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

Side by Side Diff: tests/GpuBitmapCopyTest.cpp

Issue 132843002: Add REPORTF test macro. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: final rebase 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/EmptyPathTest.cpp ('k') | tests/ImageDecodingTest.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 2012 Google Inc. 3 * Copyright 2012 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 8
9 #if SK_SUPPORT_GPU 9 #if SK_SUPPORT_GPU
10 10
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 143
144 // Extract a subset. If this succeeds we will test copying the subse t. 144 // Extract a subset. If this succeeds we will test copying the subse t.
145 SkBitmap subset; 145 SkBitmap subset;
146 const bool extracted = src.extractSubset(&subset, subsetRect); 146 const bool extracted = src.extractSubset(&subset, subsetRect);
147 147
148 for (size_t j = 0; j < SK_ARRAY_COUNT(gPairs); j++) { 148 for (size_t j = 0; j < SK_ARRAY_COUNT(gPairs); j++) {
149 dst.reset(); 149 dst.reset();
150 bool success = src.deepCopyTo(&dst, gPairs[j].fConfig); 150 bool success = src.deepCopyTo(&dst, gPairs[j].fConfig);
151 bool expected = gPairs[i].fValid[j] != '0'; 151 bool expected = gPairs[i].fValid[j] != '0';
152 if (success != expected) { 152 if (success != expected) {
153 SkString str; 153 ERRORF(reporter, "SkBitmap::deepCopyTo from %s to %s. "
154 str.printf("SkBitmap::deepCopyTo from %s to %s. expected %s returned %s", 154 "expected %s returned %s", gConfigName[i],
155 gConfigName[i], gConfigName[j], boolStr(expected) , 155 gConfigName[j], boolStr(expected),
156 boolStr(success)); 156 boolStr(success));
157 reporter->reportFailed(str);
158 } 157 }
159 158
160 bool canSucceed = src.canCopyTo(gPairs[j].fConfig); 159 bool canSucceed = src.canCopyTo(gPairs[j].fConfig);
161 if (success != canSucceed) { 160 if (success != canSucceed) {
162 SkString str; 161 ERRORF(reporter, "SkBitmap::deepCopyTo from %s to %s "
163 str.printf("SkBitmap::deepCopyTo from %s to %s returned %s," 162 "returned %s, but canCopyTo returned %s",
164 "but canCopyTo returned %s", 163 gConfigName[i], gConfigName[j], boolStr(success),
165 gConfigName[i], gConfigName[j], boolStr(success), 164 boolStr(canSucceed));
166 boolStr(canSucceed));
167 reporter->reportFailed(str);
168 } 165 }
169 166
170 TestIndividualCopy(reporter, gPairs[j].fConfig, success, src, ds t); 167 TestIndividualCopy(reporter, gPairs[j].fConfig, success, src, ds t);
171 168
172 // Test copying the subset bitmap, using both copyTo and deepCop yTo. 169 // Test copying the subset bitmap, using both copyTo and deepCop yTo.
173 if (extracted) { 170 if (extracted) {
174 SkBitmap subsetCopy; 171 SkBitmap subsetCopy;
175 success = subset.copyTo(&subsetCopy, gPairs[j].fConfig); 172 success = subset.copyTo(&subsetCopy, gPairs[j].fConfig);
176 REPORTER_ASSERT(reporter, success == expected); 173 REPORTER_ASSERT(reporter, success == expected);
177 REPORTER_ASSERT(reporter, success == canSucceed); 174 REPORTER_ASSERT(reporter, success == canSucceed);
(...skipping 10 matching lines...) Expand all
188 } 185 }
189 } // for (size_t j = ... 186 } // for (size_t j = ...
190 } // for (size_t i = ... 187 } // for (size_t i = ...
191 } // GrContextFactory::GLContextType 188 } // GrContextFactory::GLContextType
192 } 189 }
193 190
194 #include "TestClassDef.h" 191 #include "TestClassDef.h"
195 DEFINE_GPUTESTCLASS("GpuBitmapCopy", TestGpuBitmapCopyClass, TestGpuBitmapCopy) 192 DEFINE_GPUTESTCLASS("GpuBitmapCopy", TestGpuBitmapCopyClass, TestGpuBitmapCopy)
196 193
197 #endif 194 #endif
OLDNEW
« no previous file with comments | « tests/EmptyPathTest.cpp ('k') | tests/ImageDecodingTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698