summary refs log tree commit diff
diff options
context:
space:
mode:
authorManuel Bärenz <programming@manuelbaerenz.de>2021-02-27 02:26:02 +0100
committerGitHub <noreply@github.com>2021-02-26 20:26:02 -0500
commit17024be1d1ff96bd58e1b4846b060d417b275744 (patch)
tree6cf2dfbbc9a6b0ec869e907a829fb34baeceddd1
parent1585a04bcb8deeb63a50c89e89dd0628a4d16077 (diff)
downloadnixpkgs-17024be1d1ff96bd58e1b4846b060d417b275744.tar
nixpkgs-17024be1d1ff96bd58e1b4846b060d417b275744.tar.gz
nixpkgs-17024be1d1ff96bd58e1b4846b060d417b275744.tar.bz2
nixpkgs-17024be1d1ff96bd58e1b4846b060d417b275744.tar.lz
nixpkgs-17024be1d1ff96bd58e1b4846b060d417b275744.tar.xz
nixpkgs-17024be1d1ff96bd58e1b4846b060d417b275744.tar.zst
nixpkgs-17024be1d1ff96bd58e1b4846b060d417b275744.zip
nixos/tests: add musescore
-rw-r--r--nixos/tests/all-tests.nix1
-rw-r--r--nixos/tests/musescore.nix86
-rw-r--r--pkgs/applications/audio/musescore/default.nix3
3 files changed, 90 insertions, 0 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index 5ea7a5c0f05..773f91d8604 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -240,6 +240,7 @@ in
   mosquitto = handleTest ./mosquitto.nix {};
   mpd = handleTest ./mpd.nix {};
   mumble = handleTest ./mumble.nix {};
+  musescore = handleTest ./musescore.nix {};
   munin = handleTest ./munin.nix {};
   mutableUsers = handleTest ./mutable-users.nix {};
   mxisd = handleTest ./mxisd.nix {};
diff --git a/nixos/tests/musescore.nix b/nixos/tests/musescore.nix
new file mode 100644
index 00000000000..96481a9a8bf
--- /dev/null
+++ b/nixos/tests/musescore.nix
@@ -0,0 +1,86 @@
+import ./make-test-python.nix ({ pkgs, ...} :
+
+let
+  # Make sure we don't have to go through the startup tutorial
+  customMuseScoreConfig = pkgs.writeText "MuseScore3.ini" ''
+    [application]
+    startup\firstStart=false
+
+    [ui]
+    application\startup\showTours=false
+    application\startup\showStartCenter=false
+    '';
+in
+{
+  name = "musescore";
+  meta = with pkgs.lib.maintainers; {
+    maintainers = [ turion ];
+  };
+
+  machine = { ... }:
+
+  {
+    imports = [
+      ./common/x11.nix
+    ];
+
+    services.xserver.enable = true;
+    environment.systemPackages = with pkgs; [
+      musescore
+      pdfgrep
+    ];
+  };
+
+  enableOCR = true;
+
+  testScript = { ... }: ''
+    start_all()
+    machine.wait_for_x()
+
+    # Inject custom settings
+    machine.succeed("mkdir -p /root/.config/MuseScore/")
+    machine.succeed(
+        "cp ${customMuseScoreConfig} /root/.config/MuseScore/MuseScore3.ini"
+    )
+
+    # Start MuseScore window
+    machine.execute("DISPLAY=:0.0 mscore &")
+
+    # Wait until MuseScore has launched
+    machine.wait_for_window("MuseScore")
+
+    # Wait until the window has completely initialised
+    machine.wait_for_text("MuseScore")
+
+    # Start entering notes
+    machine.send_key("n")
+    # Type the beginning of https://de.wikipedia.org/wiki/Alle_meine_Entchen
+    machine.send_chars("cdef6gg5aaaa7g")
+    # Make sure the VM catches up with all the keys
+    machine.sleep(1)
+
+    machine.screenshot("MuseScore0")
+
+    # Go to the export dialogue and create a PDF
+    machine.send_key("alt-f")
+    machine.sleep(1)
+    machine.send_key("e")
+
+    # Wait until the export dialogue appears.
+    machine.wait_for_window("Export")
+    machine.screenshot("MuseScore1")
+    machine.send_key("ret")
+    machine.sleep(1)
+    machine.send_key("ret")
+
+    machine.screenshot("MuseScore2")
+
+    # Wait until PDF is exported
+    machine.wait_for_file("/root/Documents/MuseScore3/Scores/Untitled.pdf")
+
+    # Check that it contains the title of the score
+    machine.succeed("pdfgrep Title /root/Documents/MuseScore3/Scores/Untitled.pdf")
+
+    machine.screenshot("MuseScore3")
+  '';
+})
diff --git a/pkgs/applications/audio/musescore/default.nix b/pkgs/applications/audio/musescore/default.nix
index 47f8e5a22e6..0c1ad144a4a 100644
--- a/pkgs/applications/audio/musescore/default.nix
+++ b/pkgs/applications/audio/musescore/default.nix
@@ -3,6 +3,7 @@
 , portaudio, portmidi, qtbase, qtdeclarative, qtgraphicaleffects
 , qtquickcontrols2, qtscript, qtsvg, qttools
 , qtwebengine, qtxmlpatterns
+, nixosTests
 }:
 
 mkDerivation rec {
@@ -40,6 +41,8 @@ mkDerivation rec {
     qtscript qtsvg qttools qtwebengine qtxmlpatterns
   ];
 
+  passthru.tests = nixosTests.musescore;
+
   meta = with lib; {
     description = "Music notation and composition software";
     homepage = "https://musescore.org/";