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

Side by Side Diff: tests/DrawPathTest.cpp

Issue 23586002: New warning -> new pattern for fingers to learn for asserting failure. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: 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 | « no previous file | no next file » | 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 2012 Google Inc. 2 * Copyright 2012 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 "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 SkCanvas* canvas = surf->getCanvas(); 43 SkCanvas* canvas = surf->getCanvas();
44 44
45 SkRect r = { 0, 33000, 300, 33300 }; 45 SkRect r = { 0, 33000, 300, 33300 };
46 int x = SkScalarRoundToInt(r.left()); 46 int x = SkScalarRoundToInt(r.left());
47 int y = SkScalarRoundToInt(r.top()); 47 int y = SkScalarRoundToInt(r.top());
48 48
49 // check that the pixel in question starts as transparent (by the surface) 49 // check that the pixel in question starts as transparent (by the surface)
50 if (canvas->readPixels(&output, x, y)) { 50 if (canvas->readPixels(&output, x, y)) {
51 REPORTER_ASSERT(reporter, 0 == pixel[0]); 51 REPORTER_ASSERT(reporter, 0 == pixel[0]);
52 } else { 52 } else {
53 REPORTER_ASSERT(reporter, !"readPixels failed"); 53 REPORTER_ASSERT_MESSAGE(reporter, false, "readPixels failed");
54 } 54 }
55 55
56 SkPaint paint; 56 SkPaint paint;
57 paint.setAntiAlias(true); 57 paint.setAntiAlias(true);
58 paint.setColor(SK_ColorWHITE); 58 paint.setColor(SK_ColorWHITE);
59 59
60 canvas->drawRect(r, paint); 60 canvas->drawRect(r, paint);
61 61
62 // Now check that it is BLACK 62 // Now check that it is BLACK
63 if (canvas->readPixels(&output, x, y)) { 63 if (canvas->readPixels(&output, x, y)) {
64 // don't know what swizzling PMColor did, but white should always 64 // don't know what swizzling PMColor did, but white should always
65 // appear the same. 65 // appear the same.
66 REPORTER_ASSERT(reporter, 0xFFFFFFFF == pixel[0]); 66 REPORTER_ASSERT(reporter, 0xFFFFFFFF == pixel[0]);
67 } else { 67 } else {
68 REPORTER_ASSERT(reporter, !"readPixels failed"); 68 REPORTER_ASSERT_MESSAGE(reporter, false, "readPixels failed");
69 } 69 }
70 surf->unref(); 70 surf->unref();
71 } 71 }
72 72
73 /////////////////////////////////////////////////////////////////////////////// 73 ///////////////////////////////////////////////////////////////////////////////
74 74
75 static void moveToH(SkPath* path, const uint32_t raw[]) { 75 static void moveToH(SkPath* path, const uint32_t raw[]) {
76 const float* fptr = (const float*)raw; 76 const float* fptr = (const float*)raw;
77 path->moveTo(fptr[0], fptr[1]); 77 path->moveTo(fptr[0], fptr[1]);
78 } 78 }
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 test_infinite_dash(reporter); 321 test_infinite_dash(reporter);
322 test_crbug_165432(reporter); 322 test_crbug_165432(reporter);
323 323
324 if (false) { // working on a fix 324 if (false) { // working on a fix
325 test_big_aa_rect(reporter); 325 test_big_aa_rect(reporter);
326 } 326 }
327 } 327 }
328 328
329 #include "TestClassDef.h" 329 #include "TestClassDef.h"
330 DEFINE_TESTCLASS("DrawPath", TestDrawPathClass, TestDrawPath) 330 DEFINE_TESTCLASS("DrawPath", TestDrawPathClass, TestDrawPath)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698