Fix flaky QtAbstractItemModel setData test case

The Java callback function onDataChanged() gets called
from Android UI thread. QTRY_COMPARE on the result of
a JNI call does not make sense because it actually does
not retry to reinvoke the JNI call to read the related
counter.

This change puts the JNI call to QTRY_COMPARE to make sure
the Android thread have to to process the Runnable.

Fixes: QTBUG-131253
Change-Id: Icdff8f8f37b33968f5a3f6e545ce753907305e74
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This commit is contained in:
Soheil Armin 2024-11-14 11:23:46 +02:00
parent afe38ba7ab
commit 1e714bb0fc

View File

@ -249,8 +249,7 @@ void tst_AndroidItemModel::setData()
QCOMPARE(bottomRight, qProxy->index(row, column, QModelIndex()));
QCOMPARE(roles, QList<int>{role});
jint jDataChangedCount = jModel.getField<jint>("m_dataChangedCount");
QTRY_COMPARE(jDataChangedCount, 1);
QTRY_COMPARE(jModel.getField<jint>("m_dataChangedCount"), 1);
}
void tst_AndroidItemModel::resetModel()