diff options
author | 2015-02-09 13:54:43 -0800 | |
---|---|---|
committer | 2015-02-09 13:54:43 -0800 | |
commit | d5d27d9b146731b871b1bcc6d6de36fba2d5ea44 (patch) | |
tree | c0cb8e1ce8b63f321988e5d16bd24432adb04755 /tests | |
parent | 8e85761e5a4a0b169cf101c4d72142ee4b87d266 (diff) |
use conics for arcTo
guarded by SK_SUPPORT_LEGACY_ARCTO_QUADS
BUG=skia:
Review URL: https://codereview.chromium.org/892703002
Diffstat (limited to 'tests')
-rw-r--r-- | tests/PathTest.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp index 16131dee80..a852bf0d10 100644 --- a/tests/PathTest.cpp +++ b/tests/PathTest.cpp @@ -3230,6 +3230,13 @@ static void check_path_is_quad_and_reset(skiatest::Reporter* reporter, SkPath* p check_done_and_reset(reporter, p, &iter); } +static bool nearly_equal(const SkRect& a, const SkRect& b) { + return SkScalarNearlyEqual(a.fLeft, b.fLeft) && + SkScalarNearlyEqual(a.fTop, b.fTop) && + SkScalarNearlyEqual(a.fRight, b.fRight) && + SkScalarNearlyEqual(a.fBottom, b.fBottom); +} + static void test_arcTo(skiatest::Reporter* reporter) { SkPath p; p.arcTo(0, 0, 1, 2, 1); @@ -3256,15 +3263,16 @@ static void test_arcTo(skiatest::Reporter* reporter) { check_path_is_move_and_reset(reporter, &p, oval.fRight, oval.centerY()); p.arcTo(oval, 360, 0, false); check_path_is_move_and_reset(reporter, &p, oval.fRight, oval.centerY()); + for (float sweep = 359, delta = 0.5f; sweep != (float) (sweep + delta); ) { p.arcTo(oval, 0, sweep, false); - REPORTER_ASSERT(reporter, p.getBounds() == oval); + REPORTER_ASSERT(reporter, nearly_equal(p.getBounds(), oval)); sweep += delta; delta /= 2; } for (float sweep = 361, delta = 0.5f; sweep != (float) (sweep - delta);) { p.arcTo(oval, 0, sweep, false); - REPORTER_ASSERT(reporter, p.getBounds() == oval); + REPORTER_ASSERT(reporter, nearly_equal(p.getBounds(), oval)); sweep -= delta; delta /= 2; } |