summaryrefslogtreecommitdiffstats
path: root/tests/auto/qlistview
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-10-30 10:36:30 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-10-30 10:36:30 (GMT)
commitc726e83aebf2252b5a94444d5d61e03ef2033437 (patch)
tree556cb07f28896f3d3dd64cfd6b5ac537eafe2a87 /tests/auto/qlistview
parent2cdea6a10da75b7b8870f27c432a5e02f7500340 (diff)
downloadQt-c726e83aebf2252b5a94444d5d61e03ef2033437.zip
Qt-c726e83aebf2252b5a94444d5d61e03ef2033437.tar.gz
Qt-c726e83aebf2252b5a94444d5d61e03ef2033437.tar.bz2
In ItemViews, right click on the viewport clear the ext selection
Task-number: QTBUG-435 Reviewed-by: Gabriel
Diffstat (limited to 'tests/auto/qlistview')
-rw-r--r--tests/auto/qlistview/tst_qlistview.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp
index 727e6d3..a5ff153 100644
--- a/tests/auto/qlistview/tst_qlistview.cpp
+++ b/tests/auto/qlistview/tst_qlistview.cpp
@@ -120,6 +120,7 @@ private slots:
void taskQTBUG_2233_scrollHiddenItems_data();
void taskQTBUG_2233_scrollHiddenItems();
void taskQTBUG_633_changeModelData();
+ void taskQTBUG_435_deselectOnViewportClick();
};
// Testing get/set functions
@@ -1852,6 +1853,28 @@ void tst_QListView::taskQTBUG_633_changeModelData()
QVERIFY( ! rectLongText.intersects(rect2) );
}
+void tst_QListView::taskQTBUG_435_deselectOnViewportClick()
+{
+ QListView view;
+ QStringListModel model( QStringList() << "1" << "2" << "3" << "4");
+ view.setModel(&model);
+ view.setSelectionMode(QAbstractItemView::ExtendedSelection);
+ view.selectAll();
+ QCOMPARE(view.selectionModel()->selectedIndexes().count(), model.rowCount());
+
+
+ QPoint p = view.visualRect(model.index(model.rowCount() - 1)).center() + QPoint(0, 20);
+ //first the left button
+ QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, p);
+ QVERIFY(!view.selectionModel()->hasSelection());
+
+ view.selectAll();
+ QCOMPARE(view.selectionModel()->selectedIndexes().count(), model.rowCount());
+
+ //and now the right button
+ QTest::mouseClick(view.viewport(), Qt::RightButton, 0, p);
+ QVERIFY(!view.selectionModel()->hasSelection());
+}
QTEST_MAIN(tst_QListView)
#include "tst_qlistview.moc"