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