diff options
author | Mike Reed <reed@google.com> | 2009-06-05 08:28:19 -0400 |
---|---|---|
committer | Mike Reed <reed@google.com> | 2009-06-05 08:47:36 -0400 |
commit | 79377cbceeea970b663e7934d7cb1f27bb223d98 (patch) | |
tree | 4a4f44a0b57142096b0b6cd553f22906b1cc169f /tests | |
parent | b630785db28d3dbd2ef9fa2b15eb7aea0def82e8 (diff) | |
download | external_skia-79377cbceeea970b663e7934d7cb1f27bb223d98.zip external_skia-79377cbceeea970b663e7934d7cb1f27bb223d98.tar.gz external_skia-79377cbceeea970b663e7934d7cb1f27bb223d98.tar.bz2 |
refresh from skia
add isConvex to paths
cache bitmap in gradients for opengl texture
64-bit fixes in views
dumpcanvas now recurses on pictures
Diffstat (limited to 'tests')
-rw-r--r-- | tests/PathTest.cpp | 30 |
1 files changed, 29 insertions, 1 deletions
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)); |