Merge pull request #88449 from AThousandShips/test_tool_fix

[Tests] Fix test regression without editor
This commit is contained in:
Rémi Verschelde 2024-02-17 19:31:00 +01:00
commit 4f59a77c51
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 7 additions and 0 deletions

View File

@ -30,8 +30,11 @@
#include "test_main.h" #include "test_main.h"
#ifdef TOOLS_ENABLED
#include "editor/editor_paths.h" #include "editor/editor_paths.h"
#include "editor/editor_settings.h" #include "editor/editor_settings.h"
#endif // TOOLS_ENABLED
#include "tests/core/config/test_project_settings.h" #include "tests/core/config/test_project_settings.h"
#include "tests/core/input/test_input_event.h" #include "tests/core/input/test_input_event.h"
#include "tests/core/input/test_input_event_key.h" #include "tests/core/input/test_input_event_key.h"
@ -270,11 +273,13 @@ struct GodotTestCaseListener : public doctest::IReporter {
SceneTree::get_singleton()->get_root()->set_embedding_subwindows(true); SceneTree::get_singleton()->get_root()->set_embedding_subwindows(true);
} }
#ifdef TOOLS_ENABLED
if (name.find("[Editor]") != -1) { if (name.find("[Editor]") != -1) {
Engine::get_singleton()->set_editor_hint(true); Engine::get_singleton()->set_editor_hint(true);
EditorPaths::create(); EditorPaths::create();
EditorSettings::create(); EditorSettings::create();
} }
#endif // TOOLS_ENABLED
return; return;
} }
@ -298,9 +303,11 @@ struct GodotTestCaseListener : public doctest::IReporter {
} }
void test_case_end(const doctest::CurrentTestCaseStats &) override { void test_case_end(const doctest::CurrentTestCaseStats &) override {
#ifdef TOOLS_ENABLED
if (EditorSettings::get_singleton()) { if (EditorSettings::get_singleton()) {
EditorSettings::destroy(); EditorSettings::destroy();
} }
#endif // TOOLS_ENABLED
Engine::get_singleton()->set_editor_hint(false); Engine::get_singleton()->set_editor_hint(false);