Merge pull request #232890 from nevivurn/feature/fix-fcitx5-test

nixosTests.fcitx5: unbreak, add rest of CJK
This commit is contained in:
Ryan Lahfa 2023-05-20 17:54:51 +02:00 committed by GitHub
commit 07a84e229f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 74 additions and 25 deletions

View File

@ -11246,6 +11246,12 @@
githubId = 17120571;
name = "Xinhao Luo";
};
nevivurn = {
email = "nevivurn@nevi.dev";
github = "nevivurn";
githubId = 7698349;
name = "Yongun Seong";
};
newam = {
email = "alex@thinglab.org";
github = "newAM";

View File

@ -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"
''
;
})

View File

@ -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

View File

@ -31,6 +31,7 @@
, xcbutilwm
, xcb-imdkit
, libxkbfile
, nixosTests
}:
let
enDictVer = "20121020";
@ -89,7 +90,12 @@ stdenv.mkDerivation rec {
libxkbfile
];
passthru.updateScript = ./update.py;
passthru = {
updateScript = ./update.py;
tests = {
inherit (nixosTests) fcitx5;
};
};
meta = with lib; {
description = "Next generation of fcitx";

View File

@ -6,6 +6,7 @@
, gettext
, fcitx5
, libhangul
, nixosTests
}:
stdenv.mkDerivation rec {
@ -30,6 +31,10 @@ stdenv.mkDerivation rec {
libhangul
];
passthru.tests = {
inherit (nixosTests) fcitx5;
};
meta = with lib; {
description = "Hangul wrapper for Fcitx5";
homepage = "https://github.com/fcitx/fcitx5-hangul";

View File

@ -9,6 +9,7 @@
, m17n_db
, gettext
, fmt
, nixosTests
}:
stdenv.mkDerivation rec {
@ -36,6 +37,10 @@ stdenv.mkDerivation rec {
fmt
];
passthru.tests = {
inherit (nixosTests) fcitx5;
};
meta = with lib; {
description = "m17n support for Fcitx5";
homepage = "https://github.com/fcitx/fcitx5-m17n";

View File

@ -1,6 +1,6 @@
{ lib, clangStdenv, fetchFromGitHub, fetchurl, fetchpatch, fetchgit
, python3Packages, ninja, pkg-config, protobuf, zinnia, qt5, fcitx5
, jsoncpp, gtest, which, gtk2, unzip, abseil-cpp, breakpad }:
, jsoncpp, gtest, which, gtk2, unzip, abseil-cpp, breakpad, nixosTests }:
let
inherit (python3Packages) python gyp six;
utdic = fetchurl {
@ -115,6 +115,10 @@ in clangStdenv.mkDerivation rec {
wrapQtApp $out/lib/mozc/mozc_tool
'';
passthru.tests = {
inherit (nixosTests) fcitx5;
};
meta = with lib; {
description = "Fcitx5 Module of A Japanese Input Method for Chromium OS, Windows, Mac and Linux (the Open Source Edition of Google Japanese Input)";
homepage = "https://github.com/fcitx/mozc";