feat: modules moved and engine moved to submodule
This commit is contained in:
parent
dfb5e645cd
commit
c33d2130cc
5136 changed files with 225275 additions and 64485 deletions
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_ANIMATION_H
|
||||
#define TEST_ANIMATION_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/resources/animation.h"
|
||||
|
||||
|
|
@ -310,5 +309,3 @@ TEST_CASE("[Animation] Create Bezier track") {
|
|||
}
|
||||
|
||||
} // namespace TestAnimation
|
||||
|
||||
#endif // TEST_ANIMATION_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_ARRAYMESH_H
|
||||
#define TEST_ARRAYMESH_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/resources/3d/primitive_meshes.h"
|
||||
#include "scene/resources/mesh.h"
|
||||
|
|
@ -149,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);
|
||||
|
||||
|
|
@ -189,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
|
||||
|
|
@ -449,5 +444,3 @@ TEST_CASE("[SceneTree][ArrayMesh] Get/Set mesh metadata and actions") {
|
|||
}
|
||||
|
||||
} // namespace TestArrayMesh
|
||||
|
||||
#endif // TEST_ARRAYMESH_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_AUDIO_STREAM_WAV_H
|
||||
#define TEST_AUDIO_STREAM_WAV_H
|
||||
#pragma once
|
||||
|
||||
#include "core/math/math_defs.h"
|
||||
#include "core/math/math_funcs.h"
|
||||
|
|
@ -47,7 +46,7 @@ constexpr int WAV_COUNT = WAV_RATE;
|
|||
|
||||
float gen_wav(float frequency, float wav_rate, int wav_number) {
|
||||
// formula for generating a sin wave with given frequency.
|
||||
return Math::sin((Math_TAU * frequency / wav_rate) * wav_number);
|
||||
return Math::sin((Math::TAU * frequency / wav_rate) * wav_number);
|
||||
}
|
||||
|
||||
/* Generates a 440Hz sin wave in channel 0 (mono channel or left stereo channel)
|
||||
|
|
@ -218,5 +217,3 @@ TEST_CASE("[Audio][AudioStreamWAV] Saving IMA ADPCM is not supported") {
|
|||
}
|
||||
|
||||
} // namespace TestAudioStreamWAV
|
||||
|
||||
#endif // TEST_AUDIO_STREAM_WAV_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_BIT_MAP_H
|
||||
#define TEST_BIT_MAP_H
|
||||
#pragma once
|
||||
|
||||
#include "core/os/memory.h"
|
||||
#include "scene/resources/bit_map.h"
|
||||
|
|
@ -501,5 +500,3 @@ TEST_CASE("[BitMap] Clip to polygon") {
|
|||
}
|
||||
|
||||
} // namespace TestBitmap
|
||||
|
||||
#endif // TEST_BIT_MAP_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_BUTTON_H
|
||||
#define TEST_BUTTON_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/gui/button.h"
|
||||
#include "scene/main/window.h"
|
||||
|
|
@ -63,4 +62,3 @@ TEST_CASE("[SceneTree][Button] is_hovered()") {
|
|||
}
|
||||
|
||||
} //namespace TestButton
|
||||
#endif // TEST_BUTTON_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_CAMERA_2D_H
|
||||
#define TEST_CAMERA_2D_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/2d/camera_2d.h"
|
||||
#include "scene/main/viewport.h"
|
||||
|
|
@ -286,7 +285,7 @@ TEST_CASE("[SceneTree][Camera2D] Transforms") {
|
|||
}
|
||||
|
||||
SUBCASE("Rotation") {
|
||||
test_camera->set_rotation(Math_PI / 2);
|
||||
test_camera->set_rotation(Math::PI / 2);
|
||||
Transform2D xform = mock_viewport->get_canvas_transform();
|
||||
Transform2D test_xform = Transform2D(Vector2(1, 0), Vector2(0, 1), Vector2(200, 100));
|
||||
CHECK(xform.is_equal_approx(test_xform));
|
||||
|
|
@ -296,7 +295,7 @@ TEST_CASE("[SceneTree][Camera2D] Transforms") {
|
|||
test_xform = Transform2D(Vector2(0, -1), Vector2(1, 0), Vector2(200, 100));
|
||||
CHECK(xform.is_equal_approx(test_xform));
|
||||
|
||||
test_camera->set_rotation(-1 * Math_PI);
|
||||
test_camera->set_rotation(-1 * Math::PI);
|
||||
test_camera->force_update_scroll();
|
||||
xform = mock_viewport->get_canvas_transform();
|
||||
test_xform = Transform2D(Vector2(-1, 0), Vector2(0, -1), Vector2(200, 100));
|
||||
|
|
@ -314,5 +313,3 @@ TEST_CASE("[SceneTree][Camera2D] Transforms") {
|
|||
}
|
||||
|
||||
} // namespace TestCamera2D
|
||||
|
||||
#endif // TEST_CAMERA_2D_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_CAMERA_3D_H
|
||||
#define TEST_CAMERA_3D_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/3d/camera_3d.h"
|
||||
#include "scene/main/viewport.h"
|
||||
|
|
@ -37,9 +36,6 @@
|
|||
|
||||
#include "tests/test_macros.h"
|
||||
|
||||
// Constants.
|
||||
#define SQRT3 (1.7320508f)
|
||||
|
||||
TEST_CASE("[SceneTree][Camera3D] Getters and setters") {
|
||||
Camera3D *test_camera = memnew(Camera3D);
|
||||
|
||||
|
|
@ -247,13 +243,13 @@ TEST_CASE("[SceneTree][Camera3D] Project/Unproject position") {
|
|||
CHECK(test_camera->project_position(Vector2(200, 100), 100.0f).is_equal_approx(Vector3(0, 0, -100.0f)));
|
||||
CHECK(test_camera->project_position(Vector2(200, 100), test_camera->get_far()).is_equal_approx(Vector3(0, 0, -1.0f) * test_camera->get_far()));
|
||||
// 3/4th way to Top left.
|
||||
CHECK(test_camera->project_position(Vector2(100, 50), 0.5f).is_equal_approx(Vector3(-SQRT3 * 0.5f, SQRT3 * 0.25f, -0.5f)));
|
||||
CHECK(test_camera->project_position(Vector2(100, 50), 1.0f).is_equal_approx(Vector3(-SQRT3, SQRT3 * 0.5f, -1.0f)));
|
||||
CHECK(test_camera->project_position(Vector2(100, 50), test_camera->get_near()).is_equal_approx(Vector3(-SQRT3, SQRT3 * 0.5f, -1.0f) * test_camera->get_near()));
|
||||
CHECK(test_camera->project_position(Vector2(100, 50), 0.5f).is_equal_approx(Vector3(-Math::SQRT3 * 0.5f, Math::SQRT3 * 0.25f, -0.5f)));
|
||||
CHECK(test_camera->project_position(Vector2(100, 50), 1.0f).is_equal_approx(Vector3(-Math::SQRT3, Math::SQRT3 * 0.5f, -1.0f)));
|
||||
CHECK(test_camera->project_position(Vector2(100, 50), test_camera->get_near()).is_equal_approx(Vector3(-Math::SQRT3, Math::SQRT3 * 0.5f, -1.0f) * test_camera->get_near()));
|
||||
// 3/4th way to Bottom right.
|
||||
CHECK(test_camera->project_position(Vector2(300, 150), 0.5f).is_equal_approx(Vector3(SQRT3 * 0.5f, -SQRT3 * 0.25f, -0.5f)));
|
||||
CHECK(test_camera->project_position(Vector2(300, 150), 1.0f).is_equal_approx(Vector3(SQRT3, -SQRT3 * 0.5f, -1.0f)));
|
||||
CHECK(test_camera->project_position(Vector2(300, 150), test_camera->get_far()).is_equal_approx(Vector3(SQRT3, -SQRT3 * 0.5f, -1.0f) * test_camera->get_far()));
|
||||
CHECK(test_camera->project_position(Vector2(300, 150), 0.5f).is_equal_approx(Vector3(Math::SQRT3 * 0.5f, -Math::SQRT3 * 0.25f, -0.5f)));
|
||||
CHECK(test_camera->project_position(Vector2(300, 150), 1.0f).is_equal_approx(Vector3(Math::SQRT3, -Math::SQRT3 * 0.5f, -1.0f)));
|
||||
CHECK(test_camera->project_position(Vector2(300, 150), test_camera->get_far()).is_equal_approx(Vector3(Math::SQRT3, -Math::SQRT3 * 0.5f, -1.0f) * test_camera->get_far()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -275,11 +271,11 @@ TEST_CASE("[SceneTree][Camera3D] Project/Unproject position") {
|
|||
CHECK(test_camera->unproject_position(Vector3(0, 0, -0.5f)).is_equal_approx(Vector2(200, 100)));
|
||||
CHECK(test_camera->unproject_position(Vector3(0, 0, -100.0f)).is_equal_approx(Vector2(200, 100)));
|
||||
// 3/4th way to Top left.
|
||||
WARN(test_camera->unproject_position(Vector3(-SQRT3 * 0.5f, SQRT3 * 0.25f, -0.5f)).is_equal_approx(Vector2(100, 50)));
|
||||
WARN(test_camera->unproject_position(Vector3(-SQRT3, SQRT3 * 0.5f, -1.0f)).is_equal_approx(Vector2(100, 50)));
|
||||
WARN(test_camera->unproject_position(Vector3(-Math::SQRT3 * 0.5f, Math::SQRT3 * 0.25f, -0.5f)).is_equal_approx(Vector2(100, 50)));
|
||||
WARN(test_camera->unproject_position(Vector3(-Math::SQRT3, Math::SQRT3 * 0.5f, -1.0f)).is_equal_approx(Vector2(100, 50)));
|
||||
// 3/4th way to Bottom right.
|
||||
CHECK(test_camera->unproject_position(Vector3(SQRT3 * 0.5f, -SQRT3 * 0.25f, -0.5f)).is_equal_approx(Vector2(300, 150)));
|
||||
CHECK(test_camera->unproject_position(Vector3(SQRT3, -SQRT3 * 0.5f, -1.0f)).is_equal_approx(Vector2(300, 150)));
|
||||
CHECK(test_camera->unproject_position(Vector3(Math::SQRT3 * 0.5f, -Math::SQRT3 * 0.25f, -0.5f)).is_equal_approx(Vector2(300, 150)));
|
||||
CHECK(test_camera->unproject_position(Vector3(Math::SQRT3, -Math::SQRT3 * 0.5f, -1.0f)).is_equal_approx(Vector2(300, 150)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -337,9 +333,9 @@ TEST_CASE("[SceneTree][Camera3D] Project ray") {
|
|||
// Center.
|
||||
CHECK(test_camera->project_ray_normal(Vector2(200, 100)).is_equal_approx(Vector3(0, 0, -1)));
|
||||
// Top left.
|
||||
CHECK(test_camera->project_ray_normal(Vector2(0, 0)).is_equal_approx(Vector3(-SQRT3, SQRT3 / 2, -0.5f).normalized()));
|
||||
CHECK(test_camera->project_ray_normal(Vector2(0, 0)).is_equal_approx(Vector3(-Math::SQRT3, Math::SQRT3 / 2, -0.5f).normalized()));
|
||||
// Bottom right.
|
||||
CHECK(test_camera->project_ray_normal(Vector2(400, 200)).is_equal_approx(Vector3(SQRT3, -SQRT3 / 2, -0.5f).normalized()));
|
||||
CHECK(test_camera->project_ray_normal(Vector2(400, 200)).is_equal_approx(Vector3(Math::SQRT3, -Math::SQRT3 / 2, -0.5f).normalized()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -361,16 +357,12 @@ TEST_CASE("[SceneTree][Camera3D] Project ray") {
|
|||
// Center.
|
||||
CHECK(test_camera->project_local_ray_normal(Vector2(200, 100)).is_equal_approx(Vector3(0, 0, -1)));
|
||||
// Top left.
|
||||
CHECK(test_camera->project_local_ray_normal(Vector2(0, 0)).is_equal_approx(Vector3(-SQRT3, SQRT3 / 2, -0.5f).normalized()));
|
||||
CHECK(test_camera->project_local_ray_normal(Vector2(0, 0)).is_equal_approx(Vector3(-Math::SQRT3, Math::SQRT3 / 2, -0.5f).normalized()));
|
||||
// Bottom right.
|
||||
CHECK(test_camera->project_local_ray_normal(Vector2(400, 200)).is_equal_approx(Vector3(SQRT3, -SQRT3 / 2, -0.5f).normalized()));
|
||||
CHECK(test_camera->project_local_ray_normal(Vector2(400, 200)).is_equal_approx(Vector3(Math::SQRT3, -Math::SQRT3 / 2, -0.5f).normalized()));
|
||||
}
|
||||
}
|
||||
|
||||
memdelete(test_camera);
|
||||
memdelete(mock_viewport);
|
||||
}
|
||||
|
||||
#undef SQRT3
|
||||
|
||||
#endif // TEST_CAMERA_3D_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_CODE_EDIT_H
|
||||
#define TEST_CODE_EDIT_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/gui/code_edit.h"
|
||||
|
||||
|
|
@ -906,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("\""));
|
||||
|
|
@ -972,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("\""));
|
||||
|
|
@ -1771,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();
|
||||
|
|
@ -3275,6 +3269,47 @@ TEST_CASE("[SceneTree][CodeEdit] folding") {
|
|||
CHECK(code_edit->get_next_visible_line_offset_from(1, 1) == 4);
|
||||
}
|
||||
|
||||
SUBCASE("[CodeEdit] folding comments including and/or adjacent to code regions") {
|
||||
code_edit->add_comment_delimiter("#", "", true);
|
||||
|
||||
// Single line comment directly above a code region tag is not foldable.
|
||||
code_edit->set_text("#line0\n#region a\nnothing\n#line3\n#endregion");
|
||||
CHECK_FALSE(code_edit->can_fold_line(0));
|
||||
CHECK_FALSE(code_edit->can_fold_line(3));
|
||||
|
||||
// Comment blocks.
|
||||
// Foldable even when directly below a code region start tag.
|
||||
code_edit->set_text("#line0\n#line1\n#region a\n#line3\n#line4\nnothing\n#endregion");
|
||||
CHECK(code_edit->can_fold_line(3));
|
||||
|
||||
// Doesn't fold beyond region start tag.
|
||||
code_edit->fold_line(0);
|
||||
CHECK(code_edit->is_line_folded(0));
|
||||
CHECK_EQ(code_edit->get_visible_line_count_in_range(0, 1), 1);
|
||||
CHECK_EQ(code_edit->get_visible_line_count_in_range(2, 2), 1);
|
||||
|
||||
// Foldable even when directly below a code region end tag.
|
||||
code_edit->set_text("#region a\nnothing\n#line2\n#line3\n#endregion\n#line5\n#line6");
|
||||
CHECK(code_edit->can_fold_line(5));
|
||||
|
||||
// Doesn't fold beyond region end tag.
|
||||
code_edit->fold_line(2);
|
||||
CHECK(code_edit->is_line_folded(2));
|
||||
CHECK_EQ(code_edit->get_visible_line_count_in_range(2, 3), 1);
|
||||
CHECK_EQ(code_edit->get_visible_line_count_in_range(4, 4), 1);
|
||||
|
||||
code_edit->add_comment_delimiter("/*", "*/", false);
|
||||
|
||||
// Multiline comments.
|
||||
// Folds a region tag inside it.
|
||||
code_edit->set_text("/*\nnothing\n#region a\n*/\n#endregion");
|
||||
CHECK(code_edit->can_fold_line(0));
|
||||
code_edit->fold_line(0);
|
||||
CHECK(code_edit->is_line_folded(0));
|
||||
CHECK_EQ(code_edit->get_visible_line_count_in_range(0, 3), 1);
|
||||
CHECK_EQ(code_edit->get_visible_line_count_in_range(4, 4), 1);
|
||||
}
|
||||
|
||||
SUBCASE("[CodeEdit] folding carets") {
|
||||
// Folding a line moves all carets that would be hidden.
|
||||
code_edit->set_text("test\n\tline1\n\t\tline 2\n");
|
||||
|
|
@ -3937,11 +3972,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);
|
||||
|
|
@ -3959,8 +3990,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();
|
||||
|
|
@ -3973,8 +4003,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(".");
|
||||
|
|
@ -4119,10 +4148,10 @@ TEST_CASE("[SceneTree][CodeEdit] completion") {
|
|||
|
||||
Point2 caret_pos = code_edit->get_caret_draw_pos();
|
||||
caret_pos.y += code_edit->get_line_height();
|
||||
SEND_GUI_MOUSE_BUTTON_EVENT(caret_pos, MouseButton::WHEEL_DOWN, 0, Key::NONE);
|
||||
SEND_GUI_MOUSE_BUTTON_EVENT(caret_pos, MouseButton::WHEEL_DOWN, MouseButtonMask::NONE, Key::NONE);
|
||||
CHECK(code_edit->get_code_completion_selected_index() == 1);
|
||||
|
||||
SEND_GUI_MOUSE_BUTTON_EVENT(caret_pos, MouseButton::WHEEL_UP, 0, Key::NONE);
|
||||
SEND_GUI_MOUSE_BUTTON_EVENT(caret_pos, MouseButton::WHEEL_UP, MouseButtonMask::NONE, Key::NONE);
|
||||
CHECK(code_edit->get_code_completion_selected_index() == 0);
|
||||
|
||||
/* Single click selects. */
|
||||
|
|
@ -4492,7 +4521,8 @@ TEST_CASE("[SceneTree][CodeEdit] symbol lookup") {
|
|||
|
||||
Point2 caret_pos = code_edit->get_caret_draw_pos();
|
||||
caret_pos.x += 60;
|
||||
SEND_GUI_MOUSE_BUTTON_EVENT(caret_pos, MouseButton::NONE, 0, Key::NONE);
|
||||
|
||||
SEND_GUI_MOUSE_MOTION_EVENT(caret_pos, MouseButtonMask::NONE, Key::NONE);
|
||||
CHECK(code_edit->get_text_for_symbol_lookup() == "this is s" + String::chr(0xFFFF) + "ome text");
|
||||
|
||||
SIGNAL_WATCH(code_edit, "symbol_validate");
|
||||
|
|
@ -5675,5 +5705,3 @@ func _ready():
|
|||
}
|
||||
|
||||
} // namespace TestCodeEdit
|
||||
|
||||
#endif // TEST_CODE_EDIT_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_COLOR_PICKER_H
|
||||
#define TEST_COLOR_PICKER_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/gui/color_picker.h"
|
||||
|
||||
|
|
@ -57,5 +56,3 @@ TEST_CASE("[SceneTree][ColorPicker]") {
|
|||
}
|
||||
|
||||
} // namespace TestColorPicker
|
||||
|
||||
#endif // TEST_COLOR_PICKER_H
|
||||
|
|
|
|||
|
|
@ -28,9 +28,9 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_CONTROL_H
|
||||
#define TEST_CONTROL_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/2d/node_2d.h"
|
||||
#include "scene/gui/control.h"
|
||||
|
||||
#include "tests/test_macros.h"
|
||||
|
|
@ -52,9 +52,9 @@ TEST_CASE("[SceneTree][Control] Transforms") {
|
|||
CHECK_EQ(test_node->get_global_transform(), Transform2D(0, Size2(4, 4), 0, Vector2(2, 2)));
|
||||
test_node->set_scale(Vector2(1, 1));
|
||||
test_node->set_rotation_degrees(90);
|
||||
CHECK_EQ(test_node->get_global_transform(), Transform2D(Math_PI / 2, Vector2(2, 2)));
|
||||
CHECK_EQ(test_node->get_global_transform(), Transform2D(Math::PI / 2, Vector2(2, 2)));
|
||||
test_node->set_pivot_offset(Vector2(1, 0));
|
||||
CHECK_EQ(test_node->get_global_transform(), Transform2D(Math_PI / 2, Vector2(3, 1)));
|
||||
CHECK_EQ(test_node->get_global_transform(), Transform2D(Math::PI / 2, Vector2(3, 1)));
|
||||
|
||||
memdelete(test_child);
|
||||
memdelete(test_node);
|
||||
|
|
@ -66,7 +66,7 @@ TEST_CASE("[SceneTree][Control] Focus") {
|
|||
SceneTree::get_singleton()->get_root()->add_child(ctrl);
|
||||
|
||||
SUBCASE("[SceneTree][Control] Default focus") {
|
||||
CHECK_FALSE(ctrl->has_focus());
|
||||
CHECK_UNARY_FALSE(ctrl->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Can't grab focus with default focus mode") {
|
||||
|
|
@ -74,44 +74,834 @@ TEST_CASE("[SceneTree][Control] Focus") {
|
|||
ctrl->grab_focus();
|
||||
ERR_PRINT_ON
|
||||
|
||||
CHECK_FALSE(ctrl->has_focus());
|
||||
CHECK_UNARY_FALSE(ctrl->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Can grab focus") {
|
||||
ctrl->set_focus_mode(Control::FocusMode::FOCUS_ALL);
|
||||
ctrl->grab_focus();
|
||||
|
||||
CHECK(ctrl->has_focus());
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Can release focus") {
|
||||
ctrl->set_focus_mode(Control::FocusMode::FOCUS_ALL);
|
||||
ctrl->grab_focus();
|
||||
CHECK(ctrl->has_focus());
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
|
||||
ctrl->release_focus();
|
||||
CHECK_FALSE(ctrl->has_focus());
|
||||
CHECK_UNARY_FALSE(ctrl->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Only one can grab focus at the same time") {
|
||||
ctrl->set_focus_mode(Control::FocusMode::FOCUS_ALL);
|
||||
ctrl->grab_focus();
|
||||
CHECK(ctrl->has_focus());
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
|
||||
Control *other_ctrl = memnew(Control);
|
||||
SceneTree::get_singleton()->get_root()->add_child(other_ctrl);
|
||||
other_ctrl->set_focus_mode(Control::FocusMode::FOCUS_ALL);
|
||||
other_ctrl->grab_focus();
|
||||
|
||||
CHECK(other_ctrl->has_focus());
|
||||
CHECK_FALSE(ctrl->has_focus());
|
||||
CHECK_UNARY(other_ctrl->has_focus());
|
||||
CHECK_UNARY_FALSE(ctrl->has_focus());
|
||||
|
||||
memdelete(other_ctrl);
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Hide control will cause the focus to be released") {
|
||||
ctrl->set_focus_mode(Control::FocusMode::FOCUS_ALL);
|
||||
ctrl->grab_focus();
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
|
||||
ctrl->hide();
|
||||
CHECK_UNARY_FALSE(ctrl->has_focus());
|
||||
|
||||
ctrl->show();
|
||||
CHECK_UNARY_FALSE(ctrl->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] The parent node is hidden causing the focus to be released") {
|
||||
Control *child_ctrl = memnew(Control);
|
||||
ctrl->add_child(child_ctrl);
|
||||
|
||||
child_ctrl->set_focus_mode(Control::FocusMode::FOCUS_ALL);
|
||||
child_ctrl->grab_focus();
|
||||
CHECK_UNARY(child_ctrl->has_focus());
|
||||
|
||||
ctrl->hide();
|
||||
CHECK_UNARY_FALSE(child_ctrl->has_focus());
|
||||
|
||||
ctrl->show();
|
||||
CHECK_UNARY_FALSE(child_ctrl->has_focus());
|
||||
|
||||
memdelete(child_ctrl);
|
||||
}
|
||||
|
||||
memdelete(ctrl);
|
||||
}
|
||||
|
||||
TEST_CASE("[SceneTree][Control] Find next/prev valid focus") {
|
||||
Node *intermediate = memnew(Node);
|
||||
Control *ctrl = memnew(Control);
|
||||
intermediate->add_child(ctrl);
|
||||
SceneTree::get_singleton()->get_root()->add_child(intermediate);
|
||||
|
||||
SUBCASE("[SceneTree][Control] In FOCUS_CLICK mode") {
|
||||
ctrl->set_focus_mode(Control::FocusMode::FOCUS_CLICK);
|
||||
ctrl->grab_focus();
|
||||
REQUIRE_UNARY(ctrl->has_focus());
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_next action") {
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_prev action") {
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Has a sibling control but the parent node is not a control") {
|
||||
Control *other_ctrl = memnew(Control);
|
||||
intermediate->add_child(other_ctrl);
|
||||
|
||||
SUBCASE("[SceneTree][Control] Has a sibling control with FOCUS_ALL") {
|
||||
other_ctrl->set_focus_mode(Control::FocusMode::FOCUS_ALL);
|
||||
REQUIRE_EQ(other_ctrl->get_focus_mode(), Control::FocusMode::FOCUS_ALL);
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_next action") {
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
CHECK_UNARY_FALSE(other_ctrl->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_prev action") {
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
CHECK_UNARY_FALSE(other_ctrl->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Manually specify focus next") {
|
||||
ctrl->set_focus_next(ctrl->get_path_to(other_ctrl));
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_next action") {
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY_FALSE(ctrl->has_focus());
|
||||
CHECK_UNARY(other_ctrl->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_prev action") {
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
CHECK_UNARY_FALSE(other_ctrl->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Manually specified focus next is hidden") {
|
||||
other_ctrl->hide();
|
||||
REQUIRE_UNARY_FALSE(other_ctrl->is_visible());
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_next action") {
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
CHECK_UNARY_FALSE(other_ctrl->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_prev action") {
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
CHECK_UNARY_FALSE(other_ctrl->has_focus());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Manually specify focus prev") {
|
||||
ctrl->set_focus_previous(ctrl->get_path_to(other_ctrl));
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_next action") {
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
CHECK_UNARY_FALSE(other_ctrl->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_prev action") {
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY_FALSE(ctrl->has_focus());
|
||||
CHECK_UNARY(other_ctrl->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Manually specified focus next is hidden") {
|
||||
other_ctrl->hide();
|
||||
REQUIRE_UNARY_FALSE(other_ctrl->is_visible());
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_next action") {
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
CHECK_UNARY_FALSE(other_ctrl->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_prev action") {
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
CHECK_UNARY_FALSE(other_ctrl->has_focus());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Has a sibling control with FOCUS_CLICK") {
|
||||
other_ctrl->set_focus_mode(Control::FocusMode::FOCUS_CLICK);
|
||||
REQUIRE_EQ(other_ctrl->get_focus_mode(), Control::FocusMode::FOCUS_CLICK);
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_next action") {
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
CHECK_UNARY_FALSE(other_ctrl->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_prev action") {
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
CHECK_UNARY_FALSE(other_ctrl->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Manually specify focus next") {
|
||||
ctrl->set_focus_next(ctrl->get_path_to(other_ctrl));
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_next action") {
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY_FALSE(ctrl->has_focus());
|
||||
CHECK_UNARY(other_ctrl->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_prev action") {
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
CHECK_UNARY_FALSE(other_ctrl->has_focus());
|
||||
}
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Manually specify focus prev") {
|
||||
ctrl->set_focus_previous(ctrl->get_path_to(other_ctrl));
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_next action") {
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
CHECK_UNARY_FALSE(other_ctrl->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_prev action") {
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY_FALSE(ctrl->has_focus());
|
||||
CHECK_UNARY(other_ctrl->has_focus());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Has a sibling control with FOCUS_NONE") {
|
||||
other_ctrl->set_focus_mode(Control::FocusMode::FOCUS_NONE);
|
||||
REQUIRE_EQ(other_ctrl->get_focus_mode(), Control::FocusMode::FOCUS_NONE);
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_next action") {
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
CHECK_UNARY_FALSE(other_ctrl->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_prev action") {
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
CHECK_UNARY_FALSE(other_ctrl->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Manually specify focus next") {
|
||||
ctrl->set_focus_next(ctrl->get_path_to(other_ctrl));
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_next action") {
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
CHECK_UNARY_FALSE(other_ctrl->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_prev action") {
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
CHECK_UNARY_FALSE(other_ctrl->has_focus());
|
||||
}
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Manually specify focus prev") {
|
||||
ctrl->set_focus_previous(ctrl->get_path_to(other_ctrl));
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_next action") {
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
CHECK_UNARY_FALSE(other_ctrl->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_prev action") {
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
CHECK_UNARY_FALSE(other_ctrl->has_focus());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
memdelete(other_ctrl);
|
||||
}
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] In FOCUS_ALL mode") {
|
||||
ctrl->set_focus_mode(Control::FocusMode::FOCUS_ALL);
|
||||
REQUIRE_EQ(ctrl->get_focus_mode(), Control::FocusMode::FOCUS_ALL);
|
||||
|
||||
ctrl->grab_focus();
|
||||
REQUIRE_UNARY(ctrl->has_focus());
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_next action") {
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_prev action") {
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Has a sibling control but the parent node is not a control") {
|
||||
Control *other_ctrl = memnew(Control);
|
||||
SceneTree::get_singleton()->get_root()->add_child(other_ctrl);
|
||||
|
||||
SUBCASE("[SceneTree][Control] Has a sibling control with FOCUS_ALL") {
|
||||
other_ctrl->set_focus_mode(Control::FocusMode::FOCUS_ALL);
|
||||
REQUIRE_EQ(other_ctrl->get_focus_mode(), Control::FocusMode::FOCUS_ALL);
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_next action") {
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
CHECK_UNARY_FALSE(other_ctrl->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_prev action") {
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
CHECK_UNARY_FALSE(other_ctrl->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Manually specify focus next") {
|
||||
ctrl->set_focus_next(ctrl->get_path_to(other_ctrl));
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_next action") {
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY_FALSE(ctrl->has_focus());
|
||||
CHECK_UNARY(other_ctrl->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_prev action") {
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
CHECK_UNARY_FALSE(other_ctrl->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Manually specified focus next is hidden") {
|
||||
other_ctrl->hide();
|
||||
REQUIRE_UNARY_FALSE(other_ctrl->is_visible());
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_next action") {
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
CHECK_UNARY_FALSE(other_ctrl->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_prev action") {
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
CHECK_UNARY_FALSE(other_ctrl->has_focus());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Manually specify focus prev") {
|
||||
ctrl->set_focus_previous(ctrl->get_path_to(other_ctrl));
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_next action") {
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
CHECK_UNARY_FALSE(other_ctrl->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_prev action") {
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY_FALSE(ctrl->has_focus());
|
||||
CHECK_UNARY(other_ctrl->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Manually specified focus next is hidden") {
|
||||
other_ctrl->hide();
|
||||
REQUIRE_UNARY_FALSE(other_ctrl->is_visible());
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_next action") {
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
CHECK_UNARY_FALSE(other_ctrl->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_prev action") {
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
CHECK_UNARY_FALSE(other_ctrl->has_focus());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Has a sibling control with FOCUS_CLICK") {
|
||||
other_ctrl->set_focus_mode(Control::FocusMode::FOCUS_CLICK);
|
||||
REQUIRE_EQ(other_ctrl->get_focus_mode(), Control::FocusMode::FOCUS_CLICK);
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_next action") {
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
CHECK_UNARY_FALSE(other_ctrl->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_prev action") {
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
CHECK_UNARY_FALSE(other_ctrl->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Manually specify focus next") {
|
||||
ctrl->set_focus_next(ctrl->get_path_to(other_ctrl));
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_next action") {
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY_FALSE(ctrl->has_focus());
|
||||
CHECK_UNARY(other_ctrl->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_prev action") {
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
CHECK_UNARY_FALSE(other_ctrl->has_focus());
|
||||
}
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Manually specify focus prev") {
|
||||
ctrl->set_focus_previous(ctrl->get_path_to(other_ctrl));
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_next action") {
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
CHECK_UNARY_FALSE(other_ctrl->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_prev action") {
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY_FALSE(ctrl->has_focus());
|
||||
CHECK_UNARY(other_ctrl->has_focus());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Has a sibling control with FOCUS_NONE") {
|
||||
other_ctrl->set_focus_mode(Control::FocusMode::FOCUS_NONE);
|
||||
REQUIRE_EQ(other_ctrl->get_focus_mode(), Control::FocusMode::FOCUS_NONE);
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_next action") {
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
CHECK_UNARY_FALSE(other_ctrl->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_prev action") {
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
CHECK_UNARY_FALSE(other_ctrl->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Manually specify focus next") {
|
||||
ctrl->set_focus_next(ctrl->get_path_to(other_ctrl));
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_next action") {
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
CHECK_UNARY_FALSE(other_ctrl->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_prev action") {
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
CHECK_UNARY_FALSE(other_ctrl->has_focus());
|
||||
}
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Manually specify focus prev") {
|
||||
ctrl->set_focus_previous(ctrl->get_path_to(other_ctrl));
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_next action") {
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
CHECK_UNARY_FALSE(other_ctrl->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_prev action") {
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
CHECK_UNARY_FALSE(other_ctrl->has_focus());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
memdelete(other_ctrl);
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simple control tree") {
|
||||
Control *ctrl_0 = memnew(Control);
|
||||
Control *ctrl_1 = memnew(Control);
|
||||
Node2D *node_2d_2 = memnew(Node2D);
|
||||
|
||||
ctrl->add_child(ctrl_0);
|
||||
ctrl->add_child(ctrl_1);
|
||||
ctrl->add_child(node_2d_2);
|
||||
|
||||
ctrl_0->set_focus_mode(Control::FocusMode::FOCUS_ALL);
|
||||
ctrl_1->set_focus_mode(Control::FocusMode::FOCUS_ALL);
|
||||
REQUIRE_EQ(ctrl_0->get_focus_mode(), Control::FocusMode::FOCUS_ALL);
|
||||
REQUIRE_EQ(ctrl_1->get_focus_mode(), Control::FocusMode::FOCUS_ALL);
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_next action") {
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY(ctrl_0->has_focus());
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_next action") {
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY(ctrl_1->has_focus());
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_next action") {
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_prev action") {
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY(ctrl_1->has_focus());
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_prev action") {
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY(ctrl_0->has_focus());
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_prev action") {
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Skip next hidden control") {
|
||||
ctrl_0->hide();
|
||||
REQUIRE_UNARY_FALSE(ctrl_0->is_visible());
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY_FALSE(ctrl_0->has_focus());
|
||||
CHECK_UNARY(ctrl_1->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Skip next control with FOCUS_NONE") {
|
||||
ctrl_0->set_focus_mode(Control::FocusMode::FOCUS_NONE);
|
||||
REQUIRE_EQ(ctrl_0->get_focus_mode(), Control::FocusMode::FOCUS_NONE);
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY_FALSE(ctrl_0->has_focus());
|
||||
CHECK_UNARY(ctrl_1->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Skip next control with FOCUS_CLICK") {
|
||||
ctrl_0->set_focus_mode(Control::FocusMode::FOCUS_CLICK);
|
||||
REQUIRE_EQ(ctrl_0->get_focus_mode(), Control::FocusMode::FOCUS_CLICK);
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY_FALSE(ctrl_0->has_focus());
|
||||
CHECK_UNARY(ctrl_1->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Skip next top level control") {
|
||||
ctrl_0->set_as_top_level(true);
|
||||
REQUIRE_UNARY(ctrl_0->is_set_as_top_level());
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY_FALSE(ctrl_0->has_focus());
|
||||
CHECK_UNARY(ctrl_1->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Skip prev hidden control") {
|
||||
ctrl_1->hide();
|
||||
REQUIRE_UNARY_FALSE(ctrl_1->is_visible());
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY_FALSE(ctrl_1->has_focus());
|
||||
CHECK_UNARY(ctrl_0->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Skip prev control with FOCUS_NONE") {
|
||||
ctrl_1->set_focus_mode(Control::FocusMode::FOCUS_NONE);
|
||||
REQUIRE_EQ(ctrl_1->get_focus_mode(), Control::FocusMode::FOCUS_NONE);
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY_FALSE(ctrl_1->has_focus());
|
||||
CHECK_UNARY(ctrl_0->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Skip prev control with FOCUS_CLICK") {
|
||||
ctrl_1->set_focus_mode(Control::FocusMode::FOCUS_CLICK);
|
||||
REQUIRE_EQ(ctrl_1->get_focus_mode(), Control::FocusMode::FOCUS_CLICK);
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY_FALSE(ctrl_1->has_focus());
|
||||
CHECK_UNARY(ctrl_0->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Skip prev top level control") {
|
||||
ctrl_1->set_as_top_level(true);
|
||||
REQUIRE_UNARY(ctrl_1->is_set_as_top_level());
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY_FALSE(ctrl_1->has_focus());
|
||||
CHECK_UNARY(ctrl_0->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Add more node controls") {
|
||||
Control *ctrl_0_0 = memnew(Control);
|
||||
Control *ctrl_0_1 = memnew(Control);
|
||||
Control *ctrl_0_2 = memnew(Control);
|
||||
ctrl_0->add_child(ctrl_0_0);
|
||||
ctrl_0->add_child(ctrl_0_1);
|
||||
ctrl_0->add_child(ctrl_0_2);
|
||||
ctrl_0_0->set_focus_mode(Control::FocusMode::FOCUS_ALL);
|
||||
ctrl_0_1->set_focus_mode(Control::FocusMode::FOCUS_ALL);
|
||||
ctrl_0_2->set_focus_mode(Control::FocusMode::FOCUS_ALL);
|
||||
|
||||
Control *ctrl_1_0 = memnew(Control);
|
||||
Control *ctrl_1_1 = memnew(Control);
|
||||
Control *ctrl_1_2 = memnew(Control);
|
||||
ctrl_1->add_child(ctrl_1_0);
|
||||
ctrl_1->add_child(ctrl_1_1);
|
||||
ctrl_1->add_child(ctrl_1_2);
|
||||
ctrl_1_0->set_focus_mode(Control::FocusMode::FOCUS_ALL);
|
||||
ctrl_1_1->set_focus_mode(Control::FocusMode::FOCUS_ALL);
|
||||
ctrl_1_2->set_focus_mode(Control::FocusMode::FOCUS_ALL);
|
||||
|
||||
Control *ctrl_2_0 = memnew(Control);
|
||||
Control *ctrl_2_1 = memnew(Control);
|
||||
Control *ctrl_2_2 = memnew(Control);
|
||||
node_2d_2->add_child(ctrl_2_0);
|
||||
node_2d_2->add_child(ctrl_2_1);
|
||||
node_2d_2->add_child(ctrl_2_2);
|
||||
ctrl_2_0->set_focus_mode(Control::FocusMode::FOCUS_ALL);
|
||||
ctrl_2_1->set_focus_mode(Control::FocusMode::FOCUS_ALL);
|
||||
ctrl_2_2->set_focus_mode(Control::FocusMode::FOCUS_ALL);
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_next action") {
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY(ctrl_0->has_focus());
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_next action") {
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY(ctrl_0_0->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_prev action") {
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
}
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_prev action") {
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY(ctrl_1_2->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Exist top level tree") {
|
||||
ctrl_0->set_as_top_level(true);
|
||||
REQUIRE_UNARY(ctrl_0->is_set_as_top_level());
|
||||
|
||||
SUBCASE("[SceneTree][Control] Outside top level tree") {
|
||||
ctrl->grab_focus();
|
||||
REQUIRE_UNARY(ctrl->has_focus());
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_next action") {
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY(ctrl_1->has_focus());
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_prev action") {
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Inside top level tree") {
|
||||
ctrl_0->grab_focus();
|
||||
REQUIRE_UNARY(ctrl_0->has_focus());
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_next action") {
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY(ctrl_0_0->has_focus());
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_prev action") {
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY(ctrl_0->has_focus());
|
||||
}
|
||||
}
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_prev action") {
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY(ctrl_0_2->has_focus());
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_next action") {
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY(ctrl_0->has_focus());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Manually specified focus next") {
|
||||
ctrl->set_focus_next(ctrl->get_path_to(ctrl_2_1));
|
||||
ctrl_2_1->set_focus_next(ctrl_2_1->get_path_to(ctrl_1_0));
|
||||
ctrl_1_0->set_focus_next(ctrl_1_0->get_path_to(ctrl_0));
|
||||
ctrl_0->set_focus_next(ctrl_0->get_path_to(ctrl));
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_next action") {
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY(ctrl_2_1->has_focus());
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_next action") {
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY(ctrl_1_0->has_focus());
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_next action") {
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY(ctrl_0->has_focus());
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_next action") {
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_prev action") {
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY(ctrl_0_2->has_focus());
|
||||
}
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_prev action") {
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY(ctrl_1->has_focus());
|
||||
}
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_prev action") {
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY(ctrl_2_1->has_focus());
|
||||
}
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] The parent node is not visible") {
|
||||
node_2d_2->hide();
|
||||
REQUIRE_UNARY(ctrl_2_1->is_visible());
|
||||
REQUIRE_UNARY_FALSE(ctrl_2_1->is_visible_in_tree());
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_next action") {
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY_FALSE(ctrl->has_focus());
|
||||
CHECK_UNARY_FALSE(ctrl_2_1->has_focus());
|
||||
CHECK_UNARY_FALSE(ctrl_0->has_focus());
|
||||
CHECK_UNARY(ctrl_1->has_focus());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Manually specified focus prev") {
|
||||
ctrl->set_focus_previous(ctrl->get_path_to(ctrl_0_2));
|
||||
ctrl_0_2->set_focus_previous(ctrl_0_2->get_path_to(ctrl_1_1));
|
||||
ctrl_1_1->set_focus_previous(ctrl_1_1->get_path_to(ctrl_2_0));
|
||||
ctrl_2_0->set_focus_previous(ctrl_2_0->get_path_to(ctrl));
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_prev action") {
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY(ctrl_0_2->has_focus());
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_prev action") {
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY(ctrl_1_1->has_focus());
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_prev action") {
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY(ctrl_2_0->has_focus());
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_prev action") {
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_next action") {
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY(ctrl_2_0->has_focus());
|
||||
}
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_next action") {
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY(ctrl_1_2->has_focus());
|
||||
}
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_next action") {
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY(ctrl_0->has_focus());
|
||||
}
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] The parent node is not visible") {
|
||||
ctrl_0->hide();
|
||||
REQUIRE_UNARY(ctrl_0_2->is_visible());
|
||||
REQUIRE_UNARY_FALSE(ctrl_0_2->is_visible_in_tree());
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_prev action") {
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY_FALSE(ctrl->has_focus());
|
||||
CHECK_UNARY_FALSE(ctrl_0_2->has_focus());
|
||||
CHECK_UNARY(ctrl_1_2->has_focus());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SUBCASE("[SceneTree][Control] Exist hidden control tree") {
|
||||
ctrl_0->hide();
|
||||
REQUIRE_UNARY_FALSE(ctrl_0->is_visible());
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_next action") {
|
||||
SEND_GUI_ACTION("ui_focus_next");
|
||||
CHECK_UNARY(ctrl_1->has_focus());
|
||||
|
||||
SUBCASE("[SceneTree][Control] Simulate ui_focus_prev action") {
|
||||
SEND_GUI_ACTION("ui_focus_prev");
|
||||
CHECK_UNARY(ctrl->has_focus());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
memdelete(ctrl_2_2);
|
||||
memdelete(ctrl_2_1);
|
||||
memdelete(ctrl_2_0);
|
||||
memdelete(ctrl_1_2);
|
||||
memdelete(ctrl_1_1);
|
||||
memdelete(ctrl_1_0);
|
||||
memdelete(ctrl_0_2);
|
||||
memdelete(ctrl_0_1);
|
||||
memdelete(ctrl_0_0);
|
||||
}
|
||||
|
||||
memdelete(node_2d_2);
|
||||
memdelete(ctrl_1);
|
||||
memdelete(ctrl_0);
|
||||
}
|
||||
}
|
||||
|
||||
memdelete(ctrl);
|
||||
memdelete(intermediate);
|
||||
}
|
||||
|
||||
TEST_CASE("[SceneTree][Control] Anchoring") {
|
||||
Control *test_control = memnew(Control);
|
||||
Control *test_child = memnew(Control);
|
||||
|
|
@ -203,6 +993,38 @@ TEST_CASE("[SceneTree][Control] Anchoring") {
|
|||
memdelete(test_control);
|
||||
}
|
||||
|
||||
TEST_CASE("[SceneTree][Control] Set position does not cause size side-effects") {
|
||||
Control *test_control = memnew(Control);
|
||||
test_control->set_size(Size2(1, 1));
|
||||
test_control->set_custom_minimum_size(Size2(2, 2));
|
||||
Window *root = SceneTree::get_singleton()->get_root();
|
||||
root->add_child(test_control);
|
||||
|
||||
SUBCASE("Shrinks after setting position and smaller custom minimum size (without keeping offsets)") {
|
||||
test_control->set_position(Point2(10, 10), false);
|
||||
SceneTree::get_singleton()->process(0);
|
||||
|
||||
test_control->set_custom_minimum_size(Size2(0, 0));
|
||||
SceneTree::get_singleton()->process(0);
|
||||
CHECK_MESSAGE(
|
||||
test_control->get_size().is_equal_approx(Vector2(1, 1)),
|
||||
"Should shrink to original size after setting a smaller custom minimum size.");
|
||||
}
|
||||
|
||||
SUBCASE("Shrinks after setting position and smaller custom minimum size (while keeping offsets)") {
|
||||
test_control->set_position(Point2(10, 10), true);
|
||||
SceneTree::get_singleton()->process(0);
|
||||
|
||||
test_control->set_custom_minimum_size(Size2(0, 0));
|
||||
SceneTree::get_singleton()->process(0);
|
||||
CHECK_MESSAGE(
|
||||
test_control->get_size().is_equal_approx(Vector2(1, 1)),
|
||||
"Should shrink to original size after setting a smaller custom minimum size.");
|
||||
}
|
||||
|
||||
memdelete(test_control);
|
||||
}
|
||||
|
||||
TEST_CASE("[SceneTree][Control] Custom minimum size") {
|
||||
Control *test_control = memnew(Control);
|
||||
test_control->set_custom_minimum_size(Size2(4, 2));
|
||||
|
|
@ -247,8 +1069,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);
|
||||
|
|
@ -321,5 +1142,3 @@ TEST_CASE("[SceneTree][Control] Grow direction") {
|
|||
}
|
||||
|
||||
} // namespace TestControl
|
||||
|
||||
#endif // TEST_CONTROL_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_CURVE_H
|
||||
#define TEST_CURVE_H
|
||||
#pragma once
|
||||
|
||||
#include "core/math/math_funcs.h"
|
||||
#include "scene/resources/curve.h"
|
||||
|
|
@ -431,5 +430,3 @@ TEST_CASE("[Curve3D] Linear sampling should return exact value") {
|
|||
}
|
||||
|
||||
} // namespace TestCurve
|
||||
|
||||
#endif // TEST_CURVE_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_CURVE_2D_H
|
||||
#define TEST_CURVE_2D_H
|
||||
#pragma once
|
||||
|
||||
#include "core/math/math_funcs.h"
|
||||
#include "scene/resources/curve.h"
|
||||
|
|
@ -285,5 +284,3 @@ TEST_CASE("[Curve2D] Even length tessellation") {
|
|||
}
|
||||
|
||||
} // namespace TestCurve2D
|
||||
|
||||
#endif // TEST_CURVE_2D_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_CURVE_3D_H
|
||||
#define TEST_CURVE_3D_H
|
||||
#pragma once
|
||||
|
||||
#include "core/math/math_funcs.h"
|
||||
#include "scene/resources/curve.h"
|
||||
|
|
@ -283,5 +282,3 @@ TEST_CASE("[Curve3D] Even length tessellation") {
|
|||
}
|
||||
|
||||
} // namespace TestCurve3D
|
||||
|
||||
#endif // TEST_CURVE_3D_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_FONTFILE_H
|
||||
#define TEST_FONTFILE_H
|
||||
#pragma once
|
||||
|
||||
#include "modules/modules_enabled.gen.h"
|
||||
|
||||
|
|
@ -38,6 +37,54 @@
|
|||
|
||||
namespace TestFontfile {
|
||||
|
||||
TEST_CASE("[FontFile] Load Dynamic Font - getters") {
|
||||
#ifdef MODULE_FREETYPE_ENABLED
|
||||
String test_dynamic_font = "thirdparty/fonts/NotoSansHebrew_Regular.woff2";
|
||||
Ref<FontFile> ff;
|
||||
ff.instantiate();
|
||||
CHECK(ff->load_dynamic_font(test_dynamic_font) == OK);
|
||||
|
||||
// These properties come from the font file itself.
|
||||
CHECK(ff->get_font_name() == "Noto Sans Hebrew");
|
||||
CHECK(ff->get_font_style_name() == "Regular");
|
||||
CHECK(ff->get_font_weight() == 400);
|
||||
CHECK(ff->get_font_stretch() == 100);
|
||||
CHECK(ff->get_opentype_features() == Dictionary());
|
||||
|
||||
Dictionary expected_ot_name_strings;
|
||||
Dictionary en_dict;
|
||||
en_dict["copyright"] = "Copyright 2022 The Noto Project Authors (https://github.com/notofonts/hebrew)";
|
||||
en_dict["family_name"] = "Noto Sans Hebrew";
|
||||
en_dict["subfamily_name"] = "Regular";
|
||||
en_dict["full_name"] = "Noto Sans Hebrew Regular";
|
||||
en_dict["unique_identifier"] = "2.003;GOOG;NotoSansHebrew-Regular";
|
||||
en_dict["version"] = "Version 2.003";
|
||||
en_dict["postscript_name"] = "NotoSansHebrew-Regular";
|
||||
en_dict["trademark"] = "Noto is a trademark of Google Inc.";
|
||||
en_dict["license"] = "This Font Software is licensed under the SIL Open Font License, Version 1.1. This license is available with a FAQ at: https://scripts.sil.org/OFL";
|
||||
en_dict["license_url"] = "https://scripts.sil.org/OFL";
|
||||
en_dict["designer"] = "Monotype Design Team";
|
||||
en_dict["designer_url"] = "http://www.monotype.com/studio";
|
||||
en_dict["description"] = "Designed by Monotype design team.";
|
||||
en_dict["manufacturer"] = "Monotype Imaging Inc.";
|
||||
en_dict["vendor_url"] = "http://www.google.com/get/noto/";
|
||||
expected_ot_name_strings["en"] = en_dict;
|
||||
CHECK(ff->get_ot_name_strings() == expected_ot_name_strings);
|
||||
|
||||
// These are dependent on size and potentially other state. Act as regression tests based of arbitrary small size 10 and large size 100.
|
||||
CHECK(ff->get_height(10) == doctest::Approx((real_t)14));
|
||||
CHECK(ff->get_ascent(10) == doctest::Approx((real_t)11));
|
||||
CHECK(ff->get_descent(10) == doctest::Approx((real_t)3));
|
||||
CHECK(ff->get_underline_position(10) == doctest::Approx((real_t)1.25));
|
||||
CHECK(ff->get_underline_thickness(10) == doctest::Approx((real_t)0.5));
|
||||
CHECK(ff->get_height(100) == doctest::Approx((real_t)137));
|
||||
CHECK(ff->get_ascent(100) == doctest::Approx((real_t)107));
|
||||
CHECK(ff->get_descent(100) == doctest::Approx((real_t)30));
|
||||
CHECK(ff->get_underline_position(100) == doctest::Approx((real_t)12.5));
|
||||
CHECK(ff->get_underline_thickness(100) == doctest::Approx((real_t)5));
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST_CASE("[FontFile] Create font file and check data") {
|
||||
// Create test instance.
|
||||
Ref<FontFile> font_file;
|
||||
|
|
@ -78,5 +125,3 @@ TEST_CASE("[FontFile] Create font file and check data") {
|
|||
}
|
||||
|
||||
} // namespace TestFontfile
|
||||
|
||||
#endif // TEST_FONTFILE_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_GLTF_DOCUMENT_H
|
||||
#define TEST_GLTF_DOCUMENT_H
|
||||
#pragma once
|
||||
|
||||
#include "modules/gltf/extensions/gltf_document_extension_convert_importer_mesh.h"
|
||||
#include "modules/gltf/gltf_document.h"
|
||||
|
|
@ -246,5 +245,3 @@ TEST_CASE("[SceneTree][GLTFDocument] Load suzanne.glb") {
|
|||
}
|
||||
|
||||
} // namespace TestGLTFDocument
|
||||
|
||||
#endif // TEST_GLTF_DOCUMENT_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_GRADIENT_H
|
||||
#define TEST_GRADIENT_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/resources/gradient.h"
|
||||
|
||||
|
|
@ -143,5 +142,3 @@ TEST_CASE("[Gradient] Custom gradient (points specified out-of-order)") {
|
|||
"Custom out-of-order gradient should return the expected interpolated value at offset 0.1 after removing point at index 0.");
|
||||
}
|
||||
} // namespace TestGradient
|
||||
|
||||
#endif // TEST_GRADIENT_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_GRADIENT_TEXTURE_H
|
||||
#define TEST_GRADIENT_TEXTURE_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/resources/gradient_texture.h"
|
||||
|
||||
|
|
@ -83,5 +82,3 @@ TEST_CASE("[SceneTree][GradientTexture2D] Create GradientTexture2D") {
|
|||
}
|
||||
|
||||
} //namespace TestGradientTexture
|
||||
|
||||
#endif // TEST_GRADIENT_TEXTURE_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_GRAPH_NODE_H
|
||||
#define TEST_GRAPH_NODE_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/gui/graph_node.h"
|
||||
#include "scene/main/window.h"
|
||||
|
|
@ -57,5 +56,3 @@ TEST_CASE("[GraphNode][SceneTree]") {
|
|||
}
|
||||
|
||||
} // namespace TestGraphNode
|
||||
|
||||
#endif // TEST_GRAPH_NODE_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_HEIGHT_MAP_SHAPE_3D_H
|
||||
#define TEST_HEIGHT_MAP_SHAPE_3D_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/resources/3d/height_map_shape_3d.h"
|
||||
#include "scene/resources/image_texture.h"
|
||||
|
|
@ -118,5 +117,3 @@ TEST_CASE("[SceneTree][HeightMapShape3D] update_map_data_from_image") {
|
|||
}
|
||||
|
||||
} // namespace TestHeightMapShape3D
|
||||
|
||||
#endif // TEST_HEIGHT_MAP_SHAPE_3D_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_IMAGE_TEXTURE_H
|
||||
#define TEST_IMAGE_TEXTURE_H
|
||||
#pragma once
|
||||
|
||||
#include "core/io/image.h"
|
||||
#include "scene/resources/image_texture.h"
|
||||
|
|
@ -107,5 +106,3 @@ TEST_CASE("[SceneTree][ImageTexture] set_path") {
|
|||
}
|
||||
|
||||
} //namespace TestImageTexture
|
||||
|
||||
#endif // TEST_IMAGE_TEXTURE_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_IMAGE_TEXTURE_3D_H
|
||||
#define TEST_IMAGE_TEXTURE_3D_H
|
||||
#pragma once
|
||||
|
||||
#include "core/io/image.h"
|
||||
#include "scene/resources/image_texture.h"
|
||||
|
|
@ -97,5 +96,3 @@ TEST_CASE("[SceneTree][ImageTexture3D] set_path") {
|
|||
}
|
||||
|
||||
} //namespace TestImageTexture3D
|
||||
|
||||
#endif // TEST_IMAGE_TEXTURE_3D_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_INSTANCE_PLACEHOLDER_H
|
||||
#define TEST_INSTANCE_PLACEHOLDER_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/main/instance_placeholder.h"
|
||||
#include "scene/resources/packed_scene.h"
|
||||
|
|
@ -503,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++) {
|
||||
|
|
@ -530,5 +530,3 @@ TEST_CASE("[SceneTree][InstancePlaceholder] Instance a PackedScene containing an
|
|||
#endif // TOOLS_ENABLED
|
||||
|
||||
} //namespace TestInstancePlaceholder
|
||||
|
||||
#endif // TEST_INSTANCE_PLACEHOLDER_H
|
||||
|
|
|
|||
|
|
@ -28,10 +28,9 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_NAVIGATION_AGENT_2D_H
|
||||
#define TEST_NAVIGATION_AGENT_2D_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/2d/navigation_agent_2d.h"
|
||||
#include "scene/2d/navigation/navigation_agent_2d.h"
|
||||
#include "scene/2d/node_2d.h"
|
||||
#include "scene/main/window.h"
|
||||
#include "scene/resources/world_2d.h"
|
||||
|
|
@ -40,7 +39,7 @@
|
|||
|
||||
namespace TestNavigationAgent2D {
|
||||
|
||||
TEST_SUITE("[Navigation]") {
|
||||
TEST_SUITE("[Navigation2D]") {
|
||||
TEST_CASE("[SceneTree][NavigationAgent2D] New agent should have valid RID") {
|
||||
NavigationAgent2D *agent_node = memnew(NavigationAgent2D);
|
||||
CHECK(agent_node->get_rid().is_valid());
|
||||
|
|
@ -68,5 +67,3 @@ TEST_SUITE("[Navigation]") {
|
|||
}
|
||||
|
||||
} //namespace TestNavigationAgent2D
|
||||
|
||||
#endif // TEST_NAVIGATION_AGENT_2D_H
|
||||
|
|
|
|||
|
|
@ -28,10 +28,9 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_NAVIGATION_AGENT_3D_H
|
||||
#define TEST_NAVIGATION_AGENT_3D_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/3d/navigation_agent_3d.h"
|
||||
#include "scene/3d/navigation/navigation_agent_3d.h"
|
||||
#include "scene/3d/node_3d.h"
|
||||
#include "scene/main/window.h"
|
||||
|
||||
|
|
@ -39,7 +38,7 @@
|
|||
|
||||
namespace TestNavigationAgent3D {
|
||||
|
||||
TEST_SUITE("[Navigation]") {
|
||||
TEST_SUITE("[Navigation3D]") {
|
||||
TEST_CASE("[SceneTree][NavigationAgent3D] New agent should have valid RID") {
|
||||
NavigationAgent3D *agent_node = memnew(NavigationAgent3D);
|
||||
CHECK(agent_node->get_rid().is_valid());
|
||||
|
|
@ -67,5 +66,3 @@ TEST_SUITE("[Navigation]") {
|
|||
}
|
||||
|
||||
} //namespace TestNavigationAgent3D
|
||||
|
||||
#endif // TEST_NAVIGATION_AGENT_3D_H
|
||||
|
|
|
|||
|
|
@ -28,17 +28,16 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_NAVIGATION_OBSTACLE_2D_H
|
||||
#define TEST_NAVIGATION_OBSTACLE_2D_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/2d/navigation_obstacle_2d.h"
|
||||
#include "scene/2d/navigation/navigation_obstacle_2d.h"
|
||||
#include "scene/main/window.h"
|
||||
|
||||
#include "tests/test_macros.h"
|
||||
|
||||
namespace TestNavigationObstacle2D {
|
||||
|
||||
TEST_SUITE("[Navigation]") {
|
||||
TEST_SUITE("[Navigation2D]") {
|
||||
TEST_CASE("[SceneTree][NavigationObstacle2D] New obstacle should have valid RID") {
|
||||
NavigationObstacle2D *obstacle_node = memnew(NavigationObstacle2D);
|
||||
CHECK(obstacle_node->get_rid().is_valid());
|
||||
|
|
@ -65,5 +64,3 @@ TEST_SUITE("[Navigation]") {
|
|||
}
|
||||
|
||||
} //namespace TestNavigationObstacle2D
|
||||
|
||||
#endif // TEST_NAVIGATION_OBSTACLE_2D_H
|
||||
|
|
|
|||
|
|
@ -28,17 +28,16 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_NAVIGATION_OBSTACLE_3D_H
|
||||
#define TEST_NAVIGATION_OBSTACLE_3D_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/3d/navigation_obstacle_3d.h"
|
||||
#include "scene/3d/navigation/navigation_obstacle_3d.h"
|
||||
#include "scene/main/window.h"
|
||||
|
||||
#include "tests/test_macros.h"
|
||||
|
||||
namespace TestNavigationObstacle3D {
|
||||
|
||||
TEST_SUITE("[Navigation]") {
|
||||
TEST_SUITE("[Navigation3D]") {
|
||||
TEST_CASE("[SceneTree][NavigationObstacle3D] New obstacle should have valid RID") {
|
||||
NavigationObstacle3D *obstacle_node = memnew(NavigationObstacle3D);
|
||||
CHECK(obstacle_node->get_rid().is_valid());
|
||||
|
|
@ -65,5 +64,3 @@ TEST_SUITE("[Navigation]") {
|
|||
}
|
||||
|
||||
} //namespace TestNavigationObstacle3D
|
||||
|
||||
#endif // TEST_NAVIGATION_OBSTACLE_3D_H
|
||||
|
|
|
|||
|
|
@ -28,17 +28,16 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_NAVIGATION_REGION_2D_H
|
||||
#define TEST_NAVIGATION_REGION_2D_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/2d/navigation_region_2d.h"
|
||||
#include "scene/2d/navigation/navigation_region_2d.h"
|
||||
#include "scene/main/window.h"
|
||||
|
||||
#include "tests/test_macros.h"
|
||||
|
||||
namespace TestNavigationRegion2D {
|
||||
|
||||
TEST_SUITE("[Navigation]") {
|
||||
TEST_SUITE("[Navigation2D]") {
|
||||
TEST_CASE("[SceneTree][NavigationRegion2D] New region should have valid RID") {
|
||||
NavigationRegion2D *region_node = memnew(NavigationRegion2D);
|
||||
CHECK(region_node->get_rid().is_valid());
|
||||
|
|
@ -47,5 +46,3 @@ TEST_SUITE("[Navigation]") {
|
|||
}
|
||||
|
||||
} //namespace TestNavigationRegion2D
|
||||
|
||||
#endif // TEST_NAVIGATION_REGION_2D_H
|
||||
|
|
|
|||
|
|
@ -28,11 +28,10 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_NAVIGATION_REGION_3D_H
|
||||
#define TEST_NAVIGATION_REGION_3D_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/3d/mesh_instance_3d.h"
|
||||
#include "scene/3d/navigation_region_3d.h"
|
||||
#include "scene/3d/navigation/navigation_region_3d.h"
|
||||
#include "scene/main/window.h"
|
||||
#include "scene/resources/3d/primitive_meshes.h"
|
||||
|
||||
|
|
@ -40,7 +39,7 @@
|
|||
|
||||
namespace TestNavigationRegion3D {
|
||||
|
||||
TEST_SUITE("[Navigation]") {
|
||||
TEST_SUITE("[Navigation3D]") {
|
||||
TEST_CASE("[SceneTree][NavigationRegion3D] New region should have valid RID") {
|
||||
NavigationRegion3D *region_node = memnew(NavigationRegion3D);
|
||||
CHECK(region_node->get_rid().is_valid());
|
||||
|
|
@ -80,5 +79,3 @@ TEST_SUITE("[Navigation]") {
|
|||
}
|
||||
|
||||
} //namespace TestNavigationRegion3D
|
||||
|
||||
#endif // TEST_NAVIGATION_REGION_3D_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_NODE_H
|
||||
#define TEST_NODE_H
|
||||
#pragma once
|
||||
|
||||
#include "core/object/class_db.h"
|
||||
#include "scene/main/node.h"
|
||||
|
|
@ -893,5 +892,3 @@ TEST_CASE("[SceneTree][Node] Test the process priority") {
|
|||
}
|
||||
|
||||
} // namespace TestNode
|
||||
|
||||
#endif // TEST_NODE_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_NODE_2D_H
|
||||
#define TEST_NODE_2D_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/2d/node_2d.h"
|
||||
#include "scene/main/window.h"
|
||||
|
|
@ -212,5 +211,3 @@ TEST_CASE("[SceneTree][Node2D] Utility methods") {
|
|||
}
|
||||
|
||||
} // namespace TestNode2D
|
||||
|
||||
#endif // TEST_NODE_2D_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_OPTION_BUTTON_H
|
||||
#define TEST_OPTION_BUTTON_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/gui/option_button.h"
|
||||
|
||||
|
|
@ -83,7 +82,7 @@ TEST_CASE("[SceneTree][OptionButton] Single item") {
|
|||
memdelete(test_opt);
|
||||
}
|
||||
|
||||
TEST_CASE("[SceneTree][OptionButton] Complex structure") {
|
||||
TEST_CASE("[SceneTree][OptionButton] Many items") {
|
||||
OptionButton *test_opt = memnew(OptionButton);
|
||||
|
||||
SUBCASE("Creating a complex structure and checking getters") {
|
||||
|
|
@ -128,9 +127,32 @@ TEST_CASE("[SceneTree][OptionButton] Complex structure") {
|
|||
CHECK(test_opt->get_item_count() == 1);
|
||||
}
|
||||
|
||||
SUBCASE("Getters and setters not related to structure") {
|
||||
test_opt->add_item("regular", 2019);
|
||||
|
||||
Ref<Texture2D> test_icon = memnew(Texture2D);
|
||||
test_opt->add_icon_item(test_icon, "icon", 3092);
|
||||
|
||||
// item_text.
|
||||
test_opt->set_item_text(0, "example text");
|
||||
CHECK(test_opt->get_item_text(0) == "example text");
|
||||
|
||||
// item_metadata.
|
||||
Dictionary m;
|
||||
m["bool"] = true;
|
||||
m["String"] = "yes";
|
||||
test_opt->set_item_metadata(1, m);
|
||||
CHECK(test_opt->get_item_metadata(1) == m);
|
||||
|
||||
// item_tooltip.
|
||||
test_opt->set_item_tooltip(0, "tooltip guide");
|
||||
CHECK(test_opt->get_item_tooltip(0) == "tooltip guide");
|
||||
|
||||
test_opt->remove_item(1);
|
||||
test_opt->remove_item(0);
|
||||
}
|
||||
|
||||
memdelete(test_opt);
|
||||
}
|
||||
|
||||
} // namespace TestOptionButton
|
||||
|
||||
#endif // TEST_OPTION_BUTTON_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_PACKED_SCENE_H
|
||||
#define TEST_PACKED_SCENE_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/resources/packed_scene.h"
|
||||
|
||||
|
|
@ -282,5 +281,3 @@ TEST_CASE("[PackedScene] Recreate State") {
|
|||
}
|
||||
|
||||
} // namespace TestPackedScene
|
||||
|
||||
#endif // TEST_PACKED_SCENE_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_PARALLAX_2D_H
|
||||
#define TEST_PARALLAX_2D_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/2d/parallax_2d.h"
|
||||
#include "tests/test_macros.h"
|
||||
|
|
@ -127,5 +126,3 @@ TEST_CASE("[SceneTree][Parallax2D] Ignore Camera Scroll") {
|
|||
}
|
||||
|
||||
} // namespace TestParallax2D
|
||||
|
||||
#endif // TEST_PARALLAX_2D_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_PATH_2D_H
|
||||
#define TEST_PATH_2D_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/2d/path_2d.h"
|
||||
|
||||
|
|
@ -105,5 +104,3 @@ TEST_CASE("[SceneTree][Path2D] Curve setter and getter") {
|
|||
}
|
||||
|
||||
} // namespace TestPath2D
|
||||
|
||||
#endif // TEST_PATH_2D_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_PATH_3D_H
|
||||
#define TEST_PATH_3D_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/3d/path_3d.h"
|
||||
|
||||
|
|
@ -80,5 +79,3 @@ TEST_CASE("[Path3D] Curve setter and getter") {
|
|||
}
|
||||
|
||||
} // namespace TestPath3D
|
||||
|
||||
#endif // TEST_PATH_3D_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_PATH_FOLLOW_2D_H
|
||||
#define TEST_PATH_FOLLOW_2D_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/2d/path_2d.h"
|
||||
#include "scene/main/window.h"
|
||||
|
|
@ -254,5 +253,3 @@ TEST_CASE("[SceneTree][PathFollow2D] Progress out of range") {
|
|||
memdelete(path);
|
||||
}
|
||||
} // namespace TestPathFollow2D
|
||||
|
||||
#endif // TEST_PATH_FOLLOW_2D_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_PATH_FOLLOW_3D_H
|
||||
#define TEST_PATH_FOLLOW_3D_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/3d/path_3d.h"
|
||||
#include "scene/main/window.h"
|
||||
|
|
@ -46,7 +45,8 @@ bool is_equal_approx(const Vector3 &p_a, const Vector3 &p_b) {
|
|||
}
|
||||
|
||||
TEST_CASE("[SceneTree][PathFollow3D] Sampling with progress ratio") {
|
||||
Ref<Curve3D> curve = memnew(Curve3D);
|
||||
Ref<Curve3D> curve;
|
||||
curve.instantiate();
|
||||
curve->add_point(Vector3(0, 0, 0));
|
||||
curve->add_point(Vector3(100, 0, 0));
|
||||
curve->add_point(Vector3(100, 100, 0));
|
||||
|
|
@ -90,7 +90,8 @@ TEST_CASE("[SceneTree][PathFollow3D] Sampling with progress ratio") {
|
|||
}
|
||||
|
||||
TEST_CASE("[SceneTree][PathFollow3D] Sampling with progress") {
|
||||
Ref<Curve3D> curve = memnew(Curve3D);
|
||||
Ref<Curve3D> curve;
|
||||
curve.instantiate();
|
||||
curve->add_point(Vector3(0, 0, 0));
|
||||
curve->add_point(Vector3(100, 0, 0));
|
||||
curve->add_point(Vector3(100, 100, 0));
|
||||
|
|
@ -134,7 +135,8 @@ TEST_CASE("[SceneTree][PathFollow3D] Sampling with progress") {
|
|||
}
|
||||
|
||||
TEST_CASE("[SceneTree][PathFollow3D] Removal of a point in curve") {
|
||||
Ref<Curve3D> curve = memnew(Curve3D);
|
||||
Ref<Curve3D> curve;
|
||||
curve.instantiate();
|
||||
curve->add_point(Vector3(0, 0, 0));
|
||||
curve->add_point(Vector3(100, 0, 0));
|
||||
curve->add_point(Vector3(100, 100, 0));
|
||||
|
|
@ -158,7 +160,8 @@ TEST_CASE("[SceneTree][PathFollow3D] Removal of a point in curve") {
|
|||
}
|
||||
|
||||
TEST_CASE("[SceneTree][PathFollow3D] Progress ratio out of range") {
|
||||
Ref<Curve3D> curve = memnew(Curve3D);
|
||||
Ref<Curve3D> curve;
|
||||
curve.instantiate();
|
||||
curve->add_point(Vector3(0, 0, 0));
|
||||
curve->add_point(Vector3(100, 0, 0));
|
||||
Path3D *path = memnew(Path3D);
|
||||
|
|
@ -195,7 +198,8 @@ TEST_CASE("[SceneTree][PathFollow3D] Progress ratio out of range") {
|
|||
}
|
||||
|
||||
TEST_CASE("[SceneTree][PathFollow3D] Progress out of range") {
|
||||
Ref<Curve3D> curve = memnew(Curve3D);
|
||||
Ref<Curve3D> curve;
|
||||
curve.instantiate();
|
||||
curve->add_point(Vector3(0, 0, 0));
|
||||
curve->add_point(Vector3(100, 0, 0));
|
||||
Path3D *path = memnew(Path3D);
|
||||
|
|
@ -233,7 +237,8 @@ TEST_CASE("[SceneTree][PathFollow3D] Progress out of range") {
|
|||
|
||||
TEST_CASE("[SceneTree][PathFollow3D] Calculate forward vector") {
|
||||
const real_t dist_cube_100 = 100 * Math::sqrt(3.0);
|
||||
Ref<Curve3D> curve = memnew(Curve3D);
|
||||
Ref<Curve3D> curve;
|
||||
curve.instantiate();
|
||||
curve->add_point(Vector3(0, 0, 0));
|
||||
curve->add_point(Vector3(100, 0, 0));
|
||||
curve->add_point(Vector3(200, 100, -100));
|
||||
|
|
@ -284,6 +289,52 @@ TEST_CASE("[SceneTree][PathFollow3D] Calculate forward vector") {
|
|||
|
||||
memdelete(path);
|
||||
}
|
||||
} // namespace TestPathFollow3D
|
||||
|
||||
#endif // TEST_PATH_FOLLOW_3D_H
|
||||
TEST_CASE("[SceneTree][PathFollow3D] Calculate forward vector with degenerate curves") {
|
||||
Ref<Curve3D> curve;
|
||||
curve.instantiate();
|
||||
curve->add_point(Vector3(0, 0, 1), Vector3(), Vector3(1, 0, 0));
|
||||
curve->add_point(Vector3(1, 0, 0), Vector3(0, 0, 0), Vector3(0, 0, 0));
|
||||
curve->add_point(Vector3(0, 0, -1), Vector3(1, 0, 0), Vector3(-1, 0, 0));
|
||||
curve->add_point(Vector3(-1, 0, 0), Vector3(0, 0, 0), Vector3(0, 0, 0));
|
||||
curve->add_point(Vector3(0, 0, 1), Vector3(-1, 0, 0), Vector3());
|
||||
Path3D *path = memnew(Path3D);
|
||||
path->set_curve(curve);
|
||||
PathFollow3D *path_follow_3d = memnew(PathFollow3D);
|
||||
path->add_child(path_follow_3d);
|
||||
SceneTree::get_singleton()->get_root()->add_child(path);
|
||||
|
||||
path_follow_3d->set_loop(false);
|
||||
path_follow_3d->set_rotation_mode(PathFollow3D::RotationMode::ROTATION_ORIENTED);
|
||||
|
||||
path_follow_3d->set_progress_ratio(0.00);
|
||||
CHECK(is_equal_approx(Vector3(-1, 0, 0), path_follow_3d->get_transform().get_basis().get_column(2)));
|
||||
|
||||
path_follow_3d->set_progress_ratio(0.25);
|
||||
CHECK(is_equal_approx(Vector3(0, 0, 1), path_follow_3d->get_transform().get_basis().get_column(2)));
|
||||
|
||||
path_follow_3d->set_progress_ratio(0.50);
|
||||
CHECK(is_equal_approx(Vector3(1, 0, 0), path_follow_3d->get_transform().get_basis().get_column(2)));
|
||||
|
||||
path_follow_3d->set_progress_ratio(0.75);
|
||||
CHECK(is_equal_approx(Vector3(0, 0, -1), path_follow_3d->get_transform().get_basis().get_column(2)));
|
||||
|
||||
path_follow_3d->set_progress_ratio(1.00);
|
||||
CHECK(is_equal_approx(Vector3(-1, 0, 0), path_follow_3d->get_transform().get_basis().get_column(2)));
|
||||
|
||||
path_follow_3d->set_progress_ratio(0.125);
|
||||
CHECK(is_equal_approx(Vector3(-0.688375, 0, 0.725355), path_follow_3d->get_transform().get_basis().get_column(2)));
|
||||
|
||||
path_follow_3d->set_progress_ratio(0.375);
|
||||
CHECK(is_equal_approx(Vector3(0.688375, 0, 0.725355), path_follow_3d->get_transform().get_basis().get_column(2)));
|
||||
|
||||
path_follow_3d->set_progress_ratio(0.625);
|
||||
CHECK(is_equal_approx(Vector3(0.688375, 0, -0.725355), path_follow_3d->get_transform().get_basis().get_column(2)));
|
||||
|
||||
path_follow_3d->set_progress_ratio(0.875);
|
||||
CHECK(is_equal_approx(Vector3(-0.688375, 0, -0.725355), path_follow_3d->get_transform().get_basis().get_column(2)));
|
||||
|
||||
memdelete(path);
|
||||
}
|
||||
|
||||
} // namespace TestPathFollow3D
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_PHYSICS_MATERIAL_H
|
||||
#define TEST_PHYSICS_MATERIAL_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/resources/physics_material.h"
|
||||
#include "tests/test_macros.h"
|
||||
|
|
@ -103,5 +102,3 @@ TEST_CASE("[Physics_material] Absorbent") {
|
|||
}
|
||||
|
||||
} // namespace TestPhysics_material
|
||||
|
||||
#endif // TEST_PHYSICS_MATERIAL_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_PRIMITIVES_H
|
||||
#define TEST_PRIMITIVES_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/resources/3d/primitive_meshes.h"
|
||||
|
||||
|
|
@ -864,5 +863,3 @@ TEST_CASE("[SceneTree][Primitive][Text] Text Primitive") {
|
|||
}
|
||||
|
||||
} // namespace TestPrimitives
|
||||
|
||||
#endif // TEST_PRIMITIVES_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_SKELETON_3D_H
|
||||
#define TEST_SKELETON_3D_H
|
||||
#pragma once
|
||||
|
||||
#include "tests/test_macros.h"
|
||||
|
||||
|
|
@ -74,5 +73,3 @@ TEST_CASE("[Skeleton3D] Test per-bone meta") {
|
|||
memdelete(skeleton);
|
||||
}
|
||||
} // namespace TestSkeleton3D
|
||||
|
||||
#endif // TEST_SKELETON_3D_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_SKY_H
|
||||
#define TEST_SKY_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/resources/sky.h"
|
||||
|
||||
|
|
@ -218,5 +217,3 @@ TEST_CASE("[SceneTree][Sky] RID generation") {
|
|||
}
|
||||
|
||||
} // namespace TestSky
|
||||
|
||||
#endif // TEST_SKY_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_SPLIT_CONTAINER_H
|
||||
#define TEST_SPLIT_CONTAINER_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/gui/split_container.h"
|
||||
#include "scene/main/window.h"
|
||||
|
|
@ -1170,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);
|
||||
|
|
@ -1476,5 +1473,3 @@ TEST_CASE("[SceneTree][SplitContainer] Two children") {
|
|||
}
|
||||
|
||||
} // namespace TestSplitContainer
|
||||
|
||||
#endif // TEST_SPLIT_CONTAINER_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_SPRITE_FRAMES_H
|
||||
#define TEST_SPRITE_FRAMES_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/resources/sprite_frames.h"
|
||||
|
||||
|
|
@ -244,5 +243,3 @@ TEST_CASE("[SpriteFrames] Frame addition, removal, and retrieval") {
|
|||
"Clears frames.");
|
||||
}
|
||||
} // namespace TestSpriteFrames
|
||||
|
||||
#endif // TEST_SPRITE_FRAMES_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_STYLE_BOX_TEXTURE_H
|
||||
#define TEST_STYLE_BOX_TEXTURE_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/resources/style_box_texture.h"
|
||||
|
||||
|
|
@ -190,5 +189,3 @@ TEST_CASE("[StyleBoxTexture] get_draw_rect") {
|
|||
}
|
||||
|
||||
} // namespace TestStyleBoxTexture
|
||||
|
||||
#endif // TEST_STYLE_BOX_TEXTURE_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_TAB_BAR_H
|
||||
#define TEST_TAB_BAR_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/gui/tab_bar.h"
|
||||
#include "scene/main/window.h"
|
||||
|
|
@ -860,5 +859,3 @@ TEST_CASE("[SceneTree][TabBar] layout and offset") {
|
|||
// FIXME: Add tests for mouse click, keyboard navigation, and drag and drop.
|
||||
|
||||
} // namespace TestTabBar
|
||||
|
||||
#endif // TEST_TAB_BAR_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_TAB_CONTAINER_H
|
||||
#define TEST_TAB_CONTAINER_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/gui/tab_container.h"
|
||||
|
||||
|
|
@ -667,5 +666,3 @@ TEST_CASE("[SceneTree][TabContainer] layout and offset") {
|
|||
// FIXME: Add tests for mouse click, keyboard navigation, and drag and drop.
|
||||
|
||||
} // namespace TestTabContainer
|
||||
|
||||
#endif // TEST_TAB_CONTAINER_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_TEXT_EDIT_H
|
||||
#define TEST_TEXT_EDIT_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/gui/text_edit.h"
|
||||
|
||||
|
|
@ -55,13 +54,14 @@ static inline Array reverse_nested(Array array) {
|
|||
}
|
||||
|
||||
TEST_CASE("[SceneTree][TextEdit] text entry") {
|
||||
#if !defined(PHYSICS_2D_DISABLED) || !defined(PHYSICS_3D_DISABLED)
|
||||
SceneTree::get_singleton()->get_root()->set_physics_object_picking(false);
|
||||
#endif // !defined(PHYSICS_2D_DISABLED) || !defined(PHYSICS_3D_DISABLED)
|
||||
TextEdit *text_edit = memnew(TextEdit);
|
||||
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");
|
||||
|
|
@ -6446,8 +6446,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));
|
||||
|
|
@ -6711,8 +6710,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");
|
||||
|
||||
|
|
@ -7345,7 +7343,7 @@ TEST_CASE("[SceneTree][TextEdit] multicaret") {
|
|||
CHECK(text_edit->get_caret_line(1) == 1);
|
||||
CHECK(text_edit->get_caret_column(1) == 1);
|
||||
CHECK(text_edit->get_caret_line(2) == 0);
|
||||
CHECK(text_edit->get_caret_column(2) == 8);
|
||||
CHECK(text_edit->get_caret_column(2) == 7);
|
||||
|
||||
// Add caret above from first line and not first line wrap.
|
||||
text_edit->add_caret_at_carets(false);
|
||||
|
|
@ -7356,9 +7354,9 @@ TEST_CASE("[SceneTree][TextEdit] multicaret") {
|
|||
CHECK(text_edit->get_caret_line(1) == 1);
|
||||
CHECK(text_edit->get_caret_column(1) == 1);
|
||||
CHECK(text_edit->get_caret_line(2) == 0);
|
||||
CHECK(text_edit->get_caret_column(2) == 8);
|
||||
CHECK(text_edit->get_caret_column(2) == 7);
|
||||
CHECK(text_edit->get_caret_line(3) == 0);
|
||||
CHECK(text_edit->get_caret_column(3) == 4);
|
||||
CHECK(text_edit->get_caret_column(3) == 2);
|
||||
|
||||
// Cannot add caret above from first line first line wrap.
|
||||
text_edit->remove_secondary_carets();
|
||||
|
|
@ -7729,28 +7727,28 @@ TEST_CASE("[SceneTree][TextEdit] viewport") {
|
|||
|
||||
// Scroll.
|
||||
int v_scroll = text_edit->get_v_scroll();
|
||||
SEND_GUI_MOUSE_BUTTON_EVENT(Point2i(10, 10), MouseButton::WHEEL_DOWN, 0, Key::NONE);
|
||||
SEND_GUI_MOUSE_BUTTON_EVENT(Point2i(10, 10), MouseButton::WHEEL_DOWN, MouseButtonMask::NONE, Key::NONE);
|
||||
CHECK(text_edit->get_v_scroll() > v_scroll);
|
||||
SEND_GUI_MOUSE_BUTTON_EVENT(Point2i(10, 10), MouseButton::WHEEL_UP, 0, Key::NONE);
|
||||
SEND_GUI_MOUSE_BUTTON_EVENT(Point2i(10, 10), MouseButton::WHEEL_UP, MouseButtonMask::NONE, Key::NONE);
|
||||
CHECK(text_edit->get_v_scroll() == v_scroll);
|
||||
|
||||
// smooth scroll speed.
|
||||
text_edit->set_smooth_scroll_enabled(true);
|
||||
|
||||
v_scroll = text_edit->get_v_scroll();
|
||||
SEND_GUI_MOUSE_BUTTON_EVENT(Point2i(10, 10), MouseButton::WHEEL_DOWN, 0, Key::NONE);
|
||||
SEND_GUI_MOUSE_BUTTON_EVENT(Point2i(10, 10), MouseButton::WHEEL_DOWN, MouseButtonMask::NONE, Key::NONE);
|
||||
text_edit->notification(TextEdit::NOTIFICATION_INTERNAL_PHYSICS_PROCESS);
|
||||
CHECK(text_edit->get_v_scroll() >= v_scroll);
|
||||
SEND_GUI_MOUSE_BUTTON_EVENT(Point2i(10, 10), MouseButton::WHEEL_UP, 0, Key::NONE);
|
||||
SEND_GUI_MOUSE_BUTTON_EVENT(Point2i(10, 10), MouseButton::WHEEL_UP, MouseButtonMask::NONE, Key::NONE);
|
||||
text_edit->notification(TextEdit::NOTIFICATION_INTERNAL_PHYSICS_PROCESS);
|
||||
CHECK(text_edit->get_v_scroll() == v_scroll);
|
||||
|
||||
v_scroll = text_edit->get_v_scroll();
|
||||
text_edit->set_v_scroll_speed(10000);
|
||||
SEND_GUI_MOUSE_BUTTON_EVENT(Point2i(10, 10), MouseButton::WHEEL_DOWN, 0, Key::NONE);
|
||||
SEND_GUI_MOUSE_BUTTON_EVENT(Point2i(10, 10), MouseButton::WHEEL_DOWN, MouseButtonMask::NONE, Key::NONE);
|
||||
text_edit->notification(TextEdit::NOTIFICATION_INTERNAL_PHYSICS_PROCESS);
|
||||
CHECK(text_edit->get_v_scroll() >= v_scroll);
|
||||
SEND_GUI_MOUSE_BUTTON_EVENT(Point2i(10, 10), MouseButton::WHEEL_UP, 0, Key::NONE);
|
||||
SEND_GUI_MOUSE_BUTTON_EVENT(Point2i(10, 10), MouseButton::WHEEL_UP, MouseButtonMask::NONE, Key::NONE);
|
||||
text_edit->notification(TextEdit::NOTIFICATION_INTERNAL_PHYSICS_PROCESS);
|
||||
CHECK(text_edit->get_v_scroll() == v_scroll);
|
||||
|
||||
|
|
@ -7922,6 +7920,20 @@ TEST_CASE("[SceneTree][TextEdit] viewport") {
|
|||
memdelete(text_edit);
|
||||
}
|
||||
|
||||
TEST_CASE("[SceneTree][TextEdit] small height value") {
|
||||
TextEdit *text_edit = memnew(TextEdit);
|
||||
SceneTree::get_singleton()->get_root()->add_child(text_edit);
|
||||
|
||||
text_edit->set_size(Size2(800, 32));
|
||||
text_edit->set_text("0\n1\n2");
|
||||
MessageQueue::get_singleton()->flush();
|
||||
|
||||
text_edit->set_v_scroll(100);
|
||||
CHECK(text_edit->get_v_scroll() < 3);
|
||||
|
||||
memdelete(text_edit);
|
||||
}
|
||||
|
||||
TEST_CASE("[SceneTree][TextEdit] setter getters") {
|
||||
TextEdit *text_edit = memnew(TextEdit);
|
||||
SceneTree::get_singleton()->get_root()->add_child(text_edit);
|
||||
|
|
@ -8006,14 +8018,15 @@ 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");
|
||||
SIGNAL_WATCH(text_edit, "gutter_removed");
|
||||
|
||||
SUBCASE("[TextEdit] gutter add and remove") {
|
||||
text_edit->set_text("test1\ntest2\ntest3\ntest4");
|
||||
|
||||
text_edit->add_gutter();
|
||||
CHECK(text_edit->get_gutter_count() == 1);
|
||||
CHECK(text_edit->get_gutter_width(0) == 24);
|
||||
|
|
@ -8245,5 +8258,3 @@ TEST_CASE("[SceneTree][TextEdit] gutters") {
|
|||
}
|
||||
|
||||
} // namespace TestTextEdit
|
||||
|
||||
#endif // TEST_TEXT_EDIT_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_TEXTURE_PROGRESS_BAR_H
|
||||
#define TEST_TEXTURE_PROGRESS_BAR_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/gui/texture_progress_bar.h"
|
||||
|
||||
|
|
@ -64,22 +63,22 @@ TEST_CASE("[SceneTree][TextureProgressBar]") {
|
|||
texture_progress_bar->set_radial_initial_angle(30.5);
|
||||
|
||||
ERR_PRINT_OFF;
|
||||
texture_progress_bar->set_radial_initial_angle(INFINITY);
|
||||
texture_progress_bar->set_radial_initial_angle(Math::INF);
|
||||
ERR_PRINT_ON;
|
||||
CHECK(Math::is_equal_approx(texture_progress_bar->get_radial_initial_angle(), (float)30.5));
|
||||
|
||||
ERR_PRINT_OFF;
|
||||
texture_progress_bar->set_radial_initial_angle(-INFINITY);
|
||||
texture_progress_bar->set_radial_initial_angle(-Math::INF);
|
||||
ERR_PRINT_ON;
|
||||
CHECK(Math::is_equal_approx(texture_progress_bar->get_radial_initial_angle(), (float)30.5));
|
||||
|
||||
ERR_PRINT_OFF;
|
||||
texture_progress_bar->set_radial_initial_angle(NAN);
|
||||
texture_progress_bar->set_radial_initial_angle(Math::NaN);
|
||||
ERR_PRINT_ON;
|
||||
CHECK(Math::is_equal_approx(texture_progress_bar->get_radial_initial_angle(), (float)30.5));
|
||||
|
||||
ERR_PRINT_OFF;
|
||||
texture_progress_bar->set_radial_initial_angle(-NAN);
|
||||
texture_progress_bar->set_radial_initial_angle(-Math::NaN);
|
||||
ERR_PRINT_ON;
|
||||
CHECK(Math::is_equal_approx(texture_progress_bar->get_radial_initial_angle(), (float)30.5));
|
||||
}
|
||||
|
|
@ -88,5 +87,3 @@ TEST_CASE("[SceneTree][TextureProgressBar]") {
|
|||
}
|
||||
|
||||
} // namespace TestTextureProgressBar
|
||||
|
||||
#endif // TEST_TEXTURE_PROGRESS_BAR_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_THEME_H
|
||||
#define TEST_THEME_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/resources/image_texture.h"
|
||||
#include "scene/resources/style_box_flat.h"
|
||||
|
|
@ -269,5 +268,3 @@ TEST_CASE_FIXTURE(Fixture, "[Theme] Bad theme item names") {
|
|||
}
|
||||
|
||||
} // namespace TestTheme
|
||||
|
||||
#endif // TEST_THEME_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_TIMER_H
|
||||
#define TEST_TIMER_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/main/timer.h"
|
||||
|
||||
|
|
@ -157,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"));
|
||||
|
|
@ -171,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"));
|
||||
|
|
@ -187,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"));
|
||||
|
|
@ -201,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"));
|
||||
|
|
@ -213,5 +204,3 @@ TEST_CASE("[SceneTree][Timer] Check Timer timeout signal") {
|
|||
}
|
||||
|
||||
} // namespace TestTimer
|
||||
|
||||
#endif // TEST_TIMER_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_TREE_H
|
||||
#define TEST_TREE_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/gui/tree.h"
|
||||
|
||||
|
|
@ -297,5 +296,3 @@ TEST_CASE("[SceneTree][Tree]") {
|
|||
}
|
||||
|
||||
} // namespace TestTree
|
||||
|
||||
#endif // TEST_TREE_H
|
||||
|
|
|
|||
|
|
@ -28,17 +28,20 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_VIEWPORT_H
|
||||
#define TEST_VIEWPORT_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/2d/physics/area_2d.h"
|
||||
#include "scene/2d/physics/collision_shape_2d.h"
|
||||
#include "scene/2d/node_2d.h"
|
||||
#include "scene/gui/control.h"
|
||||
#include "scene/gui/subviewport_container.h"
|
||||
#include "scene/main/canvas_layer.h"
|
||||
#include "scene/main/window.h"
|
||||
|
||||
#ifndef PHYSICS_2D_DISABLED
|
||||
#include "scene/2d/physics/area_2d.h"
|
||||
#include "scene/2d/physics/collision_shape_2d.h"
|
||||
#include "scene/resources/2d/rectangle_shape_2d.h"
|
||||
#include "servers/physics_server_2d_dummy.h"
|
||||
#endif // PHYSICS_2D_DISABLED
|
||||
|
||||
#include "tests/test_macros.h"
|
||||
|
||||
|
|
@ -344,7 +347,7 @@ TEST_CASE("[SceneTree][Viewport] Controls and InputEvent handling") {
|
|||
SEND_GUI_MOUSE_BUTTON_EVENT(on_a, MouseButton::LEFT, MouseButtonMask::LEFT, Key::NONE);
|
||||
CHECK(node_a->has_focus());
|
||||
|
||||
SEND_GUI_MOUSE_BUTTON_EVENT(on_b, MouseButton::RIGHT, (int)MouseButtonMask::LEFT | (int)MouseButtonMask::RIGHT, Key::NONE);
|
||||
SEND_GUI_MOUSE_BUTTON_EVENT(on_b, MouseButton::RIGHT, MouseButtonMask::LEFT | MouseButtonMask::RIGHT, Key::NONE);
|
||||
CHECK(node_a->has_focus());
|
||||
|
||||
SEND_GUI_MOUSE_BUTTON_RELEASED_EVENT(on_b, MouseButton::RIGHT, MouseButtonMask::LEFT, Key::NONE);
|
||||
|
|
@ -359,12 +362,12 @@ TEST_CASE("[SceneTree][Viewport] Controls and InputEvent handling") {
|
|||
SEND_GUI_MOUSE_BUTTON_EVENT(on_background, MouseButton::RIGHT, MouseButtonMask::RIGHT, Key::NONE);
|
||||
CHECK_FALSE(root->gui_get_focus_owner());
|
||||
|
||||
SEND_GUI_MOUSE_BUTTON_EVENT(on_a, MouseButton::LEFT, (int)MouseButtonMask::LEFT | (int)MouseButtonMask::RIGHT, Key::NONE);
|
||||
SEND_GUI_MOUSE_BUTTON_EVENT(on_a, MouseButton::LEFT, MouseButtonMask::LEFT | MouseButtonMask::RIGHT, Key::NONE);
|
||||
CHECK(node_a->has_focus());
|
||||
SEND_GUI_MOUSE_BUTTON_RELEASED_EVENT(on_a, MouseButton::LEFT, MouseButtonMask::RIGHT, Key::NONE);
|
||||
CHECK(node_a->has_focus());
|
||||
|
||||
SEND_GUI_MOUSE_BUTTON_EVENT(on_b, MouseButton::LEFT, (int)MouseButtonMask::LEFT | (int)MouseButtonMask::RIGHT, Key::NONE);
|
||||
SEND_GUI_MOUSE_BUTTON_EVENT(on_b, MouseButton::LEFT, MouseButtonMask::LEFT | MouseButtonMask::RIGHT, Key::NONE);
|
||||
CHECK(node_b->has_focus());
|
||||
|
||||
SEND_GUI_MOUSE_BUTTON_RELEASED_EVENT(on_d, MouseButton::LEFT, MouseButtonMask::RIGHT, Key::NONE);
|
||||
|
|
@ -410,10 +413,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);
|
||||
|
|
@ -567,8 +567,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);
|
||||
|
||||
|
|
@ -775,8 +774,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);
|
||||
|
|
@ -854,8 +852,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);
|
||||
|
|
@ -907,8 +904,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);
|
||||
|
|
@ -984,8 +980,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);
|
||||
|
|
@ -1038,8 +1033,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);
|
||||
|
|
@ -1092,8 +1086,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));
|
||||
|
|
@ -1521,6 +1514,7 @@ TEST_CASE("[SceneTree][Viewport] Control mouse cursor shape") {
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef PHYSICS_2D_DISABLED
|
||||
class TestArea2D : public Area2D {
|
||||
GDCLASS(TestArea2D, Area2D);
|
||||
|
||||
|
|
@ -1616,15 +1610,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();
|
||||
|
|
@ -1787,7 +1774,7 @@ TEST_CASE("[SceneTree][Viewport] Physics Picking 2D") {
|
|||
|
||||
SUBCASE("[Viewport][Picking2D] CollisionObject in CanvasLayer") {
|
||||
CanvasLayer *node_c = memnew(CanvasLayer);
|
||||
node_c->set_rotation(Math_PI);
|
||||
node_c->set_rotation(Math::PI);
|
||||
node_c->set_offset(Point2i(100, 100));
|
||||
root->add_child(node_c);
|
||||
|
||||
|
|
@ -1928,6 +1915,7 @@ TEST_CASE("[SceneTree][Viewport] Physics Picking 2D") {
|
|||
memdelete(E.a);
|
||||
}
|
||||
}
|
||||
#endif // PHYSICS_2D_DISABLED
|
||||
|
||||
TEST_CASE("[SceneTree][Viewport] Embedded Windows") {
|
||||
Window *root = SceneTree::get_singleton()->get_root();
|
||||
|
|
@ -1945,5 +1933,3 @@ TEST_CASE("[SceneTree][Viewport] Embedded Windows") {
|
|||
}
|
||||
|
||||
} // namespace TestViewport
|
||||
|
||||
#endif // TEST_VIEWPORT_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_VISUAL_SHADER_H
|
||||
#define TEST_VISUAL_SHADER_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/resources/visual_shader.h"
|
||||
|
||||
|
|
@ -147,5 +146,3 @@ TEST_CASE("[SceneTree][VisualShader] Testing Varyings") {
|
|||
}
|
||||
|
||||
} //namespace TestVisualArray
|
||||
|
||||
#endif // TEST_VISUAL_SHADER_H
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef TEST_WINDOW_H
|
||||
#define TEST_WINDOW_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/gui/control.h"
|
||||
#include "scene/main/window.h"
|
||||
|
|
@ -92,5 +91,3 @@ TEST_CASE("[SceneTree][Window]") {
|
|||
}
|
||||
|
||||
} // namespace TestWindow
|
||||
|
||||
#endif // TEST_WINDOW_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue