From 3be52dc1db62b926e7ad65dffec1901280e53cf3 Mon Sep 17 00:00:00 2001 From: Yongun Seong Date: Sat, 20 May 2023 05:21:02 +0900 Subject: [PATCH] nixosTests.fcitx5: unbreak, add rest of CJK --- nixos/tests/fcitx5/default.nix | 55 ++++++++++++++++++++-------------- nixos/tests/fcitx5/profile | 14 ++++++++- 2 files changed, 46 insertions(+), 23 deletions(-) diff --git a/nixos/tests/fcitx5/default.nix b/nixos/tests/fcitx5/default.nix index 261a5f1f45ca..9b000da48eaf 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 55e7b7b459fa..1b48c634e0eb 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