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

Side by Side Diff: tests/PathOpsQuadIntersectionTest.cpp

Issue 117863005: Get rid of DEFINE_TESTCLASS_SHORT() macro. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Mike review Created 6 years, 11 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
« no previous file with comments | « tests/PathOpsOpTest.cpp ('k') | tests/PathOpsQuadLineIntersectionTest.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 "PathOpsQuadIntersectionTestData.h" 7 #include "PathOpsQuadIntersectionTestData.h"
8 #include "PathOpsTestCommon.h" 8 #include "PathOpsTestCommon.h"
9 #include "SkIntersections.h" 9 #include "SkIntersections.h"
10 #include "SkPathOpsRect.h" 10 #include "SkPathOpsRect.h"
11 #include "SkReduceOrder.h" 11 #include "SkReduceOrder.h"
12 #include "Test.h" 12 #include "Test.h"
13 #include "TestClassDef.h"
13 14
14 static void standardTestCases(skiatest::Reporter* reporter) { 15 static void standardTestCases(skiatest::Reporter* reporter) {
15 bool showSkipped = false; 16 bool showSkipped = false;
16 for (size_t index = 0; index < quadraticTests_count; ++index) { 17 for (size_t index = 0; index < quadraticTests_count; ++index) {
17 const SkDQuad& quad1 = quadraticTests[index][0]; 18 const SkDQuad& quad1 = quadraticTests[index][0];
18 SkASSERT(ValidQuad(quad1)); 19 SkASSERT(ValidQuad(quad1));
19 const SkDQuad& quad2 = quadraticTests[index][1]; 20 const SkDQuad& quad2 = quadraticTests[index][1];
20 SkASSERT(ValidQuad(quad2)); 21 SkASSERT(ValidQuad(quad2));
21 SkReduceOrder reduce1, reduce2; 22 SkReduceOrder reduce1, reduce2;
22 int order1 = reduce1.reduce(quad1); 23 int order1 = reduce1.reduce(quad1);
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 tt1, xy1.fX, xy1.fY, tt2, xy2.fX, xy2.fY); 277 tt1, xy1.fX, xy1.fY, tt2, xy2.fX, xy2.fY);
277 REPORTER_ASSERT(reporter, 0); 278 REPORTER_ASSERT(reporter, 0);
278 } 279 }
279 #if ONE_OFF_DEBUG 280 #if ONE_OFF_DEBUG
280 SkDebugf("%s [%d][%d] t1=%1.9g (%1.9g, %1.9g) t2=%1.9g\n", __FUNCTION__, 281 SkDebugf("%s [%d][%d] t1=%1.9g (%1.9g, %1.9g) t2=%1.9g\n", __FUNCTION__,
281 outer, inner, tt1, xy1.fX, xy1.fY, tt2); 282 outer, inner, tt1, xy1.fX, xy1.fY, tt2);
282 #endif 283 #endif
283 } 284 }
284 } 285 }
285 286
286 static void PathOpsQuadIntersectionOneOffTest(skiatest::Reporter* reporter) { 287 DEF_TEST(PathOpsQuadIntersectionOneOff, reporter) {
287 oneOffTest1(reporter, 0, 1); 288 oneOffTest1(reporter, 0, 1);
288 } 289 }
289 290
290 static void oneOffTests(skiatest::Reporter* reporter) { 291 static void oneOffTests(skiatest::Reporter* reporter) {
291 for (size_t outer = 0; outer < testSetCount - 1; ++outer) { 292 for (size_t outer = 0; outer < testSetCount - 1; ++outer) {
292 for (size_t inner = outer + 1; inner < testSetCount; ++inner) { 293 for (size_t inner = outer + 1; inner < testSetCount; ++inner) {
293 oneOffTest1(reporter, outer, inner); 294 oneOffTest1(reporter, outer, inner);
294 } 295 }
295 } 296 }
296 } 297 }
(...skipping 28 matching lines...) Expand all
325 REPORTER_ASSERT(reporter, pt1.approximatelyEqual(pt2)); 326 REPORTER_ASSERT(reporter, pt1.approximatelyEqual(pt2));
326 } 327 }
327 } 328 }
328 329
329 static void coincidentTest(skiatest::Reporter* reporter) { 330 static void coincidentTest(skiatest::Reporter* reporter) {
330 for (size_t testIndex = 0; testIndex < coincidentTestSetCount - 1; testIndex += 2) { 331 for (size_t testIndex = 0; testIndex < coincidentTestSetCount - 1; testIndex += 2) {
331 coincidentTestOne(reporter, testIndex, testIndex + 1); 332 coincidentTestOne(reporter, testIndex, testIndex + 1);
332 } 333 }
333 } 334 }
334 335
335 static void PathOpsQuadIntersectionCoincidenceOneOffTest(skiatest::Reporter* rep orter) { 336 DEF_TEST(PathOpsQuadIntersectionCoincidenceOneOff, reporter) {
336 coincidentTestOne(reporter, 0, 1); 337 coincidentTestOne(reporter, 0, 1);
337 } 338 }
338 339
339 static int floatSign(double x) { 340 static int floatSign(double x) {
340 return x < 0 ? -1 : x > 0 ? 1 : 0; 341 return x < 0 ? -1 : x > 0 ? 1 : 0;
341 } 342 }
342 343
343 static const SkDQuad pointFinderTestSet[] = { 344 static const SkDQuad pointFinderTestSet[] = {
344 //>=0.633974464 0.633974 846 <= 345 //>=0.633974464 0.633974 846 <=
345 {{{1.2071879545809394, 0.82163474041730045}, {1.1534203513372994, 0.527908700699 30229}, 346 {{{1.2071879545809394, 0.82163474041730045}, {1.1534203513372994, 0.527908700699 30229},
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 SkDPoint p22 = quad2.ptAtT(t22); 493 SkDPoint p22 = quad2.ptAtT(t22);
493 SkDebugf("%s p2=(%1.9g,%1.9g)<(%1.9g,%1.9g)<(%1.9g,%1.9g)\n", __FUNCTION__, 494 SkDebugf("%s p2=(%1.9g,%1.9g)<(%1.9g,%1.9g)<(%1.9g,%1.9g)\n", __FUNCTION__,
494 p20.fX, p20.fY, p2Seed.fX, p2Seed.fY, p22.fX, p22.fY); 495 p20.fX, p20.fY, p2Seed.fX, p2Seed.fY, p22.fX, p22.fY);
495 #endif 496 #endif
496 } 497 }
497 498
498 static void QuadraticIntersection_IntersectionFinder() { 499 static void QuadraticIntersection_IntersectionFinder() {
499 intersectionFinder(0, 1); 500 intersectionFinder(0, 1);
500 } 501 }
501 502
502 static void PathOpsQuadIntersectionTest(skiatest::Reporter* reporter) { 503 DEF_TEST(PathOpsQuadIntersection, reporter) {
503 oneOffTests(reporter); 504 oneOffTests(reporter);
504 coincidentTest(reporter); 505 coincidentTest(reporter);
505 standardTestCases(reporter); 506 standardTestCases(reporter);
506 if (false) QuadraticIntersection_IntersectionFinder(); 507 if (false) QuadraticIntersection_IntersectionFinder();
507 if (false) QuadraticIntersection_PointFinder(); 508 if (false) QuadraticIntersection_PointFinder();
508 } 509 }
509
510
511 #include "TestClassDef.h"
512 DEFINE_TESTCLASS_SHORT(PathOpsQuadIntersectionTest)
513
514 DEFINE_TESTCLASS_SHORT(PathOpsQuadIntersectionOneOffTest)
515
516 DEFINE_TESTCLASS_SHORT(PathOpsQuadIntersectionCoincidenceOneOffTest)
OLDNEW
« no previous file with comments | « tests/PathOpsOpTest.cpp ('k') | tests/PathOpsQuadLineIntersectionTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698