Add test for a non-ascii password.

This commit is contained in:
Felix Geyer 2012-05-10 21:29:10 +02:00
parent cf4e574c50
commit 2ecd11eb35
4 changed files with 20 additions and 0 deletions

View File

@ -196,6 +196,24 @@ void TestKeePass1Reader::testTwofish()
delete db;
}
void TestKeePass1Reader::testCP1252Password()
{
QString name = "CP-1252";
KeePass1Reader reader;
QString dbFilename = QString("%1/%2.kdb").arg(QString(KEEPASSX_TEST_DATA_DIR), name);
QString password = QString::fromUtf8("\xe2\x80\x9e\x70\x61\x73\x73\x77\x6f\x72\x64\xe2\x80\x9d");
Database* db = reader.readDatabase(dbFilename, password, QByteArray());
QVERIFY(db);
QVERIFY(!reader.hasError());
QCOMPARE(db->rootGroup()->children().size(), 1);
QCOMPARE(db->rootGroup()->children().at(0)->name(), name);
delete db;
}
void TestKeePass1Reader::cleanupTestCase()
{
delete m_db;

View File

@ -36,6 +36,7 @@ private Q_SLOTS:
void testFileKey_data();
void testCompositeKey();
void testTwofish();
void testCP1252Password();
void cleanupTestCase();
private:

BIN
tests/data/CP-1252.kdb Normal file

Binary file not shown.

View File

@ -0,0 +1 @@
„password”