tst_QSGGridView enforceRange_rightToLeft fails
Change 9bd6361400
corrected the
highlight range for right to left layout, i.e. positioned relative
to the right. This change fixes the autotest to account for this and
fixes flicking in StrictlyEnforceRange mode with RTL layout.
Task-number: QTBUG-22162
Change-Id: I133b7e647883e51783bcf54111871451a3a7e67f
Reviewed-by: Bea Lam <bea.lam@nokia.com>
This commit is contained in:
parent
89eea17656
commit
15547ac366
|
@ -335,9 +335,6 @@ qreal QQuickGridViewPrivate::snapPosAt(qreal pos) const
|
|||
qreal snapPos = 0;
|
||||
if (!visibleItems.isEmpty()) {
|
||||
qreal highlightStart = highlightRangeStart;
|
||||
if (isRightToLeftTopToBottom())
|
||||
highlightStart = highlightRangeEndValid ? -size() + highlightRangeEnd : -size();
|
||||
|
||||
pos += highlightStart;
|
||||
pos += rowSize()/2;
|
||||
snapPos = static_cast<FxGridItemSG*>(visibleItems.first())->rowPos() - visibleIndex / columns * rowSize();
|
||||
|
@ -346,8 +343,8 @@ qreal QQuickGridViewPrivate::snapPosAt(qreal pos) const
|
|||
qreal maxExtent;
|
||||
qreal minExtent;
|
||||
if (isRightToLeftTopToBottom()) {
|
||||
maxExtent = q->minXExtent();
|
||||
minExtent = q->maxXExtent();
|
||||
maxExtent = q->minXExtent()-size();
|
||||
minExtent = q->maxXExtent()-size();
|
||||
} else {
|
||||
maxExtent = flow == QQuickGridView::LeftToRight ? -q->maxYExtent() : -q->maxXExtent();
|
||||
minExtent = flow == QQuickGridView::LeftToRight ? -q->minYExtent() : -q->minXExtent();
|
||||
|
|
|
@ -2356,18 +2356,17 @@ void tst_QQuickGridView::enforceRange_rightToLeft()
|
|||
QQuickGridView *gridview = findItem<QQuickGridView>(canvas->rootObject(), "grid");
|
||||
QTRY_VERIFY(gridview != 0);
|
||||
|
||||
QTRY_COMPARE(gridview->preferredHighlightBegin(), 100.0);
|
||||
QTRY_COMPARE(gridview->preferredHighlightEnd(), 100.0);
|
||||
QTRY_COMPARE(gridview->highlightRangeMode(), QQuickGridView::StrictlyEnforceRange);
|
||||
QCOMPARE(gridview->preferredHighlightBegin(), 100.0);
|
||||
QCOMPARE(gridview->preferredHighlightEnd(), 100.0);
|
||||
QCOMPARE(gridview->highlightRangeMode(), QQuickGridView::StrictlyEnforceRange);
|
||||
|
||||
QQuickItem *contentItem = gridview->contentItem();
|
||||
QTRY_VERIFY(contentItem != 0);
|
||||
QVERIFY(contentItem != 0);
|
||||
|
||||
// view should be positioned at the top of the range.
|
||||
QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", 0);
|
||||
QTRY_VERIFY(item);
|
||||
QEXPECT_FAIL("", "QTBUG-22162", Abort);
|
||||
QTRY_COMPARE(gridview->contentX(), -100.);
|
||||
QVERIFY(item);
|
||||
QTRY_COMPARE(gridview->contentX(), -140.);
|
||||
QTRY_COMPARE(gridview->contentY(), 0.0);
|
||||
|
||||
QQuickText *name = findItem<QQuickText>(contentItem, "textName", 0);
|
||||
|
@ -2378,11 +2377,11 @@ void tst_QQuickGridView::enforceRange_rightToLeft()
|
|||
QTRY_COMPARE(number->text(), model.number(0));
|
||||
|
||||
// Check currentIndex is updated when contentItem moves
|
||||
gridview->setContentX(-200);
|
||||
gridview->setContentX(-240);
|
||||
QTRY_COMPARE(gridview->currentIndex(), 3);
|
||||
|
||||
gridview->setCurrentIndex(7);
|
||||
QTRY_COMPARE(gridview->contentX(), -300.);
|
||||
QTRY_COMPARE(gridview->contentX(), -340.);
|
||||
QTRY_COMPARE(gridview->contentY(), 0.0);
|
||||
|
||||
TestModel model2;
|
||||
|
|
Loading…
Reference in New Issue