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
23
Testing/screenshot_test.xml
Normal file
23
Testing/screenshot_test.xml
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<events>
|
||||
<!--
|
||||
Screenshot and widget-tree capture.
|
||||
|
||||
The runner sets COCKATRICE_SCREENSHOT_DIR (build/screenshots by default),
|
||||
so the images and the dump land in an ignored directory. Use the dump to
|
||||
find the paths other tests can address.
|
||||
-->
|
||||
<event widget="MainWindow" command="resize" arguments="1280x800" />
|
||||
<event widget="MainWindow" command="process_events" arguments="500" />
|
||||
<event widget="MainWindow" command="screenshot" arguments="$COCKATRICE_SCREENSHOT_DIR/main-window.png" />
|
||||
|
||||
<event widget="MainWindow/menubar" command="activate" arguments="cockatriceMenu" />
|
||||
<event widget="MainWindow/menubar/cockatriceMenu" command="activate" arguments="actionSettings" />
|
||||
<event widget="MainWindow" command="pause" arguments="500" />
|
||||
<event widget="MainWindow/settingsDialog/settingsView/pagesContainer/pagesWidget" command="expectProperty" arguments="currentIndex,0" />
|
||||
|
||||
<!-- Taken while the dialog is open, so the dump covers its widgets too. -->
|
||||
<event widget="MainWindow" command="dumpTree" arguments="$COCKATRICE_SCREENSHOT_DIR/widget-tree.txt" />
|
||||
<event widget="MainWindow/settingsDialog/settingsView" command="screenshot" arguments="$COCKATRICE_SCREENSHOT_DIR/settings.png" />
|
||||
|
||||
<event widget="MainWindow/settingsDialog/settingsOkButton" command="activate" arguments="" />
|
||||
</events>
|
||||
Loading…
Add table
Add a link
Reference in a new issue