Type at the window with a real keyboard: the akgl_typing test
xdotool closes the gap that shipped the missing SDL_StartTextInput(). Every other keyboard test synthesises SDL events, which covers the code downstream of SDL and cannot cover the code upstream of it -- so the suite stayed green while the real keyboard was dead. akgl_typing starts the driver under a pty, waits for the window with xdotool search --sync, gives it focus, and types a program containing a string literal and a lower-case one, polling the mirrored stdout for what they print. Verified by reverting both halves of the text-input fix and watching it fail with the reported symptom: READY, and nothing after it. Skips rather than fails without a display, xdotool, script(1) or a window manager -- none of those means the answer is no. It steals keyboard focus for about fifteen seconds; AKBASIC_SKIP_INTERACTIVE=1 skips it deliberately. xdotool and script(1) are documented as optional test dependencies, alongside what gcovr and python3 already bought. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-Authored-By: Andrew Kesterson <andrew@aklabs.net>
This commit is contained in:
@@ -317,6 +317,34 @@ if(AKBASIC_WITH_AKGL)
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/tests"
|
||||
TIMEOUT 60
|
||||
ENVIRONMENT "SDL_VIDEODRIVER=dummy;SDL_AUDIODRIVER=dummy;SDL_RENDER_DRIVER=software")
|
||||
|
||||
# The keyboard test, and the only one in the repository that uses a real X
|
||||
# server rather than the dummy driver. Note the deliberate absence of an
|
||||
# ENVIRONMENT line: forcing the dummy driver here would defeat the whole point.
|
||||
#
|
||||
# Everything else synthesises SDL events, which tests the code *downstream* of
|
||||
# SDL and cannot test the code upstream of it. That gap shipped a bug -- the
|
||||
# frontend never called SDL_StartTextInput(), so SDL emitted no text-input
|
||||
# events, the line editor dropped every keystroke, and the suite stayed green
|
||||
# because it was pushing those events itself. This one drives xdotool at a
|
||||
# focused window, so X11, SDL's composition and the window manager are all in
|
||||
# the path.
|
||||
#
|
||||
# Needs xdotool and script(1), and it **steals keyboard focus** for a few
|
||||
# seconds. Skipped rather than failed when it cannot run -- headless, no
|
||||
# xdotool, no window manager -- because none of those means the answer is no.
|
||||
# AKBASIC_SKIP_INTERACTIVE=1 skips it while you are using the machine.
|
||||
find_program(XDOTOOL_EXECUTABLE xdotool)
|
||||
if(NOT XDOTOOL_EXECUTABLE)
|
||||
message(STATUS "xdotool not found: the akgl_typing test will skip. "
|
||||
"Install it to cover the real keyboard path.")
|
||||
endif()
|
||||
_add_test(NAME akgl_typing
|
||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tests/akgl_typing.sh $<TARGET_FILE:basic>)
|
||||
_set_tests_properties(akgl_typing PROPERTIES
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
TIMEOUT 180
|
||||
SKIP_RETURN_CODE 77)
|
||||
endif()
|
||||
|
||||
if(AKBASIC_TESTS OR AKBASIC_WILL_FAIL_TESTS OR AKBASIC_KNOWN_FAILING_TESTS)
|
||||
|
||||
Reference in New Issue
Block a user