#!/bin/bash set -euo pipefail source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh" require_compositor "background intro lifecycle test" require_command quickshell stage=$(mktemp -d) trap 'rm -rf "$stage"' EXIT mkdir -p "$stage/services" "$stage/bin" "$stage/home" printf 'P6\n1 1\n255\n\377\377\377' >"$stage/cover.ppm" cp "$ROOT/shell/services/BackgroundIntro.qml" "$stage/services/" ln -s "$ROOT/shell/Commons" "$stage/Commons" cp "$SHELL_TEST_DIR/fixtures/background-intro-lifecycle/shell.qml" "$stage/shell.qml" cat >"$stage/bin/omarchy-theme-bg-boot-intro" <<'SH' #!/bin/bash printf 'intro\n' >>"$INTRO_TEST_LOG" sleep 2 SH chmod +x "$stage/bin/omarchy-theme-bg-boot-intro" cat >"$stage/bin/owe" <<'SH' #!/bin/bash if [[ -f $INTRO_TEST_FRAME_READY ]]; then sleep 0.25 printf '{"kind":"video","ready":true,"has_transition":false,"time_pos":0.05}\n' else printf '{"kind":"video","ready":true,"has_transition":true,"time_pos":0}\n' fi SH chmod +x "$stage/bin/owe" output=$(HOME="$stage/home" PATH="$stage/bin:$PATH" INTRO_TEST_LOG="$stage/starts" INTRO_TEST_COVER="$stage/cover.ppm" INTRO_TEST_FRAME_READY="$stage/video-ready" timeout 10 quickshell -p "$stage" --no-color 2>&1) || fail "background intro fixture exits cleanly" "$output" [[ $output == *"RESULT pass"* ]] || fail "background intro lifecycle assertions pass" "$output" if rg -q 'RESULT fail|ReferenceError|TypeError|Error:|Unable to assign|Binding loop' <<<"$output"; then fail "background intro fixture has no QML errors" "$output" fi [[ $(wc -l <"$stage/starts") == 1 ]] || fail "recreating the background service does not run another launcher" pass "the cover stays while waiting and remains off when OWE recreates the background service"