summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/core/math/test_vector2.h4
-rw-r--r--tests/core/math/test_vector3.h4
-rw-r--r--tests/core/object/test_class_db.h2
-rw-r--r--tests/core/os/test_os.h2
-rw-r--r--tests/display_server_mock.h22
-rw-r--r--tests/scene/test_instance_placeholder.h2
-rw-r--r--tests/scene/test_node.h2
7 files changed, 15 insertions, 23 deletions
diff --git a/tests/core/math/test_vector2.h b/tests/core/math/test_vector2.h
index fc3fd6a87d..7bd494ec80 100644
--- a/tests/core/math/test_vector2.h
+++ b/tests/core/math/test_vector2.h
@@ -353,7 +353,6 @@ TEST_CASE("[Vector2] Plane methods") {
const Vector2 vector = Vector2(1.2, 3.4);
const Vector2 vector_y = Vector2(0, 1);
const Vector2 vector_normal = Vector2(0.95879811270838721622267, 0.2840883296913739899919);
- const Vector2 vector_non_normal = Vector2(5.4, 1.6);
const real_t p_d = 99.1;
CHECK_MESSAGE(
vector.bounce(vector_y) == Vector2(1.2, -3.4),
@@ -383,6 +382,8 @@ TEST_CASE("[Vector2] Plane methods") {
vector.slide(vector_normal).is_equal_approx(Vector2(-0.8292559899117276166456, 2.798738965952080706179)),
"Vector2 slide with normal should return expected value.");
// There's probably a better way to test these ones?
+#ifdef MATH_CHECKS
+ const Vector2 vector_non_normal = Vector2(5.4, 1.6);
ERR_PRINT_OFF;
CHECK_MESSAGE(
vector.bounce(vector_non_normal).is_equal_approx(Vector2()),
@@ -394,6 +395,7 @@ TEST_CASE("[Vector2] Plane methods") {
vector.slide(vector_non_normal).is_equal_approx(Vector2()),
"Vector2 slide should return empty Vector2 with non-normalized input.");
ERR_PRINT_ON;
+#endif // MATH_CHECKS
}
TEST_CASE("[Vector2] Rounding methods") {
diff --git a/tests/core/math/test_vector3.h b/tests/core/math/test_vector3.h
index ca0aa02882..4cab753d6f 100644
--- a/tests/core/math/test_vector3.h
+++ b/tests/core/math/test_vector3.h
@@ -368,7 +368,6 @@ TEST_CASE("[Vector3] Plane methods") {
const Vector3 vector = Vector3(1.2, 3.4, 5.6);
const Vector3 vector_y = Vector3(0, 1, 0);
const Vector3 vector_normal = Vector3(0.88763458893247992491, 0.26300284116517923701, 0.37806658417494515320);
- const Vector3 vector_non_normal = Vector3(5.4, 1.6, 2.3);
CHECK_MESSAGE(
vector.bounce(vector_y) == Vector3(1.2, -3.4, 5.6),
"Vector3 bounce on a plane with normal of the Y axis should.");
@@ -394,6 +393,8 @@ TEST_CASE("[Vector3] Plane methods") {
vector.slide(vector_normal).is_equal_approx(Vector3(-2.41848149148878681437, 2.32785733585517427722237, 4.0587949202918130235)),
"Vector3 slide with normal should return expected value.");
// There's probably a better way to test these ones?
+#ifdef MATH_CHECKS
+ const Vector3 vector_non_normal = Vector3(5.4, 1.6, 2.3);
ERR_PRINT_OFF;
CHECK_MESSAGE(
vector.bounce(vector_non_normal).is_equal_approx(Vector3()),
@@ -405,6 +406,7 @@ TEST_CASE("[Vector3] Plane methods") {
vector.slide(vector_non_normal).is_equal_approx(Vector3()),
"Vector3 slide should return empty Vector3 with non-normalized input.");
ERR_PRINT_ON;
+#endif // MATH_CHECKS
}
TEST_CASE("[Vector3] Rounding methods") {
diff --git a/tests/core/object/test_class_db.h b/tests/core/object/test_class_db.h
index 381d759e5b..358bbc08a3 100644
--- a/tests/core/object/test_class_db.h
+++ b/tests/core/object/test_class_db.h
@@ -375,8 +375,10 @@ void validate_property(const Context &p_context, const ExposedClass &p_class, co
}
void validate_argument(const Context &p_context, const ExposedClass &p_class, const String &p_owner_name, const String &p_owner_type, const ArgumentData &p_arg) {
+#ifdef DEBUG_METHODS_ENABLED
TEST_COND((p_arg.name.is_empty() || p_arg.name.begins_with("_unnamed_arg")),
vformat("Unnamed argument in position %d of %s '%s.%s'.", p_arg.position, p_owner_type, p_class.name, p_owner_name));
+#endif // DEBUG_METHODS_ENABLED
const ExposedClass *arg_class = p_context.find_exposed_class(p_arg.type);
if (arg_class) {
diff --git a/tests/core/os/test_os.h b/tests/core/os/test_os.h
index 6ee0ff82e7..1e2f5e222b 100644
--- a/tests/core/os/test_os.h
+++ b/tests/core/os/test_os.h
@@ -163,12 +163,14 @@ TEST_CASE("[OS] Processor count and memory information") {
CHECK_MESSAGE(
OS::get_singleton()->get_processor_count() >= 1,
"The returned processor count should be greater than zero.");
+#ifdef DEBUG_ENABLED
CHECK_MESSAGE(
OS::get_singleton()->get_static_memory_usage() >= 1,
"The returned static memory usage should be greater than zero.");
CHECK_MESSAGE(
OS::get_singleton()->get_static_memory_peak_usage() >= 1,
"The returned static memory peak usage should be greater than zero.");
+#endif // DEBUG_ENABLED
}
TEST_CASE("[OS] Execute") {
diff --git a/tests/display_server_mock.h b/tests/display_server_mock.h
index e4946995a7..b44ff06b35 100644
--- a/tests/display_server_mock.h
+++ b/tests/display_server_mock.h
@@ -36,7 +36,7 @@
#include "servers/rendering/dummy/rasterizer_dummy.h"
// Specialized DisplayServer for unittests based on DisplayServerHeadless, that
-// additionally supports rudimentary InputEvent handling and mouse position.
+// additionally supports things like mouse enter/exit events and clipboard.
class DisplayServerMock : public DisplayServerHeadless {
private:
friend class DisplayServer;
@@ -45,7 +45,6 @@ private:
CursorShape cursor_shape = CursorShape::CURSOR_ARROW;
bool window_over = false;
Callable event_callback;
- Callable input_event_callback;
String clipboard_text;
String primary_clipboard_text;
@@ -62,16 +61,6 @@ private:
return memnew(DisplayServerMock());
}
- static void _dispatch_input_events(const Ref<InputEvent> &p_event) {
- static_cast<DisplayServerMock *>(get_singleton())->_dispatch_input_event(p_event);
- }
-
- void _dispatch_input_event(const Ref<InputEvent> &p_event) {
- if (input_event_callback.is_valid()) {
- input_event_callback.call(p_event);
- }
- }
-
void _set_mouse_position(const Point2i &p_position) {
if (mouse_position == p_position) {
return;
@@ -153,18 +142,9 @@ public:
event_callback = p_callable;
}
- virtual void window_set_input_event_callback(const Callable &p_callable, WindowID p_window = MAIN_WINDOW_ID) override {
- input_event_callback = p_callable;
- }
-
static void register_mock_driver() {
register_create_function("mock", create_func, get_rendering_drivers_func);
}
-
- DisplayServerMock() {
- Input::get_singleton()->set_event_dispatch_function(_dispatch_input_events);
- }
- ~DisplayServerMock() {}
};
#endif // DISPLAY_SERVER_MOCK_H
diff --git a/tests/scene/test_instance_placeholder.h b/tests/scene/test_instance_placeholder.h
index d915c5d961..17f2151d54 100644
--- a/tests/scene/test_instance_placeholder.h
+++ b/tests/scene/test_instance_placeholder.h
@@ -333,6 +333,7 @@ TEST_CASE("[SceneTree][InstancePlaceholder] Instantiate from placeholder with ov
}
}
+#ifdef TOOLS_ENABLED
TEST_CASE("[SceneTree][InstancePlaceholder] Instance a PackedScene containing an InstancePlaceholder with no overrides") {
GDREGISTER_CLASS(_TestInstancePlaceholderNode);
@@ -526,6 +527,7 @@ TEST_CASE("[SceneTree][InstancePlaceholder] Instance a PackedScene containing an
DirAccess::remove_file_or_error(internal_path);
DirAccess::remove_file_or_error(main_path);
}
+#endif // TOOLS_ENABLED
} //namespace TestInstancePlaceholder
diff --git a/tests/scene/test_node.h b/tests/scene/test_node.h
index 05764d8f29..e387c73f9f 100644
--- a/tests/scene/test_node.h
+++ b/tests/scene/test_node.h
@@ -529,6 +529,7 @@ TEST_CASE("[SceneTree][Node]Exported node checks") {
memdelete(dup);
}
+#ifdef TOOLS_ENABLED
SUBCASE("Saving instance with exported nodes should not store the unchanged property") {
Ref<PackedScene> ps;
ps.instantiate();
@@ -602,6 +603,7 @@ TEST_CASE("[SceneTree][Node]Exported node checks") {
}
CHECK_EQ(stored_properties, 2);
}
+#endif // TOOLS_ENABLED
memdelete(node);
}