Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Unified Diff: tests/PathOpsLineIntersectionTest.cpp

Issue 21359002: path ops work in progress (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: remove space Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/PathOpsExtendedTest.cpp ('k') | tests/PathOpsOpTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/PathOpsLineIntersectionTest.cpp
diff --git a/tests/PathOpsLineIntersectionTest.cpp b/tests/PathOpsLineIntersectionTest.cpp
index ea3f7e07c60cc800c79ff6f0c933a5bfecce1efe..feb8dd0bcebea18b76e12043671635b6677ea5e6 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) {
« no previous file with comments | « tests/PathOpsExtendedTest.cpp ('k') | tests/PathOpsOpTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698