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