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