changeset 1593:d3f068153546 bqaudiostream

QDir::entryList on Mac ignores all of our files with non-ASCII filenames, I think because of variant normalisations (https://bugreports.qt.io/browse/QTBUG-70732). Hard code the file list instead.
author Chris Cannam
date Mon, 21 Jan 2019 15:49:04 +0000
parents f8e3dcbafb4d
children afa75922fe0f
files data/fileio/test/EncodingTest.h
diffstat 1 files changed, 18 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/data/fileio/test/EncodingTest.h	Mon Jan 21 13:16:17 2019 +0000
+++ b/data/fileio/test/EncodingTest.h	Mon Jan 21 15:49:04 2019 +0000
@@ -46,6 +46,18 @@
 };
 static const int mappingCount = 4;
 
+static const char *testFiles[][2] = {
+    { "id3v2-iso-8859-1", "mp3" },
+    { "id3v2-ucs-2", "mp3" },
+    { utf8_name_tsprk, "flac" },
+    { utf8_name_tsprk, "m4a" },
+    { utf8_name_tsprk, "mp3" },
+    { utf8_name_tsprk, "ogg" },
+    { utf8_name_sprkt, "mp3" },
+    { utf8_name_sprkt, "ogg" },
+};
+static const int testFileCount = 8;
+
 class EncodingTest : public QObject
 {
     Q_OBJECT
@@ -66,15 +78,13 @@
     }
 
 private:
-    const char *strOf(QString s) {
-        return strdup(s.toLocal8Bit().data());
-    }
-
     void addAudioFiles() {
         QTest::addColumn<QString>("audiofile");
-        QStringList files = QDir(encodingDir).entryList(QDir::Files);
-        foreach (QString filename, files) {
-            QTest::newRow(strOf(filename)) << filename;
+        for (int i = 0; i < testFileCount; ++i) {
+            std::string s = testFiles[i][0];
+            s += ".";
+            s += testFiles[i][1];
+            QTest::newRow(strdup(s.c_str())) << QString::fromStdString(s);
         }
     }
 
@@ -84,7 +94,7 @@
         if (!QDir(encodingDir).exists()) {
             SVCERR << "ERROR: Audio encoding file directory \"" << encodingDir << "\" does not exist" << endl;
             QVERIFY2(QDir(encodingDir).exists(), "Audio encoding file directory not found");
-        }
+         }
         if (!QDir(outDir).exists() && !QDir().mkpath(outDir)) {
             SVCERR << "ERROR: Audio out directory \"" << outDir << "\" does not exist and could not be created" << endl;
             QVERIFY2(QDir(outDir).exists(), "Audio out directory not found and could not be created");