summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflickable_p.h5
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp1
-rw-r--r--tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp43
3 files changed, 46 insertions, 3 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeflickable_p.h b/src/declarative/graphicsitems/qdeclarativeflickable_p.h
index ece2db7..4d3da92 100644
--- a/src/declarative/graphicsitems/qdeclarativeflickable_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeflickable_p.h
@@ -149,9 +149,8 @@ public:
FlickableDirection flickableDirection() const;
void setFlickableDirection(FlickableDirection);
- //XXX Added in QtQuick 1.1
- Q_INVOKABLE void resizeContent(qreal w, qreal h, QPointF center);
- Q_INVOKABLE void returnToBounds();
+ Q_INVOKABLE Q_REVISION(1) void resizeContent(qreal w, qreal h, QPointF center);
+ Q_INVOKABLE Q_REVISION(1) void returnToBounds();
Q_SIGNALS:
void contentWidthChanged();
diff --git a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp
index 0d386c6..ddbde0b 100644
--- a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp
@@ -179,6 +179,7 @@ void QDeclarativeItemModule::defineModule()
qmlRegisterType<QDeclarativePinchArea>("QtQuick",1,1,"PinchArea");
qmlRegisterType<QDeclarativePinch>("QtQuick",1,1,"Pinch");
qmlRegisterType<QDeclarativePinchEvent>();
+ qmlRegisterType<QDeclarativeFlickable,1>("QtQuick",1,1,"Flickable");
qmlRegisterType<QDeclarativeRepeater,1>("QtQuick",1,1,"Repeater");
qmlRegisterType<QDeclarativeTextEdit,1>("QtQuick",1,1,"TextEdit");
#ifndef QT_NO_LINEEDIT
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)
{