| OLD | NEW |
| 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 2795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2806 path.lineTo(330.463562f, 217.659027f); | 2806 path.lineTo(330.463562f, 217.659027f); |
| 2807 path.lineTo(303.12088f, 141.299606f); | 2807 path.lineTo(303.12088f, 141.299606f); |
| 2808 path.close(); | 2808 path.close(); |
| 2809 path.moveTo(371.919067f, 205.854996f); | 2809 path.moveTo(371.919067f, 205.854996f); |
| 2810 path.lineTo(326.236786f, 205.854996f); | 2810 path.lineTo(326.236786f, 205.854996f); |
| 2811 path.quadTo(329.104431f, 231.663818f, 351.512085f, 231.663818f); | 2811 path.quadTo(329.104431f, 231.663818f, 351.512085f, 231.663818f); |
| 2812 path.lineTo(371.919067f, 205.854996f); | 2812 path.lineTo(371.919067f, 205.854996f); |
| 2813 path.close(); | 2813 path.close(); |
| 2814 testSimplify(reporter, path); | 2814 testSimplify(reporter, path); |
| 2815 } | 2815 } |
| 2816 |
| 2816 static void testQuadratic55(skiatest::Reporter* reporter) { | 2817 static void testQuadratic55(skiatest::Reporter* reporter) { |
| 2817 SkPath path; | 2818 SkPath path; |
| 2818 path.moveTo(303.12088f, 141.299606f); | 2819 path.moveTo(303.12088f, 141.299606f); |
| 2819 path.lineTo(330.463562f, 217.659027f); | 2820 path.lineTo(330.463562f, 217.659027f); |
| 2820 path.lineTo(358.606506f, 141.299606f); | 2821 path.lineTo(358.606506f, 141.299606f); |
| 2821 path.lineTo(303.12088f, 141.299606f); | 2822 path.lineTo(303.12088f, 141.299606f); |
| 2822 path.close(); | 2823 path.close(); |
| 2823 path.moveTo(326.236786f, 205.854996f); | 2824 path.moveTo(326.236786f, 205.854996f); |
| 2824 path.quadTo(329.104431f, 231.663818f, 351.512085f, 231.663818f); | 2825 path.quadTo(329.104431f, 231.663818f, 351.512085f, 231.663818f); |
| 2825 path.lineTo(326.236786f, 205.854996f); | 2826 path.lineTo(326.236786f, 205.854996f); |
| (...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3821 path.cubicTo(705.000000f, 13.4101496f, 706.455078f, 10.1601505f, 708.807617f
, 7.80761385f); | 3822 path.cubicTo(705.000000f, 13.4101496f, 706.455078f, 10.1601505f, 708.807617f
, 7.80761385f); |
| 3822 path.lineTo(708.099182f, 7.09919119f); | 3823 path.lineTo(708.099182f, 7.09919119f); |
| 3823 path.close(); | 3824 path.close(); |
| 3824 path.moveTo(704.000000f, 3.00000000f); | 3825 path.moveTo(704.000000f, 3.00000000f); |
| 3825 path.lineTo(704.000000f, 33.0000000f); | 3826 path.lineTo(704.000000f, 33.0000000f); |
| 3826 path.lineTo(705.000000f, 33.0000000f); | 3827 path.lineTo(705.000000f, 33.0000000f); |
| 3827 path.lineTo(719.500000f, 3.00000000f); | 3828 path.lineTo(719.500000f, 3.00000000f); |
| 3828 testSimplify(reporter, path); | 3829 testSimplify(reporter, path); |
| 3829 } | 3830 } |
| 3830 | 3831 |
| 3831 static void (*firstTest)(skiatest::Reporter* ) = testQuad6; | 3832 static void tooCloseTest(skiatest::Reporter* reporter) { |
| 3833 SkPath path; |
| 3834 path.moveTo(0, 0); |
| 3835 path.lineTo(1, 1); |
| 3836 path.lineTo(1,-1); |
| 3837 path.close(); |
| 3838 path.moveTo(0, 0); |
| 3839 path.lineTo(1,-2); |
| 3840 path.lineTo(1, 2); |
| 3841 path.lineTo(2, 0); |
| 3842 path.close(); |
| 3843 testSimplify(reporter, path); |
| 3844 } |
| 3845 |
| 3846 static void testRect1(skiatest::Reporter* reporter) { |
| 3847 SkPath path; |
| 3848 path.addRect(0, 0, 60, 60, SkPath::kCCW_Direction); |
| 3849 path.addRect(30, 20, 50, 50, SkPath::kCCW_Direction); |
| 3850 path.addRect(24, 20, 36, 30, SkPath::kCCW_Direction); |
| 3851 path.addRect(32, 24, 36, 41, SkPath::kCCW_Direction); |
| 3852 testSimplify(reporter, path); |
| 3853 } |
| 3854 |
| 3855 static void testRect2(skiatest::Reporter* reporter) { |
| 3856 SkPath path; |
| 3857 path.setFillType(SkPath::kWinding_FillType); |
| 3858 path.moveTo(0, 0); |
| 3859 path.lineTo(60, 0); |
| 3860 path.lineTo(60, 60); |
| 3861 path.lineTo(0, 60); |
| 3862 path.close(); |
| 3863 path.moveTo(30, 20); |
| 3864 path.lineTo(30, 50); |
| 3865 path.lineTo(50, 50); |
| 3866 path.lineTo(50, 20); |
| 3867 path.close(); |
| 3868 path.moveTo(24, 20); |
| 3869 path.lineTo(24, 30); |
| 3870 path.lineTo(36, 30); |
| 3871 path.lineTo(36, 20); |
| 3872 path.close(); |
| 3873 path.moveTo(32, 24); |
| 3874 path.lineTo(32, 41); |
| 3875 path.lineTo(36, 41); |
| 3876 path.lineTo(36, 24); |
| 3877 path.close(); |
| 3878 testSimplify(reporter, path); |
| 3879 } |
| 3880 |
| 3881 static void testTriangles3x(skiatest::Reporter* reporter) { |
| 3882 SkPath path; |
| 3883 path.setFillType(SkPath::kEvenOdd_FillType); |
| 3884 path.moveTo(1, 0); |
| 3885 path.quadTo(0, 1, 3, 2); |
| 3886 path.lineTo(1, 3); |
| 3887 path.close(); |
| 3888 path.moveTo(0, 0); |
| 3889 path.lineTo(1, 1); |
| 3890 path.quadTo(2, 1, 0, 2); |
| 3891 path.close(); |
| 3892 testSimplify(reporter, path); |
| 3893 } |
| 3894 |
| 3895 static void testQuad8(skiatest::Reporter* reporter) { |
| 3896 SkPath path; |
| 3897 path.moveTo(3, 0); |
| 3898 path.quadTo(0, 1, 3, 2); |
| 3899 path.lineTo(0, 3); |
| 3900 path.close(); |
| 3901 path.moveTo(1, 0); |
| 3902 path.lineTo(3, 0); |
| 3903 path.quadTo(1, 1, 2, 2); |
| 3904 path.close(); |
| 3905 testSimplify(reporter, path); |
| 3906 } |
| 3907 |
| 3908 static void (*firstTest)(skiatest::Reporter* ) = testRect2; |
| 3832 | 3909 |
| 3833 static TestDesc tests[] = { | 3910 static TestDesc tests[] = { |
| 3911 TEST(testQuad8), |
| 3912 TEST(testTriangles3x), |
| 3913 TEST(testRect2), |
| 3914 TEST(testRect1), |
| 3915 TEST(tooCloseTest), |
| 3834 TEST(skphealth_com76), | 3916 TEST(skphealth_com76), |
| 3835 TEST(testQuadLineIntersect1), | 3917 TEST(testQuadLineIntersect1), |
| 3836 TEST(testQuadLineIntersect2), | 3918 TEST(testQuadLineIntersect2), |
| 3837 TEST(testQuadLineIntersect3), | 3919 TEST(testQuadLineIntersect3), |
| 3838 TEST(testQuad7), | 3920 TEST(testQuad7), |
| 3839 TEST(testQuad6), | 3921 TEST(testQuad6), |
| 3840 TEST(testQuad5), | 3922 TEST(testQuad5), |
| 3841 TEST(testQuad4), | 3923 TEST(testQuad4), |
| 3842 TEST(testQuad3), | 3924 TEST(testQuad3), |
| 3843 TEST(testQuad2), | 3925 TEST(testQuad2), |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4192 static const size_t subTestCount = SK_ARRAY_COUNT(subTests); | 4274 static const size_t subTestCount = SK_ARRAY_COUNT(subTests); |
| 4193 | 4275 |
| 4194 static void (*firstSubTest)(skiatest::Reporter* ) = 0; | 4276 static void (*firstSubTest)(skiatest::Reporter* ) = 0; |
| 4195 | 4277 |
| 4196 static bool runSubTestsFirst = false; | 4278 static bool runSubTestsFirst = false; |
| 4197 static bool runReverse = false; | 4279 static bool runReverse = false; |
| 4198 static void (*stopTest)(skiatest::Reporter* ) = 0; | 4280 static void (*stopTest)(skiatest::Reporter* ) = 0; |
| 4199 | 4281 |
| 4200 static void PathOpsSimplifyTest(skiatest::Reporter* reporter) { | 4282 static void PathOpsSimplifyTest(skiatest::Reporter* reporter) { |
| 4201 #ifdef SK_DEBUG | 4283 #ifdef SK_DEBUG |
| 4202 gDebugMaxWindSum = 4; | 4284 SkPathOpsDebug::gMaxWindSum = 4; |
| 4203 gDebugMaxWindValue = 4; | 4285 SkPathOpsDebug::gMaxWindValue = 4; |
| 4204 #endif | 4286 #endif |
| 4205 if (runSubTestsFirst) { | 4287 if (runSubTestsFirst) { |
| 4206 RunTestSet(reporter, subTests, subTestCount, firstSubTest, stopTest, run
Reverse); | 4288 RunTestSet(reporter, subTests, subTestCount, firstSubTest, stopTest, run
Reverse); |
| 4207 } | 4289 } |
| 4208 RunTestSet(reporter, tests, testCount, firstTest, stopTest, runReverse); | 4290 RunTestSet(reporter, tests, testCount, firstTest, stopTest, runReverse); |
| 4209 if (!runSubTestsFirst) { | 4291 if (!runSubTestsFirst) { |
| 4210 RunTestSet(reporter, subTests, subTestCount, firstSubTest, stopTest, run
Reverse); | 4292 RunTestSet(reporter, subTests, subTestCount, firstSubTest, stopTest, run
Reverse); |
| 4211 } | 4293 } |
| 4212 #ifdef SK_DEBUG | 4294 #ifdef SK_DEBUG |
| 4213 gDebugMaxWindSum = SK_MaxS32; | 4295 SkPathOpsDebug::gMaxWindSum = SK_MaxS32; |
| 4214 gDebugMaxWindValue = SK_MaxS32; | 4296 SkPathOpsDebug::gMaxWindValue = SK_MaxS32; |
| 4215 #endif | 4297 #endif |
| 4216 } | 4298 } |
| 4217 | 4299 |
| 4218 #include "TestClassDef.h" | 4300 #include "TestClassDef.h" |
| 4219 DEFINE_TESTCLASS_SHORT(PathOpsSimplifyTest) | 4301 DEFINE_TESTCLASS_SHORT(PathOpsSimplifyTest) |
| OLD | NEW |