| 174 | } |
| 175 | |
| 176 | void TestQuaZip::setFileNameCodec() |
| 177 | { |
| 178 | QFETCH(QString, zipName); |
| 179 | QFETCH(QStringList, fileNames); |
| 180 | QFETCH(QByteArray, encoding); |
| 181 | fileNames.sort(); |
| 182 | QDir curDir; |
| 183 | if (curDir.exists(zipName)) { |
| 184 | if (!curDir.remove(zipName)) |
| 185 | QFAIL("Can't remove zip file"); |
| 186 | } |
| 187 | if (!createTestFiles(fileNames)) { |
| 188 | QFAIL("Can't create test file"); |
| 189 | } |
| 190 | if (!createTestArchive(zipName, fileNames, |
| 191 | QTextCodec::codecForName(encoding))) { |
| 192 | QFAIL("Can't create test archive"); |
| 193 | } |
| 194 | QuaZip testZip(zipName); |
| 195 | QVERIFY(testZip.open(QuaZip::mdUnzip)); |
| 196 | QStringList fileList = testZip.getFileNameList(); |
| 197 | fileList.sort(); |
| 198 | QVERIFY(fileList[0] != fileNames[0]); |
| 199 | testZip.close(); |
| 200 | testZip.setFileNameCodec(encoding); |
| 201 | QVERIFY(testZip.open(QuaZip::mdUnzip)); |
| 202 | fileList = testZip.getFileNameList(); |
| 203 | fileList.sort(); |
| 204 | QCOMPARE(fileList, fileNames); |
| 205 | testZip.close(); |
| 206 | // clean up |
| 207 | removeTestFiles(fileNames); |
| 208 | curDir.remove(zipName); |
| 209 | } |
| 210 | |
| 211 | void TestQuaZip::setOsCode_data() |
| 212 | { |
no test coverage detected