summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qpainter/tst_qpainter.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp
index 9e98013..5d5f9c6 100644
--- a/tests/auto/qpainter/tst_qpainter.cpp
+++ b/tests/auto/qpainter/tst_qpainter.cpp
@@ -269,6 +269,8 @@ private slots:
void drawTextOutsideGuiThread();
+ void QTBUG26013_squareCapStroke();
+
private:
void fillData();
void setPenColor(QPainter& p);
@@ -4780,6 +4782,34 @@ void tst_QPainter::drawTextOutsideGuiThread()
QCOMPARE(referenceRendering, t.rendering);
}
+void tst_QPainter::QTBUG26013_squareCapStroke()
+{
+ QImage image(4, 4, QImage::Format_RGB32);
+
+ QPainter p(&image);
+ p.setPen(QPen(Qt::black, 0, Qt::SolidLine, Qt::SquareCap));
+
+ for (int i = 0; i < 3; ++i) {
+ qreal d = i / 3.0;
+
+ image.fill(0xffffffff);
+
+ p.drawLine(QLineF(0, d, 0, d + 2));
+ p.drawLine(QLineF(1, d, 3, d));
+
+ // ensure that a horizontal line and a vertical line with square cap round up (downwards) at the same time
+ QCOMPARE(image.pixel(0, 0), image.pixel(1, 0));
+
+ image.fill(0xffffffff);
+
+ p.drawLine(QLineF(d, 0, d + 2, 0));
+ p.drawLine(QLineF(d, 1, d, 3));
+
+ // ensure that a vertical line and a horizontal line with square cap round up (to the right) at the same time
+ QCOMPARE(image.pixel(0, 0), image.pixel(0, 1));
+ }
+}
+
QTEST_MAIN(tst_QPainter)
#include "tst_qpainter.moc"