ethannicholas | c88cb89 | 2015-12-15 11:01:12 -0800 | [diff] [blame] | 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 | */ |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 7 | #include "src/core/SkPathPriv.h" |
| 8 | #include "tests/Test.h" |
ethannicholas | c88cb89 | 2015-12-15 11:01:12 -0800 | [diff] [blame] | 9 | |
| 10 | DEF_TEST(IsClosedSingleContourTest, reporter) { |
Mike Reed | ad5494d | 2020-08-25 17:36:28 -0400 | [diff] [blame] | 11 | SkPathBuilder p; |
| 12 | REPORTER_ASSERT(reporter, !SkPathPriv::IsClosedSingleContour(p.detach())); |
ethannicholas | c88cb89 | 2015-12-15 11:01:12 -0800 | [diff] [blame] | 13 | |
ethannicholas | c88cb89 | 2015-12-15 11:01:12 -0800 | [diff] [blame] | 14 | p.close(); |
Mike Reed | ad5494d | 2020-08-25 17:36:28 -0400 | [diff] [blame] | 15 | REPORTER_ASSERT(reporter, !SkPathPriv::IsClosedSingleContour(p.detach())); |
ethannicholas | c88cb89 | 2015-12-15 11:01:12 -0800 | [diff] [blame] | 16 | |
ethannicholas | c88cb89 | 2015-12-15 11:01:12 -0800 | [diff] [blame] | 17 | p.moveTo(10, 10); |
| 18 | p.close(); |
Mike Reed | ad5494d | 2020-08-25 17:36:28 -0400 | [diff] [blame] | 19 | REPORTER_ASSERT(reporter, SkPathPriv::IsClosedSingleContour(p.detach())); |
ethannicholas | c88cb89 | 2015-12-15 11:01:12 -0800 | [diff] [blame] | 20 | |
ethannicholas | c88cb89 | 2015-12-15 11:01:12 -0800 | [diff] [blame] | 21 | p.moveTo(10, 10); |
| 22 | p.lineTo(20, 20); |
| 23 | p.close(); |
Mike Reed | ad5494d | 2020-08-25 17:36:28 -0400 | [diff] [blame] | 24 | REPORTER_ASSERT(reporter, SkPathPriv::IsClosedSingleContour(p.detach())); |
ethannicholas | c88cb89 | 2015-12-15 11:01:12 -0800 | [diff] [blame] | 25 | |
ethannicholas | c88cb89 | 2015-12-15 11:01:12 -0800 | [diff] [blame] | 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(); |
Mike Reed | ad5494d | 2020-08-25 17:36:28 -0400 | [diff] [blame] | 32 | REPORTER_ASSERT(reporter, SkPathPriv::IsClosedSingleContour(p.detach())); |
ethannicholas | c88cb89 | 2015-12-15 11:01:12 -0800 | [diff] [blame] | 33 | |
ethannicholas | c88cb89 | 2015-12-15 11:01:12 -0800 | [diff] [blame] | 34 | p.moveTo(10, 10); |
| 35 | p.lineTo(20, 20); |
| 36 | p.lineTo(20, 30); |
Mike Reed | ad5494d | 2020-08-25 17:36:28 -0400 | [diff] [blame] | 37 | REPORTER_ASSERT(reporter, !SkPathPriv::IsClosedSingleContour(p.detach())); |
ethannicholas | c88cb89 | 2015-12-15 11:01:12 -0800 | [diff] [blame] | 38 | |
ethannicholas | c88cb89 | 2015-12-15 11:01:12 -0800 | [diff] [blame] | 39 | p.moveTo(10, 10); |
| 40 | p.lineTo(20, 20); |
| 41 | p.moveTo(10, 10); |
| 42 | p.lineTo(20, 30); |
| 43 | p.close(); |
Mike Reed | ad5494d | 2020-08-25 17:36:28 -0400 | [diff] [blame] | 44 | REPORTER_ASSERT(reporter, !SkPathPriv::IsClosedSingleContour(p.detach())); |
ethannicholas | c88cb89 | 2015-12-15 11:01:12 -0800 | [diff] [blame] | 45 | |
ethannicholas | c88cb89 | 2015-12-15 11:01:12 -0800 | [diff] [blame] | 46 | p.moveTo(10, 10); |
| 47 | p.lineTo(20, 20); |
| 48 | p.close(); |
| 49 | p.lineTo(20, 30); |
| 50 | p.close(); |
Mike Reed | ad5494d | 2020-08-25 17:36:28 -0400 | [diff] [blame] | 51 | REPORTER_ASSERT(reporter, !SkPathPriv::IsClosedSingleContour(p.detach())); |
ethannicholas | c88cb89 | 2015-12-15 11:01:12 -0800 | [diff] [blame] | 52 | } |