diff options
Diffstat (limited to 'tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp')
-rw-r--r-- | tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp index 61b1fed1f8..a671a6c4d8 100644 --- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp +++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp @@ -48,6 +48,7 @@ public: private slots: void init(); void repolish(); + void repolish_without_crashing(); void numinstances(); void widgetsBeforeAppStyleSheet(); void widgetsAfterAppStyleSheet(); @@ -367,6 +368,26 @@ void tst_QStyleSheetStyle::repolish() QCOMPARE(BACKGROUND(p1), APPBACKGROUND(p1)); } +void tst_QStyleSheetStyle::repolish_without_crashing() +{ + // This used to crash, QTBUG-69204 + QMainWindow w; + QScopedPointer<QSplitter> splitter1(new QSplitter(w.centralWidget())); + QScopedPointer<QSplitter> splitter2(new QSplitter); + QScopedPointer<QSplitter> splitter3(new QSplitter); + splitter2->addWidget(splitter3.data()); + + splitter2->setStyleSheet("color: red"); + QScopedPointer<QLabel> label(new QLabel); + label->setTextFormat(Qt::RichText); + splitter3->addWidget(label.data()); + label->setText("hey"); + + splitter1->addWidget(splitter2.data()); + w.show(); + QCOMPARE(COLOR(*label), QColor(Qt::red)); +} + void tst_QStyleSheetStyle::widgetStyle() { qApp->setStyleSheet(QString()); |