From 138ad7b73ac34a289403ba9bf4d5b0da691ab3e4 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Mon, 3 Jun 2024 02:28:26 +0300 Subject: 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. --- nixos/tests/musescore.nix | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) (limited to 'nixos') diff --git a/nixos/tests/musescore.nix b/nixos/tests/musescore.nix index 0720631ed284b..559c91ed8e550 100644 --- a/nixos/tests/musescore.nix +++ b/nixos/tests/musescore.nix @@ -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") - - # Wait until the export dialogue appears. - machine.wait_for_text("Export") + machine.send_key("ctrl-p") - machine.screenshot("MuseScore3") + # Wait until the Print dialogue appears. + machine.wait_for_window("Print") - machine.send_key("shift-tab") - machine.sleep(1) - machine.send_key("ret") + machine.screenshot("MuseScore4") + machine.send_key("alt-p") machine.sleep(1) - machine.send_key("ret") - machine.screenshot("MuseScore4") + machine.screenshot("MuseScore5") # Wait until PDF is exported - machine.wait_for_file('"/root/Documents/MuseScore4/Scores/Untitled score.pdf"') + machine.wait_for_file('"/root/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.screenshot("MuseScore5") + ## 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") ''; }) -- cgit 1.4.1