blob: e9d8765f26ce1fac9093a20fb278d1a48a4845ce [file] [log] [blame]
caryclark@google.com7dfbb072013-04-22 14:37:05 +00001/*
2 * Copyright 2013 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 Kleinc0bd9f92019-04-23 12:05:21 -05007#include "tests/PathOpsExtendedTest.h"
caryclark@google.com7dfbb072013-04-22 14:37:05 +00008
tfarina@chromium.org78e7b4e2014-01-02 21:45:03 +00009DEF_TEST(PathOpsInverse, reporter) {
Mike Reed30bc5272019-11-22 18:34:02 +000010 const SkPathDirection dirs[] = {SkPathDirection::kCW, SkPathDirection::kCCW};
Mike Reed7d34dc72019-11-26 12:17:17 -050011 const SkPathFillType fts[] = {
12 SkPathFillType::kWinding, SkPathFillType::kEvenOdd,
13 SkPathFillType::kInverseWinding, SkPathFillType::kInverseEvenOdd
14 };
caryclark@google.com7dfbb072013-04-22 14:37:05 +000015 SkPath one, two;
Cary Clark4533f3d2018-08-08 09:48:09 -040016 int testCount = 0;
caryclark54359292015-03-26 07:52:43 -070017 for (int op = kDifference_SkPathOp; op <= kReverseDifference_SkPathOp; ++op) {
Mike Reed7d34dc72019-11-26 12:17:17 -050018 for (auto oneFill : fts) {
Mike Reed30bc5272019-11-22 18:34:02 +000019 for (auto oneDir : dirs) {
caryclark@google.com7dfbb072013-04-22 14:37:05 +000020 one.reset();
Mike Reed7d34dc72019-11-26 12:17:17 -050021 one.setFillType(oneFill);
Mike Reed30bc5272019-11-22 18:34:02 +000022 one.addRect(0, 0, 6, 6, oneDir);
Mike Reed7d34dc72019-11-26 12:17:17 -050023 for (auto twoFill : fts) {
Mike Reed30bc5272019-11-22 18:34:02 +000024 for (auto twoDir : dirs) {
caryclark@google.com7dfbb072013-04-22 14:37:05 +000025 two.reset();
Mike Reed7d34dc72019-11-26 12:17:17 -050026 two.setFillType(twoFill);
Mike Reed30bc5272019-11-22 18:34:02 +000027 two.addRect(3, 3, 9, 9, twoDir);
Cary Clark4533f3d2018-08-08 09:48:09 -040028 SkString testName;
29 testName.printf("inverseTest%d", ++testCount);
30 testPathOp(reporter, one, two, (SkPathOp) op, testName.c_str());
caryclark@google.com7dfbb072013-04-22 14:37:05 +000031 }
32 }
33 }
34 }
35 }
36}