1{ pkgs, lib, ... }:
2{
3 name = "lomiri-calculator-app-standalone";
4 meta.maintainers = lib.teams.lomiri.members;
5
6 nodes.machine =
7 { config, pkgs, ... }:
8 {
9 imports = [ ./common/x11.nix ];
10
11 services.xserver.enable = true;
12
13 environment = {
14 systemPackages = with pkgs.lomiri; [
15 suru-icon-theme
16 lomiri-calculator-app
17 ];
18 variables = {
19 UITK_ICON_THEME = "suru";
20 };
21 };
22
23 i18n.supportedLocales = [ "all" ];
24
25 fonts.packages = with pkgs; [
26 # Intended font & helps with OCR
27 ubuntu-classic
28 ];
29 };
30
31 enableOCR = true;
32
33 testScript = ''
34 machine.wait_for_x()
35
36 with subtest("lomiri calculator launches"):
37 machine.succeed("lomiri-calculator-app >&2 &")
38 machine.wait_for_console_text("Database upgraded to") # only on first run
39 machine.sleep(10)
40 machine.send_key("alt-f10")
41 machine.sleep(5)
42 machine.wait_for_text("Calculator")
43 machine.screenshot("lomiri-calculator")
44
45 with subtest("lomiri calculator works"):
46 # Seems like on slower hardware, we might be using the app too quickly after its startup, with the math library
47 # not being set up properly yet:
48 # qml: [LOG]: Unable to calculate formula : "22*16", math.js: TypeError: Cannot call method 'evaluate' of null
49 # OfBorg aarch64 CI is *incredibly slow*, hence the long duration.
50 machine.sleep(60)
51
52 machine.send_key("tab") # Fix focus
53
54 machine.send_chars("22*16\n")
55 machine.wait_for_text("352")
56 machine.screenshot("lomiri-calculator_caninfactdobasicmath")
57
58 machine.succeed("pkill -f lomiri-calculator-app")
59
60 with subtest("lomiri calculator localisation works"):
61 machine.succeed("env LANG=de_DE.UTF-8 lomiri-calculator-app >&2 &")
62 machine.wait_for_console_text("using main qml file from") # less precise, but the app doesn't exactly log a whole lot
63 machine.sleep(10)
64 machine.send_key("alt-f10")
65 machine.sleep(5)
66 machine.wait_for_text("Rechner")
67 machine.screenshot("lomiri-calculator_localised")
68
69 # History of previous run should have loaded
70 with subtest("lomiri calculator history works"):
71 machine.wait_for_text("352")
72 '';
73}