diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2025-09-05 12:59:55 +0200 |
|---|---|---|
| committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2025-09-05 20:29:51 +0000 |
| commit | 3ea7fdcd338a8f6d9fa9119290ecfecca2840907 (patch) | |
| tree | 3ed67e9d83361fd17d24e03bdf1357ebaa099bcd | |
| parent | babcef3e270a39c9d56b756df332192657418d50 (diff) | |
tst_qqmlengine: Further stabilize
Not only C++ and JS singletons, but also QML singletons can be created
in the same memory location ...
Amends commit c300a170ed205bd255a412377fb6c26fd192bd4d
Amends commit e1614a41c8a837617a9f87d8d9106120154fbd00
Pick-to: 6.8
Change-Id: If4ce39287e459d5b183f044fd8e7bbca52b639b7
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 93624bce20b3800daf2a63cdb07c1b7e1e499ea3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 949a2b8829d698589b1456a43c73d6a3e0d4f60c)
| -rw-r--r-- | tests/auto/qml/qqmlengine/tst_qqmlengine.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp index d5b98fa1e7..2878e6b476 100644 --- a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp +++ b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp @@ -604,8 +604,10 @@ QT_WARNING_POP const JsSingleton *oldJsSingleton = engine.singletonInstance<JsSingleton *>(jsObject); QVERIFY(oldJsSingleton != nullptr); const uint oldJsSingletonId = oldJsSingleton->id; - const QObject *oldQmlSingleton = engine.singletonInstance<QObject *>(qmlObject); + QObject *oldQmlSingleton = engine.singletonInstance<QObject *>(qmlObject); QVERIFY(oldQmlSingleton != nullptr); + QCOMPARE(oldQmlSingleton->objectName(), "theSingleton"); + oldQmlSingleton->setObjectName("marked"); QQmlComponent c(&engine); c.setData("import ClearSingletons\n" @@ -663,7 +665,7 @@ QT_WARNING_POP QVERIFY(newJsSingleton->id != oldJsSingletonId); const QObject *newQmlSingleton = engine.singletonInstance<QObject *>(qmlObject); QVERIFY(newQmlSingleton != nullptr); - QVERIFY(newQmlSingleton != oldQmlSingleton); + QCOMPARE(newQmlSingleton->objectName(), "theSingleton"); // Holding on to an old singleton instance is OK. We don't delete those. QCOMPARE(qvariant_cast<QObject *>(singletonUser->property("a")), &objectCaller1); |
