···
1
-
import ./make-test-python.nix (
1
+
{ lib, hostPkgs, ... }:
5
-
# Make sure we don't have to go through the startup tutorial
6
-
customMuseScoreConfig = pkgs.writeText "MuseScore4.ini" ''
8
-
hasCompletedFirstLaunchSetup=true
4
+
# Make sure we don't have to go through the startup tutorial
5
+
customMuseScoreConfig = hostPkgs.writeText "MuseScore4.ini" ''
7
+
hasCompletedFirstLaunchSetup=true
11
-
preferredScoreCreationMode=1
16
-
meta = with pkgs.lib.maintainers; {
17
-
maintainers = [ turion ];
10
+
preferredScoreCreationMode=1
15
+
meta = with lib.maintainers; {
16
+
maintainers = [ turion ];
26
+
services.xserver.enable = true;
27
+
environment.systemPackages = with pkgs; [
28
-
services.xserver.enable = true;
29
-
environment.systemPackages = with pkgs; [
39
+
machine.wait_for_x()
41
-
machine.wait_for_x()
41
+
# Inject custom settings
42
+
machine.succeed("mkdir -p /root/.config/MuseScore/")
44
+
"cp ${customMuseScoreConfig} /root/.config/MuseScore/MuseScore4.ini"
43
-
# Inject custom settings
44
-
machine.succeed("mkdir -p /root/.config/MuseScore/")
46
-
"cp ${customMuseScoreConfig} /root/.config/MuseScore/MuseScore4.ini"
47
+
# Start MuseScore window
48
+
machine.execute("env XDG_RUNTIME_DIR=$PWD DISPLAY=:0.0 mscore >&2 &")
49
-
# Start MuseScore window
50
-
machine.execute("env XDG_RUNTIME_DIR=$PWD DISPLAY=:0.0 mscore >&2 &")
50
+
# Wait until MuseScore has launched
51
+
machine.wait_for_window("MuseScore Studio")
52
-
# Wait until MuseScore has launched
53
-
machine.wait_for_window("MuseScore Studio")
53
+
machine.screenshot("MuseScore0")
55
-
machine.screenshot("MuseScore0")
55
+
# Create a new score
56
+
machine.send_key("ctrl-n")
57
-
# Create a new score
58
-
machine.send_key("ctrl-n")
58
+
# Wait until the creation wizard appears
59
+
machine.wait_for_window("New score")
60
-
# Wait until the creation wizard appears
61
-
machine.wait_for_window("New score")
61
+
machine.screenshot("MuseScore1")
63
-
machine.screenshot("MuseScore1")
63
+
machine.send_key("tab")
64
+
machine.send_key("tab")
65
+
machine.send_key("ret")
65
-
machine.send_key("tab")
66
-
machine.send_key("tab")
67
-
machine.send_key("ret")
69
+
machine.send_key("tab")
70
+
# Type the beginning of https://de.wikipedia.org/wiki/Alle_meine_Entchen
71
+
machine.send_chars("cdef6gg5aaaa7g")
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.screenshot("MuseScore2")
76
-
machine.screenshot("MuseScore2")
78
-
# Go to the export dialogue and create a PDF
79
-
machine.send_key("ctrl-p")
76
+
# Go to the export dialogue and create a PDF
77
+
machine.send_key("ctrl-p")
81
-
# Wait until the Print dialogue appears.
82
-
machine.wait_for_window("Print")
79
+
# Wait until the Print dialogue appears.
80
+
machine.wait_for_window("Print")
84
-
machine.screenshot("MuseScore4")
85
-
machine.send_key("alt-p")
82
+
machine.screenshot("MuseScore4")
83
+
machine.send_key("alt-p")
88
-
machine.screenshot("MuseScore5")
86
+
machine.screenshot("MuseScore5")
90
-
# Wait until PDF is exported
91
-
machine.wait_for_file('"/root/Untitled score.pdf"')
88
+
# Wait until PDF is exported
89
+
machine.wait_for_file('"/root/Untitled score.pdf"')
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")
91
+
## Check that it contains the title of the score
92
+
machine.succeed('pdfgrep "Untitled score" "/root/Untitled score.pdf"')
93
+
machine.copy_from_vm("/root/Untitled score.pdf")