path: root/tests
diff options
authorGiuseppe D'Angelo <>2021-03-25 18:26:49 +0100
committerQt Cherry-pick Bot <>2021-03-26 13:12:58 +0000
commite2a7381641136bc0e347e59aa27050e359f32045 (patch)
treee3c5819edfbb4bf2277134fdbce3ac86f86cd5bb /tests
parent8f7bcbf1c686d3291b58c77dc59d5dca9c7a4b6a (diff)
QPainterPath: fix handling of fill rules
fillRule() contained a major blunder: instead of checking if the d-pointer was allocated, and return a default value if it wasn't, it checked whether the path contained any points. This means that QPainterPath p; p.setFillRule(x); Q_ASSERT(p.fillRule() == x); was failing. As a drive-by to test this change, fix another mistake in clear(): clear is documented to clear the elements in a path, but instead it also changed the fill rule. This commit partially reverses 697910e5fbd382e78bc1bcbac3f5824aded059b4. Change-Id: Ieb8145694b672439c3380d9ccb87d1206a2dd115 Done-with: Milian Wolff Reviewed-by: Eirik Aavitsland <> (cherry picked from commit 0b4ccbf81ee2009051169f2f0918442b56512b20) Reviewed-by: Qt Cherry-pick Bot <>
Diffstat (limited to 'tests')
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp b/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp
index f96ed563d3..95caa60910 100644
--- a/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp
+++ b/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp
@@ -173,8 +173,18 @@ void tst_QPainterPath::clear()
QVERIFY(p1 != p3);
- QCOMPARE(p1.fillRule(), Qt::OddEvenFill);
+ QVERIFY(p1 != p3);
+ p1.setFillRule(Qt::OddEvenFill);
QCOMPARE(p1, p2);
+ QPainterPath p4;
+ QCOMPARE(p4.fillRule(), Qt::OddEvenFill);
+ p4.setFillRule(Qt::WindingFill);
+ QCOMPARE(p4.fillRule(), Qt::WindingFill);
+ p4.clear();
+ QCOMPARE(p4.fillRule(), Qt::WindingFill);
+ p4 = QPainterPath();
+ QCOMPARE(p4.fillRule(), Qt::OddEvenFill);
void tst_QPainterPath::reserveAndCapacity()