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:
Soheil Armin 2025-01-16 16:46:21 +02:00
parent 7ebdce3cde
commit b751a12f7a

View File

@ -13,6 +13,7 @@
#include <QtCore/qjnitypes.h>
#include <QtCore/qstring.h>
#include <QSignalSpy>
#include <QAbstractItemModelTester>
using namespace Qt::Literals;
@ -32,6 +33,7 @@ private slots:
void initTestCase_data();
void init();
void cleanup();
void nonDestructiveChecks();
void addRow();
void addColumn();
void removeRow();
@ -69,6 +71,21 @@ void tst_AndroidItemModel::cleanup()
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()
{
const int rowsBefore = qProxy->rowCount();