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

Side by Side Diff: tests/TestConfigParsing.cpp

Issue 1856703002: Revert of Rename enums in GrContextFactory to remove "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 | « tests/SkpSkGrTest.cpp ('k') | tests/VkClearTests.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 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 23 matching lines...) Expand all
34 SkCommandLineFlags::StringArray config1 = make_string_array({"gpu"}); 34 SkCommandLineFlags::StringArray config1 = make_string_array({"gpu"});
35 SkCommandLineConfigArray configs; 35 SkCommandLineConfigArray configs;
36 ParseConfigs(config1, &configs); 36 ParseConfigs(config1, &configs);
37 37
38 REPORTER_ASSERT(reporter, configs.count() == 1); 38 REPORTER_ASSERT(reporter, configs.count() == 1);
39 REPORTER_ASSERT(reporter, configs[0]->getTag().equals("gpu")); 39 REPORTER_ASSERT(reporter, configs[0]->getTag().equals("gpu"));
40 REPORTER_ASSERT(reporter, configs[0]->getViaParts().count() == 0); 40 REPORTER_ASSERT(reporter, configs[0]->getViaParts().count() == 0);
41 #if SK_SUPPORT_GPU 41 #if SK_SUPPORT_GPU
42 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()); 42 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu());
43 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getContextType() 43 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getContextType()
44 == GrContextFactory::kNativeGL_ContextType); 44 == GrContextFactory::kNative_GLContextType);
45 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getUseNVPR() == false); 45 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getUseNVPR() == false);
46 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getUseDIText() == false ); 46 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getUseDIText() == false );
47 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getSamples() == 0); 47 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getSamples() == 0);
48 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getColorType() == kN32_ SkColorType); 48 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getColorType() == kN32_ SkColorType);
49 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getProfileType() 49 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getProfileType()
50 == kLinear_SkColorProfileType); 50 == kLinear_SkColorProfileType);
51 #endif 51 #endif
52 } 52 }
53 53
54 DEF_TEST(ParseConfigs_OutParam, reporter) { 54 DEF_TEST(ParseConfigs_OutParam, reporter) {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 }); 157 });
158 158
159 SkCommandLineConfigArray configs; 159 SkCommandLineConfigArray configs;
160 ParseConfigs(config1, &configs); 160 ParseConfigs(config1, &configs);
161 REPORTER_ASSERT(reporter, configs.count() == config1.count()); 161 REPORTER_ASSERT(reporter, configs.count() == config1.count());
162 for (int i = 0; i < config1.count(); ++i) { 162 for (int i = 0; i < config1.count(); ++i) {
163 REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i])); 163 REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i]));
164 } 164 }
165 #if SK_SUPPORT_GPU 165 #if SK_SUPPORT_GPU
166 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getContextType() == 166 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getContextType() ==
167 GrContextFactory::kNativeGL_ContextType); 167 GrContextFactory::kNative_GLContextType);
168 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getUseNVPR()); 168 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getUseNVPR());
169 REPORTER_ASSERT(reporter, !configs[0]->asConfigGpu()->getUseDIText()); 169 REPORTER_ASSERT(reporter, !configs[0]->asConfigGpu()->getUseDIText());
170 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getSamples() == 0); 170 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getSamples() == 0);
171 #if SK_ANGLE 171 #if SK_ANGLE
172 #ifdef SK_BUILD_FOR_WIN 172 #ifdef SK_BUILD_FOR_WIN
173 REPORTER_ASSERT(reporter, configs[1]->asConfigGpu()->getContextType() == 173 REPORTER_ASSERT(reporter, configs[1]->asConfigGpu()->getContextType() ==
174 GrContextFactory::kANGLE_ContextType); 174 GrContextFactory::kANGLE_GLContextType);
175 #else 175 #else
176 REPORTER_ASSERT(reporter, !configs[1]->asConfigGpu()); 176 REPORTER_ASSERT(reporter, !configs[1]->asConfigGpu());
177 #endif 177 #endif
178 REPORTER_ASSERT(reporter, configs[2]->asConfigGpu()->getContextType() == 178 REPORTER_ASSERT(reporter, configs[2]->asConfigGpu()->getContextType() ==
179 GrContextFactory::kANGLE_GL_ContextType); 179 GrContextFactory::kANGLE_GL_GLContextType);
180 #else 180 #else
181 REPORTER_ASSERT(reporter, !configs[1]->asConfigGpu()); 181 REPORTER_ASSERT(reporter, !configs[1]->asConfigGpu());
182 REPORTER_ASSERT(reporter, !configs[2]->asConfigGpu()); 182 REPORTER_ASSERT(reporter, !configs[2]->asConfigGpu());
183 #endif 183 #endif
184 #if SK_MESA 184 #if SK_MESA
185 REPORTER_ASSERT(reporter, configs[3]->asConfigGpu()->getContextType() == 185 REPORTER_ASSERT(reporter, configs[3]->asConfigGpu()->getContextType() ==
186 GrContextFactory::kMESA_ContextType); 186 GrContextFactory::kMESA_GLContextType);
187 #else 187 #else
188 REPORTER_ASSERT(reporter, !configs[3]->asConfigGpu()); 188 REPORTER_ASSERT(reporter, !configs[3]->asConfigGpu());
189 #endif 189 #endif
190 #if SK_COMMAND_BUFFER 190 #if SK_COMMAND_BUFFER
191 REPORTER_ASSERT(reporter, configs[4]->asConfigGpu()->getContextType() == 191 REPORTER_ASSERT(reporter, configs[4]->asConfigGpu()->getContextType() ==
192 GrContextFactory::kCommandBuffer_ContextType); 192 GrContextFactory::kCommandBuffer_GLContextType);
193 193
194 #else 194 #else
195 REPORTER_ASSERT(reporter, !configs[4]->asConfigGpu()); 195 REPORTER_ASSERT(reporter, !configs[4]->asConfigGpu());
196 #endif 196 #endif
197 REPORTER_ASSERT(reporter, configs[5]->asConfigGpu()->getContextType() == 197 REPORTER_ASSERT(reporter, configs[5]->asConfigGpu()->getContextType() ==
198 GrContextFactory::kNativeGL_ContextType); 198 GrContextFactory::kNative_GLContextType);
199 REPORTER_ASSERT(reporter, !configs[5]->asConfigGpu()->getUseNVPR()); 199 REPORTER_ASSERT(reporter, !configs[5]->asConfigGpu()->getUseNVPR());
200 REPORTER_ASSERT(reporter, !configs[5]->asConfigGpu()->getUseDIText()); 200 REPORTER_ASSERT(reporter, !configs[5]->asConfigGpu()->getUseDIText());
201 REPORTER_ASSERT(reporter, configs[5]->asConfigGpu()->getSamples() == 0); 201 REPORTER_ASSERT(reporter, configs[5]->asConfigGpu()->getSamples() == 0);
202 REPORTER_ASSERT(reporter, configs[6]->asConfigGpu()->getContextType() == 202 REPORTER_ASSERT(reporter, configs[6]->asConfigGpu()->getContextType() ==
203 GrContextFactory::kGLES_ContextType); 203 GrContextFactory::kGLES_GLContextType);
204 REPORTER_ASSERT(reporter, !configs[6]->asConfigGpu()->getUseNVPR()); 204 REPORTER_ASSERT(reporter, !configs[6]->asConfigGpu()->getUseNVPR());
205 REPORTER_ASSERT(reporter, !configs[6]->asConfigGpu()->getUseDIText()); 205 REPORTER_ASSERT(reporter, !configs[6]->asConfigGpu()->getUseDIText());
206 REPORTER_ASSERT(reporter, configs[6]->asConfigGpu()->getSamples() == 0); 206 REPORTER_ASSERT(reporter, configs[6]->asConfigGpu()->getSamples() == 0);
207
207 #endif 208 #endif
208 } 209 }
209 210
210 DEF_TEST(ParseConfigs_ExtendedGpuConfigsIncorrect, reporter) { 211 DEF_TEST(ParseConfigs_ExtendedGpuConfigsIncorrect, reporter) {
211 SkCommandLineFlags::StringArray config1 = make_string_array({ 212 SkCommandLineFlags::StringArray config1 = make_string_array({
212 "gpu(nvpr=1)", // Number as bool. 213 "gpu(nvpr=1)", // Number as bool.
213 "gpu(api=gl,)", // Trailing in comma. 214 "gpu(api=gl,)", // Trailing in comma.
214 "gpu(api=angle-glu)", // Unknown api. 215 "gpu(api=angle-glu)", // Unknown api.
215 "gpu(api=,samples=0)", // Empty api. 216 "gpu(api=,samples=0)", // Empty api.
216 "gpu(samples=true)", // Value true as a number. 217 "gpu(samples=true)", // Value true as a number.
(...skipping 11 matching lines...) Expand all
228 REPORTER_ASSERT(reporter, configs.count() == config1.count()); 229 REPORTER_ASSERT(reporter, configs.count() == config1.count());
229 for (int i = 0; i < config1.count(); ++i) { 230 for (int i = 0; i < config1.count(); ++i) {
230 REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i])); 231 REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i]));
231 REPORTER_ASSERT(reporter, configs[i]->getBackend().equals(config1[i])); 232 REPORTER_ASSERT(reporter, configs[i]->getBackend().equals(config1[i]));
232 #if SK_SUPPORT_GPU 233 #if SK_SUPPORT_GPU
233 REPORTER_ASSERT(reporter, !configs[i]->asConfigGpu()); 234 REPORTER_ASSERT(reporter, !configs[i]->asConfigGpu());
234 #endif 235 #endif
235 } 236 }
236 } 237 }
237 238
239
238 DEF_TEST(ParseConfigs_ExtendedGpuConfigsSurprises, reporter) { 240 DEF_TEST(ParseConfigs_ExtendedGpuConfigsSurprises, reporter) {
239 // These just list explicitly some properties of the system. 241 // These just list explicitly some properties of the system.
240 SkCommandLineFlags::StringArray config1 = make_string_array({ 242 SkCommandLineFlags::StringArray config1 = make_string_array({
241 // Options are not canonized -> two same configs have a different tag. 243 // Options are not canonized -> two same configs have a different tag.
242 "gpu(nvpr=true,dit=true)", "gpu(dit=true,nvpr=true)", 244 "gpu(nvpr=true,dit=true)", "gpu(dit=true,nvpr=true)",
243 "gpu(api=debug)", "gpu(api=gl)", "gpu(api=gles)", "" 245 // API native is alias for gl or gles, but it's not canonized -> differe nt tag.
244 "gpu", "gpu()", "gpu(samples=0)", "gpu(api=gles,samples=0)" 246 "gpu(api=native)", "gpu(api=gl)", "gpu(api=gles)", ""
247 // Default values are not canonized -> different tag.
248 "gpu", "gpu()", "gpu(samples=0)", "gpu(api=native,samples=0)"
245 }); 249 });
246 SkCommandLineConfigArray configs; 250 SkCommandLineConfigArray configs;
247 ParseConfigs(config1, &configs); 251 ParseConfigs(config1, &configs);
248 REPORTER_ASSERT(reporter, configs.count() == config1.count()); 252 REPORTER_ASSERT(reporter, configs.count() == config1.count());
249 for (int i = 0; i < config1.count(); ++i) { 253 for (int i = 0; i < config1.count(); ++i) {
250 REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i])); 254 REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i]));
251 #if SK_SUPPORT_GPU 255 #if SK_SUPPORT_GPU
252 REPORTER_ASSERT(reporter, configs[i]->getBackend().equals("gpu")); 256 REPORTER_ASSERT(reporter, configs[i]->getBackend().equals("gpu"));
253 REPORTER_ASSERT(reporter, configs[i]->asConfigGpu()); 257 REPORTER_ASSERT(reporter, configs[i]->asConfigGpu());
254 #else 258 #else
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 REPORTER_ASSERT(reporter, 327 REPORTER_ASSERT(reporter,
324 configs[i]->getViaParts()[j].equals(expectedConfigs[ i].vias[j])); 328 configs[i]->getViaParts()[j].equals(expectedConfigs[ i].vias[j]));
325 } 329 }
326 } 330 }
327 #if SK_SUPPORT_GPU 331 #if SK_SUPPORT_GPU
328 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()); 332 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu());
329 REPORTER_ASSERT(reporter, !configs[1]->asConfigGpu()); 333 REPORTER_ASSERT(reporter, !configs[1]->asConfigGpu());
330 REPORTER_ASSERT(reporter, !configs[2]->asConfigGpu()); 334 REPORTER_ASSERT(reporter, !configs[2]->asConfigGpu());
331 #endif 335 #endif
332 } 336 }
OLDNEW
« no previous file with comments | « tests/SkpSkGrTest.cpp ('k') | tests/VkClearTests.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698