summaryrefslogtreecommitdiffstats
path: root/tests/auto/qtreeview
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-10-27 13:43:42 +0100
committerThierry Bastian <thierry.bastian@nokia.com>2009-10-27 13:44:57 +0100
commitd683fd25512dedacdac141222db36209ef65e42d (patch)
treebf47224d501aba6f0fa1305e7f86f71777e2c677 /tests/auto/qtreeview
parent0897713a560700f574386499a872f59e3fc4ce7d (diff)
Fixed QTreeView not emitting doubleCliked when 1st col is spanned
Task-number: QTBUG-976 Reviewed-by: ogoffart
Diffstat (limited to 'tests/auto/qtreeview')
-rw-r--r--tests/auto/qtreeview/tst_qtreeview.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp
index cbc999f2f6..1429771a12 100644
--- a/tests/auto/qtreeview/tst_qtreeview.cpp
+++ b/tests/auto/qtreeview/tst_qtreeview.cpp
@@ -235,6 +235,7 @@ private slots:
void task254234_proxySort();
void task248022_changeSelection();
void task245654_changeModelAndExpandAll();
+ void doubleClickedWithSpans();
};
class QtTestModel: public QAbstractItemModel
@@ -3544,6 +3545,34 @@ void tst_QTreeView::task245654_changeModelAndExpandAll()
}
+void tst_QTreeView::doubleClickedWithSpans()
+{
+ QTreeView view;
+ QStandardItemModel model(1, 2);
+ view.setModel(&model);
+ view.setFirstColumnSpanned(0, QModelIndex(), true);
+ view.show();
+
+ QPoint p(10, 10);
+ QCOMPARE(view.indexAt(p), model.index(0, 0));
+ QSignalSpy spy(&view, SIGNAL(doubleClicked(QModelIndex)));
+ QTest::mousePress(view.viewport(), Qt::LeftButton, 0, p);
+ QTest::mouseDClick(view.viewport(), Qt::LeftButton, 0, p);
+ QTest::mouseRelease(view.viewport(), Qt::LeftButton, 0, p);
+ QCOMPARE(spy.count(), 1);
+
+ //let's click on the 2nd column
+ p.setX(p.x() + view.header()->sectionSize(0));
+ QCOMPARE(view.indexAt(p), model.index(0, 0));
+
+ //end the previous edition
+ QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, p);
+ QTest::qWait(100);
+ QTest::mousePress(view.viewport(), Qt::LeftButton, 0, p);
+ QTest::mouseDClick(view.viewport(), Qt::LeftButton, 0, p);
+ QTest::mouseRelease(view.viewport(), Qt::LeftButton, 0, p);
+ QCOMPARE(spy.count(), 2);
+}
QTEST_MAIN(tst_QTreeView)
#include "tst_qtreeview.moc"