summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/itemviews
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2019-12-03 06:55:21 +0100
committerLiang Qi <liang.qi@qt.io>2019-12-03 06:57:05 +0100
commite62d04b933a91c2bdd347aa97dc15ba210a04d2a (patch)
tree67c67af5f59d9b71522738da8a8d2d803e3ff44f /tests/auto/widgets/itemviews
parentf81f21151d30a37f955aa4af2398a96507626b15 (diff)
parent9ac156c90b92a981f70929e081c64083b14e9a57 (diff)
Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts: src/corelib/serialization/qcborvalue.cpp Change-Id: I675a3029955c96e81a33ed9d98b72b55b6784b52
Diffstat (limited to 'tests/auto/widgets/itemviews')
-rw-r--r--tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
index 23e2ec8516..8396fd4ec7 100644
--- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
+++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
@@ -4922,13 +4922,27 @@ void tst_QTreeView::taskQTBUG_61476()
const QPoint pos = rect.center();
QTest::mousePress(tv.viewport(), Qt::LeftButton, {}, pos);
- if (tv.style()->styleHint(QStyle::SH_ListViewExpand_SelectMouseType, nullptr, &tv) ==
- QEvent::MouseButtonPress)
+ const bool expandsOnPress =
+ (tv.style()->styleHint(QStyle::SH_ListViewExpand_SelectMouseType, nullptr, &tv) == QEvent::MouseButtonPress);
+ if (expandsOnPress)
QTRY_VERIFY(!tv.isExpanded(mi));
QTest::mouseRelease(tv.viewport(), Qt::LeftButton, {}, pos);
QTRY_VERIFY(!tv.isExpanded(mi));
QCOMPARE(lastTopLevel->checkState(), Qt::Checked);
+
+ // Test that it does not toggle the check state of a previously selected item when collapsing an
+ // item causes it to position the item under the mouse to be the decoration for the selected item
+ tv.expandAll();
+ tv.verticalScrollBar()->setValue(tv.verticalScrollBar()->maximum());
+ // It is not enough to programmatically select the item, we need to have it clicked on
+ QTest::mouseClick(tv.viewport(), Qt::LeftButton, {}, tv.visualRect(lastTopLevel->index()).center());
+ QTest::mousePress(tv.viewport(), Qt::LeftButton, {}, pos);
+ if (expandsOnPress)
+ QTRY_VERIFY(!tv.isExpanded(mi));
+ QTest::mouseRelease(tv.viewport(), Qt::LeftButton, nullptr, pos);
+ QTRY_VERIFY(!tv.isExpanded(mi));
+ QCOMPARE(lastTopLevel->checkState(), Qt::Checked);
}
QTEST_MAIN(tst_QTreeView)