Test with a wrong password
This commit is contained in:
parent
5ecd259ce8
commit
f0cd027a02
1 changed files with 12 additions and 0 deletions
|
@ -135,6 +135,18 @@ void TestQuaZipFile::zipUnzip()
|
|||
QCOMPARE(archivedData, originalData);
|
||||
testUnzip.goToNextFile();
|
||||
}
|
||||
if (!password.isEmpty()) {
|
||||
QVERIFY(testUnzip.goToFirstFile());
|
||||
QuaZipFileInfo64 info;
|
||||
QVERIFY(testUnzip.getCurrentFileInfo(&info));
|
||||
QFile original("tmp/" + info.name);
|
||||
QVERIFY(original.open(QIODevice::ReadOnly));
|
||||
QuaZipFile archived(&testUnzip);
|
||||
QVERIFY(archived.open(QIODevice::ReadOnly, "WrongPassword"));
|
||||
QByteArray originalData = original.readAll();
|
||||
QByteArray archivedData = archived.readAll();
|
||||
QVERIFY(archivedData != originalData);
|
||||
}
|
||||
testUnzip.close();
|
||||
QCOMPARE(testUnzip.getZipError(), UNZ_OK);
|
||||
// clean up
|
||||
|
|
Loading…
Reference in a new issue