caryclark@google.com | 07393ca | 2013-04-08 11:47:37 +0000 | [diff] [blame] | 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 | */ |
caryclark@google.com | 8d0a524 | 2013-07-16 16:11:16 +0000 | [diff] [blame] | 7 | #include "PathOpsTestCommon.h" |
caryclark@google.com | 07393ca | 2013-04-08 11:47:37 +0000 | [diff] [blame] | 8 | #include "SkPathOpsCubic.h" |
| 9 | #include "Test.h" |
| 10 | |
| 11 | static const SkDCubic tests[] = { |
| 12 | {{{2, 0}, {3, 1}, {2, 2}, {1, 1}}}, |
| 13 | {{{3, 1}, {2, 2}, {1, 1}, {2, 0}}}, |
| 14 | {{{3, 0}, {2, 1}, {3, 2}, {1, 1}}}, |
| 15 | }; |
| 16 | |
caryclark@google.com | ad65a3e | 2013-04-15 19:13:59 +0000 | [diff] [blame] | 17 | static const size_t tests_count = SK_ARRAY_COUNT(tests); |
caryclark@google.com | 07393ca | 2013-04-08 11:47:37 +0000 | [diff] [blame] | 18 | |
caryclark@google.com | ad65a3e | 2013-04-15 19:13:59 +0000 | [diff] [blame] | 19 | static void PathOpsDCubicTest(skiatest::Reporter* reporter) { |
caryclark@google.com | 07393ca | 2013-04-08 11:47:37 +0000 | [diff] [blame] | 20 | for (size_t index = 0; index < tests_count; ++index) { |
| 21 | const SkDCubic& cubic = tests[index]; |
caryclark@google.com | 8d0a524 | 2013-07-16 16:11:16 +0000 | [diff] [blame] | 22 | SkASSERT(ValidCubic(cubic)); |
caryclark@google.com | 07393ca | 2013-04-08 11:47:37 +0000 | [diff] [blame] | 23 | bool result = cubic.clockwise(); |
| 24 | if (!result) { |
| 25 | SkDebugf("%s [%d] expected clockwise\n", __FUNCTION__, index); |
| 26 | REPORTER_ASSERT(reporter, 0); |
| 27 | } |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | #include "TestClassDef.h" |
caryclark@google.com | ad65a3e | 2013-04-15 19:13:59 +0000 | [diff] [blame] | 32 | DEFINE_TESTCLASS_SHORT(PathOpsDCubicTest) |