diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/core/io/test_xml_parser.h | 2 | ||||
-rw-r--r-- | tests/scene/test_arraymesh.h | 21 | ||||
-rw-r--r-- | tests/scene/test_code_edit.h | 48 | ||||
-rw-r--r-- | tests/scene/test_primitives.h | 2 |
4 files changed, 39 insertions, 34 deletions
diff --git a/tests/core/io/test_xml_parser.h b/tests/core/io/test_xml_parser.h index f4e3f34be2..40cbea2dab 100644 --- a/tests/core/io/test_xml_parser.h +++ b/tests/core/io/test_xml_parser.h @@ -54,7 +54,7 @@ TEST_CASE("[XMLParser] End-to-end") { CHECK(parser.get_node_type() == XMLParser::NodeType::NODE_ELEMENT); CHECK(parser.get_node_name() == "top"); CHECK(parser.has_attribute("attr")); - CHECK(parser.get_attribute_value("attr") == "attr value"); + CHECK(parser.get_named_attribute_value("attr") == "attr value"); CHECK(parser.read() == OK); CHECK(parser.get_node_type() == XMLParser::NodeType::NODE_TEXT); diff --git a/tests/scene/test_arraymesh.h b/tests/scene/test_arraymesh.h index 4d9feeb4fa..b2a2ecc3bf 100644 --- a/tests/scene/test_arraymesh.h +++ b/tests/scene/test_arraymesh.h @@ -114,6 +114,17 @@ TEST_CASE("[SceneTree][ArrayMesh] Adding and modifying blendshapes.") { CHECK(mesh->get_blend_shape_count() == 0); } + SUBCASE("Can't add surface with incorrect number of blend shapes.") { + mesh->add_blend_shape(name_a); + mesh->add_blend_shape(name_b); + Ref<CylinderMesh> cylinder = memnew(CylinderMesh); + Array cylinder_array{}; + ERR_PRINT_OFF + mesh->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES, cylinder_array); + ERR_PRINT_ON + CHECK(mesh->get_surface_count() == 0); + } + SUBCASE("Can't clear blend shapes after surface had been added.") { mesh->add_blend_shape(name_a); mesh->add_blend_shape(name_b); @@ -121,7 +132,15 @@ TEST_CASE("[SceneTree][ArrayMesh] Adding and modifying blendshapes.") { Array cylinder_array{}; cylinder_array.resize(Mesh::ARRAY_MAX); cylinder->create_mesh_array(cylinder_array, 3.f, 3.f, 5.f); - mesh->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES, cylinder_array); + Array blend_shape{}; + blend_shape.resize(Mesh::ARRAY_MAX); + blend_shape[Mesh::ARRAY_VERTEX] = cylinder_array[Mesh::ARRAY_VERTEX]; + blend_shape[Mesh::ARRAY_NORMAL] = cylinder_array[Mesh::ARRAY_NORMAL]; + blend_shape[Mesh::ARRAY_TANGENT] = cylinder_array[Mesh::ARRAY_TANGENT]; + Array blend_shapes{}; + blend_shapes.push_back(blend_shape); + blend_shapes.push_back(blend_shape); + mesh->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES, cylinder_array, blend_shapes); ERR_PRINT_OFF mesh->clear_blend_shapes(); diff --git a/tests/scene/test_code_edit.h b/tests/scene/test_code_edit.h index 5447c99a64..e98aece305 100644 --- a/tests/scene/test_code_edit.h +++ b/tests/scene/test_code_edit.h @@ -1954,7 +1954,7 @@ TEST_CASE("[SceneTree][CodeEdit] indent") { code_edit->set_editable(false); - code_edit->do_unindent(); + code_edit->unindent_lines(); CHECK(code_edit->get_line(0) == "\t"); code_edit->unindent_lines(); @@ -1963,16 +1963,9 @@ TEST_CASE("[SceneTree][CodeEdit] indent") { code_edit->set_editable(true); /* Simple unindent. */ - code_edit->do_unindent(); + code_edit->unindent_lines(); CHECK(code_edit->get_line(0) == ""); - /* Should inindent inplace. */ - code_edit->set_text(""); - code_edit->insert_text_at_caret("test\t"); - - code_edit->do_unindent(); - CHECK(code_edit->get_line(0) == "test"); - /* Backspace does a simple unindent. */ code_edit->set_text(""); code_edit->insert_text_at_caret("\t"); @@ -1987,7 +1980,7 @@ TEST_CASE("[SceneTree][CodeEdit] indent") { /* Caret on col zero unindent line. */ code_edit->set_text("\t\ttest"); - code_edit->do_unindent(); + code_edit->unindent_lines(); CHECK(code_edit->get_line(0) == "\ttest"); /* Check input action. */ @@ -1998,34 +1991,34 @@ TEST_CASE("[SceneTree][CodeEdit] indent") { /* Selection does entire line. */ code_edit->set_text("\t\ttest"); code_edit->select_all(); - code_edit->do_unindent(); + code_edit->unindent_lines(); CHECK(code_edit->get_line(0) == "\ttest"); /* Handles multiple lines. */ code_edit->set_text("\ttest\n\ttext"); code_edit->select_all(); - code_edit->do_unindent(); + code_edit->unindent_lines(); CHECK(code_edit->get_line(0) == "test"); CHECK(code_edit->get_line(1) == "text"); /* Do not unindent line if last col is zero. */ code_edit->set_text("\ttest\n\ttext"); code_edit->select(0, 0, 1, 0); - code_edit->do_unindent(); + code_edit->unindent_lines(); CHECK(code_edit->get_line(0) == "test"); CHECK(code_edit->get_line(1) == "\ttext"); /* Unindent even if last column of first line. */ code_edit->set_text("\ttest\n\ttext"); code_edit->select(0, 5, 1, 1); - code_edit->do_unindent(); + code_edit->unindent_lines(); CHECK(code_edit->get_line(0) == "test"); CHECK(code_edit->get_line(1) == "text"); /* Check selection is adjusted. */ code_edit->set_text("\ttest"); code_edit->select(0, 1, 0, 2); - code_edit->do_unindent(); + code_edit->unindent_lines(); CHECK(code_edit->get_selection_from_column() == 0); CHECK(code_edit->get_selection_to_column() == 1); CHECK(code_edit->get_line(0) == "test"); @@ -2041,7 +2034,7 @@ TEST_CASE("[SceneTree][CodeEdit] indent") { code_edit->set_editable(false); - code_edit->do_unindent(); + code_edit->unindent_lines(); CHECK(code_edit->get_line(0) == " "); code_edit->unindent_lines(); @@ -2050,16 +2043,9 @@ TEST_CASE("[SceneTree][CodeEdit] indent") { code_edit->set_editable(true); /* Simple unindent. */ - code_edit->do_unindent(); + code_edit->unindent_lines(); CHECK(code_edit->get_line(0) == ""); - /* Should inindent inplace. */ - code_edit->set_text(""); - code_edit->insert_text_at_caret("test "); - - code_edit->do_unindent(); - CHECK(code_edit->get_line(0) == "test"); - /* Backspace does a simple unindent. */ code_edit->set_text(""); code_edit->insert_text_at_caret(" "); @@ -2080,12 +2066,12 @@ TEST_CASE("[SceneTree][CodeEdit] indent") { /* Caret on col zero unindent line. */ code_edit->set_text(" test"); - code_edit->do_unindent(); + code_edit->unindent_lines(); CHECK(code_edit->get_line(0) == " test"); /* Only as far as needed */ code_edit->set_text(" test"); - code_edit->do_unindent(); + code_edit->unindent_lines(); CHECK(code_edit->get_line(0) == " test"); /* Check input action. */ @@ -2096,34 +2082,34 @@ TEST_CASE("[SceneTree][CodeEdit] indent") { /* Selection does entire line. */ code_edit->set_text(" test"); code_edit->select_all(); - code_edit->do_unindent(); + code_edit->unindent_lines(); CHECK(code_edit->get_line(0) == " test"); /* Handles multiple lines. */ code_edit->set_text(" test\n text"); code_edit->select_all(); - code_edit->do_unindent(); + code_edit->unindent_lines(); CHECK(code_edit->get_line(0) == "test"); CHECK(code_edit->get_line(1) == "text"); /* Do not unindent line if last col is zero. */ code_edit->set_text(" test\n text"); code_edit->select(0, 0, 1, 0); - code_edit->do_unindent(); + code_edit->unindent_lines(); CHECK(code_edit->get_line(0) == "test"); CHECK(code_edit->get_line(1) == " text"); /* Unindent even if last column of first line. */ code_edit->set_text(" test\n text"); code_edit->select(0, 5, 1, 1); - code_edit->do_unindent(); + code_edit->unindent_lines(); CHECK(code_edit->get_line(0) == "test"); CHECK(code_edit->get_line(1) == "text"); /* Check selection is adjusted. */ code_edit->set_text(" test"); code_edit->select(0, 4, 0, 5); - code_edit->do_unindent(); + code_edit->unindent_lines(); CHECK(code_edit->get_selection_from_column() == 0); CHECK(code_edit->get_selection_to_column() == 1); CHECK(code_edit->get_line(0) == "test"); diff --git a/tests/scene/test_primitives.h b/tests/scene/test_primitives.h index 6cdb5fb0a5..9232a3020d 100644 --- a/tests/scene/test_primitives.h +++ b/tests/scene/test_primitives.h @@ -734,7 +734,7 @@ TEST_CASE("[SceneTree][Primitive][Text] Text Primitive") { text->get_structured_text_bidi_override() == TextServer::STRUCTURED_TEXT_FILE || text->get_structured_text_bidi_override() == TextServer::STRUCTURED_TEXT_EMAIL || text->get_structured_text_bidi_override() == TextServer::STRUCTURED_TEXT_LIST || - text->get_structured_text_bidi_override() == TextServer::STRUCTURED_TEXT_NONE || + text->get_structured_text_bidi_override() == TextServer::STRUCTURED_TEXT_GDSCRIPT || text->get_structured_text_bidi_override() == TextServer::STRUCTURED_TEXT_CUSTOM)); CHECK(text->get_structured_text_bidi_override_options().size() >= 0); CHECK(text->get_width() > 0); |