Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keepassxreboot/keepassxc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFelix Geyer <debfx@fobos.de>2012-05-10 23:29:10 +0400
committerFelix Geyer <debfx@fobos.de>2012-05-10 23:29:10 +0400
commit2ecd11eb355e6a79b3f5af292cea66e2eabc0b63 (patch)
tree589c57fca5d7b940653ab073248f7d56059494fe /tests
parentcf4e574c50b6cddf10ee40f6b7a1626cc8518a12 (diff)
Add test for a non-ascii password.
Diffstat (limited to 'tests')
-rw-r--r--tests/TestKeePass1Reader.cpp18
-rw-r--r--tests/TestKeePass1Reader.h1
-rw-r--r--tests/data/CP-1252.kdbbin0 -> 620 bytes
-rw-r--r--tests/data/CP-1252.kdb.key1
4 files changed, 20 insertions, 0 deletions
diff --git a/tests/TestKeePass1Reader.cpp b/tests/TestKeePass1Reader.cpp
index ea4a7d64a..2a2ca6eb3 100644
--- a/tests/TestKeePass1Reader.cpp
+++ b/tests/TestKeePass1Reader.cpp
@@ -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;
diff --git a/tests/TestKeePass1Reader.h b/tests/TestKeePass1Reader.h
index fe1c435fd..d9b1deb3d 100644
--- a/tests/TestKeePass1Reader.h
+++ b/tests/TestKeePass1Reader.h
@@ -36,6 +36,7 @@ private Q_SLOTS:
void testFileKey_data();
void testCompositeKey();
void testTwofish();
+ void testCP1252Password();
void cleanupTestCase();
private:
diff --git a/tests/data/CP-1252.kdb b/tests/data/CP-1252.kdb
new file mode 100644
index 000000000..707bc458e
--- /dev/null
+++ b/tests/data/CP-1252.kdb
Binary files differ
diff --git a/tests/data/CP-1252.kdb.key b/tests/data/CP-1252.kdb.key
new file mode 100644
index 000000000..b51896a1e
--- /dev/null
+++ b/tests/data/CP-1252.kdb.key
@@ -0,0 +1 @@
+„password” \ No newline at end of file