mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-02-22 07:29:52 -05:00
Add TestEntryModel::testDatabaseDelete().
It tests that EntryModel in EntryList mode correctly removes entries from the model when that database of these entries is deleted.
This commit is contained in:
parent
c7593a3047
commit
21a80101ba
@ -311,4 +311,35 @@ void TestEntryModel::testProxyModel()
|
|||||||
delete db;
|
delete db;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TestEntryModel::testDatabaseDelete()
|
||||||
|
{
|
||||||
|
EntryModel* model = new EntryModel(this);
|
||||||
|
ModelTest* modelTest = new ModelTest(model, this);
|
||||||
|
|
||||||
|
Database* db1 = new Database();
|
||||||
|
Group* group1 = new Group();
|
||||||
|
group1->setParent(db1->rootGroup());
|
||||||
|
|
||||||
|
Entry* entry1 = new Entry();
|
||||||
|
entry1->setGroup(group1);
|
||||||
|
|
||||||
|
Database* db2 = new Database();
|
||||||
|
Entry* entry2 = new Entry();
|
||||||
|
entry2->setGroup(db2->rootGroup());
|
||||||
|
|
||||||
|
model->setEntryList(QList<Entry*>() << entry1 << entry2);
|
||||||
|
|
||||||
|
QCOMPARE(model->rowCount(), 2);
|
||||||
|
|
||||||
|
delete db1;
|
||||||
|
QCOMPARE(model->rowCount(), 1);
|
||||||
|
|
||||||
|
delete entry2;
|
||||||
|
QCOMPARE(model->rowCount(), 0);
|
||||||
|
|
||||||
|
delete db2;
|
||||||
|
delete modelTest;
|
||||||
|
delete model;
|
||||||
|
}
|
||||||
|
|
||||||
QTEST_GUILESS_MAIN(TestEntryModel)
|
QTEST_GUILESS_MAIN(TestEntryModel)
|
||||||
|
@ -33,6 +33,7 @@ private Q_SLOTS:
|
|||||||
void testCustomIconModel();
|
void testCustomIconModel();
|
||||||
void testAutoTypeAssociationsModel();
|
void testAutoTypeAssociationsModel();
|
||||||
void testProxyModel();
|
void testProxyModel();
|
||||||
|
void testDatabaseDelete();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // KEEPASSX_TESTENTRYMODEL_H
|
#endif // KEEPASSX_TESTENTRYMODEL_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user