| 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 28 matching lines...) Expand all Loading... |
| 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::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()->getColorSpace() == null
ptr); |
| 50 == kLinear_SkColorProfileType); | |
| 51 #endif | 50 #endif |
| 52 } | 51 } |
| 53 | 52 |
| 54 DEF_TEST(ParseConfigs_OutParam, reporter) { | 53 DEF_TEST(ParseConfigs_OutParam, reporter) { |
| 55 // Clears the out parameter. | 54 // Clears the out parameter. |
| 56 SkCommandLineFlags::StringArray config1 = make_string_array({"gpu"}); | 55 SkCommandLineFlags::StringArray config1 = make_string_array({"gpu"}); |
| 57 SkCommandLineConfigArray configs; | 56 SkCommandLineConfigArray configs; |
| 58 ParseConfigs(config1, &configs); | 57 ParseConfigs(config1, &configs); |
| 59 REPORTER_ASSERT(reporter, configs.count() == 1); | 58 REPORTER_ASSERT(reporter, configs.count() == 1); |
| 60 REPORTER_ASSERT(reporter, configs[0]->getTag().equals("gpu")); | 59 REPORTER_ASSERT(reporter, configs[0]->getTag().equals("gpu")); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 76 SkCommandLineFlags::StringArray config1 = make_string_array({ | 75 SkCommandLineFlags::StringArray config1 = make_string_array({ |
| 77 "565", "8888", "debug", "gpu", "gpudebug", "gpudft", "gpunull", "msaa16"
, "msaa4", | 76 "565", "8888", "debug", "gpu", "gpudebug", "gpudft", "gpunull", "msaa16"
, "msaa4", |
| 78 "nonrendering", "null", "nullgpu", "nvpr16", "nvpr4", "nvprdit16", "nvpr
dit4", "pdf", | 77 "nonrendering", "null", "nullgpu", "nvpr16", "nvpr4", "nvprdit16", "nvpr
dit4", "pdf", |
| 79 "skp", "svg", "xps", "angle", "angle-gl", "commandbuffer", "mesa", "hwui
", | 78 "skp", "svg", "xps", "angle", "angle-gl", "commandbuffer", "mesa", "hwui
", |
| 80 "gpuf16", "gpusrgb", "gl", "glnvpr4", "glnvprdit4", "glsrgb", "glmsaa4",
"vk" | 79 "gpuf16", "gpusrgb", "gl", "glnvpr4", "glnvprdit4", "glsrgb", "glmsaa4",
"vk" |
| 81 }); | 80 }); |
| 82 | 81 |
| 83 SkCommandLineConfigArray configs; | 82 SkCommandLineConfigArray configs; |
| 84 ParseConfigs(config1, &configs); | 83 ParseConfigs(config1, &configs); |
| 85 | 84 |
| 85 auto srgbColorSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named); |
| 86 |
| 86 REPORTER_ASSERT(reporter, configs.count() == config1.count()); | 87 REPORTER_ASSERT(reporter, configs.count() == config1.count()); |
| 87 for (int i = 0; i < config1.count(); ++i) { | 88 for (int i = 0; i < config1.count(); ++i) { |
| 88 REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i])); | 89 REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i])); |
| 89 REPORTER_ASSERT(reporter, configs[i]->getViaParts().count() == 0); | 90 REPORTER_ASSERT(reporter, configs[i]->getViaParts().count() == 0); |
| 90 } | 91 } |
| 91 #if SK_SUPPORT_GPU | 92 #if SK_SUPPORT_GPU |
| 92 REPORTER_ASSERT(reporter, !configs[0]->asConfigGpu()); | 93 REPORTER_ASSERT(reporter, !configs[0]->asConfigGpu()); |
| 93 REPORTER_ASSERT(reporter, !configs[1]->asConfigGpu()); | 94 REPORTER_ASSERT(reporter, !configs[1]->asConfigGpu()); |
| 94 REPORTER_ASSERT(reporter, configs[2]->asConfigGpu()); | 95 REPORTER_ASSERT(reporter, configs[2]->asConfigGpu()); |
| 95 REPORTER_ASSERT(reporter, configs[3]->asConfigGpu()); | 96 REPORTER_ASSERT(reporter, configs[3]->asConfigGpu()); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 111 REPORTER_ASSERT(reporter, configs[14]->asConfigGpu()->getUseNVPR()); | 112 REPORTER_ASSERT(reporter, configs[14]->asConfigGpu()->getUseNVPR()); |
| 112 REPORTER_ASSERT(reporter, configs[14]->asConfigGpu()->getUseDIText()); | 113 REPORTER_ASSERT(reporter, configs[14]->asConfigGpu()->getUseDIText()); |
| 113 REPORTER_ASSERT(reporter, configs[15]->asConfigGpu()->getSamples() == 4); | 114 REPORTER_ASSERT(reporter, configs[15]->asConfigGpu()->getSamples() == 4); |
| 114 REPORTER_ASSERT(reporter, configs[15]->asConfigGpu()->getUseNVPR()); | 115 REPORTER_ASSERT(reporter, configs[15]->asConfigGpu()->getUseNVPR()); |
| 115 REPORTER_ASSERT(reporter, configs[15]->asConfigGpu()->getUseDIText()); | 116 REPORTER_ASSERT(reporter, configs[15]->asConfigGpu()->getUseDIText()); |
| 116 REPORTER_ASSERT(reporter, !configs[16]->asConfigGpu()); | 117 REPORTER_ASSERT(reporter, !configs[16]->asConfigGpu()); |
| 117 REPORTER_ASSERT(reporter, !configs[17]->asConfigGpu()); | 118 REPORTER_ASSERT(reporter, !configs[17]->asConfigGpu()); |
| 118 REPORTER_ASSERT(reporter, !configs[18]->asConfigGpu()); | 119 REPORTER_ASSERT(reporter, !configs[18]->asConfigGpu()); |
| 119 REPORTER_ASSERT(reporter, !configs[19]->asConfigGpu()); | 120 REPORTER_ASSERT(reporter, !configs[19]->asConfigGpu()); |
| 120 REPORTER_ASSERT(reporter, !configs[24]->asConfigGpu()); | 121 REPORTER_ASSERT(reporter, !configs[24]->asConfigGpu()); |
| 121 REPORTER_ASSERT(reporter, configs[25]->asConfigGpu()->getColorType() | 122 REPORTER_ASSERT(reporter, configs[25]->asConfigGpu()->getColorType() == kRGB
A_F16_SkColorType); |
| 122 == kRGBA_F16_SkColorType); | 123 REPORTER_ASSERT(reporter, configs[25]->asConfigGpu()->getColorSpace() == nul
lptr); |
| 123 REPORTER_ASSERT(reporter, configs[25]->asConfigGpu()->getProfileType() | 124 REPORTER_ASSERT(reporter, configs[26]->asConfigGpu()->getColorType() == kN32
_SkColorType); |
| 124 == kLinear_SkColorProfileType); | 125 REPORTER_ASSERT(reporter, configs[26]->asConfigGpu()->getColorSpace() == srg
bColorSpace.get()); |
| 125 REPORTER_ASSERT(reporter, configs[26]->asConfigGpu()->getColorType() | 126 |
| 126 == kN32_SkColorType); | |
| 127 REPORTER_ASSERT(reporter, configs[26]->asConfigGpu()->getProfileType() | |
| 128 == kSRGB_SkColorProfileType); | |
| 129 #if SK_ANGLE | 127 #if SK_ANGLE |
| 130 #ifdef SK_BUILD_FOR_WIN | 128 #ifdef SK_BUILD_FOR_WIN |
| 131 REPORTER_ASSERT(reporter, configs[20]->asConfigGpu()); | 129 REPORTER_ASSERT(reporter, configs[20]->asConfigGpu()); |
| 132 #else | 130 #else |
| 133 REPORTER_ASSERT(reporter, !configs[20]->asConfigGpu()); | 131 REPORTER_ASSERT(reporter, !configs[20]->asConfigGpu()); |
| 134 #endif | 132 #endif |
| 135 REPORTER_ASSERT(reporter, configs[21]->asConfigGpu()); | 133 REPORTER_ASSERT(reporter, configs[21]->asConfigGpu()); |
| 136 #else | 134 #else |
| 137 REPORTER_ASSERT(reporter, !configs[20]->asConfigGpu()); | 135 REPORTER_ASSERT(reporter, !configs[20]->asConfigGpu()); |
| 138 REPORTER_ASSERT(reporter, !configs[21]->asConfigGpu()); | 136 REPORTER_ASSERT(reporter, !configs[21]->asConfigGpu()); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 150 REPORTER_ASSERT(reporter, configs[27]->asConfigGpu()); | 148 REPORTER_ASSERT(reporter, configs[27]->asConfigGpu()); |
| 151 REPORTER_ASSERT(reporter, configs[28]->asConfigGpu()); | 149 REPORTER_ASSERT(reporter, configs[28]->asConfigGpu()); |
| 152 REPORTER_ASSERT(reporter, configs[28]->asConfigGpu()->getSamples() == 4); | 150 REPORTER_ASSERT(reporter, configs[28]->asConfigGpu()->getSamples() == 4); |
| 153 REPORTER_ASSERT(reporter, configs[28]->asConfigGpu()->getUseNVPR()); | 151 REPORTER_ASSERT(reporter, configs[28]->asConfigGpu()->getUseNVPR()); |
| 154 REPORTER_ASSERT(reporter, configs[29]->asConfigGpu()); | 152 REPORTER_ASSERT(reporter, configs[29]->asConfigGpu()); |
| 155 REPORTER_ASSERT(reporter, configs[29]->asConfigGpu()->getSamples() == 4); | 153 REPORTER_ASSERT(reporter, configs[29]->asConfigGpu()->getSamples() == 4); |
| 156 REPORTER_ASSERT(reporter, configs[29]->asConfigGpu()->getUseNVPR()); | 154 REPORTER_ASSERT(reporter, configs[29]->asConfigGpu()->getUseNVPR()); |
| 157 REPORTER_ASSERT(reporter, configs[29]->asConfigGpu()->getUseDIText()); | 155 REPORTER_ASSERT(reporter, configs[29]->asConfigGpu()->getUseDIText()); |
| 158 REPORTER_ASSERT(reporter, configs[30]->asConfigGpu()); | 156 REPORTER_ASSERT(reporter, configs[30]->asConfigGpu()); |
| 159 REPORTER_ASSERT(reporter, configs[30]->asConfigGpu()->getColorType() == kN3
2_SkColorType); | 157 REPORTER_ASSERT(reporter, configs[30]->asConfigGpu()->getColorType() == kN3
2_SkColorType); |
| 160 REPORTER_ASSERT(reporter, configs[30]->asConfigGpu()->getProfileType() == | 158 REPORTER_ASSERT(reporter, configs[30]->asConfigGpu()->getColorSpace() == srg
bColorSpace.get()); |
| 161 kSRGB_SkColorProfileType); | |
| 162 REPORTER_ASSERT(reporter, configs[31]->asConfigGpu()); | 159 REPORTER_ASSERT(reporter, configs[31]->asConfigGpu()); |
| 163 REPORTER_ASSERT(reporter, configs[31]->asConfigGpu()->getSamples() == 4); | 160 REPORTER_ASSERT(reporter, configs[31]->asConfigGpu()->getSamples() == 4); |
| 164 #ifdef SK_VULKAN | 161 #ifdef SK_VULKAN |
| 165 REPORTER_ASSERT(reporter, configs[32]->asConfigGpu()); | 162 REPORTER_ASSERT(reporter, configs[32]->asConfigGpu()); |
| 166 #endif | 163 #endif |
| 167 #endif | 164 #endif |
| 168 } | 165 } |
| 169 | 166 |
| 170 DEF_TEST(ParseConfigs_ExtendedGpuConfigsCorrect, reporter) { | 167 DEF_TEST(ParseConfigs_ExtendedGpuConfigsCorrect, reporter) { |
| 171 SkCommandLineFlags::StringArray config1 = make_string_array({ | 168 SkCommandLineFlags::StringArray config1 = make_string_array({ |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 REPORTER_ASSERT(reporter, | 356 REPORTER_ASSERT(reporter, |
| 360 configs[i]->getViaParts()[j].equals(expectedConfigs[
i].vias[j])); | 357 configs[i]->getViaParts()[j].equals(expectedConfigs[
i].vias[j])); |
| 361 } | 358 } |
| 362 } | 359 } |
| 363 #if SK_SUPPORT_GPU | 360 #if SK_SUPPORT_GPU |
| 364 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()); | 361 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()); |
| 365 REPORTER_ASSERT(reporter, !configs[1]->asConfigGpu()); | 362 REPORTER_ASSERT(reporter, !configs[1]->asConfigGpu()); |
| 366 REPORTER_ASSERT(reporter, !configs[2]->asConfigGpu()); | 363 REPORTER_ASSERT(reporter, !configs[2]->asConfigGpu()); |
| 367 #endif | 364 #endif |
| 368 } | 365 } |
| OLD | NEW |