nixos.tests.musescore: fix and improve

- Use the print dialog to create a sample score.
- Copy also the sample score from the vm to $out of the test.
- Create a bit more screenshots
- Only use machine.wait_for_window, never machine.wait_for_text which
  requires OCR which is slow.
- Set XDG_RUNTIME_DIR so it won't dump core.
This commit is contained in:
Doron Behar 2024-06-03 02:28:26 +03:00
parent cb4edfcc55
commit 138ad7b73a

View File

@ -43,13 +43,10 @@ in
)
# Start MuseScore window
machine.execute("DISPLAY=:0.0 mscore >&2 &")
machine.execute("env XDG_RUNTIME_DIR=$PWD DISPLAY=:0.0 mscore >&2 &")
# Wait until MuseScore has launched
machine.wait_for_window("MuseScore 4")
# Wait until the window has completely initialised
machine.wait_for_text("MuseScore 4")
machine.wait_for_window("MuseScore Studio")
machine.screenshot("MuseScore0")
@ -75,29 +72,22 @@ in
machine.screenshot("MuseScore2")
# Go to the export dialogue and create a PDF
machine.send_key("alt-f")
machine.sleep(1)
machine.send_key("e")
machine.send_key("ctrl-p")
# Wait until the export dialogue appears.
machine.wait_for_text("Export")
machine.screenshot("MuseScore3")
machine.send_key("shift-tab")
machine.sleep(1)
machine.send_key("ret")
machine.sleep(1)
machine.send_key("ret")
# Wait until the Print dialogue appears.
machine.wait_for_window("Print")
machine.screenshot("MuseScore4")
# Wait until PDF is exported
machine.wait_for_file('"/root/Documents/MuseScore4/Scores/Untitled score.pdf"')
# Check that it contains the title of the score
machine.succeed('pdfgrep "Untitled score" "/root/Documents/MuseScore4/Scores/Untitled score.pdf"')
machine.send_key("alt-p")
machine.sleep(1)
machine.screenshot("MuseScore5")
# Wait until PDF is exported
machine.wait_for_file('"/root/Untitled score.pdf"')
## Check that it contains the title of the score
machine.succeed('pdfgrep "Untitled score" "/root/Untitled score.pdf"')
machine.copy_from_vm("/root/Untitled score.pdf")
'';
})