Skip the touch-device case where there is no touchscreen
test_desktop_hides_touch_controls failed outright on any machine whose headless DisplayServer reports no touchscreen. Godot on Android answers yes, so case C ran on the phone; Godot on Windows answers no, so the test bailed before reaching cases A and B and reported a failure that said nothing about the game. Case C now runs where a touchscreen is reported and is skipped where none is, which leaves A and B - and the static guard on _note_keyboard's list and touchscreen check - exercised everywhere. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
c193b9614b
commit
6616952660
1 changed files with 18 additions and 12 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue