| 239 | } |
| 240 | |
| 241 | void TestQuaZipFile::atEnd() |
| 242 | { |
| 243 | QFETCH(QString, zipName); |
| 244 | QFETCH(QStringList, fileNames); |
| 245 | QFETCH(int, size); |
| 246 | QDir curDir; |
| 247 | if (!createTestFiles(fileNames, size)) { |
| 248 | QFAIL("Couldn't create test files"); |
| 249 | } |
| 250 | if (!JlCompress::compressDir(zipName, "tmp")) { |
| 251 | QFAIL("Couldn't create test archive"); |
| 252 | } |
| 253 | QuaZip testZip(zipName); |
| 254 | QVERIFY(testZip.open(QuaZip::mdUnzip)); |
| 255 | foreach (QString fileName, fileNames) { |
| 256 | QFileInfo fileInfo("tmp/" + fileName); |
| 257 | QVERIFY(testZip.setCurrentFile(fileName)); |
| 258 | QuaZipFile zipFile(&testZip); |
| 259 | QVERIFY(zipFile.open(QIODevice::ReadOnly)); |
| 260 | QCOMPARE(zipFile.atEnd(), false); |
| 261 | QCOMPARE(zipFile.read(1).size(), 1); |
| 262 | QCOMPARE(zipFile.atEnd(), false); |
| 263 | QCOMPARE(zipFile.read(fileInfo.size() - 1).size(), |
| 264 | static_cast<int>(fileInfo.size() - 1)); |
| 265 | QCOMPARE(zipFile.atEnd(), true); |
| 266 | } |
| 267 | removeTestFiles(fileNames); |
| 268 | testZip.close(); |
| 269 | curDir.remove(zipName); |
| 270 | } |
| 271 | |
| 272 | void TestQuaZipFile::posRead_data() |
| 273 | { |
no test coverage detected