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

Side by Side Diff: tests/ClampRangeTest.cpp

Issue 100113004: Use DEFINE_TESTCLASS_SHORT macro in tests. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 7 years 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/CanvasTest.cpp ('k') | tests/ClipCubicTest.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
2 /* 1 /*
3 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
4 * 3 *
5 * 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
6 * found in the LICENSE file. 5 * found in the LICENSE file.
7 */ 6 */
7
8 #include "Test.h" 8 #include "Test.h"
9 #include "TestClassDef.h"
9 #include "gradients/SkClampRange.h" 10 #include "gradients/SkClampRange.h"
10 #include "SkRandom.h" 11 #include "SkRandom.h"
11 12
12 static skiatest::Reporter* gReporter; 13 static skiatest::Reporter* gReporter;
13 14
14 static void debug_me() { 15 static void debug_me() {
15 if (NULL == gReporter) { 16 if (NULL == gReporter) {
16 SkDebugf("dsfdssd\n"); 17 SkDebugf("dsfdssd\n");
17 } 18 }
18 } 19 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 fx += dx; 74 fx += dx;
74 } 75 }
75 for (i = 0; i < range.fCount2; i++) { 76 for (i = 0; i < range.fCount2; i++) {
76 int v = classify_value(fx, V0, V1); 77 int v = classify_value(fx, V0, V1);
77 R_ASSERT(v == range.fV1); 78 R_ASSERT(v == range.fV1);
78 fx += dx; 79 fx += dx;
79 } 80 }
80 } 81 }
81 } 82 }
82 83
84
83 static void test_range(SkFixed fx, SkFixed dx, int count) { 85 static void test_range(SkFixed fx, SkFixed dx, int count) {
84 SkClampRange range; 86 SkClampRange range;
85 range.init(fx, dx, count, V0, V1); 87 range.init(fx, dx, count, V0, V1);
86 slow_check(range, fx, dx, count); 88 slow_check(range, fx, dx, count);
87 } 89 }
88 90
89 #define ff(x) SkIntToFixed(x) 91 #define ff(x) SkIntToFixed(x)
90 92
91 void TestClampRange(skiatest::Reporter* reporter); 93 DEF_TEST(ClampRange, reporter) {
92 void TestClampRange(skiatest::Reporter* reporter) {
93 gReporter = reporter; 94 gReporter = reporter;
94 95
95 test_range(0, 0, 20); 96 test_range(0, 0, 20);
96 test_range(0xFFFF, 0, 20); 97 test_range(0xFFFF, 0, 20);
97 test_range(-ff(2), 0, 20); 98 test_range(-ff(2), 0, 20);
98 test_range( ff(2), 0, 20); 99 test_range( ff(2), 0, 20);
99 100
100 test_range(-10, 1, 20); 101 test_range(-10, 1, 20);
101 test_range(10, -1, 20); 102 test_range(10, -1, 20);
102 test_range(-10, 3, 20); 103 test_range(-10, 3, 20);
(...skipping 16 matching lines...) Expand all
119 } 120 }
120 121
121 // test overflow cases 122 // test overflow cases
122 for (int i = 0; i < 100000; i++) { 123 for (int i = 0; i < 100000; i++) {
123 SkFixed fx = rand.nextS(); 124 SkFixed fx = rand.nextS();
124 SkFixed dx = rand.nextS(); 125 SkFixed dx = rand.nextS();
125 int count = rand.nextU() % 1000 + 1; 126 int count = rand.nextU() % 1000 + 1;
126 test_range(fx, dx, count); 127 test_range(fx, dx, count);
127 } 128 }
128 } 129 }
129
130 #ifdef USE_REPORTER
131
132 #include "TestClassDef.h"
133 DEFINE_TESTCLASS("ClampRange", ClampRangeClass, TestClampRange)
134
135 #endif
OLDNEW
« no previous file with comments | « tests/CanvasTest.cpp ('k') | tests/ClipCubicTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698