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

Side by Side Diff: tests/PathOpsOpTest.cpp

Issue 252243003: fix cubic/line intersection; add skp tests (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: bracket new test correctly Created 6 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/PathOpsExtendedTest.cpp ('k') | tests/PathOpsSkpTest.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 8
9 #define TEST(name) { name, #name } 9 #define TEST(name) { name, #name }
10 10
(...skipping 3292 matching lines...) Expand 10 before | Expand all | Expand 10 after
3303 path.moveTo(0, 0); 3303 path.moveTo(0, 0);
3304 path.quadTo(1, 8, 3, 5); 3304 path.quadTo(1, 8, 3, 5);
3305 path.lineTo(8, 1); 3305 path.lineTo(8, 1);
3306 path.close(); 3306 path.close();
3307 pathB.moveTo(0, 0); 3307 pathB.moveTo(0, 0);
3308 pathB.quadTo(8, 1, 4, 8); 3308 pathB.quadTo(8, 1, 4, 8);
3309 pathB.close(); 3309 pathB.close();
3310 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename); 3310 testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
3311 } 3311 }
3312 3312
3313 static void kari1(skiatest::Reporter* reporter, const char* filename) {
3314 SkPath path1;
3315 path1.moveTo(39.9375, -5.8359375);
3316 path1.lineTo(40.625, -5.7890625);
3317 path1.lineTo(37.7109375, 1.3515625);
3318 path1.lineTo(37.203125, 0.9609375);
3319 path1.close();
3320
3321 SkPath path2;
3322 path2.moveTo(37.52734375f, -1.44140625f);
3323 path2.cubicTo(37.8736991882324f, -1.69921875f, 38.1640625f, -2.140625f, 38.3 984375f, -2.765625f);
3324 path2.lineTo(38.640625f, -2.609375f);
3325 path2.cubicTo(38.53125f, -1.89583337306976f, 38.0664443969727f, -0.154893040 657043f, 38.0664443969727f, -0.154893040657043f);
3326 path2.cubicTo(38.0664443969727f, -0.154893040657043f, 37.1809883117676f, -1. 18359375f, 37.52734375, -1.44140625f);
3327 path2.close();
3328
3329 testPathOp(reporter, path1, path2, kDifference_PathOp, filename);
3330 }
3331
3313 static void (*firstTest)(skiatest::Reporter* , const char* filename) = 0; 3332 static void (*firstTest)(skiatest::Reporter* , const char* filename) = 0;
3314 static void (*stopTest)(skiatest::Reporter* , const char* filename) = 0; 3333 static void (*stopTest)(skiatest::Reporter* , const char* filename) = 0;
3315 3334
3316 static struct TestDesc tests[] = { 3335 static struct TestDesc tests[] = {
3336 TEST(kari1),
3317 TEST(quadOp10i), 3337 TEST(quadOp10i),
3318 #if 0 // FIXME: serpentine curve is ordered the wrong way 3338 #if 0 // FIXME: serpentine curve is ordered the wrong way
3319 TEST(cubicOp114), 3339 TEST(cubicOp114),
3320 #endif 3340 #endif
3321 #if 0 // FIXME: currently failing 3341 #if 0 // FIXME: currently failing
3322 TEST(cubicOp113), 3342 TEST(cubicOp113),
3323 #endif 3343 #endif
3324 #if SKPS_WORKING 3344 #if SKPS_WORKING
3325 // fails because a cubic/quadratic intersection is missed 3345 // fails because a cubic/quadratic intersection is missed
3326 // the internal quad/quad is far enough away from the real cubic/quad that i t is rejected 3346 // the internal quad/quad is far enough away from the real cubic/quad that i t is rejected
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
3567 }; 3587 };
3568 3588
3569 static const size_t failTestCount = SK_ARRAY_COUNT(failTests); 3589 static const size_t failTestCount = SK_ARRAY_COUNT(failTests);
3570 3590
3571 DEF_TEST(PathOpsFailOp, reporter) { 3591 DEF_TEST(PathOpsFailOp, reporter) {
3572 #if DEBUG_SHOW_TEST_NAME 3592 #if DEBUG_SHOW_TEST_NAME
3573 strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH); 3593 strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH);
3574 #endif 3594 #endif
3575 RunTestSet(reporter, failTests, failTestCount, 0, 0, false); 3595 RunTestSet(reporter, failTests, failTestCount, 0, 0, false);
3576 } 3596 }
OLDNEW
« no previous file with comments | « tests/PathOpsExtendedTest.cpp ('k') | tests/PathOpsSkpTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698