aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp')
-rw-r--r--tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp
index d277952f22..603c091a03 100644
--- a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp
+++ b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp
@@ -71,6 +71,7 @@ private slots:
void qmlCreateObject();
void qmlCreateObjectWithProperties();
void qmlIncubateObject();
+ void qmlCreateParentReference();
private:
QQmlEngine engine;
@@ -181,6 +182,37 @@ void tst_qqmlcomponent::qmlCreateObjectWithProperties()
delete testBindingThisObj;
}
+static QStringList warnings;
+static void msgHandler(QtMsgType, const char *warning)
+{
+ warnings << QString::fromUtf8(warning);
+}
+
+void tst_qqmlcomponent::qmlCreateParentReference()
+{
+ QQmlEngine engine;
+
+ QCOMPARE(engine.outputWarningsToStandardError(), true);
+
+ warnings.clear();
+ QtMsgHandler old = qInstallMsgHandler(msgHandler);
+
+ QQmlComponent component(&engine, testFileUrl("createParentReference.qml"));
+ QVERIFY2(component.errorString().isEmpty(), component.errorString().toUtf8());
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QVERIFY(QMetaObject::invokeMethod(object, "createChild"));
+ delete object;
+
+ qInstallMsgHandler(old);
+
+ engine.setOutputWarningsToStandardError(false);
+ QCOMPARE(engine.outputWarningsToStandardError(), false);
+
+ QCOMPARE(warnings.count(), 0);
+}
+
QTEST_MAIN(tst_qqmlcomponent)
#include "tst_qqmlcomponent.moc"