summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authorRyan Lahfa <masterancpp@gmail.com>2023-05-20 17:54:51 +0200
committerGitHub <noreply@github.com>2023-05-20 17:54:51 +0200
commit07a84e229f1b0edac2ab4c236b49cb9d539cbe94 (patch)
treeb2ff0bebce9f8b8078aef51abcc8f008ced137c4 /nixos/tests
parent5dec9a9236960476a217f2c85c613d272db70b30 (diff)
parent924f367c57665bce680cf37f716f22689dc8fcf3 (diff)
Merge pull request #232890 from nevivurn/feature/fix-fcitx5-test
nixosTests.fcitx5: unbreak, add rest of CJK
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/fcitx5/default.nix55
-rw-r--r--nixos/tests/fcitx5/profile14
2 files changed, 46 insertions, 23 deletions
diff --git a/nixos/tests/fcitx5/default.nix b/nixos/tests/fcitx5/default.nix
index 261a5f1f45cac..9b000da48eaf2 100644
--- a/nixos/tests/fcitx5/default.nix
+++ b/nixos/tests/fcitx5/default.nix
@@ -1,7 +1,8 @@
-import ../make-test-python.nix ({ pkgs, ... }:
-# copy_from_host works only for store paths
+import ../make-test-python.nix ({ lib, ... }:
 rec {
   name = "fcitx5";
+  meta.maintainers = with lib.maintainers; [ nevivurn ];
+
   nodes.machine = { pkgs, ... }:
   {
     imports = [
@@ -30,8 +31,10 @@ rec {
     i18n.inputMethod = {
       enabled = "fcitx5";
       fcitx5.addons = [
-        pkgs.fcitx5-m17n
         pkgs.fcitx5-chinese-addons
+        pkgs.fcitx5-hangul
+        pkgs.fcitx5-m17n
+        pkgs.fcitx5-mozc
       ];
     };
   };
@@ -43,11 +46,16 @@ rec {
       fcitx_confdir = "${user.home}/.config/fcitx5";
     in
       ''
-            # We need config files before login session
-            # So copy first thing
+            start_all()
+
+            machine.wait_for_x()
+            machine.wait_for_file("${xauth}")
+            machine.succeed("xauth merge ${xauth}")
+            machine.sleep(5)
+
+            machine.succeed("su - ${user.name} -c 'kill $(pgrep fcitx5)'")
+            machine.sleep(1)
 
-            # Point and click would be expensive,
-            # So configure using files
             machine.copy_from_host(
                 "${./profile}",
                 "${fcitx_confdir}/profile",
@@ -57,15 +65,8 @@ rec {
                 "${fcitx_confdir}/config",
             )
 
-            start_all()
-
-            machine.wait_for_file("${xauth}}")
-            machine.succeed("xauth merge ${xauth}")
-
-            machine.sleep(5)
-
-            machine.succeed("su - ${user.name} -c 'alacritty&'")
-            machine.succeed("su - ${user.name} -c 'fcitx5&'")
+            machine.succeed("su - ${user.name} -c 'alacritty >&2 &'")
+            machine.succeed("su - ${user.name} -c 'fcitx5 >&2 &'")
             machine.sleep(10)
 
             ### Type on terminal
@@ -74,7 +75,6 @@ rec {
 
             ### Start fcitx Unicode input
             machine.send_key("ctrl-alt-shift-u")
-            machine.sleep(5)
             machine.sleep(1)
 
             ### Search for smiling face
@@ -94,9 +94,15 @@ rec {
             machine.sleep(1)
 
             ### Default wubi, enter 一下
-            machine.send_chars("gggh")
+            machine.send_chars("gggh ")
             machine.sleep(1)
-            machine.send_key("\n")
+
+            ### Switch to Hangul
+            machine.send_key("alt-shift")
+            machine.sleep(1)
+
+            ### Enter 한
+            machine.send_chars("gks")
             machine.sleep(1)
 
             ### Switch to Harvard Kyoto
@@ -104,12 +110,17 @@ rec {
             machine.sleep(1)
 
             ### Enter क
-            machine.send_chars("ka ")
+            machine.send_chars("ka")
             machine.sleep(1)
 
+            ### Switch to Mozc
             machine.send_key("alt-shift")
             machine.sleep(1)
 
+            ### Enter か
+            machine.send_chars("ka\n")
+            machine.sleep(1)
+
             ### Turn off Fcitx
             machine.send_key("ctrl-spc")
             machine.sleep(1)
@@ -121,7 +132,7 @@ rec {
 
             ### Verify that file contents are as expected
             file_content = machine.succeed("cat ${user.home}/fcitx_test.out")
-            assert file_content == "☺一下क\n"
-            ''
+            assert file_content == "☺一下한कか\n"
+      ''
   ;
 })
diff --git a/nixos/tests/fcitx5/profile b/nixos/tests/fcitx5/profile
index 55e7b7b459faf..1b48c634e0eba 100644
--- a/nixos/tests/fcitx5/profile
+++ b/nixos/tests/fcitx5/profile
@@ -4,12 +4,24 @@ Default Layout=us
 DefaultIM=wbx
 
 [Groups/0/Items/0]
+Name=keyboard-us
+Layout=
+
+[Groups/0/Items/1]
 Name=wbx
 Layout=us
 
-[Groups/0/Items/1]
+[Groups/0/Items/2]
+Name=hangul
+Layout=us
+
+[Groups/0/Items/3]
 Name=m17n_sa_harvard-kyoto
 Layout=us
 
+[Groups/0/Items/4]
+Name=mozc
+Layout=us
+
 [GroupOrder]
 0=NixOS_test