diff options
author | Samuel Rødal <sroedal@trolltech.com> | 2009-06-16 07:03:15 (GMT) |
---|---|---|
committer | Samuel Rødal <sroedal@trolltech.com> | 2009-06-17 14:29:42 (GMT) |
commit | e3736c5031b941a665952a9696d989d79b25f32f (patch) | |
tree | 9f710909aebda6565bd4b854c020646f9192c28d /tests | |
parent | c57e8b1e92c369c2aa507ebfa6cfebe18a282635 (diff) | |
download | Qt-e3736c5031b941a665952a9696d989d79b25f32f.zip Qt-e3736c5031b941a665952a9696d989d79b25f32f.tar.gz Qt-e3736c5031b941a665952a9696d989d79b25f32f.tar.bz2 |
Fixed segmentation fault caused by empty clip.
Make sure not to use the broken QRect constructor, and do an early check
on whether the clip rect is empty in QRasterizer::rasterizeLine().
Task-number: 254105
Reviewed-by: Trond
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qpainter/tst_qpainter.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp index dcf9a04..cb532ce 100644 --- a/tests/auto/qpainter/tst_qpainter.cpp +++ b/tests/auto/qpainter/tst_qpainter.cpp @@ -227,6 +227,7 @@ private slots: void extendedBlendModes(); void zeroOpacity(); + void emptyClip(); private: void fillData(); @@ -4194,5 +4195,23 @@ void tst_QPainter::zeroOpacity() QCOMPARE(target.pixel(0, 0), 0xff000000); } +void tst_QPainter::emptyClip() +{ + QImage img(64, 64, QImage::Format_ARGB32_Premultiplied); + QPainter p(&img); + p.setRenderHints(QPainter::Antialiasing); + p.setClipRect(0, 32, 64, 0); + p.fillRect(0, 0, 64, 64, Qt::white); + + QPainterPath path; + path.lineTo(64, 0); + path.lineTo(64, 64); + path.lineTo(40, 64); + path.lineTo(40, 80); + path.lineTo(0, 80); + + p.fillPath(path, Qt::green); +} + QTEST_MAIN(tst_QPainter) #include "tst_qpainter.moc" |