diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index fb5d04f440b5..14740b3ecbdc 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -545,6 +545,7 @@ in { lomiri-calculator-app = runTest ./lomiri-calculator-app.nix; lomiri-camera-app = runTest ./lomiri-camera-app.nix; lomiri-clock-app = runTest ./lomiri-clock-app.nix; + lomiri-docviewer-app = runTest ./lomiri-docviewer-app.nix; lomiri-filemanager-app = runTest ./lomiri-filemanager-app.nix; lomiri-gallery-app = runTest ./lomiri-gallery-app.nix; lomiri-system-settings = handleTest ./lomiri-system-settings.nix {}; diff --git a/nixos/tests/lomiri-docviewer-app.nix b/nixos/tests/lomiri-docviewer-app.nix new file mode 100644 index 000000000000..c21a121f6c02 --- /dev/null +++ b/nixos/tests/lomiri-docviewer-app.nix @@ -0,0 +1,84 @@ +{ lib, ... }: +let + exampleText = "Lorem ipsum dolor sit amet"; +in +{ + name = "lomiri-docviewer-app-standalone"; + meta.maintainers = lib.teams.lomiri.members; + + nodes.machine = + { config, pkgs, ... }: + { + imports = [ ./common/x11.nix ]; + + services.xserver.enable = true; + + environment = { + etc."docviewer-sampletext.txt".text = exampleText; + systemPackages = + with pkgs; + [ + libreoffice # txt -> odf to test LibreOfficeKit integration + ] + ++ (with pkgs.lomiri; [ + suru-icon-theme + lomiri-docviewer-app + ]); + variables = { + UITK_ICON_THEME = "suru"; + }; + }; + + i18n.supportedLocales = [ "all" ]; + + fonts = { + packages = with pkgs; [ + # Intended font & helps with OCR + ubuntu-classic + ]; + }; + }; + + enableOCR = true; + + testScript = '' + machine.wait_for_x() + + with subtest("lomiri docviewer launches"): + machine.succeed("lomiri-docviewer-app >&2 &") + machine.wait_for_text("No documents") + machine.screenshot("lomiri-docviewer_open") + + machine.succeed("pkill -f lomiri-docviewer-app") + + # Setup different document types + machine.succeed("soffice --convert-to odt --outdir /root/ /etc/docviewer-sampletext.txt") + machine.succeed("soffice --convert-to pdf --outdir /root/ /etc/docviewer-sampletext.txt") + + with subtest("lomiri docviewer txt works"): + machine.succeed("lomiri-docviewer-app /etc/docviewer-sampletext.txt >&2 &") + machine.wait_for_text("${exampleText}") + machine.screenshot("lomiri-docviewer_txt") + + machine.succeed("pkill -f lomiri-docviewer-app") + + with subtest("lomiri docviewer odt works"): + machine.succeed("lomiri-docviewer-app /root/docviewer-sampletext.odt >&2 &") + machine.wait_for_text("${exampleText}") + machine.screenshot("lomiri-docviewer_odt") + + machine.succeed("pkill -f lomiri-docviewer-app") + + with subtest("lomiri docviewer pdf works"): + machine.succeed("lomiri-docviewer-app /root/docviewer-sampletext.pdf >&2 &") + machine.wait_for_text("${exampleText}") + machine.screenshot("lomiri-docviewer_pdf") + + machine.succeed("pkill -f lomiri-docviewer-app") + + with subtest("lomiri docviewer localisation works"): + machine.succeed("env LANG=de_DE.UTF-8 lomiri-docviewer-app >&2 &") + machine.wait_for_text("Keine Dokumente") + machine.screenshot("lomiri-docviewer_localised") + ''; +} diff --git a/pkgs/desktops/lomiri/applications/lomiri-docviewer-app/default.nix b/pkgs/desktops/lomiri/applications/lomiri-docviewer-app/default.nix index 9fb8cebe4e94..2618553236f2 100644 --- a/pkgs/desktops/lomiri/applications/lomiri-docviewer-app/default.nix +++ b/pkgs/desktops/lomiri/applications/lomiri-docviewer-app/default.nix @@ -5,6 +5,7 @@ fetchpatch, fetchpatch2, gitUpdater, + nixosTests, cmake, content-hub, gettext, @@ -140,6 +141,7 @@ stdenv.mkDerivation (finalAttrs: { ''; passthru = { + tests.vm = nixosTests.lomiri-docviewer-app; updateScript = gitUpdater { rev-prefix = "v"; }; };