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

Side by Side Diff: tests/ColorFilterTest.cpp

Issue 23576015: Change old PRG to be SkLCGRandom; change new one to SkRandom (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fix some spurious SkMWCRandoms Created 7 years, 3 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/ClipStackTest.cpp ('k') | tests/ColorTest.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 /* 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 "SkColor.h" 9 #include "SkColor.h"
10 #include "SkColorFilter.h" 10 #include "SkColorFilter.h"
(...skipping 17 matching lines...) Expand all
28 28
29 template <typename T> T* reincarnate(T* obj) { 29 template <typename T> T* reincarnate(T* obj) {
30 return (T*)reincarnate_flattenable(obj); 30 return (T*)reincarnate_flattenable(obj);
31 } 31 }
32 32
33 /////////////////////////////////////////////////////////////////////////////// 33 ///////////////////////////////////////////////////////////////////////////////
34 34
35 #define ILLEGAL_MODE ((SkXfermode::Mode)-1) 35 #define ILLEGAL_MODE ((SkXfermode::Mode)-1)
36 36
37 static void test_asColorMode(skiatest::Reporter* reporter) { 37 static void test_asColorMode(skiatest::Reporter* reporter) {
38 SkMWCRandom rand; 38 SkRandom rand;
39 39
40 for (int mode = 0; mode <= SkXfermode::kLastMode; mode++) { 40 for (int mode = 0; mode <= SkXfermode::kLastMode; mode++) {
41 SkColor color = rand.nextU(); 41 SkColor color = rand.nextU();
42 42
43 // ensure we always get a filter, by avoiding the possibility of a 43 // ensure we always get a filter, by avoiding the possibility of a
44 // special case that would return NULL (if color's alpha is 0 or 0xFF) 44 // special case that would return NULL (if color's alpha is 0 or 0xFF)
45 color = SkColorSetA(color, 0x7F); 45 color = SkColorSetA(color, 0x7F);
46 46
47 SkColorFilter* cf = SkColorFilter::CreateModeFilter(color, 47 SkColorFilter* cf = SkColorFilter::CreateModeFilter(color,
48 (SkXfermode::Mode)mode); 48 (SkXfermode::Mode)mode);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 SkXfermode::Mode m2 = ILLEGAL_MODE; 88 SkXfermode::Mode m2 = ILLEGAL_MODE;
89 REPORTER_ASSERT(reporter, cf2->asColorMode(&c2, &m2)); 89 REPORTER_ASSERT(reporter, cf2->asColorMode(&c2, &m2));
90 REPORTER_ASSERT(reporter, c2 == expectedColor); 90 REPORTER_ASSERT(reporter, c2 == expectedColor);
91 REPORTER_ASSERT(reporter, m2 == expectedMode); 91 REPORTER_ASSERT(reporter, m2 == expectedMode);
92 } 92 }
93 } 93 }
94 } 94 }
95 95
96 #include "TestClassDef.h" 96 #include "TestClassDef.h"
97 DEFINE_TESTCLASS("ColorFilter", ColorFilterTestClass, test_asColorMode) 97 DEFINE_TESTCLASS("ColorFilter", ColorFilterTestClass, test_asColorMode)
OLDNEW
« no previous file with comments | « tests/ClipStackTest.cpp ('k') | tests/ColorTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698