comparison data/fileio/test/EncodingTest.h @ 1699:ad33d6c10738 single-point

Merge from default branch
author Chris Cannam
date Fri, 03 May 2019 13:44:45 +0100
parents dbd13eb7dad1
children 83cb6e9d769b
comparison
equal deleted inserted replaced
1697:c077a97d055f 1699:ad33d6c10738
19 // test of audio codecs. 19 // test of audio codecs.
20 20
21 #include "../AudioFileReaderFactory.h" 21 #include "../AudioFileReaderFactory.h"
22 #include "../AudioFileReader.h" 22 #include "../AudioFileReader.h"
23 #include "../WavFileWriter.h" 23 #include "../WavFileWriter.h"
24
25 #include "UnsupportedFormat.h"
24 26
25 #include <cmath> 27 #include <cmath>
26 28
27 #include <QObject> 29 #include <QObject>
28 #include <QtTest> 30 #include <QtTest>
130 132
131 // Ensure that we can open all the files 133 // Ensure that we can open all the files
132 134
133 QFETCH(QString, audiofile); 135 QFETCH(QString, audiofile);
134 136
137 QStringList fileAndExt = audiofile.split(".");
138 QString extension = fileAndExt[1];
139
135 if (!AudioFileReaderFactory::isSupported(encodingDir + "/" + 140 if (!AudioFileReaderFactory::isSupported(encodingDir + "/" +
136 audiofile)) { 141 audiofile)) {
142 if (isLegitimatelyUnsupported(extension)) {
137 #if ( QT_VERSION >= 0x050000 ) 143 #if ( QT_VERSION >= 0x050000 )
138 QSKIP("Known unsupported file, skipping"); 144 QSKIP("Known unsupported file, skipping");
139 #else 145 #else
140 QSKIP("Known unsupported file, skipping", SkipSingle); 146 QSKIP("Known unsupported file, skipping", SkipSingle);
141 #endif 147 #endif
148 }
142 } 149 }
143 150
144 AudioFileReaderFactory::Parameters params; 151 AudioFileReaderFactory::Parameters params;
145 AudioFileReader *reader = 152 AudioFileReader *reader =
146 AudioFileReaderFactory::createReader 153 AudioFileReaderFactory::createReader
161 // that the title matches whatever is in our mapping structure 168 // that the title matches whatever is in our mapping structure
162 // defined at the top 169 // defined at the top
163 170
164 QFETCH(QString, audiofile); 171 QFETCH(QString, audiofile);
165 172
173 QStringList fileAndExt = audiofile.split(".");
174 QString file = fileAndExt[0];
175 QString extension = fileAndExt[1];
176
166 AudioFileReaderFactory::Parameters params; 177 AudioFileReaderFactory::Parameters params;
167 AudioFileReader *reader = 178 AudioFileReader *reader =
168 AudioFileReaderFactory::createReader 179 AudioFileReaderFactory::createReader
169 (encodingDir + "/" + audiofile, params); 180 (encodingDir + "/" + audiofile, params);
170 181
171 if (!reader) { 182 if (!reader) {
183 if (isLegitimatelyUnsupported(extension)) {
172 #if ( QT_VERSION >= 0x050000 ) 184 #if ( QT_VERSION >= 0x050000 )
173 QSKIP("Unsupported file, skipping"); 185 QSKIP("Unsupported file, skipping");
174 #else 186 #else
175 QSKIP("Unsupported file, skipping", SkipSingle); 187 QSKIP("Unsupported file, skipping", SkipSingle);
176 #endif 188 #endif
177 } 189 }
178 190 }
179 QStringList fileAndExt = audiofile.split("."); 191
180 QString file = fileAndExt[0]; 192 QVERIFY(reader != nullptr);
181 QString extension = fileAndExt[1];
182 193
183 if (extension == "wav") { 194 if (extension == "wav") {
184 195
185 // Nothing 196 // Nothing
186 197
187 delete reader; 198 delete reader;
188 199
189 } else { 200 } else {
190 201
191 //#if (!defined (HAVE_OGGZ) || !defined(HAVE_FISHSOUND))
192 // if (extension == "ogg") {
193 // QSKIP("Lack native Ogg Vorbis reader, so won't be getting metadata");
194 // }
195 //#endif
196
197 auto blah = reader->getInterleavedFrames(0, 10); 202 auto blah = reader->getInterleavedFrames(0, 10);
198 203
199 QString title = reader->getTitle(); 204 QString title = reader->getTitle();
200 QVERIFY(title != QString()); 205 QVERIFY(title != QString());
201 206
259 264
260 if (extension == "wav") { 265 if (extension == "wav") {
261 return; 266 return;
262 } 267 }
263 268
264 //#if (!defined (HAVE_OGGZ) || !defined(HAVE_FISHSOUND))
265 // if (extension == "ogg") {
266 // QSKIP("Lack native Ogg Vorbis reader, so won't be getting metadata");
267 // }
268 //#endif
269
270 AudioFileReaderFactory::Parameters params; 269 AudioFileReaderFactory::Parameters params;
271 AudioFileReader *reader = 270 AudioFileReader *reader =
272 AudioFileReaderFactory::createReader 271 AudioFileReaderFactory::createReader
273 (encodingDir + "/" + audiofile, params); 272 (encodingDir + "/" + audiofile, params);
274 273
275 if (!reader) { 274 if (!reader) {
275 if (isLegitimatelyUnsupported(extension)) {
276 #if ( QT_VERSION >= 0x050000 ) 276 #if ( QT_VERSION >= 0x050000 )
277 QSKIP("Unsupported file, skipping"); 277 QSKIP("Unsupported file, skipping");
278 #else 278 #else
279 QSKIP("Unsupported file, skipping", SkipSingle); 279 QSKIP("Unsupported file, skipping", SkipSingle);
280 #endif 280 #endif
281 } 281 }
282 }
283
284 QVERIFY(reader != nullptr);
282 285
283 QString title = reader->getTitle(); 286 QString title = reader->getTitle();
284 QVERIFY(title != QString()); 287 QVERIFY(title != QString());
285 288
286 for (int useTemporary = 0; useTemporary <= 1; ++useTemporary) { 289 for (int useTemporary = 0; useTemporary <= 1; ++useTemporary) {