fix path to rect when missing close verb

R=brianosman@google.com,robertphillips@google.com
TBR=reed@google.com
Bug: 824145,skia:7792
Change-Id: I24f121cfa7d437c95b94bd917d3c4888a10c519e
Reviewed-on: https://skia-review.googlesource.com/119569
Commit-Queue: Cary Clark <caryclark@skia.org>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp
index a87b371..c3c023d 100644
--- a/tests/PathTest.cpp
+++ b/tests/PathTest.cpp
@@ -4899,3 +4899,16 @@
     REPORTER_ASSERT(reporter, !canvas->isClipEmpty());
 }
 
+// skbug.com/7792
+DEF_TEST(Path_isRect, reporter) {
+    SkPath path;
+    SkPoint points[] = { {10, 10}, {75, 75}, {150, 75}, {150, 150}, {75, 150} };
+    for (size_t index = 0; index < SK_ARRAY_COUNT(points); ++index) {
+        index < 2 ? path.moveTo(points[index]) : path.lineTo(points[index]);
+    }
+    SkRect rect;
+    REPORTER_ASSERT(reporter, path.isRect(&rect, nullptr, nullptr));
+    SkRect compare;
+    compare.set(&points[1], SK_ARRAY_COUNT(points) - 1);
+    REPORTER_ASSERT(reporter, rect == compare);
+}