Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 | |
| 61 SkCommandLineFlags::StringArray config2 = make_string_array({"8888"}); | 62 SkCommandLineFlags::StringArray config2 = make_string_array({"8888"}); |
| 62 ParseConfigs(config2, &configs); | 63 ParseConfigs(config2, &configs); |
| 63 REPORTER_ASSERT(reporter, configs.count() == 1); | 64 REPORTER_ASSERT(reporter, configs.count() == 1); |
| 64 REPORTER_ASSERT(reporter, configs[0]->getTag().equals("8888")); | 65 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")); | |
| 65 } | 71 } |
| 66 | 72 |
| 67 DEF_TEST(ParseConfigs_DefaultConfigs, reporter) { | 73 DEF_TEST(ParseConfigs_DefaultConfigs, reporter) { |
| 68 // Parses all default configs and returns correct "tag". | 74 // Parses all default configs and returns correct "tag". |
| 69 | 75 |
| 70 SkCommandLineFlags::StringArray config1 = make_string_array({ | 76 SkCommandLineFlags::StringArray config1 = make_string_array({ |
| 71 "565", "8888", "debug", "gpu", "gpudebug", "gpudft", "gpunull", "msaa16" , "msaa4", | 77 "565", "8888", "debug", "gpu", "gpudebug", "gpudft", "gpunull", "msaa16" , "msaa4", |
| 72 "nonrendering", "null", "nullgpu", "nvpr16", "nvpr4", "nvprdit16", "nvpr dit4", "pdf", | 78 "nonrendering", "null", "nullgpu", "nvpr16", "nvpr4", "nvprdit16", "nvpr dit4", "pdf", |
| 73 "pdf_poppler", "skp", "svg", "xps", "angle", "angle-gl", "commandbuffer" , "mesa", "hwui", | 79 "pdf_poppler", "skp", "svg", "xps", "angle", "angle-gl", "commandbuffer" , "mesa", "hwui", |
| 74 "gpuf16", "gpusrgb" | 80 "gpuf16", "gpusrgb", "gl", "glnvpr4", "glnvprdit4", "glsrgb", "glmsaa4" |
| 75 }); | 81 }); |
| 76 | 82 |
| 77 SkCommandLineConfigArray configs; | 83 SkCommandLineConfigArray configs; |
| 78 ParseConfigs(config1, &configs); | 84 ParseConfigs(config1, &configs); |
| 79 | 85 |
| 80 REPORTER_ASSERT(reporter, configs.count() == config1.count()); | 86 REPORTER_ASSERT(reporter, configs.count() == config1.count()); |
| 81 for (int i = 0; i < config1.count(); ++i) { | 87 for (int i = 0; i < config1.count(); ++i) { |
| 82 REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i])); | 88 REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i])); |
| 83 REPORTER_ASSERT(reporter, configs[i]->getViaParts().count() == 0); | 89 REPORTER_ASSERT(reporter, configs[i]->getViaParts().count() == 0); |
| 84 } | 90 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 #if SK_COMMAND_BUFFER | 141 #if SK_COMMAND_BUFFER |
| 136 REPORTER_ASSERT(reporter, configs[23]->asConfigGpu()); | 142 REPORTER_ASSERT(reporter, configs[23]->asConfigGpu()); |
| 137 #else | 143 #else |
| 138 REPORTER_ASSERT(reporter, !configs[23]->asConfigGpu()); | 144 REPORTER_ASSERT(reporter, !configs[23]->asConfigGpu()); |
| 139 #endif | 145 #endif |
| 140 #if SK_MESA | 146 #if SK_MESA |
| 141 REPORTER_ASSERT(reporter, configs[24]->asConfigGpu()); | 147 REPORTER_ASSERT(reporter, configs[24]->asConfigGpu()); |
| 142 #else | 148 #else |
| 143 REPORTER_ASSERT(reporter, !configs[24]->asConfigGpu()); | 149 REPORTER_ASSERT(reporter, !configs[24]->asConfigGpu()); |
| 144 #endif | 150 #endif |
| 151 REPORTER_ASSERT(reporter, configs[28]->asConfigGpu()); | |
| 152 REPORTER_ASSERT(reporter, configs[29]->asConfigGpu()); | |
| 153 REPORTER_ASSERT(reporter, configs[29]->asConfigGpu()->getSamples() == 4); | |
| 154 REPORTER_ASSERT(reporter, configs[29]->asConfigGpu()->getUseNVPR()); | |
| 155 REPORTER_ASSERT(reporter, configs[30]->asConfigGpu()); | |
|
egdaniel
2016/04/04 19:09:19
currently in ToT there is a bug with the current i
| |
| 156 REPORTER_ASSERT(reporter, configs[30]->asConfigGpu()->getSamples() == 4); | |
| 157 REPORTER_ASSERT(reporter, configs[30]->asConfigGpu()->getUseNVPR()); | |
| 158 REPORTER_ASSERT(reporter, configs[30]->asConfigGpu()->getUseDIText()); | |
| 159 REPORTER_ASSERT(reporter, configs[31]->asConfigGpu()); | |
| 160 REPORTER_ASSERT(reporter, configs[31]->asConfigGpu()->getColorType() | |
| 161 == kN32_SkColorType); | |
| 162 REPORTER_ASSERT(reporter, configs[31]->asConfigGpu()->getProfileType() | |
| 163 == kSRGB_SkColorProfileType); | |
| 164 REPORTER_ASSERT(reporter, configs[32]->asConfigGpu()); | |
| 165 REPORTER_ASSERT(reporter, configs[32]->asConfigGpu()->getSamples() == 4); | |
| 145 #endif | 166 #endif |
| 146 } | 167 } |
| 147 | 168 |
| 148 DEF_TEST(ParseConfigs_ExtendedGpuConfigsCorrect, reporter) { | 169 DEF_TEST(ParseConfigs_ExtendedGpuConfigsCorrect, reporter) { |
| 149 SkCommandLineFlags::StringArray config1 = make_string_array({ | 170 SkCommandLineFlags::StringArray config1 = make_string_array({ |
| 150 "gpu(nvpr=true,dit=false)", | 171 "gpu(nvpr=true,dit=false)", |
| 151 "gpu(api=angle)", | 172 "gpu(api=angle)", |
| 152 "gpu(api=angle-gl)", | 173 "gpu(api=angle-gl)", |
| 153 "gpu(api=mesa,samples=77)", | 174 "gpu(api=mesa,samples=77)", |
| 154 "gpu(dit=true,api=commandbuffer)", | 175 "gpu(dit=true,api=commandbuffer)", |
| 155 "gpu()", | 176 "gpu()", |
| 156 "gpu(api=gles)" | 177 "gpu(api=gles)", |
| 178 "gpu(api=gl)" | |
| 157 }); | 179 }); |
| 158 | 180 |
| 159 SkCommandLineConfigArray configs; | 181 SkCommandLineConfigArray configs; |
| 160 ParseConfigs(config1, &configs); | 182 ParseConfigs(config1, &configs); |
| 161 REPORTER_ASSERT(reporter, configs.count() == config1.count()); | 183 REPORTER_ASSERT(reporter, configs.count() == config1.count()); |
| 162 for (int i = 0; i < config1.count(); ++i) { | 184 for (int i = 0; i < config1.count(); ++i) { |
| 163 REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i])); | 185 REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i])); |
| 164 } | 186 } |
| 165 #if SK_SUPPORT_GPU | 187 #if SK_SUPPORT_GPU |
| 166 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getContextType() == | 188 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getContextType() == |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 197 REPORTER_ASSERT(reporter, configs[5]->asConfigGpu()->getContextType() == | 219 REPORTER_ASSERT(reporter, configs[5]->asConfigGpu()->getContextType() == |
| 198 GrContextFactory::kNativeGL_ContextType); | 220 GrContextFactory::kNativeGL_ContextType); |
| 199 REPORTER_ASSERT(reporter, !configs[5]->asConfigGpu()->getUseNVPR()); | 221 REPORTER_ASSERT(reporter, !configs[5]->asConfigGpu()->getUseNVPR()); |
| 200 REPORTER_ASSERT(reporter, !configs[5]->asConfigGpu()->getUseDIText()); | 222 REPORTER_ASSERT(reporter, !configs[5]->asConfigGpu()->getUseDIText()); |
| 201 REPORTER_ASSERT(reporter, configs[5]->asConfigGpu()->getSamples() == 0); | 223 REPORTER_ASSERT(reporter, configs[5]->asConfigGpu()->getSamples() == 0); |
| 202 REPORTER_ASSERT(reporter, configs[6]->asConfigGpu()->getContextType() == | 224 REPORTER_ASSERT(reporter, configs[6]->asConfigGpu()->getContextType() == |
| 203 GrContextFactory::kGLES_ContextType); | 225 GrContextFactory::kGLES_ContextType); |
| 204 REPORTER_ASSERT(reporter, !configs[6]->asConfigGpu()->getUseNVPR()); | 226 REPORTER_ASSERT(reporter, !configs[6]->asConfigGpu()->getUseNVPR()); |
| 205 REPORTER_ASSERT(reporter, !configs[6]->asConfigGpu()->getUseDIText()); | 227 REPORTER_ASSERT(reporter, !configs[6]->asConfigGpu()->getUseDIText()); |
| 206 REPORTER_ASSERT(reporter, configs[6]->asConfigGpu()->getSamples() == 0); | 228 REPORTER_ASSERT(reporter, configs[6]->asConfigGpu()->getSamples() == 0); |
| 229 REPORTER_ASSERT(reporter, configs[7]->asConfigGpu()->getContextType() == | |
| 230 GrContextFactory::kGL_ContextType); | |
| 231 REPORTER_ASSERT(reporter, !configs[7]->asConfigGpu()->getUseNVPR()); | |
| 232 REPORTER_ASSERT(reporter, !configs[7]->asConfigGpu()->getUseDIText()); | |
| 233 REPORTER_ASSERT(reporter, configs[7]->asConfigGpu()->getSamples() == 0); | |
| 207 #endif | 234 #endif |
| 208 } | 235 } |
| 209 | 236 |
| 210 DEF_TEST(ParseConfigs_ExtendedGpuConfigsIncorrect, reporter) { | 237 DEF_TEST(ParseConfigs_ExtendedGpuConfigsIncorrect, reporter) { |
| 211 SkCommandLineFlags::StringArray config1 = make_string_array({ | 238 SkCommandLineFlags::StringArray config1 = make_string_array({ |
| 212 "gpu(nvpr=1)", // Number as bool. | 239 "gpu(nvpr=1)", // Number as bool. |
| 213 "gpu(api=gl,)", // Trailing in comma. | 240 "gpu(api=gl,)", // Trailing in comma. |
| 214 "gpu(api=angle-glu)", // Unknown api. | 241 "gpu(api=angle-glu)", // Unknown api. |
| 215 "gpu(api=,samples=0)", // Empty api. | 242 "gpu(api=,samples=0)", // Empty api. |
| 216 "gpu(samples=true)", // Value true as a number. | 243 "gpu(samples=true)", // Value true as a number. |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 323 REPORTER_ASSERT(reporter, | 350 REPORTER_ASSERT(reporter, |
| 324 configs[i]->getViaParts()[j].equals(expectedConfigs[ i].vias[j])); | 351 configs[i]->getViaParts()[j].equals(expectedConfigs[ i].vias[j])); |
| 325 } | 352 } |
| 326 } | 353 } |
| 327 #if SK_SUPPORT_GPU | 354 #if SK_SUPPORT_GPU |
| 328 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()); | 355 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()); |
| 329 REPORTER_ASSERT(reporter, !configs[1]->asConfigGpu()); | 356 REPORTER_ASSERT(reporter, !configs[1]->asConfigGpu()); |
| 330 REPORTER_ASSERT(reporter, !configs[2]->asConfigGpu()); | 357 REPORTER_ASSERT(reporter, !configs[2]->asConfigGpu()); |
| 331 #endif | 358 #endif |
| 332 } | 359 } |
| OLD | NEW |