Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(377)

Side by Side Diff: tests/PathOpsDQuadTest.cpp

Issue 12827020: Add base types for path ops (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/PathOpsDPointTest.cpp ('k') | tests/PathOpsDRectTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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)
OLDNEW
« no previous file with comments | « tests/PathOpsDPointTest.cpp ('k') | tests/PathOpsDRectTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698