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 -
|
# C. a touch device keeps every one of them, even with a keyboard attached -
|
||||||
# a finger is still a way to play it
|
# a finger is still a way to play it
|
||||||
#
|
#
|
||||||
# The touchscreen answer is read from DisplayServer, which headless says yes
|
# The touchscreen answer is read from DisplayServer, and headless does not
|
||||||
# to, so B is exercised by driving the handler directly under a stubbed
|
# answer the same way everywhere: Godot on Android says yes, Godot on Windows
|
||||||
# answer. That is the whole behaviour: "no touchscreen + keyboard used".
|
# 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"]
|
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")
|
print("all four touch controls start visible")
|
||||||
|
|
||||||
# --- C. a touchscreen keeps them ----------------------------------
|
# --- C. a touchscreen keeps them ----------------------------------
|
||||||
# This machine reports a touchscreen, so the real code path is the
|
# Only where the machine actually reports one: there the real code path
|
||||||
# touch-device one and can be driven as-is.
|
# is the touch-device one and can be driven as-is. Where it reports none
|
||||||
if not DisplayServer.is_touchscreen_available():
|
# there is nothing to drive, and the static check at the end of B still
|
||||||
return _fail("this environment reports no touchscreen, so case C cannot be exercised here")
|
# guards the touchscreen condition itself, so skip rather than fail.
|
||||||
controller.keyboard_seen = false
|
if DisplayServer.is_touchscreen_available():
|
||||||
controller._note_keyboard()
|
controller.keyboard_seen = false
|
||||||
if not _all_visible():
|
controller._note_keyboard()
|
||||||
return _fail("a touch device hid its controls when a keyboard was used")
|
if not _all_visible():
|
||||||
print("touch device keeps all four even after keyboard input")
|
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 -------------------------------
|
# --- B. no touchscreen: they all go -------------------------------
|
||||||
# The guard is the FIRST thing _note_keyboard checks, so the branch is
|
# The guard is the FIRST thing _note_keyboard checks, so the branch is
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue