1 /*
2  * Copyright 2015 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 #include "Test.h"
8 #include "SkPathPriv.h"
9 
DEF_TEST(IsClosedSingleContourTest,reporter)10 DEF_TEST(IsClosedSingleContourTest, reporter) {
11     SkPath p;
12     REPORTER_ASSERT(reporter, !SkPathPriv::IsClosedSingleContour(p));
13 
14     p.reset();
15     p.close();
16     REPORTER_ASSERT(reporter, !SkPathPriv::IsClosedSingleContour(p));
17 
18     p.reset();
19     p.moveTo(10, 10);
20     p.close();
21     REPORTER_ASSERT(reporter, SkPathPriv::IsClosedSingleContour(p));
22 
23     p.reset();
24     p.moveTo(10, 10);
25     p.lineTo(20, 20);
26     p.close();
27     REPORTER_ASSERT(reporter, SkPathPriv::IsClosedSingleContour(p));
28 
29     p.reset();
30     p.moveTo(10, 10);
31     p.lineTo(20, 20);
32     p.quadTo(30, 30, 40, 40);
33     p.cubicTo(50, 50, 60, 60, 70, 70);
34     p.conicTo(30, 30, 40, 40, 0.5);
35     p.close();
36     REPORTER_ASSERT(reporter, SkPathPriv::IsClosedSingleContour(p));
37 
38     p.reset();
39     p.moveTo(10, 10);
40     p.lineTo(20, 20);
41     p.lineTo(20, 30);
42     REPORTER_ASSERT(reporter, !SkPathPriv::IsClosedSingleContour(p));
43 
44     p.reset();
45     p.moveTo(10, 10);
46     p.lineTo(20, 20);
47     p.moveTo(10, 10);
48     p.lineTo(20, 30);
49     p.close();
50     REPORTER_ASSERT(reporter, !SkPathPriv::IsClosedSingleContour(p));
51 
52     p.reset();
53     p.moveTo(10, 10);
54     p.lineTo(20, 20);
55     p.close();
56     p.lineTo(20, 30);
57     p.close();
58     REPORTER_ASSERT(reporter, !SkPathPriv::IsClosedSingleContour(p));
59 }
60