comparison data/model/test/TestSparseModels.h @ 1685:0e9840a381b5 single-point

Update tests for most recent changes
author Chris Cannam
date Wed, 03 Apr 2019 16:19:20 +0100
parents 0d89abd631ac
children d7b04b0ed056
comparison
equal deleted inserted replaced
1684:95396c9382e3 1685:0e9840a381b5
121 QString xml; 121 QString xml;
122 QTextStream str(&xml, QIODevice::WriteOnly); 122 QTextStream str(&xml, QIODevice::WriteOnly);
123 m.toXml(str); 123 m.toXml(str);
124 str.flush(); 124 str.flush();
125 QString expected = 125 QString expected =
126 "<model id='2' name='This &quot;&amp;&quot; that' sampleRate='100' start='20' end='60' type='sparse' dimensions='1' resolution='10' notifyOnAdd='true' dataset='1' />\n" 126 "<model id='1' name='This &quot;&amp;&quot; that' sampleRate='100' start='20' end='60' type='sparse' dimensions='1' resolution='10' notifyOnAdd='true' dataset='0' />\n"
127 "<dataset id='1' dimensions='1'>\n" 127 "<dataset id='0' dimensions='1'>\n"
128 " <point frame='20' />\n" 128 " <point frame='20' label='' />\n"
129 " <point frame='20' label='Label &amp;&apos;&quot;&gt;' />\n" 129 " <point frame='20' label='Label &amp;&apos;&quot;&gt;' />\n"
130 " <point frame='50' />\n" 130 " <point frame='50' label='' />\n"
131 "</dataset>\n"; 131 "</dataset>\n";
132 expected.replace("\'", "\""); 132 expected.replace("\'", "\"");
133 if (xml != expected) { 133 if (xml != expected) {
134 cerr << "Obtained xml:\n" << xml 134 cerr << "Obtained xml:\n" << xml
135 << "\nExpected:\n" << expected << endl; 135 << "\nExpected:\n" << expected << endl;
207 QTextStream str(&xml, QIODevice::WriteOnly); 207 QTextStream str(&xml, QIODevice::WriteOnly);
208 m.toXml(str); 208 m.toXml(str);
209 str.flush(); 209 str.flush();
210 210
211 QString expected = 211 QString expected =
212 "<model id='4' name='' sampleRate='100' start='20' end='80' type='sparse' dimensions='3' resolution='10' notifyOnAdd='true' dataset='3' subtype='note' valueQuantization='0' minimum='123.4' maximum='126.3' units='Hz' />\n" 212 "<model id='3' name='' sampleRate='100' start='20' end='80' type='sparse' dimensions='3' resolution='10' notifyOnAdd='true' dataset='2' subtype='note' valueQuantization='0' minimum='123.4' maximum='126.3' units='Hz' />\n"
213 "<dataset id='3' dimensions='3'>\n" 213 "<dataset id='2' dimensions='3'>\n"
214 " <point frame='20' value='124.3' duration='10' level='0.9' label='note 2' />\n" 214 " <point frame='20' value='124.3' duration='10' level='0.9' label='note 2' />\n"
215 " <point frame='20' value='123.4' duration='20' level='0.8' label='note 1' />\n" 215 " <point frame='20' value='123.4' duration='20' level='0.8' label='note 1' />\n"
216 " <point frame='50' value='126.3' duration='30' level='0.9' label='note 3' />\n" 216 " <point frame='50' value='126.3' duration='30' level='0.9' label='note 3' />\n"
217 "</dataset>\n"; 217 "</dataset>\n";
218 expected.replace("\'", "\""); 218 expected.replace("\'", "\"");
235 QTextStream str(&xml, QIODevice::WriteOnly); 235 QTextStream str(&xml, QIODevice::WriteOnly);
236 m.toXml(str); 236 m.toXml(str);
237 str.flush(); 237 str.flush();
238 238
239 QString expected = 239 QString expected =
240 "<model id='6' name='' sampleRate='100' start='20' end='60' type='sparse' dimensions='2' resolution='10' notifyOnAdd='true' dataset='5' subtype='text' />\n" 240 "<model id='5' name='' sampleRate='100' start='20' end='60' type='sparse' dimensions='2' resolution='10' notifyOnAdd='true' dataset='4' subtype='text' />\n"
241 "<dataset id='5' dimensions='2'>\n" 241 "<dataset id='4' dimensions='2'>\n"
242 " <point frame='20' height='0' label='text 2' />\n" 242 " <point frame='20' height='0' label='text 2' />\n"
243 " <point frame='20' height='1' label='text 1' />\n" 243 " <point frame='20' height='1' label='text 1' />\n"
244 " <point frame='50' height='0.3' label='text 3' />\n" 244 " <point frame='50' height='0.3' label='text 3' />\n"
245 "</dataset>\n"; 245 "</dataset>\n";
246 expected.replace("\'", "\""); 246 expected.replace("\'", "\"");
263 QTextStream str(&xml, QIODevice::WriteOnly); 263 QTextStream str(&xml, QIODevice::WriteOnly);
264 m.toXml(str); 264 m.toXml(str);
265 str.flush(); 265 str.flush();
266 266
267 QString expected = 267 QString expected =
268 "<model id='7' name='' sampleRate='100' start='20' end='60' type='sparse' dimensions='2' resolution='10' notifyOnAdd='true' dataset='7' subtype='path' />\n" 268 "<model id='6' name='' sampleRate='100' start='20' end='60' type='sparse' dimensions='2' resolution='10' notifyOnAdd='true' dataset='6' subtype='path' />\n"
269 "<dataset id='7' dimensions='2'>\n" 269 "<dataset id='6' dimensions='2'>\n"
270 " <point frame='20' mapframe='30' />\n" 270 " <point frame='20' mapframe='30' />\n"
271 " <point frame='40' mapframe='60' />\n" 271 " <point frame='40' mapframe='60' />\n"
272 " <point frame='50' mapframe='49' />\n" 272 " <point frame='50' mapframe='49' />\n"
273 "</dataset>\n"; 273 "</dataset>\n";
274 expected.replace("\'", "\""); 274 expected.replace("\'", "\"");
287 QTextStream str(&xml, QIODevice::WriteOnly); 287 QTextStream str(&xml, QIODevice::WriteOnly);
288 m.toXml(str); 288 m.toXml(str);
289 str.flush(); 289 str.flush();
290 290
291 QString expected = 291 QString expected =
292 "<model id='9' name='' sampleRate='100' start='20' end='30' type='sparse' dimensions='1' resolution='10' notifyOnAdd='true' dataset='8' subtype='image' />\n" 292 "<model id='8' name='' sampleRate='100' start='20' end='30' type='sparse' dimensions='1' resolution='10' notifyOnAdd='true' dataset='7' subtype='image' />\n"
293 "<dataset id='8' dimensions='1'>\n" 293 "<dataset id='7' dimensions='1'>\n"
294 " <point frame='20' label='a label' image='/path/to/thing.png' />\n" 294 " <point frame='20' label='a label' image='/path/to/thing.png' />\n"
295 "</dataset>\n"; 295 "</dataset>\n";
296 expected.replace("\'", "\""); 296 expected.replace("\'", "\"");
297 if (xml != expected) { 297 if (xml != expected) {
298 cerr << "Obtained xml:\n" << xml 298 cerr << "Obtained xml:\n" << xml