mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-10 20:13:24 -08:00
[Tests] Capture screenshots and dump the widget tree from a playback
pqWidgetTestEventPlayer adds the widget-level commands the UI tests were
missing:
- screenshot grabs the addressed widget and saves it, creating the parent
directory and expanding $NAME / ${NAME} from the environment so the runner
decides where captures land
- dumpTree writes the widget paths the tests address, for finding the path of a
widget while writing a test
- resize sets the top-level window size, since the layout owns the children
The runner sets COCKATRICE_SCREENSHOT_DIR to build/screenshots, which is
ignored, so captures do not show up as untracked files.
Testing/screenshot_test.xml captures the main window and the settings dialog,
and Testing/README.md documents the commands, the pause/process_events split,
path drift and the capture workflow.
This commit is contained in:
parent
9793a0df4a
commit
e4c7a971fd
7 changed files with 377 additions and 14 deletions
|
|
@ -12,6 +12,10 @@
|
|||
# Environment:
|
||||
# COCKATRICE_BIN Path to the client binary (default: build/debug/cockatrice/cockatrice,
|
||||
# or the .app bundle binary on macOS).
|
||||
# COCKATRICE_SCREENSHOT_DIR
|
||||
# Directory the tests write screenshots and widget dumps to
|
||||
# (default: build/screenshots). Tests address it as
|
||||
# $COCKATRICE_SCREENSHOT_DIR/name.png.
|
||||
# TEST_TIMEOUT Seconds a single test may run before it is killed (default: 180).
|
||||
# Uses timeout, or gtimeout from coreutils on macOS.
|
||||
#
|
||||
|
|
@ -32,6 +36,12 @@ fi
|
|||
TEST_DIR="$REPO_ROOT/Testing"
|
||||
TEST_TIMEOUT="${TEST_TIMEOUT:-180}"
|
||||
|
||||
# Tests that capture the UI address this as $COCKATRICE_SCREENSHOT_DIR/name.png.
|
||||
# It lives under the ignored build/ tree, so a run does not leave untracked files.
|
||||
SCREENSHOT_DIR="${COCKATRICE_SCREENSHOT_DIR:-$REPO_ROOT/build/screenshots}"
|
||||
mkdir -p "$SCREENSHOT_DIR"
|
||||
export COCKATRICE_SCREENSHOT_DIR="$SCREENSHOT_DIR"
|
||||
|
||||
# Stock macOS has no `timeout`; coreutils provides `gtimeout`. Without either the
|
||||
# runner still works, but a hung test is not killed.
|
||||
TIMEOUT=()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue