blob: d89510f1d43516ada679f012e2083092c4f3b67e [file] [log] [blame]
caryclark@google.comd88e0892012-03-27 13:23:51 +00001#include "CurveIntersection.h"
caryclark@google.coma5764232012-03-28 16:20:21 +00002#include "Intersections.h"
caryclark@google.comd88e0892012-03-27 13:23:51 +00003#include "LineIntersection.h"
4#include "SkPath.h"
5#include "SkRect.h"
6#include "SkTArray.h"
7#include "SkTDArray.h"
caryclark@google.coma5764232012-03-28 16:20:21 +00008#include "ShapeOps.h"
caryclark@google.comd88e0892012-03-27 13:23:51 +00009#include "TSearch.h"
10
11namespace UnitTest {
12
13#include "EdgeWalker.cpp"
14
15} // end of UnitTest namespace
16
17#include "Intersection_Tests.h"
18
19SkPoint leftRight[][4] = {
20// equal length
21 {{10, 10}, {10, 50}, {20, 10}, {20, 50}},
22 {{10, 10}, {10, 50}, {10, 10}, {20, 50}},
23 {{10, 10}, {10, 50}, {20, 10}, {10, 50}},
24// left top higher
25 {{10, 0}, {10, 50}, {20, 10}, {20, 50}},
26 {{10, 0}, {10, 50}, {10, 10}, {20, 50}},
27 {{10, 0}, {10, 50}, {20, 10}, {10, 50}},
28 {{10, 0}, {10, 50}, {20, 10}, {10 + 0.000001, 40}},
29// left top lower
30 {{10, 20}, {10, 50}, {20, 10}, {20, 50}},
31 {{10, 20}, {10, 50}, {10, 10}, {20, 50}},
32 {{10, 20}, {10, 50}, {20, 10}, {10, 50}},
33 {{10, 20}, {10, 50}, {20, 10}, {10 + 0.000001, 40}},
34 {{10, 20}, {10, 50}, { 0, 0}, {50, 50}},
35// left bottom higher
36 {{10, 10}, {10, 40}, {20, 10}, {20, 50}},
37 {{10, 10}, {10, 40}, {10, 10}, {20, 50}},
38 {{10, 10}, {10, 40}, {20, 10}, {10, 50}},
39 {{10, 10}, {10, 40}, {20, 10}, { 0 + 0.000001, 70}},
40// left bottom lower
41 {{10, 10}, {10, 60}, {20, 10}, {20, 50}},
42 {{10, 10}, {10, 60}, {10, 10}, {20, 50}},
43 {{10, 10}, {10, 60}, {20, 10}, {10 + 0.000001, 50}},
44 {{10, 10}, {10, 60}, {20, 10}, {10 + 0.000001, 40}},
45 {{10, 10}, {10, 60}, { 0, 0}, {20 + 0.000001, 20}},
46};
47
48size_t leftRightCount = sizeof(leftRight) / sizeof(leftRight[0]);
49
50void ActiveEdge_Test() {
51 UnitTest::InEdge leftIn, rightIn;
52 UnitTest::ActiveEdge left, right;
53 left.fWorkEdge.fEdge = &leftIn;
54 right.fWorkEdge.fEdge = &rightIn;
55 for (size_t x = 0; x < leftRightCount; ++x) {
56 left.fAbove = leftRight[x][0];
57 left.fBelow = leftRight[x][1];
58 right.fAbove = leftRight[x][2];
59 right.fBelow = leftRight[x][3];
60 SkASSERT(left < right);
61 SkASSERT(left.operator_less_than(right));
62 SkASSERT(!(right < left));
63 SkASSERT(!right.operator_less_than(left));
64 }
65}
66
67
68
69