nixosTests.musescore: handleTest -> runTest

This commit is contained in:
Sizhe Zhao 2025-07-09 00:34:27 +08:00
parent 7b09056b8f
commit 7e1baf828c
No known key found for this signature in database
GPG Key ID: ED1807251A7DA08F
2 changed files with 74 additions and 77 deletions

View File

@ -901,7 +901,7 @@ in
mumble = runTest ./mumble.nix;
# Fails on aarch64-linux at the PDF creation step - need to debug this on an
# aarch64 machine..
musescore = handleTestOn [ "x86_64-linux" ] ./musescore.nix { };
musescore = runTestOn [ "x86_64-linux" ] ./musescore.nix;
music-assistant = runTest ./music-assistant.nix;
munin = runTest ./munin.nix;
mutableUsers = runTest ./mutable-users.nix;

View File

@ -1,98 +1,95 @@
import ./make-test-python.nix (
{ pkgs, ... }:
{ lib, hostPkgs, ... }:
let
# Make sure we don't have to go through the startup tutorial
customMuseScoreConfig = pkgs.writeText "MuseScore4.ini" ''
[application]
hasCompletedFirstLaunchSetup=true
let
# Make sure we don't have to go through the startup tutorial
customMuseScoreConfig = hostPkgs.writeText "MuseScore4.ini" ''
[application]
hasCompletedFirstLaunchSetup=true
[project]
preferredScoreCreationMode=1
'';
in
{
name = "musescore";
meta = with pkgs.lib.maintainers; {
maintainers = [ turion ];
[project]
preferredScoreCreationMode=1
'';
in
{
name = "musescore";
meta = with lib.maintainers; {
maintainers = [ turion ];
};
nodes.machine =
{ pkgs, ... }:
{
imports = [
./common/x11.nix
];
services.xserver.enable = true;
environment.systemPackages = with pkgs; [
musescore
pdfgrep
];
};
nodes.machine =
{ ... }:
enableOCR = true;
{
imports = [
./common/x11.nix
];
testScript =
{ ... }:
''
start_all()
machine.wait_for_x()
services.xserver.enable = true;
environment.systemPackages = with pkgs; [
musescore
pdfgrep
];
};
# Inject custom settings
machine.succeed("mkdir -p /root/.config/MuseScore/")
machine.succeed(
"cp ${customMuseScoreConfig} /root/.config/MuseScore/MuseScore4.ini"
)
enableOCR = true;
# Start MuseScore window
machine.execute("env XDG_RUNTIME_DIR=$PWD DISPLAY=:0.0 mscore >&2 &")
testScript =
{ ... }:
''
start_all()
machine.wait_for_x()
# Wait until MuseScore has launched
machine.wait_for_window("MuseScore Studio")
# Inject custom settings
machine.succeed("mkdir -p /root/.config/MuseScore/")
machine.succeed(
"cp ${customMuseScoreConfig} /root/.config/MuseScore/MuseScore4.ini"
)
machine.screenshot("MuseScore0")
# Start MuseScore window
machine.execute("env XDG_RUNTIME_DIR=$PWD DISPLAY=:0.0 mscore >&2 &")
# Create a new score
machine.send_key("ctrl-n")
# Wait until MuseScore has launched
machine.wait_for_window("MuseScore Studio")
# Wait until the creation wizard appears
machine.wait_for_window("New score")
machine.screenshot("MuseScore0")
machine.screenshot("MuseScore1")
# Create a new score
machine.send_key("ctrl-n")
machine.send_key("tab")
machine.send_key("tab")
machine.send_key("ret")
# Wait until the creation wizard appears
machine.wait_for_window("New score")
machine.sleep(2)
machine.screenshot("MuseScore1")
machine.send_key("tab")
# Type the beginning of https://de.wikipedia.org/wiki/Alle_meine_Entchen
machine.send_chars("cdef6gg5aaaa7g")
machine.sleep(1)
machine.send_key("tab")
machine.send_key("tab")
machine.send_key("ret")
machine.screenshot("MuseScore2")
machine.sleep(2)
# Go to the export dialogue and create a PDF
machine.send_key("ctrl-p")
machine.send_key("tab")
# Type the beginning of https://de.wikipedia.org/wiki/Alle_meine_Entchen
machine.send_chars("cdef6gg5aaaa7g")
machine.sleep(1)
# Wait until the Print dialogue appears.
machine.wait_for_window("Print")
machine.screenshot("MuseScore2")
machine.screenshot("MuseScore4")
machine.send_key("alt-p")
machine.sleep(1)
# Go to the export dialogue and create a PDF
machine.send_key("ctrl-p")
machine.screenshot("MuseScore5")
# Wait until the Print dialogue appears.
machine.wait_for_window("Print")
# Wait until PDF is exported
machine.wait_for_file('"/root/Untitled score.pdf"')
machine.screenshot("MuseScore4")
machine.send_key("alt-p")
machine.sleep(1)
machine.screenshot("MuseScore5")
# Wait until PDF is exported
machine.wait_for_file('"/root/Untitled score.pdf"')
## Check that it contains the title of the score
machine.succeed('pdfgrep "Untitled score" "/root/Untitled score.pdf"')
machine.copy_from_vm("/root/Untitled score.pdf")
'';
}
)
## Check that it contains the title of the score
machine.succeed('pdfgrep "Untitled score" "/root/Untitled score.pdf"')
machine.copy_from_vm("/root/Untitled score.pdf")
'';
}