summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2021-11-23 17:05:05 +0100
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2021-11-29 16:02:28 +0100
commit56da533b45e2785e8fd54ef6fcddb7b973c665bf (patch)
treefd346c37a3ca2a8ca35ade168d76cf082ba21baa /tests
parent8fbedf2196a292fe2affcf83ddc846b9c852772a (diff)
Never handle scrollbars styled with box or border changes as transient
If scrollbars are styled with a style sheet that includes a box or removes off the native border, then we never treat them as transient or overlapping. Otherwise, the layout logic in QAbstractScrollArea will show them on top of the viewport, overlapping the content. Add case to the style sheet test baseline test. It's a test for scrollbars in a scroll area, rather than a test for the styling of the scrollbars themselves. Fixes: QTBUG-98289 Pick-to: 6.2 Change-Id: Ic53ad248b3eedd54722ac7b2fe5256a27092dbc1 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/baseline/stylesheet/qss/qscrollarea/no_border.qss1
-rw-r--r--tests/baseline/stylesheet/qss/qscrollarea/styled_scrollbars.qss72
-rw-r--r--tests/baseline/stylesheet/tst_baseline_stylesheet.cpp19
3 files changed, 92 insertions, 0 deletions
diff --git a/tests/baseline/stylesheet/qss/qscrollarea/no_border.qss b/tests/baseline/stylesheet/qss/qscrollarea/no_border.qss
new file mode 100644
index 0000000000..0c9744de7c
--- /dev/null
+++ b/tests/baseline/stylesheet/qss/qscrollarea/no_border.qss
@@ -0,0 +1 @@
+border: none
diff --git a/tests/baseline/stylesheet/qss/qscrollarea/styled_scrollbars.qss b/tests/baseline/stylesheet/qss/qscrollarea/styled_scrollbars.qss
new file mode 100644
index 0000000000..94fa3db183
--- /dev/null
+++ b/tests/baseline/stylesheet/qss/qscrollarea/styled_scrollbars.qss
@@ -0,0 +1,72 @@
+QScrollBar:horizontal {
+ border: 2px solid grey;
+ background: #32CC99;
+ height: 15px;
+ margin: 0px 20px 0 20px;
+}
+QScrollBar::handle:horizontal {
+ background: white;
+ min-width: 20px;
+}
+QScrollBar::add-line:horizontal {
+ border: 2px solid grey;
+ background: #32CC99;
+ width: 20px;
+ subcontrol-position: right;
+ subcontrol-origin: margin;
+}
+
+QScrollBar::sub-line:horizontal {
+ border: 2px solid grey;
+ background: #32CC99;
+ width: 20px;
+ subcontrol-position: left;
+ subcontrol-origin: margin;
+}
+
+QScrollBar:left-arrow:horizontal, QScrollBar::right-arrow:horizontal {
+ border: 2px solid grey;
+ width: 3px;
+ height: 3px;
+ background: white;
+}
+
+QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal {
+ background: none;
+}
+
+QScrollBar:vertical {
+ border: 2px solid grey;
+ background: #32CC99;
+ width: 15px;
+ margin: 22px 0 22px 0;
+}
+QScrollBar::handle:vertical {
+ background: white;
+ min-height: 20px;
+}
+QScrollBar::add-line:vertical {
+ border: 2px solid grey;
+ background: #32CC99;
+ height: 20px;
+ subcontrol-position: bottom;
+ subcontrol-origin: margin;
+}
+
+QScrollBar::sub-line:vertical {
+ border: 2px solid grey;
+ background: #32CC99;
+ height: 20px;
+ subcontrol-position: top;
+ subcontrol-origin: margin;
+}
+QScrollBar::up-arrow:vertical, QScrollBar::down-arrow:vertical {
+ border: 2px solid grey;
+ width: 3px;
+ height: 3px;
+ background: white;
+}
+
+QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {
+ background: none;
+}
diff --git a/tests/baseline/stylesheet/tst_baseline_stylesheet.cpp b/tests/baseline/stylesheet/tst_baseline_stylesheet.cpp
index fe666d83e8..99b21b4bb5 100644
--- a/tests/baseline/stylesheet/tst_baseline_stylesheet.cpp
+++ b/tests/baseline/stylesheet/tst_baseline_stylesheet.cpp
@@ -46,6 +46,9 @@ private slots:
void tst_QToolButton_data();
void tst_QToolButton();
+ void tst_QScrollArea_data();
+ void tst_QScrollArea();
+
private:
QDir styleSheetDir;
};
@@ -151,6 +154,22 @@ void tst_Stylesheet::tst_QToolButton()
QBASELINE_TEST(takeSnapshot());
}
+void tst_Stylesheet::tst_QScrollArea_data()
+{
+ loadTestFiles();
+}
+
+void tst_Stylesheet::tst_QScrollArea()
+{
+ QHBoxLayout *layout = new QHBoxLayout;
+ QTableWidget *table = new QTableWidget(20, 20);
+ layout->addWidget(table);
+ testWindow()->setLayout(layout);
+
+ makeVisible();
+ QBASELINE_TEST(takeSnapshot());
+}
+
#define main _realmain
QTEST_MAIN(tst_Stylesheet)
#undef main