21 #ifndef __ctkModelTester_h
22 #define __ctkModelTester_h
26 #include <QModelIndex>
27 #include <QPersistentModelIndex>
32 #include "ctkCoreExport.h"
34 class QAbstractItemModel;
35 class ctkModelTesterPrivate;
47 Q_PROPERTY(
bool nestedInserts READ nestedInserts WRITE setNestedInserts);
48 Q_PROPERTY(
bool testDataEnabled READ testDataEnabled WRITE setTestDataEnabled);
49 Q_PROPERTY(
bool throwOnError READ throwOnError WRITE setThrowOnError);
75 QAbstractItemModel*
model()
const;
107 virtual void testData(
const QModelIndex& index)
const;
131 void onDataChanged(
const QModelIndex & topLeft,
const QModelIndex & bottomRight);
156 virtual void onItemsInserted(
const QModelIndex& parent, Qt::Orientation,
int start,
int end);
161 virtual void onItemsRemoved(
const QModelIndex& parent, Qt::Orientation,
int start,
int end);
169 virtual void test(
bool result,
const QString& errorString)
const;
172 QScopedPointer<ctkModelTesterPrivate>
d_ptr;
void onRowsInserted(const QModelIndex &parent, int start, int end)
bool testDataEnabled() const
void onDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
void onLayoutAboutToBeChanged()
QList< QPersistentModelIndex > persistentModelIndexes(const QModelIndex &index) const
Create a list of persistent index of all the index's children.
ctkModelTester(QObject *parent=0)
void onColumnsRemoved(const QModelIndex &parent, int start, int end)
virtual void onItemsInserted(const QModelIndex &parent, Qt::Orientation, int start, int end)
virtual void testModel() const
Run all the tests on the model previously set in setModel(...)
QAbstractItemModel * model() const
virtual void testParent(const QModelIndex &parent) const
ctkModelTester(QAbstractItemModel *model, QObject *parent=0)
virtual ~ctkModelTester()
Destructor.
void onModelAboutToBeReset()
virtual void testPersistentModelIndex(const QPersistentModelIndex &index) const
virtual void onItemsRemoved(const QModelIndex &parent, Qt::Orientation, int start, int end)
void onColumnsInserted(const QModelIndex &parent, int start, int end)
void onColumnsAboutToBeInserted(const QModelIndex &parent, int start, int end)
virtual void test(bool result, const QString &errorString) const
Utility function that process the result of a test.
void onHeaderDataChanged(Qt::Orientation orientation, int first, int last)
bool nestedInserts() const
void setNestedInserts(bool enable)
void onRowsRemoved(const QModelIndex &parent, int start, int end)
virtual void testData(const QModelIndex &index) const
virtual void onItemsAboutToBeInserted(const QModelIndex &parent, Qt::Orientation, int start, int end)
virtual void onItemsAboutToBeRemoved(const QModelIndex &parent, Qt::Orientation, int start, int end)
void setTestDataEnabled(bool enable)
void setVerbose(bool enable)
When Verbose is enabled, message will be printed to standard or error output.
void setThrowOnError(bool throwException)
virtual void testModelIndex(const QModelIndex &index) const
Run a collection of tests on a QModelIndex.
void setModel(QAbstractItemModel *model)
void onRowsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
bool throwOnError() const
void onRowsAboutToBeInserted(const QModelIndex &parent, int start, int end)
QScopedPointer< ctkModelTesterPrivate > d_ptr
void onColumnsAboutToBeRemoved(const QModelIndex &parent, int start, int end)