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

Side by Side Diff: tests/BlitRowTest.cpp

Issue 132843002: Add REPORTF test macro. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: 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
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 REPORTF(reporter,
93 str.printf("BlitRow config=%s [%d %d] expected %x got %x", 93 ("BlitRow config=%s [%d %d] expected %x got %x",
94 gConfigName[bm.config()], x, y, expect, bad); 94 gConfigName[bm.config()], x, y, expect, bad));
95 reporter->reportFailed(str);
96 return false; 95 return false;
97 } 96 }
98 } 97 }
99 return true; 98 return true;
100 } 99 }
101 100
102 // Make sure our blits always map src==0 to a noop, and src==FF to full opaque 101 // 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) { 102 static void test_00_FF(skiatest::Reporter* reporter) {
104 static const int W = 256; 103 static const int W = 256;
105 104
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 canvas0.drawRect(srcR, paint); 244 canvas0.drawRect(srcR, paint);
246 mesh.draw(&canvas1, &paint); 245 mesh.draw(&canvas1, &paint);
247 246
248 if (!gOnce && false) { 247 if (!gOnce && false) {
249 save_bm(dstBM0, "drawBitmap.png"); 248 save_bm(dstBM0, "drawBitmap.png");
250 save_bm(dstBM1, "drawMesh.png"); 249 save_bm(dstBM1, "drawMesh.png");
251 gOnce = true; 250 gOnce = true;
252 } 251 }
253 252
254 if (memcmp(dstBM0.getPixels(), dstBM1.getPixels(), dstBM0.ge tSize())) { 253 if (memcmp(dstBM0.getPixels(), dstBM1.getPixels(), dstBM0.ge tSize())) {
255 SkString str; 254 REPORTF(reporter,
256 str.printf("Diagonal config=%s bg=0x%x dither=%d alpha=0 x%x src=0x%x", 255 ("Diagonal config=%s bg=0x%x dither=%d "
257 gConfigName[gDstConfig[i]], bgColor, dither, alpha, c); 256 "alpha=0x%x src=0x%x",
258 reporter->reportFailed(str); 257 gConfigName[gDstConfig[i]], bgColor, dither,
258 alpha, c));
259 } 259 }
260 } 260 }
261 } 261 }
262 } 262 }
263 } 263 }
264 } 264 }
265 265
266 DEF_TEST(BlitRow, reporter) { 266 DEF_TEST(BlitRow, reporter) {
267 test_00_FF(reporter); 267 test_00_FF(reporter);
268 test_diagonal(reporter); 268 test_diagonal(reporter);
269 } 269 }
OLDNEW
« no previous file with comments | « tests/BitmapCopyTest.cpp ('k') | tests/DataRefTest.cpp » ('j') | tests/ImageDecodingTest.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698