Merge pull request #89782 from KoBeWi/stdArrayList

Use initializer list in Arrays
This commit is contained in:
Rémi Verschelde
2025-03-28 17:29:40 +01:00
72 changed files with 347 additions and 947 deletions

View File

@ -43,10 +43,8 @@ TEST_CASE("[InputEvent] Signal is emitted when device is changed") {
input_event.instantiate();
SIGNAL_WATCH(*input_event, CoreStringName(changed));
Array args1;
Array empty_args;
empty_args.push_back(args1);
Array empty_args = { {} };
input_event->set_device(1);
SIGNAL_CHECK("changed", empty_args);

View File

@ -60,10 +60,7 @@ TEST_CASE("[Shortcut] Setting and getting an event should result in the same eve
// Cast to InputEvent so the internal code recognizes the objects.
Ref<InputEvent> e1 = k1;
Ref<InputEvent> e2 = k2;
Array input_array;
input_array.append(e1);
input_array.append(e2);
Array input_array = { e1, e2 };
Shortcut s;
s.set_events(input_array);
@ -131,8 +128,7 @@ TEST_CASE("[Shortcut] 'matches_event' should correctly match the same event") {
Ref<InputEvent> e_different = different;
Ref<InputEvent> e_copy = copy;
Array a;
a.append(e_original);
Array a = { e_original };
Shortcut s;
s.set_events(a);
@ -154,9 +150,7 @@ TEST_CASE("[Shortcut] 'get_as_text' text representation should be correct") {
different->set_keycode(Key::ESCAPE);
Ref<InputEvent> key_event1 = same;
Array a;
a.append(key_event1);
Array a = { key_event1 };
Shortcut s;
s.set_events(a);
@ -175,17 +169,14 @@ TEST_CASE("[Shortcut] Event validity should be correctly checked.") {
Ref<InputEvent> valid_event = valid;
Ref<InputEvent> invalid_event = invalid;
Array a;
a.append(invalid_event);
a.append(valid_event);
Array a = { invalid_event, valid_event };
Shortcut s;
s.set_events(a);
CHECK(s.has_valid_event() == true);
Array b;
b.append(invalid_event);
Array b = { invalid_event };
Shortcut shortcut_with_invalid_event;
shortcut_with_invalid_event.set_events(b);
@ -213,13 +204,8 @@ TEST_CASE("[Shortcut] Equal arrays should be recognized as such.") {
Array same_as_same;
same_as_same.append(key_event1);
Array different1;
different1.append(key_event2);
Array different2;
different2.append(key_event1);
different2.append(key_event2);
Array different1 = { key_event2 };
Array different2 = { key_event1, key_event2 };
Array different3;
Shortcut s;

View File

@ -58,10 +58,7 @@ TEST_CASE("[HTTPClient] query_string_from_dict") {
Dictionary dict2;
dict2["key1"] = "value";
dict2["key2"] = 123;
Array values;
values.push_back(1);
values.push_back(2);
values.push_back(3);
Array values = { 1, 2, 3 };
dict2["key3"] = values;
dict2["key4"] = Variant();
String multiple_keys = client->query_string_from_dict(dict2);

View File

@ -152,15 +152,7 @@ TEST_CASE("[JSON] Parsing escape sequences") {
JSON json;
TypedArray<String> valid_escapes;
valid_escapes.push_back("\";\"");
valid_escapes.push_back("\\;\\");
valid_escapes.push_back("/;/");
valid_escapes.push_back("b;\b");
valid_escapes.push_back("f;\f");
valid_escapes.push_back("n;\n");
valid_escapes.push_back("r;\r");
valid_escapes.push_back("t;\t");
TypedArray<String> valid_escapes = { "\";\"", "\\;\\", "/;/", "b;\b", "f;\f", "n;\n", "r;\r", "t;\t" };
SUBCASE("Basic valid escape sequences") {
for (int i = 0; i < valid_escapes.size(); i++) {

View File

@ -161,25 +161,13 @@ TEST_CASE("[JSON][Native] Conversion between native and JSON formats") {
// `Array`.
Array arr;
arr.push_back(true);
arr.push_back(1);
arr.push_back("abc");
Array arr = { true, 1, "abc" };
test(arr, R"([true,"i:1","s:abc"])");
TypedArray<int64_t> int_arr;
int_arr.push_back(1);
int_arr.push_back(2);
int_arr.push_back(3);
TypedArray<int64_t> int_arr = { 1, 2, 3 };
test(int_arr, R"({"type":"Array","elem_type":"int","args":["i:1","i:2","i:3"]})");
Array arr2;
arr2.push_back(1);
arr2.push_back(res);
arr2.push_back(9);
Array arr2 = { 1, res, 9 };
const String arr2_repr = vformat(R"(["i:1",%s,"i:9"])", res_repr);
test(arr2, arr2_repr, true);
@ -188,9 +176,7 @@ TEST_CASE("[JSON][Native] Conversion between native and JSON formats") {
CHECK(decode(arr2_repr).get_construct_string() == "[1, null, 9]");
ERR_PRINT_ON;
TypedArray<Resource> res_arr;
res_arr.push_back(res);
TypedArray<Resource> res_arr = { res };
const String res_arr_repr = vformat(R"({"type":"Array","elem_type":"Resource","args":[%s]})", res_repr);
test(res_arr, res_arr_repr, true);

View File

@ -321,15 +321,11 @@ TEST_CASE("[Expression] Boolean expressions") {
TEST_CASE("[Expression] Expressions with variables") {
Expression expression;
PackedStringArray parameter_names;
parameter_names.push_back("foo");
parameter_names.push_back("bar");
PackedStringArray parameter_names = { "foo", "bar" };
CHECK_MESSAGE(
expression.parse("foo + bar + 50", parameter_names) == OK,
"The expression should parse successfully.");
Array values;
values.push_back(60);
values.push_back(20);
Array values = { 60, 20 };
CHECK_MESSAGE(
int(expression.execute(values)) == 130,
"The expression should return the expected value.");
@ -340,9 +336,7 @@ TEST_CASE("[Expression] Expressions with variables") {
CHECK_MESSAGE(
expression.parse("foo + bar + 50", parameter_names_invalid) == OK,
"The expression should parse successfully.");
Array values_invalid;
values_invalid.push_back(60);
values_invalid.push_back(20);
Array values_invalid = { 60, 20 };
// Invalid parameters will parse successfully but print an error message when executing.
ERR_PRINT_OFF;
CHECK_MESSAGE(
@ -351,31 +345,21 @@ TEST_CASE("[Expression] Expressions with variables") {
ERR_PRINT_ON;
// Mismatched argument count (more values than parameters).
PackedStringArray parameter_names_mismatch;
parameter_names_mismatch.push_back("foo");
parameter_names_mismatch.push_back("bar");
PackedStringArray parameter_names_mismatch = { "foo", "bar" };
CHECK_MESSAGE(
expression.parse("foo + bar + 50", parameter_names_mismatch) == OK,
"The expression should parse successfully.");
Array values_mismatch;
values_mismatch.push_back(60);
values_mismatch.push_back(20);
values_mismatch.push_back(110);
Array values_mismatch = { 60, 20, 110 };
CHECK_MESSAGE(
int(expression.execute(values_mismatch)) == 130,
"The expression should return the expected value.");
// Mismatched argument count (more parameters than values).
PackedStringArray parameter_names_mismatch2;
parameter_names_mismatch2.push_back("foo");
parameter_names_mismatch2.push_back("bar");
parameter_names_mismatch2.push_back("baz");
PackedStringArray parameter_names_mismatch2 = { "foo", "bar", "baz" };
CHECK_MESSAGE(
expression.parse("foo + bar + baz + 50", parameter_names_mismatch2) == OK,
"The expression should parse successfully.");
Array values_mismatch2;
values_mismatch2.push_back(60);
values_mismatch2.push_back(20);
Array values_mismatch2 = { 60, 20 };
// Having more parameters than values will parse successfully but print an
// error message when executing.
ERR_PRINT_OFF;

View File

@ -428,8 +428,7 @@ TEST_CASE("[Object] Signals") {
}
SUBCASE("Emitting an existing signal should call the connected method") {
Array empty_signal_args;
empty_signal_args.push_back(Array());
Array empty_signal_args = { {} };
SIGNAL_WATCH(&object, "my_custom_signal");
SIGNAL_CHECK_FALSE("my_custom_signal");

View File

@ -139,9 +139,7 @@ TEST_CASE("[Array] front() and back()") {
}
TEST_CASE("[Array] has() and count()") {
Array arr;
arr.push_back(1);
arr.push_back(1);
Array arr = { 1, 1 };
CHECK(arr.has(1));
CHECK(!arr.has(2));
CHECK(arr.count(1) == 2);
@ -149,9 +147,7 @@ TEST_CASE("[Array] has() and count()") {
}
TEST_CASE("[Array] remove_at()") {
Array arr;
arr.push_back(1);
arr.push_back(2);
Array arr = { 1, 2 };
arr.remove_at(0);
CHECK(arr.size() == 1);
CHECK(int(arr[0]) == 2);
@ -168,18 +164,12 @@ TEST_CASE("[Array] remove_at()") {
}
TEST_CASE("[Array] get()") {
Array arr;
arr.push_back(1);
Array arr = { 1 };
CHECK(int(arr.get(0)) == 1);
}
TEST_CASE("[Array] sort()") {
Array arr;
arr.push_back(3);
arr.push_back(4);
arr.push_back(2);
arr.push_back(1);
Array arr = { 3, 4, 2, 1 };
arr.sort();
int val = 1;
for (int i = 0; i < arr.size(); i++) {
@ -206,12 +196,7 @@ TEST_CASE("[Array] push_front(), pop_front(), pop_back()") {
TEST_CASE("[Array] pop_at()") {
ErrorDetector ed;
Array arr;
arr.push_back(2);
arr.push_back(4);
arr.push_back(6);
arr.push_back(8);
arr.push_back(10);
Array arr = { 2, 4, 6, 8, 10 };
REQUIRE(int(arr.pop_at(2)) == 6);
REQUIRE(arr.size() == 4);
@ -266,13 +251,7 @@ TEST_CASE("[Array] max() and min()") {
}
TEST_CASE("[Array] slice()") {
Array array;
array.push_back(0);
array.push_back(1);
array.push_back(2);
array.push_back(3);
array.push_back(4);
array.push_back(5);
Array array = { 0, 1, 2, 3, 4, 5 };
Array slice0 = array.slice(0, 0);
CHECK(slice0.size() == 0);
@ -617,11 +596,8 @@ TEST_CASE("[Array] Iteration and modification") {
}
TEST_CASE("[Array] Typed copying") {
TypedArray<int> a1;
a1.push_back(1);
TypedArray<double> a2;
a2.push_back(1.0);
TypedArray<int> a1 = { 1 };
TypedArray<double> a2 = { 1.0 };
Array a3 = a1;
TypedArray<int> a4 = a3;

View File

@ -154,11 +154,7 @@ public:
}
static String get_output(const Callable &p_callable) {
Array effective_args;
effective_args.push_back(7);
effective_args.push_back(8);
effective_args.push_back(9);
Array effective_args = { 7, 8, 9 };
effective_args.resize(3 - p_callable.get_unbound_arguments_count());
effective_args.append_array(p_callable.get_bound_arguments());

View File

@ -545,11 +545,7 @@ TEST_CASE("[Dictionary] Order and find") {
d[12] = "twelve";
d["4"] = "four";
Array keys;
keys.append(4);
keys.append(8);
keys.append(12);
keys.append("4");
Array keys = { 4, 8, 12, "4" };
CHECK_EQ(d.keys(), keys);
CHECK_EQ(d.find_key("four"), Variant(4));

View File

@ -92,15 +92,8 @@ TEST_CASE("[VariantUtility] Type conversion") {
}
{
Array arr;
arr.push_back(1.2);
arr.push_back(3.4);
arr.push_back(5.6);
PackedFloat64Array packed;
packed.push_back(1.2);
packed.push_back(3.4);
packed.push_back(5.6);
Array arr = { 1.2, 3.4, 5.6 };
PackedFloat64Array packed = { 1.2, 3.4, 5.6 };
converted = VariantUtilityFunctions::type_convert(arr, Variant::Type::PACKED_FLOAT64_ARRAY);
CHECK(converted.get_type() == Variant::Type::PACKED_FLOAT64_ARRAY);

View File

@ -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

View File

@ -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(".");

View File

@ -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);

View File

@ -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++) {

View File

@ -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);

View File

@ -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");

View File

@ -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"));

View File

@ -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();

View File

@ -771,9 +771,7 @@ TEST_SUITE("[Navigation]") {
query_parameters->set_map(map);
query_parameters->set_start_position(Vector3(10, 0, 10));
query_parameters->set_target_position(Vector3(0, 0, 0));
Array excluded_regions;
excluded_regions.push_back(region);
query_parameters->set_excluded_regions(excluded_regions);
query_parameters->set_excluded_regions({ region });
Ref<NavigationPathQueryResult3D> query_result;
query_result.instantiate();
navigation_server->query_path(query_parameters, query_result);
@ -786,9 +784,7 @@ TEST_SUITE("[Navigation]") {
query_parameters->set_map(map);
query_parameters->set_start_position(Vector3(10, 0, 10));
query_parameters->set_target_position(Vector3(0, 0, 0));
Array included_regions;
included_regions.push_back(region);
query_parameters->set_included_regions(included_regions);
query_parameters->set_included_regions({ region });
Ref<NavigationPathQueryResult3D> query_result;
query_result.instantiate();
navigation_server->query_path(query_parameters, query_result);
@ -801,12 +797,8 @@ TEST_SUITE("[Navigation]") {
query_parameters->set_map(map);
query_parameters->set_start_position(Vector3(10, 0, 10));
query_parameters->set_target_position(Vector3(0, 0, 0));
Array excluded_regions;
excluded_regions.push_back(region);
query_parameters->set_excluded_regions(excluded_regions);
Array included_regions;
included_regions.push_back(region);
query_parameters->set_included_regions(included_regions);
query_parameters->set_excluded_regions({ region });
query_parameters->set_included_regions({ region });
Ref<NavigationPathQueryResult3D> query_result;
query_result.instantiate();
navigation_server->query_path(query_parameters, query_result);

View File

@ -72,10 +72,7 @@ TEST_SUITE("[TextServer]") {
ts->font_set_data_ptr(font2, _font_NotoSansThai_Regular, _font_NotoSansThai_Regular_size);
ts->font_set_allow_system_fallback(font2, false);
Array font;
font.push_back(font1);
font.push_back(font2);
Array font = { font1, font2 };
String test = U"คนอ้วน khon uan ראה";
// 6^ 17^
@ -125,10 +122,7 @@ TEST_SUITE("[TextServer]") {
RID font2 = ts->create_font();
ts->font_set_data_ptr(font2, _font_Vazirmatn_Regular, _font_Vazirmatn_Regular_size);
Array font;
font.push_back(font1);
font.push_back(font2);
Array font = { font1, font2 };
String test = U"Arabic (اَلْعَرَبِيَّةُ, al-ʿarabiyyah)";
// 7^ 26^
@ -182,11 +176,7 @@ TEST_SUITE("[TextServer]") {
ts->font_set_data_ptr(font3, _font_Vazirmatn_Regular, _font_Vazirmatn_Regular_size);
ts->font_set_allow_system_fallback(font3, false);
Array font;
font.push_back(font1);
font.push_back(font2);
font.push_back(font3);
Array font = { font1, font2, font3 };
{
RID ctx = ts->create_shaped_text();
CHECK_FALSE_MESSAGE(ctx == RID(), "Creating text buffer failed.");
@ -579,10 +569,7 @@ TEST_SUITE("[TextServer]") {
RID font2 = ts->create_font();
ts->font_set_data_ptr(font2, _font_NotoSansThai_Regular, _font_NotoSansThai_Regular_size);
Array font;
font.push_back(font1);
font.push_back(font2);
Array font = { font1, font2 };
RID ctx = ts->create_shaped_text();
CHECK_FALSE_MESSAGE(ctx == RID(), "Creating text buffer failed.");
bool ok = ts->shaped_text_add_string(ctx, test_1, font, 16);
@ -637,10 +624,7 @@ TEST_SUITE("[TextServer]") {
RID font2 = ts->create_font();
ts->font_set_data_ptr(font2, _font_Vazirmatn_Regular, _font_Vazirmatn_Regular_size);
Array font;
font.push_back(font1);
font.push_back(font2);
Array font = { font1, font2 };
String test_1 = U"الحمد";
String test_2 = U"الحمد test";
String test_3 = U"test test";
@ -949,9 +933,7 @@ TEST_SUITE("[TextServer]") {
RID font1 = ts->create_font();
ts->font_set_data_ptr(font1, _font_NotoSans_Regular, _font_NotoSans_Regular_size);
Array font;
font.push_back(font1);
Array font = { font1 };
RID ctx = ts->create_shaped_text();
CHECK_FALSE_MESSAGE(ctx == RID(), "Creating text buffer failed.");
bool ok = ts->shaped_text_add_string(ctx, "T", font, 16);

View File

@ -276,23 +276,17 @@ private:
}
void _signal_callback_one(Variant p_arg1, const String &p_name) {
Array args;
args.push_back(p_arg1);
Array args = { p_arg1 };
_add_signal_entry(args, p_name);
}
void _signal_callback_two(Variant p_arg1, Variant p_arg2, const String &p_name) {
Array args;
args.push_back(p_arg1);
args.push_back(p_arg2);
Array args = { p_arg1, p_arg2 };
_add_signal_entry(args, p_name);
}
void _signal_callback_three(Variant p_arg1, Variant p_arg2, Variant p_arg3, const String &p_name) {
Array args;
args.push_back(p_arg1);
args.push_back(p_arg2);
args.push_back(p_arg3);
Array args = { p_arg1, p_arg2, p_arg3 };
_add_signal_entry(args, p_name);
}

View File

@ -124,9 +124,7 @@ TEST_SUITE("Validate tests") {
dict["color"] = color;
INFO(dict);
Array arr;
arr.push_back(string);
arr.push_back(color);
Array arr = { string, color };
INFO(arr);
PackedByteArray byte_arr;