aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-05-29 12:03:46 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-05-29 12:03:46 +0000
commit8b06f1a7ff6d5a59387a90433064550de20787ee (patch)
treeffe3607c2832ddfcec2d5ecdfb72641e3b9fcba0 /tests
parent398b1bcb7d30f9e55504b6de37d31ccc1a26c876 (diff)
Detect when the caller was hairline AND strokeandfill, and resolve that into FILL
This fixes the unittests on WIN in the trybot for DEPS roll 4048 Review URL: https://codereview.appspot.com/6242057 git-svn-id: http://skia.googlecode.com/svn/trunk@4057 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests')
-rw-r--r--tests/PathTest.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp
index ff4db0b632..fae2d4b250 100644
--- a/tests/PathTest.cpp
+++ b/tests/PathTest.cpp
@@ -10,11 +10,32 @@
#include "SkPath.h"
#include "SkParse.h"
#include "SkParsePath.h"
+#include "SkPathEffect.h"
#include "SkRandom.h"
#include "SkReader32.h"
#include "SkSize.h"
#include "SkWriter32.h"
+static void test_strokerec(skiatest::Reporter* reporter) {
+ SkStrokeRec rec(SkStrokeRec::kFill_InitStyle);
+ REPORTER_ASSERT(reporter, rec.isFillStyle());
+
+ rec.setHairlineStyle();
+ REPORTER_ASSERT(reporter, rec.isHairlineStyle());
+
+ rec.setStrokeStyle(SK_Scalar1, false);
+ REPORTER_ASSERT(reporter, SkStrokeRec::kStroke_Style == rec.getStyle());
+
+ rec.setStrokeStyle(SK_Scalar1, true);
+ REPORTER_ASSERT(reporter, SkStrokeRec::kStrokeAndFill_Style == rec.getStyle());
+
+ rec.setStrokeStyle(0, false);
+ REPORTER_ASSERT(reporter, SkStrokeRec::kHairline_Style == rec.getStyle());
+
+ rec.setStrokeStyle(0, true);
+ REPORTER_ASSERT(reporter, SkStrokeRec::kFill_Style == rec.getStyle());
+}
+
/**
* cheapIsDirection can take a shortcut when a path is marked convex.
* This function ensures that we always test cheapIsDirection when the path
@@ -1377,6 +1398,8 @@ void TestPath(skiatest::Reporter* reporter) {
test_raw_iter(reporter);
test_circle(reporter);
test_oval(reporter);
+
+ test_strokerec(reporter);
}
#include "TestClassDef.h"