comparison data/fileio/test/AudioFileReaderTest.h @ 1698:dbd13eb7dad1

Add tests for audio file readers presented with empty or nonsense input
author Chris Cannam
date Fri, 03 May 2019 13:33:53 +0100
parents 6d9881e59cc2
children c1208b211d8c
comparison
equal deleted inserted replaced
1690:ea1aa24ebf89 1698:dbd13eb7dad1
19 #include "../AudioFileReaderFactory.h" 19 #include "../AudioFileReaderFactory.h"
20 #include "../AudioFileReader.h" 20 #include "../AudioFileReader.h"
21 #include "../WavFileWriter.h" 21 #include "../WavFileWriter.h"
22 22
23 #include "AudioTestData.h" 23 #include "AudioTestData.h"
24 #include "UnsupportedFormat.h"
24 25
25 #include <cmath> 26 #include <cmath>
26 27
27 #include <QObject> 28 #include <QObject>
28 #include <QtTest> 29 #include <QtTest>
71 bitdepth = 16; 72 bitdepth = 16;
72 if (bits.length() > 2) { 73 if (bits.length() > 2) {
73 bitdepth = bits[2].toInt(); 74 bitdepth = bits[2].toInt();
74 } 75 }
75 } 76 }
76 77
77 void getExpectedThresholds(QString format, 78 void getExpectedThresholds(QString format,
78 QString filename, 79 QString filename,
79 bool resampled, 80 bool resampled,
80 bool gapless, 81 bool gapless,
81 bool normalised, 82 bool normalised,
303 AudioFileReader *reader = 304 AudioFileReader *reader =
304 AudioFileReaderFactory::createReader 305 AudioFileReaderFactory::createReader
305 (audioDir + "/" + format + "/" + audiofile, params); 306 (audioDir + "/" + format + "/" + audiofile, params);
306 307
307 if (!reader) { 308 if (!reader) {
309 if (isLegitimatelyUnsupported(format)) {
308 #if ( QT_VERSION >= 0x050000 ) 310 #if ( QT_VERSION >= 0x050000 )
309 QSKIP("Unsupported file, skipping"); 311 QSKIP("Unsupported file, skipping");
310 #else 312 #else
311 QSKIP("Unsupported file, skipping", SkipSingle); 313 QSKIP("Unsupported file, skipping", SkipSingle);
312 #endif 314 #endif
315 }
313 } 316 }
314 317
315 QString extension; 318 QString extension;
316 sv_samplerate_t fileRate; 319 sv_samplerate_t fileRate;
317 int channels; 320 int channels;