summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp')
-rw-r--r--tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
index d8bb34933a..32437050f5 100644
--- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
+++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
@@ -167,6 +167,7 @@ private slots:
void task_QTBUG_52027_mapCompleterIndex();
void checkMenuItemPosWhenStyleSheetIsSet();
void checkEmbeddedLineEditWhenStyleSheetIsSet();
+ void propagateStyleChanges();
private:
PlatformInputContext m_platformInputContext;
@@ -3586,5 +3587,50 @@ void tst_QComboBox::checkEmbeddedLineEditWhenStyleSheetIsSet()
qApp->setStyleSheet(oldCss);
}
+/*!
+ Tests that the style-based frame style propagates to the internal container
+ widget of QComboBox when the style changes by verifying that the respective
+ styleHint is asked for when the style changes.
+
+ See QTBUG-92488
+*/
+void tst_QComboBox::propagateStyleChanges()
+{
+ class FrameStyle : public QProxyStyle
+ {
+ public:
+ FrameStyle(int frameStyle, QStyle *style = nullptr)
+ : QProxyStyle(style), frameStyle(frameStyle)
+ {}
+
+ int styleHint(QStyle::StyleHint hint, const QStyleOption *opt,
+ const QWidget *widget, QStyleHintReturn *returnData) const
+ {
+ if (hint == QStyle::SH_ComboBox_PopupFrameStyle) {
+ inquired = true;
+ return frameStyle;
+ }
+ return QProxyStyle::styleHint(hint, opt, widget, returnData);
+ }
+
+ int frameStyle;
+ mutable bool inquired = false;
+ };
+
+ FrameStyle framelessStyle(QFrame::NoFrame);
+ FrameStyle frameStyle(QFrame::Plain | QFrame::Sunken);
+
+ QComboBox combo;
+ // container will be created and take settings from this style
+ combo.setStyle(&framelessStyle);
+ QVERIFY(framelessStyle.inquired);
+ combo.addItem(QLatin1String("Open"));
+ combo.addItem(QLatin1String("Close"));
+ // needed because of QComboBox's adjustSizeTimer not doing anything otherwise
+ combo.setSizeAdjustPolicy(QComboBox::AdjustToContents);
+ combo.setStyle(&frameStyle);
+ QVERIFY(frameStyle.inquired);
+}
+
QTEST_MAIN(tst_QComboBox)
#include "tst_qcombobox.moc"