Debian Codegraph @

debian/tests/savegames_x

raw
1 #!/bin/sh
2
3 set -eu
4
5 IS_LOG="${AUTOPKGTEST_ARTIFACTS}/is_savegames.log"
6
7 NOSOUND=1
8 export NOSOUND
9
10 # keytyping delay in milliseconds
11 D=900
12 # sleep between some slower actions, in seconds
13 S=5
14
15 is > "${IS_LOG}" &
16 #IS_PID=$!
17
18 # click begin new game
19 xdotool search --sync --all --onlyvisible --name Ironseed \
20 windowfocus --sync %1 \
21 set_window --name "is_startup" \
22 key --clearmodifiers Escape \
23 sleep $S mousemove --sync --window %1 200 350 \
24 sleep $S click --clearmodifiers 1
25
26 # screenshot (main game start menu)
27 xwd -silent -root -out "${AUTOPKGTEST_ARTIFACTS}/savegames_1.xwd"
28
29 # complete crewgen and save in slot1
30 xdotool search --sync --all --onlyvisible --name Ironseed \
31 windowfocus --sync %1 \
32 set_window --name "is_crewgen" \
33 mousemove --sync --window %1 580 350 \
34 sleep $S click --clearmodifiers 1 \
35 sleep $S \
36 key --clearmodifiers --delay $D Return \
37 Return Return Return Return Return Return Return Return \
38 1 Return T Return \
39 sleep $S mousemove --sync --window %1 595 435 \
40 sleep $S
41
42 # screenshot (first in-game message "Greetings & hallucionations" arrives)
43 xwd -silent -root -out "${AUTOPKGTEST_ARTIFACTS}/savegames_2.xwd"
44 xwdtopnm -quiet < "${AUTOPKGTEST_ARTIFACTS}/savegames_2.xwd" > "${AUTOPKGTEST_ARTIFACTS}/savegames_2.pnm"
45
46 # start game and save in slot2
47 xdotool search --sync --all --onlyvisible --name Ironseed \
48 windowfocus --sync %1 \
49 set_window --name "is_main" \
50 key --clearmodifiers --delay $D Escape \
51 b e 2 Return X Return \
52 sleep $S
53
54 # screenshot (normal game view orbiting planet)
55 xwd -silent -root -out "${AUTOPKGTEST_ARTIFACTS}/savegames_3.xwd"
56
57 # exit game
58 xdotool search --sync --all --onlyvisible --name is_main \
59 windowfocus --sync %1 \
60 key --clearmodifiers --delay $D alt+x y
61
62 # wait for game to finish and cleanup
63 if grep -vi '^ironseed' "${IS_LOG}"
64 then
65 echo >&2 "Unrecognized game output"
66 exit 21
67 fi
68
69 wait