From cd19ab9f306f777b495cceabaf57a6eeaf86a82a Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Tue, 12 Apr 2011 09:32:06 +0300 Subject: Two QListView autotests do not pass on Symbian^3 releases tst_QListView::taskQTBUG_2678_spacingAndWrappedText() fails because: QS60Style adds to the itemview item content size margins and empty space, which shouldn't be part of the content size. As a fix, remove these. taskQTBUG_435_deselectOnViewportClick() fails because: Sending a click to a selected itemview item, when it should be sent to below that specific one. It was using hardcoded (center + 20) and autotest assumed that this would be outside of first item. In S60 with touch support, the itemview items are rather tall (49 pixels). As a fix, autotest now uses calculated value, which ensures that click is sent to outside first item. Task-number: QT-4810 Reviewed-by: Tomi Vihria --- src/gui/styles/qs60style.cpp | 2 -- tests/auto/qlistview/tst_qlistview.cpp | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 585986d..91ac45e 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -2664,8 +2664,6 @@ QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt, } } sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget); - //native items have small empty areas at the beginning and end of menu item - sz.setWidth(sz.width() + 2 * pixelMetric(PM_MenuHMargin) + 2 * QS60StylePrivate::pixelMetric(PM_FrameCornerWidth)); if (QS60StylePrivate::isTouchSupported()) { //Make itemview easier to use in touch devices sz.setHeight(sz.height() + 2 * pixelMetric(PM_FocusFrameVMargin)); diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp index b6e69a0..ee03386 100644 --- a/tests/auto/qlistview/tst_qlistview.cpp +++ b/tests/auto/qlistview/tst_qlistview.cpp @@ -1893,7 +1893,8 @@ void tst_QListView::taskQTBUG_435_deselectOnViewportClick() QCOMPARE(view.selectionModel()->selectedIndexes().count(), model.rowCount()); - QPoint p = view.visualRect(model.index(model.rowCount() - 1)).center() + QPoint(0, 20); + const QRect itemRect = view.visualRect(model.index(model.rowCount() - 1)); + QPoint p = view.visualRect(model.index(model.rowCount() - 1)).center() + QPoint(0, itemRect.height()); //first the left button QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, p); QVERIFY(!view.selectionModel()->hasSelection()); -- cgit v0.12