forge
Explore
Log in

Don't you dare go Hollow

edith

Clone
★ 0

0 watching0 forksRust18.3 MiB6a8d990Tahinli15 days ago1049 commits

ui_capture.sh60 lines, 2.4 KiBHistoryRawDownload
1#!/bin/bash
2# Regression capture of the GUI, headless (never touches a real screen): empty window -> open project
3# -> timeline -> each dock tab -> clip sections -> menus -> settings -> palette -> export tab, at
4# 1920x1080 and again at 1280x720. Writes numbered PNGs to OUT; look at them (or diff two runs).
5#
6# scripts/ui_capture.sh OUT_DIR [PROJECT.edith]
7#
8# Env: DRIVE=<path to drive.sh> (the headless sway + virtual pointer driver; its header says how
9# to install it) BIN=<release edith binary, default target/release/edith>
10# SCRATCH=<dir for the driver's state, default $OUT/.state>
11set -u
12OUT=${1:?usage: ui_capture.sh OUT_DIR [PROJECT.edith]}
13PROJECT=${2:-}
14DRIVE=${DRIVE:?set DRIVE to drive.sh}
15HERE=$(cd "$(dirname "$0")/.." && pwd)
16BIN=${BIN:-$HERE/target/release/edith}
17mkdir -p "$OUT"
18OUT=$(cd "$OUT" && pwd)
19export D=${SCRATCH:-$OUT/.state} BIN CWD=$HERE
20mkdir -p "$D/home"
21
22shot() { "$DRIVE" shot "$1" >/dev/null; mv "$D/$1.png" "$OUT/$1.png"; }
23click() { "$DRIVE" click "$@"; }
24key() { "$DRIVE" key "$@"; }
25
26run() { # run WIDTH HEIGHT TAG
27 local W=$1 H=$2 T=$3
28 "$DRIVE" up "${W}x${H}" >/dev/null
29 # empty window
30 "$DRIVE" start; shot "${T}_01_empty"
31 "$DRIVE" stop; sleep 1
32 # the project (or stay empty when none was given)
33 if [ -n "$PROJECT" ]; then "$DRIVE" start "$PROJECT"; else "$DRIVE" start; fi
34 sleep 2; shot "${T}_02_project"
35 local TAB_Y=72 MEDIA=$((W - 282)) CLIP=$((W - 201)) TRANS=$((W - 122)) EXPORT=$((W - 42))
36 # dock tabs
37 click $MEDIA $TAB_Y; shot "${T}_03_dock_media"
38 click $CLIP $TAB_Y; shot "${T}_04_dock_clip_empty"
39 click 400 $((H * 68 / 100)); sleep 0.5
40 click $CLIP $TAB_Y; shot "${T}_05_dock_clip_selected"
41 click $((W - 230)) 154; shot "${T}_06_clip_section_open"
42 click $TRANS $TAB_Y; shot "${T}_07_dock_transcript"
43 click $EXPORT $TAB_Y; shot "${T}_08_dock_export"
44 click $MEDIA $TAB_Y
45 # menus: File Edit Clip Timeline View Help
46 local i=0
47 for X in 56 99 143 202 263 314; do
48 i=$((i + 1)); click $X 40; shot "${T}_09_menu_$i"; key -k Escape; sleep 0.4
49 done
50 # settings, then the palette
51 key -M ctrl , -m ctrl; shot "${T}_10_settings"; key -k Escape; sleep 0.4
52 key -M ctrl k -m ctrl; sleep 0.4; key "split"; shot "${T}_11_palette"; key -k Escape; sleep 0.4
53 # the timeline after all that: nothing should have moved
54 shot "${T}_12_final"
55 "$DRIVE" down
56}
57
58run 1920 1080 w1080
59run 1280 720 w720
60echo "captures in $OUT"