diff options
Diffstat (limited to 'tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp')
-rw-r--r-- | tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp b/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp index 9ce9c49..2c6890e 100644 --- a/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp +++ b/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp @@ -61,6 +61,7 @@ private slots: void maximumFlickVelocity(); void flickDeceleration(); void pressDelay(); + void flickableDirection(); private: QDeclarativeEngine engine; @@ -224,6 +225,33 @@ void tst_qdeclarativeflickable::pressDelay() QCOMPARE(spy.count(),1); } +void tst_qdeclarativeflickable::flickableDirection() +{ + QDeclarativeComponent component(&engine); + component.setData("import Qt 4.7; Flickable { flickableDirection: Flickable.VerticalFlick; }", QUrl::fromLocalFile("")); + QDeclarativeFlickable *flickable = qobject_cast<QDeclarativeFlickable*>(component.create()); + QSignalSpy spy(flickable, SIGNAL(flickableDirectionChanged())); + + QVERIFY(flickable); + QCOMPARE(flickable->flickableDirection(), QDeclarativeFlickable::VerticalFlick); + + flickable->setFlickableDirection(QDeclarativeFlickable::HorizontalAndVerticalFlick); + QCOMPARE(flickable->flickableDirection(), QDeclarativeFlickable::HorizontalAndVerticalFlick); + QCOMPARE(spy.count(),1); + + flickable->setFlickableDirection(QDeclarativeFlickable::AutoFlickDirection); + QCOMPARE(flickable->flickableDirection(), QDeclarativeFlickable::AutoFlickDirection); + QCOMPARE(spy.count(),2); + + flickable->setFlickableDirection(QDeclarativeFlickable::HorizontalFlick); + QCOMPARE(flickable->flickableDirection(), QDeclarativeFlickable::HorizontalFlick); + QCOMPARE(spy.count(),3); + + flickable->setFlickableDirection(QDeclarativeFlickable::HorizontalFlick); + QCOMPARE(flickable->flickableDirection(), QDeclarativeFlickable::HorizontalFlick); + QCOMPARE(spy.count(),3); +} + QTEST_MAIN(tst_qdeclarativeflickable) #include "tst_qdeclarativeflickable.moc" |