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

Unified Diff: tests/PathTest.cpp

Issue 803153003: Fix rrects that are large enough that we lose/gain a bit when we add the radius to a bounds coordin… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: generalize test for all edges and axes Created 6 years 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/SkRRect.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 1a74682e546e967ac322b61ba76ca1de9f2d7411..4bd4538f1a0169db1588fee68c17da2306ef2b7e 100644
--- a/tests/PathTest.cpp
+++ b/tests/PathTest.cpp
@@ -21,6 +21,41 @@
#include "SkWriter32.h"
#include "Test.h"
+static void set_radii(SkVector radii[4], int index, float rad) {
+ sk_bzero(radii, sizeof(SkVector) * 4);
+ radii[index].set(rad, rad);
+}
+
+static void test_add_rrect(skiatest::Reporter* reporter, const SkRect& bounds,
+ const SkVector radii[4]) {
+ SkRRect rrect;
+ rrect.setRectRadii(bounds, radii);
+ REPORTER_ASSERT(reporter, bounds == rrect.rect());
+
+ SkPath path;
+ // this line should not assert in the debug build (from validate)
+ path.addRRect(rrect);
+ REPORTER_ASSERT(reporter, bounds == path.getBounds());
+}
+
+static void test_skbug_3239(skiatest::Reporter* reporter) {
+ const float min = SkBits2Float(0xcb7f16c8); /* -16717512.000000 */
+ const float max = SkBits2Float(0x4b7f1c1d); /* 16718877.000000 */
+ const float big = SkBits2Float(0x4b7f1bd7); /* 16718807.000000 */
+
+ const float rad = 33436320;
+
+ const SkRect rectx = SkRect::MakeLTRB(min, min, max, big);
+ const SkRect recty = SkRect::MakeLTRB(min, min, big, max);
+
+ SkVector radii[4];
+ for (int i = 0; i < 4; ++i) {
+ set_radii(radii, i, rad);
+ test_add_rrect(reporter, rectx, radii);
+ test_add_rrect(reporter, recty, radii);
+ }
+}
+
static void make_path_crbug364224(SkPath* path) {
path->reset();
path->moveTo(3.747501373f, 2.724499941f);
@@ -3729,4 +3764,5 @@ DEF_TEST(Paths, reporter) {
PathRefTest_Private::TestPathRef(reporter);
test_dump(reporter);
test_path_crbugskia2820(reporter);
+ test_skbug_3239(reporter);
}
« no previous file with comments | « src/core/SkRRect.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698