From 1c189f011447810af939a886ba7bee33532bb1f9 Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Wed, 19 Feb 2025 11:18:30 -0800 Subject: [PATCH] tests/home-cursor: init (#6496) Working on module and needed test to verify expected behavior. --- tests/default.nix | 1 + tests/modules/config/home-cursor/default.nix | 49 +++++++++++++++++++ .../config/home-cursor/expected-index.theme | 3 ++ 3 files changed, 53 insertions(+) create mode 100644 tests/modules/config/home-cursor/default.nix create mode 100644 tests/modules/config/home-cursor/expected-index.theme diff --git a/tests/default.nix b/tests/default.nix index 5fba00801..a3d5749df 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -266,6 +266,7 @@ in import nmtSrc { ./modules/services/yubikey-agent-darwin ./modules/targets-darwin ] ++ lib.optionals isLinux [ + ./modules/config/home-cursor ./modules/config/i18n ./modules/i18n/input-method ./modules/misc/debug diff --git a/tests/modules/config/home-cursor/default.nix b/tests/modules/config/home-cursor/default.nix new file mode 100644 index 000000000..08cde5452 --- /dev/null +++ b/tests/modules/config/home-cursor/default.nix @@ -0,0 +1,49 @@ +{ + # Ensure backwards compatibility with existing configs + home-cursor-legacy = { realPkgs, ... }: { + config = { + home.pointerCursor = { + package = realPkgs.catppuccin-cursors.macchiatoBlue; + name = "catppuccin-macchiato-blue-standard"; + size = 64; + gtk.enable = true; + hyprcursor.enable = true; + x11.enable = true; + }; + + home.stateVersion = "24.11"; + + nmt.script = '' + assertFileContent \ + home-path/share/icons/catppuccin-macchiato-blue-cursors/index.theme \ + ${./expected-index.theme} + + hmEnvFile=home-path/etc/profile.d/hm-session-vars.sh + assertFileExists $hmEnvFile + assertFileRegex $hmEnvFile 'XCURSOR_THEME="catppuccin-macchiato-blue-standard"' + assertFileRegex $hmEnvFile 'XCURSOR_SIZE="64"' + assertFileRegex $hmEnvFile 'HYPRCURSOR_THEME="catppuccin-macchiato-blue-standard"' + assertFileRegex $hmEnvFile 'HYPRCURSOR_SIZE="64"' + ''; + }; + }; + + home-cursor-legacy-disabled = { ... }: { + config = { + home.pointerCursor = null; + + home.stateVersion = "24.11"; + + nmt.script = '' + assertPathNotExists home-path/share/icons/catppuccin-macchiato-blue-cursors/index.theme + + hmEnvFile=home-path/etc/profile.d/hm-session-vars.sh + assertFileExists $hmEnvFile + assertFileNotRegex $hmEnvFile 'XCURSOR_THEME="catppuccin-macchiato-blue-standard"' + assertFileNotRegex $hmEnvFile 'XCURSOR_SIZE="32"' + assertFileNotRegex $hmEnvFile 'HYPRCURSOR_THEME="catppuccin-macchiato-blue-standard"' + assertFileNotRegex $hmEnvFile 'HYPRCURSOR_SIZE="32"' + ''; + }; + }; +} diff --git a/tests/modules/config/home-cursor/expected-index.theme b/tests/modules/config/home-cursor/expected-index.theme new file mode 100644 index 000000000..7ce17e0b2 --- /dev/null +++ b/tests/modules/config/home-cursor/expected-index.theme @@ -0,0 +1,3 @@ +[Icon Theme] +Name=Catppuccin Macchiato Blue +Comment=based on Volantes Cursors