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

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
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 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 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 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 const size_t tests_count = sizeof(tests) / sizeof(tests[0]);
35 static size_t firstQuadTest = 0;
36
37 void DQuadTest(skiatest::Reporter* reporter) {
38 for (size_t index = firstQuadTest; index < tests_count; ++index) {
39 const SkDQuad& quad = tests[index];
40 bool result = quad.pointInHull(inPoint[index]);
41 if (!result) {
42 SkDebugf("%s [%d] expected in hull\n", __FUNCTION__, index);
43 REPORTER_ASSERT(reporter, 0);
44 }
45 result = quad.pointInHull(outPoint[index]);
46 if (result) {
47 SkDebugf("%s [%d] expected outside hull\n", __FUNCTION__, index);
48 REPORTER_ASSERT(reporter, 0);
49 }
50 }
51 }
52
53 #include "TestClassDef.h"
54 DEFINE_TESTCLASS("PathOpsDQuad", PathOpsDQuadClass, DQuadTest)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698