1import ./make-test-python.nix ({ pkgs, ...} :
2
3let
4 # Make sure we don't have to go through the startup tutorial
5 customMuseScoreConfig = pkgs.writeText "MuseScore4.ini" ''
6 [application]
7 hasCompletedFirstLaunchSetup=true
8
9 [project]
10 preferredScoreCreationMode=1
11 '';
12in
13{
14 name = "musescore";
15 meta = with pkgs.lib.maintainers; {
16 maintainers = [ turion ];
17 };
18
19 nodes.machine = { ... }:
20
21 {
22 imports = [
23 ./common/x11.nix
24 ];
25
26 services.xserver.enable = true;
27 environment.systemPackages = with pkgs; [
28 musescore
29 pdfgrep
30 ];
31 };
32
33 enableOCR = true;
34
35 testScript = { ... }: ''
36 start_all()
37 machine.wait_for_x()
38
39 # Inject custom settings
40 machine.succeed("mkdir -p /root/.config/MuseScore/")
41 machine.succeed(
42 "cp ${customMuseScoreConfig} /root/.config/MuseScore/MuseScore4.ini"
43 )
44
45 # Start MuseScore window
46 machine.execute("DISPLAY=:0.0 mscore >&2 &")
47
48 # Wait until MuseScore has launched
49 machine.wait_for_window("MuseScore 4")
50
51 # Wait until the window has completely initialised
52 machine.wait_for_text("MuseScore 4")
53
54 machine.screenshot("MuseScore0")
55
56 # Create a new score
57 machine.send_key("ctrl-n")
58
59 # Wait until the creation wizard appears
60 machine.wait_for_window("New score")
61
62 machine.screenshot("MuseScore1")
63
64 machine.send_key("tab")
65 machine.send_key("tab")
66 machine.send_key("ret")
67
68 machine.sleep(2)
69
70 machine.send_key("tab")
71 # Type the beginning of https://de.wikipedia.org/wiki/Alle_meine_Entchen
72 machine.send_chars("cdef6gg5aaaa7g")
73 machine.sleep(1)
74
75 machine.screenshot("MuseScore2")
76
77 # Go to the export dialogue and create a PDF
78 machine.send_key("alt-f")
79 machine.sleep(1)
80 machine.send_key("e")
81
82 # Wait until the export dialogue appears.
83 machine.wait_for_text("Export")
84
85 machine.screenshot("MuseScore3")
86
87 machine.send_key("shift-tab")
88 machine.sleep(1)
89 machine.send_key("ret")
90 machine.sleep(1)
91 machine.send_key("ret")
92
93 machine.screenshot("MuseScore4")
94
95 # Wait until PDF is exported
96 machine.wait_for_file('"/root/Documents/MuseScore4/Scores/Untitled score.pdf"')
97
98 # Check that it contains the title of the score
99 machine.succeed('pdfgrep "Untitled score" "/root/Documents/MuseScore4/Scores/Untitled score.pdf"')
100
101 machine.screenshot("MuseScore5")
102 '';
103})