OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 | 7 |
8 #include "SkRandom.h" | 8 #include "SkRandom.h" |
9 #include "Test.h" | 9 #include "Test.h" |
10 #include "gradients/SkClampRange.h" | 10 #include "gradients/SkClampRange.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 test_range( ff(2), 0, 20); | 75 test_range( ff(2), 0, 20); |
76 | 76 |
77 test_range(-10, 1, 20); | 77 test_range(-10, 1, 20); |
78 test_range(10, -1, 20); | 78 test_range(10, -1, 20); |
79 test_range(-10, 3, 20); | 79 test_range(-10, 3, 20); |
80 test_range(10, -3, 20); | 80 test_range(10, -3, 20); |
81 | 81 |
82 test_range(ff(1), ff(16384), 100); | 82 test_range(ff(1), ff(16384), 100); |
83 test_range(ff(-1), ff(-16384), 100); | 83 test_range(ff(-1), ff(-16384), 100); |
84 test_range(ff(1)/2, ff(16384), 100); | 84 test_range(ff(1)/2, ff(16384), 100); |
85 // TODO(reed): skia:2481, fix whatever bug this is, then uncomment | 85 test_range(ff(1)/2, ff(-16384), 100); |
86 //test_range(ff(1)/2, ff(-16384), 100); | |
87 | 86 |
88 SkRandom rand; | 87 SkRandom rand; |
89 | 88 |
90 // test non-overflow cases | 89 // test non-overflow cases |
91 for (int i = 0; i < 1000000; i++) { | 90 for (int i = 0; i < 1000000; i++) { |
92 SkFixed fx = rand.nextS() >> 1; | 91 SkFixed fx = rand.nextS() >> 1; |
93 SkFixed sx = rand.nextS() >> 1; | 92 SkFixed sx = rand.nextS() >> 1; |
94 int count = rand.nextU() % 1000 + 1; | 93 int count = rand.nextU() % 1000 + 1; |
95 SkFixed dx = (sx - fx) / count; | 94 SkFixed dx = (sx - fx) / count; |
96 test_range(fx, dx, count); | 95 test_range(fx, dx, count); |
97 } | 96 } |
98 | 97 |
99 // TODO(reed): skia:2481, fix whatever bug this is, then uncomment | 98 // TODO(reed): skia:2481, fix whatever bug this is, then uncomment |
100 /* | 99 /* |
101 // test overflow cases | 100 // test overflow cases |
102 for (int i = 0; i < 100000; i++) { | 101 for (int i = 0; i < 100000; i++) { |
103 SkFixed fx = rand.nextS(); | 102 SkFixed fx = rand.nextS(); |
104 SkFixed dx = rand.nextS(); | 103 SkFixed dx = rand.nextS(); |
105 int count = rand.nextU() % 1000 + 1; | 104 int count = rand.nextU() % 1000 + 1; |
106 test_range(fx, dx, count); | 105 test_range(fx, dx, count); |
107 } | 106 } |
108 */ | 107 */ |
109 } | 108 } |
OLD | NEW |