2021-03-09 03:18:52 +00:00
|
|
|
import ./make-test-python.nix ({ pkgs, ...} :
|
|
|
|
|
|
|
|
let
|
|
|
|
# Make sure we don't have to go through the startup tutorial
|
2023-02-09 11:40:11 +00:00
|
|
|
customMuseScoreConfig = pkgs.writeText "MuseScore4.ini" ''
|
2021-03-09 03:18:52 +00:00
|
|
|
[application]
|
2023-02-09 11:40:11 +00:00
|
|
|
hasCompletedFirstLaunchSetup=true
|
2021-03-09 03:18:52 +00:00
|
|
|
|
2023-02-09 11:40:11 +00:00
|
|
|
[project]
|
|
|
|
preferredScoreCreationMode=1
|
2021-03-09 03:18:52 +00:00
|
|
|
'';
|
|
|
|
in
|
|
|
|
{
|
|
|
|
name = "musescore";
|
|
|
|
meta = with pkgs.lib.maintainers; {
|
|
|
|
maintainers = [ turion ];
|
|
|
|
};
|
|
|
|
|
2022-04-03 18:54:34 +00:00
|
|
|
nodes.machine = { ... }:
|
2021-03-09 03:18:52 +00: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(
|
2023-02-09 11:40:11 +00:00
|
|
|
"cp ${customMuseScoreConfig} /root/.config/MuseScore/MuseScore4.ini"
|
2021-03-09 03:18:52 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
# Start MuseScore window
|
2021-12-06 16:07:01 +00:00
|
|
|
machine.execute("DISPLAY=:0.0 mscore >&2 &")
|
2021-03-09 03:18:52 +00:00
|
|
|
|
|
|
|
# Wait until MuseScore has launched
|
2023-02-09 11:40:11 +00:00
|
|
|
machine.wait_for_window("MuseScore 4")
|
2021-03-09 03:18:52 +00:00
|
|
|
|
|
|
|
# Wait until the window has completely initialised
|
2023-02-09 11:40:11 +00:00
|
|
|
machine.wait_for_text("MuseScore 4")
|
|
|
|
|
|
|
|
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("tab")
|
|
|
|
machine.send_key("tab")
|
|
|
|
machine.send_key("right")
|
|
|
|
machine.send_key("right")
|
|
|
|
machine.send_key("ret")
|
|
|
|
|
|
|
|
machine.sleep(1)
|
2021-03-09 03:18:52 +00:00
|
|
|
|
|
|
|
# Type the beginning of https://de.wikipedia.org/wiki/Alle_meine_Entchen
|
|
|
|
machine.send_chars("cdef6gg5aaaa7g")
|
|
|
|
machine.sleep(1)
|
|
|
|
|
2023-02-09 11:40:11 +00:00
|
|
|
machine.screenshot("MuseScore2")
|
2021-03-09 03:18:52 +00:00
|
|
|
|
|
|
|
# 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.
|
2023-02-09 11:40:11 +00:00
|
|
|
machine.wait_for_text("Export")
|
|
|
|
|
|
|
|
machine.screenshot("MuseScore3")
|
|
|
|
|
2022-12-02 08:20:57 +00:00
|
|
|
machine.send_key("shift-tab")
|
|
|
|
machine.sleep(1)
|
2021-03-09 03:18:52 +00:00
|
|
|
machine.send_key("ret")
|
|
|
|
machine.sleep(1)
|
|
|
|
machine.send_key("ret")
|
|
|
|
|
2023-02-09 11:40:11 +00:00
|
|
|
machine.screenshot("MuseScore4")
|
2021-03-09 03:18:52 +00:00
|
|
|
|
|
|
|
# Wait until PDF is exported
|
2023-02-09 11:40:11 +00:00
|
|
|
machine.wait_for_file('"/root/Documents/MuseScore4/Scores/Untitled score.pdf"')
|
2021-03-09 03:18:52 +00:00
|
|
|
|
|
|
|
# Check that it contains the title of the score
|
2023-02-09 11:40:11 +00:00
|
|
|
machine.succeed('pdfgrep "Untitled score" "/root/Documents/MuseScore4/Scores/Untitled score.pdf"')
|
2021-03-09 03:18:52 +00:00
|
|
|
|
2023-02-09 11:40:11 +00:00
|
|
|
machine.screenshot("MuseScore5")
|
2021-03-09 03:18:52 +00:00
|
|
|
'';
|
|
|
|
})
|