| 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 25 matching lines...) Expand all Loading... |
| 36 REPORTER_ASSERT(reporter, configs.count() == 1); | 36 REPORTER_ASSERT(reporter, configs.count() == 1); |
| 37 REPORTER_ASSERT(reporter, configs[0]->getTag().equals("gpu")); | 37 REPORTER_ASSERT(reporter, configs[0]->getTag().equals("gpu")); |
| 38 REPORTER_ASSERT(reporter, configs[0]->getViaParts().count() == 0); | 38 REPORTER_ASSERT(reporter, configs[0]->getViaParts().count() == 0); |
| 39 #if SK_SUPPORT_GPU | 39 #if SK_SUPPORT_GPU |
| 40 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()); | 40 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()); |
| 41 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getContextType() | 41 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getContextType() |
| 42 == GrContextFactory::kNative_GLContextType); | 42 == GrContextFactory::kNative_GLContextType); |
| 43 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getUseNVPR() == false); | 43 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getUseNVPR() == false); |
| 44 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getUseDIText() == false
); | 44 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getUseDIText() == false
); |
| 45 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getSamples() == 0); | 45 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getSamples() == 0); |
| 46 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getColorType() == kN32_
SkColorType); |
| 47 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()->getProfileType() |
| 48 == kLinear_SkColorProfileType); |
| 46 #endif | 49 #endif |
| 47 } | 50 } |
| 48 | 51 |
| 49 DEF_TEST(ParseConfigs_OutParam, reporter) { | 52 DEF_TEST(ParseConfigs_OutParam, reporter) { |
| 50 // Clears the out parameter. | 53 // Clears the out parameter. |
| 51 SkCommandLineFlags::StringArray config1 = make_string_array({"gpu"}); | 54 SkCommandLineFlags::StringArray config1 = make_string_array({"gpu"}); |
| 52 SkCommandLineConfigArray configs; | 55 SkCommandLineConfigArray configs; |
| 53 ParseConfigs(config1, &configs); | 56 ParseConfigs(config1, &configs); |
| 54 REPORTER_ASSERT(reporter, configs.count() == 1); | 57 REPORTER_ASSERT(reporter, configs.count() == 1); |
| 55 REPORTER_ASSERT(reporter, configs[0]->getTag().equals("gpu")); | 58 REPORTER_ASSERT(reporter, configs[0]->getTag().equals("gpu")); |
| 56 SkCommandLineFlags::StringArray config2 = make_string_array({"8888"}); | 59 SkCommandLineFlags::StringArray config2 = make_string_array({"8888"}); |
| 57 ParseConfigs(config2, &configs); | 60 ParseConfigs(config2, &configs); |
| 58 REPORTER_ASSERT(reporter, configs.count() == 1); | 61 REPORTER_ASSERT(reporter, configs.count() == 1); |
| 59 REPORTER_ASSERT(reporter, configs[0]->getTag().equals("8888")); | 62 REPORTER_ASSERT(reporter, configs[0]->getTag().equals("8888")); |
| 60 } | 63 } |
| 61 | 64 |
| 62 DEF_TEST(ParseConfigs_DefaultConfigs, reporter) { | 65 DEF_TEST(ParseConfigs_DefaultConfigs, reporter) { |
| 63 // Parses all default configs and returns correct "tag". | 66 // Parses all default configs and returns correct "tag". |
| 64 | 67 |
| 65 SkCommandLineFlags::StringArray config1 = make_string_array({ | 68 SkCommandLineFlags::StringArray config1 = make_string_array({ |
| 66 "565", "8888", "debug", "gpu", "gpudebug", "gpudft", "gpunull", "msaa16"
, "msaa4", | 69 "565", "8888", "debug", "gpu", "gpudebug", "gpudft", "gpunull", "msaa16"
, "msaa4", |
| 67 "nonrendering", "null", "nullgpu", "nvprmsaa16", "nvprmsaa4", "pdf", "pd
f_poppler", | 70 "nonrendering", "null", "nullgpu", "nvprmsaa16", "nvprmsaa4", "pdf", "pd
f_poppler", |
| 68 "skp", "svg", "xps", "angle", "angle-gl", "commandbuffer", "mesa", "hwui
" | 71 "skp", "svg", "xps", "angle", "angle-gl", "commandbuffer", "mesa", "hwui
", |
| 72 "gpuf16", "gpusrgb", "anglesrgb" |
| 69 }); | 73 }); |
| 70 | 74 |
| 71 SkCommandLineConfigArray configs; | 75 SkCommandLineConfigArray configs; |
| 72 ParseConfigs(config1, &configs); | 76 ParseConfigs(config1, &configs); |
| 73 | 77 |
| 74 REPORTER_ASSERT(reporter, configs.count() == config1.count()); | 78 REPORTER_ASSERT(reporter, configs.count() == config1.count()); |
| 75 for (int i = 0; i < config1.count(); ++i) { | 79 for (int i = 0; i < config1.count(); ++i) { |
| 76 REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i])); | 80 REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i])); |
| 77 REPORTER_ASSERT(reporter, configs[i]->getViaParts().count() == 0); | 81 REPORTER_ASSERT(reporter, configs[i]->getViaParts().count() == 0); |
| 78 } | 82 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 94 REPORTER_ASSERT(reporter, configs[12]->asConfigGpu()->getUseDIText()); | 98 REPORTER_ASSERT(reporter, configs[12]->asConfigGpu()->getUseDIText()); |
| 95 REPORTER_ASSERT(reporter, configs[13]->asConfigGpu()->getSamples() == 4); | 99 REPORTER_ASSERT(reporter, configs[13]->asConfigGpu()->getSamples() == 4); |
| 96 REPORTER_ASSERT(reporter, configs[13]->asConfigGpu()->getUseNVPR()); | 100 REPORTER_ASSERT(reporter, configs[13]->asConfigGpu()->getUseNVPR()); |
| 97 REPORTER_ASSERT(reporter, configs[13]->asConfigGpu()->getUseDIText()); | 101 REPORTER_ASSERT(reporter, configs[13]->asConfigGpu()->getUseDIText()); |
| 98 REPORTER_ASSERT(reporter, !configs[14]->asConfigGpu()); | 102 REPORTER_ASSERT(reporter, !configs[14]->asConfigGpu()); |
| 99 REPORTER_ASSERT(reporter, !configs[15]->asConfigGpu()); | 103 REPORTER_ASSERT(reporter, !configs[15]->asConfigGpu()); |
| 100 REPORTER_ASSERT(reporter, !configs[16]->asConfigGpu()); | 104 REPORTER_ASSERT(reporter, !configs[16]->asConfigGpu()); |
| 101 REPORTER_ASSERT(reporter, !configs[17]->asConfigGpu()); | 105 REPORTER_ASSERT(reporter, !configs[17]->asConfigGpu()); |
| 102 REPORTER_ASSERT(reporter, !configs[18]->asConfigGpu()); | 106 REPORTER_ASSERT(reporter, !configs[18]->asConfigGpu()); |
| 103 REPORTER_ASSERT(reporter, !configs[23]->asConfigGpu()); | 107 REPORTER_ASSERT(reporter, !configs[23]->asConfigGpu()); |
| 108 REPORTER_ASSERT(reporter, configs[24]->asConfigGpu()->getColorType() |
| 109 == kRGBA_F16_SkColorType); |
| 110 REPORTER_ASSERT(reporter, configs[24]->asConfigGpu()->getProfileType() |
| 111 == kLinear_SkColorProfileType); |
| 112 REPORTER_ASSERT(reporter, configs[25]->asConfigGpu()->getColorType() |
| 113 == kN32_SkColorType); |
| 114 REPORTER_ASSERT(reporter, configs[25]->asConfigGpu()->getProfileType() |
| 115 == kSRGB_SkColorProfileType); |
| 104 #if SK_ANGLE | 116 #if SK_ANGLE |
| 105 #ifdef SK_BUILD_FOR_WIN | 117 #ifdef SK_BUILD_FOR_WIN |
| 106 REPORTER_ASSERT(reporter, configs[19]->asConfigGpu()); | 118 REPORTER_ASSERT(reporter, configs[19]->asConfigGpu()); |
| 119 REPORTER_ASSERT(reporter, configs[26]->asConfigGpu()->getProfileType() |
| 120 == kSRGB_SkColorProfileType); |
| 107 #else | 121 #else |
| 108 REPORTER_ASSERT(reporter, !configs[19]->asConfigGpu()); | 122 REPORTER_ASSERT(reporter, !configs[19]->asConfigGpu()); |
| 123 REPORTER_ASSERT(reporter, !configs[26]->asConfigGpu()); |
| 109 #endif | 124 #endif |
| 110 REPORTER_ASSERT(reporter, configs[20]->asConfigGpu()); | 125 REPORTER_ASSERT(reporter, configs[20]->asConfigGpu()); |
| 111 #else | 126 #else |
| 112 REPORTER_ASSERT(reporter, !configs[19]->asConfigGpu()); | 127 REPORTER_ASSERT(reporter, !configs[19]->asConfigGpu()); |
| 113 REPORTER_ASSERT(reporter, !configs[20]->asConfigGpu()); | 128 REPORTER_ASSERT(reporter, !configs[20]->asConfigGpu()); |
| 114 #endif | 129 #endif |
| 115 #if SK_COMMAND_BUFFER | 130 #if SK_COMMAND_BUFFER |
| 116 REPORTER_ASSERT(reporter, configs[21]->asConfigGpu()); | 131 REPORTER_ASSERT(reporter, configs[21]->asConfigGpu()); |
| 117 #else | 132 #else |
| 118 REPORTER_ASSERT(reporter, !configs[21]->asConfigGpu()); | 133 REPORTER_ASSERT(reporter, !configs[21]->asConfigGpu()); |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 REPORTER_ASSERT(reporter, | 322 REPORTER_ASSERT(reporter, |
| 308 configs[i]->getViaParts()[j].equals(expectedConfigs[
i].vias[j])); | 323 configs[i]->getViaParts()[j].equals(expectedConfigs[
i].vias[j])); |
| 309 } | 324 } |
| 310 } | 325 } |
| 311 #if SK_SUPPORT_GPU | 326 #if SK_SUPPORT_GPU |
| 312 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()); | 327 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()); |
| 313 REPORTER_ASSERT(reporter, !configs[1]->asConfigGpu()); | 328 REPORTER_ASSERT(reporter, !configs[1]->asConfigGpu()); |
| 314 REPORTER_ASSERT(reporter, !configs[2]->asConfigGpu()); | 329 REPORTER_ASSERT(reporter, !configs[2]->asConfigGpu()); |
| 315 #endif | 330 #endif |
| 316 } | 331 } |
| OLD | NEW |