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

Side by Side Diff: tests/PathOpsSkpClipTest.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/PathOpsSimplifyTrianglesThreadedTest.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 #include "SkBitmap.h" 2 #include "SkBitmap.h"
3 #include "SkCanvas.h" 3 #include "SkCanvas.h"
4 #include "SkColor.h" 4 #include "SkColor.h"
5 #include "SkColorPriv.h" 5 #include "SkColorPriv.h"
6 #include "SkDevice.h" 6 #include "SkDevice.h"
7 #include "SkGraphics.h" 7 #include "SkGraphics.h"
8 #include "SkImageDecoder.h" 8 #include "SkImageDecoder.h"
9 #include "SkImageEncoder.h" 9 #include "SkImageEncoder.h"
10 #include "SkOSFile.h" 10 #include "SkOSFile.h"
11 #include "SkPathOpsDebug.h" 11 #include "SkPathOpsDebug.h"
12 #include "SkPicture.h" 12 #include "SkPicture.h"
13 #include "SkRTConf.h" 13 #include "SkRTConf.h"
14 #include "SkStream.h" 14 #include "SkStream.h"
15 #include "SkString.h" 15 #include "SkString.h"
16 #include "SkTArray.h" 16 #include "SkTArray.h"
17 #include "SkTDArray.h" 17 #include "SkTDArray.h"
18 #include "SkThreadPool.h" 18 #include "SkThreadPool.h"
19 #include "SkTime.h" 19 #include "SkTime.h"
20 #include "Test.h" 20 #include "Test.h"
21 #include "TestClassDef.h"
21 22
22 #ifdef SK_BUILD_FOR_WIN 23 #ifdef SK_BUILD_FOR_WIN
23 #define PATH_SLASH "\\" 24 #define PATH_SLASH "\\"
24 #define IN_DIR "D:\\9-30-13\\" 25 #define IN_DIR "D:\\9-30-13\\"
25 #define OUT_DIR "D:\\opSkpClip\\1\\" 26 #define OUT_DIR "D:\\opSkpClip\\1\\"
26 #else 27 #else
27 #define PATH_SLASH "/" 28 #define PATH_SLASH "/"
28 #ifdef SK_BUILD_FOR_MAC 29 #ifdef SK_BUILD_FOR_MAC
29 #define IN_DIR "/Volumes/tera/9-30-13/skp" 30 #define IN_DIR "/Volumes/tera/9-30-13/skp"
30 #define OUT_DIR "/Volumes/tera/out/9-30-13/1/" 31 #define OUT_DIR "/Volumes/tera/out/9-30-13/1/"
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 SkDebugf("%d %s %d\n", state.fDirsFound[index], state.fFilesFound[in dex], 606 SkDebugf("%d %s %d\n", state.fDirsFound[index], state.fFilesFound[in dex],
606 state.fError[index]); 607 state.fError[index]);
607 } 608 }
608 } 609 }
609 for (int index = 0; index < state.fFoundCount; ++index) { 610 for (int index = 0; index < state.fFoundCount; ++index) {
610 TestResult::Test(state.fDirsFound[index], state.fFilesFound[index], kEnc odeFiles); 611 TestResult::Test(state.fDirsFound[index], state.fFilesFound[index], kEnc odeFiles);
611 if (state.fReporter->verbose()) SkDebugf("+"); 612 if (state.fReporter->verbose()) SkDebugf("+");
612 } 613 }
613 } 614 }
614 615
615 static void PathOpsSkpClipTest(skiatest::Reporter* reporter) { 616 DEF_TEST(PathOpsSkpClip, reporter) {
616 if (!initTest()) { 617 if (!initTest()) {
617 return; 618 return;
618 } 619 }
619 SkTArray<TestResult, true> errors; 620 SkTArray<TestResult, true> errors;
620 TestState state; 621 TestState state;
621 state.init(0, reporter); 622 state.init(0, reporter);
622 for (int dirNo = 1; dirNo <= 100; ++dirNo) { 623 for (int dirNo = 1; dirNo <= 100; ++dirNo) {
623 if (reporter->verbose()) { 624 if (reporter->verbose()) {
624 SkDebugf("dirNo=%d\n", dirNo); 625 SkDebugf("dirNo=%d\n", dirNo);
625 } 626 }
626 state.fResult.fDirNo = dirNo; 627 state.fResult.fDirNo = dirNo;
627 if (!doOneDir(&state)) { 628 if (!doOneDir(&state)) {
628 break; 629 break;
629 } 630 }
630 } 631 }
631 encodeFound(reporter, state); 632 encodeFound(reporter, state);
632 } 633 }
633 634
634 static void testSkpClipMain(TestState* data) { 635 static void testSkpClipMain(TestState* data) {
635 (void) doOneDir(data); 636 (void) doOneDir(data);
636 } 637 }
637 638
638 static void PathOpsSkpClipThreadedTest(skiatest::Reporter* reporter) { 639 DEF_TEST(PathOpsSkpClipThreaded, reporter) {
639 if (!initTest()) { 640 if (!initTest()) {
640 return; 641 return;
641 } 642 }
642 int threadCount = reporter->allowThreaded() ? SkThreadPool::kThreadPerCore : 1; 643 int threadCount = reporter->allowThreaded() ? SkThreadPool::kThreadPerCore : 1;
643 TestRunner testRunner(reporter, threadCount); 644 TestRunner testRunner(reporter, threadCount);
644 for (int dirNo = 1; dirNo <= 100; ++dirNo) { 645 for (int dirNo = 1; dirNo <= 100; ++dirNo) {
645 *testRunner.fRunnables.append() = SkNEW_ARGS(TestRunnable, 646 *testRunner.fRunnables.append() = SkNEW_ARGS(TestRunnable,
646 (&testSkpClipMain, dirNo, &testRunner)); 647 (&testSkpClipMain, dirNo, &testRunner));
647 } 648 }
648 testRunner.render(); 649 testRunner.render();
649 TestState state; 650 TestState state;
650 state.init(0, reporter); 651 state.init(0, reporter);
651 for (int dirNo = 1; dirNo <= 100; ++dirNo) { 652 for (int dirNo = 1; dirNo <= 100; ++dirNo) {
652 TestState& testState = testRunner.fRunnables[dirNo - 1]->fState; 653 TestState& testState = testRunner.fRunnables[dirNo - 1]->fState;
653 for (int inner = 0; inner < testState.fFoundCount; ++inner) { 654 for (int inner = 0; inner < testState.fFoundCount; ++inner) {
654 TestResult& testResult = testState.fResult; 655 TestResult& testResult = testState.fResult;
655 SkASSERT(testResult.fDirNo == dirNo); 656 SkASSERT(testResult.fDirNo == dirNo);
656 testResult.fPixelError = testState.fError[inner]; 657 testResult.fPixelError = testState.fError[inner];
657 strcpy(testResult.fFilename, testState.fFilesFound[inner]); 658 strcpy(testResult.fFilename, testState.fFilesFound[inner]);
658 addError(&state, testResult); 659 addError(&state, testResult);
659 } 660 }
660 } 661 }
661 encodeFound(reporter, state); 662 encodeFound(reporter, state);
662 } 663 }
663 664
664 static void PathOpsSkpClipOneOffTest(skiatest::Reporter* reporter) { 665 DEF_TEST(PathOpsSkpClipOneOff, reporter) {
665 if (!initTest()) { 666 if (!initTest()) {
666 return; 667 return;
667 } 668 }
668 const int testIndex = 43 - 41; 669 const int testIndex = 43 - 41;
669 int dirNo = skipOverSept[testIndex].directory; 670 int dirNo = skipOverSept[testIndex].directory;
670 SkAssertResult(make_in_dir_name(dirNo).size()); 671 SkAssertResult(make_in_dir_name(dirNo).size());
671 SkString filename(skipOverSept[testIndex].filename); 672 SkString filename(skipOverSept[testIndex].filename);
672 TestResult state; 673 TestResult state;
673 state.test(dirNo, filename); 674 state.test(dirNo, filename);
674 if (reporter->verbose()) { 675 if (reporter->verbose()) {
675 SkDebugf("%s", state.status().c_str()); 676 SkDebugf("%s", state.status().c_str());
676 } 677 }
677 state.fTestStep = kEncodeFiles; 678 state.fTestStep = kEncodeFiles;
678 state.testOne(); 679 state.testOne();
679 } 680 }
680
681 #include "TestClassDef.h"
682 DEFINE_TESTCLASS_SHORT(PathOpsSkpClipTest)
683
684 DEFINE_TESTCLASS_SHORT(PathOpsSkpClipOneOffTest)
685
686 DEFINE_TESTCLASS_SHORT(PathOpsSkpClipThreadedTest)
OLDNEW
« no previous file with comments | « tests/PathOpsSimplifyTrianglesThreadedTest.cpp ('k') | tests/PathOpsSkpTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698