Baseline: add stylesheet setting show-decoration-selected for treeview
The fix for QTBUG-73251 in f4976f86cd
resulted in QTBUG-106227. Add baseline test coverage for the respective
configuration to make sure we don't regress.
Refactor mapping of index to configuration to make accessing of subitems
more robust.
Task-number: QTBUG-73251
Pick-to: 6.4 6.2
Change-Id: I530ecd67fa5663f219884f641bc5e25c7ac5fe73
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
This commit is contained in:
parent
273b13dbd1
commit
6f9d31be49
@ -0,0 +1,3 @@
|
||||
QTreeView {
|
||||
show-decoration-selected: 1
|
||||
}
|
@ -160,19 +160,29 @@ void tst_Stylesheet::tst_QTreeView()
|
||||
tw->header()->hide();
|
||||
layout->addWidget(tw);
|
||||
|
||||
for (int i = 0; i < 6; ++i) {
|
||||
enum {
|
||||
Unchecked = 0,
|
||||
Checked = 1,
|
||||
Children = 2,
|
||||
Disabled = 3,
|
||||
CheckedDisabled = 4,
|
||||
ChildrenDisabled = 5,
|
||||
NConfigs
|
||||
};
|
||||
|
||||
for (int i = 0; i < NConfigs; ++i) {
|
||||
QTreeWidgetItem *topLevelItem = new QTreeWidgetItem(tw, QStringList{QString("top %1").arg(i)});
|
||||
switch (i) {
|
||||
case 0:
|
||||
case 3:
|
||||
case Unchecked:
|
||||
case Disabled:
|
||||
topLevelItem->setCheckState(0, Qt::Unchecked);
|
||||
break;
|
||||
case 1:
|
||||
case 4:
|
||||
case Checked:
|
||||
case CheckedDisabled:
|
||||
topLevelItem->setCheckState(0, Qt::Checked);
|
||||
break;
|
||||
case 2:
|
||||
case 5:
|
||||
case Children:
|
||||
case ChildrenDisabled:
|
||||
topLevelItem->setCheckState(0, Qt::PartiallyChecked);
|
||||
topLevelItem->setExpanded(true);
|
||||
for (int j = 0; j < 2; ++j) {
|
||||
@ -181,7 +191,7 @@ void tst_Stylesheet::tst_QTreeView()
|
||||
}
|
||||
break;
|
||||
}
|
||||
topLevelItem->setDisabled(i > 2);
|
||||
topLevelItem->setDisabled(i >= Disabled);
|
||||
}
|
||||
testWindow()->setLayout(layout);
|
||||
tw->setRootIsDecorated(true);
|
||||
@ -190,6 +200,9 @@ void tst_Stylesheet::tst_QTreeView()
|
||||
QBASELINE_CHECK_DEFERRED(takeSnapshot(), "rootDecorated");
|
||||
tw->setRootIsDecorated(false);
|
||||
QBASELINE_CHECK_DEFERRED(takeSnapshot(), "rootNotDecorated");
|
||||
|
||||
tw->topLevelItem(Children)->child(0)->setSelected(true);
|
||||
QBASELINE_CHECK_DEFERRED(takeSnapshot(), "itemSelected");
|
||||
}
|
||||
|
||||
#define main _realmain
|
||||
|
Loading…
Reference in New Issue
Block a user