mirror of
https://github.com/Redot-Engine/redot-engine.git
synced 2025-12-05 23:07:42 -05:00
Allow to compile templates without physics servers
This commit is contained in:
@@ -54,7 +54,9 @@ 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();
|
||||
|
||||
@@ -30,14 +30,18 @@
|
||||
|
||||
#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"
|
||||
|
||||
@@ -1520,6 +1524,7 @@ TEST_CASE("[SceneTree][Viewport] Control mouse cursor shape") {
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef PHYSICS_2D_DISABLED
|
||||
class TestArea2D : public Area2D {
|
||||
GDCLASS(TestArea2D, Area2D);
|
||||
|
||||
@@ -1927,6 +1932,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();
|
||||
|
||||
@@ -135,7 +135,9 @@
|
||||
#include "tests/scene/test_parallax_2d.h"
|
||||
#include "tests/scene/test_path_2d.h"
|
||||
#include "tests/scene/test_path_follow_2d.h"
|
||||
#ifndef PHYSICS_3D_DISABLED
|
||||
#include "tests/scene/test_physics_material.h"
|
||||
#endif // PHYSICS_3D_DISABLED
|
||||
#include "tests/scene/test_sprite_frames.h"
|
||||
#include "tests/scene/test_style_box_texture.h"
|
||||
#include "tests/scene/test_texture_progress_bar.h"
|
||||
@@ -176,7 +178,9 @@
|
||||
#include "tests/scene/test_arraymesh.h"
|
||||
#include "tests/scene/test_camera_3d.h"
|
||||
#include "tests/scene/test_gltf_document.h"
|
||||
#ifndef PHYSICS_3D_DISABLED
|
||||
#include "tests/scene/test_height_map_shape_3d.h"
|
||||
#endif // PHYSICS_3D_DISABLED
|
||||
#include "tests/scene/test_path_3d.h"
|
||||
#include "tests/scene/test_path_follow_3d.h"
|
||||
#include "tests/scene/test_primitives.h"
|
||||
@@ -194,12 +198,14 @@
|
||||
#include "servers/navigation_server_2d.h"
|
||||
#include "servers/navigation_server_3d.h"
|
||||
#endif // _3D_DISABLED
|
||||
#ifndef PHYSICS_2D_DISABLED
|
||||
#include "servers/physics_server_2d.h"
|
||||
#include "servers/physics_server_2d_dummy.h"
|
||||
#ifndef _3D_DISABLED
|
||||
#endif // PHYSICS_2D_DISABLED
|
||||
#ifndef PHYSICS_3D_DISABLED
|
||||
#include "servers/physics_server_3d.h"
|
||||
#include "servers/physics_server_3d_dummy.h"
|
||||
#endif // _3D_DISABLED
|
||||
#endif // PHYSICS_3D_DISABLED
|
||||
#include "servers/rendering/rendering_server_default.h"
|
||||
|
||||
int test_main(int argc, char *argv[]) {
|
||||
@@ -274,9 +280,13 @@ struct GodotTestCaseListener : public doctest::IReporter {
|
||||
|
||||
SignalWatcher *signal_watcher = nullptr;
|
||||
|
||||
#ifndef PHYSICS_2D_DISABLED
|
||||
PhysicsServer2D *physics_server_2d = nullptr;
|
||||
#ifndef _3D_DISABLED
|
||||
#endif // PHYSICS_2D_DISABLED
|
||||
#ifndef PHYSICS_3D_DISABLED
|
||||
PhysicsServer3D *physics_server_3d = nullptr;
|
||||
#endif // PHYSICS_3D_DISABLED
|
||||
#ifndef _3D_DISABLED
|
||||
NavigationServer3D *navigation_server_3d = nullptr;
|
||||
NavigationServer2D *navigation_server_2d = nullptr;
|
||||
#endif // _3D_DISABLED
|
||||
@@ -311,19 +321,21 @@ struct GodotTestCaseListener : public doctest::IReporter {
|
||||
ThemeDB::get_singleton()->finalize_theme();
|
||||
ThemeDB::get_singleton()->initialize_theme();
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
#ifndef PHYSICS_3D_DISABLED
|
||||
physics_server_3d = PhysicsServer3DManager::get_singleton()->new_default_server();
|
||||
if (!physics_server_3d) {
|
||||
physics_server_3d = memnew(PhysicsServer3DDummy);
|
||||
}
|
||||
physics_server_3d->init();
|
||||
#endif // _3D_DISABLED
|
||||
#endif // PHYSICS_3D_DISABLED
|
||||
|
||||
#ifndef PHYSICS_2D_DISABLED
|
||||
physics_server_2d = PhysicsServer2DManager::get_singleton()->new_default_server();
|
||||
if (!physics_server_2d) {
|
||||
physics_server_2d = memnew(PhysicsServer2DDummy);
|
||||
}
|
||||
physics_server_2d->init();
|
||||
#endif // PHYSICS_2D_DISABLED
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
ERR_PRINT_OFF;
|
||||
@@ -411,19 +423,21 @@ struct GodotTestCaseListener : public doctest::IReporter {
|
||||
}
|
||||
#endif // _3D_DISABLED
|
||||
|
||||
#ifndef _3D_DISABLED
|
||||
#ifndef PHYSICS_3D_DISABLED
|
||||
if (physics_server_3d) {
|
||||
physics_server_3d->finish();
|
||||
memdelete(physics_server_3d);
|
||||
physics_server_3d = nullptr;
|
||||
}
|
||||
#endif // _3D_DISABLED
|
||||
#endif // PHYSICS_3D_DISABLED
|
||||
|
||||
#ifndef PHYSICS_2D_DISABLED
|
||||
if (physics_server_2d) {
|
||||
physics_server_2d->finish();
|
||||
memdelete(physics_server_2d);
|
||||
physics_server_2d = nullptr;
|
||||
}
|
||||
#endif // PHYSICS_2D_DISABLED
|
||||
|
||||
if (Input::get_singleton()) {
|
||||
memdelete(Input::get_singleton());
|
||||
|
||||
Reference in New Issue
Block a user