diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2017-12-11 16:55:02 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2017-12-12 20:21:07 +0000 |
commit | 7257862fb2edfab0219d6cd45c83677049404f7d (patch) | |
tree | 72822eeada9ae1b2edc686c18142bf861f9ad780 /tests/auto/widgets/effects | |
parent | 6a5ca7240a03cce4e490b493bb6185df019e7d87 (diff) |
Set sharedPainter correctly for QGraphicsEffect
Autotest is taken from the previously reverted
8b1377fde16a2049a1c27f6d005bff84a8f85f28.
Task-number: QTBUG-60231
Change-Id: I44dd79cba22b6baefdd6d95c176790bef0b7eafe
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'tests/auto/widgets/effects')
-rw-r--r-- | tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp b/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp index a1cb729849..dfe5baba71 100644 --- a/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp +++ b/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp @@ -52,6 +52,7 @@ private slots: void boundingRect2(); void draw(); void opacity(); + void nestedOpaqueOpacity(); void grayscale(); void colorize(); void drawPixmapItem(); @@ -407,6 +408,26 @@ void tst_QGraphicsEffect::opacity() QCOMPARE(effect->m_opacity, qreal(0.5)); } +void tst_QGraphicsEffect::nestedOpaqueOpacity() +{ + // QTBUG-60231: Nesting widgets with a QGraphicsEffect on a toplevel with + // QGraphicsOpacityEffect caused crashes due to constructing several + // QPainter instances on a device in the fast path for + // QGraphicsOpacityEffect::opacity=1 + QWidget topLevel; + topLevel.setWindowTitle(QTest::currentTestFunction()); + topLevel.resize(320, 200); + QGraphicsOpacityEffect *opacityEffect = new QGraphicsOpacityEffect; + opacityEffect->setOpacity(1); + topLevel.setGraphicsEffect(opacityEffect); + QWidget *child = new QWidget(&topLevel); + child->resize(topLevel.size() / 2); + QGraphicsDropShadowEffect *childEffect = new QGraphicsDropShadowEffect; + child->setGraphicsEffect(childEffect); + topLevel.show(); + QVERIFY(QTest::qWaitForWindowExposed(&topLevel)); +} + void tst_QGraphicsEffect::grayscale() { if (qApp->desktop()->depth() < 24) |