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

Side by Side Diff: tests/TestConfigParsing.cpp

Issue 1857233002: Revert of Add predfined configs for msaa4, nvpr4, nvpr4dit, and srgb that explictly use OpenGL rather than GL… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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 | « no previous file | tools/dm_flags.json » ('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 2015 Google Inc. 2 * Copyright 2015 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 "SkCommonFlagsConfig.h" 8 #include "SkCommonFlagsConfig.h"
9 #include "Test.h" 9 #include "Test.h"
10 #include <initializer_list> 10 #include <initializer_list>
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 #endif 51 #endif
52 } 52 }
53 53
54 DEF_TEST(ParseConfigs_OutParam, reporter) { 54 DEF_TEST(ParseConfigs_OutParam, reporter) {
55 // Clears the out parameter. 55 // Clears the out parameter.
56 SkCommandLineFlags::StringArray config1 = make_string_array({"gpu"}); 56 SkCommandLineFlags::StringArray config1 = make_string_array({"gpu"});
57 SkCommandLineConfigArray configs; 57 SkCommandLineConfigArray configs;
58 ParseConfigs(config1, &configs); 58 ParseConfigs(config1, &configs);
59 REPORTER_ASSERT(reporter, configs.count() == 1); 59 REPORTER_ASSERT(reporter, configs.count() == 1);
60 REPORTER_ASSERT(reporter, configs[0]->getTag().equals("gpu")); 60 REPORTER_ASSERT(reporter, configs[0]->getTag().equals("gpu"));
61
62 SkCommandLineFlags::StringArray config2 = make_string_array({"8888"}); 61 SkCommandLineFlags::StringArray config2 = make_string_array({"8888"});
63 ParseConfigs(config2, &configs); 62 ParseConfigs(config2, &configs);
64 REPORTER_ASSERT(reporter, configs.count() == 1); 63 REPORTER_ASSERT(reporter, configs.count() == 1);
65 REPORTER_ASSERT(reporter, configs[0]->getTag().equals("8888")); 64 REPORTER_ASSERT(reporter, configs[0]->getTag().equals("8888"));
66
67 SkCommandLineFlags::StringArray config3 = make_string_array({"gl"});
68 ParseConfigs(config3, &configs);
69 REPORTER_ASSERT(reporter, configs.count() == 1);
70 REPORTER_ASSERT(reporter, configs[0]->getTag().equals("gl"));
71 } 65 }
72 66
73 DEF_TEST(ParseConfigs_DefaultConfigs, reporter) { 67 DEF_TEST(ParseConfigs_DefaultConfigs, reporter) {
74 // Parses all default configs and returns correct "tag". 68 // Parses all default configs and returns correct "tag".
75 69
76 SkCommandLineFlags::StringArray config1 = make_string_array({ 70 SkCommandLineFlags::StringArray config1 = make_string_array({
77 "565", "8888", "debug", "gpu", "gpudebug", "gpudft", "gpunull", "msaa16" , "msaa4", 71 "565", "8888", "debug", "gpu", "gpudebug", "gpudft", "gpunull", "msaa16" , "msaa4",
78 "nonrendering", "null", "nullgpu", "nvpr16", "nvpr4", "nvprdit16", "nvpr dit4", "pdf", 72 "nonrendering", "null", "nullgpu", "nvpr16", "nvpr4", "nvprdit16", "nvpr dit4", "pdf",
79 "skp", "svg", "xps", "angle", "angle-gl", "commandbuffer", "mesa", "hwui ", 73 "skp", "svg", "xps", "angle", "angle-gl", "commandbuffer", "mesa", "hwui ",
80 "gpuf16", "gpusrgb", "gl", "glnvpr4", "glnvprdit4", "glsrgb", "glmsaa4" 74 "gpuf16", "gpusrgb"
81 }); 75 });
82 76
83 SkCommandLineConfigArray configs; 77 SkCommandLineConfigArray configs;
84 ParseConfigs(config1, &configs); 78 ParseConfigs(config1, &configs);
85 79
86 REPORTER_ASSERT(reporter, configs.count() == config1.count()); 80 REPORTER_ASSERT(reporter, configs.count() == config1.count());
87 for (int i = 0; i < config1.count(); ++i) { 81 for (int i = 0; i < config1.count(); ++i) {
88 REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i])); 82 REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i]));
89 REPORTER_ASSERT(reporter, configs[i]->getViaParts().count() == 0); 83 REPORTER_ASSERT(reporter, configs[i]->getViaParts().count() == 0);
90 } 84 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 #if SK_COMMAND_BUFFER 134 #if SK_COMMAND_BUFFER
141 REPORTER_ASSERT(reporter, configs[22]->asConfigGpu()); 135 REPORTER_ASSERT(reporter, configs[22]->asConfigGpu());
142 #else 136 #else
143 REPORTER_ASSERT(reporter, !configs[22]->asConfigGpu()); 137 REPORTER_ASSERT(reporter, !configs[22]->asConfigGpu());
144 #endif 138 #endif
145 #if SK_MESA 139 #if SK_MESA
146 REPORTER_ASSERT(reporter, configs[23]->asConfigGpu()); 140 REPORTER_ASSERT(reporter, configs[23]->asConfigGpu());
147 #else 141 #else
148 REPORTER_ASSERT(reporter, !configs[23]->asConfigGpu()); 142 REPORTER_ASSERT(reporter, !configs[23]->asConfigGpu());
149 #endif 143 #endif
150 REPORTER_ASSERT(reporter, configs[27]->asConfigGpu());
151 REPORTER_ASSERT(reporter, configs[28]->asConfigGpu());
152 REPORTER_ASSERT(reporter, configs[28]->asConfigGpu()->getSamples() == 4);
153 REPORTER_ASSERT(reporter, configs[28]->asConfigGpu()->getUseNVPR());
154 REPORTER_ASSERT(reporter, configs[29]->asConfigGpu());
155 REPORTER_ASSERT(reporter, configs[29]->asConfigGpu()->getSamples() == 4);
156 REPORTER_ASSERT(reporter, configs[29]->asConfigGpu()->getUseNVPR());
157 REPORTER_ASSERT(reporter, configs[29]->asConfigGpu()->getUseDIText());
158 REPORTER_ASSERT(reporter, configs[30]->asConfigGpu());
159 REPORTER_ASSERT(reporter, configs[30]->asConfigGpu()->getColorType() == kN3 2_SkColorType);
160 REPORTER_ASSERT(reporter, configs[30]->asConfigGpu()->getProfileType() ==
161 kSRGB_SkColorProfileType);
162 REPORTER_ASSERT(reporter, configs[31]->asConfigGpu());
163 REPORTER_ASSERT(reporter, configs[31]->asConfigGpu()->getSamples() == 4);
164 #endif 144 #endif
165 } 145 }
166 146
167 DEF_TEST(ParseConfigs_ExtendedGpuConfigsCorrect, reporter) { 147 DEF_TEST(ParseConfigs_ExtendedGpuConfigsCorrect, reporter) {
168 SkCommandLineFlags::StringArray config1 = make_string_array({ 148 SkCommandLineFlags::StringArray config1 = make_string_array({
169 "gpu(nvpr=true,dit=false)", 149 "gpu(nvpr=true,dit=false)",
170 "gpu(api=angle)", 150 "gpu(api=angle)",
171 "gpu(api=angle-gl)", 151 "gpu(api=angle-gl)",
172 "gpu(api=mesa,samples=77)", 152 "gpu(api=mesa,samples=77)",
173 "gpu(dit=true,api=commandbuffer)", 153 "gpu(dit=true,api=commandbuffer)",
174 "gpu()", 154 "gpu()",
175 "gpu(api=gles)", 155 "gpu(api=gles)"
176 "gpu(api=gl)"
177 }); 156 });
178 157
179 SkCommandLineConfigArray configs; 158 SkCommandLineConfigArray configs;
180 ParseConfigs(config1, &configs); 159 ParseConfigs(config1, &configs);
181 REPORTER_ASSERT(reporter, configs.count() == config1.count()); 160 REPORTER_ASSERT(reporter, configs.count() == config1.count());
182 for (int i = 0; i < config1.count(); ++i) { 161 for (int i = 0; i < config1.count(); ++i) {
183 REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i])); 162 REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i]));
184 } 163 }
185 #if SK_SUPPORT_GPU 164 #if SK_SUPPORT_GPU
186 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getContextType() == 165 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getContextType() ==
(...skipping 30 matching lines...) Expand all
217 REPORTER_ASSERT(reporter, configs[5]->asConfigGpu()->getContextType() == 196 REPORTER_ASSERT(reporter, configs[5]->asConfigGpu()->getContextType() ==
218 GrContextFactory::kNative_GLContextType); 197 GrContextFactory::kNative_GLContextType);
219 REPORTER_ASSERT(reporter, !configs[5]->asConfigGpu()->getUseNVPR()); 198 REPORTER_ASSERT(reporter, !configs[5]->asConfigGpu()->getUseNVPR());
220 REPORTER_ASSERT(reporter, !configs[5]->asConfigGpu()->getUseDIText()); 199 REPORTER_ASSERT(reporter, !configs[5]->asConfigGpu()->getUseDIText());
221 REPORTER_ASSERT(reporter, configs[5]->asConfigGpu()->getSamples() == 0); 200 REPORTER_ASSERT(reporter, configs[5]->asConfigGpu()->getSamples() == 0);
222 REPORTER_ASSERT(reporter, configs[6]->asConfigGpu()->getContextType() == 201 REPORTER_ASSERT(reporter, configs[6]->asConfigGpu()->getContextType() ==
223 GrContextFactory::kGLES_GLContextType); 202 GrContextFactory::kGLES_GLContextType);
224 REPORTER_ASSERT(reporter, !configs[6]->asConfigGpu()->getUseNVPR()); 203 REPORTER_ASSERT(reporter, !configs[6]->asConfigGpu()->getUseNVPR());
225 REPORTER_ASSERT(reporter, !configs[6]->asConfigGpu()->getUseDIText()); 204 REPORTER_ASSERT(reporter, !configs[6]->asConfigGpu()->getUseDIText());
226 REPORTER_ASSERT(reporter, configs[6]->asConfigGpu()->getSamples() == 0); 205 REPORTER_ASSERT(reporter, configs[6]->asConfigGpu()->getSamples() == 0);
227 REPORTER_ASSERT(reporter, configs[7]->asConfigGpu()->getContextType() == 206
228 GrContextFactory::kGL_GLContextType);
229 REPORTER_ASSERT(reporter, !configs[7]->asConfigGpu()->getUseNVPR());
230 REPORTER_ASSERT(reporter, !configs[7]->asConfigGpu()->getUseDIText());
231 REPORTER_ASSERT(reporter, configs[7]->asConfigGpu()->getSamples() == 0);
232 #endif 207 #endif
233 } 208 }
234 209
235 DEF_TEST(ParseConfigs_ExtendedGpuConfigsIncorrect, reporter) { 210 DEF_TEST(ParseConfigs_ExtendedGpuConfigsIncorrect, reporter) {
236 SkCommandLineFlags::StringArray config1 = make_string_array({ 211 SkCommandLineFlags::StringArray config1 = make_string_array({
237 "gpu(nvpr=1)", // Number as bool. 212 "gpu(nvpr=1)", // Number as bool.
238 "gpu(api=gl,)", // Trailing in comma. 213 "gpu(api=gl,)", // Trailing in comma.
239 "gpu(api=angle-glu)", // Unknown api. 214 "gpu(api=angle-glu)", // Unknown api.
240 "gpu(api=,samples=0)", // Empty api. 215 "gpu(api=,samples=0)", // Empty api.
241 "gpu(samples=true)", // Value true as a number. 216 "gpu(samples=true)", // Value true as a number.
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 REPORTER_ASSERT(reporter, 326 REPORTER_ASSERT(reporter,
352 configs[i]->getViaParts()[j].equals(expectedConfigs[ i].vias[j])); 327 configs[i]->getViaParts()[j].equals(expectedConfigs[ i].vias[j]));
353 } 328 }
354 } 329 }
355 #if SK_SUPPORT_GPU 330 #if SK_SUPPORT_GPU
356 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()); 331 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu());
357 REPORTER_ASSERT(reporter, !configs[1]->asConfigGpu()); 332 REPORTER_ASSERT(reporter, !configs[1]->asConfigGpu());
358 REPORTER_ASSERT(reporter, !configs[2]->asConfigGpu()); 333 REPORTER_ASSERT(reporter, !configs[2]->asConfigGpu());
359 #endif 334 #endif
360 } 335 }
OLDNEW
« no previous file with comments | « no previous file | tools/dm_flags.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698