summaryrefslogtreecommitdiffstats
path: root/modules/gdscript
diff options
context:
space:
mode:
authorGeorge Marques <george@gmarqu.es>2023-07-13 13:05:42 -0300
committerGeorge Marques <george@gmarqu.es>2023-07-13 13:05:42 -0300
commit80ba1e0614b87693f154ab52981cd9f7af462a9b (patch)
treea2c4dc5ee749445cfd6cdae59924a97cb7ba9b2b /modules/gdscript
parentef155c1aeb216fa5a732913b6f2dc321e4b512dc (diff)
downloadredot-engine-80ba1e0614b87693f154ab52981cd9f7af462a9b.tar.gz
GDScript: Load global classes when running debug tests
So when running compiler debug tests it works with dependencies within a project.
Diffstat (limited to 'modules/gdscript')
-rw-r--r--modules/gdscript/tests/test_gdscript.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/modules/gdscript/tests/test_gdscript.cpp b/modules/gdscript/tests/test_gdscript.cpp
index 0446a7aad6..31420c4c1b 100644
--- a/modules/gdscript/tests/test_gdscript.cpp
+++ b/modules/gdscript/tests/test_gdscript.cpp
@@ -222,6 +222,16 @@ void test(TestType p_type) {
// Initialize the language for the test routine.
init_language(fa->get_path_absolute().get_base_dir());
+ // Load global classes.
+ TypedArray<Dictionary> script_classes = ProjectSettings::get_singleton()->get_global_class_list();
+ for (int i = 0; i < script_classes.size(); i++) {
+ Dictionary c = script_classes[i];
+ if (!c.has("class") || !c.has("language") || !c.has("path") || !c.has("base")) {
+ continue;
+ }
+ ScriptServer::add_global_class(c["class"], c["base"], c["language"], c["path"]);
+ }
+
Vector<uint8_t> buf;
uint64_t flen = fa->get_length();
buf.resize(flen + 1);