OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 #include "PathOpsTestCommon.h" | 7 #include "PathOpsTestCommon.h" |
8 #include "SkPathOpsCubic.h" | 8 #include "SkPathOpsCubic.h" |
9 #include "Test.h" | 9 #include "Test.h" |
10 | 10 |
11 static const SkDCubic tests[] = { | 11 static const SkDCubic tests[] = { |
12 {{{2, 0}, {3, 1}, {2, 2}, {1, 1}}}, | 12 {{{2, 0}, {3, 1}, {2, 2}, {1, 1}}}, |
13 {{{3, 1}, {2, 2}, {1, 1}, {2, 0}}}, | 13 {{{3, 1}, {2, 2}, {1, 1}, {2, 0}}}, |
14 {{{3, 0}, {2, 1}, {3, 2}, {1, 1}}}, | 14 {{{3, 0}, {2, 1}, {3, 2}, {1, 1}}}, |
15 }; | 15 }; |
16 | 16 |
17 static const size_t tests_count = SK_ARRAY_COUNT(tests); | 17 static const size_t tests_count = SK_ARRAY_COUNT(tests); |
18 | 18 |
19 DEF_TEST(PathOpsDCubic, reporter) { | 19 DEF_TEST(PathOpsDCubic, reporter) { |
20 for (size_t index = 0; index < tests_count; ++index) { | 20 for (size_t index = 0; index < tests_count; ++index) { |
21 const SkDCubic& cubic = tests[index]; | 21 const SkDCubic& cubic = tests[index]; |
22 SkASSERT(ValidCubic(cubic)); | 22 SkASSERT(ValidCubic(cubic)); |
23 bool skip; | 23 bool skip; |
24 bool result = cubic.clockwise(&skip); | 24 bool result = cubic.clockwise(cubic, &skip); |
25 if (!result) { | 25 if (!result) { |
26 SkDebugf("%s [%d] expected clockwise\n", __FUNCTION__, index); | 26 SkDebugf("%s [%d] expected clockwise\n", __FUNCTION__, index); |
27 REPORTER_ASSERT(reporter, 0); | 27 REPORTER_ASSERT(reporter, 0); |
28 } | 28 } |
29 } | 29 } |
30 } | 30 } |
31 | 31 |
32 static const SkDCubic hullTests[] = { | 32 static const SkDCubic hullTests[] = { |
33 {{{2.6250000819563866, 2.3750000223517418}, {2.833333432674408, 2.33333334326744
08}, {3.1111112236976624, 2.3333333134651184}, {3.4074075222015381, 2.3333332538
604736}}}, | 33 {{{2.6250000819563866, 2.3750000223517418}, {2.833333432674408, 2.33333334326744
08}, {3.1111112236976624, 2.3333333134651184}, {3.4074075222015381, 2.3333332538
604736}}}, |
34 }; | 34 }; |
35 | 35 |
36 static const size_t hullTests_count = SK_ARRAY_COUNT(hullTests); | 36 static const size_t hullTests_count = SK_ARRAY_COUNT(hullTests); |
37 | 37 |
38 DEF_TEST(PathOpsCubicHull, reporter) { | 38 DEF_TEST(PathOpsCubicHull, reporter) { |
39 for (size_t index = 0; index < hullTests_count; ++index) { | 39 for (size_t index = 0; index < hullTests_count; ++index) { |
40 const SkDCubic& cubic = hullTests[index]; | 40 const SkDCubic& cubic = hullTests[index]; |
41 char order[4]; | 41 char order[4]; |
42 cubic.convexHull(order); | 42 cubic.convexHull(order); |
43 } | 43 } |
44 } | 44 } |
OLD | NEW |