plasma-manager/test/basic.nix

59 lines
1.4 KiB
Nix
Raw Normal View History

2024-02-26 19:58:45 +03:00
{ testers, home-manager-module, plasma-module, writeShellScriptBin, libsForQt5 }:
2022-06-22 22:10:51 +03:00
let
2024-02-26 19:58:45 +03:00
script = writeShellScriptBin "plasma-basic-test" ''
set -eu
2022-06-22 22:10:51 +03:00
export XDG_CONFIG_HOME=''${XDG_CONFIG_HOME:-$HOME/.config}
2024-02-26 19:58:45 +03:00
export PATH=${libsForQt5.kconfig}/bin:$PATH
2022-06-22 22:10:51 +03:00
kread_global() {
kreadconfig5 --file $XDG_CONFIG_HOME/kdeglobals --group $1 --key $2
}
assert_eq() {
actual=$(kread_global "$1" "$2")
if [ "$actual" != "$3" ]; then
echo >&2 "ERROR: $1.$2: expected $3 but got $actual"
exit 1
fi
}
assert_eq KDE SingleClick false
assert_eq General AllowKDEAppsToRememberWindowPositions true
'';
2024-02-26 19:58:45 +03:00
in
testers.nixosTest {
name = "plasma-basic";
2022-06-22 22:10:51 +03:00
2024-02-26 19:58:45 +03:00
nodes.machine = {
environment.systemPackages = [ script ];
imports = [ home-manager-module ];
2022-06-22 22:10:51 +03:00
2024-02-26 19:58:45 +03:00
users.users.fake = {
createHome = true;
isNormalUser = true;
2022-06-22 22:10:51 +03:00
};
2024-02-26 19:58:45 +03:00
home-manager.users.fake = {
home.stateVersion = "23.11";
imports = [ plasma-module ];
programs.plasma = {
enable = true;
workspace.clickItemTo = "select";
};
};
2022-06-22 22:10:51 +03:00
};
testScript = ''
# Boot:
start_all()
machine.wait_for_unit("multi-user.target")
machine.wait_for_unit("home-manager-fake.service")
# Run tests:
machine.succeed("test -e /home/fake/.config/kdeglobals")
machine.succeed("su - fake -c plasma-basic-test")
'';
}