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

Side by Side Diff: tests/ErrorTest.cpp

Issue 551973004: Clear away any lingering error before testing SkError. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 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
« 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 2013 Google Inc. 2 * Copyright 2013 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 "SkError.h" 8 #include "SkError.h"
9 #include "SkPath.h" 9 #include "SkPath.h"
10 #include "SkRect.h" 10 #include "SkRect.h"
(...skipping 10 matching lines...) Expand all
21 { \ 21 { \
22 SkClearLastError(); \ 22 SkClearLastError(); \
23 } 23 }
24 24
25 static void cb(SkError err, void *context) { 25 static void cb(SkError err, void *context) {
26 ErrorContext *context_ptr = static_cast<ErrorContext *>(context); 26 ErrorContext *context_ptr = static_cast<ErrorContext *>(context);
27 REPORTER_ASSERT( context_ptr->fReporter, (*(context_ptr->fIntPointer) == 0xd eadbeef) ); 27 REPORTER_ASSERT( context_ptr->fReporter, (*(context_ptr->fIntPointer) == 0xd eadbeef) );
28 } 28 }
29 29
30 DEF_TEST(Error, reporter) { 30 DEF_TEST(Error, reporter) {
31 // Some previous user of this thread may have left an error laying around.
32 SkClearLastError();
33
31 SkError err; 34 SkError err;
32 35
33 unsigned int test_value = 0xdeadbeef; 36 unsigned int test_value = 0xdeadbeef;
34 ErrorContext context; 37 ErrorContext context;
35 context.fReporter = reporter; 38 context.fReporter = reporter;
36 context.fIntPointer = &test_value; 39 context.fIntPointer = &test_value;
37 40
38 SkSetErrorCallback(cb, &context); 41 SkSetErrorCallback(cb, &context);
39 42
40 CHECK(kNoError_SkError); 43 CHECK(kNoError_SkError);
(...skipping 11 matching lines...) Expand all
52 // should trigger the default error callback, which just prints to the scree n. 55 // should trigger the default error callback, which just prints to the scree n.
53 path.addRoundRect(r, -10, -10); 56 path.addRoundRect(r, -10, -10);
54 CHECK(kInvalidArgument_SkError); 57 CHECK(kInvalidArgument_SkError);
55 CHECK(kNoError_SkError); 58 CHECK(kNoError_SkError);
56 59
57 // should trigger *our* callback. 60 // should trigger *our* callback.
58 path.addRoundRect(r, -10, -10); 61 path.addRoundRect(r, -10, -10);
59 CHECK(kInvalidArgument_SkError); 62 CHECK(kInvalidArgument_SkError);
60 CHECK(kNoError_SkError); 63 CHECK(kNoError_SkError);
61 } 64 }
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