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
Change-Id: I719f4223d84e66c1d94cbd0380bfdb77b07da7b6
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit b751a12f7af533049ff46c6a63bd12eb6082415a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Soheil Armin 2025-01-16 16:46:21 +02:00 committed by Qt Cherry-pick Bot
parent d25e08afc2
commit 74c455c8bb

View File

@ -13,6 +13,7 @@
#include <QtCore/qjnitypes.h>
#include <QtCore/qstring.h>
#include <QSignalSpy>
#include <QAbstractItemModelTester>
using namespace Qt::Literals;
@ -40,6 +41,7 @@ private slots:
void initTestCase_data();
void init();
void cleanup();
void nonDestructiveChecks();
void addRow();
void addColumn();
void removeRow();
@ -77,6 +79,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();