OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #include "Test.h" | 8 #include "Test.h" |
9 #include "gradients/SkClampRange.h" | 9 #include "gradients/SkClampRange.h" |
10 #include "SkRandom.h" | 10 #include "SkRandom.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 fx += dx; | 58 fx += dx; |
59 } | 59 } |
60 } else { | 60 } else { |
61 for (i = 0; i < range.fCount0; i++) { | 61 for (i = 0; i < range.fCount0; i++) { |
62 int v = classify_value(fx, V0, V1); | 62 int v = classify_value(fx, V0, V1); |
63 R_ASSERT(v == range.fV0); | 63 R_ASSERT(v == range.fV0); |
64 fx += dx; | 64 fx += dx; |
65 } | 65 } |
66 if (range.fCount1 > 0 && fx != range.fFx1) { | 66 if (range.fCount1 > 0 && fx != range.fFx1) { |
67 SkDebugf("%x %x\n", fx, range.fFx1); | 67 SkDebugf("%x %x\n", fx, range.fFx1); |
68 R_ASSERT(!"bad fFx1"); | 68 R_ASSERT(false); // bad fFx1 |
69 return; | 69 return; |
70 } | 70 } |
71 for (i = 0; i < range.fCount1; i++) { | 71 for (i = 0; i < range.fCount1; i++) { |
72 R_ASSERT(fx >= 0 && fx <= 0xFFFF); | 72 R_ASSERT(fx >= 0 && fx <= 0xFFFF); |
73 fx += dx; | 73 fx += dx; |
74 } | 74 } |
75 for (i = 0; i < range.fCount2; i++) { | 75 for (i = 0; i < range.fCount2; i++) { |
76 int v = classify_value(fx, V0, V1); | 76 int v = classify_value(fx, V0, V1); |
77 R_ASSERT(v == range.fV1); | 77 R_ASSERT(v == range.fV1); |
78 fx += dx; | 78 fx += dx; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 test_range(fx, dx, count); | 126 test_range(fx, dx, count); |
127 } | 127 } |
128 } | 128 } |
129 | 129 |
130 #ifdef USE_REPORTER | 130 #ifdef USE_REPORTER |
131 | 131 |
132 #include "TestClassDef.h" | 132 #include "TestClassDef.h" |
133 DEFINE_TESTCLASS("ClampRange", ClampRangeClass, TestClampRange) | 133 DEFINE_TESTCLASS("ClampRange", ClampRangeClass, TestClampRange) |
134 | 134 |
135 #endif | 135 #endif |
OLD | NEW |