add test that setLastPt() invalidates path bounds

Spoiler alert... it doesn't.

Bug: oss-fuzz:10488
Change-Id: Ifafd92f40aed55ff14a5198ea7d79a20751e40aa
Reviewed-on: https://skia-review.googlesource.com/156661
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
This commit is contained in:
Mike Klein 2018-09-24 20:30:28 -04:00 committed by Skia Commit-Bot
parent 822eecb2fb
commit 9de721655c

View File

@ -5180,3 +5180,19 @@ DEF_TEST(Path_shrinkToFit, reporter) {
SkDebugf("max_free %zu\n", max_free);
}
}
DEF_TEST(Path_setLastPt, r) {
// There was a time where SkPath::setLastPoint() didn't invalidate cached path bounds.
SkPath p;
p.moveTo(0,0);
p.moveTo(20,01);
p.moveTo(20,10);
p.moveTo(20,61);
REPORTER_ASSERT(r, p.getBounds() == SkRect::MakeLTRB(0,0, 20,61));
p.setLastPt(30,01);
REPORTER_ASSERT(r, p.getBounds() == SkRect::MakeLTRB(0,0, 30,10)); // was {0,0, 20,61}
REPORTER_ASSERT(r, p.isValid());
REPORTER_ASSERT(r, p.pathRefIsValid());
}