changeset 1596:81989085997b bqaudiostream

Argh, that fix for Mac broke Win
author Chris Cannam
date Tue, 22 Jan 2019 20:07:46 +0000
parents c9c8c49b22d6
children ae9849c0815f
files data/fileio/test/EncodingTest.h
diffstat 1 files changed, 24 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/data/fileio/test/EncodingTest.h	Tue Jan 22 20:07:19 2019 +0000
+++ b/data/fileio/test/EncodingTest.h	Tue Jan 22 20:07:46 2019 +0000
@@ -79,14 +79,31 @@
     }
 
 private:
+    const char *strOf(QString s) {
+        return strdup(s.toLocal8Bit().data());
+    }
+
     void addAudioFiles() {
-        QTest::addColumn<QString>("audiofile");
-        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);
-        }
+         QTest::addColumn<QString>("audiofile");
+#ifndef Q_OS_MAC
+         // The normal case - populate the file list from the files
+         // actually present in the encodings directory
+         QStringList files = QDir(encodingDir).entryList(QDir::Files);
+         foreach (QString filename, files) {
+             QTest::newRow(strOf(filename)) << filename;
+         }
+#else
+         // Deviant case for Mac - populate the file list from the
+         // hard-coded list of expected files in testFiles. This is
+         // because QDir::entryList is currently broken on APFS (as of
+         // Qt 5.12) because of variant Unicode normalisations.
+         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);
+         }
+#endif
     }
 
 private slots: