2021-02-27 02:26:02 +01:00
|
|
|
import ./make-test-python.nix ({ pkgs, ...} :
|
|
|
|
|
|
|
|
let
|
|
|
|
# Make sure we don't have to go through the startup tutorial
|
2022-12-17 15:05:59 +01:00
|
|
|
customMuseScoreConfig = pkgs.writeText "MuseScore4.ini" ''
|
2021-02-27 02:26:02 +01:00
|
|
|
[application]
|
2022-12-17 15:05:59 +01:00
|
|
|
hasCompletedFirstLaunchSetup=true
|
2021-02-27 02:26:02 +01:00
|
|
|
|
2022-12-17 15:05:59 +01:00
|
|
|
[project]
|
|
|
|
preferredScoreCreationMode=1
|
2021-02-27 02:26:02 +01:00
|
|
|
'';
|
|
|
|
in
|
|
|
|
{
|
|
|
|
name = "musescore";
|
|
|
|
meta = with pkgs.lib.maintainers; {
|
|
|
|
maintainers = [ turion ];
|
|
|
|
};
|
|
|
|
|
2022-03-21 00:15:30 +01:00
|
|
|
nodes.machine = { ... }:
|
2021-02-27 02:26:02 +01:00
|
|
|
|
|
|
|
{
|
|
|
|
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(
|
2022-12-17 15:05:59 +01:00
|
|
|
"cp ${customMuseScoreConfig} /root/.config/MuseScore/MuseScore4.ini"
|
2021-02-27 02:26:02 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
# Start MuseScore window
|
2024-06-03 01:28:26 +02:00
|
|
|
machine.execute("env XDG_RUNTIME_DIR=$PWD DISPLAY=:0.0 mscore >&2 &")
|
2021-02-27 02:26:02 +01:00
|
|
|
|
|
|
|
# Wait until MuseScore has launched
|
2024-06-03 01:28:26 +02:00
|
|
|
machine.wait_for_window("MuseScore Studio")
|
2022-12-17 15:05:59 +01:00
|
|
|
|
|
|
|
machine.screenshot("MuseScore0")
|
|
|
|
|
|
|
|
# Create a new score
|
|
|
|
machine.send_key("ctrl-n")
|
|
|
|
|
|
|
|
# Wait until the creation wizard appears
|
|
|
|
machine.wait_for_window("New score")
|
|
|
|
|
|
|
|
machine.screenshot("MuseScore1")
|
|
|
|
|
|
|
|
machine.send_key("tab")
|
|
|
|
machine.send_key("tab")
|
|
|
|
machine.send_key("ret")
|
|
|
|
|
2023-12-21 14:33:33 +01:00
|
|
|
machine.sleep(2)
|
2021-02-27 02:26:02 +01:00
|
|
|
|
2023-12-21 14:33:33 +01:00
|
|
|
machine.send_key("tab")
|
2021-02-27 02:26:02 +01:00
|
|
|
# Type the beginning of https://de.wikipedia.org/wiki/Alle_meine_Entchen
|
|
|
|
machine.send_chars("cdef6gg5aaaa7g")
|
|
|
|
machine.sleep(1)
|
|
|
|
|
2022-12-17 15:05:59 +01:00
|
|
|
machine.screenshot("MuseScore2")
|
2021-02-27 02:26:02 +01:00
|
|
|
|
|
|
|
# Go to the export dialogue and create a PDF
|
2024-06-03 01:28:26 +02:00
|
|
|
machine.send_key("ctrl-p")
|
2022-12-17 15:05:59 +01:00
|
|
|
|
2024-06-03 01:28:26 +02:00
|
|
|
# Wait until the Print dialogue appears.
|
|
|
|
machine.wait_for_window("Print")
|
2022-12-17 15:05:59 +01:00
|
|
|
|
2024-06-03 01:28:26 +02:00
|
|
|
machine.screenshot("MuseScore4")
|
|
|
|
machine.send_key("alt-p")
|
2021-02-27 02:26:02 +01:00
|
|
|
machine.sleep(1)
|
|
|
|
|
2024-06-03 01:28:26 +02:00
|
|
|
machine.screenshot("MuseScore5")
|
2021-02-27 02:26:02 +01:00
|
|
|
|
|
|
|
# Wait until PDF is exported
|
2024-06-03 01:28:26 +02:00
|
|
|
machine.wait_for_file('"/root/Untitled score.pdf"')
|
2021-02-27 02:26:02 +01:00
|
|
|
|
2024-06-03 01:28:26 +02:00
|
|
|
## 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")
|
2021-02-27 02:26:02 +01:00
|
|
|
'';
|
|
|
|
})
|