Android: Incorporate QAbstractItemModelTester into QtAIM CI Tests
QAbstractItemModelTester performs non-destructive tests on test models. It helps with catching the most common errors in the test model. Task-number: QTBUG-132880 Pick-to: 6.9 Change-Id: I719f4223d84e66c1d94cbd0380bfdb77b07da7b6 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This commit is contained in:
parent
7ebdce3cde
commit
b751a12f7a
@ -13,6 +13,7 @@
|
|||||||
#include <QtCore/qjnitypes.h>
|
#include <QtCore/qjnitypes.h>
|
||||||
#include <QtCore/qstring.h>
|
#include <QtCore/qstring.h>
|
||||||
#include <QSignalSpy>
|
#include <QSignalSpy>
|
||||||
|
#include <QAbstractItemModelTester>
|
||||||
|
|
||||||
using namespace Qt::Literals;
|
using namespace Qt::Literals;
|
||||||
|
|
||||||
@ -32,6 +33,7 @@ private slots:
|
|||||||
void initTestCase_data();
|
void initTestCase_data();
|
||||||
void init();
|
void init();
|
||||||
void cleanup();
|
void cleanup();
|
||||||
|
void nonDestructiveChecks();
|
||||||
void addRow();
|
void addRow();
|
||||||
void addColumn();
|
void addColumn();
|
||||||
void removeRow();
|
void removeRow();
|
||||||
@ -69,6 +71,21 @@ void tst_AndroidItemModel::cleanup()
|
|||||||
resetModel();
|
resetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tst_AndroidItemModel::nonDestructiveChecks()
|
||||||
|
{
|
||||||
|
QFETCH_GLOBAL(bool, isList);
|
||||||
|
|
||||||
|
for (int i = 0; i < 10; ++i)
|
||||||
|
jModel.callMethod<void>("addRow");
|
||||||
|
|
||||||
|
if (!isList) {
|
||||||
|
for (int i = 0; i < 10; ++i)
|
||||||
|
jModel.callMethod<void>("addCol");
|
||||||
|
}
|
||||||
|
|
||||||
|
QAbstractItemModelTester tester(qProxy);
|
||||||
|
}
|
||||||
|
|
||||||
void tst_AndroidItemModel::addRow()
|
void tst_AndroidItemModel::addRow()
|
||||||
{
|
{
|
||||||
const int rowsBefore = qProxy->rowCount();
|
const int rowsBefore = qProxy->rowCount();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user