| 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 "SkColorSpace.h" | 9 #include "SkColorSpace.h" |
| 10 #include "Test.h" | 10 #include "Test.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 ParseConfigs(config1, &configs); | 37 ParseConfigs(config1, &configs); |
| 38 | 38 |
| 39 REPORTER_ASSERT(reporter, configs.count() == 1); | 39 REPORTER_ASSERT(reporter, configs.count() == 1); |
| 40 REPORTER_ASSERT(reporter, configs[0]->getTag().equals("gpu")); | 40 REPORTER_ASSERT(reporter, configs[0]->getTag().equals("gpu")); |
| 41 REPORTER_ASSERT(reporter, configs[0]->getViaParts().count() == 0); | 41 REPORTER_ASSERT(reporter, configs[0]->getViaParts().count() == 0); |
| 42 #if SK_SUPPORT_GPU | 42 #if SK_SUPPORT_GPU |
| 43 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()); | 43 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()); |
| 44 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getContextType() | 44 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getContextType() |
| 45 == GrContextFactory::kNativeGL_ContextType); | 45 == GrContextFactory::kNativeGL_ContextType); |
| 46 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getUseNVPR() == false); | 46 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getUseNVPR() == false); |
| 47 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getUseInstanced() == fa
lse); |
| 47 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getUseDIText() == false
); | 48 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getUseDIText() == false
); |
| 48 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getSamples() == 0); | 49 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getSamples() == 0); |
| 49 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getColorType() == kN32_
SkColorType); | 50 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getColorType() == kN32_
SkColorType); |
| 50 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getColorSpace() == null
ptr); | 51 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getColorSpace() == null
ptr); |
| 51 #endif | 52 #endif |
| 52 } | 53 } |
| 53 | 54 |
| 54 DEF_TEST(ParseConfigs_OutParam, reporter) { | 55 DEF_TEST(ParseConfigs_OutParam, reporter) { |
| 55 // Clears the out parameter. | 56 // Clears the out parameter. |
| 56 SkCommandLineFlags::StringArray config1 = make_string_array({"gpu"}); | 57 SkCommandLineFlags::StringArray config1 = make_string_array({"gpu"}); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 68 ParseConfigs(config3, &configs); | 69 ParseConfigs(config3, &configs); |
| 69 REPORTER_ASSERT(reporter, configs.count() == 1); | 70 REPORTER_ASSERT(reporter, configs.count() == 1); |
| 70 REPORTER_ASSERT(reporter, configs[0]->getTag().equals("gl")); | 71 REPORTER_ASSERT(reporter, configs[0]->getTag().equals("gl")); |
| 71 } | 72 } |
| 72 | 73 |
| 73 DEF_TEST(ParseConfigs_DefaultConfigs, reporter) { | 74 DEF_TEST(ParseConfigs_DefaultConfigs, reporter) { |
| 74 // Parses all default configs and returns correct "tag". | 75 // Parses all default configs and returns correct "tag". |
| 75 | 76 |
| 76 SkCommandLineFlags::StringArray config1 = make_string_array({ | 77 SkCommandLineFlags::StringArray config1 = make_string_array({ |
| 77 "565", "8888", "debug", "gpu", "gpudebug", "gpudft", "gpunull", "msaa16"
, "msaa4", | 78 "565", "8888", "debug", "gpu", "gpudebug", "gpudft", "gpunull", "msaa16"
, "msaa4", |
| 78 "nonrendering", "null", "nullgpu", "nvpr16", "nvpr4", "nvprdit16", "nvpr
dit4", "pdf", | 79 "nonrendering", "null", "nullgpu", "nvpr16", "nvpr4", "nvprdit16", "nvpr
dit4", "pdf", "skp", |
| 79 "skp", "svg", "xps", "angle", "angle-gl", "commandbuffer", "mesa", "hwui
", | 80 "svg", "xps", "angle", "angle-gl", "commandbuffer", "mesa", "hwui", "gpu
f16", "gpusrgb", |
| 80 "gpuf16", "gpusrgb", "gl", "glnvpr4", "glnvprdit4", "glsrgb", "glmsaa4",
"vk" | 81 "gl", "glnvpr4", "glnvprdit4", "glsrgb", "glmsaa4", "vk", "glinst", "gli
nst4", "glinstdit4", |
| 82 "glinst16", "glinstdit16", "esinst", "esinst4", "esinstdit4" |
| 81 }); | 83 }); |
| 82 | 84 |
| 83 SkCommandLineConfigArray configs; | 85 SkCommandLineConfigArray configs; |
| 84 ParseConfigs(config1, &configs); | 86 ParseConfigs(config1, &configs); |
| 85 | 87 |
| 86 auto srgbColorSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named); | 88 auto srgbColorSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named); |
| 87 | 89 |
| 88 REPORTER_ASSERT(reporter, configs.count() == config1.count()); | 90 REPORTER_ASSERT(reporter, configs.count() == config1.count()); |
| 89 for (int i = 0; i < config1.count(); ++i) { | 91 for (int i = 0; i < config1.count(); ++i) { |
| 90 REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i])); | 92 REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i])); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 117 REPORTER_ASSERT(reporter, configs[15]->asConfigGpu()->getUseDIText()); | 119 REPORTER_ASSERT(reporter, configs[15]->asConfigGpu()->getUseDIText()); |
| 118 REPORTER_ASSERT(reporter, !configs[16]->asConfigGpu()); | 120 REPORTER_ASSERT(reporter, !configs[16]->asConfigGpu()); |
| 119 REPORTER_ASSERT(reporter, !configs[17]->asConfigGpu()); | 121 REPORTER_ASSERT(reporter, !configs[17]->asConfigGpu()); |
| 120 REPORTER_ASSERT(reporter, !configs[18]->asConfigGpu()); | 122 REPORTER_ASSERT(reporter, !configs[18]->asConfigGpu()); |
| 121 REPORTER_ASSERT(reporter, !configs[19]->asConfigGpu()); | 123 REPORTER_ASSERT(reporter, !configs[19]->asConfigGpu()); |
| 122 REPORTER_ASSERT(reporter, !configs[24]->asConfigGpu()); | 124 REPORTER_ASSERT(reporter, !configs[24]->asConfigGpu()); |
| 123 REPORTER_ASSERT(reporter, configs[25]->asConfigGpu()->getColorType() == kRGB
A_F16_SkColorType); | 125 REPORTER_ASSERT(reporter, configs[25]->asConfigGpu()->getColorType() == kRGB
A_F16_SkColorType); |
| 124 REPORTER_ASSERT(reporter, configs[25]->asConfigGpu()->getColorSpace() == srg
bColorSpace.get()); | 126 REPORTER_ASSERT(reporter, configs[25]->asConfigGpu()->getColorSpace() == srg
bColorSpace.get()); |
| 125 REPORTER_ASSERT(reporter, configs[26]->asConfigGpu()->getColorType() == kN32
_SkColorType); | 127 REPORTER_ASSERT(reporter, configs[26]->asConfigGpu()->getColorType() == kN32
_SkColorType); |
| 126 REPORTER_ASSERT(reporter, configs[26]->asConfigGpu()->getColorSpace() == srg
bColorSpace.get()); | 128 REPORTER_ASSERT(reporter, configs[26]->asConfigGpu()->getColorSpace() == srg
bColorSpace.get()); |
| 129 REPORTER_ASSERT(reporter, configs[33]->asConfigGpu()->getContextType() == |
| 130 GrContextFactory::kGL_ContextType); |
| 131 REPORTER_ASSERT(reporter, configs[33]->asConfigGpu()->getUseInstanced()); |
| 132 REPORTER_ASSERT(reporter, configs[34]->asConfigGpu()->getContextType() == |
| 133 GrContextFactory::kGL_ContextType); |
| 134 REPORTER_ASSERT(reporter, configs[34]->asConfigGpu()->getUseInstanced()); |
| 135 REPORTER_ASSERT(reporter, configs[34]->asConfigGpu()->getSamples() == 4); |
| 136 REPORTER_ASSERT(reporter, configs[35]->asConfigGpu()->getContextType() == |
| 137 GrContextFactory::kGL_ContextType); |
| 138 REPORTER_ASSERT(reporter, configs[35]->asConfigGpu()->getUseInstanced()); |
| 139 REPORTER_ASSERT(reporter, configs[35]->asConfigGpu()->getUseDIText()); |
| 140 REPORTER_ASSERT(reporter, configs[35]->asConfigGpu()->getSamples() == 4); |
| 141 REPORTER_ASSERT(reporter, configs[36]->asConfigGpu()->getContextType() == |
| 142 GrContextFactory::kGL_ContextType); |
| 143 REPORTER_ASSERT(reporter, configs[36]->asConfigGpu()->getUseInstanced()); |
| 144 REPORTER_ASSERT(reporter, configs[36]->asConfigGpu()->getSamples() == 16); |
| 145 REPORTER_ASSERT(reporter, configs[37]->asConfigGpu()->getContextType() == |
| 146 GrContextFactory::kGL_ContextType); |
| 147 REPORTER_ASSERT(reporter, configs[37]->asConfigGpu()->getUseInstanced()); |
| 148 REPORTER_ASSERT(reporter, configs[37]->asConfigGpu()->getUseDIText()); |
| 149 REPORTER_ASSERT(reporter, configs[37]->asConfigGpu()->getSamples() == 16); |
| 150 REPORTER_ASSERT(reporter, configs[38]->asConfigGpu()->getContextType() == |
| 151 GrContextFactory::kGLES_ContextType); |
| 152 REPORTER_ASSERT(reporter, configs[38]->asConfigGpu()->getUseInstanced()); |
| 153 REPORTER_ASSERT(reporter, configs[39]->asConfigGpu()->getContextType() == |
| 154 GrContextFactory::kGLES_ContextType); |
| 155 REPORTER_ASSERT(reporter, configs[39]->asConfigGpu()->getUseInstanced()); |
| 156 REPORTER_ASSERT(reporter, configs[39]->asConfigGpu()->getSamples() == 4); |
| 157 REPORTER_ASSERT(reporter, configs[40]->asConfigGpu()->getContextType() == |
| 158 GrContextFactory::kGLES_ContextType); |
| 159 REPORTER_ASSERT(reporter, configs[40]->asConfigGpu()->getUseInstanced()); |
| 160 REPORTER_ASSERT(reporter, configs[40]->asConfigGpu()->getUseDIText()); |
| 161 REPORTER_ASSERT(reporter, configs[40]->asConfigGpu()->getSamples() == 4); |
| 127 | 162 |
| 128 #if SK_ANGLE | 163 #if SK_ANGLE |
| 129 #ifdef SK_BUILD_FOR_WIN | 164 #ifdef SK_BUILD_FOR_WIN |
| 130 REPORTER_ASSERT(reporter, configs[20]->asConfigGpu()); | 165 REPORTER_ASSERT(reporter, configs[20]->asConfigGpu()); |
| 131 #else | 166 #else |
| 132 REPORTER_ASSERT(reporter, !configs[20]->asConfigGpu()); | 167 REPORTER_ASSERT(reporter, !configs[20]->asConfigGpu()); |
| 133 #endif | 168 #endif |
| 134 REPORTER_ASSERT(reporter, configs[21]->asConfigGpu()); | 169 REPORTER_ASSERT(reporter, configs[21]->asConfigGpu()); |
| 135 #else | 170 #else |
| 136 REPORTER_ASSERT(reporter, !configs[20]->asConfigGpu()); | 171 REPORTER_ASSERT(reporter, !configs[20]->asConfigGpu()); |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 REPORTER_ASSERT(reporter, | 396 REPORTER_ASSERT(reporter, |
| 362 configs[i]->getViaParts()[j].equals(expectedConfigs[
i].vias[j])); | 397 configs[i]->getViaParts()[j].equals(expectedConfigs[
i].vias[j])); |
| 363 } | 398 } |
| 364 } | 399 } |
| 365 #if SK_SUPPORT_GPU | 400 #if SK_SUPPORT_GPU |
| 366 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()); | 401 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()); |
| 367 REPORTER_ASSERT(reporter, !configs[1]->asConfigGpu()); | 402 REPORTER_ASSERT(reporter, !configs[1]->asConfigGpu()); |
| 368 REPORTER_ASSERT(reporter, !configs[2]->asConfigGpu()); | 403 REPORTER_ASSERT(reporter, !configs[2]->asConfigGpu()); |
| 369 #endif | 404 #endif |
| 370 } | 405 } |
| OLD | NEW |