diff options
| -rw-r--r-- | tests/wallp.bats | 22 | ||||
| -rw-r--r-- | wallp | 25 |
2 files changed, 47 insertions, 0 deletions
diff --git a/tests/wallp.bats b/tests/wallp.bats index 0ffed89..b5c9ff7 100644 --- a/tests/wallp.bats +++ b/tests/wallp.bats @@ -105,3 +105,25 @@ teardown() { persist_theme "abc" [ "$(cat "$HOME/.config/wallp/theme")" = "abc" ] } + +@test "output_for maps logical to physical" { + CONF_OUTPUT_H="DP-1"; CONF_OUTPUT_V="DP-3" + run output_for H + [ "$output" = "DP-1" ] + run output_for V + [ "$output" = "DP-3" ] +} + +@test "wall_file_for returns config paths" { + run wall_file_for H + [ "$output" = "$HOME/.config/wallp/wall_h" ] + run wall_file_for V + [ "$output" = "$HOME/.config/wallp/wall_v" ] +} + +@test "pid_file_for returns cache paths" { + run pid_file_for H + [ "$output" = "$HOME/.cache/wallp/H.pid" ] + run pid_file_for V + [ "$output" = "$HOME/.cache/wallp/V.pid" ] +} @@ -95,6 +95,31 @@ resolve_theme() { printf '%s\n' "sexy-splurge" } +# Maps logical output (H|V) to physical connector name from config. +output_for() { + case "$1" in + H) printf '%s\n' "$CONF_OUTPUT_H" ;; + V) printf '%s\n' "$CONF_OUTPUT_V" ;; + *) echo "wallp: unknown logical output '$1'" >&2; return 1 ;; + esac +} + +# Returns path to saved wall state for logical output (H|V). +wall_file_for() { + case "$1" in + H) printf '%s\n' "$HOME/.config/wallp/wall_h" ;; + V) printf '%s\n' "$HOME/.config/wallp/wall_v" ;; + esac +} + +# Returns path to PID file for logical output (H|V). +pid_file_for() { + case "$1" in + H) printf '%s\n' "$HOME/.cache/wallp/H.pid" ;; + V) printf '%s\n' "$HOME/.cache/wallp/V.pid" ;; + esac +} + main() { return 0 } |
