diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2015-04-06 19:10:10 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2015-04-06 19:10:25 +0200 |
commit | 20cac3d9c9c22153e9e316daff32b6050ff6be6b (patch) | |
tree | b563a89475df9afb4f40841ec371be9488d5b1ed /tests/auto/gui/painting | |
parent | 8ce85d74b692392a4ea0785360156f37418cff13 (diff) | |
parent | 9eb0b09abce28b11e4915fc9c3b3e996eb19cef2 (diff) |
Merge remote-tracking branch 'origin/5.5' into dev
Change-Id: If9fd98525b6b4ca07e5e006fc98bf372a73b8a21
Diffstat (limited to 'tests/auto/gui/painting')
-rw-r--r-- | tests/auto/gui/painting/qpainter/tst_qpainter.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp index f6167262a9..6582755aec 100644 --- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp +++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp @@ -291,6 +291,10 @@ private slots: void RasterOp_NotDestination(); void drawTextNoHinting(); + + void drawPolyline_data(); + void drawPolyline(); + private: void fillData(); void setPenColor(QPainter& p); @@ -4874,6 +4878,39 @@ void tst_QPainter::drawTextNoHinting() QVERIFY(true); } +void tst_QPainter::drawPolyline_data() +{ + QTest::addColumn< QVector<QPointF> >("points"); + + QTest::newRow("basic") << (QVector<QPointF>() << QPointF(10, 10) << QPointF(20, 10) << QPointF(20, 20) << QPointF(10, 20)); + QTest::newRow("clipped") << (QVector<QPointF>() << QPoint(-10, 100) << QPoint(-1, 100) << QPoint(-1, -2) << QPoint(100, -2) << QPoint(100, 40)); // QTBUG-31579 + QTest::newRow("shortsegment") << (QVector<QPointF>() << QPoint(20, 100) << QPoint(20, 99) << QPoint(21, 99) << QPoint(21, 104)); // QTBUG-42398 +} + +void tst_QPainter::drawPolyline() +{ + QFETCH(QVector<QPointF>, points); + QImage images[2]; + + for (int r = 0; r < 2; r++) { + images[r] = QImage(150, 150, QImage::Format_ARGB32); + images[r].fill(Qt::transparent); + QPainter p(images + r); + QPen pen(Qt::red, 0, Qt::SolidLine, Qt::FlatCap); + p.setPen(pen); + QVERIFY(p.pen().isCosmetic()); + if (r) { + for (int i = 0; i < points.count()-1; i++) { + p.drawLine(points.at(i), points.at(i+1)); + } + } else { + p.drawPolyline(points); + } + } + + QCOMPARE(images[0], images[1]); +} + QTEST_MAIN(tst_QPainter) #include "tst_qpainter.moc" |