aboutsummaryrefslogtreecommitdiff
path: root/scripts/testing/tests/test_desktop.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/testing/tests/test_desktop.py')
-rw-r--r--scripts/testing/tests/test_desktop.py98
1 files changed, 98 insertions, 0 deletions
diff --git a/scripts/testing/tests/test_desktop.py b/scripts/testing/tests/test_desktop.py
new file mode 100644
index 0000000..53e54e1
--- /dev/null
+++ b/scripts/testing/tests/test_desktop.py
@@ -0,0 +1,98 @@
+# SPDX-License-Identifier: GPL-3.0-or-later
+"""Post-install checks: window manager + desktop integration.
+
+Parity port of validate_window_manager and its Hyprland/DWM branches, plus
+validate_autologin_config. Hyprland and DWM checks are gated on which DE the
+run installed; socket/portal-query checks are gated on a live compositor (the
+headless test VM has none).
+
+Note: validate_hyprland_tools historically checked `swww`, but archsetup now
+installs `awww` (swww successor) and `pacman -Q swww` no longer matches — so
+this checks awww. That divergence from the shell sweep is a correctness fix.
+"""
+
+import pytest
+
+
+HYPRLAND_TOOLS = [
+ "hyprland", "hypridle", "hyprlock", "waybar", "fuzzel",
+ "awww", "grim", "slurp", "gammastep", "foot",
+]
+
+HYPRLAND_CONFIGS = [
+ ".config/hypr/hyprland.conf",
+ ".config/hypr/hypridle.conf",
+ ".config/hypr/hyprlock.conf",
+ ".config/waybar/config",
+ ".config/fuzzel/fuzzel.ini",
+ ".config/gammastep/config.ini",
+]
+
+SUCKLESS_TOOLS = ["dwm", "st", "dmenu", "slock"]
+
+PORTALS_CONF = ".config/xdg-desktop-portal/portals.conf"
+
+
+@pytest.mark.attribution("archsetup")
+@pytest.mark.parametrize("pkg", HYPRLAND_TOOLS)
+def test_hyprland_tool_installed(host, hyprland_installed, pkg):
+ if not hyprland_installed:
+ pytest.skip("Hyprland not installed (DESKTOP_ENV != hyprland)")
+ assert host.package(pkg).is_installed, "%s missing" % pkg
+
+
+@pytest.mark.attribution("archsetup")
+@pytest.mark.parametrize("rel", HYPRLAND_CONFIGS)
+def test_hyprland_config_present(host, hyprland_installed, home, rel):
+ if not hyprland_installed:
+ pytest.skip("Hyprland not installed (DESKTOP_ENV != hyprland)")
+ assert host.file("%s/%s" % (home, rel)).exists, "%s missing" % rel
+
+
+@pytest.mark.attribution("archsetup")
+def test_portal_settings_backend_not_disabled(host, hyprland_installed, home):
+ if not hyprland_installed:
+ pytest.skip("Hyprland not installed")
+ conf = host.file("%s/%s" % (home, PORTALS_CONF))
+ assert conf.exists, "portals.conf missing"
+ line = host.run(
+ "grep org.freedesktop.impl.portal.Settings %s" % conf.path
+ ).stdout
+ assert "=none" not in line.replace(" ", ""), "Settings portal disabled (=none)"
+
+
+def test_portal_returns_dark_mode(host, hyprland_installed, compositor_running, target_user):
+ if not hyprland_installed:
+ pytest.skip("Hyprland not installed")
+ if not compositor_running:
+ pytest.skip("no compositor running (headless) — portal query not applicable")
+ cmd = (
+ "sudo -u %s busctl --user call org.freedesktop.portal.Desktop "
+ "/org/freedesktop/portal/desktop org.freedesktop.portal.Settings Read "
+ "'ss' 'org.freedesktop.appearance' 'color-scheme'" % target_user
+ )
+ out = host.run(cmd).stdout
+ assert "u 1" in out, "Settings portal should report color-scheme=1 (dark)"
+
+
+def test_hyprland_socket(host, hyprland_installed, compositor_running):
+ if not hyprland_installed:
+ pytest.skip("Hyprland not installed")
+ if not compositor_running:
+ pytest.skip("Hyprland not running (headless) — socket check not applicable")
+ assert host.run("test -S /tmp/hypr/*/.socket.sock").rc == 0
+
+
+@pytest.mark.attribution("archsetup")
+@pytest.mark.parametrize("tool", SUCKLESS_TOOLS)
+def test_suckless_tool_installed(host, dwm_installed, tool):
+ if not dwm_installed:
+ pytest.skip("DWM not installed (DESKTOP_ENV != dwm)")
+ assert host.file("/usr/local/bin/%s" % tool).exists, "%s missing" % tool
+
+
+def test_autologin_configured(host):
+ conf = host.file("/etc/systemd/system/getty@tty1.service.d/autologin.conf")
+ if not conf.exists:
+ pytest.skip("autologin not configured (AUTOLOGIN=no, may be intentional)")
+ assert conf.exists