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

Side by Side Diff: tests/PathOpsQuadLineIntersectionTest.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
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 "PathOpsExtendedTest.h" 7 #include "PathOpsExtendedTest.h"
8 #include "PathOpsTestCommon.h" 8 #include "PathOpsTestCommon.h"
9 #include "SkIntersections.h" 9 #include "SkIntersections.h"
10 #include "SkPathOpsLine.h" 10 #include "SkPathOpsLine.h"
11 #include "SkPathOpsQuad.h" 11 #include "SkPathOpsQuad.h"
12 #include "SkReduceOrder.h" 12 #include "SkReduceOrder.h"
13 #include "Test.h" 13 #include "Test.h"
14 #include "TestClassDef.h"
14 15
15 static struct lineQuad { 16 static struct lineQuad {
16 SkDQuad quad; 17 SkDQuad quad;
17 SkDLine line; 18 SkDLine line;
18 int result; 19 int result;
19 SkDPoint expected[2]; 20 SkDPoint expected[2];
20 } lineQuadTests[] = { 21 } lineQuadTests[] = {
21 // quad line results 22 // quad line results
22 {{{{1, 1}, {2, 1}, {0, 2}}}, {{{0, 0}, {1, 1}}}, 1, {{1, 1}, {0, 0}} }, 23 {{{{1, 1}, {2, 1}, {0, 2}}}, {{{0, 0}, {1, 1}}}, 1, {{1, 1}, {0, 0}} },
23 {{{{0, 0}, {1, 1}, {3, 1}}}, {{{0, 0}, {3, 1}}}, 2, {{0, 0}, {3, 1}} }, 24 {{{{0, 0}, {1, 1}, {3, 1}}}, {{{0, 0}, {3, 1}}}, 2, {{0, 0}, {3, 1}} },
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 SkDPoint lineXY = line.ptAtT(lineT); 91 SkDPoint lineXY = line.ptAtT(lineT);
91 if (!quadXY.approximatelyEqual(lineXY)) { 92 if (!quadXY.approximatelyEqual(lineXY)) {
92 quadXY.approximatelyEqual(lineXY); 93 quadXY.approximatelyEqual(lineXY);
93 SkDebugf(""); 94 SkDebugf("");
94 } 95 }
95 REPORTER_ASSERT(reporter, quadXY.approximatelyEqual(lineXY)); 96 REPORTER_ASSERT(reporter, quadXY.approximatelyEqual(lineXY));
96 } 97 }
97 } 98 }
98 } 99 }
99 100
100 static void PathOpsQuadLineIntersectionOneOffTest(skiatest::Reporter* reporter) { 101 DEF_TEST(PathOpsQuadLineIntersectionOneOff, reporter) {
101 testOneOffs(reporter); 102 testOneOffs(reporter);
102 } 103 }
103 104
104 static void PathOpsQuadLineIntersectionTest(skiatest::Reporter* reporter) { 105 DEF_TEST(PathOpsQuadLineIntersection, reporter) {
105 for (size_t index = 0; index < lineQuadTests_count; ++index) { 106 for (size_t index = 0; index < lineQuadTests_count; ++index) {
106 int iIndex = static_cast<int>(index); 107 int iIndex = static_cast<int>(index);
107 const SkDQuad& quad = lineQuadTests[index].quad; 108 const SkDQuad& quad = lineQuadTests[index].quad;
108 SkASSERT(ValidQuad(quad)); 109 SkASSERT(ValidQuad(quad));
109 const SkDLine& line = lineQuadTests[index].line; 110 const SkDLine& line = lineQuadTests[index].line;
110 SkASSERT(ValidLine(line)); 111 SkASSERT(ValidLine(line));
111 SkReduceOrder reducer1, reducer2; 112 SkReduceOrder reducer1, reducer2;
112 int order1 = reducer1.reduce(quad); 113 int order1 = reducer1.reduce(quad);
113 int order2 = reducer2.reduce(line); 114 int order2 = reducer2.reduce(line);
114 if (order1 < 3) { 115 if (order1 < 3) {
(...skipping 25 matching lines...) Expand all
140 } 141 }
141 if (!t1.approximatelyEqual(lineQuadTests[index].expected[0]) 142 if (!t1.approximatelyEqual(lineQuadTests[index].expected[0])
142 && (lineQuadTests[index].result == 1 143 && (lineQuadTests[index].result == 1
143 || !t1.approximatelyEqual(lineQuadTests[index].expected[1])) ) { 144 || !t1.approximatelyEqual(lineQuadTests[index].expected[1])) ) {
144 SkDebugf("%s t1=(%1.9g,%1.9g)\n", __FUNCTION__, t1.fX, t1.fY); 145 SkDebugf("%s t1=(%1.9g,%1.9g)\n", __FUNCTION__, t1.fX, t1.fY);
145 REPORTER_ASSERT(reporter, 0); 146 REPORTER_ASSERT(reporter, 0);
146 } 147 }
147 } 148 }
148 } 149 }
149 } 150 }
150
151 #include "TestClassDef.h"
152 DEFINE_TESTCLASS_SHORT(PathOpsQuadLineIntersectionTest)
153
154 DEFINE_TESTCLASS_SHORT(PathOpsQuadLineIntersectionOneOffTest)
OLDNEW
« no previous file with comments | « tests/PathOpsQuadIntersectionTest.cpp ('k') | tests/PathOpsQuadLineIntersectionThreadedTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698