Finish Home and Phone settings cohesion
This commit is contained in:
@@ -80,8 +80,12 @@ system_settings="$repo_dir/config/dot/quickshell/services/SystemSettings.qml"
|
||||
[[ -f "$home_page" ]] || fail 'HomePhonePage.qml is missing'
|
||||
[[ -f "$favorite_card" ]] || fail 'HomeFavoriteCard.qml is missing'
|
||||
[[ -f "$available_row" ]] || fail 'AvailableLightRow.qml is missing'
|
||||
assert_contains 'text: "Home & Phone"' "$home_page"
|
||||
assert_contains 'text: "Choose what appears in Control Center and keep phone continuity close at hand."' "$home_page"
|
||||
assert_contains 'SettingsPage {' "$home_page"
|
||||
assert_contains 'title: "Home & Phone"' "$home_page"
|
||||
assert_contains 'lede: "Choose what appears in Control Center and keep phone continuity close at hand."' "$home_page"
|
||||
if rg -q '^\s*Flickable \{' "$home_page"; then
|
||||
fail 'HomePhonePage.qml still owns a copied Flickable scaffold'
|
||||
fi
|
||||
assert_contains 'Connected · ' "$home_page"
|
||||
assert_contains 'Last update unavailable · showing saved controls' "$home_page"
|
||||
assert_contains 'Authentication required' "$home_page"
|
||||
|
||||
@@ -83,6 +83,21 @@ wait_for_file_content() {
|
||||
fail 'preferences file did not contain the complete atomic update'
|
||||
}
|
||||
|
||||
wait_for_reset_file_content() {
|
||||
local expected='{"initialized":false,"favorites":[]}'
|
||||
local state_file=""
|
||||
|
||||
for _ in $(seq 1 18); do
|
||||
state_file="$(find "$state_home" -name panama-home.json -print -quit)"
|
||||
if [[ -n "$state_file" ]] \
|
||||
&& jq -e --argjson expected "$expected" '. == $expected' "$state_file" >/dev/null; then
|
||||
return
|
||||
fi
|
||||
sleep 0.01
|
||||
done
|
||||
fail 'reset did not persist the default Home state before the debounce interval'
|
||||
}
|
||||
|
||||
# A leading JSON whitespace prevents qs from expanding the array into IPC
|
||||
# positional arguments; JSON.parse() intentionally accepts that whitespace.
|
||||
initial_ids=' ["light.kitchen","light.hall","light.desk"]'
|
||||
@@ -90,6 +105,7 @@ expected='{"initialized":true,"favorites":[{"id":"light.desk","alias":""},{"id":
|
||||
expected_file='{"initialized":true,"favorites":[{"id":"light.desk","alias":""},{"id":"light.kitchen","alias":"Island"}]}'
|
||||
empty_expected='{"initialized":true,"favorites":[],"saveError":""}'
|
||||
empty_file='{"initialized":true,"favorites":[]}'
|
||||
reset_expected='{"initialized":false,"favorites":[],"saveError":""}'
|
||||
|
||||
start_harness
|
||||
qs_for_harness ipc call home-pref-test initialize "$initial_ids" >/dev/null
|
||||
@@ -99,9 +115,20 @@ qs_for_harness ipc call home-pref-test remove light.hall >/dev/null
|
||||
wait_for_status "$expected"
|
||||
wait_for_file_content "$expected_file"
|
||||
|
||||
qs_for_harness ipc call home-pref-test reset >/dev/null
|
||||
wait_for_status "$reset_expected"
|
||||
wait_for_reset_file_content
|
||||
|
||||
stop_harness
|
||||
start_harness
|
||||
wait_for_status "$reset_expected"
|
||||
|
||||
qs_for_harness ipc call home-pref-test initialize "$initial_ids" >/dev/null
|
||||
qs_for_harness ipc call home-pref-test alias light.kitchen ' Island ' >/dev/null
|
||||
qs_for_harness ipc call home-pref-test move light.desk 0 >/dev/null
|
||||
qs_for_harness ipc call home-pref-test remove light.hall >/dev/null
|
||||
wait_for_status "$expected"
|
||||
wait_for_file_content "$expected_file"
|
||||
|
||||
qs_for_harness ipc call home-pref-test remove light.desk >/dev/null
|
||||
qs_for_harness ipc call home-pref-test remove light.kitchen >/dev/null
|
||||
|
||||
Reference in New Issue
Block a user