Fix tst_QQmlXmlListModel::source() on Android

tst_QQmlXmlListModel::source() assumed that local files are loaded
immediately and others later.
This is not true for files in the qrc: system. They are not local
files. But still, they are loaded immediately. This patch
fixes the test.

Pick-to: 6.2 6.3
Task-number: QTBUG-101865
Change-Id: I13a449cefe12135d4c6cd7687c80f41b7333349e
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
This commit is contained in:
Andreas Buhr 2022-04-20 10:11:11 +02:00 committed by Andreas Buhr
parent 8976a55dac
commit 9bbc43fbd1
1 changed files with 4 additions and 1 deletions

View File

@ -38,6 +38,8 @@
#include <QtQmlXmlListModel/private/qqmlxmllistmodel_p.h>
#include <QtQuickTestUtils/private/qmlutils_p.h>
using namespace Qt::StringLiterals;
typedef QList<QVariantList> QQmlXmlModelData;
Q_DECLARE_METATYPE(QQmlXmlModelData)
@ -380,7 +382,8 @@ void tst_QQmlXmlListModel::source()
if (model->property("source").toString().isEmpty())
QCOMPARE(qvariant_cast<QQmlXmlListModel::Status>(model->property("status")),
QQmlXmlListModel::Null);
QCOMPARE(model->property("progress").toDouble(), qreal(source.isLocalFile() ? 1.0 : 0.0));
qreal expectedProgress = (source.isLocalFile() || (source.scheme() == "qrc"_L1)) ? 1.0 : 0.0;
QCOMPARE(model->property("progress").toDouble(), expectedProgress);
QTRY_COMPARE(spy.count(), 1);
spy.clear();
QCOMPARE(qvariant_cast<QQmlXmlListModel::Status>(model->property("status")),