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