From 7b9c84b805e286b7989534bcba6e5b45badc0e52 Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Sat, 6 Apr 2024 12:56:55 +0200 Subject: [PATCH] Update check_children() and check_orphan_nodes() I made them no longer be a single line. check_children() now prints all children of /root too. --- addons/besseretests/src/runtimescene.gd | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/addons/besseretests/src/runtimescene.gd b/addons/besseretests/src/runtimescene.gd index f3da277..29e157e 100644 --- a/addons/besseretests/src/runtimescene.gd +++ b/addons/besseretests/src/runtimescene.gd @@ -166,6 +166,13 @@ func terminate(exit_code: int = 0) -> void: get_tree().quit(exit_code) # Checks -func check_children() -> void: if get_tree().root.get_child_count() != 1: lwarn("There are still '" + str(get_tree().root.get_child_count()-1) + "' children active in the scene tree. Please make sure to call 'remove_child' on them in your tests.") +func check_children() -> void: + if get_tree().root.get_child_count() != 1: + lwarn("There are still '" + str(get_tree().root.get_child_count()-1) + "' children active in the scene tree. Please make sure to call 'remove_child' on them in your tests.") + lwarn("Here's a tree of /root:") + get_tree().root.print_tree_pretty() -func check_orphan_nodes() -> void: if config_print_orphan_nodes: if Performance.get_monitor(Performance.OBJECT_ORPHAN_NODE_COUNT) != 4: lwarn("There are still '" + str(Performance.get_monitor(Performance.OBJECT_ORPHAN_NODE_COUNT)-4) + "' orphan nodes loaded. Please make sure to call 'queue_free' or 'free' on them in your tests.") +func check_orphan_nodes() -> void: + if config_print_orphan_nodes: + if Performance.get_monitor(Performance.OBJECT_ORPHAN_NODE_COUNT) != 4: + lwarn("There are still '" + str(Performance.get_monitor(Performance.OBJECT_ORPHAN_NODE_COUNT)-4) + "' orphan nodes loaded. Please make sure to call 'queue_free' or 'free' on them in your tests.")