diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/data/translations.csv | 5 | ||||
-rw-r--r-- | tests/test_astar.h | 2 | ||||
-rw-r--r-- | tests/test_file_access.h | 29 | ||||
-rw-r--r-- | tests/test_math.cpp | 4 | ||||
-rw-r--r-- | tests/test_physics_2d.cpp | 2 | ||||
-rw-r--r-- | tests/test_render.cpp | 2 |
6 files changed, 34 insertions, 10 deletions
diff --git a/tests/data/translations.csv b/tests/data/translations.csv index 4c9ad4996a..8cb7b800c5 100644 --- a/tests/data/translations.csv +++ b/tests/data/translations.csv @@ -1,3 +1,8 @@ keys,en,de GOOD_MORNING,"Good Morning","Guten Morgen" GOOD_EVENING,"Good Evening","" +Without quotes,"With, comma","With ""inner"" quotes","With ""inner"", quotes"","" and comma","With ""inner +split"" quotes and +line breaks","With \nnewline chars" +Some other~delimiter~should still work, shouldn't it? +What about tab separated lines, good? diff --git a/tests/test_astar.h b/tests/test_astar.h index 12664a5ff1..137c477946 100644 --- a/tests/test_astar.h +++ b/tests/test_astar.h @@ -63,7 +63,7 @@ public: } // Disable heuristic completely. - float _compute_cost(int p_from, int p_to) { + real_t _compute_cost(int p_from, int p_to) { if (p_from == A && p_to == C) { return 1000; } diff --git a/tests/test_file_access.h b/tests/test_file_access.h index cb74e08a0d..b3da16c1d1 100644 --- a/tests/test_file_access.h +++ b/tests/test_file_access.h @@ -37,12 +37,12 @@ namespace TestFileAccess { TEST_CASE("[FileAccess] CSV read") { - FileAccess *f = FileAccess::open(TestUtils::get_data_path("translations.csv"), FileAccess::READ); + FileAccessRef f = FileAccess::open(TestUtils::get_data_path("translations.csv"), FileAccess::READ); - Vector<String> header = f->get_csv_line(); // Default delimiter: "," + Vector<String> header = f->get_csv_line(); // Default delimiter: ",". REQUIRE(header.size() == 3); - Vector<String> row1 = f->get_csv_line(","); + Vector<String> row1 = f->get_csv_line(","); // Explicit delimiter, should be the same. REQUIRE(row1.size() == 3); CHECK(row1[0] == "GOOD_MORNING"); CHECK(row1[1] == "Good Morning"); @@ -53,12 +53,31 @@ TEST_CASE("[FileAccess] CSV read") { CHECK(row2[0] == "GOOD_EVENING"); CHECK(row2[1] == "Good Evening"); CHECK(row2[2] == ""); // Use case: not yet translated! - // https://github.com/godotengine/godot/issues/44269 CHECK_MESSAGE(row2[2] != "\"", "Should not parse empty string as a single double quote."); + Vector<String> row3 = f->get_csv_line(); + REQUIRE(row3.size() == 6); + CHECK(row3[0] == "Without quotes"); + CHECK(row3[1] == "With, comma"); + CHECK(row3[2] == "With \"inner\" quotes"); + CHECK(row3[3] == "With \"inner\", quotes\",\" and comma"); + CHECK(row3[4] == "With \"inner\nsplit\" quotes and\nline breaks"); + CHECK(row3[5] == "With \\nnewline chars"); // Escaped, not an actual newline. + + Vector<String> row4 = f->get_csv_line("~"); // Custom delimiter, makes inline commas easier. + REQUIRE(row4.size() == 3); + CHECK(row4[0] == "Some other"); + CHECK(row4[1] == "delimiter"); + CHECK(row4[2] == "should still work, shouldn't it?"); + + Vector<String> row5 = f->get_csv_line("\t"); // Tab separated variables. + REQUIRE(row5.size() == 3); + CHECK(row5[0] == "What about"); + CHECK(row5[1] == "tab separated"); + CHECK(row5[2] == "lines, good?"); + f->close(); - memdelete(f); } } // namespace TestFileAccess diff --git a/tests/test_math.cpp b/tests/test_math.cpp index d0b9fdef4b..a44040dfe2 100644 --- a/tests/test_math.cpp +++ b/tests/test_math.cpp @@ -589,13 +589,13 @@ MainLoop *test() { { Vector3 v(1, 2, 3); v.normalize(); - float a = 0.3; + real_t a = 0.3; Basis m(v, a); Vector3 v2(7, 3, 1); v2.normalize(); - float a2 = 0.8; + real_t a2 = 0.8; Basis m2(v2, a2); diff --git a/tests/test_physics_2d.cpp b/tests/test_physics_2d.cpp index 40dc74e89c..61b8951afa 100644 --- a/tests/test_physics_2d.cpp +++ b/tests/test_physics_2d.cpp @@ -255,7 +255,7 @@ protected: arr.push_back(p_normal); arr.push_back(p_d); - RID plane = ps->line_shape_create(); + RID plane = ps->world_margin_shape_create(); ps->shape_set_data(plane, arr); RID plane_body = ps->body_create(); diff --git a/tests/test_render.cpp b/tests/test_render.cpp index beff86dd83..21b4da9b3b 100644 --- a/tests/test_render.cpp +++ b/tests/test_render.cpp @@ -184,7 +184,7 @@ public: light = vs->instance_create2(lightaux, scenario); Transform3D lla; //lla.set_look_at(Vector3(),Vector3(1, -1, 1)); - lla.set_look_at(Vector3(), Vector3(0.0, -0.836026, -0.548690)); + lla.basis = Basis::looking_at(Vector3(0.0, -0.836026, -0.548690)); vs->instance_set_transform(light, lla); |