Skip to content

Commit 8e7a5cb

Browse files
authored
Merge pull request #28401 from juli27/convertMidiImportTests
iex/midi/tests: Convert import tests to gtest
2 parents 6c3e4c3 + e2b1d81 commit 8e7a5cb

File tree

99 files changed

+1032
-644
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+1032
-644
lines changed

src/importexport/midi/tests/CMakeLists.txt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,15 @@
2121
set(MODULE_TEST iex_midi_tests)
2222

2323
set(MODULE_TEST_SRC
24+
${PROJECT_SOURCE_DIR}/src/engraving/tests/utils/scorerw.cpp
25+
${PROJECT_SOURCE_DIR}/src/engraving/tests/utils/scorerw.h
26+
${PROJECT_SOURCE_DIR}/src/engraving/tests/utils/scorecomp.cpp
27+
${PROJECT_SOURCE_DIR}/src/engraving/tests/utils/scorecomp.h
28+
2429
${CMAKE_CURRENT_LIST_DIR}/environment.cpp
25-
${CMAKE_CURRENT_LIST_DIR}/testbase.cpp
26-
${CMAKE_CURRENT_LIST_DIR}/testbase.h
27-
#${CMAKE_CURRENT_LIST_DIR}/midiimport_tests.cpp doesn't compile and needs actualization
30+
#${CMAKE_CURRENT_LIST_DIR}/testbase.cpp
31+
#${CMAKE_CURRENT_LIST_DIR}/testbase.h
32+
${CMAKE_CURRENT_LIST_DIR}/midiimport_tests.cpp
2833
#${CMAKE_CURRENT_LIST_DIR}/midiexport_tests.cpp doesn't compile and needs actualization
2934
)
3035

