comparison data/fileio/test/EncodingTest.h @ 1596:81989085997b bqaudiostream

Argh, that fix for Mac broke Win
author Chris Cannam
date Tue, 22 Jan 2019 20:07:46 +0000
parents afa75922fe0f
children ae9849c0815f
comparison
equal deleted inserted replaced
1595:c9c8c49b22d6 1596:81989085997b
77 encodingDir = base + "/encodings"; 77 encodingDir = base + "/encodings";
78 outDir = base + "/outfiles"; 78 outDir = base + "/outfiles";
79 } 79 }
80 80
81 private: 81 private:
82 const char *strOf(QString s) {
83 return strdup(s.toLocal8Bit().data());
84 }
85
82 void addAudioFiles() { 86 void addAudioFiles() {
83 QTest::addColumn<QString>("audiofile"); 87 QTest::addColumn<QString>("audiofile");
84 for (int i = 0; i < testFileCount; ++i) { 88 #ifndef Q_OS_MAC
85 std::string s = testFiles[i][0]; 89 // The normal case - populate the file list from the files
86 s += "."; 90 // actually present in the encodings directory
87 s += testFiles[i][1]; 91 QStringList files = QDir(encodingDir).entryList(QDir::Files);
88 QTest::newRow(strdup(s.c_str())) << QString::fromStdString(s); 92 foreach (QString filename, files) {
89 } 93 QTest::newRow(strOf(filename)) << filename;
94 }
95 #else
96 // Deviant case for Mac - populate the file list from the
97 // hard-coded list of expected files in testFiles. This is
98 // because QDir::entryList is currently broken on APFS (as of
99 // Qt 5.12) because of variant Unicode normalisations.
100 for (int i = 0; i < testFileCount; ++i) {
101 std::string s = testFiles[i][0];
102 s += ".";
103 s += testFiles[i][1];
104 QTest::newRow(strdup(s.c_str())) << QString::fromStdString(s);
105 }
106 #endif
90 } 107 }
91 108
92 private slots: 109 private slots:
93 void init() 110 void init()
94 { 111 {