QTRY_VERIFY(gridview->currentItem() != oldCurrent);
gridview->setContentY(0);
- // let transitions settle.
- QTest::qWait(300);
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
// Confirm items positioned correctly
itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
QTRY_COMPARE(gridview->currentIndex(), 24);
QTRY_COMPARE(gridview->contentY(), 220.0);
- QTest::qWait(100); // wait for refill to complete
+ QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false);
QTRY_VERIFY(!findItem<QQuickItem>(contentItem, "wrapper", 0)); // 0 shouldn't be visible
if (doAdd) {
QTest::addColumn<qreal>("startExtent");
QTest::newRow("vertical, left to right") << QQuickGridView::LeftToRight << Qt::LeftToRight << int(QQuickItemView::NoHighlightRange)
- << QPoint(20, 200) << QPoint(20, 20) << 60.0 << 1200.0 << 0.0;
+ << QPoint(20, 200) << QPoint(20, 20) << 60.0 << 800.0 << 0.0;
QTest::newRow("horizontal, left to right") << QQuickGridView::TopToBottom << Qt::LeftToRight << int(QQuickItemView::NoHighlightRange)
- << QPoint(200, 20) << QPoint(20, 20) << 60.0 << 1200.0 << 0.0;
+ << QPoint(200, 20) << QPoint(20, 20) << 60.0 << 800.0 << 0.0;
QTest::newRow("horizontal, right to left") << QQuickGridView::TopToBottom << Qt::RightToLeft << int(QQuickItemView::NoHighlightRange)
- << QPoint(20, 20) << QPoint(200, 20) << -60.0 << -1200.0 - 240.0 << -240.0;
+ << QPoint(20, 20) << QPoint(200, 20) << -60.0 << -800.0 - 240.0 << -240.0;
QTest::newRow("vertical, left to right, enforce range") << QQuickGridView::LeftToRight << Qt::LeftToRight << int(QQuickItemView::StrictlyEnforceRange)
- << QPoint(20, 200) << QPoint(20, 20) << 60.0 << 1340.0 << -20.0;
+ << QPoint(20, 200) << QPoint(20, 20) << 60.0 << 940.0 << -20.0;
QTest::newRow("horizontal, left to right, enforce range") << QQuickGridView::TopToBottom << Qt::LeftToRight << int(QQuickItemView::StrictlyEnforceRange)
- << QPoint(200, 20) << QPoint(20, 20) << 60.0 << 1340.0 << -20.0;
+ << QPoint(200, 20) << QPoint(20, 20) << 60.0 << 940.0 << -20.0;
QTest::newRow("horizontal, right to left, enforce range") << QQuickGridView::TopToBottom << Qt::RightToLeft << int(QQuickItemView::StrictlyEnforceRange)
- << QPoint(20, 20) << QPoint(200, 20) << -60.0 << -1200.0 - 240.0 - 140.0 << -220.0;
+ << QPoint(20, 20) << QPoint(200, 20) << -60.0 << -800.0 - 240.0 - 140.0 << -220.0;
}
void tst_QQuickGridView::snapToRow()
QTest::addColumn<qreal>("startExtent");
QTest::newRow("vertical, left to right") << QQuickGridView::LeftToRight << Qt::LeftToRight << int(QQuickItemView::NoHighlightRange)
- << QPoint(20, 200) << QPoint(20, 20) << 100.0 << 360.0 << 0.0;
+ << QPoint(20, 200) << QPoint(20, 20) << 100.0 << 240.0 << 0.0;
QTest::newRow("horizontal, left to right") << QQuickGridView::TopToBottom << Qt::LeftToRight << int(QQuickItemView::NoHighlightRange)
- << QPoint(200, 20) << QPoint(20, 20) << 100.0 << 360.0 << 0.0;
+ << QPoint(200, 20) << QPoint(20, 20) << 100.0 << 240.0 << 0.0;
QTest::newRow("horizontal, right to left") << QQuickGridView::TopToBottom << Qt::RightToLeft << int(QQuickItemView::NoHighlightRange)
- << QPoint(20, 20) << QPoint(200, 20) << -340.0 << -360.0 - 240.0 << -240.0;
+ << QPoint(20, 20) << QPoint(200, 20) << -340.0 << -240.0 - 240.0 << -240.0;
QTest::newRow("vertical, left to right, enforce range") << QQuickGridView::LeftToRight << Qt::LeftToRight << int(QQuickItemView::StrictlyEnforceRange)
- << QPoint(20, 200) << QPoint(20, 20) << 100.0 << 460.0 << -20.0;
+ << QPoint(20, 200) << QPoint(20, 20) << 100.0 << 340.0 << -20.0;
QTest::newRow("horizontal, left to right, enforce range") << QQuickGridView::TopToBottom << Qt::LeftToRight << int(QQuickItemView::StrictlyEnforceRange)
- << QPoint(200, 20) << QPoint(20, 20) << 100.0 << 460.0 << -20.0;
+ << QPoint(200, 20) << QPoint(20, 20) << 100.0 << 340.0 << -20.0;
QTest::newRow("horizontal, right to left, enforce range") << QQuickGridView::TopToBottom << Qt::RightToLeft << int(QQuickItemView::StrictlyEnforceRange)
- << QPoint(20, 20) << QPoint(200, 20) << -340.0 << -360.0 - 240.0 - 100.0 << -220.0;
+ << QPoint(20, 20) << QPoint(200, 20) << -340.0 << -240.0 - 240.0 - 100.0 << -220.0;
}
void tst_QQuickGridView::snapOneRow()
: layoutDirection == Qt::LeftToRight ? !gridview->isAtXEnd() : !gridview->isAtXBeginning());
if (QQuickItemView::HighlightRangeMode(highlightRangeMode) == QQuickItemView::StrictlyEnforceRange) {
- QCOMPARE(gridview->currentIndex(), 8);
- QCOMPARE(currentIndexSpy.count(), 4);
+ QCOMPARE(gridview->currentIndex(), 6);
+ QCOMPARE(currentIndexSpy.count(), 3);
}
if (flow == QQuickGridView::LeftToRight)
if (QQuickItemView::HighlightRangeMode(highlightRangeMode) == QQuickItemView::StrictlyEnforceRange) {
QCOMPARE(gridview->currentIndex(), 0);
- QCOMPARE(currentIndexSpy.count(), 8);
+ QCOMPARE(currentIndexSpy.count(), 6);
}
delete canvas;
listview->setContentY(20); // That's the top now
// let transitions settle.
QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
- QTest::qWait(300);
// Confirm items positioned correctly
itemCount = findItems<QQuickItem>(contentItem, "wrapper").count();
listview->setContentY(80);
QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false);
- QTest::qWait(300);
// remove all visible items
model.removeItems(1, 18);
QTest::addColumn<qreal>("startExtent");
QTest::newRow("vertical, left to right") << QQuickListView::Vertical << Qt::LeftToRight << int(QQuickItemView::NoHighlightRange)
- << QPoint(20, 200) << QPoint(20, 20) << 60.0 << 1200.0 << 0.0;
+ << QPoint(20, 200) << QPoint(20, 20) << 60.0 << 560.0 << 0.0;
QTest::newRow("horizontal, left to right") << QQuickListView::Horizontal << Qt::LeftToRight << int(QQuickItemView::NoHighlightRange)
- << QPoint(200, 20) << QPoint(20, 20) << 60.0 << 1200.0 << 0.0;
+ << QPoint(200, 20) << QPoint(20, 20) << 60.0 << 560.0 << 0.0;
QTest::newRow("horizontal, right to left") << QQuickListView::Horizontal << Qt::RightToLeft << int(QQuickItemView::NoHighlightRange)
- << QPoint(20, 20) << QPoint(200, 20) << -60.0 << -1200.0 - 240.0 << -240.0;
+ << QPoint(20, 20) << QPoint(200, 20) << -60.0 << -560.0 - 240.0 << -240.0;
QTest::newRow("vertical, left to right, enforce range") << QQuickListView::Vertical << Qt::LeftToRight << int(QQuickItemView::StrictlyEnforceRange)
- << QPoint(20, 200) << QPoint(20, 20) << 60.0 << 1340.0 << -20.0;
+ << QPoint(20, 200) << QPoint(20, 20) << 60.0 << 700.0 << -20.0;
QTest::newRow("horizontal, left to right, enforce range") << QQuickListView::Horizontal << Qt::LeftToRight << int(QQuickItemView::StrictlyEnforceRange)
- << QPoint(200, 20) << QPoint(20, 20) << 60.0 << 1340.0 << -20.0;
+ << QPoint(200, 20) << QPoint(20, 20) << 60.0 << 700.0 << -20.0;
QTest::newRow("horizontal, right to left, enforce range") << QQuickListView::Horizontal << Qt::RightToLeft << int(QQuickItemView::StrictlyEnforceRange)
- << QPoint(20, 20) << QPoint(200, 20) << -60.0 << -1200.0 - 240.0 - 140.0 << -220.0;
+ << QPoint(20, 20) << QPoint(200, 20) << -60.0 << -560.0 - 240.0 - 140.0 << -220.0;
}
void tst_QQuickListView::snapToItem()