diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qtsensors5/tst_qtsensors5.cpp | 28 | ||||
-rw-r--r-- | tests/auto/sensors2qmlapi/sensors2qmlapi.pro | 2 |
2 files changed, 30 insertions, 0 deletions
diff --git a/tests/auto/qtsensors5/tst_qtsensors5.cpp b/tests/auto/qtsensors5/tst_qtsensors5.cpp index 3f67315..7be610a 100644 --- a/tests/auto/qtsensors5/tst_qtsensors5.cpp +++ b/tests/auto/qtsensors5/tst_qtsensors5.cpp @@ -124,6 +124,34 @@ private slots: QList<QDeclarativeError> errors = c.errors(); QCOMPARE(errors.count(), 0); } + + void uncreatable_elements_data() + { + QTest::addColumn<QString>("version"); + QTest::addColumn<QString>("element"); + + QTest::newRow("Sensor 5.0") << "5.0" << "Sensor"; + } + + void uncreatable_elements() + { + QFETCH(QString, version); + QFETCH(QString, element); + + QDeclarativeEngine engine; + QString qml = QString("import QtQuick 2.0\nimport QtSensors %1\n%2 {}").arg(version).arg(element); + QDeclarativeComponent c(&engine); + c.setData(qml.toLocal8Bit(), QUrl::fromLocalFile(QDir::currentPath())); + //QTest::ignoreMessage(QtWarningMsg, "QDeclarativeComponent: Component is not ready"); + QObject *obj = c.create(); + QCOMPARE(obj, static_cast<QObject*>(0)); + delete obj; + QList<QDeclarativeError> errors = c.errors(); + QCOMPARE(errors.count(), 1); + QString expected = QString("Cannot create %1").arg(element); + QString actual = errors.first().description(); + QCOMPARE(expected, actual); + } }; QTEST_MAIN(tst_qtsensors5) diff --git a/tests/auto/sensors2qmlapi/sensors2qmlapi.pro b/tests/auto/sensors2qmlapi/sensors2qmlapi.pro index cdd9c02..836cce0 100644 --- a/tests/auto/sensors2qmlapi/sensors2qmlapi.pro +++ b/tests/auto/sensors2qmlapi/sensors2qmlapi.pro @@ -11,6 +11,7 @@ SOURCES += tst_sensors2qmlapi.cpp \ ./../../../src/imports/sensors2/qsensor2proximity.cpp \ ./../../../src/imports/sensors2/qsensor2tilt.cpp \ ./../../../src/imports/sensors2/qsensor2gesture.cpp \ + ./../../../src/imports/sensors2/qsensor2common.cpp \ qtemplategestureplugin.cpp \ qtemplaterecognizer.cpp @@ -22,5 +23,6 @@ HEADERS += qdeclaccelerometer.h \ ./../../../src/imports/sensors2/qsensor2proximity.h \ ./../../../src/imports/sensors2/qsensor2tilt.h \ ./../../../src/imports/sensors2/qsensor2gesture.h \ + ./../../../src/imports/sensors2/qsensor2common.h \ qtemplategestureplugin.h \ qtemplaterecognizer.h |