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

Side by Side Diff: tests/PathOpsSimplifyTest.cpp

Issue 14407006: path ops -- handle non-finite numbers (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
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 8
9 #define TEST(name) { name, #name } 9 #define TEST(name) { name, #name }
10 10
(...skipping 3634 matching lines...) Expand 10 before | Expand all | Expand 10 after
3645 path.lineTo(1, 0); 3645 path.lineTo(1, 0);
3646 path.lineTo(3, 3); 3646 path.lineTo(3, 3);
3647 path.close(); 3647 path.close();
3648 path.moveTo(1, 1); 3648 path.moveTo(1, 1);
3649 path.lineTo(2, 3); 3649 path.lineTo(2, 3);
3650 path.lineTo(1, 2); 3650 path.lineTo(1, 2);
3651 path.close(); 3651 path.close();
3652 testSimplify(reporter, path); 3652 testSimplify(reporter, path);
3653 } 3653 }
3654 3654
3655 // A test this for this case:
3656 // contourA has two segments that are coincident
3657 // contourB has two segments that are coincident in the same place
3658 // each ends up with +2/0 pairs for winding count
3659 // since logic in OpSegment::addTCoincident doesn't transfer count (only increme nts/decrements)
3660 // can this be resolved to +4/0 ?
3661 static void testAddTCoincident1(skiatest::Reporter* reporter) {
3662 SkPath path;
3663 path.moveTo(2, 0);
3664 path.lineTo(2, 2);
3665 path.lineTo(1, 1);
3666 path.lineTo(2, 0);
3667 path.lineTo(2, 2);
3668 path.lineTo(1, 1);
3669 path.close();
3670 path.moveTo(2, 0);
3671 path.lineTo(2, 2);
3672 path.lineTo(3, 1);
3673 path.lineTo(2, 0);
3674 path.lineTo(2, 2);
3675 path.lineTo(3, 1);
3676 path.close();
3677 testSimplify(reporter, path);
3678 }
3679
3680 // test with implicit close
3681 static void testAddTCoincident2(skiatest::Reporter* reporter) {
3682 SkPath path;
3683 path.moveTo(2, 0);
3684 path.lineTo(2, 2);
3685 path.lineTo(1, 1);
3686 path.lineTo(2, 0);
3687 path.lineTo(2, 2);
3688 path.lineTo(1, 1);
3689 path.moveTo(2, 0);
3690 path.lineTo(2, 2);
3691 path.lineTo(3, 1);
3692 path.lineTo(2, 0);
3693 path.lineTo(2, 2);
3694 path.lineTo(3, 1);
3695 testSimplify(reporter, path);
3696 }
3697
3655 static void (*firstTest)(skiatest::Reporter* ) = 0; 3698 static void (*firstTest)(skiatest::Reporter* ) = 0;
3656 3699
3657 static TestDesc tests[] = { 3700 static TestDesc tests[] = {
3701 TEST(testAddTCoincident2),
3702 TEST(testAddTCoincident1),
3658 TEST(testTriangles2), 3703 TEST(testTriangles2),
3659 TEST(testTriangles1), 3704 TEST(testTriangles1),
3660 TEST(testQuadratic97), 3705 TEST(testQuadratic97),
3661 TEST(testQuadratic96), 3706 TEST(testQuadratic96),
3662 TEST(testQuadratic95), 3707 TEST(testQuadratic95),
3663 TEST(testQuadratic94), 3708 TEST(testQuadratic94),
3664 TEST(testQuadralateral2), 3709 TEST(testQuadralateral2),
3665 TEST(testQuad1), // FIXME: fails, need to investigate 3710 TEST(testQuad1), // FIXME: fails, need to investigate
3666 TEST(testCubic2), 3711 TEST(testCubic2),
3667 TEST(testCubic1), 3712 TEST(testCubic1),
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
4022 RunTestSet(reporter, subTests, subTestCount, firstSubTest, stopTest, run Reverse); 4067 RunTestSet(reporter, subTests, subTestCount, firstSubTest, stopTest, run Reverse);
4023 } 4068 }
4024 #ifdef SK_DEBUG 4069 #ifdef SK_DEBUG
4025 gDebugMaxWindSum = SK_MaxS32; 4070 gDebugMaxWindSum = SK_MaxS32;
4026 gDebugMaxWindValue = SK_MaxS32; 4071 gDebugMaxWindValue = SK_MaxS32;
4027 #endif 4072 #endif
4028 } 4073 }
4029 4074
4030 #include "TestClassDef.h" 4075 #include "TestClassDef.h"
4031 DEFINE_TESTCLASS_SHORT(PathOpsSimplifyTest) 4076 DEFINE_TESTCLASS_SHORT(PathOpsSimplifyTest)
OLDNEW
« src/pathops/SkOpEdgeBuilder.cpp ('K') | « tests/PathOpsSimplifyFailTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698