diff options
| author | danix <danix@danix.xyz> | 2026-06-11 09:54:23 +0200 |
|---|---|---|
| committer | danix <danix@danix.xyz> | 2026-06-11 09:54:23 +0200 |
| commit | 7d1005a3ebadbb073b68ec91cc92d3b43cd2f9a1 (patch) | |
| tree | 3520ea90b57971ceec172e2e887b0e944af19eef /tests | |
| parent | 2e047897346ac58fb005711d9648b618a2d77b96 (diff) | |
| download | wallp-7d1005a3ebadbb073b68ec91cc92d3b43cd2f9a1.tar.gz wallp-7d1005a3ebadbb073b68ec91cc92d3b43cd2f9a1.zip | |
feat: apply_output with selective kill + persistence
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/wallp.bats | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/wallp.bats b/tests/wallp.bats index 52e6706..f8ea2d7 100644 --- a/tests/wallp.bats +++ b/tests/wallp.bats @@ -154,3 +154,28 @@ teardown() { [ "$status" -eq 1 ] [[ "$output" == *"Z="* ]] } + +@test "apply_output skips missing file without writing pid" { + CONF_OUTPUT_H="DP-1" + run apply_output H "$HOME/nope.png" + [ "$status" -eq 1 ] + [ ! -e "$HOME/.cache/wallp/H.pid" ] +} + +@test "apply_output sets swaybg and persists path" { + CONF_OUTPUT_H="DP-1" + : > "$HOME/real.png" + apply_output H "$HOME/real.png" + [ "$?" -eq 0 ] + [ "$(cat "$HOME/.config/wallp/wall_h")" = "$HOME/real.png" ] + [ -f "$HOME/.cache/wallp/H.pid" ] + grep -q "swaybg -o DP-1 -i $HOME/real.png" "$HOME/calls.log" +} + +@test "apply_output on V does not touch H pid" { + CONF_OUTPUT_H="DP-1"; CONF_OUTPUT_V="DP-3" + mkdir -p "$HOME/.cache/wallp"; echo 99999 > "$HOME/.cache/wallp/H.pid" + : > "$HOME/v.png" + apply_output V "$HOME/v.png" + [ "$(cat "$HOME/.cache/wallp/H.pid")" = "99999" ] +} |
