diff options
author | Martin Jones <martin.jones@nokia.com> | 2011-03-16 02:08:42 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2011-03-16 03:05:22 (GMT) |
commit | 733578aec105c2d2bdb3f6ef57ee3195ebb79696 (patch) | |
tree | 4caad3d3e09d81b32168fea7c38db62a25ffeaef /tests | |
parent | 77342ad3e7beecb75c136ee26c0c77cd1a41b415 (diff) | |
download | Qt-733578aec105c2d2bdb3f6ef57ee3195ebb79696.zip Qt-733578aec105c2d2bdb3f6ef57ee3195ebb79696.tar.gz Qt-733578aec105c2d2bdb3f6ef57ee3195ebb79696.tar.bz2 |
Disabled non-QDeclarativeItems in Flickable break flicking
Allow Flickable to steal grab from items that are disabled.
Change-Id: I71e401cd78695ecb2c3d47abde1c3d13e722d848
Task-number: QT-4677
Reviewed-by: Michael Brasser
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/declarative/qdeclarativeflickable/data/disabledcontent.qml | 8 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp | 39 |
2 files changed, 47 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeflickable/data/disabledcontent.qml b/tests/auto/declarative/qdeclarativeflickable/data/disabledcontent.qml new file mode 100644 index 0000000..dcbb20b --- /dev/null +++ b/tests/auto/declarative/qdeclarativeflickable/data/disabledcontent.qml @@ -0,0 +1,8 @@ +import QtQuick 1.0 + +Flickable { + width: 100; height: 100 + contentWidth: 200; contentHeight: 300 + + QGraphicsWidget { width: 200; height: 300; enabled: false } +} diff --git a/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp b/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp index 65ba316..d499edf 100644 --- a/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp +++ b/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp @@ -69,6 +69,7 @@ private slots: void maximumFlickVelocity(); void flickDeceleration(); void pressDelay(); + void disabledContent(); void nestedPressDelay(); void flickableDirection(); void qgraphicswidget(); @@ -247,6 +248,44 @@ void tst_qdeclarativeflickable::pressDelay() QCOMPARE(spy.count(),1); } +// QT-4677 +void tst_qdeclarativeflickable::disabledContent() +{ + QDeclarativeView *canvas = new QDeclarativeView; + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/disabledcontent.qml")); + canvas->show(); + canvas->setFocus(); + QVERIFY(canvas->rootObject() != 0); + + QDeclarativeFlickable *flickable = qobject_cast<QDeclarativeFlickable*>(canvas->rootObject()); + QVERIFY(flickable != 0); + + QVERIFY(flickable->contentX() == 0); + QVERIFY(flickable->contentY() == 0); + + QTest::mousePress(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(50, 50))); + { + QMouseEvent mv(QEvent::MouseMove, canvas->mapFromScene(QPoint(70,70)), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier); + QApplication::sendEvent(canvas->viewport(), &mv); + } + { + QMouseEvent mv(QEvent::MouseMove, canvas->mapFromScene(QPoint(90,90)), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier); + QApplication::sendEvent(canvas->viewport(), &mv); + } + { + QMouseEvent mv(QEvent::MouseMove, canvas->mapFromScene(QPoint(100,100)), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier); + QApplication::sendEvent(canvas->viewport(), &mv); + } + + QVERIFY(flickable->contentX() < 0); + QVERIFY(flickable->contentY() < 0); + + QTest::mouseRelease(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(90, 90))); + + delete canvas; +} + + // QTBUG-17361 void tst_qdeclarativeflickable::nestedPressDelay() { |