|
9 | 9 | @testable import BezierKit |
10 | 10 | import XCTest |
11 | 11 |
|
12 | | -private extension Path { |
| 12 | +internal extension Path { |
13 | 13 | /// copies the path in such a way that it's impossible that optimizations would allow the copy to share the same underlying storage |
14 | 14 | func independentCopy() -> Path { |
15 | 15 | return self.copy(using: CGAffineTransform(translationX: 1, y: 0)).copy(using: CGAffineTransform(translationX: -1, y: 0)) |
@@ -474,36 +474,6 @@ class PathVectorBooleanTests: XCTestCase { |
474 | 474 | XCTAssertTrue(componentsEqualAsideFromElementOrdering(result.components[0], square.components[0])) |
475 | 475 | } |
476 | 476 |
|
477 | | - func testCrossingsRemovedEdgeCase() { |
478 | | - // this is an edge cases which caused difficulty in practice |
479 | | - // the contour, which intersects at (1,1) creates two squares, one with -1 winding count |
480 | | - // the other with +1 winding count |
481 | | - // incorrect implementation of this algorithm previously interpretted |
482 | | - // the crossing as an entry / exit, which would completely cull off the square with +1 count |
483 | | - |
484 | | - let points = [CGPoint(x: 0, y: 1), |
485 | | - CGPoint(x: 1, y: 1), |
486 | | - CGPoint(x: 2, y: 1), |
487 | | - CGPoint(x: 2, y: 2), |
488 | | - CGPoint(x: 1, y: 2), |
489 | | - CGPoint(x: 1, y: 1), |
490 | | - CGPoint(x: 1, y: 0), |
491 | | - CGPoint(x: 0, y: 0)] |
492 | | - |
493 | | - let cgPath = CGMutablePath() |
494 | | - cgPath.addLines(between: points) |
495 | | - cgPath.closeSubpath() |
496 | | - |
497 | | - let contour = Path(cgPath: cgPath) |
498 | | - XCTAssertEqual(contour.windingCount(CGPoint(x: 0.5, y: 0.5)), -1) // winding count at center of one square region |
499 | | - XCTAssertEqual(contour.windingCount(CGPoint(x: 1.5, y: 1.5)), 1) // winding count at center of other square region |
500 | | - |
501 | | - let crossingsRemoved = contour.crossingsRemoved() |
502 | | - |
503 | | - XCTAssertEqual(crossingsRemoved.components.count, 1) |
504 | | - XCTAssertTrue(componentsEqualAsideFromElementOrdering(crossingsRemoved.components[0], contour.components[0])) |
505 | | - } |
506 | | - |
507 | 477 | func testCrossingsRemovedEdgeCaseInnerLoop() { |
508 | 478 |
|
509 | 479 | // the path is a box with a loop that begins at (2,0), touches the top of the box at (2,2) exactly tangent |
|
0 commit comments