53 lines
1.6 KiB
Bash
Executable File
53 lines
1.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
fail() {
|
|
printf 'applications settings contract: %s\n' "$1" >&2
|
|
exit 1
|
|
}
|
|
|
|
project_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
page="$project_root/config/dot/quickshell/modules/settings/ApplicationsPage.qml"
|
|
|
|
[[ -f "$page" ]] || fail 'Applications page is missing'
|
|
|
|
assert_contains() {
|
|
rg -F --quiet "$1" "$page" || fail "page is missing: $1"
|
|
}
|
|
|
|
assert_contains 'SettingsPage {'
|
|
assert_contains 'objectName: "applications"'
|
|
assert_contains 'DesktopEntries.applications.values'
|
|
assert_contains 'DefaultApps'
|
|
assert_contains 'SettingsCard {'
|
|
assert_contains 'SettingRow {'
|
|
assert_contains 'activatable:'
|
|
assert_contains 'ActionRow {'
|
|
assert_contains 'TextRow {'
|
|
|
|
for label in Browser Mail Files Terminal Music Images Video; do
|
|
assert_contains "label: \"$label\""
|
|
done
|
|
|
|
assert_contains 'title: "Default applications"'
|
|
assert_contains 'title: "User autostart"'
|
|
assert_contains 'title: "Compositor autostart"'
|
|
assert_contains 'categories'
|
|
assert_contains 'genericName'
|
|
assert_contains '.sort('
|
|
assert_contains 'currentEntry'
|
|
assert_contains 'read-only'
|
|
|
|
if rg --quiet 'Component\.onCompleted|DesktopEntries\.(byId|heuristicLookup)' "$page"; then
|
|
fail 'page snapshots or performs a one-time desktop-entry lookup'
|
|
fi
|
|
if rg --quiet '#[0-9A-Fa-f]{3,8}' "$page"; then
|
|
fail 'page introduces a color literal instead of the shared visual system'
|
|
fi
|
|
|
|
[[ "$(rg --count 'activatable:' "$page")" -ge 2 ]] \
|
|
|| fail 'default and autostart rows are not both whole-row activatable'
|
|
|
|
printf 'applications settings contract: PASS\n'
|