Skip to content

Commit

Permalink
Merge pull request #88449 from AThousandShips/test_tool_fix
Browse files Browse the repository at this point in the history
[Tests] Fix test regression without editor
  • Loading branch information
akien-mga committed Feb 17, 2024
2 parents 4ce5e26 + d5212b4 commit 4f59a77
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/test_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@

#include "test_main.h"

#ifdef TOOLS_ENABLED
#include "editor/editor_paths.h"
#include "editor/editor_settings.h"
#endif // TOOLS_ENABLED

#include "tests/core/config/test_project_settings.h"
#include "tests/core/input/test_input_event.h"
#include "tests/core/input/test_input_event_key.h"
Expand Down Expand Up @@ -270,11 +273,13 @@ struct GodotTestCaseListener : public doctest::IReporter {
SceneTree::get_singleton()->get_root()->set_embedding_subwindows(true);
}

#ifdef TOOLS_ENABLED
if (name.find("[Editor]") != -1) {
Engine::get_singleton()->set_editor_hint(true);
EditorPaths::create();
EditorSettings::create();
}
#endif // TOOLS_ENABLED

return;
}
Expand All @@ -298,9 +303,11 @@ struct GodotTestCaseListener : public doctest::IReporter {
}

void test_case_end(const doctest::CurrentTestCaseStats &) override {
#ifdef TOOLS_ENABLED
if (EditorSettings::get_singleton()) {
EditorSettings::destroy();
}
#endif // TOOLS_ENABLED

Engine::get_singleton()->set_editor_hint(false);

Expand Down

0 comments on commit 4f59a77

Please sign in to comment.