diff 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
line wrap: on
line diff
--- a/data/fileio/test/EncodingTest.h	Wed May 01 21:39:37 2019 +0100
+++ b/data/fileio/test/EncodingTest.h	Fri May 03 13:44:45 2019 +0100
@@ -22,6 +22,8 @@
 #include "../AudioFileReader.h"
 #include "../WavFileWriter.h"
 
+#include "UnsupportedFormat.h"
+
 #include <cmath>
 
 #include <QObject>
@@ -132,13 +134,18 @@
         
         QFETCH(QString, audiofile);
 
+        QStringList fileAndExt = audiofile.split(".");
+        QString extension = fileAndExt[1];
+
         if (!AudioFileReaderFactory::isSupported(encodingDir + "/" +
                                                  audiofile)) {
+            if (isLegitimatelyUnsupported(extension)) {
 #if ( QT_VERSION >= 0x050000 )
-            QSKIP("Known unsupported file, skipping");
+                QSKIP("Known unsupported file, skipping");
 #else
-            QSKIP("Known unsupported file, skipping", SkipSingle);
+                QSKIP("Known unsupported file, skipping", SkipSingle);
 #endif
+            }
         }            
         
         AudioFileReaderFactory::Parameters params;
@@ -163,22 +170,26 @@
         
         QFETCH(QString, audiofile);
 
+        QStringList fileAndExt = audiofile.split(".");
+        QString file = fileAndExt[0];
+        QString extension = fileAndExt[1];
+
         AudioFileReaderFactory::Parameters params;
         AudioFileReader *reader =
             AudioFileReaderFactory::createReader
             (encodingDir + "/" + audiofile, params);
 
         if (!reader) {
+            if (isLegitimatelyUnsupported(extension)) {
 #if ( QT_VERSION >= 0x050000 )
-            QSKIP("Unsupported file, skipping");
+                QSKIP("Unsupported file, skipping");
 #else
-            QSKIP("Unsupported file, skipping", SkipSingle);
+                QSKIP("Unsupported file, skipping", SkipSingle);
 #endif
+            }
         }
 
-        QStringList fileAndExt = audiofile.split(".");
-        QString file = fileAndExt[0];
-        QString extension = fileAndExt[1];
+        QVERIFY(reader != nullptr);
 
         if (extension == "wav") {
 
@@ -188,12 +199,6 @@
 
         } else {
 
-//#if (!defined (HAVE_OGGZ) || !defined(HAVE_FISHSOUND))
-//            if (extension == "ogg") {
-//                QSKIP("Lack native Ogg Vorbis reader, so won't be getting metadata");
-//            }
-//#endif
-            
             auto blah = reader->getInterleavedFrames(0, 10);
             
             QString title = reader->getTitle();
@@ -261,25 +266,23 @@
             return;
         }
 
-//#if (!defined (HAVE_OGGZ) || !defined(HAVE_FISHSOUND))
-//        if (extension == "ogg") {
-//            QSKIP("Lack native Ogg Vorbis reader, so won't be getting metadata");
-//        }
-//#endif
-
         AudioFileReaderFactory::Parameters params;
         AudioFileReader *reader =
             AudioFileReaderFactory::createReader
             (encodingDir + "/" + audiofile, params);
         
         if (!reader) {
+            if (isLegitimatelyUnsupported(extension)) {
 #if ( QT_VERSION >= 0x050000 )
-            QSKIP("Unsupported file, skipping");
+                QSKIP("Unsupported file, skipping");
 #else
-            QSKIP("Unsupported file, skipping", SkipSingle);
+                QSKIP("Unsupported file, skipping", SkipSingle);
 #endif
+            }
         }
 
+        QVERIFY(reader != nullptr);
+
         QString title = reader->getTitle();
         QVERIFY(title != QString());