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

Unified Diff: tests/CanvasStateTest.cpp

Issue 23477067: fix printing of error messages in canvasstatetest. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fix mac build 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/utils/SkCanvasStateUtils.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/CanvasStateTest.cpp
diff --git a/tests/CanvasStateTest.cpp b/tests/CanvasStateTest.cpp
index 91d369e3f5ddf71451e18b419faf87cf8474bf75..7cba71e7260879ad7677dd9ba92ab7e815ad9037 100644
--- a/tests/CanvasStateTest.cpp
+++ b/tests/CanvasStateTest.cpp
@@ -11,6 +11,7 @@
#include "SkCanvas.h"
#include "SkCanvasStateUtils.h"
#include "SkDrawFilter.h"
+#include "SkError.h"
#include "SkPaint.h"
#include "SkRect.h"
#include "SkRRect.h"
@@ -205,6 +206,9 @@ static void test_draw_filters(skiatest::Reporter* reporter) {
////////////////////////////////////////////////////////////////////////////////
+// we need this function to prevent SkError from printing to stdout
+static void error_callback(SkError code, void* ctx) {}
+
static void test_soft_clips(skiatest::Reporter* reporter) {
SkBitmapDevice device(SkBitmap::kARGB_8888_Config, 10, 10);
SkCanvas canvas(&device);
@@ -214,8 +218,13 @@ static void test_soft_clips(skiatest::Reporter* reporter) {
canvas.clipRRect(roundRect, SkRegion::kIntersect_Op, true);
+ SkSetErrorCallback(error_callback, NULL);
+
SkCanvasState* state = SkCanvasStateUtils::CaptureCanvasState(&canvas);
REPORTER_ASSERT(reporter, !state);
+
+ REPORTER_ASSERT(reporter, kInvalidOperation_SkError == SkGetLastError());
+ SkClearLastError();
}
////////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « src/utils/SkCanvasStateUtils.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698