summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/SCsub4
-rw-r--r--tests/core/math/test_vector2.h3
-rw-r--r--tests/core/math/test_vector3.h5
-rw-r--r--tests/core/object/test_object.h2
-rw-r--r--tests/core/string/test_string.h2
-rw-r--r--tests/core/test_time.h3
-rw-r--r--tests/servers/test_physics_2d.cpp30
-rw-r--r--tests/test_main.cpp11
8 files changed, 21 insertions, 39 deletions
diff --git a/tests/SCsub b/tests/SCsub
index 31466fffc1..25b06f2312 100644
--- a/tests/SCsub
+++ b/tests/SCsub
@@ -6,10 +6,6 @@ env.tests_sources = []
env_tests = env.Clone()
-# Include GDNative headers.
-if env["module_gdnative_enabled"]:
- env_tests.Append(CPPPATH=["#modules/gdnative/include"])
-
# We must disable the THREAD_LOCAL entirely in doctest to prevent crashes on debugging
# Since we link with /MT thread_local is always expired when the header is used
# So the debugger crashes the engine and it causes weird errors
diff --git a/tests/core/math/test_vector2.h b/tests/core/math/test_vector2.h
index ff60467bf4..9b7800164a 100644
--- a/tests/core/math/test_vector2.h
+++ b/tests/core/math/test_vector2.h
@@ -90,6 +90,9 @@ TEST_CASE("[Vector2] Interpolation methods") {
Vector2(5, 0).slerp(Vector2(0, 5), 0.5).is_equal_approx(Vector2(5, 5) * Math_SQRT12),
"Vector2 slerp with non-normalized values should work as expected.");
CHECK_MESSAGE(
+ Vector2(1, 1).slerp(Vector2(2, 2), 0.5).is_equal_approx(Vector2(1.5, 1.5)),
+ "Vector2 slerp with colinear inputs should behave as expected.");
+ CHECK_MESSAGE(
Vector2().slerp(Vector2(), 0.5) == Vector2(),
"Vector2 slerp with both inputs as zero vectors should return a zero vector.");
CHECK_MESSAGE(
diff --git a/tests/core/math/test_vector3.h b/tests/core/math/test_vector3.h
index 136a531946..6f99fada2b 100644
--- a/tests/core/math/test_vector3.h
+++ b/tests/core/math/test_vector3.h
@@ -58,7 +58,7 @@ TEST_CASE("[Vector3] Angle methods") {
CHECK_MESSAGE(
Math::is_equal_approx(vector_x.signed_angle_to(vector_y, vector_y), (real_t)Math_TAU / 4),
- "Vector3 signed_angle_to edge case should be postiive.");
+ "Vector3 signed_angle_to edge case should be positive.");
CHECK_MESSAGE(
Math::is_equal_approx(vector_x.signed_angle_to(vector_yz, vector_y), (real_t)Math_TAU / -4),
"Vector3 signed_angle_to should work as expected.");
@@ -111,6 +111,9 @@ TEST_CASE("[Vector3] Interpolation methods") {
Vector3(5, 0, 0).slerp(Vector3(0, 3, 4), 0.5).is_equal_approx(Vector3(3.535533905029296875, 2.121320486068725586, 2.828427314758300781)),
"Vector3 slerp with non-normalized values should work as expected.");
CHECK_MESSAGE(
+ Vector3(1, 1, 1).slerp(Vector3(2, 2, 2), 0.5).is_equal_approx(Vector3(1.5, 1.5, 1.5)),
+ "Vector3 slerp with colinear inputs should behave as expected.");
+ CHECK_MESSAGE(
Vector3().slerp(Vector3(), 0.5) == Vector3(),
"Vector3 slerp with both inputs as zero vectors should return a zero vector.");
CHECK_MESSAGE(
diff --git a/tests/core/object/test_object.h b/tests/core/object/test_object.h
index f9158eccec..e44b93bb66 100644
--- a/tests/core/object/test_object.h
+++ b/tests/core/object/test_object.h
@@ -87,7 +87,7 @@ public:
bool has_method(const StringName &p_method) const override {
return false;
}
- Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) override {
+ Variant callp(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) override {
return Variant();
}
void notification(int p_notification) override {
diff --git a/tests/core/string/test_string.h b/tests/core/string/test_string.h
index bf78298450..87016dddf6 100644
--- a/tests/core/string/test_string.h
+++ b/tests/core/string/test_string.h
@@ -39,7 +39,7 @@ namespace TestString {
int u32scmp(const char32_t *l, const char32_t *r) {
for (; *l == *r && *l && *r; l++, r++) {
- ;
+ // Continue.
}
return *l - *r;
}
diff --git a/tests/core/test_time.h b/tests/core/test_time.h
index 903ca9c001..bc341c73bd 100644
--- a/tests/core/test_time.h
+++ b/tests/core/test_time.h
@@ -79,6 +79,9 @@ TEST_CASE("[Time] Unix time conversion to/from datetime string") {
CHECK_MESSAGE(time->get_date_string_from_unix_time(1391904000) == "2014-02-09", "Time get_date_string_from_unix_time: The date for GODOT IS OPEN SOURCE without time is as expected.");
CHECK_MESSAGE(time->get_time_string_from_unix_time(79830) == "22:10:30", "Time get_time_string_from_unix_time: The time for GODOT IS OPEN SOURCE without date is as expected.");
CHECK_MESSAGE(time->get_datetime_string_from_unix_time(31494784780800) == "1000000-01-01T00:00:00", "Time get_datetime_string_from_unix_time: The timestamp for the year a million is as expected.");
+ CHECK_MESSAGE(time->get_offset_string_from_offset_minutes(0) == "+00:00", "Time get_offset_string_from_offset_minutes: The offset string is as expected.");
+ CHECK_MESSAGE(time->get_offset_string_from_offset_minutes(-600) == "-10:00", "Time get_offset_string_from_offset_minutes: The offset string is as expected.");
+ CHECK_MESSAGE(time->get_offset_string_from_offset_minutes(345) == "+05:45", "Time get_offset_string_from_offset_minutes: The offset string is as expected.");
}
TEST_CASE("[Time] Datetime dictionary conversion methods") {
diff --git a/tests/servers/test_physics_2d.cpp b/tests/servers/test_physics_2d.cpp
index 8b77458a33..138412ec09 100644
--- a/tests/servers/test_physics_2d.cpp
+++ b/tests/servers/test_physics_2d.cpp
@@ -84,6 +84,7 @@ class TestPhysics2DMainLoop : public MainLoop {
body_shape_data[PhysicsServer2D::SHAPE_SEGMENT].shape = segment_shape;
}
+
// CIRCLE
{
@@ -182,10 +183,7 @@ class TestPhysics2DMainLoop : public MainLoop {
}
void _do_ray_query() {
- /*
- PhysicsServer2D *ps = PhysicsServer2D::get_singleton();
- ps->query_intersection_segment(ray_query,ray_from,ray_to);
- */
+ // FIXME: Do something?
}
protected:
@@ -231,11 +229,10 @@ protected:
ps->body_set_continuous_collision_detection_mode(body, PhysicsServer2D::CCD_MODE_CAST_SHAPE);
ps->body_set_state(body, PhysicsServer2D::BODY_STATE_TRANSFORM, p_xform);
- //print_line("add body with xform: "+p_xform);
RID sprite = vs->canvas_item_create();
vs->canvas_item_set_parent(sprite, canvas);
vs->canvas_item_set_transform(sprite, p_xform);
- Size2 imgsize(5, 5); //vs->texture_get_width(body_shape_data[p_shape].image), vs->texture_get_height(body_shape_data[p_shape].image));
+ Size2 imgsize(5, 5);
vs->canvas_item_add_texture_rect(sprite, Rect2(-imgsize / 2.0, imgsize), body_shape_data[p_shape].image);
ps->body_set_force_integration_callback(body, callable_mp(this, &TestPhysics2DMainLoop::_body_moved), sprite);
@@ -326,21 +323,11 @@ public:
vs->viewport_set_size(vp, screen_size.x, screen_size.y);
vs->viewport_attach_to_screen(vp, Rect2(Vector2(), screen_size));
vs->viewport_set_active(vp, true);
-
- Transform2D smaller;
- //smaller.scale(Vector2(0.6,0.6));
- //smaller.elements[2]=Vector2(100,0);
-
- //view_xform = smaller;
vs->viewport_set_canvas_transform(vp, canvas, view_xform);
}
ray = vs->canvas_item_create();
vs->canvas_item_set_parent(ray, canvas);
- //ray_query = ps->query_create(this,"_ray_query_callback",Variant());
- //ps->query_intersection(ray_query,space);
-
- _create_body_shape_data();
for (int i = 0; i < 32; i++) {
PhysicsServer2D::ShapeType types[4] = {
@@ -352,17 +339,9 @@ public:
};
PhysicsServer2D::ShapeType type = types[i % 4];
- //type=PhysicsServer2D::SHAPE_SEGMENT;
_add_body(type, Transform2D(i * 0.8, Point2(152 + i * 40, 100 - 40 * i)));
- /*
- if (i==0)
- ps->body_set_mode(b,PhysicsServer2D::BODY_MODE_STATIC);
- */
}
- //RID b= _add_body(PhysicsServer2D::SHAPE_CIRCLE,Transform2D(0,Point2(101,140)));
- //ps->body_set_mode(b,PhysicsServer2D::BODY_MODE_STATIC);
-
Point2 prev;
Vector<Point2> parr;
@@ -376,9 +355,6 @@ public:
}
_add_concave(parr);
- //_add_world_boundary(Vector2(0.0,-1).normalized(),-300);
- //_add_world_boundary(Vector2(1,0).normalized(),50);
- //_add_world_boundary(Vector2(-1,0).normalized(),-600);
}
virtual bool process(double p_time) override {
diff --git a/tests/test_main.cpp b/tests/test_main.cpp
index 504b83c2b0..830731abcd 100644
--- a/tests/test_main.cpp
+++ b/tests/test_main.cpp
@@ -91,6 +91,11 @@
#include "tests/test_macros.h"
#include "scene/resources/default_theme/default_theme.h"
+#include "servers/navigation_server_2d.h"
+#include "servers/navigation_server_3d.h"
+#include "servers/physics_server_2d.h"
+#include "servers/physics_server_3d.h"
+#include "servers/rendering/rendering_server_default.h"
int test_main(int argc, char *argv[]) {
bool run_tests = true;
@@ -156,10 +161,6 @@ int test_main(int argc, char *argv[]) {
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-#include "servers/navigation_server_2d.h"
-#include "servers/navigation_server_3d.h"
-#include "servers/rendering/rendering_server_default.h"
-
struct GodotTestCaseListener : public doctest::IReporter {
GodotTestCaseListener(const doctest::ContextOptions &p_in) {}
@@ -205,7 +206,7 @@ struct GodotTestCaseListener : public doctest::IReporter {
memnew(InputMap);
InputMap::get_singleton()->load_default();
- make_default_theme(1.0, Ref<Font>());
+ make_default_theme(1.0, Ref<Font>(), TextServer::SUBPIXEL_POSITIONING_AUTO, TextServer::HINTING_LIGHT, true);
memnew(SceneTree);
SceneTree::get_singleton()->initialize();