Debian Codegraph @

debian/tests/trigger-3buttons

raw
1 #!/bin/sh
2 set -ex
3
4 export GTK_A11Y=NONE
5
6 cleanup(){
7 kill -9 "$xpid" || :
8 rm "$exe" || :
9 }
10 trap cleanup 0
11
12 exe=$(dirname "$0")/3buttons
13 #shellcheck disable=SC2046
14 cc "$exe.c" -o "$exe" $(pkg-config --cflags --libs libpanel-1 gtk4)
15
16 #Run program in virtual X framebuffer.
17 export DISPLAY=:71
18 Xvfb "$DISPLAY" &
19 xpid=$!
20 "$exe" &
21 pid=$!
22
23 #Wait a bit for server to be set up and window, to be mapped
24 sleep 5
25 #The panel has merely 3 buttons. Clicking a button destroys that button.
26 #If 0 buttons exist, the program terminates with 0.
27 #Therefore, after three <Tab> <Enter>, the program terminates
28 i=0
29 nbuttons=3
30 while [ "$i" -lt "$nbuttons" ]; do
31 test -d "/proc/$pid"
32 xdotool key Tab Return
33 sleep 5
34 i=$((i+1))
35 done
36 #Confirm the program terminated
37 ! kill -0 "$pid"