diff options
author | Bea Lam <bea.lam@nokia.com> | 2011-07-13 13:46:57 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-07-21 02:35:45 +0200 |
commit | 0592e17e18e26acc177bc7556a3c9888582f0045 (patch) | |
tree | c66df0adb57ecfbd7eab1105f139e10aed72da36 /tests | |
parent | 7141596fae74938c907209482a46ecb73df1d4f8 (diff) |
Make lastPosition() result consistent among GridView and ListView
lastPosition() returns the end position of the last item so it should
always include a -1 calculation for the last item (as
FxListItemSG::endPosition() and FxGridItemSG::endPosition() do) to get
the last edge pixel of the item. With this fix, both views now
calculate startPosition() and endPosition() in the same way.
This also fixes positioning of GridView items in TopToBottom+RightToLeft
layouts. Incorrect test values in positionViewAtIndex_rightToLeft()
test are fixed (the last edge of a 1-pixel border shouldn't be visible,
since the bottom edge of a 1-pixel border is actually drawn outside,
not inside, the Rectangle).
Change-Id: I253c3836f871c61e13c08f67007ebc75e09378d6
Reviewed-on: http://codereview.qt.nokia.com/1547
Reviewed-by: Bea Lam <bea.lam@nokia.com>
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/declarative/qsggridview/tst_qsggridview.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/auto/declarative/qsggridview/tst_qsggridview.cpp b/tests/auto/declarative/qsggridview/tst_qsggridview.cpp index 5310632d98..39359d1c10 100644 --- a/tests/auto/declarative/qsggridview/tst_qsggridview.cpp +++ b/tests/auto/declarative/qsggridview/tst_qsggridview.cpp @@ -1236,7 +1236,7 @@ void tst_QSGGridView::positionViewAtIndex() // Position on an item that would leave empty space if positioned at the top gridview->positionViewAtIndex(31, QSGGridView::Beginning); QTRY_COMPARE(gridview->indexAt(120, 630), 31); - QTRY_COMPARE(gridview->contentY(), 521.); // 520 then +1 so bottom edge of last item is visible + QTRY_COMPARE(gridview->contentY(), 520.); // Confirm items positioned correctly itemCount = findItems<QSGItem>(contentItem, "wrapper").count(); @@ -1528,7 +1528,7 @@ void tst_QSGGridView::positionViewAtIndex_rightToLeft() // Position on an item that would leave empty space if positioned at the top gridview->positionViewAtIndex(31, QSGGridView::Beginning); - QTRY_COMPARE(gridview->contentX(), -639.); + QTRY_COMPARE(gridview->contentX(), -640.); // Confirm items positioned correctly itemCount = findItems<QSGItem>(contentItem, "wrapper").count(); |