OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include <initializer_list> | 8 #include <initializer_list> |
9 #include <functional> | 9 #include <functional> |
10 #include "Test.h" | 10 #include "Test.h" |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 } else { | 307 } else { |
308 SkPath pA = pathA; | 308 SkPath pA = pathA; |
309 SkPath pB = pathB; | 309 SkPath pB = pathB; |
310 if (ignoreInversenessDifference) { | 310 if (ignoreInversenessDifference) { |
311 pA.setFillType(SkPath::ConvertToNonInverseFillType(pathA.getFillType
())); | 311 pA.setFillType(SkPath::ConvertToNonInverseFillType(pathA.getFillType
())); |
312 pB.setFillType(SkPath::ConvertToNonInverseFillType(pathB.getFillType
())); | 312 pB.setFillType(SkPath::ConvertToNonInverseFillType(pathB.getFillType
())); |
313 REPORTER_ASSERT(r, keyA != keyB); | 313 REPORTER_ASSERT(r, keyA != keyB); |
314 } else { | 314 } else { |
315 REPORTER_ASSERT(r, keyA == keyB); | 315 REPORTER_ASSERT(r, keyA == keyB); |
316 } | 316 } |
| 317 if (a.style().isSimpleFill() != b.style().isSimpleFill()) { |
| 318 // GrShape will close paths with simple fill style. Make the non-fil
led path closed |
| 319 // so that the comparision will succeed. Make sure both are closed b
efore comparing. |
| 320 pA.close(); |
| 321 pB.close(); |
| 322 } |
317 REPORTER_ASSERT(r, pA == pB); | 323 REPORTER_ASSERT(r, pA == pB); |
318 REPORTER_ASSERT(r, aIsRRect == bIsRRect); | 324 REPORTER_ASSERT(r, aIsRRect == bIsRRect); |
319 if (aIsRRect) { | 325 if (aIsRRect) { |
320 REPORTER_ASSERT(r, rrectA == rrectB); | 326 REPORTER_ASSERT(r, rrectA == rrectB); |
321 REPORTER_ASSERT(r, dirA == dirB); | 327 REPORTER_ASSERT(r, dirA == dirB); |
322 REPORTER_ASSERT(r, startA == startB); | 328 REPORTER_ASSERT(r, startA == startB); |
323 REPORTER_ASSERT(r, ignoreInversenessDifference || invertedA == inver
tedB); | 329 REPORTER_ASSERT(r, ignoreInversenessDifference || invertedA == inver
tedB); |
324 } | 330 } |
325 } | 331 } |
326 REPORTER_ASSERT(r, a.isEmpty() == b.isEmpty()); | 332 REPORTER_ASSERT(r, a.isEmpty() == b.isEmpty()); |
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1340 test_path_effect_makes_rrect(reporter, rr); | 1346 test_path_effect_makes_rrect(reporter, rr); |
1341 test_unknown_path_effect(reporter, rr); | 1347 test_unknown_path_effect(reporter, rr); |
1342 test_path_effect_makes_empty_shape(reporter, rr); | 1348 test_path_effect_makes_empty_shape(reporter, rr); |
1343 test_path_effect_fails(reporter, rr); | 1349 test_path_effect_fails(reporter, rr); |
1344 test_make_hairline_path_effect(reporter, rr, true); | 1350 test_make_hairline_path_effect(reporter, rr, true); |
1345 GrShape shape(rr); | 1351 GrShape shape(rr); |
1346 REPORTER_ASSERT(reporter, !shape.asLine(nullptr)); | 1352 REPORTER_ASSERT(reporter, !shape.asLine(nullptr)); |
1347 } | 1353 } |
1348 | 1354 |
1349 struct TestPath { | 1355 struct TestPath { |
1350 TestPath(const SkPath& path, bool isRRectFill, bool isRRectStroke, bool
isLine, const SkRRect& rrect) | 1356 TestPath(const SkPath& path, bool isRRectFill, bool isRRectStroke, bool
isLine, |
| 1357 const SkRRect& rrect) |
1351 : fPath(path) | 1358 : fPath(path) |
1352 , fIsRRectForFill(isRRectFill) | 1359 , fIsRRectForFill(isRRectFill) |
1353 , fIsRRectForStroke(isRRectStroke) | 1360 , fIsRRectForStroke(isRRectStroke) |
1354 , fIsLine(isLine) | 1361 , fIsLine(isLine) |
1355 , fRRect(rrect) {} | 1362 , fRRect(rrect) {} |
1356 SkPath fPath; | 1363 SkPath fPath; |
1357 bool fIsRRectForFill; | 1364 bool fIsRRectForFill; |
1358 bool fIsRRectForStroke; | 1365 bool fIsRRectForStroke; |
1359 bool fIsLine; | 1366 bool fIsLine; |
1360 SkRRect fRRect; | 1367 SkRRect fRRect; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1459 REPORTER_ASSERT(reporter, testPath.fIsLine == strokePathCase.baseShape()
.asLine(nullptr)); | 1466 REPORTER_ASSERT(reporter, testPath.fIsLine == strokePathCase.baseShape()
.asLine(nullptr)); |
1460 } | 1467 } |
1461 | 1468 |
1462 // Test a volatile empty path. | 1469 // Test a volatile empty path. |
1463 test_volatile_path(reporter, SkPath(), true); | 1470 test_volatile_path(reporter, SkPath(), true); |
1464 | 1471 |
1465 test_empty_shape(reporter); | 1472 test_empty_shape(reporter); |
1466 } | 1473 } |
1467 | 1474 |
1468 #endif | 1475 #endif |
OLD | NEW |