diff options
author | Holger Böhnke <holger.boehnke@amarin.de> | 2020-05-22 04:43:00 +0300 |
---|---|---|
committer | Jonathan White <support@dmapps.us> | 2020-05-22 19:13:20 +0300 |
commit | eb198271acd79310b59bdb415167d72971309760 (patch) | |
tree | c742e59ef4411d693730b1a9d2db794d53f646da /tests/TestEntryModel.cpp | |
parent | 43c82ccb09f05c3a14fd6109183e442facc58e97 (diff) |
Add natural sort of entry list
Introduce a third unsorted status that shows entries in the order they occur in the KDBX file.
* Add keyboard shortcut Ctrl+Alt+Up/Down to move entries up and down in sort order
* Add entry context menu icons to achieve movement up/down
* Only show menu icons when in natural sort order
* Add Material Design icons for moving up/down
* Add feature to track non-data changes and force a save on exit to ensure they are not lost when locking a database. This allows users to make entry movements and group expand/collapse operations and not lose that state.
Remove saveas
Diffstat (limited to 'tests/TestEntryModel.cpp')
-rw-r--r-- | tests/TestEntryModel.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/TestEntryModel.cpp b/tests/TestEntryModel.cpp index 6c4b97454..26cb0dfec 100644 --- a/tests/TestEntryModel.cpp +++ b/tests/TestEntryModel.cpp @@ -55,6 +55,9 @@ void TestEntryModel::test() EntryModel* model = new EntryModel(this); + QSignalSpy spyAboutToBeMoved(model, SIGNAL(rowsAboutToBeMoved(QModelIndex, int, int, QModelIndex, int))); + QSignalSpy spyMoved(model, SIGNAL(rowsMoved(QModelIndex, int, int, QModelIndex, int))); + ModelTest* modelTest = new ModelTest(model, this); model->setGroup(group1); @@ -79,6 +82,29 @@ void TestEntryModel::test() Entry* entry3 = new Entry(); entry3->setGroup(group1); + QCOMPARE(spyAboutToBeMoved.count(), 0); + QCOMPARE(spyMoved.count(), 0); + + entry1->moveDown(); + QCOMPARE(spyAboutToBeMoved.count(), 1); + QCOMPARE(spyMoved.count(), 1); + + entry1->moveDown(); + QCOMPARE(spyAboutToBeMoved.count(), 2); + QCOMPARE(spyMoved.count(), 2); + + entry1->moveDown(); + QCOMPARE(spyAboutToBeMoved.count(), 2); + QCOMPARE(spyMoved.count(), 2); + + entry3->moveUp(); + QCOMPARE(spyAboutToBeMoved.count(), 3); + QCOMPARE(spyMoved.count(), 3); + + entry3->moveUp(); + QCOMPARE(spyAboutToBeMoved.count(), 3); + QCOMPARE(spyMoved.count(), 3); + QCOMPARE(spyAboutToAdd.count(), 1); QCOMPARE(spyAdded.count(), 1); QCOMPARE(spyAboutToRemove.count(), 0); |