| 292 | } |
| 293 | |
| 294 | void TestQuaZipDir::operators() |
| 295 | { |
| 296 | QString zipName = "zipDirOperators.zip"; |
| 297 | QStringList fileNames; |
| 298 | fileNames << "dir/test.txt" << "root.txt"; |
| 299 | if (!createTestFiles(fileNames)) { |
| 300 | QFAIL("Couldn't create test files"); |
| 301 | } |
| 302 | if (!createTestArchive(zipName, fileNames)) { |
| 303 | QFAIL("Couldn't create test archive"); |
| 304 | } |
| 305 | removeTestFiles(fileNames); |
| 306 | QuaZip zip(zipName); |
| 307 | QDir curDir; |
| 308 | QVERIFY(zip.open(QuaZip::mdUnzip)); |
| 309 | QuaZipDir dir(&zip, "dir"); |
| 310 | QuaZipDir dir2 = dir; // Copy constructor |
| 311 | QCOMPARE(dir2.path(), QString::fromLatin1("dir")); |
| 312 | dir2.cdUp(); |
| 313 | QCOMPARE(dir2.path(), QString::fromLatin1("")); |
| 314 | QCOMPARE(dir.path(), QString::fromLatin1("dir")); |
| 315 | dir2 = dir; // operator=() |
| 316 | QCOMPARE(dir2.path(), QString::fromLatin1("dir")); |
| 317 | QVERIFY(dir2 == dir); // opertor== |
| 318 | dir.cd("/"); |
| 319 | QCOMPARE(dir[0], QString::fromLatin1("dir/")); |
| 320 | QCOMPARE(dir[1], QString::fromLatin1("root.txt")); |
| 321 | zip.close(); |
| 322 | curDir.remove(zipName); |
| 323 | } |
| 324 | |
| 325 | void TestQuaZipDir::filePath() |
| 326 | { |
nothing calls this directly
no test coverage detected