summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@digia.com>2012-10-10 16:14:32 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-17 13:06:53 +0200
commit54e53d3ca97a30acfcb50eee9d28c93d684753b7 (patch)
tree2387dfaa1e5d97ec52c65a0b56528273e76bb675 /tests
parent429e80f10aaa3b710b03960c9169b4c296d9df0f (diff)
Fixed cosmetic line drawing where begin and end points are equal.
This case has typically required specific work-arounds in other rendering paths as well. (cherry picked from commit dfb55f8a6c8d3ec4da840191c331ace3c2aa2bf3) Task-number: QTBUG-25153 Change-Id: I217e710a30222792ebca3bf297e438d944c32992 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qpainter/tst_qpainter.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp
index c21f3b59e5..fc2d0453cd 100644
--- a/tests/auto/qpainter/tst_qpainter.cpp
+++ b/tests/auto/qpainter/tst_qpainter.cpp
@@ -270,6 +270,7 @@ private slots:
void drawTextOutsideGuiThread();
void QTBUG26013_squareCapStroke();
+ void QTBUG25153_drawLine();
private:
void fillData();
@@ -4810,6 +4811,26 @@ void tst_QPainter::QTBUG26013_squareCapStroke()
}
}
+void tst_QPainter::QTBUG25153_drawLine()
+{
+ QImage image(2, 2, QImage::Format_RGB32);
+
+ QVector<Qt::PenCapStyle> styles;
+ styles << Qt::FlatCap << Qt::SquareCap << Qt::RoundCap;
+
+ foreach (Qt::PenCapStyle style, styles) {
+ image.fill(0xffffffff);
+ QPainter p(&image);
+ p.setPen(QPen(Qt::black, 0, Qt::SolidLine, style));
+ p.drawLine(QLineF(0, 0, 0, 0));
+ p.end();
+
+ QCOMPARE(image.pixel(0, 0), 0xff000000);
+ QCOMPARE(image.pixel(0, 1), 0xffffffff);
+ QCOMPARE(image.pixel(1, 0), 0xffffffff);
+ }
+}
+
QTEST_MAIN(tst_QPainter)
#include "tst_qpainter.moc"