diff --git a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp index 4fc48327b5..77707192f0 100644 --- a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp +++ b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp @@ -606,8 +606,10 @@ QT_WARNING_POP const JsSingleton *oldJsSingleton = engine.singletonInstance(jsObject); QVERIFY(oldJsSingleton != nullptr); const uint oldJsSingletonId = oldJsSingleton->id; - const QObject *oldQmlSingleton = engine.singletonInstance(qmlObject); + QObject *oldQmlSingleton = engine.singletonInstance(qmlObject); QVERIFY(oldQmlSingleton != nullptr); + QCOMPARE(oldQmlSingleton->objectName(), "theSingleton"); + oldQmlSingleton->setObjectName("marked"); QQmlComponent c(&engine); c.setData("import ClearSingletons\n" @@ -665,7 +667,7 @@ QT_WARNING_POP QVERIFY(newJsSingleton->id != oldJsSingletonId); const QObject *newQmlSingleton = engine.singletonInstance(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(singletonUser->property("a")), &objectCaller1);