diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-04-20 09:32:06 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-05-17 10:21:19 +0000 |
commit | 13de0e512992ca67844a9780a2246122dab74053 (patch) | |
tree | fd86256d6511ab39466d7e2b07ca5da78c3df662 /tests/auto | |
parent | b545a6359bd7a34ccb7683b871ccd4e1f197ae47 (diff) |
Add test-case for intersection equality
Test-case taken from QTBUG-17027
Task-number: QTBUG-17027
Change-Id: I92ceb76addc4a61d19963d89f89e1f6386d8a049
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp b/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp index 98f63984b3..c7203a1b36 100644 --- a/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp +++ b/tests/auto/gui/painting/qpainterpath/tst_qpainterpath.cpp @@ -99,6 +99,8 @@ private slots: void translate(); void lineWithinBounds(); + + void intersectionEquality(); }; void tst_QPainterPath::cleanupTestCase() @@ -1313,6 +1315,53 @@ void tst_QPainterPath::lineWithinBounds() } } +void tst_QPainterPath::intersectionEquality() +{ + // Test case from QTBUG-17027 + QPainterPath p1; + p1.moveTo(256.0000000000000000, 135.8384137532701743); + p1.lineTo(50.9999999999999715, 107.9999999999999857); + p1.lineTo(233.5425474228109123, 205.3560252921671462); + p1.lineTo(191.7771366877784373, 318.0257074407572304); + p1.lineTo(-48.2616272048215151, 229.0459803737862216); + p1.lineTo(0.0000000000000000, 98.8515898136580801); + p1.lineTo(0.0000000000000000, 0.0000000000000000); + p1.lineTo(256.0000000000000000, 0.0000000000000000); + p1.lineTo(256.0000000000000000, 135.8384137532701743); + + QPainterPath p2; + p2.moveTo(1516.2703263523442274, 306.9795200262722119); + p2.lineTo(-1296.8426224886295585, -75.0331736542986931); + p2.lineTo(-1678.8553161692004778, 2738.0797751866753060); + p2.lineTo(1134.2576326717733081, 3120.0924688672457705); + p2.lineTo(1516.2703263523442274, 306.9795200262722119); + + QPainterPath i1 = p1.intersected(p2); + QPainterPath i2 = p2.intersected(p1); + QVERIFY(i1 == i2 || i1.toReversed() == i2); + + p1 = QPainterPath(); + p1.moveTo(256.00000000, 135.83841375); + p1.lineTo(50.99999999, 107.99999999); + p1.lineTo(233.54254742, 205.35602529); + p1.lineTo(191.77713668, 318.02570744); + p1.lineTo(-48.26162720, 229.04598037); + p1.lineTo(0.00000000, 98.85158981); + p1.lineTo(0.00000000, 0.00000000); + p1.lineTo(256.00000000, 0.00000000); + p1.lineTo(256.00000000, 135.83841375); + + p2 = QPainterPath(); + p2.moveTo(1516.27032635, 306.97952002); + p2.lineTo(-1296.84262248, -75.03317365); + p2.lineTo(-1678.85531616, 2738.07977518); + p2.lineTo(1134.25763267, 3120.09246886); + p2.lineTo(1516.27032635, 306.97952002); + + i1 = p1.intersected(p2); + i2 = p2.intersected(p1); + QVERIFY(i1 == i2 || i1.toReversed() == i2); +} QTEST_APPLESS_MAIN(tst_QPainterPath) |