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

Side by Side Diff: tests/PathOpsDTriangleTest.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 "SkPathOpsTriangle.h"
8 #include "Test.h"
9
10 const SkDTriangle tests[] = {
11 {{{2, 0}, {3, 1}, {2, 2}}},
12 {{{3, 1}, {2, 2}, {1, 1}}},
13 {{{3, 0}, {2, 1}, {3, 2}}},
14 };
15
16 const SkDPoint inPoint[] = {
17 {2.5, 1},
18 {2, 1.5},
19 {2.5, 1},
20 };
21
22 const SkDPoint outPoint[] = {
23 {3, 0},
24 {2.5, 2},
25 {2.5, 2},
26 };
27
28 const size_t tests_count = sizeof(tests) / sizeof(tests[0]);
29 static size_t firstTriangleTest = 0;
30
31 void TriangleUtilitiesTest(skiatest::Reporter* reporter) {
32 for (size_t index = firstTriangleTest; index < tests_count; ++index) {
33 const SkDTriangle& triangle = tests[index];
34 bool result = triangle.contains(inPoint[index]);
35 if (!result) {
36 SkDebugf("%s [%d] expected point in triangle\n", __FUNCTION__, index );
37 REPORTER_ASSERT(reporter, 0);
38 }
39 result = triangle.contains(outPoint[index]);
40 if (result) {
41 SkDebugf("%s [%d] expected point outside triangle\n", __FUNCTION__, index);
42 REPORTER_ASSERT(reporter, 0);
43 }
44 }
45 }
46
47 #include "TestClassDef.h"
48 DEFINE_TESTCLASS("PathOpsTriangleUtilities", PathOpsTriangleUtilitiesClass, Tria ngleUtilitiesTest)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698