Use initializer list in Arrays
This commit is contained in:
@@ -148,9 +148,7 @@ TEST_CASE("[SceneTree][ArrayMesh] Adding and modifying blendshapes.") {
|
||||
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);
|
||||
Array blend_shapes = { blend_shape, blend_shape };
|
||||
mesh->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES, cylinder_array, blend_shapes);
|
||||
mesh->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES, cylinder_array, blend_shapes);
|
||||
|
||||
@@ -188,9 +186,7 @@ TEST_CASE("[SceneTree][ArrayMesh] Adding and modifying blendshapes.") {
|
||||
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);
|
||||
Array blend_shapes = { blend_shape, blend_shape };
|
||||
mesh->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES, cylinder_array, blend_shapes);
|
||||
|
||||
ERR_PRINT_OFF
|
||||
|
||||
@@ -905,8 +905,7 @@ TEST_CASE("[SceneTree][CodeEdit] delimiters") {
|
||||
CHECK(code_edit->get_string_delimiters().size() == 2);
|
||||
|
||||
/* Set should override existing, and test multiline */
|
||||
TypedArray<String> delimiters;
|
||||
delimiters.push_back("^^ ^^");
|
||||
TypedArray<String> delimiters = { "^^ ^^" };
|
||||
|
||||
code_edit->set_string_delimiters(delimiters);
|
||||
CHECK_FALSE(code_edit->has_string_delimiter("\""));
|
||||
@@ -971,8 +970,7 @@ TEST_CASE("[SceneTree][CodeEdit] delimiters") {
|
||||
CHECK(code_edit->get_comment_delimiters().size() == 2);
|
||||
|
||||
/* Set should override existing, and test multiline. */
|
||||
TypedArray<String> delimiters;
|
||||
delimiters.push_back("^^ ^^");
|
||||
TypedArray<String> delimiters = { "^^ ^^" };
|
||||
|
||||
code_edit->set_comment_delimiters(delimiters);
|
||||
CHECK_FALSE(code_edit->has_comment_delimiter("\""));
|
||||
@@ -1770,10 +1768,7 @@ TEST_CASE("[SceneTree][CodeEdit] indent") {
|
||||
CHECK(code_edit->is_indent_using_spaces());
|
||||
|
||||
/* Only the first char is registered. */
|
||||
TypedArray<String> auto_indent_prefixes;
|
||||
auto_indent_prefixes.push_back("::");
|
||||
auto_indent_prefixes.push_back("s");
|
||||
auto_indent_prefixes.push_back("1");
|
||||
TypedArray<String> auto_indent_prefixes = { "::", "s", "1" };
|
||||
code_edit->set_auto_indent_prefixes(auto_indent_prefixes);
|
||||
|
||||
auto_indent_prefixes = code_edit->get_auto_indent_prefixes();
|
||||
@@ -3936,11 +3931,7 @@ TEST_CASE("[SceneTree][CodeEdit] completion") {
|
||||
CHECK(code_edit->is_code_completion_enabled());
|
||||
|
||||
/* Set prefixes, single char only, disallow empty. */
|
||||
TypedArray<String> completion_prefixes;
|
||||
completion_prefixes.push_back("");
|
||||
completion_prefixes.push_back(".");
|
||||
completion_prefixes.push_back(".");
|
||||
completion_prefixes.push_back(",,");
|
||||
TypedArray<String> completion_prefixes = { "", ".", ".", ",," };
|
||||
|
||||
ERR_PRINT_OFF;
|
||||
code_edit->set_code_completion_prefixes(completion_prefixes);
|
||||
@@ -3958,8 +3949,7 @@ TEST_CASE("[SceneTree][CodeEdit] completion") {
|
||||
SIGNAL_WATCH(code_edit, "code_completion_requested");
|
||||
code_edit->set_code_completion_enabled(true);
|
||||
|
||||
Array signal_args;
|
||||
signal_args.push_back(Array());
|
||||
Array signal_args = { {} };
|
||||
|
||||
/* Force request. */
|
||||
code_edit->request_code_completion();
|
||||
@@ -3972,8 +3962,7 @@ TEST_CASE("[SceneTree][CodeEdit] completion") {
|
||||
SIGNAL_CHECK("code_completion_requested", signal_args);
|
||||
|
||||
/* Insert prefix. */
|
||||
TypedArray<String> completion_prefixes;
|
||||
completion_prefixes.push_back(".");
|
||||
TypedArray<String> completion_prefixes = { "." };
|
||||
code_edit->set_code_completion_prefixes(completion_prefixes);
|
||||
|
||||
code_edit->insert_text_at_caret(".");
|
||||
|
||||
@@ -1034,8 +1034,7 @@ TEST_CASE("[SceneTree][Control] Grow direction") {
|
||||
}
|
||||
|
||||
SIGNAL_WATCH(test_control, SNAME("minimum_size_changed"))
|
||||
Array signal_args;
|
||||
signal_args.push_back(Array());
|
||||
Array signal_args = { {} };
|
||||
|
||||
SUBCASE("Horizontal grow direction begin") {
|
||||
test_control->set_h_grow_direction(Control::GROW_DIRECTION_BEGIN);
|
||||
|
||||
@@ -502,10 +502,11 @@ TEST_CASE("[SceneTree][InstancePlaceholder] Instance a PackedScene containing an
|
||||
REQUIRE(final_node->get_reference_property().identity_compare(instanced_main_node->get_child(1, true)));
|
||||
Array final_array = final_node->get_reference_array_property();
|
||||
REQUIRE(final_array.size() == 3);
|
||||
Array wanted_node_array;
|
||||
wanted_node_array.push_back(instanced_main_node->get_child(2, true)); // ExternalArrayMember
|
||||
wanted_node_array.push_back(final_node->get_child(1, true)); // ArrayRef1
|
||||
wanted_node_array.push_back(final_node->get_child(2, true)); // ArrayRef2
|
||||
Array wanted_node_array = {
|
||||
instanced_main_node->get_child(2, true), // ExternalArrayMember
|
||||
final_node->get_child(1, true), // ArrayRef1
|
||||
final_node->get_child(2, true) // ArrayRef2
|
||||
};
|
||||
|
||||
// Iterate over all nodes, since the ordering is not guaranteed.
|
||||
for (int i = 0; i < wanted_node_array.size(); i++) {
|
||||
|
||||
@@ -1169,9 +1169,7 @@ TEST_CASE("[SceneTree][SplitContainer] Two children") {
|
||||
SUBCASE("[SplitContainer] Drag") {
|
||||
SUBCASE("[SplitContainer] Vertical, no expand flags") {
|
||||
SIGNAL_WATCH(split_container, "dragged");
|
||||
Array signal_args;
|
||||
signal_args.push_back(Array());
|
||||
((Array)signal_args[0]).push_back(0);
|
||||
Array signal_args = { { 0 } };
|
||||
|
||||
split_container->set_vertical(true);
|
||||
Point2 mouse_offset = Point2(1, 1);
|
||||
|
||||
@@ -59,8 +59,7 @@ TEST_CASE("[SceneTree][TextEdit] text entry") {
|
||||
SceneTree::get_singleton()->get_root()->add_child(text_edit);
|
||||
text_edit->grab_focus();
|
||||
|
||||
Array empty_signal_args;
|
||||
empty_signal_args.push_back(Array());
|
||||
Array empty_signal_args = { {} };
|
||||
|
||||
SUBCASE("[TextEdit] text entry") {
|
||||
SIGNAL_WATCH(text_edit, "text_set");
|
||||
@@ -6445,8 +6444,7 @@ TEST_CASE("[SceneTree][TextEdit] versioning") {
|
||||
|
||||
CHECK(text_edit->get_caret_count() == 1);
|
||||
|
||||
Array caret_index;
|
||||
caret_index.push_back(0);
|
||||
Array caret_index = { 0 };
|
||||
|
||||
for (int i = 1; i < 4; i++) {
|
||||
caret_index.push_back(text_edit->add_caret(i, 0));
|
||||
@@ -6710,8 +6708,7 @@ TEST_CASE("[SceneTree][TextEdit] multicaret") {
|
||||
SceneTree::get_singleton()->get_root()->add_child(text_edit);
|
||||
text_edit->set_multiple_carets_enabled(true);
|
||||
|
||||
Array empty_signal_args;
|
||||
empty_signal_args.push_back(Array());
|
||||
Array empty_signal_args = { {} };
|
||||
|
||||
SIGNAL_WATCH(text_edit, "caret_changed");
|
||||
|
||||
@@ -8005,8 +8002,7 @@ TEST_CASE("[SceneTree][TextEdit] gutters") {
|
||||
TextEdit *text_edit = memnew(TextEdit);
|
||||
SceneTree::get_singleton()->get_root()->add_child(text_edit);
|
||||
|
||||
Array empty_signal_args;
|
||||
empty_signal_args.push_back(Array());
|
||||
Array empty_signal_args = { {} };
|
||||
|
||||
SIGNAL_WATCH(text_edit, "gutter_clicked");
|
||||
SIGNAL_WATCH(text_edit, "gutter_added");
|
||||
|
||||
@@ -156,9 +156,7 @@ TEST_CASE("[SceneTree][Timer] Check Timer timeout signal") {
|
||||
|
||||
SceneTree::get_singleton()->process(0.2);
|
||||
|
||||
Array signal_args;
|
||||
signal_args.push_back(Array());
|
||||
|
||||
Array signal_args = { {} };
|
||||
SIGNAL_CHECK(SNAME("timeout"), signal_args);
|
||||
|
||||
SIGNAL_UNWATCH(test_timer, SNAME("timeout"));
|
||||
@@ -170,9 +168,7 @@ TEST_CASE("[SceneTree][Timer] Check Timer timeout signal") {
|
||||
|
||||
SceneTree::get_singleton()->process(0.05);
|
||||
|
||||
Array signal_args;
|
||||
signal_args.push_back(Array());
|
||||
|
||||
Array signal_args = { {} };
|
||||
SIGNAL_CHECK_FALSE(SNAME("timeout"));
|
||||
|
||||
SIGNAL_UNWATCH(test_timer, SNAME("timeout"));
|
||||
@@ -186,9 +182,7 @@ TEST_CASE("[SceneTree][Timer] Check Timer timeout signal") {
|
||||
|
||||
SceneTree::get_singleton()->physics_process(0.2);
|
||||
|
||||
Array signal_args;
|
||||
signal_args.push_back(Array());
|
||||
|
||||
Array signal_args = { {} };
|
||||
SIGNAL_CHECK(SNAME("timeout"), signal_args);
|
||||
|
||||
SIGNAL_UNWATCH(test_timer, SNAME("timeout"));
|
||||
@@ -200,9 +194,7 @@ TEST_CASE("[SceneTree][Timer] Check Timer timeout signal") {
|
||||
|
||||
SceneTree::get_singleton()->physics_process(0.05);
|
||||
|
||||
Array signal_args;
|
||||
signal_args.push_back(Array());
|
||||
|
||||
Array signal_args = { {} };
|
||||
SIGNAL_CHECK_FALSE(SNAME("timeout"));
|
||||
|
||||
SIGNAL_UNWATCH(test_timer, SNAME("timeout"));
|
||||
|
||||
+10
-27
@@ -409,10 +409,7 @@ TEST_CASE("[SceneTree][Viewport] Controls and InputEvent handling") {
|
||||
|
||||
SUBCASE("[Viewport][GuiInputEvent] Signal 'gui_focus_changed' is only emitted if a previously unfocused Control grabs focus.") {
|
||||
SIGNAL_WATCH(root, SNAME("gui_focus_changed"));
|
||||
Array node_array;
|
||||
node_array.push_back(node_a);
|
||||
Array signal_args;
|
||||
signal_args.push_back(node_array);
|
||||
Array signal_args = { { node_a } };
|
||||
|
||||
SEND_GUI_MOUSE_BUTTON_EVENT(on_a, MouseButton::LEFT, MouseButtonMask::LEFT, Key::NONE);
|
||||
SEND_GUI_MOUSE_BUTTON_RELEASED_EVENT(on_a, MouseButton::LEFT, MouseButtonMask::NONE, Key::NONE);
|
||||
@@ -566,8 +563,7 @@ TEST_CASE("[SceneTree][Viewport] Controls and InputEvent handling") {
|
||||
SUBCASE("[Viewport][GuiInputEvent] Mouse Enter/Exit notification propagation when moving into child.") {
|
||||
SIGNAL_WATCH(node_i, SceneStringName(mouse_entered));
|
||||
SIGNAL_WATCH(node_i, SceneStringName(mouse_exited));
|
||||
Array signal_args;
|
||||
signal_args.push_back(Array());
|
||||
Array signal_args = { {} };
|
||||
|
||||
node_j->set_mouse_filter(Control::MOUSE_FILTER_PASS);
|
||||
|
||||
@@ -774,8 +770,7 @@ TEST_CASE("[SceneTree][Viewport] Controls and InputEvent handling") {
|
||||
SUBCASE("[Viewport][GuiInputEvent] Mouse Enter/Exit notification when changing top level.") {
|
||||
SIGNAL_WATCH(node_i, SceneStringName(mouse_entered));
|
||||
SIGNAL_WATCH(node_i, SceneStringName(mouse_exited));
|
||||
Array signal_args;
|
||||
signal_args.push_back(Array());
|
||||
Array signal_args = { {} };
|
||||
|
||||
node_d->set_mouse_filter(Control::MOUSE_FILTER_PASS);
|
||||
node_i->set_mouse_filter(Control::MOUSE_FILTER_PASS);
|
||||
@@ -853,8 +848,7 @@ TEST_CASE("[SceneTree][Viewport] Controls and InputEvent handling") {
|
||||
SUBCASE("[Viewport][GuiInputEvent] Mouse Enter/Exit notification when changing the mouse filter to stop.") {
|
||||
SIGNAL_WATCH(node_i, SceneStringName(mouse_entered));
|
||||
SIGNAL_WATCH(node_i, SceneStringName(mouse_exited));
|
||||
Array signal_args;
|
||||
signal_args.push_back(Array());
|
||||
Array signal_args = { {} };
|
||||
|
||||
node_i->set_mouse_filter(Control::MOUSE_FILTER_PASS);
|
||||
node_j->set_mouse_filter(Control::MOUSE_FILTER_PASS);
|
||||
@@ -906,8 +900,7 @@ TEST_CASE("[SceneTree][Viewport] Controls and InputEvent handling") {
|
||||
SUBCASE("[Viewport][GuiInputEvent] Mouse Enter/Exit notification when changing the mouse filter to ignore.") {
|
||||
SIGNAL_WATCH(node_i, SceneStringName(mouse_entered));
|
||||
SIGNAL_WATCH(node_i, SceneStringName(mouse_exited));
|
||||
Array signal_args;
|
||||
signal_args.push_back(Array());
|
||||
Array signal_args = { {} };
|
||||
|
||||
node_i->set_mouse_filter(Control::MOUSE_FILTER_PASS);
|
||||
node_j->set_mouse_filter(Control::MOUSE_FILTER_PASS);
|
||||
@@ -983,8 +976,7 @@ TEST_CASE("[SceneTree][Viewport] Controls and InputEvent handling") {
|
||||
SUBCASE("[Viewport][GuiInputEvent] Mouse Enter/Exit notification when removing the hovered Control.") {
|
||||
SIGNAL_WATCH(node_h, SceneStringName(mouse_entered));
|
||||
SIGNAL_WATCH(node_h, SceneStringName(mouse_exited));
|
||||
Array signal_args;
|
||||
signal_args.push_back(Array());
|
||||
Array signal_args = { {} };
|
||||
|
||||
node_i->set_mouse_filter(Control::MOUSE_FILTER_PASS);
|
||||
node_j->set_mouse_filter(Control::MOUSE_FILTER_PASS);
|
||||
@@ -1037,8 +1029,7 @@ TEST_CASE("[SceneTree][Viewport] Controls and InputEvent handling") {
|
||||
SUBCASE("[Viewport][GuiInputEvent] Mouse Enter/Exit notification when hiding the hovered Control.") {
|
||||
SIGNAL_WATCH(node_h, SceneStringName(mouse_entered));
|
||||
SIGNAL_WATCH(node_h, SceneStringName(mouse_exited));
|
||||
Array signal_args;
|
||||
signal_args.push_back(Array());
|
||||
Array signal_args = { {} };
|
||||
|
||||
node_i->set_mouse_filter(Control::MOUSE_FILTER_PASS);
|
||||
node_j->set_mouse_filter(Control::MOUSE_FILTER_PASS);
|
||||
@@ -1091,8 +1082,7 @@ TEST_CASE("[SceneTree][Viewport] Controls and InputEvent handling") {
|
||||
SUBCASE("[Viewport][GuiInputEvent] Window Mouse Enter/Exit signals.") {
|
||||
SIGNAL_WATCH(root, SceneStringName(mouse_entered));
|
||||
SIGNAL_WATCH(root, SceneStringName(mouse_exited));
|
||||
Array signal_args;
|
||||
signal_args.push_back(Array());
|
||||
Array signal_args = { {} };
|
||||
|
||||
SEND_GUI_MOUSE_MOTION_EVENT(on_outside, MouseButtonMask::NONE, Key::NONE);
|
||||
SIGNAL_CHECK_FALSE(SceneStringName(mouse_entered));
|
||||
@@ -1615,15 +1605,8 @@ TEST_CASE("[SceneTree][Viewport] Physics Picking 2D") {
|
||||
Point2i on_01 = Point2i(10, 50);
|
||||
Point2i on_02 = Point2i(50, 10);
|
||||
|
||||
Array empty_signal_args_2;
|
||||
empty_signal_args_2.push_back(Array());
|
||||
empty_signal_args_2.push_back(Array());
|
||||
|
||||
Array empty_signal_args_4;
|
||||
empty_signal_args_4.push_back(Array());
|
||||
empty_signal_args_4.push_back(Array());
|
||||
empty_signal_args_4.push_back(Array());
|
||||
empty_signal_args_4.push_back(Array());
|
||||
Array empty_signal_args_2 = { Array(), Array() };
|
||||
Array empty_signal_args_4 = { Array(), Array(), Array(), Array() };
|
||||
|
||||
for (PickingCollider E : v) {
|
||||
E.a->init_signals();
|
||||
|
||||
Reference in New Issue
Block a user