Handle CustomData element.

This should make support for reading and writing
KeePass 2 XML files complete (closes #1).
This commit is contained in:
Felix Geyer
2010-08-26 00:31:07 +02:00
parent 8df8f69e10
commit 3bf0564436
10 changed files with 65 additions and 67 deletions

View File

@@ -30,7 +30,16 @@
<EntryTemplatesGroupChanged>2010-08-08T17:24:19Z</EntryTemplatesGroupChanged>
<LastSelectedGroup>lmU+9n0aeESKZvcEze+bRg==</LastSelectedGroup>
<LastTopVisibleGroup>lmU+9n0aeESKZvcEze+bRg==</LastTopVisibleGroup>
<CustomData />
<CustomData>
<Item>
<Key>A Sample Test Key</Key>
<Value>valu</Value>
</Item>
<Item>
<Key>custom key</Key>
<Value>blub</Value>
</Item>
</CustomData>
</Meta>
<Root>
<Group>

View File

@@ -40,7 +40,8 @@ class TestParser : public QObject
private Q_SLOTS:
void initTestCase();
void testMetadata();
void testCustomIcon();
void testCustomIcons();
void testCustomData();
void testGroupRoot();
void testGroup1();
void testGroup2();
@@ -97,7 +98,7 @@ void TestParser::testMetadata()
QVERIFY(m_db->metadata()->lastTopVisibleGroup() == m_db->metadata()->lastSelectedGroup());
}
void TestParser::testCustomIcon()
void TestParser::testCustomIcons()
{
QCOMPARE(m_db->metadata()->customIcons().size(), 1);
Uuid uuid = Uuid::fromBase64("++vyI+daLk6omox4a6kQGA==");
@@ -115,6 +116,15 @@ void TestParser::testCustomIcon()
}
}
void TestParser::testCustomData()
{
QHash<QString, QString> customFields = m_db->metadata()->customFields();
QCOMPARE(customFields.size(), 2);
QCOMPARE(customFields.value("A Sample Test Key"), QString("valu"));
QCOMPARE(customFields.value("custom key"), QString("blub"));
}
void TestParser::testGroupRoot()
{
const Group* group = m_db->rootGroup();