mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-12-04 15:39:34 +01:00
Handle CustomData element.
This should make support for reading and writing KeePass 2 XML files complete (closes #1).
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user