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

Side by Side Diff: tests/PathOpsDRectTest.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/PathOpsDQuadTest.cpp ('k') | tests/PathOpsDTriangleTest.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 "SkPathOpsCubic.h" 8 #include "SkPathOpsCubic.h"
9 #include "SkPathOpsLine.h" 9 #include "SkPathOpsLine.h"
10 #include "SkPathOpsQuad.h" 10 #include "SkPathOpsQuad.h"
11 #include "SkPathOpsRect.h" 11 #include "SkPathOpsRect.h"
12 #include "Test.h" 12 #include "Test.h"
13 #include "TestClassDef.h"
13 14
14 static const SkDLine lineTests[] = { 15 static const SkDLine lineTests[] = {
15 {{{2, 1}, {2, 1}}}, 16 {{{2, 1}, {2, 1}}},
16 {{{2, 1}, {1, 1}}}, 17 {{{2, 1}, {1, 1}}},
17 {{{2, 1}, {2, 2}}}, 18 {{{2, 1}, {2, 2}}},
18 {{{1, 1}, {2, 2}}}, 19 {{{1, 1}, {2, 2}}},
19 {{{3, 0}, {2, 1}}}, 20 {{{3, 0}, {2, 1}}},
20 {{{3, 2}, {1, 1}}}, 21 {{{3, 2}, {1, 1}}},
21 }; 22 };
22 23
23 static const SkDQuad quadTests[] = { 24 static const SkDQuad quadTests[] = {
24 {{{1, 1}, {2, 1}, {0, 2}}}, 25 {{{1, 1}, {2, 1}, {0, 2}}},
25 {{{0, 0}, {1, 1}, {3, 1}}}, 26 {{{0, 0}, {1, 1}, {3, 1}}},
26 {{{2, 0}, {1, 1}, {2, 2}}}, 27 {{{2, 0}, {1, 1}, {2, 2}}},
27 {{{4, 0}, {0, 1}, {4, 2}}}, 28 {{{4, 0}, {0, 1}, {4, 2}}},
28 {{{0, 0}, {0, 1}, {1, 1}}}, 29 {{{0, 0}, {0, 1}, {1, 1}}},
29 }; 30 };
30 31
31 static const SkDCubic cubicTests[] = { 32 static const SkDCubic cubicTests[] = {
32 {{{2, 0}, {3, 1}, {2, 2}, {1, 1}}}, 33 {{{2, 0}, {3, 1}, {2, 2}, {1, 1}}},
33 {{{3, 1}, {2, 2}, {1, 1}, {2, 0}}}, 34 {{{3, 1}, {2, 2}, {1, 1}, {2, 0}}},
34 {{{3, 0}, {2, 1}, {3, 2}, {1, 1}}}, 35 {{{3, 0}, {2, 1}, {3, 2}, {1, 1}}},
35 }; 36 };
36 37
37 static const size_t lineTests_count = SK_ARRAY_COUNT(lineTests); 38 static const size_t lineTests_count = SK_ARRAY_COUNT(lineTests);
38 static const size_t quadTests_count = SK_ARRAY_COUNT(quadTests); 39 static const size_t quadTests_count = SK_ARRAY_COUNT(quadTests);
39 static const size_t cubicTests_count = SK_ARRAY_COUNT(cubicTests); 40 static const size_t cubicTests_count = SK_ARRAY_COUNT(cubicTests);
40 41
41 static void PathOpsDRectTest(skiatest::Reporter* reporter) { 42 DEF_TEST(PathOpsDRect, reporter) {
42 size_t index; 43 size_t index;
43 SkDRect rect, rect2; 44 SkDRect rect, rect2;
44 for (index = 0; index < lineTests_count; ++index) { 45 for (index = 0; index < lineTests_count; ++index) {
45 const SkDLine& line = lineTests[index]; 46 const SkDLine& line = lineTests[index];
46 SkASSERT(ValidLine(line)); 47 SkASSERT(ValidLine(line));
47 rect.setBounds(line); 48 rect.setBounds(line);
48 REPORTER_ASSERT(reporter, rect.fLeft == SkTMin(line[0].fX, line[1].fX)); 49 REPORTER_ASSERT(reporter, rect.fLeft == SkTMin(line[0].fX, line[1].fX));
49 REPORTER_ASSERT(reporter, rect.fTop == SkTMin(line[0].fY, line[1].fY)); 50 REPORTER_ASSERT(reporter, rect.fTop == SkTMin(line[0].fY, line[1].fY));
50 REPORTER_ASSERT(reporter, rect.fRight == SkTMax(line[0].fX, line[1].fX)) ; 51 REPORTER_ASSERT(reporter, rect.fRight == SkTMax(line[0].fX, line[1].fX)) ;
51 REPORTER_ASSERT(reporter, rect.fBottom == SkTMax(line[0].fY, line[1].fY) ); 52 REPORTER_ASSERT(reporter, rect.fBottom == SkTMax(line[0].fY, line[1].fY) );
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 SkTMax(cubic[1].fY, SkTMax(cubic[2].fY, cubic[3].fY)))); 93 SkTMax(cubic[1].fY, SkTMax(cubic[2].fY, cubic[3].fY))));
93 rect2.setBounds(cubic); 94 rect2.setBounds(cubic);
94 REPORTER_ASSERT(reporter, rect.intersects(&rect2)); 95 REPORTER_ASSERT(reporter, rect.intersects(&rect2));
95 // FIXME: add a recursive box subdivision method to verify that tight bo unds is correct 96 // FIXME: add a recursive box subdivision method to verify that tight bo unds is correct
96 SkDPoint leftTop = {rect2.fLeft, rect2.fTop}; 97 SkDPoint leftTop = {rect2.fLeft, rect2.fTop};
97 REPORTER_ASSERT(reporter, rect.contains(leftTop)); 98 REPORTER_ASSERT(reporter, rect.contains(leftTop));
98 SkDPoint rightBottom = {rect2.fRight, rect2.fBottom}; 99 SkDPoint rightBottom = {rect2.fRight, rect2.fBottom};
99 REPORTER_ASSERT(reporter, rect.contains(rightBottom)); 100 REPORTER_ASSERT(reporter, rect.contains(rightBottom));
100 } 101 }
101 } 102 }
102
103 #include "TestClassDef.h"
104 DEFINE_TESTCLASS_SHORT(PathOpsDRectTest)
OLDNEW
« no previous file with comments | « tests/PathOpsDQuadTest.cpp ('k') | tests/PathOpsDTriangleTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698