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 "MuseScore3.ini" ''
6 [application]
7 startup\firstStart=false
8
9 [ui]
10 application\startup\showTours=false
11 application\startup\showStartCenter=false
12 '';
13in
14{
15 name = "musescore";
16 meta = with pkgs.lib.maintainers; {
17 maintainers = [ turion ];
18 };
19
20 machine = { ... }:
21
22 {
23 imports = [
24 ./common/x11.nix
25 ];
26
27 services.xserver.enable = true;
28 environment.systemPackages = with pkgs; [
29 musescore
30 pdfgrep
31 ];
32 };
33
34 enableOCR = true;
35
36 testScript = { ... }: ''
37 start_all()
38 machine.wait_for_x()
39
40 # Inject custom settings
41 machine.succeed("mkdir -p /root/.config/MuseScore/")
42 machine.succeed(
43 "cp ${customMuseScoreConfig} /root/.config/MuseScore/MuseScore3.ini"
44 )
45
46 # Start MuseScore window
47 machine.execute("DISPLAY=:0.0 mscore >&2 &")
48
49 # Wait until MuseScore has launched
50 machine.wait_for_window("MuseScore")
51
52 # Wait until the window has completely initialised
53 machine.wait_for_text("MuseScore")
54
55 # Start entering notes
56 machine.send_key("n")
57 # Type the beginning of https://de.wikipedia.org/wiki/Alle_meine_Entchen
58 machine.send_chars("cdef6gg5aaaa7g")
59 # Make sure the VM catches up with all the keys
60 machine.sleep(1)
61
62 machine.screenshot("MuseScore0")
63
64 # Go to the export dialogue and create a PDF
65 machine.send_key("alt-f")
66 machine.sleep(1)
67 machine.send_key("e")
68
69 # Wait until the export dialogue appears.
70 machine.wait_for_window("Export")
71 machine.screenshot("MuseScore1")
72 machine.send_key("ret")
73 machine.sleep(1)
74 machine.send_key("ret")
75
76 machine.screenshot("MuseScore2")
77
78 # Wait until PDF is exported
79 machine.wait_for_file("/root/Documents/MuseScore3/Scores/Untitled.pdf")
80
81 # Check that it contains the title of the score
82 machine.succeed("pdfgrep Title /root/Documents/MuseScore3/Scores/Untitled.pdf")
83
84 machine.screenshot("MuseScore3")
85 '';
86})