1 import ../make-test-python.nix ({ lib, ... }:
4 meta.maintainers = with lib.maintainers; [ nevivurn ];
6 nodes.machine = { pkgs, ... }:
9 ../common/user-account.nix
12 environment.systemPackages = [
13 # To avoid clashing with xfce4-terminal
17 services.displayManager.autoLogin = {
24 displayManager.lightdm.enable = true;
25 desktopManager.xfce.enable = true;
32 pkgs.fcitx5-chinese-addons
39 "Hotkey"."EnumerateSkipFirst" = "False";
40 "Hotkey/TriggerKeys"."0" = "Control+space";
41 "Hotkey/EnumerateForwardKeys"."0" = "Alt+Shift_L";
42 "Hotkey/EnumerateBackwardKeys"."0" = "Alt+Shift_R";
49 "Default Layout" = "us";
51 "Name" = "NixOS_test";
53 "Groups/0/Items/0" = {
54 "Name" = "keyboard-us";
56 "Groups/0/Items/1" = {
60 "Groups/0/Items/2" = {
64 "Groups/0/Items/3" = {
66 "Name" = "m17n_sa_harvard-kyoto";
68 "Groups/0/Items/4" = {
77 testScript = { nodes, ... }:
79 user = nodes.machine.users.users.alice;
80 xauth = "${user.home}/.Xauthority";
86 machine.wait_for_file("${xauth}")
87 machine.succeed("xauth merge ${xauth}")
90 machine.wait_until_succeeds("pgrep fcitx5")
91 machine.succeed("su - ${user.name} -c 'kill $(pgrep fcitx5)'")
94 machine.succeed("su - ${user.name} -c 'alacritty >&2 &'")
95 machine.wait_for_window("alice@machine")
97 machine.succeed("su - ${user.name} -c 'fcitx5 >&2 &'")
101 machine.send_chars("echo ")
104 ### Start fcitx Unicode input
105 machine.send_key("ctrl-alt-shift-u")
108 ### Search for smiling face
109 machine.send_chars("smil")
112 ### Navigate to the second one
113 machine.send_key("tab")
117 machine.send_key("\n")
120 ### Start fcitx language input
121 machine.send_key("ctrl-spc")
124 ### Default wubi, enter 一下
125 machine.send_chars("gggh ")
129 machine.send_key("alt-shift")
133 machine.send_chars("gks")
136 ### Switch to Harvard Kyoto
137 machine.send_key("alt-shift")
141 machine.send_chars("ka")
145 machine.send_key("alt-shift")
149 machine.send_chars("ka\n")
153 machine.send_key("ctrl-spc")
156 ### Redirect typed characters to a file
157 machine.send_chars(" > fcitx_test.out\n")
159 machine.screenshot("terminal_chars")
161 ### Verify that file contents are as expected
162 file_content = machine.succeed("cat ${user.home}/fcitx_test.out")
163 assert file_content == "☺一下한कか\n"