mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Add icon model tests.
This commit is contained in:
parent
8204f2007a
commit
5a08e4619c
@ -22,15 +22,19 @@
|
|||||||
|
|
||||||
#include "modeltest.h"
|
#include "modeltest.h"
|
||||||
#include "tests.h"
|
#include "tests.h"
|
||||||
|
#include "core/DatabaseIcons.h"
|
||||||
#include "core/Entry.h"
|
#include "core/Entry.h"
|
||||||
#include "core/Group.h"
|
#include "core/Group.h"
|
||||||
|
#include "crypto/Crypto.h"
|
||||||
#include "gui/EntryModel.h"
|
#include "gui/EntryModel.h"
|
||||||
#include "gui/EntryAttachmentsModel.h"
|
#include "gui/EntryAttachmentsModel.h"
|
||||||
#include "gui/EntryAttributesModel.h"
|
#include "gui/EntryAttributesModel.h"
|
||||||
|
#include "gui/IconModels.h"
|
||||||
|
|
||||||
void TestEntryModel::initTestCase()
|
void TestEntryModel::initTestCase()
|
||||||
{
|
{
|
||||||
qRegisterMetaType<QModelIndex>("QModelIndex");
|
qRegisterMetaType<QModelIndex>("QModelIndex");
|
||||||
|
Crypto::init();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestEntryModel::test()
|
void TestEntryModel::test()
|
||||||
@ -184,4 +188,34 @@ void TestEntryModel::testAttributesModel()
|
|||||||
delete model;
|
delete model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TestEntryModel::testDefaultIconModel()
|
||||||
|
{
|
||||||
|
DefaultIconModel* model = new DefaultIconModel(this);
|
||||||
|
ModelTest* modelTest = new ModelTest(model, this);
|
||||||
|
|
||||||
|
QCOMPARE(model->rowCount(), databaseIcons()->iconCount());
|
||||||
|
|
||||||
|
delete modelTest;
|
||||||
|
delete model;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestEntryModel::testCustomIconModel()
|
||||||
|
{
|
||||||
|
CustomIconModel* model = new CustomIconModel(this);
|
||||||
|
ModelTest* modelTest = new ModelTest(model, this);
|
||||||
|
|
||||||
|
QCOMPARE(model->rowCount(), 0);
|
||||||
|
|
||||||
|
QHash<Uuid, QImage> icons;
|
||||||
|
Uuid iconUuid = Uuid::random();
|
||||||
|
QImage icon;
|
||||||
|
icons.insert(iconUuid, icon);
|
||||||
|
|
||||||
|
model->setIcons(icons);
|
||||||
|
QCOMPARE(model->uuidFromIndex(model->index(0, 0)), iconUuid);
|
||||||
|
|
||||||
|
delete modelTest;
|
||||||
|
delete model;
|
||||||
|
}
|
||||||
|
|
||||||
KEEPASSX_QTEST_CORE_MAIN(TestEntryModel)
|
KEEPASSX_QTEST_CORE_MAIN(TestEntryModel)
|
||||||
|
@ -29,6 +29,8 @@ private Q_SLOTS:
|
|||||||
void test();
|
void test();
|
||||||
void testAttachmentsModel();
|
void testAttachmentsModel();
|
||||||
void testAttributesModel();
|
void testAttributesModel();
|
||||||
|
void testDefaultIconModel();
|
||||||
|
void testCustomIconModel();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // KEEPASSX_TESTENTRYMODEL_H
|
#endif // KEEPASSX_TESTENTRYMODEL_H
|
||||||
|
Loading…
Reference in New Issue
Block a user