mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-08-05 04:54:20 -04:00
Add tests for modified, fix history for autotype
Added tests to ensure #1387 works Fixed issue detected during testing - AutoTypeAssociations were not pushed to history
This commit is contained in:
parent
045f157a63
commit
943dc6cdd6
4 changed files with 57 additions and 5 deletions
|
@ -465,5 +465,52 @@ void TestModified::testHistoryItem()
|
|||
entry3->endUpdate();
|
||||
QCOMPARE(entry3->historyItems().size(), 2);
|
||||
|
||||
Entry* entry4 = new Entry();
|
||||
entry4->setGroup(root);
|
||||
QCOMPARE(entry4->historyItems().size(), 0);
|
||||
|
||||
int reservedSize = entry4->attributes()->attributesSize();
|
||||
entry4->beginUpdate();
|
||||
entry4->attachments()->set("test1", QByteArray(17000 - 5 - reservedSize + 1, 'a'));
|
||||
entry4->endUpdate();
|
||||
QCOMPARE(entry4->historyItems().size(), 1);
|
||||
|
||||
entry4->beginUpdate();
|
||||
entry4->attachments()->remove("test1");
|
||||
entry4->endUpdate();
|
||||
QCOMPARE(entry4->historyItems().size(), 0);
|
||||
|
||||
entry4->beginUpdate();
|
||||
entry4->setTags(QByteArray(17000 - reservedSize + 1, 'a'));
|
||||
entry4->endUpdate();
|
||||
QCOMPARE(entry4->historyItems().size(), 1);
|
||||
|
||||
entry4->beginUpdate();
|
||||
entry4->setTags("");
|
||||
entry4->endUpdate();
|
||||
QCOMPARE(entry4->historyItems().size(), 0);
|
||||
|
||||
entry4->beginUpdate();
|
||||
entry4->attributes()->set("test3", QByteArray(17000 - 5 - reservedSize + 1, 'a'));
|
||||
entry4->endUpdate();
|
||||
QCOMPARE(entry4->historyItems().size(), 1);
|
||||
|
||||
entry4->beginUpdate();
|
||||
entry4->attributes()->remove("test3");
|
||||
entry4->endUpdate();
|
||||
QCOMPARE(entry4->historyItems().size(), 0);
|
||||
|
||||
entry4->beginUpdate();
|
||||
AutoTypeAssociations::Association association;
|
||||
association.window = "test3";
|
||||
association.sequence = QByteArray(17000 - 5 - reservedSize + 1, 'a');
|
||||
entry4->autoTypeAssociations()->add(association);
|
||||
entry4->endUpdate();
|
||||
QCOMPARE(entry4->historyItems().size(), 1);
|
||||
|
||||
entry4->beginUpdate();
|
||||
entry4->autoTypeAssociations()->remove(0);
|
||||
entry4->endUpdate();
|
||||
QCOMPARE(entry4->historyItems().size(), 0);
|
||||
delete db;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue