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

Side by Side Diff: tests/BlitRowTest.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/BitmapCopyTest.cpp ('k') | tests/DataRefTest.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 * 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 "Test.h" 8 #include "Test.h"
9 #include "TestClassDef.h" 9 #include "TestClassDef.h"
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 82
83 static bool check_color(const SkBitmap& bm, SkPMColor expect32, 83 static bool check_color(const SkBitmap& bm, SkPMColor expect32,
84 uint16_t expect16, uint8_t expect8, 84 uint16_t expect16, uint8_t expect8,
85 skiatest::Reporter* reporter) { 85 skiatest::Reporter* reporter) {
86 uint32_t expect; 86 uint32_t expect;
87 Proc proc = find_proc(bm, expect32, expect16, expect8, &expect); 87 Proc proc = find_proc(bm, expect32, expect16, expect8, &expect);
88 for (int y = 0; y < bm.height(); y++) { 88 for (int y = 0; y < bm.height(); y++) {
89 uint32_t bad; 89 uint32_t bad;
90 int x = proc(bm.getAddr(0, y), bm.width(), expect, &bad); 90 int x = proc(bm.getAddr(0, y), bm.width(), expect, &bad);
91 if (x >= 0) { 91 if (x >= 0) {
92 SkString str; 92 ERRORF(reporter, "BlitRow config=%s [%d %d] expected %x got %x",
93 str.printf("BlitRow config=%s [%d %d] expected %x got %x", 93 gConfigName[bm.config()], x, y, expect, bad);
94 gConfigName[bm.config()], x, y, expect, bad);
95 reporter->reportFailed(str);
96 return false; 94 return false;
97 } 95 }
98 } 96 }
99 return true; 97 return true;
100 } 98 }
101 99
102 // Make sure our blits always map src==0 to a noop, and src==FF to full opaque 100 // Make sure our blits always map src==0 to a noop, and src==FF to full opaque
103 static void test_00_FF(skiatest::Reporter* reporter) { 101 static void test_00_FF(skiatest::Reporter* reporter) {
104 static const int W = 256; 102 static const int W = 256;
105 103
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 canvas0.drawRect(srcR, paint); 243 canvas0.drawRect(srcR, paint);
246 mesh.draw(&canvas1, &paint); 244 mesh.draw(&canvas1, &paint);
247 245
248 if (!gOnce && false) { 246 if (!gOnce && false) {
249 save_bm(dstBM0, "drawBitmap.png"); 247 save_bm(dstBM0, "drawBitmap.png");
250 save_bm(dstBM1, "drawMesh.png"); 248 save_bm(dstBM1, "drawMesh.png");
251 gOnce = true; 249 gOnce = true;
252 } 250 }
253 251
254 if (memcmp(dstBM0.getPixels(), dstBM1.getPixels(), dstBM0.ge tSize())) { 252 if (memcmp(dstBM0.getPixels(), dstBM1.getPixels(), dstBM0.ge tSize())) {
255 SkString str; 253 ERRORF(reporter, "Diagonal config=%s bg=0x%x dither=%d"
256 str.printf("Diagonal config=%s bg=0x%x dither=%d alpha=0 x%x src=0x%x", 254 " alpha=0x%x src=0x%x",
257 gConfigName[gDstConfig[i]], bgColor, dither, alpha, c); 255 gConfigName[gDstConfig[i]], bgColor, dither,
258 reporter->reportFailed(str); 256 alpha, c);
259 } 257 }
260 } 258 }
261 } 259 }
262 } 260 }
263 } 261 }
264 } 262 }
265 263
266 DEF_TEST(BlitRow, reporter) { 264 DEF_TEST(BlitRow, reporter) {
267 test_00_FF(reporter); 265 test_00_FF(reporter);
268 test_diagonal(reporter); 266 test_diagonal(reporter);
269 } 267 }
OLDNEW
« no previous file with comments | « tests/BitmapCopyTest.cpp ('k') | tests/DataRefTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698