1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Add unit test runner for autocompletion

This commit is contained in:
HolonProduction
2023-11-21 16:06:43 +01:00
parent d822fd5322
commit af4cbaf751
15 changed files with 236 additions and 12 deletions

View File

@@ -30,6 +30,8 @@
#include "test_main.h"
#include "editor/editor_paths.h"
#include "editor/editor_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_key.h"
@@ -221,7 +223,7 @@ struct GodotTestCaseListener : public doctest::IReporter {
String name = String(p_in.m_name);
String suite_name = String(p_in.m_test_suite);
if (name.find("[SceneTree]") != -1) {
if (name.find("[SceneTree]") != -1 || name.find("[Editor]") != -1) {
memnew(MessageQueue);
memnew(Input);
@@ -264,6 +266,13 @@ struct GodotTestCaseListener : public doctest::IReporter {
if (!DisplayServer::get_singleton()->has_feature(DisplayServer::Feature::FEATURE_SUBWINDOWS)) {
SceneTree::get_singleton()->get_root()->set_embedding_subwindows(true);
}
if (name.find("[Editor]") != -1) {
Engine::get_singleton()->set_editor_hint(true);
EditorPaths::create();
EditorSettings::create();
}
return;
}
@@ -286,6 +295,12 @@ struct GodotTestCaseListener : public doctest::IReporter {
}
void test_case_end(const doctest::CurrentTestCaseStats &) override {
if (EditorSettings::get_singleton()) {
EditorSettings::destroy();
}
Engine::get_singleton()->set_editor_hint(false);
if (SceneTree::get_singleton()) {
SceneTree::get_singleton()->finalize();
}