OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2012 Google Inc. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. |
| 6 */ |
| 7 #include "SkPathOpsQuad.h" |
| 8 #include "Test.h" |
| 9 |
| 10 static const SkDQuad tests[] = { |
| 11 {{{1, 1}, {2, 1}, {0, 2}}}, |
| 12 {{{0, 0}, {1, 1}, {3, 1}}}, |
| 13 {{{2, 0}, {1, 1}, {2, 2}}}, |
| 14 {{{4, 0}, {0, 1}, {4, 2}}}, |
| 15 {{{0, 0}, {0, 1}, {1, 1}}}, |
| 16 }; |
| 17 |
| 18 static const SkDPoint inPoint[]= { |
| 19 {1, 1.2}, |
| 20 {1, 0.8}, |
| 21 {1.8, 1}, |
| 22 {1.5, 1}, |
| 23 {0.5, 0.5}, |
| 24 }; |
| 25 |
| 26 static const SkDPoint outPoint[]= { |
| 27 {1, 1.6}, |
| 28 {1, 1.5}, |
| 29 {2.2, 1}, |
| 30 {1.5, 1.5}, |
| 31 {1.1, 0.5}, |
| 32 }; |
| 33 |
| 34 static const size_t tests_count = sizeof(tests) / sizeof(tests[0]); |
| 35 |
| 36 static void DQuadTest(skiatest::Reporter* reporter) { |
| 37 for (size_t index = 0; index < tests_count; ++index) { |
| 38 const SkDQuad& quad = tests[index]; |
| 39 bool result = quad.pointInHull(inPoint[index]); |
| 40 if (!result) { |
| 41 SkDebugf("%s [%d] expected in hull\n", __FUNCTION__, index); |
| 42 REPORTER_ASSERT(reporter, 0); |
| 43 } |
| 44 result = quad.pointInHull(outPoint[index]); |
| 45 if (result) { |
| 46 SkDebugf("%s [%d] expected outside hull\n", __FUNCTION__, index); |
| 47 REPORTER_ASSERT(reporter, 0); |
| 48 } |
| 49 } |
| 50 } |
| 51 |
| 52 #include "TestClassDef.h" |
| 53 DEFINE_TESTCLASS("PathOpsDQuad", PathOpsDQuadClass, DQuadTest) |
OLD | NEW |