diff options
author | Robin Burchell <robin.burchell@viroteck.net> | 2015-02-02 22:17:41 +0100 |
---|---|---|
committer | Robin Burchell <robin.burchell@viroteck.net> | 2015-02-23 12:43:06 +0000 |
commit | 59f6a78b5fddf71f2c98e8b67e093b7e8d1cb3d3 (patch) | |
tree | bc15cfb2c2ebe45af2958e12358b7d565d4e8fdc /tests/auto/quick/qquickview | |
parent | 4db31cbd4e29cf5387f4332537f8ea9e0e9f62ae (diff) |
QQuickView/QQuickWidget: Report an error if rootObject ends up null.
This can happen when trying to use a non-QQuickItem item as the root item in a
QQuickView, for instance, a Window or ApplicationWindow item.
This generates a warning (correctly), but does not set an error state on the
view, so automated tooling and the like does not know that the scene was not
successfully loaded.
Change-Id: I1dc4191ef07187e9b1929995aedb01c155b0957c
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
Diffstat (limited to 'tests/auto/quick/qquickview')
-rw-r--r-- | tests/auto/quick/qquickview/data/error2.qml | 4 | ||||
-rw-r--r-- | tests/auto/quick/qquickview/tst_qquickview.cpp | 9 |
2 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickview/data/error2.qml b/tests/auto/quick/qquickview/data/error2.qml new file mode 100644 index 0000000000..1d754b64f0 --- /dev/null +++ b/tests/auto/quick/qquickview/data/error2.qml @@ -0,0 +1,4 @@ +import QtQuick.Window 2.0 + +Window { +} diff --git a/tests/auto/quick/qquickview/tst_qquickview.cpp b/tests/auto/quick/qquickview/tst_qquickview.cpp index a980c69140..7ee24bf3d4 100644 --- a/tests/auto/quick/qquickview/tst_qquickview.cpp +++ b/tests/auto/quick/qquickview/tst_qquickview.cpp @@ -187,6 +187,15 @@ void tst_QQuickView::errors() QVERIFY(view.status() == QQuickView::Error); QVERIFY(view.errors().count() == 1); } + + { + QQuickView view; + QQmlTestMessageHandler messageHandler; + view.setSource(testFileUrl("error2.qml")); + QVERIFY(view.status() == QQuickView::Error); + QVERIFY(view.errors().count() == 1); + view.show(); + } } void tst_QQuickView::engine() |