summaryrefslogtreecommitdiffstats
path: root/tests/auto/qabstractitemview
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-12-04 18:33:53 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-12-04 18:33:53 (GMT)
commit1bb5999cdca0a70df3f96d596c83c3cf7c97c5fd (patch)
tree71c03d33b9c36fb78a6bc11b8994720ca3823f79 /tests/auto/qabstractitemview
parent696099f8e3179787114df40d6ce6fef97bfa33dc (diff)
parentc0b81480b2909b18ac15bdd124a562ae005c2f41 (diff)
downloadQt-1bb5999cdca0a70df3f96d596c83c3cf7c97c5fd.zip
Qt-1bb5999cdca0a70df3f96d596c83c3cf7c97c5fd.tar.gz
Qt-1bb5999cdca0a70df3f96d596c83c3cf7c97c5fd.tar.bz2
Merge commit 'c0b81480b2909b18ac15bdd124a562ae005c2f41' into origin-4.6
Diffstat (limited to 'tests/auto/qabstractitemview')
-rw-r--r--tests/auto/qabstractitemview/tst_qabstractitemview.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp
index db840f4..6479829 100644
--- a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp
+++ b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp
@@ -46,6 +46,7 @@
#include <qstandarditemmodel.h>
#include <qapplication.h>
#include <qlistview.h>
+#include <qlistwidget.h>
#include <qtableview.h>
#include <qtreeview.h>
#include <qtreewidget.h>
@@ -224,6 +225,7 @@ private slots:
void shiftArrowSelectionAfterScrolling();
void shiftSelectionAfterRubberbandSelection();
void ctrlRubberbandSelection();
+ void QTBUG6407_extendedSelection();
};
class MyAbstractItemDelegate : public QAbstractItemDelegate
@@ -1433,5 +1435,45 @@ void tst_QAbstractItemView::ctrlRubberbandSelection()
QVERIFY(selected.contains(index2));
}
+void tst_QAbstractItemView::QTBUG6407_extendedSelection()
+{
+ QListWidget view;
+ view.setSelectionMode(QAbstractItemView::ExtendedSelection);
+ for(int i = 0; i < 50; ++i)
+ view.addItem(QString::number(i));
+
+ view.resize(200,200);
+
+ view.show();
+ QApplication::setActiveWindow(&view);
+ QTest::qWaitForWindowShown(&view);
+ QTRY_COMPARE(static_cast<QWidget *>(&view), QApplication::activeWindow());
+
+ view.verticalScrollBar()->setValue(view.verticalScrollBar()->maximum());
+ QTest::qWait(20);
+
+ QModelIndex index49 = view.model()->index(49,0);
+ QPoint p = view.visualRect(index49).center();
+ QVERIFY(view.viewport()->rect().contains(p));
+ QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, p);
+ QCOMPARE(view.currentIndex(), index49);
+ QCOMPARE(view.selectedItems().count(), 1);
+
+ QModelIndex index47 = view.model()->index(47,0);
+ p = view.visualRect(index47).center();
+ QVERIFY(view.viewport()->rect().contains(p));
+ QTest::mouseClick(view.viewport(), Qt::LeftButton, Qt::ShiftModifier, p);
+ QCOMPARE(view.currentIndex(), index47);
+ QCOMPARE(view.selectedItems().count(), 3); //49, 48, 47;
+
+ QModelIndex index44 = view.model()->index(44,0);
+ p = view.visualRect(index44).center();
+ QVERIFY(view.viewport()->rect().contains(p));
+ QTest::mouseClick(view.viewport(), Qt::LeftButton, Qt::ShiftModifier, p);
+ QCOMPARE(view.currentIndex(), index44);
+ QCOMPARE(view.selectedItems().count(), 6); //49 .. 44;
+
+}
+
QTEST_MAIN(tst_QAbstractItemView)
#include "tst_qabstractitemview.moc"