diff options
author | 2012-04-11 17:51:01 +0000 | |
---|---|---|
committer | 2012-04-11 17:51:01 +0000 | |
commit | 94fa43c6255906660c2ff001fb462b6492cbdc07 (patch) | |
tree | 8a4a97ee3a4de91be4abb35d716481dc456884fe /tests | |
parent | 1647a1955fa44654102ae36df7af683bb8874175 (diff) |
Fix SkPathStroker::lineTo() for line with length SK_ScalarNearlyZero
Review URL: https://codereview.appspot.com/5992077
git-svn-id: http://skia.googlecode.com/svn/trunk@3650 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests')
-rw-r--r-- | tests/CanvasTest.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/CanvasTest.cpp b/tests/CanvasTest.cpp index 7cafda2b52..65a3494791 100644 --- a/tests/CanvasTest.cpp +++ b/tests/CanvasTest.cpp @@ -286,6 +286,29 @@ SIMPLE_TEST_STEP(DrawData, drawData(kTestText.c_str(), kTestText.size())); /////////////////////////////////////////////////////////////////////////////// // Complex test steps +// exercise fix for http://code.google.com/p/skia/issues/detail?id=560 +// ('SkPathStroker::lineTo() fails for line with length SK_ScalarNearlyZero') +static void DrawNearlyZeroLengthPathTestStep(SkCanvas* canvas, + skiatest::Reporter* reporter, + CanvasTestStep* testStep) { + SkPaint paint; + paint.setStrokeWidth(SkIntToScalar(1)); + paint.setStyle(SkPaint::kStroke_Style); + + SkPath path; + SkPoint pt1 = { 0, 0 }; + SkPoint pt2 = { 0, SK_ScalarNearlyZero }; + SkPoint pt3 = { SkIntToScalar(1), 0 }; + SkPoint pt4 = { SkIntToScalar(1), SK_ScalarNearlyZero/2 }; + path.moveTo(pt1); + path.lineTo(pt2); + path.lineTo(pt3); + path.lineTo(pt4); + + canvas->drawPath(path, paint); +} +TEST_STEP(DrawNearlyZeroLengthPath, DrawNearlyZeroLengthPathTestStep); + static void DrawVerticesShaderTestStep(SkCanvas* canvas, skiatest::Reporter* reporter, CanvasTestStep* testStep) { |