diff options
author | halcanary@google.com <halcanary@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-01-10 14:58:10 +0000 |
---|---|---|
committer | halcanary@google.com <halcanary@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-01-10 14:58:10 +0000 |
commit | a9325fa237dde2654bc841c2bb0a05fc3e57696a (patch) | |
tree | 3d5952d42ac35f0c9200887215c47dcb14122e41 /tests/EmptyPathTest.cpp | |
parent | 9acb8cdf20423e80d5687ba3c8e11545e3bc8020 (diff) |
Add REPORTF test macro.
This macro replaces:
SkString str;
str.printf("Foo test Expected %d got %d", x, y);
reporter->reportFailed(str);
with the shorter code:
REPORTF(reporter, ("Foo test Expected %d got %d", x, y));
The new form also appends __FILE__:__LINE__ to the message before calling reportFailed().
BUG=
R=mtklein@google.com
Review URL: https://codereview.chromium.org/132843002
git-svn-id: http://skia.googlecode.com/svn/trunk@13016 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests/EmptyPathTest.cpp')
-rw-r--r-- | tests/EmptyPathTest.cpp | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/tests/EmptyPathTest.cpp b/tests/EmptyPathTest.cpp index fa1fd7f489..39e36808c7 100644 --- a/tests/EmptyPathTest.cpp +++ b/tests/EmptyPathTest.cpp @@ -10,17 +10,6 @@ #include "SkPath.h" #include "SkCanvas.h" -static void appendStr(SkString* str, const SkPaint& paint) { - str->appendf(" style[%d] cap[%d] join[%d] antialias[%d]", - paint.getStyle(), paint.getStrokeCap(), - paint.getStrokeJoin(), paint.isAntiAlias()); -} - -static void appendStr(SkString* str, const SkPath& path) { - str->appendf(" filltype[%d] ptcount[%d]", - path.getFillType(), path.countPoints()); -} - #define DIMENSION 32 static void drawAndTest(skiatest::Reporter* reporter, const SkPath& path, @@ -52,16 +41,16 @@ static void drawAndTest(skiatest::Reporter* reporter, const SkPath& path, bool success = shouldDraw ? (~0U == andValue) : (0 == orValue); if (!success) { - SkString str; + const char* str; if (shouldDraw) { - str.set("Path expected to draw everywhere, but didn't. "); + str = "Path expected to draw everywhere, but didn't. "; } else { - str.set("Path expected to draw nowhere, but did. "); + str = "Path expected to draw nowhere, but did. "; } - appendStr(&str, paint); - appendStr(&str, path); - reporter->reportFailed(str); - + ERRORF(reporter, "%s style[%d] cap[%d] join[%d] antialias[%d]" + " filltype[%d] ptcount[%d]", str, paint.getStyle(), + paint.getStrokeCap(), paint.getStrokeJoin(), + paint.isAntiAlias(), path.getFillType(), path.countPoints()); // uncomment this if you want to step in to see the failure // canvas.drawPath(path, p); } |