From 79377cbceeea970b663e7934d7cb1f27bb223d98 Mon Sep 17 00:00:00 2001 From: Mike Reed Date: Fri, 5 Jun 2009 08:28:19 -0400 Subject: refresh from skia add isConvex to paths cache bitmap in gradients for opengl texture 64-bit fixes in views dumpcanvas now recurses on pictures --- tests/PathTest.cpp | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp index c17fa45..89fe93b 100644 --- a/tests/PathTest.cpp +++ b/tests/PathTest.cpp @@ -1,11 +1,27 @@ #include "Test.h" #include "SkPath.h" +static void check_convex_bounds(skiatest::Reporter* reporter, const SkPath& p, + const SkRect& bounds) { + REPORTER_ASSERT(reporter, p.isConvex()); + REPORTER_ASSERT(reporter, p.getBounds() == bounds); + + SkPath p2(p); + REPORTER_ASSERT(reporter, p2.isConvex()); + REPORTER_ASSERT(reporter, p2.getBounds() == bounds); + + SkPath other; + other.swap(p2); + REPORTER_ASSERT(reporter, other.isConvex()); + REPORTER_ASSERT(reporter, other.getBounds() == bounds); +} + static void TestPath(skiatest::Reporter* reporter) { SkPath p, p2; SkRect bounds, bounds2; REPORTER_ASSERT(reporter, p.isEmpty()); + REPORTER_ASSERT(reporter, !p.isConvex()); REPORTER_ASSERT(reporter, p.getFillType() == SkPath::kWinding_FillType); REPORTER_ASSERT(reporter, !p.isInverseFillType()); REPORTER_ASSERT(reporter, p == p2); @@ -14,8 +30,20 @@ static void TestPath(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, p.getBounds().isEmpty()); bounds.set(0, 0, SK_Scalar1, SK_Scalar1); + + p.setIsConvex(false); + p.addRoundRect(bounds, SK_Scalar1, SK_Scalar1); + check_convex_bounds(reporter, p, bounds); + + p.reset(); + p.setIsConvex(false); + p.addOval(bounds); + check_convex_bounds(reporter, p, bounds); + + p.reset(); + p.setIsConvex(false); p.addRect(bounds); - REPORTER_ASSERT(reporter, bounds == p.getBounds()); + check_convex_bounds(reporter, p, bounds); REPORTER_ASSERT(reporter, p != p2); REPORTER_ASSERT(reporter, !(p == p2)); -- cgit v1.1