Resize an example under the rig, since a resize is its own case
`--resize WxH@Hz` changes the output once the app is up and screenshots after, so "it lands where a cold start at that size does" is a command rather than a procedure. That check caught both of #16's defects and nothing in `cargo test` can see it; it now passes byte for byte on `tabs` and `text` for this branch. Run one at a time: the rig reuses a single compositor and a single output, so two invocations at once resize each other's window and quietly screenshot the wrong thing. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b0f9f046da
commit
2272634dc5
1 file changed
+13
-1
+13
-1
@@ -17,6 +17,10 @@
|
|||||||
# custom one would otherwise inherit the other's output and quietly screenshot
|
# custom one would otherwise inherit the other's output and quietly screenshot
|
||||||
# the wrong size.
|
# the wrong size.
|
||||||
#
|
#
|
||||||
|
# `--resize WxH@Hz` changes the output under the app once it is up, then
|
||||||
|
# screenshots. A resize is its own case: what it has to match is a cold start
|
||||||
|
# at that size, byte for byte, and nothing in `cargo test` can see it.
|
||||||
|
#
|
||||||
# `--replay FILE` drives a `.touch` recording into the window through
|
# `--replay FILE` drives a `.touch` recording into the window through
|
||||||
# `replay-touch`, which reads it with the same parser `iris::harness` uses. A
|
# `replay-touch`, which reads it with the same parser `iris::harness` uses. A
|
||||||
# recording is `<ms> down|move|up <x> <y>` in the output's own pixels. With
|
# recording is `<ms> down|move|up <x> <y>` in the output's own pixels. With
|
||||||
@@ -46,6 +50,7 @@ run="${XDG_RUNTIME_DIR:-/tmp}/iris-headless"
|
|||||||
seconds=3
|
seconds=3
|
||||||
shot=""
|
shot=""
|
||||||
replay=""
|
replay=""
|
||||||
|
resize=""
|
||||||
example=""
|
example=""
|
||||||
kind=example
|
kind=example
|
||||||
mode=1920x1200@60Hz
|
mode=1920x1200@60Hz
|
||||||
@@ -57,13 +62,14 @@ while [ $# -gt 0 ]; do
|
|||||||
--seconds) seconds=$2; shift 2 ;;
|
--seconds) seconds=$2; shift 2 ;;
|
||||||
--bin) kind=bin; shift ;;
|
--bin) kind=bin; shift ;;
|
||||||
--mode) mode=$2; shift 2 ;;
|
--mode) mode=$2; shift 2 ;;
|
||||||
|
--resize) resize=$2; shift 2 ;;
|
||||||
--replay) replay=$2; shift 2 ;;
|
--replay) replay=$2; shift 2 ;;
|
||||||
--dir) workdir=$(cd "$2" && pwd); shift 2 ;;
|
--dir) workdir=$(cd "$2" && pwd); shift 2 ;;
|
||||||
--) shift; break ;;
|
--) shift; break ;;
|
||||||
*) example=$1; shift ;;
|
*) example=$1; shift ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
[ -n "$example" ] || { echo "usage: $0 NAME [--bin] [--dir DIR] [--mode WxH@Hz] [--replay TOUCH] [--shot PNG] [--seconds N] [-- cargo args]" >&2; exit 2; }
|
[ -n "$example" ] || { echo "usage: $0 NAME [--bin] [--dir DIR] [--mode WxH@Hz] [--resize WxH@Hz] [--replay TOUCH] [--shot PNG] [--seconds N] [-- cargo args]" >&2; exit 2; }
|
||||||
[ -z "$replay" ] || [ -f "$replay" ] || { echo "run-headless: no touch script at $replay" >&2; exit 2; }
|
[ -z "$replay" ] || [ -f "$replay" ] || { echo "run-headless: no touch script at $replay" >&2; exit 2; }
|
||||||
[ -z "$shot" ] || need grim "the screenshot --shot writes"
|
[ -z "$shot" ] || need grim "the screenshot --shot writes"
|
||||||
|
|
||||||
@@ -142,6 +148,12 @@ while [ $i -lt "$((seconds * 2))" ]; do
|
|||||||
i=$((i + 1)); sleep 0.5
|
i=$((i + 1)); sleep 0.5
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [ -n "$resize" ] && kill -0 "$pid" 2>/dev/null; then
|
||||||
|
swaymsg output HEADLESS-1 mode "$resize" >/dev/null
|
||||||
|
echo "run-headless: resized to $resize" >&2
|
||||||
|
sleep 2
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -n "$replay" ] && kill -0 "$pid" 2>/dev/null; then
|
if [ -n "$replay" ] && kill -0 "$pid" 2>/dev/null; then
|
||||||
if [ -n "$shot" ]; then
|
if [ -n "$shot" ]; then
|
||||||
grim "${shot%.png}-before.png"
|
grim "${shot%.png}-before.png"
|
||||||
|
|||||||
Reference in new issue
Block a user