aboutsummaryrefslogtreecommitdiff
path: root/tests/PathTest.cpp
diff options
context:
space:
mode:
authorreed <reed@google.com>2015-07-29 08:37:13 -0700
committerCommit bot <commit-bot@chromium.org>2015-07-29 08:37:13 -0700
commit3b2fb981ab8d011077eb6de7eec5fe1f590906b3 (patch)
treee68555d3da4dd036a9371f761319a39223b57459 /tests/PathTest.cpp
parent117842223bd13325b6da26110d80e0590c1a742b (diff)
rewrite path.getBounds test to work-around compiler bug
BUG=skia: TBR= Review URL: https://codereview.chromium.org/1262143002
Diffstat (limited to 'tests/PathTest.cpp')
-rw-r--r--tests/PathTest.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp
index abe8b39590..8272692167 100644
--- a/tests/PathTest.cpp
+++ b/tests/PathTest.cpp
@@ -568,9 +568,19 @@ static void test_clipped_cubic() {
}
}
+static void dump_if_ne(skiatest::Reporter* reporter, const SkRect& expected, const SkRect& bounds) {
+ if (expected != bounds) {
+ ERRORF(reporter, "path.getBounds() returned [%g %g %g %g], but expected [%g %g %g %g]",
+ bounds.left(), bounds.top(), bounds.right(), bounds.bottom(),
+ expected.left(), expected.top(), expected.right(), expected.bottom());
+ }
+}
+
static void test_bounds_crbug_513799(skiatest::Reporter* reporter) {
SkPath path;
-
+#if 0
+ // As written these tests were failing on LLVM 4.2 MacMini Release mysteriously, so we've
+ // rewritten them to avoid this (compiler-bug?).
REPORTER_ASSERT(reporter, SkRect::MakeLTRB(0, 0, 0, 0) == path.getBounds());
path.moveTo(-5, -8);
@@ -581,6 +591,18 @@ static void test_bounds_crbug_513799(skiatest::Reporter* reporter) {
path.moveTo(1, 2);
REPORTER_ASSERT(reporter, SkRect::MakeLTRB(-5, -8, 3, 4) == path.getBounds());
+#else
+ dump_if_ne(reporter, SkRect::MakeLTRB(0, 0, 0, 0), path.getBounds());
+
+ path.moveTo(-5, -8); // should set the bounds
+ dump_if_ne(reporter, SkRect::MakeLTRB(-5, -8, -5, -8), path.getBounds());
+
+ path.addRect(SkRect::MakeLTRB(1, 2, 3, 4)); // should extend the bounds
+ dump_if_ne(reporter, SkRect::MakeLTRB(-5, -8, 3, 4), path.getBounds());
+
+ path.moveTo(1, 2); // don't expect this to have changed the bounds
+ dump_if_ne(reporter, SkRect::MakeLTRB(-5, -8, 3, 4), path.getBounds());
+#endif
}
// Inspired by http://ie.microsoft.com/testdrive/Performance/Chalkboard/