summaryrefslogtreecommitdiffstats
path: root/tests/auto/qstylesheetstyle
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2011-02-14 09:57:26 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2011-02-14 12:50:51 (GMT)
commit0bf70c35bd51be4435c95f28dab96bf9f00b49db (patch)
treedad35efe42cc9e5ed3ae9d7f9c95ab13add5c0e5 /tests/auto/qstylesheetstyle
parenta1f695f7b3b671c26925d41fba7dff1d3cb49da2 (diff)
downloadQt-0bf70c35bd51be4435c95f28dab96bf9f00b49db.zip
Qt-0bf70c35bd51be4435c95f28dab96bf9f00b49db.tar.gz
Qt-0bf70c35bd51be4435c95f28dab96bf9f00b49db.tar.bz2
QStyleSheetStyle: dont crash in PE_WIDGET when widget is null
Reviewed-by: Gabriel Task-number: QTBUG-15910
Diffstat (limited to 'tests/auto/qstylesheetstyle')
-rw-r--r--tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp
index f3e21a0..c386ffb 100644
--- a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp
+++ b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp
@@ -100,6 +100,7 @@ private slots:
void task188195_baseBackground();
void task232085_spinBoxLineEditBg();
void changeStyleInChangeEvent();
+ void QTBUG15910_crashNullWidget();
//at the end because it mess with the style.
void widgetStyle();
@@ -1626,6 +1627,24 @@ void tst_QStyleSheetStyle::changeStyleInChangeEvent()
wid.ensurePolished();
}
+void tst_QStyleSheetStyle::QTBUG15910_crashNullWidget()
+{
+ struct : QWidget {
+ virtual void paintEvent(QPaintEvent* ) {
+ QStyleOption opt;
+ opt.init(this);
+ QPainter p(this);
+ style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, 0);
+ style()->drawPrimitive(QStyle::PE_Frame, &opt, &p, 0);
+ style()->drawControl(QStyle::CE_PushButton, &opt, &p, 0);
+ }
+ } w;
+ w.setStyleSheet("* { background-color: white; color:black; border 3px solid yellow }");
+ w.show();
+ QTest::qWaitForWindowShown(&w);
+}
+
+
QTEST_MAIN(tst_QStyleSheetStyle)
#include "tst_qstylesheetstyle.moc"