Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: tests/PathOpsOpTest.cpp

Issue 1107353004: align top and bounds computations (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: clean up code Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests/PathOpsIssue3651.cpp ('k') | tests/PathOpsTestCommon.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 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 #include "PathOpsExtendedTest.h" 7 #include "PathOpsExtendedTest.h"
8 #include "PathOpsTestCommon.h" 8 #include "PathOpsTestCommon.h"
9 9
10 #define TEST(name) { name, #name } 10 #define TEST(name) { name, #name }
(...skipping 4460 matching lines...) Expand 10 before | Expand all | Expand 10 after
4471 path.moveTo(1,5); 4471 path.moveTo(1,5);
4472 path.cubicTo(1,3, 6,2, 4,2); 4472 path.cubicTo(1,3, 6,2, 4,2);
4473 path.close(); 4473 path.close();
4474 pathB.setFillType(SkPath::kWinding_FillType); 4474 pathB.setFillType(SkPath::kWinding_FillType);
4475 pathB.moveTo(2,6); 4475 pathB.moveTo(2,6);
4476 pathB.cubicTo(2,4, 5,1, 3,1); 4476 pathB.cubicTo(2,4, 5,1, 3,1);
4477 pathB.close(); 4477 pathB.close();
4478 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename); 4478 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
4479 } 4479 }
4480 4480
4481 static void cubics20d(skiatest::Reporter* reporter, const char* filename) {
4482 SkPath path, pathB;
4483 path.setFillType(SkPath::kWinding_FillType);
4484 path.moveTo(1, 2);
4485 path.cubicTo(0, 3, 6, 0, 3, 2);
4486 path.close();
4487 pathB.setFillType(SkPath::kWinding_FillType);
4488 pathB.moveTo(0, 6);
4489 pathB.cubicTo(2, 3, 2, 1, 3, 0);
4490 pathB.close();
4491 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
4492 }
4493
4494 static void loops20i(skiatest::Reporter* reporter, const char* filename) {
4495 SkPath path, pathB;
4496 path.setFillType(SkPath::kWinding_FillType);
4497 path.moveTo(1, 2);
4498 path.cubicTo(0, 2, 0.833333313f, 2, 1, 3.66666651f);
4499 path.close();
4500 pathB.setFillType(SkPath::kWinding_FillType);
4501 pathB.moveTo(0, 2);
4502 pathB.cubicTo(0.833333313f, 2, 1, 3.66666651f, 1, 2);
4503 pathB.close();
4504 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4505 }
4506
4507 static void loops21i(skiatest::Reporter* reporter, const char* filename) {
4508 SkPath path, pathB;
4509 path.setFillType(SkPath::kWinding_FillType);
4510 path.moveTo(1, 2);
4511 path.cubicTo(0, 2, 0.833333313f, 2, 1, 4);
4512 path.close();
4513 pathB.setFillType(SkPath::kWinding_FillType);
4514 pathB.moveTo(0, 2);
4515 pathB.cubicTo(0.833333313f, 2, 1, 4, 1, 2);
4516 pathB.close();
4517 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4518 }
4519
4520 static void loops22i(skiatest::Reporter* reporter, const char* filename) {
4521 SkPath path, pathB;
4522 path.setFillType(SkPath::kWinding_FillType);
4523 path.moveTo(1, 3);
4524 path.cubicTo(0, 3, 0.833333313f, 3, 1, 4.66666651f);
4525 path.close();
4526 pathB.setFillType(SkPath::kWinding_FillType);
4527 pathB.moveTo(0, 3);
4528 pathB.cubicTo(0.833333313f, 3, 1, 4.66666651f, 1, 3);
4529 pathB.close();
4530 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4531 }
4532
4533 static void loops23i(skiatest::Reporter* reporter, const char* filename) {
4534 SkPath path, pathB;
4535 path.setFillType(SkPath::kWinding_FillType);
4536 path.moveTo(1, 5);
4537 path.cubicTo(0, 1, 6.16666698f, 5.66666698f, -5.66666651f, 6.66666651f);
4538 path.close();
4539 pathB.setFillType(SkPath::kWinding_FillType);
4540 pathB.moveTo(0, 1);
4541 pathB.cubicTo(6.16666698f, 5.66666698f, -5.66666651f, 6.66666651f, 1, 5);
4542 pathB.close();
4543 testPathOpCheck(reporter, path, pathB, kIntersect_SkPathOp, filename, FLAGS_ runFail);
4544 }
4545
4546 static void loops24i(skiatest::Reporter* reporter, const char* filename) {
4547 SkPath path, pathB;
4548 path.setFillType(SkPath::kWinding_FillType);
4549 path.moveTo(1, 2);
4550 path.cubicTo(0, 2, 0.833333313f, 2, 1, 3);
4551 path.close();
4552 pathB.setFillType(SkPath::kWinding_FillType);
4553 pathB.moveTo(0, 2);
4554 pathB.cubicTo(0.833333313f, 2, 1, 3, 1, 2);
4555 pathB.close();
4556 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4557 }
4558
4559 static void loops25i(skiatest::Reporter* reporter, const char* filename) {
4560 SkPath path, pathB;
4561 path.setFillType(SkPath::kWinding_FillType);
4562 path.moveTo(1, 5);
4563 path.cubicTo(0, 5, 0.833333313f, 5, 1, 7);
4564 path.close();
4565 pathB.setFillType(SkPath::kWinding_FillType);
4566 pathB.moveTo(0, 5);
4567 pathB.cubicTo(0.833333313f, 5, 1, 7, 1, 5);
4568 pathB.close();
4569 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4570 }
4571
4572 static void loops26i(skiatest::Reporter* reporter, const char* filename) {
4573 SkPath path, pathB;
4574 path.setFillType(SkPath::kWinding_FillType);
4575 path.moveTo(1, 6);
4576 path.cubicTo(0, 2, 6.16666698f, 6.66666698f, -5.66666651f, 7.66666651f);
4577 path.close();
4578 pathB.setFillType(SkPath::kWinding_FillType);
4579 pathB.moveTo(0, 2);
4580 pathB.cubicTo(6.16666698f, 6.66666698f, -5.66666651f, 7.66666651f, 1, 6);
4581 pathB.close();
4582 testPathOpCheck(reporter, path, pathB, kIntersect_SkPathOp, filename, FLAGS_ runFail);
4583 }
4584
4585 static void loops27i(skiatest::Reporter* reporter, const char* filename) {
4586 SkPath path, pathB;
4587 path.setFillType(SkPath::kWinding_FillType);
4588 path.moveTo(1, 3);
4589 path.cubicTo(0, 3, 0.833333313f, 3, 1, 4.33333349f);
4590 path.close();
4591 pathB.setFillType(SkPath::kWinding_FillType);
4592 pathB.moveTo(0, 3);
4593 pathB.cubicTo(0.833333313f, 3, 1, 4.33333349f, 1, 3);
4594 pathB.close();
4595 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4596 }
4597
4598 static void loops28i(skiatest::Reporter* reporter, const char* filename) {
4599 SkPath path, pathB;
4600 path.setFillType(SkPath::kWinding_FillType);
4601 path.moveTo(2, 3);
4602 path.cubicTo(1, 3, 1.83333337f, 3, 2, 4.66666651f);
4603 path.close();
4604 pathB.setFillType(SkPath::kWinding_FillType);
4605 pathB.moveTo(1, 3);
4606 pathB.cubicTo(1.83333337f, 3, 2, 4.66666651f, 2, 3);
4607 pathB.close();
4608 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4609 }
4610
4611 static void loops29i(skiatest::Reporter* reporter, const char* filename) {
4612 SkPath path, pathB;
4613 path.setFillType(SkPath::kWinding_FillType);
4614 path.moveTo(2, 4);
4615 path.cubicTo(0, 4, 1.66666663f, 4, 2, 7.33333302f);
4616 path.close();
4617 pathB.setFillType(SkPath::kWinding_FillType);
4618 pathB.moveTo(0, 4);
4619 pathB.cubicTo(1.66666663f, 4, 2, 7.33333302f, 2, 4);
4620 pathB.close();
4621 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4622 }
4623
4624 static void loops30i(skiatest::Reporter* reporter, const char* filename) {
4625 SkPath path, pathB;
4626 path.setFillType(SkPath::kWinding_FillType);
4627 path.moveTo(2, 4);
4628 path.cubicTo(0, 4, 1.66666663f, 4, 2, 8);
4629 path.close();
4630 pathB.setFillType(SkPath::kWinding_FillType);
4631 pathB.moveTo(0, 4);
4632 pathB.cubicTo(1.66666663f, 4, 2, 8, 2, 4);
4633 pathB.close();
4634 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4635 }
4636
4637 static void loops31i(skiatest::Reporter* reporter, const char* filename) {
4638 SkPath path, pathB;
4639 path.setFillType(SkPath::kWinding_FillType);
4640 path.moveTo(2, 5);
4641 path.cubicTo(1, 5, 1.83333337f, 5, 2, 6.66666651f);
4642 path.close();
4643 pathB.setFillType(SkPath::kWinding_FillType);
4644 pathB.moveTo(1, 5);
4645 pathB.cubicTo(1.83333337f, 5, 2, 6.66666651f, 2, 5);
4646 pathB.close();
4647 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4648 }
4649
4650 static void loops32i(skiatest::Reporter* reporter, const char* filename) {
4651 SkPath path, pathB;
4652 path.setFillType(SkPath::kWinding_FillType);
4653 path.moveTo(2, 6);
4654 path.cubicTo(1, 6, 1.83333337f, 6, 2, 8);
4655 path.close();
4656 pathB.setFillType(SkPath::kWinding_FillType);
4657 pathB.moveTo(1, 6);
4658 pathB.cubicTo(1.83333337f, 6, 2, 8, 2, 6);
4659 pathB.close();
4660 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4661 }
4662
4663 static void loops33i(skiatest::Reporter* reporter, const char* filename) {
4664 SkPath path, pathB;
4665 path.setFillType(SkPath::kWinding_FillType);
4666 path.moveTo(2, 6);
4667 path.cubicTo(1, 2, 7.16666698f, 6.66666698f, -4.66666651f, 7.66666651f);
4668 path.close();
4669 pathB.setFillType(SkPath::kWinding_FillType);
4670 pathB.moveTo(1, 2);
4671 pathB.cubicTo(7.16666698f, 6.66666698f, -4.66666651f, 7.66666651f, 2, 6);
4672 pathB.close();
4673 testPathOpCheck(reporter, path, pathB, kIntersect_SkPathOp, filename, FLAGS_ runFail);
4674 }
4675
4676 static void loops33iMod(skiatest::Reporter* reporter, const char* filename) {
4677 SkPoint pts[] = {{2, 6}, {1, 2}, {7.16666698f, 6.66666698f}, {-4.66666651f, 7.66666651f},
4678 {1, 2}, {7.16666698f, 6.66666698f}, {-4.66666651f, 7.666666 51f}, {2, 6}};
4679 bool up = false;
4680 float offset = 0.0380172729f;
4681 float step = 7.62939453e-006f;
4682 bool lastResult = true;
4683 // for (int i = 0; i < 30; ++i) {
4684 SkString name(filename);
4685 // name.appendS32(i);
4686 // if (i > 0) {
4687 // SkDebugf("\n\n<div id=\"%s\">\n", name.c_str());
4688 // }
4689 pts[5].fY = 6.66666698f + offset;
4690 SkPath path, pathB;
4691 path.setFillType(SkPath::kWinding_FillType);
4692 path.moveTo(pts[0]);
4693 path.cubicTo(pts[1], pts[2], pts[3]);
4694 path.close();
4695 pathB.setFillType(SkPath::kWinding_FillType);
4696 pathB.moveTo(pts[4]);
4697 pathB.cubicTo(pts[5], pts[6], pts[7]);
4698 pathB.close();
4699 bool result = testPathOpCheck(reporter, path, pathB, kIntersect_SkPathOp , name.c_str(),
4700 FLAGS_runFail);
4701 if (lastResult != result) {
4702 up = !up;
4703 }
4704 step /= 2;
4705 offset += up ? step : -step;
4706 lastResult = result;
4707 // }
4708 }
4709
4710
4711 static void loops33iAsQuads(skiatest::Reporter* reporter, const char* filename) {
4712 SkPath path, pathB;
4713 path.setFillType(SkPath::kWinding_FillType);
4714 path.moveTo(2, 6);
4715 path.cubicTo(1, 2, 7.16666698f, 6.66666698f, -4.66666651f, 7.66666651f);
4716 path.close();
4717 pathB.setFillType(SkPath::kWinding_FillType);
4718 pathB.moveTo(1, 2);
4719 pathB.cubicTo(7.16666698f, 6.66666698f, -4.66666651f, 7.66666651f, 2, 6);
4720 pathB.close();
4721 SkPath qPath, qPathB;
4722 CubicPathToQuads(path, &qPath);
4723 CubicPathToQuads(pathB, &qPathB);
4724 testPathOp(reporter, qPath, qPathB, kIntersect_SkPathOp, filename);
4725 }
4726
4727 static void loops34i(skiatest::Reporter* reporter, const char* filename) {
4728 SkPath path, pathB;
4729 path.setFillType(SkPath::kWinding_FillType);
4730 path.moveTo(3, 4);
4731 path.cubicTo(0, 4, 2.5f, 4, 3, 9);
4732 path.close();
4733 pathB.setFillType(SkPath::kWinding_FillType);
4734 pathB.moveTo(0, 4);
4735 pathB.cubicTo(2.5f, 4, 3, 9, 3, 4);
4736 pathB.close();
4737 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4738 }
4739
4740 static void loops35i(skiatest::Reporter* reporter, const char* filename) {
4741 SkPath path, pathB;
4742 path.setFillType(SkPath::kWinding_FillType);
4743 path.moveTo(3, 4);
4744 path.cubicTo(0, 4, 2.5f, 4, 3, 10);
4745 path.close();
4746 pathB.setFillType(SkPath::kWinding_FillType);
4747 pathB.moveTo(0, 4);
4748 pathB.cubicTo(2.5f, 4, 3, 10, 3, 4);
4749 pathB.close();
4750 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4751 }
4752
4753 static void loops36i(skiatest::Reporter* reporter, const char* filename) {
4754 SkPath path, pathB;
4755 path.setFillType(SkPath::kWinding_FillType);
4756 path.moveTo(3, 4);
4757 path.cubicTo(1, 4, 2.66666675f, 4, 3, 8);
4758 path.close();
4759 pathB.setFillType(SkPath::kWinding_FillType);
4760 pathB.moveTo(1, 4);
4761 pathB.cubicTo(2.66666675f, 4, 3, 8, 3, 4);
4762 pathB.close();
4763 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4764 }
4765
4766 static void loops37i(skiatest::Reporter* reporter, const char* filename) {
4767 SkPath path, pathB;
4768 path.setFillType(SkPath::kWinding_FillType);
4769 path.moveTo(2, 4);
4770 path.cubicTo(1, 4, 1.83333337f, 4, 2, 5.33333349f);
4771 path.close();
4772 pathB.setFillType(SkPath::kWinding_FillType);
4773 pathB.moveTo(1, 4);
4774 pathB.cubicTo(1.83333337f, 4, 2, 5.33333349f, 2, 4);
4775 pathB.close();
4776 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4777 }
4778
4779 static void loops38i(skiatest::Reporter* reporter, const char* filename) {
4780 SkPath path, pathB;
4781 path.setFillType(SkPath::kWinding_FillType);
4782 path.moveTo(3, 4);
4783 path.cubicTo(2, 4, 2.83333325f, 4, 3, 6);
4784 path.close();
4785 pathB.setFillType(SkPath::kWinding_FillType);
4786 pathB.moveTo(2, 4);
4787 pathB.cubicTo(2.83333325f, 4, 3, 6, 3, 4);
4788 pathB.close();
4789 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4790 }
4791
4792 static void loops39i(skiatest::Reporter* reporter, const char* filename) {
4793 SkPath path, pathB;
4794 path.setFillType(SkPath::kWinding_FillType);
4795 path.moveTo(3, 5);
4796 path.cubicTo(0, 5, 2.5f, 5, 3, 10);
4797 path.close();
4798 pathB.setFillType(SkPath::kWinding_FillType);
4799 pathB.moveTo(0, 5);
4800 pathB.cubicTo(2.5f, 5, 3, 10, 3, 5);
4801 pathB.close();
4802 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4803 }
4804
4805 static void loops40i(skiatest::Reporter* reporter, const char* filename) {
4806 SkPath path, pathB;
4807 path.setFillType(SkPath::kWinding_FillType);
4808 path.moveTo(3, 5);
4809 path.cubicTo(0, 5, 2.5f, 5, 3, 11);
4810 path.close();
4811 pathB.setFillType(SkPath::kWinding_FillType);
4812 pathB.moveTo(0, 5);
4813 pathB.cubicTo(2.5f, 5, 3, 11, 3, 5);
4814 pathB.close();
4815 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
4816 }
4817
4818 static void loops40iAsQuads(skiatest::Reporter* reporter, const char* filename) {
4819 SkPath path, pathB;
4820 path.setFillType(SkPath::kWinding_FillType);
4821 path.moveTo(3, 5);
4822 path.cubicTo(0, 5, 2.5f, 5, 3, 11);
4823 path.close();
4824 pathB.setFillType(SkPath::kWinding_FillType);
4825 pathB.moveTo(0, 5);
4826 pathB.cubicTo(2.5f, 5, 3, 11, 3, 5);
4827 pathB.close();
4828 SkPath qPath, qPathB;
4829 CubicPathToQuads(path, &qPath);
4830 CubicPathToQuads(pathB, &qPathB);
4831 testPathOp(reporter, qPath, qPathB, kIntersect_SkPathOp, filename);
4832 }
4833
4834 static void loops41i(skiatest::Reporter* reporter, const char* filename) {
4835 SkPath path, pathB;
4836 path.setFillType(SkPath::kWinding_FillType);
4837 path.moveTo(1, 5);
4838 path.cubicTo(0, 1, 6.16666698f, 5.66666698f, -5.66666651f, 6.66666651f);
4839 path.close();
4840 pathB.setFillType(SkPath::kWinding_FillType);
4841 pathB.moveTo(0, 1);
4842 pathB.cubicTo(6.16666698f, 5.66666698f, -5.66666651f, 6.66666651f, 1, 5);
4843 pathB.close();
4844 testPathOpCheck(reporter, path, pathB, kIntersect_SkPathOp, filename, FLAGS_ runFail);
4845 }
4846
4847 /*
4848 FAILED: d:\cygwin\puregit\tests\pathopsextendedtest.cpp:346 0 */
4849 static void loops42i(skiatest::Reporter* reporter, const char* filename) {
4850 SkPath path, pathB;
4851 path.setFillType(SkPath::kWinding_FillType);
4852 path.moveTo(1, 6);
4853 path.cubicTo(0, 2, 6.16666698f, 6.66666698f, -5.66666651f, 7.66666651f);
4854 path.close();
4855 pathB.setFillType(SkPath::kWinding_FillType);
4856 pathB.moveTo(0, 2);
4857 pathB.cubicTo(6.16666698f, 6.66666698f, -5.66666651f, 7.66666651f, 1, 6);
4858 pathB.close();
4859 testPathOpCheck(reporter, path, pathB, kIntersect_SkPathOp, filename, FLAGS_ runFail);
4860 }
4861
4862 /*
4863 FAILED: d:\cygwin\puregit\tests\pathopsextendedtest.cpp:346 0 */
4864 static void loops43i(skiatest::Reporter* reporter, const char* filename) {
4865 SkPath path, pathB;
4866 path.setFillType(SkPath::kWinding_FillType);
4867 path.moveTo(2, 6);
4868 path.cubicTo(1, 2, 7.16666698f, 6.66666698f, -4.66666651f, 7.66666651f);
4869 path.close();
4870 pathB.setFillType(SkPath::kWinding_FillType);
4871 pathB.moveTo(1, 2);
4872 pathB.cubicTo(7.16666698f, 6.66666698f, -4.66666651f, 7.66666651f, 2, 6);
4873 pathB.close();
4874 testPathOpCheck(reporter, path, pathB, kIntersect_SkPathOp, filename, FLAGS_ runFail);
4875 }
4876
4877 /*
4878 FAILED: d:\cygwin\puregit\tests\pathopsextendedtest.cpp:346 0 */
4879 static void loops44i(skiatest::Reporter* reporter, const char* filename) {
4880 SkPath path, pathB;
4881 path.setFillType(SkPath::kWinding_FillType);
4882 path.moveTo(1, 5);
4883 path.cubicTo(0, 1, 7.33333302f, 5.33333349f, -7, 7);
4884 path.close();
4885 pathB.setFillType(SkPath::kWinding_FillType);
4886 pathB.moveTo(0, 1);
4887 pathB.cubicTo(7.33333302f, 5.33333349f, -7, 7, 1, 5);
4888 pathB.close();
4889 testPathOpCheck(reporter, path, pathB, kIntersect_SkPathOp, filename, FLAGS_ runFail);
4890 }
4891
4892 /*
4893 FAILED: d:\cygwin\puregit\tests\pathopsextendedtest.cpp:346 0 */
4894 static void loops45i(skiatest::Reporter* reporter, const char* filename) {
4895 SkPath path, pathB;
4896 path.setFillType(SkPath::kWinding_FillType);
4897 path.moveTo(1, 6);
4898 path.cubicTo(0, 2, 7.33333302f, 6.33333302f, -7, 8);
4899 path.close();
4900 pathB.setFillType(SkPath::kWinding_FillType);
4901 pathB.moveTo(0, 2);
4902 pathB.cubicTo(7.33333302f, 6.33333302f, -7, 8, 1, 6);
4903 pathB.close();
4904 testPathOpCheck(reporter, path, pathB, kIntersect_SkPathOp, filename, FLAGS_ runFail);
4905 }
4906
4907 /*
4908 FAILED: d:\cygwin\puregit\tests\pathopsextendedtest.cpp:346 0 */
4909 static void loops46i(skiatest::Reporter* reporter, const char* filename) {
4910 SkPath path, pathB;
4911 path.setFillType(SkPath::kWinding_FillType);
4912 path.moveTo(2, 6);
4913 path.cubicTo(1, 2, 8.33333302f, 6.33333302f, -6, 8);
4914 path.close();
4915 pathB.setFillType(SkPath::kWinding_FillType);
4916 pathB.moveTo(1, 2);
4917 pathB.cubicTo(8.33333302f, 6.33333302f, -6, 8, 2, 6);
4918 pathB.close();
4919 testPathOpCheck(reporter, path, pathB, kIntersect_SkPathOp, filename, FLAGS_ runFail);
4920 }
4921
4922 /*
4923 FAILED: d:\cygwin\puregit\tests\pathopsextendedtest.cpp:346 0 */
4924 static void loops47i(skiatest::Reporter* reporter, const char* filename) {
4925 SkPath path, pathB;
4926 path.setFillType(SkPath::kWinding_FillType);
4927 path.moveTo(2, 4);
4928 path.cubicTo(0, 1, 6, 5.83333302f, -4, 8);
4929 path.close();
4930 pathB.setFillType(SkPath::kWinding_FillType);
4931 pathB.moveTo(0, 1);
4932 pathB.cubicTo(6, 5.83333302f, -4, 8, 2, 4);
4933 pathB.close();
4934 testPathOpCheck(reporter, path, pathB, kIntersect_SkPathOp, filename, FLAGS_ runFail);
4935 }
4936
4937 /*
4938 FAILED: d:\cygwin\puregit\tests\pathopsextendedtest.cpp:346 0 */
4939 static void loops48i(skiatest::Reporter* reporter, const char* filename) {
4940 SkPath path, pathB;
4941 path.setFillType(SkPath::kWinding_FillType);
4942 path.moveTo(2, 6);
4943 path.cubicTo(0, 1, 9.33333302f, 6.83333302f, -8.33333302f, 9.16666603f);
4944 path.close();
4945 pathB.setFillType(SkPath::kWinding_FillType);
4946 pathB.moveTo(0, 1);
4947 pathB.cubicTo(9.33333302f, 6.83333302f, -8.33333302f, 9.16666603f, 2, 6);
4948 pathB.close();
4949 testPathOpCheck(reporter, path, pathB, kIntersect_SkPathOp, filename, FLAGS_ runFail);
4950 }
4951
4952 /*
4953 FAILED: d:\cygwin\puregit\tests\pathopsextendedtest.cpp:346 0 */
4954 static void loops49i(skiatest::Reporter* reporter, const char* filename) {
4955 SkPath path, pathB;
4956 path.setFillType(SkPath::kWinding_FillType);
4957 path.moveTo(0, 2);
4958 path.cubicTo(1, 4, -0.166666687f, 2.66666675f, 1.66666675f, 2);
4959 path.close();
4960 pathB.setFillType(SkPath::kWinding_FillType);
4961 pathB.moveTo(1, 4);
4962 pathB.cubicTo(-0.166666687f, 2.66666675f, 1.66666675f, 2, 0, 2);
4963 pathB.close();
4964 testPathOpCheck(reporter, path, pathB, kIntersect_SkPathOp, filename, FLAGS_ runFail);
4965 }
4966
4967 /*
4968 FAILED: d:\cygwin\puregit\tests\pathopsextendedtest.cpp:346 0 */
4969 static void loops50i(skiatest::Reporter* reporter, const char* filename) {
4970 SkPath path, pathB;
4971 path.setFillType(SkPath::kWinding_FillType);
4972 path.moveTo(0, 3);
4973 path.cubicTo(1, 5, -0.166666687f, 3.66666675f, 1.66666675f, 3);
4974 path.close();
4975 pathB.setFillType(SkPath::kWinding_FillType);
4976 pathB.moveTo(1, 5);
4977 pathB.cubicTo(-0.166666687f, 3.66666675f, 1.66666675f, 3, 0, 3);
4978 pathB.close();
4979 testPathOpCheck(reporter, path, pathB, kIntersect_SkPathOp, filename, FLAGS_ runFail);
4980 }
4981
4982 /*
4983 FAILED: d:\cygwin\puregit\tests\pathopsextendedtest.cpp:346 0 */
4984 static void loops51i(skiatest::Reporter* reporter, const char* filename) {
4985 SkPath path, pathB;
4986 path.setFillType(SkPath::kWinding_FillType);
4987 path.moveTo(1, 2);
4988 path.cubicTo(2, 4, 0.833333313f, 2.66666675f, 2.66666675f, 2);
4989 path.close();
4990 pathB.setFillType(SkPath::kWinding_FillType);
4991 pathB.moveTo(2, 4);
4992 pathB.cubicTo(0.833333313f, 2.66666675f, 2.66666675f, 2, 1, 2);
4993 pathB.close();
4994 testPathOpCheck(reporter, path, pathB, kIntersect_SkPathOp, filename, FLAGS_ runFail);
4995 }
4996
4997 /*
4998 FAILED: d:\cygwin\puregit\tests\pathopsextendedtest.cpp:346 0 */
4999 static void loops52i(skiatest::Reporter* reporter, const char* filename) {
5000 SkPath path, pathB;
5001 path.setFillType(SkPath::kWinding_FillType);
5002 path.moveTo(1, 3);
5003 path.cubicTo(2, 5, 0.833333313f, 3.66666675f, 2.66666675f, 3);
5004 path.close();
5005 pathB.setFillType(SkPath::kWinding_FillType);
5006 pathB.moveTo(2, 5);
5007 pathB.cubicTo(0.833333313f, 3.66666675f, 2.66666675f, 3, 1, 3);
5008 pathB.close();
5009 testPathOpCheck(reporter, path, pathB, kIntersect_SkPathOp, filename, FLAGS_ runFail);
5010 }
5011
5012 /*
5013 FAILED: d:\cygwin\puregit\tests\pathopsextendedtest.cpp:346 0 */
5014 static void loops53i(skiatest::Reporter* reporter, const char* filename) {
5015 SkPath path, pathB;
5016 path.setFillType(SkPath::kWinding_FillType);
5017 path.moveTo(2, 3);
5018 path.cubicTo(3, 5, 1.83333325f, 3.66666675f, 3.66666651f, 3);
5019 path.close();
5020 pathB.setFillType(SkPath::kWinding_FillType);
5021 pathB.moveTo(3, 5);
5022 pathB.cubicTo(1.83333325f, 3.66666675f, 3.66666651f, 3, 2, 3);
5023 pathB.close();
5024 testPathOpCheck(reporter, path, pathB, kIntersect_SkPathOp, filename, FLAGS_ runFail);
5025 }
5026
5027 /*
5028 FAILED: d:\cygwin\puregit\tests\pathopsextendedtest.cpp:346 0 */
5029 static void loops54i(skiatest::Reporter* reporter, const char* filename) {
5030 SkPath path, pathB;
5031 path.setFillType(SkPath::kWinding_FillType);
5032 path.moveTo(0, 2);
5033 path.cubicTo(1, 4, 0, 3, 1.66666675f, 2);
5034 path.close();
5035 pathB.setFillType(SkPath::kWinding_FillType);
5036 pathB.moveTo(1, 4);
5037 pathB.cubicTo(0, 3, 1.66666675f, 2, 0, 2);
5038 pathB.close();
5039 testPathOpCheck(reporter, path, pathB, kIntersect_SkPathOp, filename, FLAGS_ runFail);
5040 }
5041
5042 /*
5043 FAILED: d:\cygwin\puregit\tests\pathopsextendedtest.cpp:346 0 */
5044 static void loops55i(skiatest::Reporter* reporter, const char* filename) {
5045 SkPath path, pathB;
5046 path.setFillType(SkPath::kWinding_FillType);
5047 path.moveTo(0, 3);
5048 path.cubicTo(1, 5, 0, 4, 1.66666675f, 3);
5049 path.close();
5050 pathB.setFillType(SkPath::kWinding_FillType);
5051 pathB.moveTo(1, 5);
5052 pathB.cubicTo(0, 4, 1.66666675f, 3, 0, 3);
5053 pathB.close();
5054 testPathOpCheck(reporter, path, pathB, kIntersect_SkPathOp, filename, FLAGS_ runFail);
5055 }
5056
5057 /*
5058 FAILED: d:\cygwin\puregit\tests\pathopsextendedtest.cpp:346 0 */
5059 static void loops56i(skiatest::Reporter* reporter, const char* filename) {
5060 SkPath path, pathB;
5061 path.setFillType(SkPath::kWinding_FillType);
5062 path.moveTo(1, 2);
5063 path.cubicTo(2, 4, 0.99999994f, 3, 2.66666675f, 2);
5064 path.close();
5065 pathB.setFillType(SkPath::kWinding_FillType);
5066 pathB.moveTo(2, 4);
5067 pathB.cubicTo(0.99999994f, 3, 2.66666675f, 2, 1, 2);
5068 pathB.close();
5069 testPathOpCheck(reporter, path, pathB, kIntersect_SkPathOp, filename, FLAGS_ runFail);
5070 }
5071
5072 /*
5073 FAILED: d:\cygwin\puregit\tests\pathopsextendedtest.cpp:346 0 */
5074 static void loops57i(skiatest::Reporter* reporter, const char* filename) {
5075 SkPath path, pathB;
5076 path.setFillType(SkPath::kWinding_FillType);
5077 path.moveTo(1, 3);
5078 path.cubicTo(2, 5, 0.99999994f, 4, 2.66666675f, 3);
5079 path.close();
5080 pathB.setFillType(SkPath::kWinding_FillType);
5081 pathB.moveTo(2, 5);
5082 pathB.cubicTo(0.99999994f, 4, 2.66666675f, 3, 1, 3);
5083 pathB.close();
5084 testPathOpCheck(reporter, path, pathB, kIntersect_SkPathOp, filename, FLAGS_ runFail);
5085 }
5086
5087 /*
5088 FAILED: d:\cygwin\puregit\tests\pathopsextendedtest.cpp:346 0 */
5089 static void loops58i(skiatest::Reporter* reporter, const char* filename) {
5090 SkPath path, pathB;
5091 path.setFillType(SkPath::kWinding_FillType);
5092 path.moveTo(2, 3);
5093 path.cubicTo(3, 5, 2, 4, 3.66666651f, 3);
5094 path.close();
5095 pathB.setFillType(SkPath::kWinding_FillType);
5096 pathB.moveTo(3, 5);
5097 pathB.cubicTo(2, 4, 3.66666651f, 3, 2, 3);
5098 pathB.close();
5099 testPathOpCheck(reporter, path, pathB, kIntersect_SkPathOp, filename, FLAGS_ runFail);
5100 }
5101
5102 /*
5103 FAILED: d:\cygwin\puregit\tests\pathopsextendedtest.cpp:346 0 */
5104 static void loops59i(skiatest::Reporter* reporter, const char* filename) {
5105 SkPath path, pathB;
5106 path.setFillType(SkPath::kWinding_FillType);
5107 path.moveTo(0, 6);
5108 path.cubicTo(1, 2, 7.33333302f, 1.66666663f, -7.5f, 2);
5109 path.close();
5110 pathB.setFillType(SkPath::kWinding_FillType);
5111 pathB.moveTo(1, 2);
5112 pathB.cubicTo(7.33333302f, 1.66666663f, -7.5f, 2, 0, 6);
5113 pathB.close();
5114 testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
5115 }
5116
5117 class PathTest_Private {
5118 public:
5119 PathTest_Private(SkPath* path)
5120 : fPath(path) {}
5121
5122 void setPt(int index, SkScalar x, SkScalar y) {
5123 fPath->setPt(index, x, y);
5124 }
5125
5126 SkPath* fPath;
5127 };
5128
5129 static void path_edit(const SkPoint& from, const SkPoint& to, SkPath* path) {
5130 PathTest_Private testPath(path);
5131 for (int index = 0; index < path->countPoints(); ++index) {
5132 if (SkDPoint::ApproximatelyEqual(path->getPoint(index), from)) {
5133 testPath.setPt(index, to.fX, to.fY);
5134 return;
5135 }
5136 }
5137 }
5138
5139 static void loops59iasQuads(skiatest::Reporter* reporter, const char* filename) {
5140 SkPath path, pathB;
5141 path.setFillType(SkPath::kWinding_FillType);
5142 path.moveTo(0, 6);
5143 path.cubicTo(1, 2, 7.33333302f, 1.66666663f, -7.5f, 2);
5144 path.close();
5145 pathB.setFillType(SkPath::kWinding_FillType);
5146 pathB.moveTo(1, 2);
5147 pathB.cubicTo(7.33333302f, 1.66666663f, -7.5f, 2, 0, 6);
5148 pathB.close();
5149 SkPath qPath, qPathB;
5150 CubicPathToQuads(path, &qPath);
5151 CubicPathToQuads(pathB, &qPathB);
5152 SkPoint from = {2.61714339f,1.90228665f};
5153 SkPoint to = {2.617045833359139f,1.9013528935803314f};
5154 path_edit(from, to, &qPathB);
5155 testPathOp(reporter, qPath, qPathB, kIntersect_SkPathOp, filename);
5156 }
5157
5158 static void cubics41d(skiatest::Reporter* reporter, const char* filename) {
5159 SkPath path, pathB;
5160 path.setFillType(SkPath::kWinding_FillType);
5161 path.moveTo(0, 1);
5162 path.cubicTo(1, 4, 3, 0, 3, 1);
5163 path.close();
5164 pathB.setFillType(SkPath::kWinding_FillType);
5165 pathB.moveTo(0, 3);
5166 pathB.cubicTo(1, 3, 1, 0, 4, 1);
5167 pathB.close();
5168 testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
5169 }
5170
4481 static void (*skipTest)(skiatest::Reporter* , const char* filename) = 0; 5171 static void (*skipTest)(skiatest::Reporter* , const char* filename) = 0;
4482 static void (*firstTest)(skiatest::Reporter* , const char* filename) = cubicOp90 u; 5172 static void (*firstTest)(skiatest::Reporter* , const char* filename) = loops59i;
4483 static void (*stopTest)(skiatest::Reporter* , const char* filename) = 0; 5173 static void (*stopTest)(skiatest::Reporter* , const char* filename) = 0;
4484 5174
4485 static struct TestDesc tests[] = { 5175 static struct TestDesc tests[] = {
5176 TEST(cubics41d),
5177 TEST(loops59iasQuads),
5178 TEST(loops59i),
5179 TEST(loops41i),
5180 TEST(loops42i),
5181 TEST(loops43i),
5182 TEST(loops44i),
5183 TEST(loops45i),
5184 TEST(loops46i),
5185 TEST(loops47i),
5186 TEST(loops48i),
5187 TEST(loops49i),
5188 TEST(loops50i),
5189 TEST(loops51i),
5190 TEST(loops52i),
5191 TEST(loops53i),
5192 TEST(loops54i),
5193 TEST(loops55i),
5194 TEST(loops56i),
5195 TEST(loops57i),
5196 TEST(loops58i),
5197 TEST(loops33iMod),
5198 TEST(loops33iAsQuads),
5199 TEST(loops33i),
5200 TEST(loops40i),
5201 TEST(loops40iAsQuads),
5202 TEST(loops39i),
5203 TEST(loops38i),
5204 TEST(loops37i),
5205 TEST(loops36i),
5206 TEST(loops35i),
5207 TEST(loops34i),
5208 TEST(loops32i),
5209 TEST(loops31i),
5210 TEST(loops30i),
5211 TEST(loops29i),
5212 TEST(loops28i),
5213 TEST(loops27i),
5214 TEST(loops26i),
5215 TEST(loops25i),
5216 TEST(loops24i),
5217 TEST(loops23i),
5218 TEST(loops22i),
5219 TEST(loops21i),
5220 TEST(loops20i),
5221 TEST(cubics20d),
4486 TEST(cubics6d), 5222 TEST(cubics6d),
4487 TEST(cubics7d), 5223 TEST(cubics7d),
4488 TEST(cubics8d), 5224 TEST(cubics8d),
4489 TEST(cubics9d), 5225 TEST(cubics9d),
4490 TEST(cubics10u), 5226 TEST(cubics10u),
4491 TEST(cubics11i), 5227 TEST(cubics11i),
4492 TEST(cubics12d), 5228 TEST(cubics12d),
4493 TEST(cubics13d), 5229 TEST(cubics13d),
4494 TEST(cubics14d), 5230 TEST(cubics14d),
4495 TEST(cubics15d), 5231 TEST(cubics15d),
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
4766 TEST(cubicOp6d), 5502 TEST(cubicOp6d),
4767 TEST(cubicOp5d), 5503 TEST(cubicOp5d),
4768 TEST(cubicOp3d), 5504 TEST(cubicOp3d),
4769 TEST(cubicOp2d), 5505 TEST(cubicOp2d),
4770 TEST(cubicOp1d), 5506 TEST(cubicOp1d),
4771 }; 5507 };
4772 5508
4773 static const size_t testCount = SK_ARRAY_COUNT(tests); 5509 static const size_t testCount = SK_ARRAY_COUNT(tests);
4774 5510
4775 static struct TestDesc subTests[] = { 5511 static struct TestDesc subTests[] = {
4776 TEST(loop16), 5512 TEST(loops40i),
4777 TEST(loop15), 5513 TEST(loops39i),
4778 TEST(loop12), 5514 TEST(loops38i),
4779 TEST(cubicOp132), 5515 TEST(loops37i),
4780 TEST(loop11), 5516 TEST(loops36i),
4781 TEST(loop10), 5517 TEST(loops35i),
4782 TEST(circlesOp3), 5518 TEST(loops34i),
4783 TEST(loop9), 5519 TEST(loops33i),
4784 TEST(loop8), 5520 TEST(loops32i),
4785 TEST(rects5), 5521 TEST(loops31i),
4786 TEST(loop7), 5522 TEST(loops30i),
4787 TEST(cubicOp130a), 5523 TEST(loops29i),
4788 TEST(rRect1x), 5524 TEST(loops28i),
4789 TEST(circlesOp2), 5525 TEST(loops27i),
4790 TEST(circlesOp1), 5526 TEST(loops26i),
4791 TEST(cubicOp131), 5527 TEST(loops25i),
4792 TEST(cubicOp130), 5528 TEST(loops24i),
4793 TEST(cubicOp129), 5529 TEST(loops23i),
4794 TEST(cubicOp128), 5530 TEST(loops22i),
4795 TEST(cubicOp127), 5531 TEST(loops21i),
4796 TEST(cubicOp126), 5532 TEST(loops20i),
4797 TEST(cubicOp125), 5533 TEST(cubics20d),
4798 TEST(cubicOp124), 5534 TEST(cubics6d),
4799 TEST(loop6), 5535 TEST(cubics7d),
4800 TEST(loop5), 5536 TEST(cubics8d),
4801 TEST(cubicOp123), 5537 TEST(cubics9d),
4802 TEST(cubicOp122), 5538 TEST(cubics10u),
4803 TEST(cubicOp121), 5539 TEST(cubics11i),
4804 TEST(cubicOp120), 5540 TEST(cubics12d),
4805 TEST(cubicOp119), 5541 TEST(cubics13d),
4806 TEST(loop4), 5542 TEST(cubics14d),
4807 TEST(loop3), 5543 TEST(cubics15d),
4808 TEST(loop2), 5544 TEST(cubics16i),
4809 TEST(loop1asQuad), 5545 TEST(cubics17d),
4810 TEST(loop1), 5546 TEST(cubics18d),
4811 TEST(issue3517), 5547 TEST(cubics19d),
4812 TEST(cubicOp118), 5548 TEST(cubicOp157),
4813 TEST(cubicOp117), 5549 TEST(cubicOp142),
4814 TEST(cubicOp116), 5550 TEST(loops4i),
4815 TEST(testRect2), 5551 TEST(quadRect1),
4816 TEST(testRect1), 5552 TEST(quadRect2),
4817 TEST(cubicOp115), 5553 TEST(quadRect3),
4818 TEST(issue2753), 5554 TEST(quadRect4),
4819 TEST(cubicOp114), 5555 TEST(quadRect5),
4820 TEST(issue2808), 5556 TEST(quadRect6),
4821 TEST(cubicOp114asQuad),
4822 TEST(rects4),
4823 TEST(rects3),
4824 TEST(rects2),
4825 TEST(rects1),
4826 TEST(issue2540),
4827 TEST(issue2504),
4828 TEST(kari1),
4829 TEST(quadOp10i),
4830 TEST(cubicOp113),
4831 TEST(skpcarrot_is24),
4832 TEST(issue1417),
4833 TEST(cubicOp112),
4834 TEST(skpadspert_net23),
4835 TEST(skpadspert_de11),
4836 TEST(findFirst1),
4837 TEST(xOp2i),
4838 TEST(xOp3i),
4839 TEST(xOp1u),
4840 TEST(xOp1i),
4841 TEST(cubicOp111),
4842 TEST(cubicOp110),
4843 TEST(cubicOp109),
4844 TEST(cubicOp108),
4845 TEST(cubicOp107),
4846 TEST(cubicOp106),
4847 TEST(cubicOp105),
4848 TEST(cubicOp104),
4849 TEST(cubicOp103),
4850 TEST(cubicOp102),
4851 TEST(cubicOp101),
4852 TEST(cubicOp100),
4853 TEST(cubicOp99),
4854 }; 5557 };
4855 5558
4856 static const size_t subTestCount = SK_ARRAY_COUNT(subTests); 5559 static const size_t subTestCount = SK_ARRAY_COUNT(subTests);
4857 5560
4858 static void (*firstSubTest)(skiatest::Reporter* , const char* filename) = 0; 5561 static void (*firstSubTest)(skiatest::Reporter* , const char* filename) = 0;
4859 5562
4860 static bool runSubTests = false; 5563 static bool runSubTests = false;
4861 static bool runSubTestsFirst = true; 5564 static bool runSubTestsFirst = true;
4862 static bool runReverse = false; 5565 static bool runReverse = false;
4863 5566
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
5076 }; 5779 };
5077 5780
5078 static const size_t failTestCount = SK_ARRAY_COUNT(failTests); 5781 static const size_t failTestCount = SK_ARRAY_COUNT(failTests);
5079 5782
5080 DEF_TEST(PathOpsFailOp, reporter) { 5783 DEF_TEST(PathOpsFailOp, reporter) {
5081 #if DEBUG_SHOW_TEST_NAME 5784 #if DEBUG_SHOW_TEST_NAME
5082 strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH); 5785 strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH);
5083 #endif 5786 #endif
5084 RunTestSet(reporter, failTests, failTestCount, NULL, NULL, NULL, false); 5787 RunTestSet(reporter, failTests, failTestCount, NULL, NULL, NULL, false);
5085 } 5788 }
OLDNEW
« no previous file with comments | « tests/PathOpsIssue3651.cpp ('k') | tests/PathOpsTestCommon.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698