diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_command_queue.h | 4 | ||||
-rw-r--r-- | tests/test_geometry_2d.h | 2 | ||||
-rw-r--r-- | tests/test_list.h | 2 | ||||
-rw-r--r-- | tests/test_physics_2d.cpp | 5 | ||||
-rw-r--r-- | tests/test_physics_3d.cpp | 9 | ||||
-rw-r--r-- | tests/test_shader_lang.cpp | 2 | ||||
-rw-r--r-- | tests/test_string.h | 21 |
7 files changed, 24 insertions, 21 deletions
diff --git a/tests/test_command_queue.h b/tests/test_command_queue.h index b4fa63ad2b..2f0f62f5c8 100644 --- a/tests/test_command_queue.h +++ b/tests/test_command_queue.h @@ -31,14 +31,14 @@ #ifndef TEST_COMMAND_QUEUE_H #define TEST_COMMAND_QUEUE_H -#include "test_command_queue.h" - #include "core/config/project_settings.h" +#include "core/math/random_number_generator.h" #include "core/os/mutex.h" #include "core/os/os.h" #include "core/os/semaphore.h" #include "core/os/thread.h" #include "core/templates/command_queue_mt.h" +#include "test_macros.h" #if !defined(NO_THREADS) diff --git a/tests/test_geometry_2d.h b/tests/test_geometry_2d.h index ea02d1114f..c9313f3625 100644 --- a/tests/test_geometry_2d.h +++ b/tests/test_geometry_2d.h @@ -113,7 +113,7 @@ TEST_CASE("[Geometry2D] Polygon clockwise") { p.push_back(Vector2(1, 5)); CHECK(Geometry2D::is_polygon_clockwise(p)); - p.invert(); + p.reverse(); CHECK_FALSE(Geometry2D::is_polygon_clockwise(p)); } diff --git a/tests/test_list.h b/tests/test_list.h index 1c70b6e961..52d5edff70 100644 --- a/tests/test_list.h +++ b/tests/test_list.h @@ -260,7 +260,7 @@ TEST_CASE("[List] Invert") { List<int>::Element *n[4]; populate_integers(list, n, 4); - list.invert(); + list.reverse(); CHECK(list.front()->get() == 3); CHECK(list.front()->next()->get() == 2); diff --git a/tests/test_physics_2d.cpp b/tests/test_physics_2d.cpp index 047697e314..25b2871890 100644 --- a/tests/test_physics_2d.cpp +++ b/tests/test_physics_2d.cpp @@ -243,9 +243,7 @@ protected: Size2 imgsize(5, 5); //vs->texture_get_width(body_shape_data[p_shape].image), vs->texture_get_height(body_shape_data[p_shape].image)); 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, this, "_body_moved", sprite); - //RID q = ps->query_create(this,"_body_moved",sprite); - //ps->query_body_state(q,body); + ps->body_set_force_integration_callback(body, callable_mp(this, &TestPhysics2DMainLoop::_body_moved), sprite); return body; } @@ -310,7 +308,6 @@ protected: } static void _bind_methods() { - ClassDB::bind_method(D_METHOD("_body_moved"), &TestPhysics2DMainLoop::_body_moved); ClassDB::bind_method(D_METHOD("_ray_query_callback"), &TestPhysics2DMainLoop::_ray_query_callback); } diff --git a/tests/test_physics_3d.cpp b/tests/test_physics_3d.cpp index bb324d8ffe..ac8078a0a8 100644 --- a/tests/test_physics_3d.cpp +++ b/tests/test_physics_3d.cpp @@ -77,10 +77,6 @@ class TestPhysics3DMainLoop : public MainLoop { bool quit; protected: - static void _bind_methods() { - ClassDB::bind_method("body_changed_transform", &TestPhysics3DMainLoop::body_changed_transform); - } - RID create_body(PhysicsServer3D::ShapeType p_shape, PhysicsServer3D::BodyMode p_body, const Transform p_location, bool p_active_default = true, const Transform &p_shape_xform = Transform()) { RenderingServer *vs = RenderingServer::get_singleton(); PhysicsServer3D *ps = PhysicsServer3D::get_singleton(); @@ -93,7 +89,7 @@ protected: ps->body_set_param(body, PhysicsServer3D::BODY_PARAM_BOUNCE, 0.0); //todo set space ps->body_add_shape(body, type_shape_map[p_shape]); - ps->body_set_force_integration_callback(body, this, "body_changed_transform", mesh_instance); + ps->body_set_force_integration_callback(body, callable_mp(this, &TestPhysics3DMainLoop::body_changed_transform), mesh_instance); ps->body_set_state(body, PhysicsServer3D::BODY_STATE_TRANSFORM, p_location); bodies.push_back(body); @@ -370,8 +366,7 @@ public: ps->body_set_space(character, space); //todo add space ps->body_add_shape(character, capsule_shape); - - ps->body_set_force_integration_callback(character, this, "body_changed_transform", mesh_instance); + ps->body_set_force_integration_callback(character, callable_mp(this, &TestPhysics3DMainLoop::body_changed_transform), mesh_instance); ps->body_set_state(character, PhysicsServer3D::BODY_STATE_TRANSFORM, Transform(Basis(), Vector3(-2, 5, -2))); bodies.push_back(character); diff --git a/tests/test_shader_lang.cpp b/tests/test_shader_lang.cpp index a023f35506..2169350c02 100644 --- a/tests/test_shader_lang.cpp +++ b/tests/test_shader_lang.cpp @@ -344,7 +344,7 @@ MainLoop *test() { Set<String> types; types.insert("spatial"); - Error err = sl.compile(code, dt, rm, types, nullptr); + Error err = sl.compile(code, dt, rm, ShaderLanguage::VaryingFunctionNames(), types, nullptr); if (err) { print_line("Error at line: " + rtos(sl.get_error_line()) + ": " + sl.get_error_text()); diff --git a/tests/test_string.h b/tests/test_string.h index 6febf22765..486c17dbbd 100644 --- a/tests/test_string.h +++ b/tests/test_string.h @@ -860,10 +860,10 @@ TEST_CASE("[String] match") { } TEST_CASE("[String] IPVX address to string") { - IP_Address ip0("2001:0db8:85a3:0000:0000:8a2e:0370:7334"); - IP_Address ip(0x0123, 0x4567, 0x89ab, 0xcdef, true); - IP_Address ip2("fe80::52e5:49ff:fe93:1baf"); - IP_Address ip3("::ffff:192.168.0.1"); + IPAddress ip0("2001:0db8:85a3:0000:0000:8a2e:0370:7334"); + IPAddress ip(0x0123, 0x4567, 0x89ab, 0xcdef, true); + IPAddress ip2("fe80::52e5:49ff:fe93:1baf"); + IPAddress ip3("::ffff:192.168.0.1"); String ip4 = "192.168.0.1"; CHECK(ip4.is_valid_ip_address()); @@ -1045,7 +1045,7 @@ TEST_CASE("[String] lstrip and rstrip") { TEST_CASE("[String] ensuring empty string into parse_utf8 passes empty string") { String empty; - CHECK(empty.parse_utf8(NULL, -1)); + CHECK(empty.parse_utf8(nullptr, -1)); } TEST_CASE("[String] Cyrillic to_lower()") { @@ -1156,6 +1156,17 @@ TEST_CASE("[String] uri_encode/unescape") { String s = "Godot Engine:'docs'"; String t = "Godot%20Engine%3A%27docs%27"; + String x1 = "T%C4%93%C5%A1t"; + static const uint8_t u8str[] = { 0x54, 0xC4, 0x93, 0xC5, 0xA1, 0x74, 0x00 }; + String x2 = String::utf8((const char *)u8str); + String x3 = U"Tēšt"; + + CHECK(x1.uri_decode() == x2); + CHECK(x1.uri_decode() == x3); + CHECK((x1 + x3).uri_decode() == (x2 + x3)); // Mixed unicode and URL encoded string, e.g. GTK+ bookmark. + CHECK(x2.uri_encode() == x1); + CHECK(x3.uri_encode() == x1); + CHECK(s.uri_encode() == t); CHECK(t.uri_decode() == s); } |