# HG changeset patch # User Chris Cannam # Date 1548187666 0 # Node ID 81989085997b4e8eef06408511a5d8300c35e062 # Parent c9c8c49b22d615f990f7b28058bc0e57ef474eba Argh, that fix for Mac broke Win diff -r c9c8c49b22d6 -r 81989085997b data/fileio/test/EncodingTest.h --- 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("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("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: