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

Side by Side Diff: tests/PathOpsSkpClipTest.cpp

Issue 2212473002: SkRTConf: eliminate (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: `git grep SK_CONF` now returns nothing Created 4 years, 4 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/RTConfRegistryTest.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 2013 Google Inc. 2 * Copyright 2013 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 7
8 #include "CrashHandler.h" 8 #include "CrashHandler.h"
9 // #include "OverwriteLine.h" 9 // #include "OverwriteLine.h"
10 #include "Resources.h" 10 #include "Resources.h"
11 #include "SkBitmap.h" 11 #include "SkBitmap.h"
12 #include "SkCanvas.h" 12 #include "SkCanvas.h"
13 #include "SkColor.h" 13 #include "SkColor.h"
14 #include "SkColorPriv.h" 14 #include "SkColorPriv.h"
15 #include "SkCommandLineFlags.h" 15 #include "SkCommandLineFlags.h"
16 #include "SkForceLinking.h" 16 #include "SkForceLinking.h"
17 #include "SkGraphics.h" 17 #include "SkGraphics.h"
18 #include "SkImageEncoder.h" 18 #include "SkImageEncoder.h"
19 #include "SkOSFile.h" 19 #include "SkOSFile.h"
20 #include "SkPathOpsDebug.h" 20 #include "SkPathOpsDebug.h"
21 #include "SkPicture.h" 21 #include "SkPicture.h"
22 #include "SkRTConf.h"
23 #include "SkTSort.h" 22 #include "SkTSort.h"
24 #include "SkStream.h" 23 #include "SkStream.h"
25 #include "SkString.h" 24 #include "SkString.h"
26 #include "SkTArray.h" 25 #include "SkTArray.h"
27 #include "SkTDArray.h" 26 #include "SkTDArray.h"
28 #include "SkTaskGroup.h" 27 #include "SkTaskGroup.h"
29 #include "SkTemplates.h" 28 #include "SkTemplates.h"
29 #include "SkTSearch.h"
30 #include "SkTime.h" 30 #include "SkTime.h"
31 31
32 #include <stdlib.h> 32 #include <stdlib.h>
33 33
34 /* add local exceptions here */ 34 /* add local exceptions here */
35 /* TODO : add command flag interface */ 35 /* TODO : add command flag interface */
36 const struct SkipOverTest { 36 const struct SkipOverTest {
37 int directory; 37 int directory;
38 const char* filename; 38 const char* filename;
39 bool blamePathOps; 39 bool blamePathOps;
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 return true; 733 return true;
734 } 734 }
735 #endif 735 #endif
736 } 736 }
737 checkEarlyExit: 737 checkEarlyExit:
738 ; 738 ;
739 } 739 }
740 return true; 740 return true;
741 } 741 }
742 742
743 static void initTest() {
744 #if !defined SK_BUILD_FOR_WIN && !defined SK_BUILD_FOR_MAC
745 SK_CONF_SET("images.jpeg.suppressDecoderWarnings", true);
746 SK_CONF_SET("images.png.suppressDecoderWarnings", true);
747 #endif
748 }
749
750 static void testSkpClipEncode(TestState* data) { 743 static void testSkpClipEncode(TestState* data) {
751 data->fResult.testOne(); 744 data->fResult.testOne();
752 if (verbose()) { 745 if (verbose()) {
753 SkDebugf("+"); 746 SkDebugf("+");
754 } 747 }
755 } 748 }
756 749
757 static void encodeFound(TestState& state) { 750 static void encodeFound(TestState& state) {
758 if (verbose()) { 751 if (verbose()) {
759 if (state.fPixelWorst.count()) { 752 if (state.fPixelWorst.count()) {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 \ 813 \
821 protected: \ 814 protected: \
822 void onGetName(SkString* name) override { name->set(#name); } \ 815 void onGetName(SkString* name) override { name->set(#name); } \
823 void onRun() override { test_##name(); } \ 816 void onRun() override { test_##name(); } \
824 }; \ 817 }; \
825 static TestRegistry gReg_##name##Class(name##Class::Factory); \ 818 static TestRegistry gReg_##name##Class(name##Class::Factory); \
826 static void test_##name() 819 static void test_##name()
827 820
828 DEF_TEST(PathOpsSkpClip) { 821 DEF_TEST(PathOpsSkpClip) {
829 gDirs.setDefault(); 822 gDirs.setDefault();
830 initTest();
831 SkTArray<TestResult, true> errors; 823 SkTArray<TestResult, true> errors;
832 TestState state; 824 TestState state;
833 state.init(0); 825 state.init(0);
834 int dirNo; 826 int dirNo;
835 gDirs.reset(); 827 gDirs.reset();
836 while ((dirNo = gDirs.next()) > 0) { 828 while ((dirNo = gDirs.next()) > 0) {
837 if (verbose()) { 829 if (verbose()) {
838 SkDebugf("dirNo=%d\n", dirNo); 830 SkDebugf("dirNo=%d\n", dirNo);
839 } 831 }
840 state.fResult.fDirNo = dirNo; 832 state.fResult.fDirNo = dirNo;
841 if (!doOneDir(&state, false)) { 833 if (!doOneDir(&state, false)) {
842 break; 834 break;
843 } 835 }
844 } 836 }
845 encodeFound(state); 837 encodeFound(state);
846 } 838 }
847 839
848 static void testSkpClipMain(TestState* data) { 840 static void testSkpClipMain(TestState* data) {
849 (void) doOneDir(data, true); 841 (void) doOneDir(data, true);
850 } 842 }
851 843
852 DEF_TEST(PathOpsSkpClipThreaded) { 844 DEF_TEST(PathOpsSkpClipThreaded) {
853 gDirs.setDefault(); 845 gDirs.setDefault();
854 initTest();
855 TestRunner testRunner; 846 TestRunner testRunner;
856 int dirNo; 847 int dirNo;
857 gDirs.reset(); 848 gDirs.reset();
858 while ((dirNo = gDirs.next()) > 0) { 849 while ((dirNo = gDirs.next()) > 0) {
859 *testRunner.fRunnables.append() = new TestRunnableDir(&testSkpClipMain, dirNo, &testRunner); 850 *testRunner.fRunnables.append() = new TestRunnableDir(&testSkpClipMain, dirNo, &testRunner);
860 } 851 }
861 testRunner.render(); 852 testRunner.render();
862 TestState state; 853 TestState state;
863 state.init(0); 854 state.init(0);
864 gDirs.reset(); 855 gDirs.reset();
(...skipping 18 matching lines...) Expand all
883 return false; 874 return false;
884 } 875 }
885 } 876 }
886 return true; 877 return true;
887 } 878 }
888 879
889 DEF_TEST(PathOpsSkpClipUberThreaded) { 880 DEF_TEST(PathOpsSkpClipUberThreaded) {
890 gDirs.setDefault(); 881 gDirs.setDefault();
891 const int firstDirNo = gDirs.next(); 882 const int firstDirNo = gDirs.next();
892 const int lastDirNo = gDirs.last(); 883 const int lastDirNo = gDirs.last();
893 initTest();
894 int dirCount = lastDirNo - firstDirNo + 1; 884 int dirCount = lastDirNo - firstDirNo + 1;
895 SkAutoTDeleteArray<SkTDArray<TestResult> > tests(new SkTDArray<TestResult>[d irCount]); 885 SkAutoTDeleteArray<SkTDArray<TestResult> > tests(new SkTDArray<TestResult>[d irCount]);
896 SkAutoTDeleteArray<SkTDArray<SortByName*> > sorted(new SkTDArray<SortByName* >[dirCount]); 886 SkAutoTDeleteArray<SkTDArray<SortByName*> > sorted(new SkTDArray<SortByName* >[dirCount]);
897 if (!buildTests(tests.get(), sorted.get())) { 887 if (!buildTests(tests.get(), sorted.get())) {
898 return; 888 return;
899 } 889 }
900 TestRunner testRunner; 890 TestRunner testRunner;
901 int dirNo; 891 int dirNo;
902 gDirs.reset(); 892 gDirs.reset();
903 while ((dirNo = gDirs.next()) > 0) { 893 while ((dirNo = gDirs.next()) > 0) {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
966 DEF_TEST(PathOpsSkpClipOneOff) { 956 DEF_TEST(PathOpsSkpClipOneOff) {
967 const int testIndex = FLAGS_testIndex; 957 const int testIndex = FLAGS_testIndex;
968 int dirNo = gDirs.next(); 958 int dirNo = gDirs.next();
969 if (dirNo < 0) { 959 if (dirNo < 0) {
970 dirNo = skipOver[testIndex].directory; 960 dirNo = skipOver[testIndex].directory;
971 } 961 }
972 const char* skp = gNames.next(); 962 const char* skp = gNames.next();
973 if (!skp) { 963 if (!skp) {
974 skp = skipOver[testIndex].filename; 964 skp = skipOver[testIndex].filename;
975 } 965 }
976 initTest();
977 SkAssertResult(get_in_path(dirNo, skp).size()); 966 SkAssertResult(get_in_path(dirNo, skp).size());
978 SkString filename(skp); 967 SkString filename(skp);
979 TestResult state; 968 TestResult state;
980 state.test(dirNo, filename); 969 state.test(dirNo, filename);
981 if (verbose()) { 970 if (verbose()) {
982 SkDebugf("%s", state.status().c_str()); 971 SkDebugf("%s", state.status().c_str());
983 } 972 }
984 state.fTestStep = kEncodeFiles; 973 state.fTestStep = kEncodeFiles;
985 state.testOne(); 974 state.testOne();
986 } 975 }
987 976
988 DEF_TEST(PathOpsTestSkipped) { 977 DEF_TEST(PathOpsTestSkipped) {
989 for (size_t index = 0; index < skipOverCount; ++index) { 978 for (size_t index = 0; index < skipOverCount; ++index) {
990 const SkipOverTest& skip = skipOver[index]; 979 const SkipOverTest& skip = skipOver[index];
991 if (!skip.blamePathOps) { 980 if (!skip.blamePathOps) {
992 continue; 981 continue;
993 } 982 }
994 int dirNo = skip.directory; 983 int dirNo = skip.directory;
995 const char* skp = skip.filename; 984 const char* skp = skip.filename;
996 initTest();
997 SkAssertResult(get_in_path(dirNo, skp).size()); 985 SkAssertResult(get_in_path(dirNo, skp).size());
998 SkString filename(skp); 986 SkString filename(skp);
999 TestResult state; 987 TestResult state;
1000 state.test(dirNo, filename); 988 state.test(dirNo, filename);
1001 if (verbose()) { 989 if (verbose()) {
1002 SkDebugf("%s", state.status().c_str()); 990 SkDebugf("%s", state.status().c_str());
1003 } 991 }
1004 state.fTestStep = kEncodeFiles; 992 state.fTestStep = kEncodeFiles;
1005 state.testOne(); 993 state.testOne();
1006 } 994 }
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
1092 } 1080 }
1093 } 1081 }
1094 return 0; 1082 return 0;
1095 } 1083 }
1096 1084
1097 #if !defined(SK_BUILD_FOR_IOS) 1085 #if !defined(SK_BUILD_FOR_IOS)
1098 int main(int argc, char * const argv[]) { 1086 int main(int argc, char * const argv[]) {
1099 return tool_main(argc, (char**) argv); 1087 return tool_main(argc, (char**) argv);
1100 } 1088 }
1101 #endif 1089 #endif
OLDNEW
« no previous file with comments | « tests/PathOpsExtendedTest.cpp ('k') | tests/RTConfRegistryTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698