aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/quick/qquickloader/data/statusChanged.qml16
-rw-r--r--tests/auto/quick/qquickloader/tst_qquickloader.cpp14
2 files changed, 30 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickloader/data/statusChanged.qml b/tests/auto/quick/qquickloader/data/statusChanged.qml
new file mode 100644
index 0000000000..fe46bc7b24
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/statusChanged.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.12
+import QtQuick.Window 2.12
+
+Window {
+ id: root
+ property int statusChangedCounter: 0
+ property alias status: loader.status
+ visible: true; width: 640; height: 480
+ Loader {
+ id: loader
+ anchors.fill: parent
+ asynchronous: true
+ source: "./RedRect.qml"
+ onStatusChanged: root.statusChangedCounter++
+ }
+}
diff --git a/tests/auto/quick/qquickloader/tst_qquickloader.cpp b/tests/auto/quick/qquickloader/tst_qquickloader.cpp
index d0a1a8a45b..7bd6f9466a 100644
--- a/tests/auto/quick/qquickloader/tst_qquickloader.cpp
+++ b/tests/auto/quick/qquickloader/tst_qquickloader.cpp
@@ -39,6 +39,7 @@
#include "testhttpserver.h"
#include "../../shared/util.h"
#include "../shared/geometrytestutil.h"
+#include <QQmlApplicationEngine>
Q_LOGGING_CATEGORY(lcTests, "qt.quick.tests")
@@ -128,6 +129,7 @@ private slots:
void rootContext();
void sourceURLKeepComponent();
+ void statusChangeOnlyEmittedOnce();
};
Q_DECLARE_METATYPE(QList<QQmlError>)
@@ -1446,6 +1448,18 @@ void tst_QQuickLoader::sourceURLKeepComponent()
}
+// QTBUG-82002
+void tst_QQuickLoader::statusChangeOnlyEmittedOnce()
+{
+ QQmlApplicationEngine engine;
+ auto url = testFileUrl("statusChanged.qml");
+ engine.load(url);
+ auto root = engine.rootObjects().at(0);
+ QVERIFY(root);
+ QTRY_COMPARE(QQuickLoader::Status(root->property("status").toInt()), QQuickLoader::Ready);
+ QCOMPARE(root->property("statusChangedCounter").toInt(), 2); // 1xLoading + 1xReady*/
+}
+
QTEST_MAIN(tst_QQuickLoader)
#include "tst_qquickloader.moc"