about summary refs log tree commit diff
path: root/nixos/tests/lomiri-calculator-app.nix
blob: 3231353097a7697e5fe72f4144f7ef261c07f8e8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
{ pkgs, lib, ... }:
{
  name = "lomiri-calculator-app-standalone";
  meta.maintainers = lib.teams.lomiri.members;

  nodes.machine =
    { config, pkgs, ... }:
    {
      imports = [ ./common/x11.nix ];

      services.xserver.enable = true;

      environment = {
        systemPackages = with pkgs.lomiri; [
          suru-icon-theme
          lomiri-calculator-app
        ];
        variables = {
          UITK_ICON_THEME = "suru";
        };
      };

      i18n.supportedLocales = [ "all" ];

      fonts.packages = with pkgs; [
        # Intended font & helps with OCR
        ubuntu_font_family
      ];
    };

  enableOCR = true;

  testScript = ''
    machine.wait_for_x()

    with subtest("lomiri calculator launches"):
        machine.execute("lomiri-calculator-app >&2 &")
        machine.wait_for_text("Calculator")
        machine.screenshot("lomiri-calculator")

    with subtest("lomiri calculator works"):
        machine.send_key("tab") # Fix focus

        machine.send_chars("22*16\n")
        machine.wait_for_text("352")
        machine.screenshot("lomiri-calculator_caninfactdobasicmath")

    machine.succeed("pkill -f lomiri-calculator-app")

    with subtest("lomiri calculator localisation works"):
        machine.execute("env LANG=de_DE.UTF-8 lomiri-calculator-app >&2 &")
        machine.wait_for_text("Rechner")
        machine.screenshot("lomiri-calculator_localised")

    # History of previous run should have loaded
    with subtest("lomiri calculator history works"):
        machine.wait_for_text("352")
  '';
}