Port ClassDB tests to use doctest
Extracted the most minimal core initialization functionality from `setup()` and `setup2()` so that `ClassDB` could be tested properly (input, audio, rendering, physics etc, are excluded). Display and rendering servers/singletons are not initialized at all. Due to the fact that most subsystems are disabled, fixed various crashes in the process (in order): - `AcceptDialog` OK/cancel swap behavior (used `DisplayServer` while `register_scene_types()`); - `make_default_theme` which depends on `RenderingServer`; - `XRServer` singleton access while calling `register_modules_types()`; - hidden bug in a way joypads are cleaned up (MacOS and Linux only). Removed manual `ClassDB` init/cleanup calls from `test_validate_testing.h`. ClassDB tests: Co-authored-by: Ignacio Etcheverry <ignalfonsore@gmail.com>
This commit is contained in:
@@ -372,7 +372,11 @@ void register_scene_types() {
|
||||
|
||||
OS::get_singleton()->yield(); //may take time to init
|
||||
|
||||
AcceptDialog::set_swap_cancel_ok(GLOBAL_DEF_NOVAL("gui/common/swap_cancel_ok", bool(DisplayServer::get_singleton()->get_swap_cancel_ok())));
|
||||
bool swap_cancel_ok = false;
|
||||
if (DisplayServer::get_singleton()) {
|
||||
swap_cancel_ok = GLOBAL_DEF_NOVAL("gui/common/swap_cancel_ok", bool(DisplayServer::get_singleton()->get_swap_cancel_ok()));
|
||||
}
|
||||
AcceptDialog::set_swap_cancel_ok(swap_cancel_ok);
|
||||
#endif
|
||||
|
||||
/* REGISTER 3D */
|
||||
@@ -912,8 +916,10 @@ void register_scene_types() {
|
||||
}
|
||||
}
|
||||
|
||||
// Always make the default theme to avoid invalid default font/icon/style in the given theme
|
||||
make_default_theme(default_theme_hidpi, font);
|
||||
// Always make the default theme to avoid invalid default font/icon/style in the given theme.
|
||||
if (RenderingServer::get_singleton()) {
|
||||
make_default_theme(default_theme_hidpi, font);
|
||||
}
|
||||
|
||||
if (theme_path != String()) {
|
||||
Ref<Theme> theme = ResourceLoader::load(theme_path);
|
||||
|
||||
Reference in New Issue
Block a user