diff options
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" ] +} |
