aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/CanvasStateTest.cpp
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-09-18 20:15:12 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-09-18 20:15:12 +0000
commit07f6cf372dc003694c79cfb313923fef9eaf8dc8 (patch)
tree52149746fb0fe2f0a66265ce5c66f227c28d4ac2 /tests/CanvasStateTest.cpp
parent44d3dafc87796396850396ef607d7e8fa53e13eb (diff)
fix printing of error messages in canvasstatetest.
R=scroggo@google.com, caryclark@google.com Author: djsollen@google.com Review URL: https://chromiumcodereview.appspot.com/23477067 git-svn-id: http://skia.googlecode.com/svn/trunk@11363 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests/CanvasStateTest.cpp')
-rw-r--r--tests/CanvasStateTest.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/CanvasStateTest.cpp b/tests/CanvasStateTest.cpp
index 91d369e3f5..7cba71e726 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();
}
////////////////////////////////////////////////////////////////////////////////