diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-03-30 17:43:33 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-03-30 17:43:33 +0000 |
commit | 6de0bfc51a4f729a5a4a0fd870e2077f9416635e (patch) | |
tree | 6d05d34044a38617dfe1a3696a06764f74a9ce93 /tests/DrawBitmapRectTest.cpp | |
parent | 193395c7a391bc0046b7793d633487d510457aec (diff) |
regression unittest for the fix in rev. 3558 (handling nan in antihairpaths)
git-svn-id: http://skia.googlecode.com/svn/trunk@3562 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests/DrawBitmapRectTest.cpp')
-rw-r--r-- | tests/DrawBitmapRectTest.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/DrawBitmapRectTest.cpp b/tests/DrawBitmapRectTest.cpp index 843feb5d05..e5b446390c 100644 --- a/tests/DrawBitmapRectTest.cpp +++ b/tests/DrawBitmapRectTest.cpp @@ -9,6 +9,28 @@ #include "SkBitmap.h" #include "SkCanvas.h" +static void test_nan_antihair(skiatest::Reporter* reporter) { + SkBitmap bm; + bm.setConfig(SkBitmap::kARGB_8888_Config, 20, 20); + bm.allocPixels(); + + SkCanvas canvas(bm); + + SkPath path; + path.moveTo(0, 0); + path.lineTo(10, SK_ScalarNaN); + + SkPaint paint; + paint.setAntiAlias(true); + paint.setStyle(SkPaint::kStroke_Style); + + // before our fix to SkScan_Antihair.cpp to check for integral NaN (0x800...) + // this would trigger an assert/crash. + // + // see rev. 3558 + canvas.drawPath(path, paint); +} + static bool check_for_all_zeros(const SkBitmap& bm) { SkAutoLockPixels alp(bm); @@ -48,6 +70,8 @@ static void TestDrawBitmapRect(skiatest::Reporter* reporter) { // ensure that we draw nothing if srcR does not intersect the bitmap REPORTER_ASSERT(reporter, check_for_all_zeros(dst)); + + test_nan_antihair(reporter); } #include "TestClassDef.h" |