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

Unified Diff: tests/PathOpsLineIntersectionTest.cpp

Issue 23542056: path ops work in progress (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: verbose + mutex around file number access Created 7 years, 2 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 ee15363996921939f4dc20bed133ef8d2aaf3340..f37a5091b43ae54cabc0b580241f998e4dbd96c2 100644
--- a/tests/PathOpsLineIntersectionTest.cpp
+++ b/tests/PathOpsLineIntersectionTest.cpp
@@ -48,6 +48,12 @@ static const SkDLine noIntersect[][2] = {
static const size_t noIntersect_count = SK_ARRAY_COUNT(noIntersect);
static const SkDLine coincidentTests[][2] = {
+ {{{{0,482.5}, {-4.4408921e-016,682.5}}},
+ {{{0,683}, {0,482}}}},
+
+ {{{{1.77635684e-015,312}, {-1.24344979e-014,348}}},
+ {{{0,348}, {0,312}}}},
+
{{{{979.304871, 561}, {1036.69507, 291}}},
{{{985.681519, 531}, {982.159790, 547.568542}}}},
@@ -116,6 +122,7 @@ static void testOne(skiatest::Reporter* reporter, const SkDLine& line1, const Sk
ts.vertical(line1, top, bottom, line2[0].fX, line2[0].fY != top);
check_results(reporter, line1, line2, ts);
}
+ reporter->bumpTestCount();
}
static void testOneCoincident(skiatest::Reporter* reporter, const SkDLine& line1,
@@ -127,6 +134,46 @@ static void testOneCoincident(skiatest::Reporter* reporter, const SkDLine& line1
REPORTER_ASSERT(reporter, pts == 2);
REPORTER_ASSERT(reporter, pts == ts.used());
check_results(reporter, line1, line2, ts);
+ if (line1[0] == line1[1] || line2[0] == line2[1]) {
+ return;
+ }
+ if (line1[0].fY == line1[1].fY) {
+ double left = SkTMin(line1[0].fX, line1[1].fX);
+ double right = SkTMax(line1[0].fX, line1[1].fX);
+ SkIntersections ts;
+ ts.horizontal(line2, left, right, line1[0].fY, line1[0].fX != left);
+ REPORTER_ASSERT(reporter, pts == 2);
+ REPORTER_ASSERT(reporter, pts == ts.used());
+ check_results(reporter, line2, line1, ts);
+ }
+ if (line2[0].fY == line2[1].fY) {
+ double left = SkTMin(line2[0].fX, line2[1].fX);
+ double right = SkTMax(line2[0].fX, line2[1].fX);
+ SkIntersections ts;
+ ts.horizontal(line1, left, right, line2[0].fY, line2[0].fX != left);
+ REPORTER_ASSERT(reporter, pts == 2);
+ REPORTER_ASSERT(reporter, pts == ts.used());
+ check_results(reporter, line1, line2, ts);
+ }
+ if (line1[0].fX == line1[1].fX) {
+ double top = SkTMin(line1[0].fY, line1[1].fY);
+ double bottom = SkTMax(line1[0].fY, line1[1].fY);
+ SkIntersections ts;
+ ts.vertical(line2, top, bottom, line1[0].fX, line1[0].fY != top);
+ REPORTER_ASSERT(reporter, pts == 2);
+ REPORTER_ASSERT(reporter, pts == ts.used());
+ check_results(reporter, line2, line1, ts);
+ }
+ if (line2[0].fX == line2[1].fX) {
+ double top = SkTMin(line2[0].fY, line2[1].fY);
+ double bottom = SkTMax(line2[0].fY, line2[1].fY);
+ SkIntersections ts;
+ ts.vertical(line1, top, bottom, line2[0].fX, line2[0].fY != top);
+ REPORTER_ASSERT(reporter, pts == 2);
+ REPORTER_ASSERT(reporter, pts == ts.used());
+ check_results(reporter, line1, line2, ts);
+ }
+ reporter->bumpTestCount();
}
static void PathOpsLineIntersectionTest(skiatest::Reporter* reporter) {
@@ -135,13 +182,11 @@ static void PathOpsLineIntersectionTest(skiatest::Reporter* reporter) {
const SkDLine& line1 = coincidentTests[index][0];
const SkDLine& line2 = coincidentTests[index][1];
testOneCoincident(reporter, line1, line2);
- reporter->bumpTestCount();
}
for (index = 0; index < tests_count; ++index) {
const SkDLine& line1 = tests[index][0];
const SkDLine& line2 = tests[index][1];
testOne(reporter, line1, line2);
- reporter->bumpTestCount();
}
for (index = 0; index < noIntersect_count; ++index) {
const SkDLine& line1 = noIntersect[index][0];
« 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