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 16:38:22 +0000 |
| commit | 949a2b8829d698589b1456a43c73d6a3e0d4f60c (patch) | |
| tree | 30f7c54133ca00f7178e3082f0290de928a71a19 | |
| parent | 5210e391ef7b3d711d14691759484e21269231e1 (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.9 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>
| -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); |
