Report database read failure reason in tests

This commit is contained in:
angelsl 2017-11-13 03:20:37 +08:00 committed by Jonathan White
parent bef7ba2cfe
commit 564188b0d3
No known key found for this signature in database
GPG key ID: 440FC65F2E0C6E01
2 changed files with 13 additions and 3 deletions

View file

@ -153,12 +153,19 @@ void TestKeys::testCreateAndOpenFileKey()
KeePass2Writer writer;
writer.writeDatabase(&dbBuffer, dbOrg.data());
bool writeSuccess = writer.writeDatabase(&dbBuffer, dbOrg.data());
if (writer.hasError()) {
QFAIL(writer.errorString().toUtf8().constData());
}
QVERIFY(writeSuccess);
dbBuffer.reset();
KeePass2Reader reader;
QScopedPointer<Database> dbRead(reader.readDatabase(&dbBuffer, compositeKey));
if (reader.hasError()) {
QFAIL(reader.errorString().toUtf8().constData());
}
QVERIFY(dbRead);
QVERIFY(!reader.hasError());
QCOMPARE(dbRead->metadata()->name(), dbName);
}