-
Notifications
You must be signed in to change notification settings - Fork 3
/
test_gui.py
133 lines (116 loc) · 3.17 KB
/
test_gui.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
"""Test the examples from the README.rst file."""
from __future__ import annotations
from pathlib import Path
import pytest
from tests.helper import Cli, get_file, invoke, open_in_gui
@pytest.mark.gui
def test_a4_piano_fruehtau() -> None:
src = (
Cli(
"--save-in-mscore",
"--a4",
"--rename",
"_Piano_A4",
"--only-filename",
"--staff-space",
"1.75mm",
"--margin",
"15mm",
"--title",
"Im Frühtau zu Berge",
"--subtitle",
"Vi gå över daggstänkta berg",
"--composer",
"Edwin Ericson",
"--lyricist",
"Olof Thunman",
"--reset-small-staffs",
)
.append_score("Im-Fruehtau-zu-Berge.mscz")
.score()
)
dest = src.new(filename="_Piano_A4.mscz")
assert dest.exists()
assert dest.meta.title == "Im Frühtau zu Berge"
assert dest.meta.subtitle == "Vi gå över daggstänkta berg"
assert dest.meta.composer == "Edwin Ericson"
assert dest.meta.lyricist == "Olof Thunman"
# open_in_gui(dest)
@pytest.mark.gui
def test_a4_piano_drunken() -> None:
src = (
Cli(
"--save-in-mscore",
"--a4",
"--rename",
"_Piano_A4",
"--only-filename",
"--staff-space",
"1.75mm",
"--margin",
"15mm",
"--title",
"Drunken Sailor",
"--subtitle",
"What shall we do with the drunken sailor",
"--reset-small-staffs",
"--header",
"",
"$:workTitle:",
"",
"--footer",
"",
"$P",
"",
)
.append_score("Drunken-Sailor.mscz")
.score()
)
dest = src.new(filename="_Piano_A4.mscz")
assert dest.exists()
assert dest.meta.title == "Drunken Sailor"
assert dest.meta.subtitle == "What shall we do with the drunken sailor"
assert dest.meta.composer is None
assert dest.meta.lyricist is None
assert dest.style.even_header_center == "$:workTitle:"
assert dest.style.odd_header_center == "$:workTitle:"
assert dest.style.even_footer_center == "$P"
assert dest.style.odd_footer_center == "$P"
open_in_gui(dest)
@pytest.mark.gui
def test_set_style() -> None:
tmp = get_file("Ragtime_3.mscz", version=4)
invoke(
"style",
"--set-style",
"pageWidth",
"4.13",
"--set-style",
"pageHeight",
"5.83",
"--set-style",
"pagePrintableWidth",
"3.35",
tmp,
)
assert Path(tmp).exists()
@pytest.mark.gui
def test_meta() -> None:
tmp = get_file("no-vbox.mscz", version=4)
invoke(
"meta",
"--set-field",
"vbox_title",
"This is a new title",
"--set-field",
"vbox_subtitle",
"This is a new subtitle",
"--set-field",
"vbox_composer",
"This is a new composer",
"--set-field",
"vbox_lyricist",
"This is a new lyricist",
tmp,
)
assert Path(tmp).exists()