diff options
author | Sergio Martins <sergio.martins@kdab.com> | 2018-07-11 14:01:10 +0100 |
---|---|---|
committer | Sérgio Martins <sergio.martins@kdab.com> | 2018-07-17 11:24:29 +0000 |
commit | 856284d525f7c7958e76843cac46d718f5325275 (patch) | |
tree | f2da679dc99077a5a2212356b78f69d9d307f008 /tests | |
parent | 37bd2400fa0f36c8f7ef7cbb06d0f05e15356b5b (diff) |
Reset geometry constraints when removing stylesheet
CSS geometry constraints such as "min-height" or "min-width"
will set size constraints on the widget.
Removing the stylesheet should remove these constraints.
Task-Id: QTBUG-69418
Change-Id: I1008e4390281c90112303d72dd7d59a8acddfcd9
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp index 28a099de83..6d47d5cfb6 100644 --- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp +++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp @@ -98,6 +98,7 @@ private slots: void widgetStyle(); void appStyle(); void QTBUG11658_cachecrash(); + void unpolish(); private: QColor COLOR(const QWidget& w) { w.ensurePolished(); @@ -1999,6 +2000,17 @@ void tst_QStyleSheetStyle::widgetStylePropagation() QCOMPARE(COLOR(childLabel), childExpectedColor); } +void tst_QStyleSheetStyle::unpolish() +{ + QWidget w; + QCOMPARE(w.minimumWidth(), 0); + w.setStyleSheet("QWidget { min-width: 100; }"); + w.ensurePolished(); + QCOMPARE(w.minimumWidth(), 100); + w.setStyleSheet(""); + QCOMPARE(w.minimumWidth(), 0); +} + QTEST_MAIN(tst_QStyleSheetStyle) #include "tst_qstylesheetstyle.moc" |