at 23.11-pre 2.5 kB view raw
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 "MuseScore4.ini" '' 6 [application] 7 hasCompletedFirstLaunchSetup=true 8 9 [project] 10 preferredScoreCreationMode=1 11 ''; 12in 13{ 14 name = "musescore"; 15 meta = with pkgs.lib.maintainers; { 16 maintainers = [ turion ]; 17 }; 18 19 nodes.machine = { ... }: 20 21 { 22 imports = [ 23 ./common/x11.nix 24 ]; 25 26 services.xserver.enable = true; 27 environment.systemPackages = with pkgs; [ 28 musescore 29 pdfgrep 30 ]; 31 }; 32 33 enableOCR = true; 34 35 testScript = { ... }: '' 36 start_all() 37 machine.wait_for_x() 38 39 # Inject custom settings 40 machine.succeed("mkdir -p /root/.config/MuseScore/") 41 machine.succeed( 42 "cp ${customMuseScoreConfig} /root/.config/MuseScore/MuseScore4.ini" 43 ) 44 45 # Start MuseScore window 46 machine.execute("DISPLAY=:0.0 mscore >&2 &") 47 48 # Wait until MuseScore has launched 49 machine.wait_for_window("MuseScore 4") 50 51 # Wait until the window has completely initialised 52 machine.wait_for_text("MuseScore 4") 53 54 machine.screenshot("MuseScore0") 55 56 # Create a new score 57 machine.send_key("ctrl-n") 58 59 # Wait until the creation wizard appears 60 machine.wait_for_window("New score") 61 62 machine.screenshot("MuseScore1") 63 64 machine.send_key("tab") 65 machine.send_key("tab") 66 machine.send_key("tab") 67 machine.send_key("tab") 68 machine.send_key("right") 69 machine.send_key("right") 70 machine.send_key("ret") 71 72 machine.sleep(1) 73 74 # Type the beginning of https://de.wikipedia.org/wiki/Alle_meine_Entchen 75 machine.send_chars("cdef6gg5aaaa7g") 76 machine.sleep(1) 77 78 machine.screenshot("MuseScore2") 79 80 # Go to the export dialogue and create a PDF 81 machine.send_key("alt-f") 82 machine.sleep(1) 83 machine.send_key("e") 84 85 # Wait until the export dialogue appears. 86 machine.wait_for_text("Export") 87 88 machine.screenshot("MuseScore3") 89 90 machine.send_key("shift-tab") 91 machine.sleep(1) 92 machine.send_key("ret") 93 machine.sleep(1) 94 machine.send_key("ret") 95 96 machine.screenshot("MuseScore4") 97 98 # Wait until PDF is exported 99 machine.wait_for_file('"/root/Documents/MuseScore4/Scores/Untitled score.pdf"') 100 101 # Check that it contains the title of the score 102 machine.succeed('pdfgrep "Untitled score" "/root/Documents/MuseScore4/Scores/Untitled score.pdf"') 103 104 machine.screenshot("MuseScore5") 105 ''; 106})