#include <Libs/Core/ctkModelTester.h>
|
void | onColumnsAboutToBeInserted (const QModelIndex &parent, int start, int end) |
|
void | onColumnsAboutToBeRemoved (const QModelIndex &parent, int start, int end) |
|
void | onColumnsInserted (const QModelIndex &parent, int start, int end) |
|
void | onColumnsRemoved (const QModelIndex &parent, int start, int end) |
|
void | onDataChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight) |
|
void | onHeaderDataChanged (Qt::Orientation orientation, int first, int last) |
|
void | onLayoutAboutToBeChanged () |
|
void | onLayoutChanged () |
|
void | onModelAboutToBeReset () |
|
void | onModelReset () |
|
void | onRowsAboutToBeInserted (const QModelIndex &parent, int start, int end) |
|
void | onRowsAboutToBeRemoved (const QModelIndex &parent, int start, int end) |
|
void | onRowsInserted (const QModelIndex &parent, int start, int end) |
|
void | onRowsRemoved (const QModelIndex &parent, int start, int end) |
|
|
virtual void | onItemsAboutToBeInserted (const QModelIndex &parent, Qt::Orientation, int start, int end) |
|
virtual void | onItemsAboutToBeRemoved (const QModelIndex &parent, Qt::Orientation, int start, int end) |
|
virtual void | onItemsInserted (const QModelIndex &parent, Qt::Orientation, int start, int end) |
|
virtual void | onItemsRemoved (const QModelIndex &parent, Qt::Orientation, int start, int end) |
|
QList< QPersistentModelIndex > | persistentModelIndexes (const QModelIndex &index) const |
| Create a list of persistent index of all the index's children. More...
|
|
virtual void | test (bool result, const QString &errorString) const |
| Utility function that process the result of a test. More...
|
|
|
QScopedPointer< ctkModelTesterPrivate > | d_ptr |
|
ctkModelTester is a tool that tests any QAbstractItemModel Most of the signals fired by the model set (ctkModelTester::setModel()) are connected to the tester that check their consistency with the model contents. ctkModelTester is typically used when developing a new QAbstractItemModel or during unit tests.
Definition at line 44 of file ctkModelTester.h.
◆ ctkModelTester() [1/2]
ctkModelTester::ctkModelTester |
( |
QObject * |
parent = 0 | ) |
|
|
explicit |
Constructor No model is set by default. To be tested, a model must be set using setModel(...)
◆ ctkModelTester() [2/2]
ctkModelTester::ctkModelTester |
( |
QAbstractItemModel * |
model, |
|
|
QObject * |
parent = 0 |
|
) |
| |
Constructor that set the model to test. A new model can later be set using setModel(...) by default, throwOnError is true, nestedInsert is false, testDataEnabled is true, verbose is true.
◆ ~ctkModelTester()
virtual ctkModelTester::~ctkModelTester |
( |
| ) |
|
|
virtual |
◆ model()
QAbstractItemModel* ctkModelTester::model |
( |
| ) |
const |
◆ nestedInserts()
bool ctkModelTester::nestedInserts |
( |
| ) |
const |
◆ onColumnsAboutToBeInserted
void ctkModelTester::onColumnsAboutToBeInserted |
( |
const QModelIndex & |
parent, |
|
|
int |
start, |
|
|
int |
end |
|
) |
| |
|
protectedslot |
◆ onColumnsAboutToBeRemoved
void ctkModelTester::onColumnsAboutToBeRemoved |
( |
const QModelIndex & |
parent, |
|
|
int |
start, |
|
|
int |
end |
|
) |
| |
|
protectedslot |
◆ onColumnsInserted
void ctkModelTester::onColumnsInserted |
( |
const QModelIndex & |
parent, |
|
|
int |
start, |
|
|
int |
end |
|
) |
| |
|
protectedslot |
◆ onColumnsRemoved
void ctkModelTester::onColumnsRemoved |
( |
const QModelIndex & |
parent, |
|
|
int |
start, |
|
|
int |
end |
|
) |
| |
|
protectedslot |
◆ onDataChanged
void ctkModelTester::onDataChanged |
( |
const QModelIndex & |
topLeft, |
|
|
const QModelIndex & |
bottomRight |
|
) |
| |
|
protectedslot |
◆ onHeaderDataChanged
void ctkModelTester::onHeaderDataChanged |
( |
Qt::Orientation |
orientation, |
|
|
int |
first, |
|
|
int |
last |
|
) |
| |
|
protectedslot |
◆ onItemsAboutToBeInserted()
virtual void ctkModelTester::onItemsAboutToBeInserted |
( |
const QModelIndex & |
parent, |
|
|
Qt::Orientation |
, |
|
|
int |
start, |
|
|
int |
end |
|
) |
| |
|
protectedvirtual |
The logic of onColumnsAboutToBeInserted and onRowsAboutToBeInserted is gathered in onItemsAboutToBeInserted
◆ onItemsAboutToBeRemoved()
virtual void ctkModelTester::onItemsAboutToBeRemoved |
( |
const QModelIndex & |
parent, |
|
|
Qt::Orientation |
, |
|
|
int |
start, |
|
|
int |
end |
|
) |
| |
|
protectedvirtual |
The logic of onColumnsAboutToBeRemoved and onRowsAboutToBeRemoved is gathered in onItemsAboutToBeRemoved
◆ onItemsInserted()
virtual void ctkModelTester::onItemsInserted |
( |
const QModelIndex & |
parent, |
|
|
Qt::Orientation |
, |
|
|
int |
start, |
|
|
int |
end |
|
) |
| |
|
protectedvirtual |
The logic of onColumnsInserted and onRowsInserted is gathered in onItemsInserted
◆ onItemsRemoved()
virtual void ctkModelTester::onItemsRemoved |
( |
const QModelIndex & |
parent, |
|
|
Qt::Orientation |
, |
|
|
int |
start, |
|
|
int |
end |
|
) |
| |
|
protectedvirtual |
The logic of onColumnsRemoved and onRowsRemoved is gathered in onItemsRemoved
◆ onLayoutAboutToBeChanged
void ctkModelTester::onLayoutAboutToBeChanged |
( |
| ) |
|
|
protectedslot |
◆ onLayoutChanged
void ctkModelTester::onLayoutChanged |
( |
| ) |
|
|
protectedslot |
◆ onModelAboutToBeReset
void ctkModelTester::onModelAboutToBeReset |
( |
| ) |
|
|
protectedslot |
◆ onModelReset
void ctkModelTester::onModelReset |
( |
| ) |
|
|
protectedslot |
◆ onRowsAboutToBeInserted
void ctkModelTester::onRowsAboutToBeInserted |
( |
const QModelIndex & |
parent, |
|
|
int |
start, |
|
|
int |
end |
|
) |
| |
|
protectedslot |
◆ onRowsAboutToBeRemoved
void ctkModelTester::onRowsAboutToBeRemoved |
( |
const QModelIndex & |
parent, |
|
|
int |
start, |
|
|
int |
end |
|
) |
| |
|
protectedslot |
◆ onRowsInserted
void ctkModelTester::onRowsInserted |
( |
const QModelIndex & |
parent, |
|
|
int |
start, |
|
|
int |
end |
|
) |
| |
|
protectedslot |
◆ onRowsRemoved
void ctkModelTester::onRowsRemoved |
( |
const QModelIndex & |
parent, |
|
|
int |
start, |
|
|
int |
end |
|
) |
| |
|
protectedslot |
◆ persistentModelIndexes()
QList<QPersistentModelIndex> ctkModelTester::persistentModelIndexes |
( |
const QModelIndex & |
index | ) |
const |
|
protected |
Create a list of persistent index of all the index's children.
◆ setModel()
void ctkModelTester::setModel |
( |
QAbstractItemModel * |
model | ) |
|
Set the model to be tested, the model must remain valid during the life ctkModelTester.
◆ setNestedInserts()
void ctkModelTester::setNestedInserts |
( |
bool |
enable | ) |
|
nestedInserts controls wether the model is allowed to make nested row/column insertions ( an insertion signal is fired when an insertion a previous insertion was not finished). A row insertion consists of 2 signals: rowsAboutToBeInserted and rowsInserted It also applies for row/column suppressions.
◆ setTestDataEnabled()
void ctkModelTester::setTestDataEnabled |
( |
bool |
enable | ) |
|
When TestData is enabled, it checks if the display role of a valid model index is valid too. You can disable the test if you are ok with temporary invalid display roles.
◆ setThrowOnError()
void ctkModelTester::setThrowOnError |
( |
bool |
throwException | ) |
|
Throw an exception when an error is found in the model. True by default
◆ setVerbose()
void ctkModelTester::setVerbose |
( |
bool |
enable | ) |
|
When Verbose is enabled, message will be printed to standard or error output.
◆ test()
virtual void ctkModelTester::test |
( |
bool |
result, |
|
|
const QString & |
errorString |
|
) |
| const |
|
protectedvirtual |
Utility function that process the result of a test.
◆ testData()
virtual void ctkModelTester::testData |
( |
const QModelIndex & |
index | ) |
const |
|
virtual |
Test the data consistency of a QModelIndex. Note: Only DisplayRole is checked.
◆ testDataEnabled()
bool ctkModelTester::testDataEnabled |
( |
| ) |
const |
◆ testModel()
virtual void ctkModelTester::testModel |
( |
| ) |
const |
|
virtual |
Run all the tests on the model previously set in setModel(...)
◆ testModelIndex()
virtual void ctkModelTester::testModelIndex |
( |
const QModelIndex & |
index | ) |
const |
|
virtual |
Run a collection of tests on a QModelIndex.
◆ testParent()
virtual void ctkModelTester::testParent |
( |
const QModelIndex & |
parent | ) |
const |
|
virtual |
Check the hierarchy consistency of a QModelIndex child/parent/siblings relationships
◆ testPersistentModelIndex()
virtual void ctkModelTester::testPersistentModelIndex |
( |
const QPersistentModelIndex & |
index | ) |
const |
|
virtual |
Test a persistent model index
◆ throwOnError()
bool ctkModelTester::throwOnError |
( |
| ) |
const |
◆ verbose()
bool ctkModelTester::verbose |
( |
| ) |
const |
◆ d_ptr
QScopedPointer<ctkModelTesterPrivate> ctkModelTester::d_ptr |
|
protected |
◆ nestedInserts
bool ctkModelTester::nestedInserts |
|
readwrite |
◆ testDataEnabled
bool ctkModelTester::testDataEnabled |
|
readwrite |
◆ throwOnError
bool ctkModelTester::throwOnError |
|
readwrite |
◆ verbose
bool ctkModelTester::verbose |
|
readwrite |
The documentation for this class was generated from the following file: