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

Side by Side Diff: tests/PathOpsBoundsTest.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/PathOpsAngleTest.cpp ('k') | tests/PathOpsCubicIntersectionTest.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 2013 Google Inc. 2 * Copyright 2013 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 "SkPathOpsBounds.h" 8 #include "SkPathOpsBounds.h"
9 #include "Test.h" 9 #include "Test.h"
10 #include "TestClassDef.h"
10 11
11 static const SkRect sectTests[][2] = { 12 static const SkRect sectTests[][2] = {
12 {{2, 0, 4, 1}, {4, 0, 6, 1}}, 13 {{2, 0, 4, 1}, {4, 0, 6, 1}},
13 {{2, 0, 4, 1}, {3, 0, 5, 1}}, 14 {{2, 0, 4, 1}, {3, 0, 5, 1}},
14 {{2, 0, 4, 1}, {3, 0, 5, 0}}, 15 {{2, 0, 4, 1}, {3, 0, 5, 0}},
15 {{2, 0, 4, 1}, {3, 1, 5, 2}}, 16 {{2, 0, 4, 1}, {3, 1, 5, 2}},
16 {{2, 1, 4, 2}, {1, 0, 5, 3}}, 17 {{2, 1, 4, 2}, {1, 0, 5, 3}},
17 {{2, 1, 5, 3}, {3, 1, 4, 2}}, 18 {{2, 1, 5, 3}, {3, 1, 4, 2}},
18 {{2, 0, 4, 1}, {3, 0, 3, 0}}, // intersecting an empty bounds is OK 19 {{2, 0, 4, 1}, {3, 0, 3, 0}}, // intersecting an empty bounds is OK
19 {{2, 0, 4, 1}, {4, 1, 5, 2}}, // touching just on a corner is OK 20 {{2, 0, 4, 1}, {4, 1, 5, 2}}, // touching just on a corner is OK
(...skipping 19 matching lines...) Expand all
39 static const size_t emptyTestsCount = SK_ARRAY_COUNT(reallyEmpty); 40 static const size_t emptyTestsCount = SK_ARRAY_COUNT(reallyEmpty);
40 41
41 static const SkRect notReallyEmpty[] = { 42 static const SkRect notReallyEmpty[] = {
42 {0, 0, 1, 0}, 43 {0, 0, 1, 0},
43 {0, 0, 0, 1}, 44 {0, 0, 0, 1},
44 {0, 0, 1, 1}, 45 {0, 0, 1, 1},
45 }; 46 };
46 47
47 static const size_t notEmptyTestsCount = SK_ARRAY_COUNT(notReallyEmpty); 48 static const size_t notEmptyTestsCount = SK_ARRAY_COUNT(notReallyEmpty);
48 49
49 static void PathOpsBoundsTest(skiatest::Reporter* reporter) { 50 DEF_TEST(PathOpsBounds, reporter) {
50 for (size_t index = 0; index < sectTestsCount; ++index) { 51 for (size_t index = 0; index < sectTestsCount; ++index) {
51 const SkPathOpsBounds& bounds1 = static_cast<const SkPathOpsBounds&>(sec tTests[index][0]); 52 const SkPathOpsBounds& bounds1 = static_cast<const SkPathOpsBounds&>(sec tTests[index][0]);
52 SkASSERT(ValidBounds(bounds1)); 53 SkASSERT(ValidBounds(bounds1));
53 const SkPathOpsBounds& bounds2 = static_cast<const SkPathOpsBounds&>(sec tTests[index][1]); 54 const SkPathOpsBounds& bounds2 = static_cast<const SkPathOpsBounds&>(sec tTests[index][1]);
54 SkASSERT(ValidBounds(bounds2)); 55 SkASSERT(ValidBounds(bounds2));
55 bool touches = SkPathOpsBounds::Intersects(bounds1, bounds2); 56 bool touches = SkPathOpsBounds::Intersects(bounds1, bounds2);
56 REPORTER_ASSERT(reporter, touches); 57 REPORTER_ASSERT(reporter, touches);
57 } 58 }
58 for (size_t index = 0; index < noSectTestsCount; ++index) { 59 for (size_t index = 0; index < noSectTestsCount; ++index) {
59 const SkPathOpsBounds& bounds1 = static_cast<const SkPathOpsBounds&>(noS ectTests[index][0]); 60 const SkPathOpsBounds& bounds1 = static_cast<const SkPathOpsBounds&>(noS ectTests[index][0]);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 expected.set(0, 0, 3, 4); 102 expected.set(0, 0, 3, 4);
102 REPORTER_ASSERT(reporter, bounds == expected); 103 REPORTER_ASSERT(reporter, bounds == expected);
103 (bounds.*SetCurveBounds[2])(curvePts); 104 (bounds.*SetCurveBounds[2])(curvePts);
104 REPORTER_ASSERT(reporter, bounds == expected); 105 REPORTER_ASSERT(reporter, bounds == expected);
105 bounds.setCubicBounds(curvePts); 106 bounds.setCubicBounds(curvePts);
106 expected.set(0, 0, 5, 6); 107 expected.set(0, 0, 5, 6);
107 REPORTER_ASSERT(reporter, bounds == expected); 108 REPORTER_ASSERT(reporter, bounds == expected);
108 (bounds.*SetCurveBounds[3])(curvePts); 109 (bounds.*SetCurveBounds[3])(curvePts);
109 REPORTER_ASSERT(reporter, bounds == expected); 110 REPORTER_ASSERT(reporter, bounds == expected);
110 } 111 }
111
112 #include "TestClassDef.h"
113 DEFINE_TESTCLASS_SHORT(PathOpsBoundsTest)
OLDNEW
« no previous file with comments | « tests/PathOpsAngleTest.cpp ('k') | tests/PathOpsCubicIntersectionTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698