diff options
author | Felix Geyer <debfx@fobos.de> | 2013-04-14 16:21:42 +0400 |
---|---|---|
committer | Felix Geyer <debfx@fobos.de> | 2013-04-30 00:31:49 +0400 |
commit | 61ee763515e9f5356bdd2713b6447409fe3cd655 (patch) | |
tree | 7e352097f69a8e23f676a9b75fad823ffe9e867f /tests/TestEntry.cpp | |
parent | 3658a6538040045ae025e5caada19fae6de25d2d (diff) |
Add Entry::copyDataFrom().
Diffstat (limited to 'tests/TestEntry.cpp')
-rw-r--r-- | tests/TestEntry.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/TestEntry.cpp b/tests/TestEntry.cpp index c7e143fdf..fdba1c81c 100644 --- a/tests/TestEntry.cpp +++ b/tests/TestEntry.cpp @@ -38,5 +38,40 @@ void TestEntry::testHistoryItemDeletion() delete entry; } +void TestEntry::testCopyDataFrom() +{ + Entry* entry = new Entry(); + + entry->setTitle("testtitle"); + entry->attributes()->set("attr1", "abc"); + entry->attributes()->set("attr2", "def"); + + entry->attachments()->set("test", "123"); + entry->attachments()->set("test2", "456"); + + AutoTypeAssociations::Association assoc; + assoc.window = "1"; + assoc.sequence = "2"; + entry->autoTypeAssociations()->add(assoc); + assoc.window = "3"; + assoc.sequence = "4"; + entry->autoTypeAssociations()->add(assoc); + + Entry* entry2 = new Entry(); + entry2->copyDataFrom(entry); + delete entry; + + QCOMPARE(entry2->title(), QString("testtitle")); + QCOMPARE(entry2->attributes()->value("attr1"), QString("abc")); + QCOMPARE(entry2->attributes()->value("attr2"), QString("def")); + + QCOMPARE(entry2->attachments()->keys().size(), 2); + QCOMPARE(entry2->attachments()->value("test"), QByteArray("123")); + QCOMPARE(entry2->attachments()->value("test2"), QByteArray("456")); + + QCOMPARE(entry2->autoTypeAssociations()->size(), 2); + QCOMPARE(entry2->autoTypeAssociations()->get(0).window, QString("1")); + QCOMPARE(entry2->autoTypeAssociations()->get(1).window, QString("3")); +} QTEST_GUILESS_MAIN(TestEntry) |