caryclark@google.com | d88e089 | 2012-03-27 13:23:51 +0000 | [diff] [blame^] | 1 | #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 | |
| 9 | namespace UnitTest { |
| 10 | |
| 11 | #include "EdgeWalker.cpp" |
| 12 | |
| 13 | } // end of UnitTest namespace |
| 14 | |
| 15 | #include "Intersection_Tests.h" |
| 16 | |
| 17 | SkPoint 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 | |
| 46 | size_t leftRightCount = sizeof(leftRight) / sizeof(leftRight[0]); |
| 47 | |
| 48 | void 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 | |