diff options
Diffstat (limited to 'tests/auto/declarative/qdeclarativeview')
4 files changed, 24 insertions, 2 deletions
diff --git a/tests/auto/declarative/qdeclarativeview/data/error1.qml b/tests/auto/declarative/qdeclarativeview/data/error1.qml new file mode 100644 index 0000000..4887ff9 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeview/data/error1.qml @@ -0,0 +1,5 @@ +import QtQuick 1.0 + +Rectangle { + nonExistentProperty: 5 +} diff --git a/tests/auto/declarative/qdeclarativeview/data/resizemodedeclarativeitem.qml b/tests/auto/declarative/qdeclarativeview/data/resizemodedeclarativeitem.qml index 27c8454..e5501a1 100644 --- a/tests/auto/declarative/qdeclarativeview/data/resizemodedeclarativeitem.qml +++ b/tests/auto/declarative/qdeclarativeview/data/resizemodedeclarativeitem.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 Item { width: 200 height: 200 diff --git a/tests/auto/declarative/qdeclarativeview/data/resizemodegraphicswidget.qml b/tests/auto/declarative/qdeclarativeview/data/resizemodegraphicswidget.qml index 964810c..f270908 100644 --- a/tests/auto/declarative/qdeclarativeview/data/resizemodegraphicswidget.qml +++ b/tests/auto/declarative/qdeclarativeview/data/resizemodegraphicswidget.qml @@ -1,4 +1,4 @@ -import Qt 4.7 +import QtQuick 1.0 QGraphicsWidget { width: 200 height: 200 diff --git a/tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp b/tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp index 6450e38..9ac79e4 100644 --- a/tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp +++ b/tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp @@ -62,6 +62,7 @@ public: private slots: void resizemodedeclarativeitem(); void resizemodegraphicswidget(); + void errors(); private: template<typename T> @@ -255,6 +256,22 @@ void tst_QDeclarativeView::resizemodegraphicswidget() delete canvas; } +static void silentErrorsMsgHandler(QtMsgType, const char *) +{ +} + +void tst_QDeclarativeView::errors() +{ + QDeclarativeView *canvas = new QDeclarativeView; + QVERIFY(canvas); + QtMsgHandler old = qInstallMsgHandler(silentErrorsMsgHandler); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/error1.qml")); + qInstallMsgHandler(old); + QVERIFY(canvas->status() == QDeclarativeView::Error); + QVERIFY(canvas->errors().count() == 1); + delete canvas; +} + template<typename T> T *tst_QDeclarativeView::findItem(QGraphicsObject *parent, const QString &objectName) { |