diff options
author | Martin Jones <martin.jones@nokia.com> | 2011-01-11 00:55:14 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2011-01-11 00:55:14 (GMT) |
commit | 7ca750fad4e74929c9c34a98c19bde37747a9dc5 (patch) | |
tree | 9918f7ac4660ff0106b8f8f78be0559b6ba3c812 /tests/auto/declarative | |
parent | 7d43a31902ca6d2132004c45db313194c9669bb6 (diff) | |
download | Qt-7ca750fad4e74929c9c34a98c19bde37747a9dc5.zip Qt-7ca750fad4e74929c9c34a98c19bde37747a9dc5.tar.gz Qt-7ca750fad4e74929c9c34a98c19bde37747a9dc5.tar.bz2 |
Add versioning for new Flickable methods.
Task-number: QTBUG-15148
Diffstat (limited to 'tests/auto/declarative')
-rw-r--r-- | tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp b/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp index c1564bc..10ab467 100644 --- a/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp +++ b/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp @@ -72,6 +72,8 @@ private slots: void qgraphicswidget(); void resizeContent(); void returnToBounds(); + void testQtQuick11Attributes(); + void testQtQuick11Attributes_data(); private: QDeclarativeEngine engine; @@ -331,6 +333,47 @@ void tst_qdeclarativeflickable::returnToBounds() delete root; } +void tst_qdeclarativeflickable::testQtQuick11Attributes() +{ + QFETCH(QString, code); + QFETCH(QString, warning); + QFETCH(QString, error); + + QDeclarativeEngine engine; + QObject *obj; + + QDeclarativeComponent invalid(&engine); + invalid.setData("import QtQuick 1.0; Flickable { " + code.toUtf8() + " }", QUrl("")); + QTest::ignoreMessage(QtWarningMsg, warning.toUtf8()); + obj = invalid.create(); + QCOMPARE(invalid.errorString(), error); + delete obj; + + QDeclarativeComponent valid(&engine); + valid.setData("import QtQuick 1.1; Flickable { " + code.toUtf8() + " }", QUrl("")); + obj = valid.create(); + QVERIFY(obj); + QVERIFY(valid.errorString().isEmpty()); + delete obj; +} + +void tst_qdeclarativeflickable::testQtQuick11Attributes_data() +{ + QTest::addColumn<QString>("code"); + QTest::addColumn<QString>("warning"); + QTest::addColumn<QString>("error"); + + QTest::newRow("resizeContent") << "Component.onCompleted: resizeContent(100,100,Qt.point(50,50))" + << "<Unknown File>:1: ReferenceError: Can't find variable: resizeContent" + << ""; + + QTest::newRow("returnToBounds") << "Component.onCompleted: returnToBounds()" + << "<Unknown File>:1: ReferenceError: Can't find variable: returnToBounds" + << ""; + +} + + template<typename T> T *tst_qdeclarativeflickable::findItem(QGraphicsObject *parent, const QString &objectName) { |