From 6f426c3360595593294d910471f3c30407bbd38f Mon Sep 17 00:00:00 2001 From: "Andrii Doroshenko (Xrayez)" Date: Sun, 2 Aug 2020 21:30:56 +0300 Subject: 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 --- modules/mobile_vr/register_types.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'modules') diff --git a/modules/mobile_vr/register_types.cpp b/modules/mobile_vr/register_types.cpp index 75638d47c4..0bb555e780 100644 --- a/modules/mobile_vr/register_types.cpp +++ b/modules/mobile_vr/register_types.cpp @@ -35,9 +35,11 @@ void register_mobile_vr_types() { ClassDB::register_class(); - Ref mobile_vr; - mobile_vr.instance(); - XRServer::get_singleton()->add_interface(mobile_vr); + if (XRServer::get_singleton()) { + Ref mobile_vr; + mobile_vr.instance(); + XRServer::get_singleton()->add_interface(mobile_vr); + } } void unregister_mobile_vr_types() { -- cgit v1.2.3