summaryrefslogtreecommitdiffstats
path: root/tests/auto/qpainter
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2011-02-22 13:44:58 (GMT)
committerSamuel Rødal <samuel.rodal@nokia.com>2011-02-22 13:54:12 (GMT)
commit9d019830169289a3aa00e8baca9c320963904993 (patch)
tree03e2a689b96cca552037bc88411410c0e8e7e5b4 /tests/auto/qpainter
parentdb9925a187a9ad395ba2cabf23487b9a0e09c67c (diff)
downloadQt-9d019830169289a3aa00e8baca9c320963904993.zip
Qt-9d019830169289a3aa00e8baca9c320963904993.tar.gz
Qt-9d019830169289a3aa00e8baca9c320963904993.tar.bz2
Prevent infinite loop in raster engine on zero dash pattern length.
Task-number: QTBUG-17053 Reviewed-by: Kim
Diffstat (limited to 'tests/auto/qpainter')
-rw-r--r--tests/auto/qpainter/tst_qpainter.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp
index 4cf64f1..c9eca89 100644
--- a/tests/auto/qpainter/tst_qpainter.cpp
+++ b/tests/auto/qpainter/tst_qpainter.cpp
@@ -258,6 +258,8 @@ private slots:
void QTBUG14614_gradientCacheRaceCondition();
void drawTextOpacity();
+ void QTBUG17053_zeroDashPattern();
+
private:
void fillData();
void setPenColor(QPainter& p);
@@ -4601,6 +4603,26 @@ void tst_QPainter::drawTextOpacity()
QCOMPARE(image, copy);
}
+void tst_QPainter::QTBUG17053_zeroDashPattern()
+{
+ QImage image(32, 32, QImage::Format_RGB32);
+ image.fill(0xffffffff);
+
+ QImage original = image;
+
+ QVector<qreal> pattern;
+ pattern << qreal(0) << qreal(0);
+
+ QPainter p(&image);
+ QPen pen(Qt::black, 2.0);
+ pen.setDashPattern(pattern);
+
+ p.setPen(pen);
+ p.drawLine(0, 0, image.width(), image.height());
+
+ QCOMPARE(image, original);
+}
+
QTEST_MAIN(tst_QPainter)
#include "tst_qpainter.moc"