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

Side by Side Diff: tests/TestConfigParsing.cpp

Issue 1845923004: Rename enums in GrContextFactory to remove "GL" (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: working 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
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::kNative_GLContextType); 44 == GrContextFactory::kNativeGL_ContextType);
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::kNative_GLContextType); 167 GrContextFactory::kNativeGL_ContextType);
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_GLContextType); 174 GrContextFactory::kANGLE_ContextType);
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_GLContextType); 179 GrContextFactory::kANGLE_GL_ContextType);
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_GLContextType); 186 GrContextFactory::kMESA_ContextType);
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_GLContextType); 192 GrContextFactory::kCommandBuffer_ContextType);
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::kNative_GLContextType); 198 GrContextFactory::kNativeGL_ContextType);
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_GLContextType); 203 GrContextFactory::kGLES_ContextType);
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
208 #endif 207 #endif
209 } 208 }
210 209
211 DEF_TEST(ParseConfigs_ExtendedGpuConfigsIncorrect, reporter) { 210 DEF_TEST(ParseConfigs_ExtendedGpuConfigsIncorrect, reporter) {
212 SkCommandLineFlags::StringArray config1 = make_string_array({ 211 SkCommandLineFlags::StringArray config1 = make_string_array({
213 "gpu(nvpr=1)", // Number as bool. 212 "gpu(nvpr=1)", // Number as bool.
214 "gpu(api=gl,)", // Trailing in comma. 213 "gpu(api=gl,)", // Trailing in comma.
215 "gpu(api=angle-glu)", // Unknown api. 214 "gpu(api=angle-glu)", // Unknown api.
216 "gpu(api=,samples=0)", // Empty api. 215 "gpu(api=,samples=0)", // Empty api.
217 "gpu(samples=true)", // Value true as a number. 216 "gpu(samples=true)", // Value true as a number.
(...skipping 11 matching lines...) Expand all
229 REPORTER_ASSERT(reporter, configs.count() == config1.count()); 228 REPORTER_ASSERT(reporter, configs.count() == config1.count());
230 for (int i = 0; i < config1.count(); ++i) { 229 for (int i = 0; i < config1.count(); ++i) {
231 REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i])); 230 REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i]));
232 REPORTER_ASSERT(reporter, configs[i]->getBackend().equals(config1[i])); 231 REPORTER_ASSERT(reporter, configs[i]->getBackend().equals(config1[i]));
233 #if SK_SUPPORT_GPU 232 #if SK_SUPPORT_GPU
234 REPORTER_ASSERT(reporter, !configs[i]->asConfigGpu()); 233 REPORTER_ASSERT(reporter, !configs[i]->asConfigGpu());
235 #endif 234 #endif
236 } 235 }
237 } 236 }
238 237
239
240 DEF_TEST(ParseConfigs_ExtendedGpuConfigsSurprises, reporter) { 238 DEF_TEST(ParseConfigs_ExtendedGpuConfigsSurprises, reporter) {
241 // These just list explicitly some properties of the system. 239 // These just list explicitly some properties of the system.
242 SkCommandLineFlags::StringArray config1 = make_string_array({ 240 SkCommandLineFlags::StringArray config1 = make_string_array({
243 // Options are not canonized -> two same configs have a different tag. 241 // Options are not canonized -> two same configs have a different tag.
244 "gpu(nvpr=true,dit=true)", "gpu(dit=true,nvpr=true)", 242 "gpu(nvpr=true,dit=true)", "gpu(dit=true,nvpr=true)",
245 // API native is alias for gl or gles, but it's not canonized -> differe nt tag. 243 "gpu(api=debug)", "gpu(api=gl)", "gpu(api=gles)", ""
246 "gpu(api=native)", "gpu(api=gl)", "gpu(api=gles)", "" 244 "gpu", "gpu()", "gpu(samples=0)", "gpu(api=gles,samples=0)"
247 // Default values are not canonized -> different tag.
248 "gpu", "gpu()", "gpu(samples=0)", "gpu(api=native,samples=0)"
249 }); 245 });
250 SkCommandLineConfigArray configs; 246 SkCommandLineConfigArray configs;
251 ParseConfigs(config1, &configs); 247 ParseConfigs(config1, &configs);
252 REPORTER_ASSERT(reporter, configs.count() == config1.count()); 248 REPORTER_ASSERT(reporter, configs.count() == config1.count());
253 for (int i = 0; i < config1.count(); ++i) { 249 for (int i = 0; i < config1.count(); ++i) {
254 REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i])); 250 REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i]));
255 #if SK_SUPPORT_GPU 251 #if SK_SUPPORT_GPU
256 REPORTER_ASSERT(reporter, configs[i]->getBackend().equals("gpu")); 252 REPORTER_ASSERT(reporter, configs[i]->getBackend().equals("gpu"));
257 REPORTER_ASSERT(reporter, configs[i]->asConfigGpu()); 253 REPORTER_ASSERT(reporter, configs[i]->asConfigGpu());
258 #else 254 #else
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 REPORTER_ASSERT(reporter, 323 REPORTER_ASSERT(reporter,
328 configs[i]->getViaParts()[j].equals(expectedConfigs[ i].vias[j])); 324 configs[i]->getViaParts()[j].equals(expectedConfigs[ i].vias[j]));
329 } 325 }
330 } 326 }
331 #if SK_SUPPORT_GPU 327 #if SK_SUPPORT_GPU
332 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()); 328 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu());
333 REPORTER_ASSERT(reporter, !configs[1]->asConfigGpu()); 329 REPORTER_ASSERT(reporter, !configs[1]->asConfigGpu());
334 REPORTER_ASSERT(reporter, !configs[2]->asConfigGpu()); 330 REPORTER_ASSERT(reporter, !configs[2]->asConfigGpu());
335 #endif 331 #endif
336 } 332 }
OLDNEW
« no previous file with comments | « tests/SkpSkGrTest.cpp ('k') | tests/VkClearTests.cpp » ('j') | tools/gpu/GrContextFactory.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698