Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Unified Diff: tests/PathTest.cpp

Issue 892703002: use conics for arcTo (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix the legacy code-path for chrome Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkPath.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/PathTest.cpp
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp
index 16131dee80231719b50394645239c449595fbc51..a852bf0d101e4cdd2e4711d4a9cf476cf6e9059f 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;
}
« no previous file with comments | « src/core/SkPath.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698