aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar mike@reedtribe.org <mike@reedtribe.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-04-14 12:55:17 +0000
committerGravatar mike@reedtribe.org <mike@reedtribe.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-04-14 12:55:17 +0000
commit6093e6582970364241a10d62b05efee50606c5e8 (patch)
tree9129f6639ff77213841f9d85d67130c26b353911
parente01403096cc8fc15217d7de08c476c2056d8b9d0 (diff)
dd DrawPathTest to gyp
add regression tests for bug 533 git-svn-id: http://skia.googlecode.com/svn/trunk@3678 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--gyp/tests.gyp1
-rw-r--r--tests/DrawPathTest.cpp31
2 files changed, 28 insertions, 4 deletions
diff --git a/gyp/tests.gyp b/gyp/tests.gyp
index 8c9c98542a..58039ba6c7 100644
--- a/gyp/tests.gyp
+++ b/gyp/tests.gyp
@@ -32,6 +32,7 @@
'../tests/DeferredCanvasTest.cpp',
'../tests/DequeTest.cpp',
'../tests/DrawBitmapRectTest.cpp',
+ '../tests/DrawPathTest.cpp',
'../tests/DrawTextTest.cpp',
'../tests/EmptyPathTest.cpp',
'../tests/FillPathTest.cpp',
diff --git a/tests/DrawPathTest.cpp b/tests/DrawPathTest.cpp
index ae0068b4c1..f0556c278f 100644
--- a/tests/DrawPathTest.cpp
+++ b/tests/DrawPathTest.cpp
@@ -21,25 +21,48 @@ static SkCanvas* create(SkBitmap::Config config, int w, int h, int rb,
return new SkCanvas(bm);
}
+static SkCanvas* new_canvas(int w, int h) {
+ return create(SkBitmap::kARGB_8888_Config, w, h, 0, NULL);
+}
+
+static void test_bug533(skiatest::Reporter* reporter) {
+#ifdef SK_SCALAR_IS_FLOAT
+ /*
+ http://code.google.com/p/skia/issues/detail?id=533
+ This particular test/bug only applies to the float case, where the
+ coordinates are very large.
+ */
+ SkPath path;
+ path.moveTo(64, 3);
+ path.quadTo(-329936, -100000000, 1153, 330003);
+
+ SkPaint paint;
+ paint.setAntiAlias(true);
+
+ SkAutoTUnref<SkCanvas> canvas(new_canvas(640, 480));
+ canvas.get()->drawPath(path, paint);
+#endif
+}
+
// we used to assert if the bounds of the device (clip) was larger than 32K
// even when the path itself was smaller. We just draw and hope in the debug
// version to not assert.
static void test_giantaa(skiatest::Reporter* reporter) {
const int W = 400;
const int H = 400;
- SkCanvas* canvas = create(SkBitmap::kARGB_8888_Config, 33000, 10, 0, NULL);
- canvas->clear(0);
+ SkAutoTUnref<SkCanvas> canvas(new_canvas(33000, 10));
+ canvas.get()->clear(0);
SkPaint paint;
paint.setAntiAlias(true);
SkPath path;
path.addOval(SkRect::MakeXYWH(-10, -10, 20 + W, 20 + H));
- canvas->drawPath(path, paint);
- canvas->unref();
+ canvas.get()->drawPath(path, paint);
}
static void TestDrawPath(skiatest::Reporter* reporter) {
test_giantaa(reporter);
+ test_bug533(reporter);
}
#include "TestClassDef.h"