tests/lomiri-docviewer-app: init

This commit is contained in:
OPNA2608 2024-08-24 23:09:29 +02:00
parent de8cf8018c
commit 531655d3bf
3 changed files with 87 additions and 0 deletions

View File

@ -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 {};

View File

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

View File

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