summaryrefslogtreecommitdiffstats
path: root/tests/auto/qpathclipper
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2010-04-08 11:50:46 (GMT)
committerSamuel Rødal <sroedal@trolltech.com>2010-04-08 12:22:48 (GMT)
commitbf195e57ff96c326fa26c6b3a4f64e26d18fd9bd (patch)
tree32490d70c21ffa8e932e9f17552cde9856a3a2d0 /tests/auto/qpathclipper
parent75b338aaa8e3c5138718019e95271d8eed5f0c39 (diff)
downloadQt-bf195e57ff96c326fa26c6b3a4f64e26d18fd9bd.zip
Qt-bf195e57ff96c326fa26c6b3a4f64e26d18fd9bd.tar.gz
Qt-bf195e57ff96c326fa26c6b3a4f64e26d18fd9bd.tar.bz2
Fixed bug in QPainterPath::intersected().
When we compute the angle delta we can't use qFuzzyCompare as it will cause slightly negative deltas to be snapped to 0, causing the winged edge builder to put path edges in the wrong order. Task-number: QTBUG-3778 Reviewed-by: Trond
Diffstat (limited to 'tests/auto/qpathclipper')
-rw-r--r--tests/auto/qpathclipper/tst_qpathclipper.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/auto/qpathclipper/tst_qpathclipper.cpp b/tests/auto/qpathclipper/tst_qpathclipper.cpp
index 38d253a..db5a13e 100644
--- a/tests/auto/qpathclipper/tst_qpathclipper.cpp
+++ b/tests/auto/qpathclipper/tst_qpathclipper.cpp
@@ -95,6 +95,8 @@ private slots:
void task209056();
void task251909();
+
+ void qtbug3778();
};
Q_DECLARE_METATYPE(QPainterPath)
@@ -1346,6 +1348,33 @@ void tst_QPathClipper::task251909()
QVERIFY(result.elementCount() <= 5);
}
+void tst_QPathClipper::qtbug3778()
+{
+ QPainterPath path1;
+ path1.moveTo(200, 3.22409e-5);
+ // e-5 and higher leads to a bug
+ // Using 3.22409e-4 starts to work correctly
+ path1.lineTo(0, 0);
+ path1.lineTo(1.07025e-13, 1450);
+ path1.lineTo(750, 950);
+ path1.lineTo(950, 750);
+ path1.lineTo(200, 3.22409e-13);
+
+ QPainterPath path2;
+ path2.moveTo(0, 0);
+ path2.lineTo(200, 800);
+ path2.lineTo(600, 1500);
+ path2.lineTo(1500, 1400);
+ path2.lineTo(1900, 1200);
+ path2.lineTo(2000, 1000);
+ path2.lineTo(1400, 0);
+ path2.lineTo(0, 0);
+
+ QPainterPath p12 = path1.intersected(path2);
+
+ QVERIFY(p12.contains(QPointF(100, 100)));
+}
+
QTEST_APPLESS_MAIN(tst_QPathClipper)