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
diff options
context:
space:
mode:
authorChristian Kieschnick <christian.kieschnick@hicknhack-software.com>2018-01-15 20:17:56 +0300
committerJanek Bevendorff <janek@jbev.net>2018-01-23 02:57:01 +0300
commit943dc6cdd603fae915c8f3cb476b8374e908c4a7 (patch)
treed9b6499a80d3b00cd1f98426aa6e4dbb21ce2ced /tests/TestModified.cpp
parent045f157a6384dc68342cc709c9154c52f6ed95dd (diff)
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
Diffstat (limited to 'tests/TestModified.cpp')
-rw-r--r--tests/TestModified.cpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/TestModified.cpp b/tests/TestModified.cpp
index 70a4a4844..9ae28b80c 100644
--- a/tests/TestModified.cpp
+++ b/tests/TestModified.cpp
@@ -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;
}