summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2011-02-28 03:49:37 (GMT)
committerMartin Jones <martin.jones@nokia.com>2011-02-28 04:46:50 (GMT)
commitcb0a6844705802564c81b581f24a76c5d5adf6d1 (patch)
treed17b9382c66f21a748f138f76a06a767f665c31e /tests/auto
parent6d7c12ae3f3d0eae6946524ce023ac452cf188c4 (diff)
downloadQt-cb0a6844705802564c81b581f24a76c5d5adf6d1.zip
Qt-cb0a6844705802564c81b581f24a76c5d5adf6d1.tar.gz
Qt-cb0a6844705802564c81b581f24a76c5d5adf6d1.tar.bz2
Drag over bounds errors when ListView has variable height content
There are two related problems: - when dragging variable height content up beyond bounds items are destroyed, causing the maximum extent to change, which in turn causes skipping. This is fixed by storing the extents on press so that later changes do not affect drag behavior. - when variable height content is dragged beyond the bounds and and released, items are created as the view returns to bounds. This changes the extents, however the bound target was not updated. If the viewport height changes during fixup the bounds animation is now updated. Change-Id: Ib37ec9e51f8ceb71af1e2e58f25fd8da18dcd632 Task-number: QTBUG-17769 Reviewed-by: Michael Brasser
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp26
1 files changed, 24 insertions, 2 deletions
diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
index cceeb63..e326136 100644
--- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
+++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
@@ -1104,7 +1104,7 @@ void tst_QDeclarativeListView::sectionsDelegate()
model.modifyItem(9, "Two", "aaa");
model.modifyItem(10, "Two", "aaa");
model.modifyItem(11, "Two", "aaa");
- QTest::qWait(100);
+ QTRY_COMPARE(findItems<QDeclarativeItem>(contentItem, "sect_aaa").count(), 1);
canvas->rootObject()->setProperty("sectionProperty", "name");
// ensure view has settled.
QTRY_COMPARE(findItems<QDeclarativeItem>(contentItem, "sect_Four").count(), 1);
@@ -1115,6 +1115,28 @@ void tst_QDeclarativeListView::sectionsDelegate()
QTRY_COMPARE(item->y(), qreal(i*20*4));
}
+ // QTBUG-17769
+ model.removeItems(10, 20);
+ // ensure view has settled.
+ QTRY_COMPARE(findItems<QDeclarativeItem>(contentItem, "wrapper").count(), 10);
+ // Drag view up beyond bounds
+ QTest::mousePress(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(20,20)));
+ {
+ QMouseEvent mv(QEvent::MouseMove, canvas->mapFromScene(QPoint(20,0)), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier);
+ QApplication::sendEvent(canvas->viewport(), &mv);
+ }
+ {
+ QMouseEvent mv(QEvent::MouseMove, canvas->mapFromScene(QPoint(20,-50)), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier);
+ QApplication::sendEvent(canvas->viewport(), &mv);
+ }
+ {
+ QMouseEvent mv(QEvent::MouseMove, canvas->mapFromScene(QPoint(20,-200)), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier);
+ QApplication::sendEvent(canvas->viewport(), &mv);
+ }
+ QTest::mouseRelease(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(20,-200)));
+ // view should settle back at 0
+ QTRY_COMPARE(listview->contentY(), 0.0);
+
delete canvas;
}
@@ -2445,7 +2467,7 @@ QList<T*> tst_QDeclarativeListView::findItems(QGraphicsObject *parent, const QSt
//qDebug() << parent->childItems().count() << "children";
for (int i = 0; i < parent->childItems().count(); ++i) {
QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(parent->childItems().at(i));
- if(!item)
+ if(!item || !item->isVisible())
continue;
//qDebug() << "try" << item;
if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName))