diff options
author | Thorbjørn Lund Martsum <tmartsum@gmail.com> | 2012-11-07 08:08:44 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-01-31 13:12:40 +0100 |
commit | 3260aec38ebfdd9f5bc0ce8e5b8e239f30a59c1b (patch) | |
tree | 79634e84c3357461d417bd3ab9c78beb0216b64f /tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp | |
parent | 80fa4b6c8ef4d4b51c6a8c114aed2f7b1bc4db45 (diff) |
QTreeView - emit collapsed in collapseAll()
When we call call collapase we emit collapsed. Therefore it should
also be emitted on collapseAll()
This partly solves:
Task-number: QTBUG-8176
Change-Id: I20c1388fcbbb60d12debb4a0b3b0d9fed41e2563
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Diffstat (limited to 'tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp')
-rw-r--r-- | tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp index 2256a252f5..402cf27dd4 100644 --- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp @@ -1637,8 +1637,7 @@ void tst_QTreeView::expandAndCollapseAll() for (int r = 0; r < rows; ++r) parents.push(model.index(r, 0, p)); } -// ### why is collapsed() signal not emitted? -// QCOMPARE(collapsedSpy.count(), count); + QCOMPARE(collapsedSpy.count(), 12); } void tst_QTreeView::expandWithNoChildren() @@ -4206,6 +4205,7 @@ void tst_QTreeView::taskQTBUG_8176_emitOnExpandAll() QTreeWidgetItem *item5 = new QTreeWidgetItem(&tw, QStringList(QString("item 5"))); new QTreeWidgetItem(item5, QStringList(QString("item 6"))); QSignalSpy spy(&tw, SIGNAL(expanded(const QModelIndex&))); + // expand all tw.expandAll(); QCOMPARE(spy.size(), 6); @@ -4215,6 +4215,16 @@ void tst_QTreeView::taskQTBUG_8176_emitOnExpandAll() spy.clear(); tw.expandAll(); QCOMPARE(spy.size(), 5); + + // collapse all + QSignalSpy spy2(&tw, SIGNAL(collapsed(const QModelIndex&))); + tw.collapseAll(); + QCOMPARE(spy2.size(), 6); + tw.expandAll(); + item2->setExpanded(false); + spy2.clear(); + tw.collapseAll(); + QCOMPARE(spy2.size(), 5); } #ifndef QT_NO_ANIMATION |