aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/IsClosedSingleContourTest.cpp
blob: b5509983e586a87f644b207fbc6e8c98cfc11c38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
 * Copyright 2015 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */
#include "Test.h"
#include "SkPathPriv.h"

DEF_TEST(IsClosedSingleContourTest, reporter) {
    SkPath p;
    REPORTER_ASSERT(reporter, !SkPathPriv::IsClosedSingleContour(p));

    p.reset();
    p.close();
    REPORTER_ASSERT(reporter, !SkPathPriv::IsClosedSingleContour(p));

    p.reset();
    p.moveTo(10, 10);
    p.close();
    REPORTER_ASSERT(reporter, SkPathPriv::IsClosedSingleContour(p));

    p.reset();
    p.moveTo(10, 10);
    p.lineTo(20, 20);
    p.close();
    REPORTER_ASSERT(reporter, SkPathPriv::IsClosedSingleContour(p));

    p.reset();
    p.moveTo(10, 10);
    p.lineTo(20, 20);
    p.quadTo(30, 30, 40, 40);
    p.cubicTo(50, 50, 60, 60, 70, 70);
    p.conicTo(30, 30, 40, 40, 0.5);
    p.close();
    REPORTER_ASSERT(reporter, SkPathPriv::IsClosedSingleContour(p));

    p.reset();
    p.moveTo(10, 10);
    p.lineTo(20, 20);
    p.lineTo(20, 30);
    REPORTER_ASSERT(reporter, !SkPathPriv::IsClosedSingleContour(p));

    p.reset();
    p.moveTo(10, 10);
    p.lineTo(20, 20);
    p.moveTo(10, 10);
    p.lineTo(20, 30);
    p.close();
    REPORTER_ASSERT(reporter, !SkPathPriv::IsClosedSingleContour(p));

    p.reset();
    p.moveTo(10, 10);
    p.lineTo(20, 20);
    p.close();
    p.lineTo(20, 30);
    p.close();
    REPORTER_ASSERT(reporter, !SkPathPriv::IsClosedSingleContour(p));
}