| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 ParseConfigs(config2, &configs); | 60 ParseConfigs(config2, &configs); |
| 61 REPORTER_ASSERT(reporter, configs.count() == 1); | 61 REPORTER_ASSERT(reporter, configs.count() == 1); |
| 62 REPORTER_ASSERT(reporter, configs[0]->getTag().equals("8888")); | 62 REPORTER_ASSERT(reporter, configs[0]->getTag().equals("8888")); |
| 63 } | 63 } |
| 64 | 64 |
| 65 DEF_TEST(ParseConfigs_DefaultConfigs, reporter) { | 65 DEF_TEST(ParseConfigs_DefaultConfigs, reporter) { |
| 66 // Parses all default configs and returns correct "tag". | 66 // Parses all default configs and returns correct "tag". |
| 67 | 67 |
| 68 SkCommandLineFlags::StringArray config1 = make_string_array({ | 68 SkCommandLineFlags::StringArray config1 = make_string_array({ |
| 69 "565", "8888", "debug", "gpu", "gpudebug", "gpudft", "gpunull", "msaa16"
, "msaa4", | 69 "565", "8888", "debug", "gpu", "gpudebug", "gpudft", "gpunull", "msaa16"
, "msaa4", |
| 70 "nonrendering", "null", "nullgpu", "nvprmsaa16", "nvprmsaa4", "pdf", "pd
f_poppler", | 70 "nonrendering", "null", "nullgpu", "nvpr16", "nvpr4", "nvprdit16", "nvpr
dit4", "pdf", |
| 71 "skp", "svg", "xps", "angle", "angle-gl", "commandbuffer", "mesa", "hwui
", | 71 "pdf_poppler", "skp", "svg", "xps", "angle", "angle-gl", "commandbuffer"
, "mesa", "hwui", |
| 72 "gpuf16", "gpusrgb" | 72 "gpuf16", "gpusrgb" |
| 73 }); | 73 }); |
| 74 | 74 |
| 75 SkCommandLineConfigArray configs; | 75 SkCommandLineConfigArray configs; |
| 76 ParseConfigs(config1, &configs); | 76 ParseConfigs(config1, &configs); |
| 77 | 77 |
| 78 REPORTER_ASSERT(reporter, configs.count() == config1.count()); | 78 REPORTER_ASSERT(reporter, configs.count() == config1.count()); |
| 79 for (int i = 0; i < config1.count(); ++i) { | 79 for (int i = 0; i < config1.count(); ++i) { |
| 80 REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i])); | 80 REPORTER_ASSERT(reporter, configs[i]->getTag().equals(config1[i])); |
| 81 REPORTER_ASSERT(reporter, configs[i]->getViaParts().count() == 0); | 81 REPORTER_ASSERT(reporter, configs[i]->getViaParts().count() == 0); |
| 82 } | 82 } |
| 83 #if SK_SUPPORT_GPU | 83 #if SK_SUPPORT_GPU |
| 84 REPORTER_ASSERT(reporter, !configs[0]->asConfigGpu()); | 84 REPORTER_ASSERT(reporter, !configs[0]->asConfigGpu()); |
| 85 REPORTER_ASSERT(reporter, !configs[1]->asConfigGpu()); | 85 REPORTER_ASSERT(reporter, !configs[1]->asConfigGpu()); |
| 86 REPORTER_ASSERT(reporter, configs[2]->asConfigGpu()); | 86 REPORTER_ASSERT(reporter, configs[2]->asConfigGpu()); |
| 87 REPORTER_ASSERT(reporter, configs[3]->asConfigGpu()); | 87 REPORTER_ASSERT(reporter, configs[3]->asConfigGpu()); |
| 88 REPORTER_ASSERT(reporter, configs[4]->asConfigGpu()); | 88 REPORTER_ASSERT(reporter, configs[4]->asConfigGpu()); |
| 89 REPORTER_ASSERT(reporter, configs[5]->asConfigGpu()->getUseDIText()); | 89 REPORTER_ASSERT(reporter, configs[5]->asConfigGpu()->getUseDIText()); |
| 90 REPORTER_ASSERT(reporter, configs[6]->asConfigGpu()); | 90 REPORTER_ASSERT(reporter, configs[6]->asConfigGpu()); |
| 91 REPORTER_ASSERT(reporter, configs[7]->asConfigGpu()->getSamples() == 16); | 91 REPORTER_ASSERT(reporter, configs[7]->asConfigGpu()->getSamples() == 16); |
| 92 REPORTER_ASSERT(reporter, configs[8]->asConfigGpu()->getSamples() == 4); | 92 REPORTER_ASSERT(reporter, configs[8]->asConfigGpu()->getSamples() == 4); |
| 93 REPORTER_ASSERT(reporter, !configs[9]->asConfigGpu()); | 93 REPORTER_ASSERT(reporter, !configs[9]->asConfigGpu()); |
| 94 REPORTER_ASSERT(reporter, !configs[10]->asConfigGpu()); | 94 REPORTER_ASSERT(reporter, !configs[10]->asConfigGpu()); |
| 95 REPORTER_ASSERT(reporter, configs[11]->asConfigGpu()); | 95 REPORTER_ASSERT(reporter, configs[11]->asConfigGpu()); |
| 96 REPORTER_ASSERT(reporter, configs[12]->asConfigGpu()->getSamples() == 16); | 96 REPORTER_ASSERT(reporter, configs[12]->asConfigGpu()->getSamples() == 16); |
| 97 REPORTER_ASSERT(reporter, configs[12]->asConfigGpu()->getUseNVPR()); | 97 REPORTER_ASSERT(reporter, configs[12]->asConfigGpu()->getUseNVPR()); |
| 98 REPORTER_ASSERT(reporter, configs[12]->asConfigGpu()->getUseDIText()); | 98 REPORTER_ASSERT(reporter, !configs[12]->asConfigGpu()->getUseDIText()); |
| 99 REPORTER_ASSERT(reporter, configs[13]->asConfigGpu()->getSamples() == 4); | 99 REPORTER_ASSERT(reporter, configs[13]->asConfigGpu()->getSamples() == 4); |
| 100 REPORTER_ASSERT(reporter, configs[13]->asConfigGpu()->getUseNVPR()); | 100 REPORTER_ASSERT(reporter, configs[13]->asConfigGpu()->getUseNVPR()); |
| 101 REPORTER_ASSERT(reporter, configs[13]->asConfigGpu()->getUseDIText()); | 101 REPORTER_ASSERT(reporter, !configs[13]->asConfigGpu()->getUseDIText()); |
| 102 REPORTER_ASSERT(reporter, !configs[14]->asConfigGpu()); | 102 REPORTER_ASSERT(reporter, configs[14]->asConfigGpu()->getSamples() == 16); |
| 103 REPORTER_ASSERT(reporter, !configs[15]->asConfigGpu()); | 103 REPORTER_ASSERT(reporter, configs[14]->asConfigGpu()->getUseNVPR()); |
| 104 REPORTER_ASSERT(reporter, configs[14]->asConfigGpu()->getUseDIText()); |
| 105 REPORTER_ASSERT(reporter, configs[15]->asConfigGpu()->getSamples() == 4); |
| 106 REPORTER_ASSERT(reporter, configs[15]->asConfigGpu()->getUseNVPR()); |
| 107 REPORTER_ASSERT(reporter, configs[15]->asConfigGpu()->getUseDIText()); |
| 104 REPORTER_ASSERT(reporter, !configs[16]->asConfigGpu()); | 108 REPORTER_ASSERT(reporter, !configs[16]->asConfigGpu()); |
| 105 REPORTER_ASSERT(reporter, !configs[17]->asConfigGpu()); | 109 REPORTER_ASSERT(reporter, !configs[17]->asConfigGpu()); |
| 106 REPORTER_ASSERT(reporter, !configs[18]->asConfigGpu()); | 110 REPORTER_ASSERT(reporter, !configs[18]->asConfigGpu()); |
| 107 REPORTER_ASSERT(reporter, !configs[23]->asConfigGpu()); | 111 REPORTER_ASSERT(reporter, !configs[19]->asConfigGpu()); |
| 108 REPORTER_ASSERT(reporter, configs[24]->asConfigGpu()->getColorType() | 112 REPORTER_ASSERT(reporter, !configs[20]->asConfigGpu()); |
| 113 REPORTER_ASSERT(reporter, !configs[25]->asConfigGpu()); |
| 114 REPORTER_ASSERT(reporter, configs[26]->asConfigGpu()->getColorType() |
| 109 == kRGBA_F16_SkColorType); | 115 == kRGBA_F16_SkColorType); |
| 110 REPORTER_ASSERT(reporter, configs[24]->asConfigGpu()->getProfileType() | 116 REPORTER_ASSERT(reporter, configs[26]->asConfigGpu()->getProfileType() |
| 111 == kLinear_SkColorProfileType); | 117 == kLinear_SkColorProfileType); |
| 112 REPORTER_ASSERT(reporter, configs[25]->asConfigGpu()->getColorType() | 118 REPORTER_ASSERT(reporter, configs[27]->asConfigGpu()->getColorType() |
| 113 == kN32_SkColorType); | 119 == kN32_SkColorType); |
| 114 REPORTER_ASSERT(reporter, configs[25]->asConfigGpu()->getProfileType() | 120 REPORTER_ASSERT(reporter, configs[27]->asConfigGpu()->getProfileType() |
| 115 == kSRGB_SkColorProfileType); | 121 == kSRGB_SkColorProfileType); |
| 116 #if SK_ANGLE | 122 #if SK_ANGLE |
| 117 #ifdef SK_BUILD_FOR_WIN | 123 #ifdef SK_BUILD_FOR_WIN |
| 118 REPORTER_ASSERT(reporter, configs[19]->asConfigGpu()); | |
| 119 #else | |
| 120 REPORTER_ASSERT(reporter, !configs[19]->asConfigGpu()); | |
| 121 #endif | |
| 122 REPORTER_ASSERT(reporter, configs[20]->asConfigGpu()); | |
| 123 #else | |
| 124 REPORTER_ASSERT(reporter, !configs[19]->asConfigGpu()); | |
| 125 REPORTER_ASSERT(reporter, !configs[20]->asConfigGpu()); | |
| 126 #endif | |
| 127 #if SK_COMMAND_BUFFER | |
| 128 REPORTER_ASSERT(reporter, configs[21]->asConfigGpu()); | 124 REPORTER_ASSERT(reporter, configs[21]->asConfigGpu()); |
| 129 #else | 125 #else |
| 130 REPORTER_ASSERT(reporter, !configs[21]->asConfigGpu()); | 126 REPORTER_ASSERT(reporter, !configs[21]->asConfigGpu()); |
| 131 #endif | 127 #endif |
| 132 #if SK_MESA | |
| 133 REPORTER_ASSERT(reporter, configs[22]->asConfigGpu()); | 128 REPORTER_ASSERT(reporter, configs[22]->asConfigGpu()); |
| 134 #else | 129 #else |
| 130 REPORTER_ASSERT(reporter, !configs[21]->asConfigGpu()); |
| 135 REPORTER_ASSERT(reporter, !configs[22]->asConfigGpu()); | 131 REPORTER_ASSERT(reporter, !configs[22]->asConfigGpu()); |
| 136 #endif | 132 #endif |
| 133 #if SK_COMMAND_BUFFER |
| 134 REPORTER_ASSERT(reporter, configs[23]->asConfigGpu()); |
| 135 #else |
| 136 REPORTER_ASSERT(reporter, !configs[23]->asConfigGpu()); |
| 137 #endif |
| 138 #if SK_MESA |
| 139 REPORTER_ASSERT(reporter, configs[24]->asConfigGpu()); |
| 140 #else |
| 141 REPORTER_ASSERT(reporter, !configs[24]->asConfigGpu()); |
| 142 #endif |
| 137 #endif | 143 #endif |
| 138 } | 144 } |
| 139 | 145 |
| 140 DEF_TEST(ParseConfigs_ExtendedGpuConfigsCorrect, reporter) { | 146 DEF_TEST(ParseConfigs_ExtendedGpuConfigsCorrect, reporter) { |
| 141 SkCommandLineFlags::StringArray config1 = make_string_array({ | 147 SkCommandLineFlags::StringArray config1 = make_string_array({ |
| 142 "gpu(nvpr=true,dit=false)", | 148 "gpu(nvpr=true,dit=false)", |
| 143 "gpu(api=angle)", | 149 "gpu(api=angle)", |
| 144 "gpu(api=angle-gl)", | 150 "gpu(api=angle-gl)", |
| 145 "gpu(api=mesa,samples=77)", | 151 "gpu(api=mesa,samples=77)", |
| 146 "gpu(dit=true,api=commandbuffer)", | 152 "gpu(dit=true,api=commandbuffer)", |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 REPORTER_ASSERT(reporter, | 325 REPORTER_ASSERT(reporter, |
| 320 configs[i]->getViaParts()[j].equals(expectedConfigs[
i].vias[j])); | 326 configs[i]->getViaParts()[j].equals(expectedConfigs[
i].vias[j])); |
| 321 } | 327 } |
| 322 } | 328 } |
| 323 #if SK_SUPPORT_GPU | 329 #if SK_SUPPORT_GPU |
| 324 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()); | 330 REPORTER_ASSERT(reporter, configs[0]->asConfigGpu()); |
| 325 REPORTER_ASSERT(reporter, !configs[1]->asConfigGpu()); | 331 REPORTER_ASSERT(reporter, !configs[1]->asConfigGpu()); |
| 326 REPORTER_ASSERT(reporter, !configs[2]->asConfigGpu()); | 332 REPORTER_ASSERT(reporter, !configs[2]->asConfigGpu()); |
| 327 #endif | 333 #endif |
| 328 } | 334 } |
| OLD | NEW |