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

Side by Side Diff: tests/PathOpsDQuadTest.cpp

Issue 117863005: Get rid of DEFINE_TESTCLASS_SHORT() macro. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Mike review Created 6 years, 11 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
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 "SkPath.h" 8 #include "SkPath.h"
9 #include "SkPathOpsQuad.h" 9 #include "SkPathOpsQuad.h"
10 #include "SkRRect.h" 10 #include "SkRRect.h"
11 #include "Test.h" 11 #include "Test.h"
12 #include "TestClassDef.h"
12 13
13 static const SkDQuad tests[] = { 14 static const SkDQuad tests[] = {
14 {{{1, 1}, {2, 1}, {0, 2}}}, 15 {{{1, 1}, {2, 1}, {0, 2}}},
15 {{{0, 0}, {1, 1}, {3, 1}}}, 16 {{{0, 0}, {1, 1}, {3, 1}}},
16 {{{2, 0}, {1, 1}, {2, 2}}}, 17 {{{2, 0}, {1, 1}, {2, 2}}},
17 {{{4, 0}, {0, 1}, {4, 2}}}, 18 {{{4, 0}, {0, 1}, {4, 2}}},
18 {{{0, 0}, {0, 1}, {1, 1}}}, 19 {{{0, 0}, {0, 1}, {1, 1}}},
19 }; 20 };
20 21
21 static const SkDPoint inPoint[]= { 22 static const SkDPoint inPoint[]= {
22 {1, 1.2}, 23 {1, 1.2},
23 {1, 0.8}, 24 {1, 0.8},
24 {1.8, 1}, 25 {1.8, 1},
25 {1.5, 1}, 26 {1.5, 1},
26 {0.4999, 0.5}, // was 0.5, 0.5; points on the hull are considered outside 27 {0.4999, 0.5}, // was 0.5, 0.5; points on the hull are considered outside
27 }; 28 };
28 29
29 static const SkDPoint outPoint[]= { 30 static const SkDPoint outPoint[]= {
30 {1, 1.6}, 31 {1, 1.6},
31 {1, 1.5}, 32 {1, 1.5},
32 {2.2, 1}, 33 {2.2, 1},
33 {1.5, 1.5}, 34 {1.5, 1.5},
34 {1.1, 0.5}, 35 {1.1, 0.5},
35 }; 36 };
36 37
37 static const size_t tests_count = SK_ARRAY_COUNT(tests); 38 static const size_t tests_count = SK_ARRAY_COUNT(tests);
38 39
39 static void PathOpsDQuadTest(skiatest::Reporter* reporter) { 40 DEF_TEST(PathOpsDQuad, reporter) {
40 for (size_t index = 0; index < tests_count; ++index) { 41 for (size_t index = 0; index < tests_count; ++index) {
41 const SkDQuad& quad = tests[index]; 42 const SkDQuad& quad = tests[index];
42 SkASSERT(ValidQuad(quad)); 43 SkASSERT(ValidQuad(quad));
43 bool result = quad.pointInHull(inPoint[index]); 44 bool result = quad.pointInHull(inPoint[index]);
44 if (!result) { 45 if (!result) {
45 SkDebugf("%s [%d] expected in hull\n", __FUNCTION__, index); 46 SkDebugf("%s [%d] expected in hull\n", __FUNCTION__, index);
46 REPORTER_ASSERT(reporter, 0); 47 REPORTER_ASSERT(reporter, 0);
47 } 48 }
48 result = quad.pointInHull(outPoint[index]); 49 result = quad.pointInHull(outPoint[index]);
49 if (result) { 50 if (result) {
50 SkDebugf("%s [%d] expected outside hull\n", __FUNCTION__, index); 51 SkDebugf("%s [%d] expected outside hull\n", __FUNCTION__, index);
51 REPORTER_ASSERT(reporter, 0); 52 REPORTER_ASSERT(reporter, 0);
52 } 53 }
53 } 54 }
54 } 55 }
55 56
56 static void PathOpsRRectTest(skiatest::Reporter* reporter) { 57 DEF_TEST(PathOpsRRect, reporter) {
57 SkPath path; 58 SkPath path;
58 SkRRect rRect; 59 SkRRect rRect;
59 SkRect rect = {135, 143, 250, 177}; 60 SkRect rect = {135, 143, 250, 177};
60 SkVector radii[4] = {{8, 8}, {8, 8}, {0, 0}, {0, 0}}; 61 SkVector radii[4] = {{8, 8}, {8, 8}, {0, 0}, {0, 0}};
61 rRect.setRectRadii(rect, radii); 62 rRect.setRectRadii(rect, radii);
62 path.addRRect(rRect); 63 path.addRRect(rRect);
63 } 64 }
64
65 #include "TestClassDef.h"
66 DEFINE_TESTCLASS_SHORT(PathOpsDQuadTest)
67
68 DEFINE_TESTCLASS_SHORT(PathOpsRRectTest)
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