LibEngsas
|
Class to test all basic stuff of QAbstractItemModels. More...
#include <modeltest.h>
Classes | |
struct | Changing |
Public Member Functions | |
ModelTest (QAbstractItemModel *model, QObject *parent=NULL, int verbose=1) | |
Protected Slots | |
void | runAllTests () |
void | layoutAboutToBeChanged () |
void | layoutChanged () |
void | rowsAboutToBeInserted (const QModelIndex &parent, int start, int) |
void | rowsInserted (const QModelIndex &parent, int start, int end) |
void | rowsAboutToBeRemoved (const QModelIndex &parent, int start, int end) |
void | rowsRemoved (const QModelIndex &parent, int start, int end) |
Private Slots | |
void | nonDestructiveBasicTest () |
void | rowCount () |
void | columnCount () |
void | hasIndex () |
void | index () |
void | parent () |
void | data () |
Private Member Functions | |
void | checkChildren (const QModelIndex &parent, int currentDepth=0) |
void | init () |
Private Attributes | |
QAbstractItemModel * | model |
QStack< Changing > | insert |
QStack< Changing > | remove |
bool | fetchingMore |
int | verboseLevel |
QList< QPersistentModelIndex > | changing |
Class to test all basic stuff of QAbstractItemModels.
This class is from QtLabs. It is designed to watch a given model and run some checks after events like inserting or remove items. So use it like this:
ModelTest::ModelTest | ( | QAbstractItemModel * | _model, |
QObject * | parent = NULL , |
||
int | verbose = 1 |
||
) |
Connect to all of the models signals. Whenever anything happens recheck everything.
|
private |
Called from the parent() test.
A model that returns an index of parent X should also return X when asking for the parent of the index.
This recursive function does pretty extensive testing on the whole model in an effort to catch edge cases.
This function assumes that rowCount(), columnCount() and index() already work. If they have a bug it will point it out, but the above tests should have already found the basic bugs because it is easier to figure out the problem in those tests then this one.
|
privateslot |
Tests model's implementation of QAbstractItemModel::columnCount() and hasChildren()
|
privateslot |
Tests model's implementation of QAbstractItemModel::data()
|
privateslot |
Tests model's implementation of QAbstractItemModel::hasIndex()
|
privateslot |
Tests model's implementation of QAbstractItemModel::index()
|
private |
|
protectedslot |
|
protectedslot |
|
privateslot |
nonDestructiveBasicTest tries to call a number of the basic functions (not all) to make sure the model doesn't outright segfault, testing the functions that makes sense.
|
privateslot |
Tests model's implementation of QAbstractItemModel::parent()
|
privateslot |
Tests model's implementation of QAbstractItemModel::rowCount() and hasChildren()
Models that are dynamically populated are not as fully tested here.
|
protectedslot |
Store what is about to be inserted to make sure it actually happens
|
protectedslot |
Store what is about to be inserted to make sure it actually happens
|
protectedslot |
Confirm that what was said was going to happen actually did
|
protectedslot |
Confirm that what was said was going to happen actually did
|
protectedslot |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |