diff --git a/tests/test_desktop_hides_touch_controls.gd b/tests/test_desktop_hides_touch_controls.gd index 632a24f..2204226 100644 --- a/tests/test_desktop_hides_touch_controls.gd +++ b/tests/test_desktop_hides_touch_controls.gd @@ -12,9 +12,12 @@ extends SceneTree # C. a touch device keeps every one of them, even with a keyboard attached - # a finger is still a way to play it # -# The touchscreen answer is read from DisplayServer, which headless says yes -# to, so B is exercised by driving the handler directly under a stubbed -# answer. That is the whole behaviour: "no touchscreen + keyboard used". +# The touchscreen answer is read from DisplayServer, and headless does not +# answer the same way everywhere: Godot on Android says yes, Godot on Windows +# says no. So B is exercised by driving the handler directly under a stubbed +# answer, and C is skipped - not failed - wherever there is no touchscreen to +# exercise it with. That is the whole behaviour: "no touchscreen + keyboard +# used". const CONTROLS: Array = ["UI/Joystick", "UI/FireStick", "UI/PivotCWButton", "UI/PivotCCWButton"] @@ -60,15 +63,18 @@ func _process(delta: float) -> bool: print("all four touch controls start visible") # --- C. a touchscreen keeps them ---------------------------------- - # This machine reports a touchscreen, so the real code path is the - # touch-device one and can be driven as-is. - if not DisplayServer.is_touchscreen_available(): - return _fail("this environment reports no touchscreen, so case C cannot be exercised here") - controller.keyboard_seen = false - controller._note_keyboard() - if not _all_visible(): - return _fail("a touch device hid its controls when a keyboard was used") - print("touch device keeps all four even after keyboard input") + # Only where the machine actually reports one: there the real code path + # is the touch-device one and can be driven as-is. Where it reports none + # there is nothing to drive, and the static check at the end of B still + # guards the touchscreen condition itself, so skip rather than fail. + if DisplayServer.is_touchscreen_available(): + controller.keyboard_seen = false + controller._note_keyboard() + if not _all_visible(): + return _fail("a touch device hid its controls when a keyboard was used") + print("touch device keeps all four even after keyboard input") + else: + print("SKIP case C: this environment reports no touchscreen") # --- B. no touchscreen: they all go ------------------------------- # The guard is the FIRST thing _note_keyboard checks, so the branch is