@@ -35,4 +40,4 @@ set(MODULE_TEST_LINK
3540

3641
set(MODULE_TEST_DATA_ROOT ${CMAKE_CURRENT_LIST_DIR})
3742

38-
include(${PROJECT_SOURCE_DIR}/src/framework/testing/qtest.cmake)
43+
include(SetupGTest)

src/importexport/midi/tests/environment.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
#include "engraving/dom/instrtemplate.h"
2929
#include "engraving/dom/mscore.h"
3030

31+
#include "engraving/tests/utils/scorerw.h"
32+
3133
#include "log.h"
3234

3335
static muse::testing::SuiteEnvironment importexport_se(
@@ -39,6 +41,8 @@ static muse::testing::SuiteEnvironment importexport_se(
3941
[]() {
4042
LOGI() << "midi tests suite post init";
4143

44+
mu::engraving::ScoreRW::setRootPath(muse::String::fromUtf8(iex_midi_tests_DATA_ROOT));
45+
4246
mu::engraving::MScore::testMode = true;
4347
mu::engraving::MScore::noGui = true;
4448

src/importexport/midi/tests/midiimport_data/m1.mscx renamed to src/importexport/midi/tests/midiimport_data/m1-ref.mscx

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<museScore version="4.00">
2+
<museScore version="4.60">
33
<Score>
4+
<eid>B_B</eid>
45
<Division>480</Division>
56
<Style>
6-
<Spatium>1.74978</Spatium>
7+
<spatium>1.74978</spatium>
78
</Style>
89
<showInvisible>1</showInvisible>
910
<showUnprintable>1</showUnprintable>
@@ -19,15 +20,17 @@
1920
<metaTag name="translator"></metaTag>
2021
<metaTag name="workNumber"></metaTag>
2122
<metaTag name="workTitle"></metaTag>
22-
<Part>
23-
<Staff id="1">
23+
<Part id="1">
24+
<Staff>
25+
<eid>C_C</eid>
2426
<StaffType group="pitched">
2527
<name>stdNormal</name>
2628
</StaffType>
2729
<bracket type="1" span="2" col="0" visible="1"/>
2830
<barLineSpan>1</barLineSpan>
2931
</Staff>
30-
<Staff id="2">
32+
<Staff>
33+
<eid>D_D</eid>
3134
<StaffType group="pitched">
3235
<name>stdNormal</name>
3336
</StaffType>
@@ -91,70 +94,80 @@
9194
</Part>
9295
<Staff id="1">
9396
<Measure>
97+
<eid>E_E</eid>
9498
<voice>
9599
<TimeSig>
100+
<eid>F_F</eid>
96101
<sigN>4</sigN>
97102
<sigD>4</sigD>
98103
</TimeSig>
99104
<Chord>
105+
<eid>G_G</eid>
100106
<durationType>quarter</durationType>
101107
<Note>
108+
<eid>H_H</eid>
102109
<pitch>67</pitch>
103110
<tpc>15</tpc>
104111
<velocity>80</velocity>
105-
<veloType>user</veloType>
106112
</Note>
107113
</Chord>
108114
<Chord>
115+
<eid>I_I</eid>
109116
<durationType>quarter</durationType>
110117
<Note>
118+
<eid>J_J</eid>
111119
<pitch>69</pitch>
112120
<tpc>17</tpc>
113121
<velocity>80</velocity>
114-
<veloType>user</veloType>
115122
</Note>
116123
</Chord>
117124
<Chord>
125+
<eid>K_K</eid>
118126
<durationType>quarter</durationType>
119127
<Note>
128+
<eid>L_L</eid>
120129
<pitch>71</pitch>
121130
<tpc>19</tpc>
122131
<velocity>80</velocity>
123-
<veloType>user</veloType>
124132
</Note>
125133
</Chord>
126134
<Chord>
135+
<eid>M_M</eid>
127136
<durationType>quarter</durationType>
128137
<Note>
138+
<eid>N_N</eid>
129139
<pitch>72</pitch>
130140
<tpc>14</tpc>
131141
<velocity>80</velocity>
132-
<veloType>user</veloType>
133142
</Note>
134143
</Chord>
135144
</voice>
136145
</Measure>
137146
<Measure>
147+
<eid>O_O</eid>
138148
<voice>
139149
<Chord>
150+
<eid>P_P</eid>
140151
<durationType>quarter</durationType>
141152
<Note>
153+
<eid>Q_Q</eid>
142154
<pitch>72</pitch>
143155
<tpc>14</tpc>
144156
<velocity>80</velocity>
145-
<veloType>user</veloType>
146157
</Note>
147158
</Chord>
148159
<Chord>
160+
<eid>R_R</eid>
149161
<durationType>quarter</durationType>
150162
<Note>
163+
<eid>S_S</eid>
151164
<pitch>72</pitch>
152165
<tpc>14</tpc>
153166
<velocity>80</velocity>
154-
<veloType>user</veloType>
155167
</Note>
156168
</Chord>
157169
<Rest>
170+
<eid>T_T</eid>
158171
<durationType>half</durationType>
159172
</Rest>
160173
</voice>
@@ -164,29 +177,34 @@
164177
<Measure>
165178
<voice>
166179
<TimeSig>
180+
<eid>U_U</eid>
167181
<sigN>4</sigN>
168182
<sigD>4</sigD>
169183
</TimeSig>
170184
<Chord>
185+
<eid>V_V</eid>
171186
<durationType>quarter</durationType>
172187
<Note>
188+
<eid>W_W</eid>
173189
<pitch>59</pitch>
174190
<tpc>19</tpc>
175191
<velocity>80</velocity>
176-
<veloType>user</veloType>
177192
</Note>
178193
</Chord>
179194
<Rest>
195+
<eid>X_X</eid>
180196
<durationType>quarter</durationType>
181197
</Rest>
182198
<Rest>
199+
<eid>Y_Y</eid>
183200
<durationType>half</durationType>
184201
</Rest>
185202
</voice>
186203
</Measure>
187204
<Measure>
188205
<voice>
189206
<Rest>
207+
<eid>Z_Z</eid>
190208
<durationType>measure</durationType>
191209
<duration>4/4</duration>
192210
</Rest>

src/importexport/midi/tests/midiimport_data/m2.mscx renamed to src/importexport/midi/tests/midiimport_data/m2-ref.mscx

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<museScore version="4.00">
2+
<museScore version="4.60">
33
<Score>
4+
<eid>B_B</eid>
45
<Division>480</Division>
56
<Style>
6-
<Spatium>1.74978</Spatium>
7+
<spatium>1.74978</spatium>
78
</Style>
89
<showInvisible>1</showInvisible>
910
<showUnprintable>1</showUnprintable>
@@ -19,15 +20,17 @@
1920
<metaTag name="translator"></metaTag>
2021
<metaTag name="workNumber"></metaTag>
2122
<metaTag name="workTitle"></metaTag>
22-
<Part>
23-
<Staff id="1">
23+
<Part id="1">
24+
<Staff>
25+
<eid>C_C</eid>
2426
<StaffType group="pitched">
2527
<name>stdNormal</name>
2628
</StaffType>
2729
<bracket type="1" span="2" col="0" visible="1"/>
2830
<barLineSpan>1</barLineSpan>
2931
</Staff>
30-
<Staff id="2">
32+
<Staff>
33+
<eid>D_D</eid>
3134
<StaffType group="pitched">
3235
<name>stdNormal</name>
3336
</StaffType>
@@ -91,43 +94,51 @@
9194
</Part>
9295
<Staff id="1">
9396
<Measure>
97+
<eid>E_E</eid>
9498
<voice>
9599
<TimeSig>
100+
<eid>F_F</eid>
96101
<sigN>4</sigN>
97102
<sigD>4</sigD>
98103
</TimeSig>
99104
<Chord>
105+
<eid>G_G</eid>
100106
<durationType>quarter</durationType>
101107
<Note>
108+
<eid>H_H</eid>
102109
<pitch>67</pitch>
103110
<tpc>15</tpc>
104111
<velocity>80</velocity>
105-
<veloType>user</veloType>
106112
</Note>
107113
</Chord>
108114
<Chord>
115+
<eid>I_I</eid>
109116
<durationType>quarter</durationType>
110117
<Note>
118+
<eid>J_J</eid>
111119
<pitch>69</pitch>
112120
<tpc>17</tpc>
113121
<velocity>80</velocity>
114-
<veloType>user</veloType>
115122
</Note>
116123
</Chord>
117124
<Chord>
125+
<eid>K_K</eid>
118126
<durationType>quarter</durationType>
119127
<Note>
128+
<eid>L_L</eid>
120129
<pitch>71</pitch>
121130
<tpc>19</tpc>
122131
<velocity>80</velocity>
123-
<veloType>user</veloType>
124132
</Note>
125133
</Chord>
126134
<Chord>
135+
<eid>M_M</eid>
127136
<durationType>quarter</durationType>
128137
<Note>
138+
<eid>N_N</eid>
129139
<Spanner type="Tie">
130140
<Tie>
141+
<eid>O_O</eid>
131142
</Tie>
132143
<next>
133144
<location>
@@ -139,16 +150,18 @@
139150
<pitch>72</pitch>
140151
<tpc>14</tpc>
141152
<velocity>80</velocity>
142-
<veloType>user</veloType>
143153
</Note>
144154
</Chord>
145155
</voice>
146156
</Measure>
147157
<Measure>
158+
<eid>P_P</eid>
148159
<voice>
149160
<Chord>
161+
<eid>Q_Q</eid>
150162
<durationType>quarter</durationType>
151163
<Note>
164+
<eid>R_R</eid>
152165
<Spanner type="Tie">
153166
<prev>
154167
<location>
@@ -160,19 +173,20 @@
160173
<pitch>72</pitch>
161174
<tpc>14</tpc>
162175
<velocity>80</velocity>
163-
<veloType>user</veloType>
164176
</Note>
165177
</Chord>
166178
<Chord>
179+
<eid>S_S</eid>
167180
<durationType>quarter</durationType>
168181
<Note>
182+
<eid>T_T</eid>
169183
<pitch>72</pitch>
170184
<tpc>14</tpc>
171185
<velocity>80</velocity>
172-
<veloType>user</veloType>
173186
</Note>
174187
</Chord>
175188
<Rest>
189+
<eid>U_U</eid>
176190
<durationType>half</durationType>
177191
</Rest>
178192
</voice>
@@ -182,29 +196,34 @@
182196
<Measure>
183197
<voice>
184198
<TimeSig>
199+
<eid>V_V</eid>
185200
<sigN>4</sigN>
186201
<sigD>4</sigD>
187202
</TimeSig>
188203
<Chord>
204+
<eid>W_W</eid>
189205
<durationType>quarter</durationType>
190206
<Note>
207+
<eid>X_X</eid>
191208
<pitch>59</pitch>
192209
<tpc>19</tpc>
193210
<velocity>80</velocity>
194-
<veloType>user</veloType>
195211
</Note>
196212
</Chord>
197213
<Rest>
214+
<eid>Y_Y</eid>
198215
<durationType>quarter</durationType>
199216
</Rest>
200217
<Rest>
218+
<eid>Z_Z</eid>
201219
<durationType>half</durationType>
202220
</Rest>
203221
</voice>
204222
</Measure>
205223
<Measure>
206224
<voice>
207225
<Rest>
226+
<eid>a_a</eid>
208227
<durationType>measure</durationType>
209228
<duration>4/4</duration>
210229
</Rest>

0 commit comments

Comments
 (0)