aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp')
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index 7c1eb7d54b..6af8863de7 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -313,6 +313,7 @@ private slots:
void qtbug_33754();
void qtbug_34493();
void singletonFromQMLToCpp();
+ void singletonFromQMLAndBackAndCompare();
void setPropertyOnInvalid();
void miscTypeTest();
void stackLimits();
@@ -7389,6 +7390,33 @@ void tst_qqmlecmascript::singletonFromQMLToCpp()
QCOMPARE(obj->property("myInheritedQmlObjectTest"), QVariant(true));
}
+// Check that a Singleton can be passed from QML to C++
+// as its type*, it's parent type* and as QObject*
+// and correctly compares to itself
+void tst_qqmlecmascript::singletonFromQMLAndBackAndCompare()
+{
+ QQmlComponent component(&engine, testFile("singletonTest2.qml"));
+ QScopedPointer<QObject> o(component.create());
+ if (component.errors().size())
+ qDebug() << component.errors();
+ QVERIFY(component.errors().isEmpty());
+ QVERIFY(o != 0);
+
+ QCOMPARE(o->property("myInheritedQmlObjectTest1"), QVariant(true));
+ QCOMPARE(o->property("myInheritedQmlObjectTest2"), QVariant(true));
+ QCOMPARE(o->property("myInheritedQmlObjectTest3"), QVariant(true));
+
+ QCOMPARE(o->property("myQmlObjectTest1"), QVariant(true));
+ QCOMPARE(o->property("myQmlObjectTest2"), QVariant(true));
+ QCOMPARE(o->property("myQmlObjectTest3"), QVariant(true));
+
+ QCOMPARE(o->property("qobjectTest1"), QVariant(true));
+ QCOMPARE(o->property("qobjectTest2"), QVariant(true));
+ QCOMPARE(o->property("qobjectTest3"), QVariant(true));
+
+ QCOMPARE(o->property("singletonEqualToItself"), QVariant(true));
+}
+
void tst_qqmlecmascript::setPropertyOnInvalid()
{
{