diff options
author | 2013-09-19 22:11:38 +0000 | |
---|---|---|
committer | 2013-09-19 22:11:38 +0000 | |
commit | c5e57bd0a3e1b3b8d2d11307c6de1886656ca9fd (patch) | |
tree | 46cfc94222f7791153158963546c4877a221692b /tests/ErrorTest.cpp | |
parent | 191eaeb9169c3c1cfc6e3039a18b270fd7ddf9cf (diff) |
silence the error test to be a better citizen
BUG=
R=caryclark@google.com, bsalomon@google.com, tfarina@chromium.org, mtklein@google.com
Author: humper@google.com
Review URL: https://chromiumcodereview.appspot.com/23481012
git-svn-id: http://skia.googlecode.com/svn/trunk@11409 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests/ErrorTest.cpp')
-rw-r--r-- | tests/ErrorTest.cpp | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/tests/ErrorTest.cpp b/tests/ErrorTest.cpp index 761f8bf66f..5b92808507 100644 --- a/tests/ErrorTest.cpp +++ b/tests/ErrorTest.cpp @@ -10,21 +10,32 @@ #include "SkPath.h" #include "SkRect.h" +typedef struct { + skiatest::Reporter *fReporter; + unsigned int *fIntPointer; +} ErrorContext; + #define CHECK(errcode) \ REPORTER_ASSERT( reporter, (err = SkGetLastError()) == errcode); \ if (err != kNoError_SkError) \ { \ - SkDebugf("Last error string: %s\n", SkGetLastErrorString()); \ SkClearLastError(); \ } static void cb(SkError err, void *context) { - int *context_ptr = static_cast<int *>(context); - SkDebugf("CB (0x%x): %s\n", *context_ptr, SkGetLastErrorString()); + ErrorContext *context_ptr = static_cast<ErrorContext *>(context); + REPORTER_ASSERT( context_ptr->fReporter, (*(context_ptr->fIntPointer) == 0xdeadbeef) ); } static void ErrorTest(skiatest::Reporter* reporter) { SkError err; + + unsigned int test_value = 0xdeadbeef; + ErrorContext context; + context.fReporter = reporter; + context.fIntPointer = &test_value; + + SkSetErrorCallback(cb, &context); CHECK(kNoError_SkError); @@ -43,19 +54,10 @@ static void ErrorTest(skiatest::Reporter* reporter) { CHECK(kInvalidArgument_SkError); CHECK(kNoError_SkError); - int test_value = 0xdeadbeef; - SkSetErrorCallback(cb, &test_value); - // should trigger *our* callback. path.addRoundRect(r, -10, -10); CHECK(kInvalidArgument_SkError); CHECK(kNoError_SkError); - - // Should trigger the default one again. - SkSetErrorCallback(NULL, NULL); - path.addRoundRect(r, -10, -10); - CHECK(kInvalidArgument_SkError); - CHECK(kNoError_SkError); } #include "TestClassDef.h" |