| 229 | } |
| 230 | |
| 231 | void TestJlCompress::compressDir() |
| 232 | { |
| 233 | QFETCH(QString, zipName); |
| 234 | QFETCH(QStringList, fileNames); |
| 235 | QFETCH(QStringList, expected); |
| 236 | QDir curDir; |
| 237 | if (curDir.exists(zipName)) { |
| 238 | if (!curDir.remove(zipName)) |
| 239 | QFAIL("Can't remove zip file"); |
| 240 | } |
| 241 | if (!createTestFiles(fileNames, -1, "compressDir_tmp")) { |
| 242 | QFAIL("Can't create test files"); |
| 243 | } |
| 244 | #ifdef Q_OS_WIN |
| 245 | for (int i = 0; i < fileNames.size(); ++i) { |
| 246 | if (fileNames.at(i).startsWith(".")) { |
| 247 | QString fn = "compressDir_tmp\\" + fileNames.at(i); |
| 248 | SetFileAttributesW(reinterpret_cast<LPCWSTR>(fn.utf16()), |
| 249 | FILE_ATTRIBUTE_HIDDEN); |
| 250 | } |
| 251 | } |
| 252 | #endif |
| 253 | QVERIFY(JlCompress::compressDir(zipName, "compressDir_tmp", true, QDir::Hidden)); |
| 254 | // get the file list and check it |
| 255 | QStringList fileList = JlCompress::getFileList(zipName); |
| 256 | fileList.sort(); |
| 257 | expected.sort(); |
| 258 | QCOMPARE(fileList, expected); |
| 259 | removeTestFiles(fileNames, "compressDir_tmp"); |
| 260 | curDir.remove(zipName); |
| 261 | } |
| 262 | |
| 263 | void TestJlCompress::compressDirOptions_data() |
| 264 | { |
nothing calls this directly
no test coverage detected