From 570863f2e22b8ea7d7c504bd15e4f766af097df2 Mon Sep 17 00:00:00 2001 From: "caryclark@google.com" Date: Mon, 16 Sep 2013 15:55:01 +0000 Subject: path ops work in progress path ops work in progress BUG= Review URL: https://codereview.chromium.org/21359002 git-svn-id: http://skia.googlecode.com/svn/trunk@11291 2bbb7eff-a529-9590-31e7-b0007b416f81 --- tests/PathOpsLineIntersectionTest.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'tests/PathOpsLineIntersectionTest.cpp') diff --git a/tests/PathOpsLineIntersectionTest.cpp b/tests/PathOpsLineIntersectionTest.cpp index ea3f7e07c6..ee15363996 100644 --- a/tests/PathOpsLineIntersectionTest.cpp +++ b/tests/PathOpsLineIntersectionTest.cpp @@ -11,6 +11,8 @@ // FIXME: add tests for intersecting, non-intersecting, degenerate, coincident static const SkDLine tests[][2] = { + {{{{90,230}, {160,60}}}, {{{60,120}, {260,120}}}}, + {{{{90,230}, {160,60}}}, {{{181.176468,120}, {135.294128,120}}}}, {{{{181.1764678955078125f, 120}, {186.3661956787109375f, 134.7042236328125f}}}, {{{175.8309783935546875f, 141.5211334228515625f}, {187.8782806396484375f, 133.7258148193359375f}}}}, #if 0 // FIXME: these fail because one line is too short and appears quasi-coincident @@ -33,6 +35,9 @@ static const SkDLine tests[][2] = { static const size_t tests_count = SK_ARRAY_COUNT(tests); static const SkDLine noIntersect[][2] = { + {{{{(double) (2 - 1e-6f),2}, {(double) (2 - 1e-6f),4}}}, + {{{2,1}, {2,3}}}}, + {{{{0, 0}, {1, 0}}}, {{{3, 0}, {2, 0}}}}, {{{{0, 0}, {0, 0}}}, {{{1, 0}, {2, 0}}}}, {{{{0, 1}, {0, 1}}}, {{{0, 3}, {0, 2}}}}, @@ -43,6 +48,12 @@ static const SkDLine noIntersect[][2] = { static const size_t noIntersect_count = SK_ARRAY_COUNT(noIntersect); static const SkDLine coincidentTests[][2] = { + {{{{979.304871, 561}, {1036.69507, 291}}}, + {{{985.681519, 531}, {982.159790, 547.568542}}}}, + + {{{{232.159805, 547.568542}, {235.681549, 531}}}, + {{{286.695129,291}, {229.304855,561}}}}, + {{{{186.3661956787109375f, 134.7042236328125f}, {187.8782806396484375f, 133.7258148193359375f}}}, {{{175.8309783935546875f, 141.5211334228515625f}, {187.8782806396484375f, 133.7258148193359375f}}}}, @@ -111,19 +122,11 @@ static void testOneCoincident(skiatest::Reporter* reporter, const SkDLine& line1 const SkDLine& line2) { SkASSERT(ValidLine(line1)); SkASSERT(ValidLine(line2)); - SkIntersections ts2; - int pts2 = ts2.intersect(line1, line2); - REPORTER_ASSERT(reporter, pts2 == 2); - REPORTER_ASSERT(reporter, pts2 == ts2.used()); - check_results(reporter, line1, line2, ts2); -#if 0 SkIntersections ts; int pts = ts.intersect(line1, line2); - REPORTER_ASSERT(reporter, pts == pts2); REPORTER_ASSERT(reporter, pts == 2); REPORTER_ASSERT(reporter, pts == ts.used()); check_results(reporter, line1, line2, ts); -#endif } static void PathOpsLineIntersectionTest(skiatest::Reporter* reporter) { @@ -154,9 +157,8 @@ static void PathOpsLineIntersectionTest(skiatest::Reporter* reporter) { static void PathOpsLineIntersectionOneOffTest(skiatest::Reporter* reporter) { int index = 0; SkASSERT(index < (int) tests_count); - const SkDLine& line1 = tests[index][0]; - const SkDLine& line2 = tests[index][1]; - testOne(reporter, line1, line2); + testOne(reporter, tests[index][0], tests[index][1]); + testOne(reporter, tests[1][0], tests[1][1]); } static void PathOpsLineIntersectionOneCoincidentTest(skiatest::Reporter* reporter) { -- cgit v1.2.3