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
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp
index ff4db0b..fae2d4b 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 @@
test_raw_iter(reporter);
test_circle(reporter);
test_oval(reporter);
+
+ test_strokerec(reporter);
}
#include "TestClassDef.h"