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 "include/core/SkPathBuilder.h"
8 #include "src/core/SkPathPriv.h"
9 #include "tests/Test.h"
10
DEF_TEST(IsClosedSingleContourTest,reporter)11 DEF_TEST(IsClosedSingleContourTest, reporter) {
12 SkPathBuilder p;
13 REPORTER_ASSERT(reporter, !SkPathPriv::IsClosedSingleContour(p.detach()));
14
15 p.close();
16 REPORTER_ASSERT(reporter, !SkPathPriv::IsClosedSingleContour(p.detach()));
17
18 p.moveTo(10, 10);
19 p.close();
20 REPORTER_ASSERT(reporter, SkPathPriv::IsClosedSingleContour(p.detach()));
21
22 p.moveTo(10, 10);
23 p.lineTo(20, 20);
24 p.close();
25 REPORTER_ASSERT(reporter, SkPathPriv::IsClosedSingleContour(p.detach()));
26
27 p.moveTo(10, 10);
28 p.lineTo(20, 20);
29 p.quadTo(30, 30, 40, 40);
30 p.cubicTo(50, 50, 60, 60, 70, 70);
31 p.conicTo(30, 30, 40, 40, 0.5);
32 p.close();
33 REPORTER_ASSERT(reporter, SkPathPriv::IsClosedSingleContour(p.detach()));
34
35 p.moveTo(10, 10);
36 p.lineTo(20, 20);
37 p.lineTo(20, 30);
38 REPORTER_ASSERT(reporter, !SkPathPriv::IsClosedSingleContour(p.detach()));
39
40 p.moveTo(10, 10);
41 p.lineTo(20, 20);
42 p.moveTo(10, 10);
43 p.lineTo(20, 30);
44 p.close();
45 REPORTER_ASSERT(reporter, !SkPathPriv::IsClosedSingleContour(p.detach()));
46
47 p.moveTo(10, 10);
48 p.lineTo(20, 20);
49 p.close();
50 p.lineTo(20, 30);
51 p.close();
52 REPORTER_ASSERT(reporter, !SkPathPriv::IsClosedSingleContour(p.detach()));
53 }
54