diff options
author | Bea Lam <bea.lam@nokia.com> | 2010-02-23 23:43:06 (GMT) |
---|---|---|
committer | Bea Lam <bea.lam@nokia.com> | 2010-02-23 23:43:06 (GMT) |
commit | 206b55e618945e7cfb428cfa7a7decbb3dc9f2e4 (patch) | |
tree | 600546d7cb8d2f9a18bbc98d29257d026a1e4888 /tests | |
parent | 2f1372b7a77d9e24d4a6f6925fe876b4e3a1b01a (diff) | |
parent | d19f691a5646725c69b232e2adde8c2f961eb571 (diff) | |
download | Qt-206b55e618945e7cfb428cfa7a7decbb3dc9f2e4.zip Qt-206b55e618945e7cfb428cfa7a7decbb3dc9f2e4.tar.gz Qt-206b55e618945e7cfb428cfa7a7decbb3dc9f2e4.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-qml
Diffstat (limited to 'tests')
42 files changed, 786 insertions, 260 deletions
diff --git a/tests/auto/declarative/layouts/tst_layouts.cpp b/tests/auto/declarative/layouts/tst_layouts.cpp index ee05574..53c1ede 100644 --- a/tests/auto/declarative/layouts/tst_layouts.cpp +++ b/tests/auto/declarative/layouts/tst_layouts.cpp @@ -67,7 +67,6 @@ void tst_QmlGraphicsLayouts::test_qml() { QmlView *canvas = createView(SRCDIR "/data/layouts.qml"); - canvas->execute(); qApp->processEvents(); QmlGraphicsLayoutItem *left = static_cast<QmlGraphicsLayoutItem*>(canvas->rootObject()->findChild<QmlGraphicsItem*>("left")); QVERIFY(left != 0); diff --git a/tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp b/tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp index 9eae308..00e099e 100644 --- a/tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp +++ b/tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp @@ -45,6 +45,7 @@ #include <private/qmlgraphicsrectangle_p.h> #include <private/qmlanimation_p.h> #include <QVariantAnimation> +#include <QEasingCurve> class tst_qmlanimations : public QObject { @@ -67,11 +68,11 @@ private slots: void mixedTypes(); void properties(); void propertiesTransition(); - void easingStringConversion(); void invalidDuration(); void attached(); void propertyValueSourceDefaultStart(); void dontStart(); + void easingProperties(); }; #define QTIMED_COMPARE(lhs, rhs) do { \ @@ -261,7 +262,6 @@ void tst_qmlanimations::badTypes() QmlView *view = new QmlView; view->setSource(QUrl::fromLocalFile(SRCDIR "/data/badtype1.qml")); - view->execute(); qApp->processEvents(); delete view; @@ -518,57 +518,6 @@ void tst_qmlanimations::propertiesTransition() }*/ } -void tst_qmlanimations::easingStringConversion() -{ - QmlNumberAnimation *animation = new QmlNumberAnimation; - animation->setEasing("easeInOutQuad"); - QCOMPARE(animation->easing(),QLatin1String("easeInOutQuad")); - QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve(), QEasingCurve(QEasingCurve::InOutQuad)); - - animation->setEasing("OutQuad"); - QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve(), QEasingCurve(QEasingCurve::OutQuad)); - - animation->setEasing("easeOutBounce(amplitude: 5)"); - QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::OutBounce); - QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().amplitude(), qreal(5)); - - animation->setEasing("easeOutElastic(amplitude: 5, period: 3)"); - QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::OutElastic); - QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().amplitude(), qreal(5)); - QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().period(), qreal(3)); - - animation->setEasing("easeInOutBack(overshoot: 2)"); - QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::InOutBack); - QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().overshoot(), qreal(2)); - - QTest::ignoreMessage(QtWarningMsg, "QML NumberAnimation (unknown location) Unmatched parenthesis in easing function \"easeInOutBack(overshoot: 2\""); - animation->setEasing("easeInOutBack(overshoot: 2"); - QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::Linear); - - QTest::ignoreMessage(QtWarningMsg, "QML NumberAnimation (unknown location) Easing function \"InOutBack(overshoot: 2)\" must start with \"ease\""); - animation->setEasing("InOutBack(overshoot: 2)"); - QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::Linear); - - QTest::ignoreMessage(QtWarningMsg, "QML NumberAnimation (unknown location) Unknown easing curve \"NonExistantEase\""); - animation->setEasing("NonExistantEase"); - QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::Linear); - - QTest::ignoreMessage(QtWarningMsg, "QML NumberAnimation (unknown location) Improperly specified parameter in easing function \"easeInOutElastic(amplitude 5)\""); - animation->setEasing("easeInOutElastic(amplitude 5)"); - QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::InOutElastic); - - QTest::ignoreMessage(QtWarningMsg, "QML NumberAnimation (unknown location) Improperly specified parameter in easing function \"easeInOutElastic(amplitude: yes)\""); - animation->setEasing("easeInOutElastic(amplitude: yes)"); - QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::InOutElastic); - QVERIFY(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().amplitude() != qreal(5)); - - QTest::ignoreMessage(QtWarningMsg, "QML NumberAnimation (unknown location) Unknown easing parameter \"nonexistentproperty\""); - animation->setEasing("easeOutQuad(nonexistentproperty: 12)"); - QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::OutQuad); - - delete animation; -} - void tst_qmlanimations::invalidDuration() { QmlPropertyAnimation *animation = new QmlPropertyAnimation; @@ -667,6 +616,57 @@ void tst_qmlanimations::dontStart() } } +void tst_qmlanimations::easingProperties() +{ + { + QmlEngine engine; + QString componentStr = "import Qt 4.6\nNumberAnimation { easing.type: \"InOutQuad\" }"; + QmlComponent animationComponent(&engine); + animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QmlPropertyAnimation *animObject = qobject_cast<QmlPropertyAnimation*>(animationComponent.create()); + + QVERIFY(animObject != 0); + QCOMPARE(animObject->easing().type(), QEasingCurve::InOutQuad); + } + + { + QmlEngine engine; + QString componentStr = "import Qt 4.6\nPropertyAnimation { easing.type: \"OutBounce\"; easing.amplitude: 5.0 }"; + QmlComponent animationComponent(&engine); + animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QmlPropertyAnimation *animObject = qobject_cast<QmlPropertyAnimation*>(animationComponent.create()); + + QVERIFY(animObject != 0); + QCOMPARE(animObject->easing().type(), QEasingCurve::OutBounce); + QCOMPARE(animObject->easing().amplitude(), 5.0); + } + + { + QmlEngine engine; + QString componentStr = "import Qt 4.6\nPropertyAnimation { easing.type: \"OutElastic\"; easing.amplitude: 5.0; easing.period: 3.0}"; + QmlComponent animationComponent(&engine); + animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QmlPropertyAnimation *animObject = qobject_cast<QmlPropertyAnimation*>(animationComponent.create()); + + QVERIFY(animObject != 0); + QCOMPARE(animObject->easing().type(), QEasingCurve::OutElastic); + QCOMPARE(animObject->easing().amplitude(), 5.0); + QCOMPARE(animObject->easing().period(), 3.0); + } + + { + QmlEngine engine; + QString componentStr = "import Qt 4.6\nPropertyAnimation { easing.type: \"InOutBack\"; easing.overshoot: 2 }"; + QmlComponent animationComponent(&engine); + animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QmlPropertyAnimation *animObject = qobject_cast<QmlPropertyAnimation*>(animationComponent.create()); + + QVERIFY(animObject != 0); + QCOMPARE(animObject->easing().type(), QEasingCurve::InOutBack); + QCOMPARE(animObject->easing().overshoot(), 2.0); + } +} + QTEST_MAIN(tst_qmlanimations) #include "tst_qmlanimations.moc" diff --git a/tests/auto/declarative/qmlgraphicsanchors/tst_qmlgraphicsanchors.cpp b/tests/auto/declarative/qmlgraphicsanchors/tst_qmlgraphicsanchors.cpp index aa6b56a..721608e 100644 --- a/tests/auto/declarative/qmlgraphicsanchors/tst_qmlgraphicsanchors.cpp +++ b/tests/auto/declarative/qmlgraphicsanchors/tst_qmlgraphicsanchors.cpp @@ -104,7 +104,6 @@ void tst_qmlgraphicsanchors::basicAnchors() QmlView *view = new QmlView; view->setSource(QUrl::fromLocalFile(SRCDIR "/data/anchors.qml")); - view->execute(); qApp->processEvents(); //sibling horizontal @@ -171,28 +170,28 @@ void tst_qmlgraphicsanchors::basicAnchors() void tst_qmlgraphicsanchors::loops() { { - QmlView *view = new QmlView; - - view->setSource(QUrl::fromLocalFile(SRCDIR "/data/loop1.qml")); + QUrl source(QUrl::fromLocalFile(SRCDIR "/data/loop1.qml")); - QString expect = "QML Text (" + view->source().toString() + ":6:5" + ") Possible anchor loop detected on horizontal anchor."; + QString expect = "QML Text (" + source.toString() + ":6:5" + ") Possible anchor loop detected on horizontal anchor."; QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); - view->execute(); + + QmlView *view = new QmlView; + view->setSource(source); qApp->processEvents(); delete view; } { - QmlView *view = new QmlView; + QUrl source(QUrl::fromLocalFile(SRCDIR "/data/loop2.qml")); - view->setSource(QUrl::fromLocalFile(SRCDIR "/data/loop2.qml")); - - QString expect = "QML Image (" + view->source().toString() + ":8:3" + ") Possible anchor loop detected on horizontal anchor."; + QString expect = "QML Image (" + source.toString() + ":8:3" + ") Possible anchor loop detected on horizontal anchor."; QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); - view->execute(); + + QmlView *view = new QmlView; + view->setSource(source); qApp->processEvents(); delete view; @@ -370,14 +369,13 @@ void tst_qmlgraphicsanchors::nullItem_data() void tst_qmlgraphicsanchors::crash1() { - QmlView *view = new QmlView; + QUrl source(QUrl::fromLocalFile(SRCDIR "/data/crash1.qml")); - view->setSource(QUrl::fromLocalFile(SRCDIR "/data/crash1.qml")); - - QString expect = "QML Text (" + view->source().toString() + ":4:5" + ") Possible anchor loop detected on fill."; + QString expect = "QML Text (" + source.toString() + ":4:5" + ") Possible anchor loop detected on fill."; QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); // XXX ideally, should be one message - view->execute(); + + QmlView *view = new QmlView(source); qApp->processEvents(); delete view; @@ -385,11 +383,8 @@ void tst_qmlgraphicsanchors::crash1() void tst_qmlgraphicsanchors::fill() { - QmlView *view = new QmlView; - - view->setSource(QUrl::fromLocalFile(SRCDIR "/data/fill.qml")); + QmlView *view = new QmlView(QUrl::fromLocalFile(SRCDIR "/data/fill.qml")); - view->execute(); qApp->processEvents(); QmlGraphicsRectangle* rect = findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("filler")); QCOMPARE(rect->x(), 0.0 + 10.0); @@ -411,11 +406,8 @@ void tst_qmlgraphicsanchors::fill() void tst_qmlgraphicsanchors::centerIn() { - QmlView *view = new QmlView; - - view->setSource(QUrl::fromLocalFile(SRCDIR "/data/centerin.qml")); + QmlView *view = new QmlView(QUrl::fromLocalFile(SRCDIR "/data/centerin.qml")); - view->execute(); qApp->processEvents(); QmlGraphicsRectangle* rect = findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("centered")); QCOMPARE(rect->x(), 75.0 + 10); @@ -431,11 +423,8 @@ void tst_qmlgraphicsanchors::centerIn() void tst_qmlgraphicsanchors::margins() { - QmlView *view = new QmlView; - - view->setSource(QUrl::fromLocalFile(SRCDIR "/data/margins.qml")); + QmlView *view = new QmlView(QUrl::fromLocalFile(SRCDIR "/data/margins.qml")); - view->execute(); qApp->processEvents(); QmlGraphicsRectangle* rect = findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("filler")); QCOMPARE(rect->x(), 5.0); diff --git a/tests/auto/declarative/qmlgraphicsgridview/tst_qmlgraphicsgridview.cpp b/tests/auto/declarative/qmlgraphicsgridview/tst_qmlgraphicsgridview.cpp index 2520d4a..7c8501c 100644 --- a/tests/auto/declarative/qmlgraphicsgridview/tst_qmlgraphicsgridview.cpp +++ b/tests/auto/declarative/qmlgraphicsgridview/tst_qmlgraphicsgridview.cpp @@ -68,7 +68,7 @@ private slots: void positionViewAtIndex(); private: - QmlView *createView(const QString &filename); + QmlView *createView(); template<typename T> T *findItem(QGraphicsObject *parent, const QString &id, int index=-1); template<typename T> @@ -142,7 +142,7 @@ tst_QmlGraphicsGridView::tst_QmlGraphicsGridView() void tst_QmlGraphicsGridView::items() { - QmlView *canvas = createView(SRCDIR "/data/gridview.qml"); + QmlView *canvas = createView(); TestModel model; model.addItem("Fred", "12345"); @@ -157,7 +157,7 @@ void tst_QmlGraphicsGridView::items() ctxt->setContextProperty("testModel", &model); ctxt->setContextProperty("testTopToBottom", QVariant(false)); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview.qml")); qApp->processEvents(); QmlGraphicsGridView *gridview = findItem<QmlGraphicsGridView>(canvas->rootObject(), "grid"); @@ -190,7 +190,7 @@ void tst_QmlGraphicsGridView::items() void tst_QmlGraphicsGridView::changed() { - QmlView *canvas = createView(SRCDIR "/data/gridview.qml"); + QmlView *canvas = createView(); TestModel model; model.addItem("Fred", "12345"); @@ -205,7 +205,7 @@ void tst_QmlGraphicsGridView::changed() ctxt->setContextProperty("testModel", &model); ctxt->setContextProperty("testTopToBottom", QVariant(false)); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview.qml")); qApp->processEvents(); QmlGraphicsFlickable *gridview = findItem<QmlGraphicsFlickable>(canvas->rootObject(), "grid"); @@ -227,7 +227,7 @@ void tst_QmlGraphicsGridView::changed() void tst_QmlGraphicsGridView::inserted() { - QmlView *canvas = createView(SRCDIR "/data/gridview.qml"); + QmlView *canvas = createView(); TestModel model; model.addItem("Fred", "12345"); @@ -238,7 +238,7 @@ void tst_QmlGraphicsGridView::inserted() ctxt->setContextProperty("testModel", &model); ctxt->setContextProperty("testTopToBottom", QVariant(false)); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview.qml")); qApp->processEvents(); QmlGraphicsGridView *gridview = findItem<QmlGraphicsGridView>(canvas->rootObject(), "grid"); @@ -309,7 +309,7 @@ void tst_QmlGraphicsGridView::inserted() void tst_QmlGraphicsGridView::removed() { - QmlView *canvas = createView(SRCDIR "/data/gridview.qml"); + QmlView *canvas = createView(); TestModel model; for (int i = 0; i < 40; i++) @@ -319,7 +319,7 @@ void tst_QmlGraphicsGridView::removed() ctxt->setContextProperty("testModel", &model); ctxt->setContextProperty("testTopToBottom", QVariant(false)); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview.qml")); qApp->processEvents(); QmlGraphicsGridView *gridview = findItem<QmlGraphicsGridView>(canvas->rootObject(), "grid"); @@ -469,7 +469,7 @@ void tst_QmlGraphicsGridView::removed() void tst_QmlGraphicsGridView::moved() { - QmlView *canvas = createView(SRCDIR "/data/gridview.qml"); + QmlView *canvas = createView(); TestModel model; for (int i = 0; i < 30; i++) @@ -479,7 +479,7 @@ void tst_QmlGraphicsGridView::moved() ctxt->setContextProperty("testModel", &model); ctxt->setContextProperty("testTopToBottom", QVariant(false)); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview.qml")); qApp->processEvents(); QmlGraphicsGridView *gridview = findItem<QmlGraphicsGridView>(canvas->rootObject(), "grid"); @@ -580,7 +580,6 @@ void tst_QmlGraphicsGridView::currentIndex() QString filename(SRCDIR "/data/gridview-initCurrent.qml"); canvas->setSource(QUrl::fromLocalFile(filename)); - canvas->execute(); qApp->processEvents(); QmlGraphicsGridView *gridview = findItem<QmlGraphicsGridView>(canvas->rootObject(), "grid"); @@ -690,7 +689,7 @@ void tst_QmlGraphicsGridView::currentIndex() void tst_QmlGraphicsGridView::changeFlow() { - QmlView *canvas = createView(SRCDIR "/data/gridview.qml"); + QmlView *canvas = createView(); TestModel model; for (int i = 0; i < 30; i++) @@ -700,7 +699,7 @@ void tst_QmlGraphicsGridView::changeFlow() ctxt->setContextProperty("testModel", &model); ctxt->setContextProperty("testTopToBottom", QVariant(false)); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview.qml")); qApp->processEvents(); QmlGraphicsGridView *gridview = findItem<QmlGraphicsGridView>(canvas->rootObject(), "grid"); @@ -795,7 +794,7 @@ void tst_QmlGraphicsGridView::properties() void tst_QmlGraphicsGridView::positionViewAtIndex() { - QmlView *canvas = createView(SRCDIR "/data/gridview.qml"); + QmlView *canvas = createView(); TestModel model; for (int i = 0; i < 40; i++) @@ -805,7 +804,7 @@ void tst_QmlGraphicsGridView::positionViewAtIndex() ctxt->setContextProperty("testModel", &model); ctxt->setContextProperty("testTopToBottom", QVariant(false)); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview.qml")); qApp->processEvents(); QmlGraphicsGridView *gridview = findItem<QmlGraphicsGridView>(canvas->rootObject(), "grid"); @@ -883,13 +882,11 @@ void tst_QmlGraphicsGridView::positionViewAtIndex() delete canvas; } -QmlView *tst_QmlGraphicsGridView::createView(const QString &filename) +QmlView *tst_QmlGraphicsGridView::createView() { QmlView *canvas = new QmlView(0); canvas->setFixedSize(240,320); - canvas->setSource(QUrl::fromLocalFile(filename)); - return canvas; } diff --git a/tests/auto/declarative/qmlgraphicsitem/tst_qmlgraphicsitem.cpp b/tests/auto/declarative/qmlgraphicsitem/tst_qmlgraphicsitem.cpp index 820a6de..1bface4 100644 --- a/tests/auto/declarative/qmlgraphicsitem/tst_qmlgraphicsitem.cpp +++ b/tests/auto/declarative/qmlgraphicsitem/tst_qmlgraphicsitem.cpp @@ -112,14 +112,12 @@ void tst_QmlGraphicsItem::keys() QmlView *canvas = new QmlView(0); canvas->setFixedSize(240,320); - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/keys.qml")); - KeysTestObject *testObject = new KeysTestObject; canvas->rootContext()->setContextProperty("keysTestObject", testObject); canvas->rootContext()->setContextProperty("enableKeyHanding", QVariant(true)); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/keys.qml")); canvas->show(); qApp->processEvents(); @@ -195,7 +193,6 @@ void tst_QmlGraphicsItem::keyNavigation() canvas->setFixedSize(240,320); canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/keynavigation.qml")); - canvas->execute(); canvas->show(); qApp->processEvents(); diff --git a/tests/auto/declarative/qmlgraphicslistview/data/listview.qml b/tests/auto/declarative/qmlgraphicslistview/data/listview.qml index 99b3db6..1c1b3f8 100644 --- a/tests/auto/declarative/qmlgraphicslistview/data/listview.qml +++ b/tests/auto/declarative/qmlgraphicslistview/data/listview.qml @@ -88,7 +88,7 @@ Rectangle { ScriptAction { script: console.log("Fix PropertyAction with attached properties") } /* PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: true } - NumberAnimation { target: wrapper; property: "scale"; to: 0; duration: 250; easing: "easeInOutQuad" } + NumberAnimation { target: wrapper; property: "scale"; to: 0; duration: 250; easing.type: "InOutQuad" } PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: false } */ } diff --git a/tests/auto/declarative/qmlgraphicslistview/tst_qmlgraphicslistview.cpp b/tests/auto/declarative/qmlgraphicslistview/tst_qmlgraphicslistview.cpp index 0876520..cf96ad5 100644 --- a/tests/auto/declarative/qmlgraphicslistview/tst_qmlgraphicslistview.cpp +++ b/tests/auto/declarative/qmlgraphicslistview/tst_qmlgraphicslistview.cpp @@ -88,7 +88,7 @@ private: template <class T> void removed(bool animated); template <class T> void moved(); template <class T> void clear(); - QmlView *createView(const QString &filename); + QmlView *createView(); template<typename T> T *findItem(QGraphicsObject *parent, const QString &id, int index=-1); template<typename T> @@ -300,7 +300,7 @@ tst_QmlGraphicsListView::tst_QmlGraphicsListView() template <class T> void tst_QmlGraphicsListView::items() { - QmlView *canvas = createView(SRCDIR "/data/listview.qml"); + QmlView *canvas = createView(); T model; model.addItem("Fred", "12345"); @@ -313,7 +313,7 @@ void tst_QmlGraphicsListView::items() TestObject *testObject = new TestObject; ctxt->setContextProperty("testObject", testObject); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview.qml")); qApp->processEvents(); QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "list"); @@ -380,7 +380,7 @@ void tst_QmlGraphicsListView::items() template <class T> void tst_QmlGraphicsListView::changed() { - QmlView *canvas = createView(SRCDIR "/data/listview.qml"); + QmlView *canvas = createView(); T model; model.addItem("Fred", "12345"); @@ -393,7 +393,7 @@ void tst_QmlGraphicsListView::changed() TestObject *testObject = new TestObject; ctxt->setContextProperty("testObject", testObject); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview.qml")); qApp->processEvents(); QmlGraphicsFlickable *listview = findItem<QmlGraphicsFlickable>(canvas->rootObject(), "list"); @@ -416,7 +416,7 @@ void tst_QmlGraphicsListView::changed() template <class T> void tst_QmlGraphicsListView::inserted() { - QmlView *canvas = createView(SRCDIR "/data/listview.qml"); + QmlView *canvas = createView(); T model; model.addItem("Fred", "12345"); @@ -429,7 +429,7 @@ void tst_QmlGraphicsListView::inserted() TestObject *testObject = new TestObject; ctxt->setContextProperty("testObject", testObject); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview.qml")); qApp->processEvents(); QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "list"); @@ -509,7 +509,7 @@ void tst_QmlGraphicsListView::inserted() template <class T> void tst_QmlGraphicsListView::removed(bool animated) { - QmlView *canvas = createView(SRCDIR "/data/listview.qml"); + QmlView *canvas = createView(); T model; for (int i = 0; i < 30; i++) @@ -522,7 +522,7 @@ void tst_QmlGraphicsListView::removed(bool animated) testObject->setAnimate(animated); ctxt->setContextProperty("testObject", testObject); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview.qml")); qApp->processEvents(); QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "list"); @@ -652,7 +652,7 @@ void tst_QmlGraphicsListView::removed(bool animated) template <class T> void tst_QmlGraphicsListView::clear() { - QmlView *canvas = createView(SRCDIR "/data/listview.qml"); + QmlView *canvas = createView(); T model; for (int i = 0; i < 30; i++) @@ -664,7 +664,7 @@ void tst_QmlGraphicsListView::clear() TestObject *testObject = new TestObject; ctxt->setContextProperty("testObject", testObject); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview.qml")); qApp->processEvents(); QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "list"); @@ -689,7 +689,7 @@ void tst_QmlGraphicsListView::clear() template <class T> void tst_QmlGraphicsListView::moved() { - QmlView *canvas = createView(SRCDIR "/data/listview.qml"); + QmlView *canvas = createView(); T model; for (int i = 0; i < 30; i++) @@ -701,7 +701,7 @@ void tst_QmlGraphicsListView::moved() TestObject *testObject = new TestObject; ctxt->setContextProperty("testObject", testObject); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview.qml")); qApp->processEvents(); QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "list"); @@ -785,7 +785,7 @@ void tst_QmlGraphicsListView::moved() void tst_QmlGraphicsListView::enforceRange() { - QmlView *canvas = createView(SRCDIR "/data/listview-enforcerange.qml"); + QmlView *canvas = createView(); TestModel model; for (int i = 0; i < 30; i++) @@ -794,7 +794,7 @@ void tst_QmlGraphicsListView::enforceRange() QmlContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testModel", &model); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview-enforcerange.qml")); qApp->processEvents(); QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "list"); @@ -830,7 +830,7 @@ void tst_QmlGraphicsListView::enforceRange() void tst_QmlGraphicsListView::spacing() { - QmlView *canvas = createView(SRCDIR "/data/listview.qml"); + QmlView *canvas = createView(); TestModel model; for (int i = 0; i < 30; i++) @@ -842,7 +842,7 @@ void tst_QmlGraphicsListView::spacing() TestObject *testObject = new TestObject; ctxt->setContextProperty("testObject", testObject); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview.qml")); qApp->processEvents(); QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "list"); @@ -888,7 +888,7 @@ void tst_QmlGraphicsListView::spacing() void tst_QmlGraphicsListView::sections() { - QmlView *canvas = createView(SRCDIR "/data/listview-sections.qml"); + QmlView *canvas = createView(); TestModel model; for (int i = 0; i < 30; i++) @@ -897,7 +897,7 @@ void tst_QmlGraphicsListView::sections() QmlContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testModel", &model); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview-sections.qml")); qApp->processEvents(); QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "list"); @@ -975,7 +975,6 @@ void tst_QmlGraphicsListView::currentIndex() QString filename(SRCDIR "/data/listview-initCurrent.qml"); canvas->setSource(QUrl::fromLocalFile(filename)); - canvas->execute(); qApp->processEvents(); QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "list"); @@ -1055,9 +1054,9 @@ void tst_QmlGraphicsListView::currentIndex() void tst_QmlGraphicsListView::itemList() { - QmlView *canvas = createView(SRCDIR "/data/itemlist.qml"); + QmlView *canvas = createView(); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/itemlist.qml")); qApp->processEvents(); QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "view"); @@ -1096,7 +1095,7 @@ void tst_QmlGraphicsListView::itemList() void tst_QmlGraphicsListView::cacheBuffer() { - QmlView *canvas = createView(SRCDIR "/data/listview.qml"); + QmlView *canvas = createView(); TestModel model; for (int i = 0; i < 30; i++) @@ -1108,7 +1107,7 @@ void tst_QmlGraphicsListView::cacheBuffer() TestObject *testObject = new TestObject; ctxt->setContextProperty("testObject", testObject); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview.qml")); qApp->processEvents(); QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "list"); @@ -1148,7 +1147,7 @@ void tst_QmlGraphicsListView::cacheBuffer() void tst_QmlGraphicsListView::positionViewAtIndex() { - QmlView *canvas = createView(SRCDIR "/data/listview.qml"); + QmlView *canvas = createView(); TestModel model; for (int i = 0; i < 40; i++) @@ -1160,7 +1159,7 @@ void tst_QmlGraphicsListView::positionViewAtIndex() TestObject *testObject = new TestObject; ctxt->setContextProperty("testObject", testObject); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview.qml")); qApp->processEvents(); QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "list"); @@ -1295,13 +1294,11 @@ void tst_QmlGraphicsListView::qAbstractItemModel_clear() clear<TestModel2>(); } -QmlView *tst_QmlGraphicsListView::createView(const QString &filename) +QmlView *tst_QmlGraphicsListView::createView() { QmlView *canvas = new QmlView(0); canvas->setFixedSize(240,320); - canvas->setSource(QUrl::fromLocalFile(filename)); - return canvas; } diff --git a/tests/auto/declarative/qmlgraphicsmousearea/tst_qmlgraphicsmousearea.cpp b/tests/auto/declarative/qmlgraphicsmousearea/tst_qmlgraphicsmousearea.cpp index 869a7bd..22a12a9 100644 --- a/tests/auto/declarative/qmlgraphicsmousearea/tst_qmlgraphicsmousearea.cpp +++ b/tests/auto/declarative/qmlgraphicsmousearea/tst_qmlgraphicsmousearea.cpp @@ -56,7 +56,6 @@ private: void tst_QmlGraphicsMouseArea::dragProperties() { QmlView *canvas = createView(SRCDIR "/data/dragproperties.qml"); - canvas->execute(); canvas->show(); canvas->setFocus(); QVERIFY(canvas->rootObject() != 0); diff --git a/tests/auto/declarative/qmlgraphicsparticles/data/particlemotion.qml b/tests/auto/declarative/qmlgraphicsparticles/data/particlemotion.qml new file mode 100644 index 0000000..ace61fe --- /dev/null +++ b/tests/auto/declarative/qmlgraphicsparticles/data/particlemotion.qml @@ -0,0 +1,33 @@ +import Qt 4.6 +Rectangle { + width: 240 + height: 320 + color: "black" + Particles { + objectName: "particles" + anchors.fill: parent + width: 1 + height: 1 + source: "particle.png" + lifeSpan: 5000 + count: 200 + angle: 270 + angleDeviation: 45 + velocity: 50 + velocityDeviation: 30 + ParticleMotionGravity { + objectName: "motionGravity" + yattractor: 1000 + xattractor: 0 + acceleration: 25 + } + } + resources: [ + ParticleMotionWander { + objectName: "motionWander" + xvariance: 30 + yvariance: 30 + pace: 100 + } + ] +}
\ No newline at end of file diff --git a/tests/auto/declarative/qmlgraphicsparticles/tst_qmlgraphicsparticles.cpp b/tests/auto/declarative/qmlgraphicsparticles/tst_qmlgraphicsparticles.cpp index a5c0b78..9436772 100644 --- a/tests/auto/declarative/qmlgraphicsparticles/tst_qmlgraphicsparticles.cpp +++ b/tests/auto/declarative/qmlgraphicsparticles/tst_qmlgraphicsparticles.cpp @@ -39,6 +39,7 @@ ** ****************************************************************************/ #include <QtTest/QtTest> +#include <QtTest/QSignalSpy> #include <qmlview.h> #include <private/qmlgraphicsparticles_p.h> @@ -50,6 +51,8 @@ public: private slots: void properties(); + void motionGravity(); + void motionWander(); void runs(); private: QmlView *createView(const QString &filename); @@ -98,6 +101,91 @@ void tst_QmlGraphicsParticles::properties() QCOMPARE(particles->emissionRate(), 12); } +void tst_QmlGraphicsParticles::motionGravity() +{ + QmlView *canvas = createView(SRCDIR "/data/particlemotion.qml"); + QVERIFY(canvas->rootObject()); + QmlGraphicsParticles* particles = canvas->rootObject()->findChild<QmlGraphicsParticles*>("particles"); + QVERIFY(particles); + + QmlGraphicsParticleMotionGravity* motionGravity = canvas->rootObject()->findChild<QmlGraphicsParticleMotionGravity*>("motionGravity"); + QCOMPARE(particles->motion(), motionGravity); + + QSignalSpy xattractorSpy(motionGravity, SIGNAL(xattractorChanged())); + QSignalSpy yattractorSpy(motionGravity, SIGNAL(yattractorChanged())); + QSignalSpy accelerationSpy(motionGravity, SIGNAL(accelerationChanged())); + + QCOMPARE(motionGravity->xAttractor(), 0.0); + QCOMPARE(motionGravity->yAttractor(), 1000.0); + QCOMPARE(motionGravity->acceleration(), 25.0); + + motionGravity->setXAttractor(20.0); + motionGravity->setYAttractor(10.0); + motionGravity->setAcceleration(10.0); + + QCOMPARE(motionGravity->xAttractor(), 20.0); + QCOMPARE(motionGravity->yAttractor(), 10.0); + QCOMPARE(motionGravity->acceleration(), 10.0); + + QCOMPARE(xattractorSpy.count(), 1); + QCOMPARE(yattractorSpy.count(), 1); + QCOMPARE(accelerationSpy.count(), 1); + + motionGravity->setXAttractor(20.0); + motionGravity->setYAttractor(10.0); + motionGravity->setAcceleration(10.0); + + QCOMPARE(xattractorSpy.count(), 1); + QCOMPARE(yattractorSpy.count(), 1); + QCOMPARE(accelerationSpy.count(), 1); +} + +void tst_QmlGraphicsParticles::motionWander() +{ + QmlView *canvas = createView(SRCDIR "/data/particlemotion.qml"); + QVERIFY(canvas->rootObject()); + QmlGraphicsParticles* particles = canvas->rootObject()->findChild<QmlGraphicsParticles*>("particles"); + QVERIFY(particles); + + QSignalSpy motionSpy(particles, SIGNAL(motionChanged())); + QmlGraphicsParticleMotionWander* motionWander = canvas->rootObject()->findChild<QmlGraphicsParticleMotionWander*>("motionWander"); + + particles->setMotion(motionWander); + QCOMPARE(particles->motion(),motionWander); + QCOMPARE(motionSpy.count(), 1); + + particles->setMotion(motionWander); + QCOMPARE(motionSpy.count(), 1); + + QSignalSpy xvarianceSpy(motionWander, SIGNAL(xvarianceChanged())); + QSignalSpy yvarianceSpy(motionWander, SIGNAL(yvarianceChanged())); + QSignalSpy paceSpy(motionWander, SIGNAL(paceChanged())); + + QCOMPARE(motionWander->xVariance(), 30.0); + QCOMPARE(motionWander->yVariance(), 30.0); + QCOMPARE(motionWander->pace(), 100.0); + + motionWander->setXVariance(20.0); + motionWander->setYVariance(10.0); + motionWander->setPace(10.0); + + QCOMPARE(motionWander->xVariance(), 20.0); + QCOMPARE(motionWander->yVariance(), 10.0); + QCOMPARE(motionWander->pace(), 10.0); + + QCOMPARE(xvarianceSpy.count(), 1); + QCOMPARE(yvarianceSpy.count(), 1); + QCOMPARE(paceSpy.count(), 1); + + motionWander->setXVariance(20.0); + motionWander->setYVariance(10.0); + motionWander->setPace(10.0); + + QCOMPARE(xvarianceSpy.count(), 1); + QCOMPARE(yvarianceSpy.count(), 1); + QCOMPARE(paceSpy.count(), 1); +} + void tst_QmlGraphicsParticles::runs() { QmlView *canvas = createView(SRCDIR "/data/particles.qml"); @@ -113,7 +201,6 @@ QmlView *tst_QmlGraphicsParticles::createView(const QString &filename) canvas->setFixedSize(240,320); canvas->setSource(QUrl::fromLocalFile(filename)); - canvas->execute(); return canvas; } diff --git a/tests/auto/declarative/qmlgraphicspathview/tst_qmlgraphicspathview.cpp b/tests/auto/declarative/qmlgraphicspathview/tst_qmlgraphicspathview.cpp index 62b3cfc..b57142e 100644 --- a/tests/auto/declarative/qmlgraphicspathview/tst_qmlgraphicspathview.cpp +++ b/tests/auto/declarative/qmlgraphicspathview/tst_qmlgraphicspathview.cpp @@ -69,7 +69,7 @@ private slots: void pathMoved(); private: - QmlView *createView(const QString &filename); + QmlView *createView(); template<typename T> T *findItem(QGraphicsObject *parent, const QString &objectName, int index=-1); template<typename T> @@ -191,7 +191,7 @@ void tst_QmlGraphicsPathView::initValues() void tst_QmlGraphicsPathView::items() { - QmlView *canvas = createView(SRCDIR "/data/pathview.qml"); + QmlView *canvas = createView(); TestModel model; model.addItem("Fred", "12345"); @@ -201,7 +201,7 @@ void tst_QmlGraphicsPathView::items() QmlContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testModel", &model); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pathview.qml")); qApp->processEvents(); QmlGraphicsPathView *pathview = findItem<QmlGraphicsPathView>(canvas->rootObject(), "view"); @@ -304,7 +304,7 @@ void tst_QmlGraphicsPathView::path() void tst_QmlGraphicsPathView::dataModel() { - QmlView *canvas = createView(SRCDIR "/data/datamodel.qml"); + QmlView *canvas = createView(); QmlContext *ctxt = canvas->rootContext(); TestObject *testObject = new TestObject; @@ -323,7 +323,7 @@ void tst_QmlGraphicsPathView::dataModel() ctxt->setContextProperty("testData", &model); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/datamodel.qml")); qApp->processEvents(); QmlGraphicsPathView *pathview = qobject_cast<QmlGraphicsPathView*>(canvas->rootObject()); @@ -384,7 +384,7 @@ void tst_QmlGraphicsPathView::dataModel() void tst_QmlGraphicsPathView::pathMoved() { - QmlView *canvas = createView(SRCDIR "/data/pathview.qml"); + QmlView *canvas = createView(); TestModel model; model.addItem("Ben", "12345"); @@ -395,7 +395,7 @@ void tst_QmlGraphicsPathView::pathMoved() QmlContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testModel", &model); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pathview.qml")); qApp->processEvents(); QmlGraphicsPathView *pathview = findItem<QmlGraphicsPathView>(canvas->rootObject(), "view"); @@ -425,13 +425,11 @@ void tst_QmlGraphicsPathView::pathMoved() delete canvas; } -QmlView *tst_QmlGraphicsPathView::createView(const QString &filename) +QmlView *tst_QmlGraphicsPathView::createView() { QmlView *canvas = new QmlView(0); canvas->setFixedSize(240,320); - canvas->setSource(QUrl::fromLocalFile(filename)); - return canvas; } diff --git a/tests/auto/declarative/qmlgraphicspositioners/data/propertychanges.qml b/tests/auto/declarative/qmlgraphicspositioners/data/propertychanges.qml new file mode 100644 index 0000000..c3dc7bf --- /dev/null +++ b/tests/auto/declarative/qmlgraphicspositioners/data/propertychanges.qml @@ -0,0 +1,39 @@ +import Qt 4.6 + +Grid { + id: myGrid + + width: 270 + height: 270 + x: 3 + y: 3 + columns: 4 + spacing: 3 + + add: columnTransition + move: columnTransition + + Repeater { + model: 20 + Rectangle { color: "black"; width: 50; height: 50 } + } + + data: [ + Transition { + id: rowTransition + objectName: "rowTransition" + NumberAnimation { + properties: "x,y"; + easing: "easeOutInCubic" + } + }, + Transition { + id: columnTransition + objectName: "columnTransition" + NumberAnimation { + properties: "x,y"; + easing: "easeOutInCubic" + } + } + ] +} diff --git a/tests/auto/declarative/qmlgraphicspositioners/tst_qmlgraphicspositioners.cpp b/tests/auto/declarative/qmlgraphicspositioners/tst_qmlgraphicspositioners.cpp index b51266a..5089dc5 100644 --- a/tests/auto/declarative/qmlgraphicspositioners/tst_qmlgraphicspositioners.cpp +++ b/tests/auto/declarative/qmlgraphicspositioners/tst_qmlgraphicspositioners.cpp @@ -42,6 +42,8 @@ #include <private/qlistmodelinterface_p.h> #include <qmlview.h> #include <private/qmlgraphicsrectangle_p.h> +#include <private/qmlgraphicspositioners_p.h> +#include <private/qmltransition_p.h> #include <qmlexpression.h> #include "../../../shared/util.h" @@ -61,7 +63,7 @@ private slots: void test_grid(); void test_grid_spacing(); void test_grid_animated(); - + void test_propertychanges(); void test_repeater(); private: QmlView *createView(const QString &filename); @@ -75,8 +77,6 @@ void tst_QmlGraphicsPositioners::test_horizontal() { QmlView *canvas = createView(SRCDIR "/data/horizontal.qml"); - canvas->execute(); - QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one"); QVERIFY(one != 0); @@ -98,8 +98,6 @@ void tst_QmlGraphicsPositioners::test_horizontal_spacing() { QmlView *canvas = createView(SRCDIR "/data/horizontal-spacing.qml"); - canvas->execute(); - QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one"); QVERIFY(one != 0); @@ -121,8 +119,6 @@ void tst_QmlGraphicsPositioners::test_horizontal_animated() { QmlView *canvas = createView(SRCDIR "/data/horizontal-animated.qml"); - canvas->execute(); - QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one"); QVERIFY(one != 0); @@ -163,8 +159,6 @@ void tst_QmlGraphicsPositioners::test_vertical() { QmlView *canvas = createView(SRCDIR "/data/vertical.qml"); - canvas->execute(); - QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one"); QVERIFY(one != 0); @@ -186,8 +180,6 @@ void tst_QmlGraphicsPositioners::test_vertical_spacing() { QmlView *canvas = createView(SRCDIR "/data/vertical-spacing.qml"); - canvas->execute(); - QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one"); QVERIFY(one != 0); @@ -209,8 +201,6 @@ void tst_QmlGraphicsPositioners::test_vertical_animated() { QmlView *canvas = createView(SRCDIR "/data/vertical-animated.qml"); - canvas->execute(); - //Note that they animate in QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one"); QVERIFY(one != 0); @@ -251,8 +241,6 @@ void tst_QmlGraphicsPositioners::test_grid() { QmlView *canvas = createView("data/grid.qml"); - canvas->execute(); - QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one"); QVERIFY(one != 0); QmlGraphicsRectangle *two = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("two"); @@ -280,8 +268,6 @@ void tst_QmlGraphicsPositioners::test_grid_spacing() { QmlView *canvas = createView("data/grid-spacing.qml"); - canvas->execute(); - QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one"); QVERIFY(one != 0); QmlGraphicsRectangle *two = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("two"); @@ -308,7 +294,6 @@ void tst_QmlGraphicsPositioners::test_grid_spacing() void tst_QmlGraphicsPositioners::test_grid_animated() { QmlView *canvas = createView(SRCDIR "/data/grid-animated.qml"); - canvas->execute(); //Note that all animate in QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one"); @@ -378,13 +363,66 @@ void tst_QmlGraphicsPositioners::test_grid_animated() QTRY_COMPARE(five->y(), 50.0); } +void tst_QmlGraphicsPositioners::test_propertychanges() +{ + QmlView *canvas = createView("data/propertychanges.qml"); + + QmlGraphicsGrid *grid = qobject_cast<QmlGraphicsGrid*>(canvas->rootObject()); + QmlTransition *rowTransition = canvas->rootObject()->findChild<QmlTransition*>("rowTransition"); + QmlTransition *columnTransition = canvas->rootObject()->findChild<QmlTransition*>("columnTransition"); + + QSignalSpy addSpy(grid, SIGNAL(addChanged())); + QSignalSpy moveSpy(grid, SIGNAL(moveChanged())); + QSignalSpy columnsSpy(grid, SIGNAL(columnsChanged())); + QSignalSpy rowsSpy(grid, SIGNAL(rowsChanged())); + + QVERIFY(grid); + QVERIFY(rowTransition); + QVERIFY(columnTransition); + QCOMPARE(grid->add(), columnTransition); + QCOMPARE(grid->move(), columnTransition); + QCOMPARE(grid->columns(), 4); + QCOMPARE(grid->rows(), -1); + + grid->setAdd(rowTransition); + grid->setMove(rowTransition); + QCOMPARE(grid->add(), rowTransition); + QCOMPARE(grid->move(), rowTransition); + QCOMPARE(addSpy.count(),1); + QCOMPARE(moveSpy.count(),1); + + grid->setAdd(rowTransition); + grid->setMove(rowTransition); + QCOMPARE(addSpy.count(),1); + QCOMPARE(moveSpy.count(),1); + + grid->setAdd(0); + grid->setMove(0); + QCOMPARE(addSpy.count(),2); + QCOMPARE(moveSpy.count(),2); + + grid->setColumns(-1); + grid->setRows(3); + QCOMPARE(grid->columns(), -1); + QCOMPARE(grid->rows(), 3); + QCOMPARE(columnsSpy.count(),1); + QCOMPARE(rowsSpy.count(),1); + + grid->setColumns(-1); + grid->setRows(3); + QCOMPARE(columnsSpy.count(),1); + QCOMPARE(rowsSpy.count(),1); + + grid->setColumns(2); + grid->setRows(2); + QCOMPARE(columnsSpy.count(),2); + QCOMPARE(rowsSpy.count(),2); +} void tst_QmlGraphicsPositioners::test_repeater() { QmlView *canvas = createView("data/repeater.qml"); - canvas->execute(); - QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one"); QVERIFY(one != 0); diff --git a/tests/auto/declarative/qmlgraphicsrepeater/tst_qmlgraphicsrepeater.cpp b/tests/auto/declarative/qmlgraphicsrepeater/tst_qmlgraphicsrepeater.cpp index c971840..9f3ff45 100644 --- a/tests/auto/declarative/qmlgraphicsrepeater/tst_qmlgraphicsrepeater.cpp +++ b/tests/auto/declarative/qmlgraphicsrepeater/tst_qmlgraphicsrepeater.cpp @@ -68,7 +68,7 @@ private slots: void properties(); private: - QmlView *createView(const QString &filename); + QmlView *createView(); template<typename T> T *findItem(QGraphicsObject *parent, const QString &id); }; @@ -164,14 +164,14 @@ tst_QmlGraphicsRepeater::tst_QmlGraphicsRepeater() void tst_QmlGraphicsRepeater::numberModel() { - QmlView *canvas = createView(SRCDIR "/data/intmodel.qml"); + QmlView *canvas = createView(); QmlContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testData", 5); TestObject *testObject = new TestObject; ctxt->setContextProperty("testObject", testObject); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/intmodel.qml")); qApp->processEvents(); QmlGraphicsRepeater *repeater = findItem<QmlGraphicsRepeater>(canvas->rootObject(), "repeater"); @@ -186,7 +186,7 @@ void tst_QmlGraphicsRepeater::numberModel() void tst_QmlGraphicsRepeater::objectList() { - QmlView *canvas = createView(SRCDIR "/data/objlist.qml"); + QmlView *canvas = createView(); QObjectList data; for(int i=0; i<100; i++){ @@ -197,7 +197,7 @@ void tst_QmlGraphicsRepeater::objectList() QmlContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testData", QVariant::fromValue(data)); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/objlist.qml")); qApp->processEvents(); QmlGraphicsRepeater *repeater = findItem<QmlGraphicsRepeater>(canvas->rootObject(), "repeater"); @@ -213,7 +213,7 @@ elements to test this. */ void tst_QmlGraphicsRepeater::stringList() { - QmlView *canvas = createView(SRCDIR "/data/repeater.qml"); + QmlView *canvas = createView(); QStringList data; data << "One"; @@ -224,7 +224,7 @@ void tst_QmlGraphicsRepeater::stringList() QmlContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testData", data); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/repeater.qml")); qApp->processEvents(); QmlGraphicsRepeater *repeater = findItem<QmlGraphicsRepeater>(canvas->rootObject(), "repeater"); @@ -265,7 +265,7 @@ void tst_QmlGraphicsRepeater::stringList() void tst_QmlGraphicsRepeater::dataModel() { - QmlView *canvas = createView(SRCDIR "/data/repeater2.qml"); + QmlView *canvas = createView(); QmlContext *ctxt = canvas->rootContext(); TestObject *testObject = new TestObject; ctxt->setContextProperty("testObject", testObject); @@ -277,7 +277,7 @@ void tst_QmlGraphicsRepeater::dataModel() ctxt->setContextProperty("testData", &testModel); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/repeater2.qml")); qApp->processEvents(); QmlGraphicsRepeater *repeater = findItem<QmlGraphicsRepeater>(canvas->rootObject(), "repeater"); @@ -297,12 +297,12 @@ void tst_QmlGraphicsRepeater::dataModel() void tst_QmlGraphicsRepeater::itemModel() { - QmlView *canvas = createView(SRCDIR "/data/itemlist.qml"); + QmlView *canvas = createView(); QmlContext *ctxt = canvas->rootContext(); TestObject *testObject = new TestObject; ctxt->setContextProperty("testObject", testObject); - canvas->execute(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/itemlist.qml")); qApp->processEvents(); QmlGraphicsRepeater *repeater = findItem<QmlGraphicsRepeater>(canvas->rootObject(), "repeater"); @@ -354,13 +354,11 @@ void tst_QmlGraphicsRepeater::properties() QCOMPARE(delegateSpy.count(),1); } -QmlView *tst_QmlGraphicsRepeater::createView(const QString &filename) +QmlView *tst_QmlGraphicsRepeater::createView() { QmlView *canvas = new QmlView(0); canvas->setFixedSize(240,320); - canvas->setSource(QUrl::fromLocalFile(filename)); - return canvas; } diff --git a/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp b/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp index cc2f929..0d6ac77 100644 --- a/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp +++ b/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp @@ -604,7 +604,6 @@ void tst_qmlgraphicstextedit::selection() void tst_qmlgraphicstextedit::inputMethodHints() { QmlView *canvas = createView(SRCDIR "/data/inputmethodhints.qml"); - canvas->execute(); canvas->show(); canvas->setFocus(); @@ -619,7 +618,6 @@ void tst_qmlgraphicstextedit::inputMethodHints() void tst_qmlgraphicstextedit::cursorDelegate() { QmlView* view = createView(SRCDIR "/data/cursorTest.qml"); - view->execute(); view->show(); view->setFocus(); QmlGraphicsTextEdit *textEditObject = view->rootObject()->findChild<QmlGraphicsTextEdit*>("textEditObject"); @@ -651,7 +649,6 @@ void tst_qmlgraphicstextedit::delegateLoading() server.serveDirectory(SRCDIR "/data/http"); QmlView* view = new QmlView(0); view->setSource(QUrl("http://localhost:42332/cursorHttpTestPass.qml")); - view->execute(); view->show(); view->setFocus(); QTRY_VERIFY(view->rootObject());//Wait for loading to finish. @@ -665,12 +662,10 @@ void tst_qmlgraphicstextedit::delegateLoading() delegate = view->rootObject()->findChild<QmlGraphicsItem*>("delegateSlow"); QVERIFY(delegate); view->setSource(QUrl("http://localhost:42332/cursorHttpTestFail1.qml")); - view->execute(); view->show(); view->setFocus(); QTRY_VERIFY(!view->rootObject()); // there is fail item inside this test view->setSource(QUrl("http://localhost:42332/cursorHttpTestFail2.qml")); - view->execute(); view->show(); view->setFocus(); QTRY_VERIFY(!view->rootObject()); // there is fail item inside this test @@ -688,7 +683,6 @@ the extent of the text, then they should ignore the keys. void tst_qmlgraphicstextedit::navigation() { QmlView *canvas = createView(SRCDIR "/data/navigation.qml"); - canvas->execute(); canvas->show(); canvas->setFocus(); @@ -711,7 +705,6 @@ void tst_qmlgraphicstextedit::navigation() void tst_qmlgraphicstextedit::readOnly() { QmlView *canvas = createView(SRCDIR "/data/readOnly.qml"); - canvas->execute(); canvas->show(); canvas->setFocus(); diff --git a/tests/auto/declarative/qmlgraphicstextinput/tst_qmlgraphicstextinput.cpp b/tests/auto/declarative/qmlgraphicstextinput/tst_qmlgraphicstextinput.cpp index 8b45fc7..748cf5e 100644 --- a/tests/auto/declarative/qmlgraphicstextinput/tst_qmlgraphicstextinput.cpp +++ b/tests/auto/declarative/qmlgraphicstextinput/tst_qmlgraphicstextinput.cpp @@ -349,7 +349,6 @@ void tst_qmlgraphicstextinput::maxLength() { //QString componentStr = "import Qt 4.6\nTextInput { maximumLength: 10; }"; QmlView *canvas = createView(SRCDIR "/data/maxLength.qml"); - canvas->execute(); canvas->show(); canvas->setFocus(); QVERIFY(canvas->rootObject() != 0); @@ -378,7 +377,6 @@ void tst_qmlgraphicstextinput::masks() //Not a comprehensive test of the possible masks, that's done elsewhere (QLineEdit) //QString componentStr = "import Qt 4.6\nTextInput { inputMask: 'HHHHhhhh'; }"; QmlView *canvas = createView(SRCDIR "/data/masks.qml"); - canvas->execute(); canvas->show(); canvas->setFocus(); QVERIFY(canvas->rootObject() != 0); @@ -403,7 +401,6 @@ void tst_qmlgraphicstextinput::validators() // here to ensure that their exposure to QML is working. QmlView *canvas = createView(SRCDIR "/data/validators.qml"); - canvas->execute(); canvas->show(); canvas->setFocus(); @@ -493,7 +490,6 @@ void tst_qmlgraphicstextinput::validators() void tst_qmlgraphicstextinput::inputMethodHints() { QmlView *canvas = createView(SRCDIR "/data/inputmethodhints.qml"); - canvas->execute(); canvas->show(); canvas->setFocus(); @@ -513,7 +509,6 @@ the extent of the text, then they should ignore the keys. void tst_qmlgraphicstextinput::navigation() { QmlView *canvas = createView(SRCDIR "/data/navigation.qml"); - canvas->execute(); canvas->show(); canvas->setFocus(); @@ -546,7 +541,6 @@ void tst_qmlgraphicstextinput::navigation() void tst_qmlgraphicstextinput::cursorDelegate() { QmlView* view = createView(SRCDIR "/data/cursorTest.qml"); - view->execute(); view->show(); view->setFocus(); QmlGraphicsTextInput *textInputObject = view->rootObject()->findChild<QmlGraphicsTextInput*>("textInputObject"); @@ -574,7 +568,6 @@ void tst_qmlgraphicstextinput::cursorDelegate() void tst_qmlgraphicstextinput::readOnly() { QmlView *canvas = createView(SRCDIR "/data/readOnly.qml"); - canvas->execute(); canvas->show(); canvas->setFocus(); diff --git a/tests/auto/declarative/qmlgraphicswebview/data/propertychanges.qml b/tests/auto/declarative/qmlgraphicswebview/data/propertychanges.qml new file mode 100644 index 0000000..3dd4e51 --- /dev/null +++ b/tests/auto/declarative/qmlgraphicswebview/data/propertychanges.qml @@ -0,0 +1,33 @@ +import Qt 4.6 + +Item { + width: 240 + height: 160 + Grid { + anchors.fill: parent + objectName: "newWindowParent" + id: newWindowParent + } + + Row { + anchors.fill: parent + id: oldWindowParent + objectName: "oldWindowParent" + } + + Loader { + sourceComponent: webViewComponent + } + Component { + id: webViewComponent + WebView { + id: webView + objectName: "webView" + newWindowComponent: webViewComponent + newWindowParent: oldWindowParent + url: "basic.html" + renderingEnabled: true + pressGrabTime: 200 + } + } +}
\ No newline at end of file diff --git a/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp b/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp index f3c39f8..5815e22 100644 --- a/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp +++ b/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp @@ -39,6 +39,7 @@ ** ****************************************************************************/ #include <qtest.h> +#include <QtTest/QSignalSpy> #include "../../../shared/util.h" #include <QtDeclarative/qmlengine.h> #include <QtDeclarative/qmlcomponent.h> @@ -69,6 +70,10 @@ private slots: void javaScript(); void cleanupTestCase(); void pixelCache(); + void newWindowParent(); + void newWindowComponent(); + void renderingEnabled(); + void pressGrabTime(); private: void checkNoErrors(const QmlComponent& component); @@ -335,6 +340,10 @@ void tst_qmlgraphicswebview::setHtml() QmlGraphicsWebView *wv = qobject_cast<QmlGraphicsWebView*>(component.create()); QVERIFY(wv != 0); QCOMPARE(wv->html(),QString("<html><head></head><body><p>This is a <b>string</b> set on the WebView</p></body></html>")); + + QSignalSpy spy(wv, SIGNAL(htmlChanged())); + wv->setHtml(QString("<html><head><title>Basic</title></head><body><p>text</p></body></html>")); + QCOMPARE(spy.count(),1); } void tst_qmlgraphicswebview::elementAreaAt() @@ -391,6 +400,106 @@ void tst_qmlgraphicswebview::pixelCache() QCOMPARE(wv->pixelsPainted(), expected*3); // repainted } +void tst_qmlgraphicswebview::newWindowParent() +{ + QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml")); + checkNoErrors(component); + QmlGraphicsItem *rootItem = qobject_cast<QmlGraphicsItem*>(component.create()); + QmlGraphicsWebView *wv = rootItem->findChild<QmlGraphicsWebView*>("webView"); + QVERIFY(rootItem != 0); + QVERIFY(wv != 0); + QTRY_COMPARE(wv->progress(), 1.0); + + QmlGraphicsItem* oldWindowParent = rootItem->findChild<QmlGraphicsItem*>("oldWindowParent"); + QCOMPARE(wv->newWindowParent(), oldWindowParent); + QSignalSpy newWindowParentSpy(wv, SIGNAL(newWindowParentChanged())); + + QmlGraphicsItem* newWindowParent = rootItem->findChild<QmlGraphicsItem*>("newWindowParent"); + wv->setNewWindowParent(newWindowParent); + QVERIFY(oldWindowParent); + QVERIFY(oldWindowParent->childItems().count() == 0); + QCOMPARE(wv->newWindowParent(), newWindowParent); + QCOMPARE(newWindowParentSpy.count(),1); + + wv->setNewWindowParent(newWindowParent); + QCOMPARE(newWindowParentSpy.count(),1); + + wv->setNewWindowParent(0); + QCOMPARE(newWindowParentSpy.count(),2); +} + +void tst_qmlgraphicswebview::newWindowComponent() +{ + QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml")); + checkNoErrors(component); + QmlGraphicsItem *rootItem = qobject_cast<QmlGraphicsItem*>(component.create()); + QmlGraphicsWebView *wv = rootItem->findChild<QmlGraphicsWebView*>("webView"); + QVERIFY(rootItem != 0); + QVERIFY(wv != 0); + QTRY_COMPARE(wv->progress(), 1.0); + + QmlComponent substituteComponent(&engine); + substituteComponent.setData("import Qt 4.6; WebView { objectName: 'newWebView'; url: 'basic.html'; }", QUrl::fromLocalFile("")); + QSignalSpy newWindowComponentSpy(wv, SIGNAL(newWindowComponentChanged())); + + wv->setNewWindowComponent(&substituteComponent); + QCOMPARE(wv->newWindowComponent(), &substituteComponent); + QCOMPARE(newWindowComponentSpy.count(),1); + + wv->setNewWindowComponent(&substituteComponent); + QCOMPARE(newWindowComponentSpy.count(),1); + + wv->setNewWindowComponent(0); + QCOMPARE(newWindowComponentSpy.count(),2); +} + +void tst_qmlgraphicswebview::renderingEnabled() +{ + QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml")); + checkNoErrors(component); + QmlGraphicsItem *rootItem = qobject_cast<QmlGraphicsItem*>(component.create()); + QmlGraphicsWebView *wv = rootItem->findChild<QmlGraphicsWebView*>("webView"); + QVERIFY(rootItem != 0); + QVERIFY(wv != 0); + QTRY_COMPARE(wv->progress(), 1.0); + + QVERIFY(wv->renderingEnabled()); + QSignalSpy renderingEnabledSpy(wv, SIGNAL(renderingEnabledChanged())); + + wv->setRenderingEnabled(false); + QVERIFY(!wv->renderingEnabled()); + QCOMPARE(renderingEnabledSpy.count(),1); + + wv->setRenderingEnabled(false); + QCOMPARE(renderingEnabledSpy.count(),1); + + wv->setRenderingEnabled(true); + QCOMPARE(renderingEnabledSpy.count(),2); +} + +void tst_qmlgraphicswebview::pressGrabTime() +{ + QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertychanges.qml")); + checkNoErrors(component); + QmlGraphicsItem *rootItem = qobject_cast<QmlGraphicsItem*>(component.create()); + QmlGraphicsWebView *wv = rootItem->findChild<QmlGraphicsWebView*>("webView"); + QVERIFY(rootItem != 0); + QVERIFY(wv != 0); + QTRY_COMPARE(wv->progress(), 1.0); + QCOMPARE(wv->pressGrabTime(), 200); + QSignalSpy pressGrabTimeSpy(wv, SIGNAL(pressGrabTimeChanged())); + + wv->setPressGrabTime(100); + QCOMPARE(wv->pressGrabTime(), 100); + QCOMPARE(pressGrabTimeSpy.count(),1); + + wv->setPressGrabTime(100); + QCOMPARE(pressGrabTimeSpy.count(),1); + + wv->setPressGrabTime(0); + QCOMPARE(pressGrabTimeSpy.count(),2); +} + QTEST_MAIN(tst_qmlgraphicswebview) #include "tst_qmlgraphicswebview.moc" diff --git a/tests/auto/declarative/qmlvaluetypes/data/enums.1.qml b/tests/auto/declarative/qmlvaluetypes/data/enums.1.qml new file mode 100644 index 0000000..0eadd50 --- /dev/null +++ b/tests/auto/declarative/qmlvaluetypes/data/enums.1.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyTypeObject { + font.capitalization: "MixedCase" +} + diff --git a/tests/auto/declarative/qmlvaluetypes/data/enums.2.qml b/tests/auto/declarative/qmlvaluetypes/data/enums.2.qml new file mode 100644 index 0000000..81f1c92 --- /dev/null +++ b/tests/auto/declarative/qmlvaluetypes/data/enums.2.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyTypeObject { + font.capitalization: if (1) "MixedCase" +} + diff --git a/tests/auto/declarative/qmlvaluetypes/tst_qmlvaluetypes.cpp b/tests/auto/declarative/qmlvaluetypes/tst_qmlvaluetypes.cpp index f99d3ce..4faa0bc 100644 --- a/tests/auto/declarative/qmlvaluetypes/tst_qmlvaluetypes.cpp +++ b/tests/auto/declarative/qmlvaluetypes/tst_qmlvaluetypes.cpp @@ -74,6 +74,7 @@ private slots: void bindingVariantCopy(); void scriptVariantCopy(); void cppClasses(); + void enums(); private: QmlEngine engine; @@ -583,6 +584,26 @@ void tst_qmlvaluetypes::cppClasses() CPP_TEST(QmlFontValueType, QFont("Helvetica")); } + +void tst_qmlvaluetypes::enums() +{ + { + QmlComponent component(&engine, TEST_FILE("enums.1.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + QVERIFY(object->font().capitalization() == QFont::MixedCase); + delete object; + } + + { + QmlComponent component(&engine, TEST_FILE("enums.2.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + QVERIFY(object->font().capitalization() == QFont::MixedCase); + delete object; + } +} + QTEST_MAIN(tst_qmlvaluetypes) #include "tst_qmlvaluetypes.moc" diff --git a/tests/auto/declarative/visual/Package_Views/packageviews.qml b/tests/auto/declarative/visual/Package_Views/packageviews.qml index b577e45..cf3f9f7 100644 --- a/tests/auto/declarative/visual/Package_Views/packageviews.qml +++ b/tests/auto/declarative/visual/Package_Views/packageviews.qml @@ -64,7 +64,7 @@ Rectangle { from: "*"; to: "*" SequentialAnimation { ParentAction{} - NumberAnimation { properties: "x,y,width"; easing: "easeInOutQuad" } + NumberAnimation { properties: "x,y,width"; easing.type: "InOutQuad" } } } ] diff --git a/tests/auto/declarative/visual/animation/easing/easing.qml b/tests/auto/declarative/visual/animation/easing/easing.qml index 9c814eb..4248d88 100644 --- a/tests/auto/declarative/visual/animation/easing/easing.qml +++ b/tests/auto/declarative/visual/animation/easing/easing.qml @@ -9,127 +9,127 @@ Rectangle { ListModel { id: easingtypes ListElement { - type: "easeLinear" + type: "Linear" } ListElement { - type: "easeInQuad" + type: "InQuad" } ListElement { - type: "easeOutQuad" + type: "OutQuad" } ListElement { - type: "easeInOutQuad" + type: "InOutQuad" } ListElement { - type: "easeOutInQuad" + type: "OutInQuad" } ListElement { - type: "easeInCubic" + type: "InCubic" } ListElement { - type: "easeOutCubic" + type: "OutCubic" } ListElement { - type: "easeInOutCubic" + type: "InOutCubic" } ListElement { - type: "easeOutInCubic" + type: "OutInCubic" } ListElement { - type: "easeInQuart" + type: "InQuart" } ListElement { - type: "easeOutQuart" + type: "OutQuart" } ListElement { - type: "easeInOutQuart" + type: "InOutQuart" } ListElement { - type: "easeOutInQuart" + type: "OutInQuart" } ListElement { - type: "easeInQuint" + type: "InQuint" } ListElement { - type: "easeOutQuint" + type: "OutQuint" } ListElement { - type: "easeInOutQuint" + type: "InOutQuint" } ListElement { - type: "easeOutInQuint" + type: "OutInQuint" } ListElement { - type: "easeInSine" + type: "InSine" } ListElement { - type: "easeOutSine" + type: "OutSine" } ListElement { - type: "easeInOutSine" + type: "InOutSine" } ListElement { - type: "easeOutInSine" + type: "OutInSine" } ListElement { - type: "easeInExpo" + type: "InExpo" } ListElement { - type: "easeOutExpo" + type: "OutExpo" } ListElement { - type: "easeInOutExpo" + type: "InOutExpo" } ListElement { - type: "easeOutInExpo" + type: "OutInExpo" } ListElement { - type: "easeInCirc" + type: "InCirc" } ListElement { - type: "easeOutCirc" + type: "OutCirc" } ListElement { - type: "easeInOutCirc" + type: "InOutCirc" } ListElement { - type: "easeOutInCirc" + type: "OutInCirc" } ListElement { - type: "easeInElastic" + type: "InElastic" } ListElement { - type: "easeOutElastic" + type: "OutElastic" } ListElement { - type: "easeInOutElastic" + type: "InOutElastic" } ListElement { - type: "easeOutInElastic" + type: "OutInElastic" } ListElement { - type: "easeInBack" + type: "InBack" } ListElement { - type: "easeOutBack" + type: "OutBack" } ListElement { - type: "easeInOutBack" + type: "InOutBack" } ListElement { - type: "easeOutInBack" + type: "OutInBack" } ListElement { - type: "easeOutBounce" + type: "OutBounce" } ListElement { - type: "easeInBounce" + type: "InBounce" } ListElement { - type: "easeInOutBounce" + type: "InOutBounce" } ListElement { - type: "easeOutInBounce" + type: "OutInBounce" } } ] @@ -177,7 +177,7 @@ Rectangle { reversible: true NumberAnimation { properties: "x" - easing: type + easing.type: type duration: 1000 } } diff --git a/tests/auto/declarative/visual/animation/pauseAnimation/pauseAnimation.qml b/tests/auto/declarative/visual/animation/pauseAnimation/pauseAnimation.qml index f2e065d..24ca76b 100644 --- a/tests/auto/declarative/visual/animation/pauseAnimation/pauseAnimation.qml +++ b/tests/auto/declarative/visual/animation/pauseAnimation/pauseAnimation.qml @@ -14,11 +14,11 @@ Rectangle { repeat: true NumberAnimation { to: 0; duration: 500 - easing: "easeInOutQuad" + easing.type: "InOutQuad" } NumberAnimation { to: 200-img.height - easing: "easeOutBounce" + easing.type: "OutBounce" duration: 2000 } PauseAnimation { diff --git a/tests/auto/declarative/visual/animation/propertyAction/propertyAction.qml b/tests/auto/declarative/visual/animation/propertyAction/propertyAction.qml index 593f495..e18e770 100644 --- a/tests/auto/declarative/visual/animation/propertyAction/propertyAction.qml +++ b/tests/auto/declarative/visual/animation/propertyAction/propertyAction.qml @@ -28,7 +28,7 @@ Rectangle { SequentialAnimation { ColorAnimation {} PropertyAction { properties: "x" } - NumberAnimation { properties: "y"; easing: "InOutQuad" } + NumberAnimation { properties: "y"; easing.type: "InOutQuad" } } } } diff --git a/tests/auto/declarative/visual/animation/scriptAction/scriptAction.qml b/tests/auto/declarative/visual/animation/scriptAction/scriptAction.qml index 30d587a..ef4ed76 100644 --- a/tests/auto/declarative/visual/animation/scriptAction/scriptAction.qml +++ b/tests/auto/declarative/visual/animation/scriptAction/scriptAction.qml @@ -27,9 +27,9 @@ Rectangle { transitions: Transition { SequentialAnimation { - NumberAnimation { properties: "x"; easing: "InOutQuad" } + NumberAnimation { properties: "x"; easing.type: "InOutQuad" } ScriptAction { stateChangeScriptName: "setColor" } - NumberAnimation { properties: "y"; easing: "InOutQuad" } + NumberAnimation { properties: "y"; easing.type: "InOutQuad" } } } } diff --git a/tests/auto/declarative/visual/qmlgraphicsborderimage/content/MyBorderImage.qml b/tests/auto/declarative/visual/qmlgraphicsborderimage/content/MyBorderImage.qml index eb1ec00..e268ce7 100644 --- a/tests/auto/declarative/visual/qmlgraphicsborderimage/content/MyBorderImage.qml +++ b/tests/auto/declarative/visual/qmlgraphicsborderimage/content/MyBorderImage.qml @@ -20,14 +20,14 @@ Item { width: SequentialAnimation { repeat: true - NumberAnimation { from: container.minWidth; to: container.maxWidth; duration: 2000; easing: "easeInOutQuad"} - NumberAnimation { from: container.maxWidth; to: container.minWidth; duration: 2000; easing: "easeInOutQuad" } + NumberAnimation { from: container.minWidth; to: container.maxWidth; duration: 2000; easing.type: "InOutQuad"} + NumberAnimation { from: container.maxWidth; to: container.minWidth; duration: 2000; easing.type: "InOutQuad" } } height: SequentialAnimation { repeat: true - NumberAnimation { from: container.minHeight; to: container.maxHeight; duration: 2000; easing: "easeInOutQuad"} - NumberAnimation { from: container.maxHeight; to: container.minHeight; duration: 2000; easing: "easeInOutQuad" } + NumberAnimation { from: container.minHeight; to: container.maxHeight; duration: 2000; easing.type: "InOutQuad"} + NumberAnimation { from: container.maxHeight; to: container.minHeight; duration: 2000; easing.type: "InOutQuad" } } border.top: container.margin diff --git a/tests/auto/declarative/visual/qmlgraphicsflipable/test-flipable.qml b/tests/auto/declarative/visual/qmlgraphicsflipable/test-flipable.qml index c33a319..a27aa6e 100644 --- a/tests/auto/declarative/visual/qmlgraphicsflipable/test-flipable.qml +++ b/tests/auto/declarative/visual/qmlgraphicsflipable/test-flipable.qml @@ -36,7 +36,7 @@ Rectangle { } transitions: Transition { - NumberAnimation { easing: "easeInOutQuad"; properties: "angle"; duration: 3000 } + NumberAnimation { easing.type: "InOutQuad"; properties: "angle"; duration: 3000 } } } @@ -64,7 +64,7 @@ Rectangle { } transitions: Transition { - NumberAnimation { easing: "easeInOutQuad"; properties: "angle"; duration: 3000 } + NumberAnimation { easing.type: "InOutQuad"; properties: "angle"; duration: 3000 } } } diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/cursorDelegate.qml b/tests/auto/declarative/visual/qmlgraphicstextedit/cursorDelegate.qml index e0c5db4..176a5b8 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/cursorDelegate.qml +++ b/tests/auto/declarative/visual/qmlgraphicstextedit/cursorDelegate.qml @@ -11,8 +11,8 @@ import Qt 4.6 Rectangle { id:bottom; color: "black"; width: 3; height: 1; x: -1; anchors.bottom: parent.bottom;} opacity: 1 opacity: SequentialAnimation { running: cPage.parent.focus == true; repeat: true; - NumberAnimation { properties: "opacity"; to: 1; duration: 500; easing: "easeInQuad"} - NumberAnimation { properties: "opacity"; to: 0; duration: 500; easing: "easeOutQuad"} + NumberAnimation { properties: "opacity"; to: 1; duration: 500; easing.type: "InQuad"} + NumberAnimation { properties: "opacity"; to: 0; duration: 500; easing.type: "OutQuad"} } } width: 1; diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/cursorDelegate.qml b/tests/auto/declarative/visual/qmlgraphicstextinput/cursorDelegate.qml index 0038664..6a4e7fa 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextinput/cursorDelegate.qml +++ b/tests/auto/declarative/visual/qmlgraphicstextinput/cursorDelegate.qml @@ -11,8 +11,8 @@ import Qt 4.6 Rectangle { id:bottom; color: "black"; width: 3; height: 1; x: -1; anchors.bottom: parent.bottom;} opacity: 1 opacity: SequentialAnimation { running: cPage.parent.focus == true; repeat: true; - NumberAnimation { properties: "opacity"; to: 1; duration: 500; easing: "easeInQuad"} - NumberAnimation { properties: "opacity"; to: 0; duration: 500; easing: "easeOutQuad"} + NumberAnimation { properties: "opacity"; to: 1; duration: 500; easing.type: "InQuad"} + NumberAnimation { properties: "opacity"; to: 0; duration: 500; easing.type: "OutQuad"} } } width: 1; diff --git a/tests/auto/declarative/visual/qmlspringfollow/follow.qml b/tests/auto/declarative/visual/qmlspringfollow/follow.qml index a85a778..62503e4 100644 --- a/tests/auto/declarative/visual/qmlspringfollow/follow.qml +++ b/tests/auto/declarative/visual/qmlspringfollow/follow.qml @@ -11,11 +11,11 @@ Rectangle { repeat: true NumberAnimation { to: 20; duration: 500 - easing: "easeInOutQuad" + easing.type: "InOutQuad" } NumberAnimation { to: 200; duration: 2000 - easing: "easeOutBounce" + easing.type: "OutBounce" } PauseAnimation { duration: 1000 } } diff --git a/tests/auto/qeasingcurve/tst_qeasingcurve.cpp b/tests/auto/qeasingcurve/tst_qeasingcurve.cpp index 12ddff1..abb4014 100644 --- a/tests/auto/qeasingcurve/tst_qeasingcurve.cpp +++ b/tests/auto/qeasingcurve/tst_qeasingcurve.cpp @@ -69,6 +69,10 @@ private slots: void valueForProgress(); void setCustomType(); void operators(); + void dataStreamOperators_data(); + void dataStreamOperators(); + void properties(); + void metaTypes(); protected: }; @@ -505,6 +509,117 @@ void tst_QEasingCurve::operators() QVERIFY(curve2 == curve); } +void tst_QEasingCurve::dataStreamOperators_data() +{ + QTest::addColumn<int>("type"); + QTest::addColumn<qreal>("amplitude"); + QTest::addColumn<qreal>("overshoot"); + QTest::addColumn<qreal>("period"); + QTest::addColumn<QEasingCurve>("easingCurve"); + QTest::newRow("Linear") << int(QEasingCurve::Linear) << -1.0 << -1.0 << -1.0 << QEasingCurve(QEasingCurve::Linear); + QTest::newRow("OutCubic") << int(QEasingCurve::OutCubic) << -1.0 << -1.0 << -1.0 << QEasingCurve(QEasingCurve::OutCubic); + QTest::newRow("InOutSine") << int(QEasingCurve::InOutSine) << -1.0 << -1.0 << -1.0 << QEasingCurve(QEasingCurve::InOutSine); + QEasingCurve inOutElastic(QEasingCurve::InOutElastic); + inOutElastic.setPeriod(1.5); + inOutElastic.setAmplitude(2.0); + QTest::newRow("InOutElastic") << int(QEasingCurve::InOutElastic) << 2.0 << -1.0 << 1.5 << inOutElastic; + QTest::newRow("OutInBack") << int(QEasingCurve::OutInBack) << -1.0 << -1.0 << -1.0 << QEasingCurve(QEasingCurve::OutInBack); + QTest::newRow("OutCurve") << int(QEasingCurve::OutCurve) << -1.0 << -1.0 << -1.0 << QEasingCurve(QEasingCurve::OutCurve); + QEasingCurve inOutBack(QEasingCurve::InOutBack); + inOutBack.setOvershoot(0.5); + QTest::newRow("InOutBack") << int(QEasingCurve::InOutBack) << -1.0 << 0.5 << -1.0 << inOutBack; +} + +void tst_QEasingCurve::dataStreamOperators() +{ + QFETCH(int, type); + QFETCH(qreal, amplitude); + QFETCH(qreal, overshoot); + QFETCH(qreal, period); + QFETCH(QEasingCurve, easingCurve); + + // operator << + QEasingCurve curve; + curve.setType(QEasingCurve::Type(type)); + if (amplitude != -1.0) + curve.setAmplitude(amplitude); + if (overshoot != -1.0) + curve.setOvershoot(overshoot); + if (period != -1.0) + curve.setPeriod(period); + + QVERIFY(easingCurve == curve); + + QByteArray array; + QDataStream out(&array, QIODevice::WriteOnly); + out << curve; + + QDataStream in(array); + QEasingCurve curve2; + in >> curve2; + + QVERIFY(curve2 == curve); +} + +class tst_QEasingProperties : public QObject +{ + Q_OBJECT + Q_PROPERTY(QEasingCurve easing READ easing WRITE setEasing) +public: + tst_QEasingProperties(QObject *parent = 0) : QObject(parent) {} + + QEasingCurve easing() const { return e; } + void setEasing(const QEasingCurve& value) { e = value; } + +private: + QEasingCurve e; +}; + +// Test getting and setting easing properties via the metaobject system. +void tst_QEasingCurve::properties() +{ + tst_QEasingProperties obj; + + QEasingCurve inOutBack(QEasingCurve::InOutBack); + qreal overshoot = 1.5f; + inOutBack.setOvershoot(overshoot); + qreal amplitude = inOutBack.amplitude(); + qreal period = inOutBack.period(); + + obj.setEasing(inOutBack); + + QEasingCurve easing = qVariantValue<QEasingCurve>(obj.property("easing")); + QCOMPARE(easing.type(), QEasingCurve::InOutBack); + QCOMPARE(easing.overshoot(), overshoot); + QCOMPARE(easing.amplitude(), amplitude); + QCOMPARE(easing.period(), period); + + QEasingCurve linear(QEasingCurve::Linear); + overshoot = linear.overshoot(); + amplitude = linear.amplitude(); + period = linear.period(); + + obj.setProperty("easing", + qVariantFromValue(QEasingCurve(QEasingCurve::Linear))); + + easing = qVariantValue<QEasingCurve>(obj.property("easing")); + QCOMPARE(easing.type(), QEasingCurve::Linear); + QCOMPARE(easing.overshoot(), overshoot); + QCOMPARE(easing.amplitude(), amplitude); + QCOMPARE(easing.period(), period); +} + +void tst_QEasingCurve::metaTypes() +{ + QVERIFY(QMetaType::type("QEasingCurve") == QMetaType::QEasingCurve); + + QCOMPARE(QByteArray(QMetaType::typeName(QMetaType::QEasingCurve)), + QByteArray("QEasingCurve")); + + QVERIFY(QMetaType::isRegistered(QMetaType::QEasingCurve)); + + QVERIFY(qMetaTypeId<QEasingCurve>() == QMetaType::QEasingCurve); +} QTEST_MAIN(tst_QEasingCurve) #include "tst_qeasingcurve.moc" diff --git a/tests/benchmarks/declarative/binding/binding.pro b/tests/benchmarks/declarative/binding/binding.pro index e25f186..aa4cc41 100644 --- a/tests/benchmarks/declarative/binding/binding.pro +++ b/tests/benchmarks/declarative/binding/binding.pro @@ -7,3 +7,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_binding.cpp testtypes.cpp HEADERS += testtypes.h +symbian* { + data.sources = data/* + data.path = data + DEPLOYMENT = data +} + diff --git a/tests/benchmarks/declarative/creation/creation.pro b/tests/benchmarks/declarative/creation/creation.pro index fcc2987..3e0caf6 100644 --- a/tests/benchmarks/declarative/creation/creation.pro +++ b/tests/benchmarks/declarative/creation/creation.pro @@ -6,5 +6,10 @@ macx:CONFIG -= app_bundle SOURCES += tst_creation.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" - +symbian* { + data.sources = data/* + data.path = data + DEPLOYMENT += addFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +}
\ No newline at end of file diff --git a/tests/benchmarks/declarative/creation/tst_creation.cpp b/tests/benchmarks/declarative/creation/tst_creation.cpp index 23c820c..b99031a 100644 --- a/tests/benchmarks/declarative/creation/tst_creation.cpp +++ b/tests/benchmarks/declarative/creation/tst_creation.cpp @@ -49,6 +49,12 @@ #include <QmlGraphicsItem> #include <private/qobject_p.h> +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +// Application private dir is default serach path for files, so SRCDIR can be set to empty +#define SRCDIR "" +#endif + class tst_creation : public QObject { Q_OBJECT diff --git a/tests/benchmarks/declarative/qmlcomponent/qmlcomponent.pro b/tests/benchmarks/declarative/qmlcomponent/qmlcomponent.pro index 6a86f58..a77eebb 100644 --- a/tests/benchmarks/declarative/qmlcomponent/qmlcomponent.pro +++ b/tests/benchmarks/declarative/qmlcomponent/qmlcomponent.pro @@ -7,3 +7,13 @@ macx:CONFIG -= app_bundle SOURCES += tst_qmlcomponent.cpp testtypes.cpp HEADERS += testtypes.h +symbian* { + data.sources = data/* + data.path = data + samegame.sources = data/samegame/* + samegame.path = data/samegame + samegame_pics.sources = data/samegame/pics/* + samegame_pics.path = data/samegame/pics + DEPLOYMENT += data samegame samegame_pics +} + diff --git a/tests/benchmarks/declarative/qmlgraphicsimage/qmlgraphicsimage.pro b/tests/benchmarks/declarative/qmlgraphicsimage/qmlgraphicsimage.pro index 449d874..f14931c 100644 --- a/tests/benchmarks/declarative/qmlgraphicsimage/qmlgraphicsimage.pro +++ b/tests/benchmarks/declarative/qmlgraphicsimage/qmlgraphicsimage.pro @@ -7,5 +7,10 @@ CONFIG += release SOURCES += tst_qmlgraphicsimage.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" - +symbian* { + data.sources = image.png + data.path = . + DEPLOYMENT += data +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} diff --git a/tests/benchmarks/declarative/qmlgraphicsimage/tst_qmlgraphicsimage.cpp b/tests/benchmarks/declarative/qmlgraphicsimage/tst_qmlgraphicsimage.cpp index 7d7d24e..6d1aa0e 100644 --- a/tests/benchmarks/declarative/qmlgraphicsimage/tst_qmlgraphicsimage.cpp +++ b/tests/benchmarks/declarative/qmlgraphicsimage/tst_qmlgraphicsimage.cpp @@ -44,6 +44,12 @@ #include <QmlComponent> #include <private/qmlgraphicsimage_p.h> +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +// Application private dir is default serach path for files, so SRCDIR can be set to empty +#define SRCDIR "" +#endif + class tst_qmlgraphicsimage : public QObject { Q_OBJECT diff --git a/tests/benchmarks/declarative/qmltime/qmltime.cpp b/tests/benchmarks/declarative/qmltime/qmltime.cpp index 2cc5d0d..8e312be 100644 --- a/tests/benchmarks/declarative/qmltime/qmltime.cpp +++ b/tests/benchmarks/declarative/qmltime/qmltime.cpp @@ -183,7 +183,11 @@ int main(int argc, char ** argv) } if (filename.isEmpty()) +#ifdef Q_OS_SYMBIAN + filename = QLatin1String("./tests/item_creation/data.qml"); +#else usage(argv[0]); +#endif QmlEngine engine; QmlComponent component(&engine, filename); @@ -204,6 +208,9 @@ int main(int argc, char ** argv) return -1; } +#ifdef Q_OS_SYMBIAN + willParent = true; +#endif timer->setWillParent(willParent); if (!timer->component()) { @@ -211,6 +218,10 @@ int main(int argc, char ** argv) return -1; } +#ifdef Q_OS_SYMBIAN + iterations = 1024; +#endif + timer->run(iterations); return 0; diff --git a/tests/benchmarks/declarative/qmltime/qmltime.pro b/tests/benchmarks/declarative/qmltime/qmltime.pro index b077d1a..9352f3b 100644 --- a/tests/benchmarks/declarative/qmltime/qmltime.pro +++ b/tests/benchmarks/declarative/qmltime/qmltime.pro @@ -6,3 +6,18 @@ macx:CONFIG -= app_bundle SOURCES += qmltime.cpp +symbian* { + TARGET.CAPABILITY = "All -TCB" + example.sources = example.qml + esample.path = . + tests.sources = tests/* + tests.path = tests + anshors.sources = tests/anchors/* + anchors.path = tests/anchors + item_creation.sources = tests/item_creation/* + item_creation.path = tests/item_creation + positioner_creation.sources = tests/positioner_creation/* + positioner_creation.path = tests/positioner_creation + DEPLOYMENT += example tests anchors item_creation positioner_creation +} + diff --git a/tests/benchmarks/declarative/script/script.pro b/tests/benchmarks/declarative/script/script.pro index 48fea81..6255acc 100644 --- a/tests/benchmarks/declarative/script/script.pro +++ b/tests/benchmarks/declarative/script/script.pro @@ -7,5 +7,14 @@ CONFIG += release SOURCES += tst_script.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian* { + data.sources = data/* + data.path = data + DEPLOYMENT += data +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} + + + diff --git a/tests/benchmarks/declarative/script/tst_script.cpp b/tests/benchmarks/declarative/script/tst_script.cpp index dd21997..15902e4 100644 --- a/tests/benchmarks/declarative/script/tst_script.cpp +++ b/tests/benchmarks/declarative/script/tst_script.cpp @@ -48,6 +48,12 @@ #include <QScriptEngine> #include <QScriptValue> +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +// Application private dir is default serach path for files, so SRCDIR can be set to empty +#define SRCDIR "." +#endif + class tst_script : public QObject { Q_OBJECT |