blob: ece70a9e42ba314f4aa7e07a412ecf74123c644e [file] [log] [blame]
Shane Farmer74cdea32017-05-12 16:22:36 -07001/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "configuration/ConfigurationParser.h"
18
19#include <string>
20
Shane Farmer74cdea32017-05-12 16:22:36 -070021#include "androidfw/ResourceTypes.h"
22
23#include "test/Test.h"
24#include "xml/XmlDom.h"
25
26namespace aapt {
27namespace {
28
Adam Lesinski6b372992017-08-09 10:54:23 -070029using ::android::ResTable_config;
Shane Farmer74cdea32017-05-12 16:22:36 -070030using configuration::Abi;
31using configuration::AndroidSdk;
Shane Farmer9f0e7f12017-06-22 12:26:44 -070032using configuration::Artifact;
Shane Farmer280be342017-06-21 15:20:15 -070033using configuration::PostProcessingConfiguration;
Shane Farmer74cdea32017-05-12 16:22:36 -070034using configuration::DeviceFeature;
35using configuration::GlTexture;
36using configuration::Locale;
37using configuration::AndroidManifest;
Adam Lesinski6b372992017-08-09 10:54:23 -070038using ::testing::ElementsAre;
Shane Farmer74cdea32017-05-12 16:22:36 -070039using xml::Element;
40using xml::NodeCast;
41
42constexpr const char* kValidConfig = R"(<?xml version="1.0" encoding="utf-8" ?>
43<post-process xmlns="http://schemas.android.com/tools/aapt">
44 <groups>
45 <abi-group label="arm">
46 <abi>armeabi-v7a</abi>
47 <abi>arm64-v8a</abi>
48 </abi-group>
49 <abi-group label="other">
50 <abi>x86</abi>
51 <abi>mips</abi>
52 </abi-group>
53 <screen-density-group label="large">
54 <screen-density>xhdpi</screen-density>
55 <screen-density>xxhdpi</screen-density>
56 <screen-density>xxxhdpi</screen-density>
57 </screen-density-group>
58 <screen-density-group label="alldpi">
59 <screen-density>ldpi</screen-density>
60 <screen-density>mdpi</screen-density>
61 <screen-density>hdpi</screen-density>
62 <screen-density>xhdpi</screen-density>
63 <screen-density>xxhdpi</screen-density>
64 <screen-density>xxxhdpi</screen-density>
65 </screen-density-group>
66 <locale-group label="europe">
Shane Farmer0a5b2012017-06-22 12:24:12 -070067 <locale>en</locale>
68 <locale>es</locale>
69 <locale>fr</locale>
70 <locale>de</locale>
Shane Farmer74cdea32017-05-12 16:22:36 -070071 </locale-group>
72 <locale-group label="north-america">
Shane Farmer0a5b2012017-06-22 12:24:12 -070073 <locale>en</locale>
74 <locale>es-rMX</locale>
75 <locale>fr-rCA</locale>
Shane Farmer74cdea32017-05-12 16:22:36 -070076 </locale-group>
77 <android-sdk-group label="19">
78 <android-sdk
79 minSdkVersion="19"
80 targetSdkVersion="24"
81 maxSdkVersion="25">
82 <manifest>
83 <!--- manifest additions here XSLT? TODO -->
84 </manifest>
85 </android-sdk>
86 </android-sdk-group>
87 <gl-texture-group label="dxt1">
88 <gl-texture name="GL_EXT_texture_compression_dxt1">
89 <texture-path>assets/dxt1/*</texture-path>
90 </gl-texture>
91 </gl-texture-group>
92 <device-feature-group label="low-latency">
93 <supports-feature>android.hardware.audio.low_latency</supports-feature>
94 </device-feature-group>
95 </groups>
96 <artifacts>
97 <artifact-format>
98 ${base}.${abi}.${screen-density}.${locale}.${sdk}.${gl}.${feature}.release
99 </artifact-format>
100 <artifact
101 name="art1"
102 abi-group="arm"
103 screen-density-group="large"
104 locale-group="europe"
105 android-sdk-group="19"
106 gl-texture-group="dxt1"
107 device-feature-group="low-latency"/>
108 <artifact
109 name="art2"
110 abi-group="other"
111 screen-density-group="alldpi"
112 locale-group="north-america"
113 android-sdk-group="19"
114 gl-texture-group="dxt1"
115 device-feature-group="low-latency"/>
116 </artifacts>
117</post-process>
118)";
119
120class ConfigurationParserTest : public ConfigurationParser, public ::testing::Test {
121 public:
122 ConfigurationParserTest() : ConfigurationParser("") {}
123
124 protected:
125 StdErrDiagnostics diag_;
126};
127
Shane Farmerb1027272017-06-14 09:10:28 -0700128TEST_F(ConfigurationParserTest, ForPath_NoFile) {
129 auto result = ConfigurationParser::ForPath("./does_not_exist.xml");
130 EXPECT_FALSE(result);
131}
132
Shane Farmer74cdea32017-05-12 16:22:36 -0700133TEST_F(ConfigurationParserTest, ValidateFile) {
134 auto parser = ConfigurationParser::ForContents(kValidConfig).WithDiagnostics(&diag_);
135 auto result = parser.Parse();
136 ASSERT_TRUE(result);
Shane Farmer280be342017-06-21 15:20:15 -0700137 PostProcessingConfiguration& value = result.value();
Shane Farmer74cdea32017-05-12 16:22:36 -0700138 EXPECT_EQ(2ul, value.artifacts.size());
139 ASSERT_TRUE(value.artifact_format);
140 EXPECT_EQ(
141 "${base}.${abi}.${screen-density}.${locale}.${sdk}.${gl}.${feature}.release",
142 value.artifact_format.value()
143 );
144
145 EXPECT_EQ(2ul, value.abi_groups.size());
146 EXPECT_EQ(2ul, value.abi_groups["arm"].size());
147 EXPECT_EQ(2ul, value.abi_groups["other"].size());
148
149 EXPECT_EQ(2ul, value.screen_density_groups.size());
150 EXPECT_EQ(3ul, value.screen_density_groups["large"].size());
151 EXPECT_EQ(6ul, value.screen_density_groups["alldpi"].size());
152
Shane Farmer0a5b2012017-06-22 12:24:12 -0700153 EXPECT_EQ(2ul, value.locale_groups.size());
Shane Farmer74cdea32017-05-12 16:22:36 -0700154 EXPECT_EQ(4ul, value.locale_groups["europe"].size());
155 EXPECT_EQ(3ul, value.locale_groups["north-america"].size());
Shane Farmer74cdea32017-05-12 16:22:36 -0700156
157 EXPECT_EQ(1ul, value.android_sdk_groups.size());
158 EXPECT_EQ(1ul, value.android_sdk_groups["19"].size());
159
160 EXPECT_EQ(1ul, value.gl_texture_groups.size());
161 EXPECT_EQ(1ul, value.gl_texture_groups["dxt1"].size());
162
163 EXPECT_EQ(1ul, value.device_feature_groups.size());
164 EXPECT_EQ(1ul, value.device_feature_groups["low-latency"].size());
165}
166
167TEST_F(ConfigurationParserTest, InvalidNamespace) {
168 constexpr const char* invalid_ns = R"(<?xml version="1.0" encoding="utf-8" ?>
169 <post-process xmlns="http://schemas.android.com/tools/another-unknown-tool" />)";
170
171 auto result = ConfigurationParser::ForContents(invalid_ns).Parse();
172 ASSERT_FALSE(result);
173}
174
175TEST_F(ConfigurationParserTest, ArtifactAction) {
176 static constexpr const char* xml = R"xml(
177 <artifact
178 abi-group="arm"
179 screen-density-group="large"
180 locale-group="europe"
181 android-sdk-group="19"
182 gl-texture-group="dxt1"
183 device-feature-group="low-latency"/>)xml";
184
185 auto doc = test::BuildXmlDom(xml);
186
Shane Farmer280be342017-06-21 15:20:15 -0700187 PostProcessingConfiguration config;
Adam Lesinski6b372992017-08-09 10:54:23 -0700188 bool ok = artifact_handler_(&config, NodeCast<Element>(doc->root.get()), &diag_);
Shane Farmer74cdea32017-05-12 16:22:36 -0700189 ASSERT_TRUE(ok);
190
191 EXPECT_EQ(1ul, config.artifacts.size());
192
Shane Farmer57669432017-06-19 12:52:04 -0700193 auto& artifact = config.artifacts.front();
Shane Farmer0a5b2012017-06-22 12:24:12 -0700194 EXPECT_FALSE(artifact.name); // TODO: make this fail.
Shane Farmer74cdea32017-05-12 16:22:36 -0700195 EXPECT_EQ("arm", artifact.abi_group.value());
196 EXPECT_EQ("large", artifact.screen_density_group.value());
197 EXPECT_EQ("europe", artifact.locale_group.value());
198 EXPECT_EQ("19", artifact.android_sdk_group.value());
199 EXPECT_EQ("dxt1", artifact.gl_texture_group.value());
200 EXPECT_EQ("low-latency", artifact.device_feature_group.value());
Shane Farmer57669432017-06-19 12:52:04 -0700201
202 // Perform a second action to ensure we get 2 artifacts.
203 static constexpr const char* second = R"xml(
204 <artifact
205 abi-group="other"
206 screen-density-group="large"
207 locale-group="europe"
208 android-sdk-group="19"
209 gl-texture-group="dxt1"
210 device-feature-group="low-latency"/>)xml";
211 doc = test::BuildXmlDom(second);
212
213 ok = artifact_handler_(&config, NodeCast<Element>(doc.get()->root.get()), &diag_);
214 ASSERT_TRUE(ok);
215 EXPECT_EQ(2ul, config.artifacts.size());
Shane Farmer74cdea32017-05-12 16:22:36 -0700216}
217
218TEST_F(ConfigurationParserTest, ArtifactFormatAction) {
219 static constexpr const char* xml = R"xml(
220 <artifact-format>
221 ${base}.${abi}.${screen-density}.${locale}.${sdk}.${gl}.${feature}.release
222 </artifact-format>)xml";
223
224 auto doc = test::BuildXmlDom(xml);
225
Shane Farmer280be342017-06-21 15:20:15 -0700226 PostProcessingConfiguration config;
Shane Farmer74cdea32017-05-12 16:22:36 -0700227 bool ok = artifact_format_handler_(&config, NodeCast<Element>(doc.get()->root.get()), &diag_);
228 ASSERT_TRUE(ok);
229 ASSERT_TRUE(config.artifact_format);
230 EXPECT_EQ(
231 "${base}.${abi}.${screen-density}.${locale}.${sdk}.${gl}.${feature}.release",
232 static_cast<std::string>(config.artifact_format.value())
233 );
234}
235
236TEST_F(ConfigurationParserTest, AbiGroupAction) {
237 static constexpr const char* xml = R"xml(
238 <abi-group label="arm">
239 <!-- First comment. -->
240 <abi>
241 armeabi-v7a
242 </abi>
243 <!-- Another comment. -->
244 <abi>arm64-v8a</abi>
245 </abi-group>)xml";
246
247 auto doc = test::BuildXmlDom(xml);
248
Shane Farmer280be342017-06-21 15:20:15 -0700249 PostProcessingConfiguration config;
Shane Farmer74cdea32017-05-12 16:22:36 -0700250 bool ok = abi_group_handler_(&config, NodeCast<Element>(doc.get()->root.get()), &diag_);
251 ASSERT_TRUE(ok);
252
253 EXPECT_EQ(1ul, config.abi_groups.size());
254 ASSERT_EQ(1u, config.abi_groups.count("arm"));
255
256 auto& out = config.abi_groups["arm"];
257 ASSERT_THAT(out, ElementsAre(Abi::kArmV7a, Abi::kArm64V8a));
258}
259
260TEST_F(ConfigurationParserTest, ScreenDensityGroupAction) {
261 static constexpr const char* xml = R"xml(
262 <screen-density-group label="large">
263 <screen-density>xhdpi</screen-density>
264 <screen-density>
265 xxhdpi
266 </screen-density>
267 <screen-density>xxxhdpi</screen-density>
268 </screen-density-group>)xml";
269
270 auto doc = test::BuildXmlDom(xml);
271
Shane Farmer280be342017-06-21 15:20:15 -0700272 PostProcessingConfiguration config;
Shane Farmer74cdea32017-05-12 16:22:36 -0700273 bool ok =
274 screen_density_group_handler_(&config, NodeCast<Element>(doc.get()->root.get()), &diag_);
275 ASSERT_TRUE(ok);
276
277 EXPECT_EQ(1ul, config.screen_density_groups.size());
278 ASSERT_EQ(1u, config.screen_density_groups.count("large"));
279
280 ConfigDescription xhdpi;
281 xhdpi.density = ResTable_config::DENSITY_XHIGH;
282 ConfigDescription xxhdpi;
283 xxhdpi.density = ResTable_config::DENSITY_XXHIGH;
284 ConfigDescription xxxhdpi;
285 xxxhdpi.density = ResTable_config::DENSITY_XXXHIGH;
286
287 auto& out = config.screen_density_groups["large"];
288 ASSERT_THAT(out, ElementsAre(xhdpi, xxhdpi, xxxhdpi));
289}
290
291TEST_F(ConfigurationParserTest, LocaleGroupAction) {
292 static constexpr const char* xml = R"xml(
293 <locale-group label="europe">
Shane Farmer0a5b2012017-06-22 12:24:12 -0700294 <locale>en</locale>
295 <locale>es</locale>
296 <locale>fr</locale>
297 <locale>de</locale>
Shane Farmer74cdea32017-05-12 16:22:36 -0700298 </locale-group>)xml";
299
300 auto doc = test::BuildXmlDom(xml);
301
Shane Farmer280be342017-06-21 15:20:15 -0700302 PostProcessingConfiguration config;
Shane Farmer74cdea32017-05-12 16:22:36 -0700303 bool ok = locale_group_handler_(&config, NodeCast<Element>(doc.get()->root.get()), &diag_);
304 ASSERT_TRUE(ok);
305
306 ASSERT_EQ(1ul, config.locale_groups.size());
307 ASSERT_EQ(1u, config.locale_groups.count("europe"));
308
Shane Farmer0a5b2012017-06-22 12:24:12 -0700309 const auto& out = config.locale_groups["europe"];
Shane Farmer74cdea32017-05-12 16:22:36 -0700310
Shane Farmer0a5b2012017-06-22 12:24:12 -0700311 ConfigDescription en = test::ParseConfigOrDie("en");
312 ConfigDescription es = test::ParseConfigOrDie("es");
313 ConfigDescription fr = test::ParseConfigOrDie("fr");
314 ConfigDescription de = test::ParseConfigOrDie("de");
Shane Farmer74cdea32017-05-12 16:22:36 -0700315
316 ASSERT_THAT(out, ElementsAre(en, es, fr, de));
317}
318
319TEST_F(ConfigurationParserTest, AndroidSdkGroupAction) {
320 static constexpr const char* xml = R"xml(
321 <android-sdk-group label="19">
322 <android-sdk
323 minSdkVersion="19"
324 targetSdkVersion="24"
325 maxSdkVersion="25">
326 <manifest>
327 <!--- manifest additions here XSLT? TODO -->
328 </manifest>
329 </android-sdk>
330 </android-sdk-group>)xml";
331
332 auto doc = test::BuildXmlDom(xml);
333
Shane Farmer280be342017-06-21 15:20:15 -0700334 PostProcessingConfiguration config;
Shane Farmer74cdea32017-05-12 16:22:36 -0700335 bool ok = android_sdk_group_handler_(&config, NodeCast<Element>(doc.get()->root.get()), &diag_);
336 ASSERT_TRUE(ok);
337
338 ASSERT_EQ(1ul, config.android_sdk_groups.size());
339 ASSERT_EQ(1u, config.android_sdk_groups.count("19"));
340
341 auto& out = config.android_sdk_groups["19"];
342
343 AndroidSdk sdk;
344 sdk.min_sdk_version = std::string("19");
345 sdk.target_sdk_version = std::string("24");
346 sdk.max_sdk_version = std::string("25");
347 sdk.manifest = AndroidManifest();
348
349 ASSERT_EQ(1ul, out.size());
350 ASSERT_EQ(sdk, out[0]);
351}
352
353TEST_F(ConfigurationParserTest, GlTextureGroupAction) {
354 static constexpr const char* xml = R"xml(
355 <gl-texture-group label="dxt1">
356 <gl-texture name="GL_EXT_texture_compression_dxt1">
357 <texture-path>assets/dxt1/main/*</texture-path>
358 <texture-path>
359 assets/dxt1/test/*
360 </texture-path>
361 </gl-texture>
362 </gl-texture-group>)xml";
363
364 auto doc = test::BuildXmlDom(xml);
365
Shane Farmer280be342017-06-21 15:20:15 -0700366 PostProcessingConfiguration config;
Shane Farmer74cdea32017-05-12 16:22:36 -0700367 bool ok = gl_texture_group_handler_(&config, NodeCast<Element>(doc.get()->root.get()), &diag_);
368 ASSERT_TRUE(ok);
369
370 EXPECT_EQ(1ul, config.gl_texture_groups.size());
371 ASSERT_EQ(1u, config.gl_texture_groups.count("dxt1"));
372
373 auto& out = config.gl_texture_groups["dxt1"];
374
375 GlTexture texture{
376 std::string("GL_EXT_texture_compression_dxt1"),
377 {"assets/dxt1/main/*", "assets/dxt1/test/*"}
378 };
379
380 ASSERT_EQ(1ul, out.size());
381 ASSERT_EQ(texture, out[0]);
382}
383
384TEST_F(ConfigurationParserTest, DeviceFeatureGroupAction) {
385 static constexpr const char* xml = R"xml(
386 <device-feature-group label="low-latency">
387 <supports-feature>android.hardware.audio.low_latency</supports-feature>
388 <supports-feature>
389 android.hardware.audio.pro
390 </supports-feature>
391 </device-feature-group>)xml";
392
393 auto doc = test::BuildXmlDom(xml);
394
Shane Farmer280be342017-06-21 15:20:15 -0700395 PostProcessingConfiguration config;
Shane Farmer74cdea32017-05-12 16:22:36 -0700396 bool ok
397 = device_feature_group_handler_(&config, NodeCast<Element>(doc.get()->root.get()), &diag_);
398 ASSERT_TRUE(ok);
399
400 EXPECT_EQ(1ul, config.device_feature_groups.size());
401 ASSERT_EQ(1u, config.device_feature_groups.count("low-latency"));
402
403 auto& out = config.device_feature_groups["low-latency"];
404
405 DeviceFeature low_latency = "android.hardware.audio.low_latency";
406 DeviceFeature pro = "android.hardware.audio.pro";
407 ASSERT_THAT(out, ElementsAre(low_latency, pro));
408}
409
Shane Farmer1a21b8c2017-07-21 09:42:42 -0700410// Artifact name parser test cases.
411
Shane Farmer9f0e7f12017-06-22 12:26:44 -0700412TEST(ArtifactTest, Simple) {
413 StdErrDiagnostics diag;
414 Artifact x86;
415 x86.abi_group = {"x86"};
416
Shane Farmer0a5b2012017-06-22 12:24:12 -0700417 auto x86_result = x86.ToArtifactName("something.${abi}.apk", &diag);
Shane Farmer9f0e7f12017-06-22 12:26:44 -0700418 ASSERT_TRUE(x86_result);
419 EXPECT_EQ(x86_result.value(), "something.x86.apk");
420
421 Artifact arm;
422 arm.abi_group = {"armeabi-v7a"};
423
Shane Farmer0a5b2012017-06-22 12:24:12 -0700424 auto arm_result = arm.ToArtifactName("app.${abi}.apk", &diag);
Shane Farmer9f0e7f12017-06-22 12:26:44 -0700425 ASSERT_TRUE(arm_result);
426 EXPECT_EQ(arm_result.value(), "app.armeabi-v7a.apk");
427}
428
429TEST(ArtifactTest, Complex) {
430 StdErrDiagnostics diag;
431 Artifact artifact;
432 artifact.abi_group = {"mips64"};
433 artifact.screen_density_group = {"ldpi"};
434 artifact.device_feature_group = {"df1"};
435 artifact.gl_texture_group = {"glx1"};
436 artifact.locale_group = {"en-AU"};
437 artifact.android_sdk_group = {"26"};
438
Shane Farmer0a5b2012017-06-22 12:24:12 -0700439 auto result = artifact.ToArtifactName(
440 "app.${density}_${locale}_${feature}_${gl}.sdk${sdk}.${abi}.apk", &diag);
Shane Farmer9f0e7f12017-06-22 12:26:44 -0700441 ASSERT_TRUE(result);
442 EXPECT_EQ(result.value(), "app.ldpi_en-AU_df1_glx1.sdk26.mips64.apk");
443}
444
445TEST(ArtifactTest, Missing) {
446 StdErrDiagnostics diag;
447 Artifact x86;
448 x86.abi_group = {"x86"};
449
Shane Farmer0a5b2012017-06-22 12:24:12 -0700450 EXPECT_FALSE(x86.ToArtifactName("something.${density}.apk", &diag));
Shane Farmer9f0e7f12017-06-22 12:26:44 -0700451 EXPECT_FALSE(x86.ToArtifactName("something.apk", &diag));
452}
453
454TEST(ArtifactTest, Empty) {
455 StdErrDiagnostics diag;
456 Artifact artifact;
457
Shane Farmer0a5b2012017-06-22 12:24:12 -0700458 EXPECT_FALSE(artifact.ToArtifactName("something.${density}.apk", &diag));
Shane Farmer9f0e7f12017-06-22 12:26:44 -0700459 EXPECT_TRUE(artifact.ToArtifactName("something.apk", &diag));
460}
461
Shane Farmer1a21b8c2017-07-21 09:42:42 -0700462TEST(ArtifactTest, Repeated) {
463 StdErrDiagnostics diag;
464 Artifact artifact;
465 artifact.screen_density_group = {"mdpi"};
466
Shane Farmer0a5b2012017-06-22 12:24:12 -0700467 ASSERT_TRUE(artifact.ToArtifactName("something.${density}.apk", &diag));
468 EXPECT_FALSE(artifact.ToArtifactName("something.${density}.${density}.apk", &diag));
Shane Farmer1a21b8c2017-07-21 09:42:42 -0700469}
470
471TEST(ArtifactTest, Nesting) {
472 StdErrDiagnostics diag;
473 Artifact x86;
474 x86.abi_group = {"x86"};
475
Shane Farmer0a5b2012017-06-22 12:24:12 -0700476 EXPECT_FALSE(x86.ToArtifactName("something.${abi${density}}.apk", &diag));
Shane Farmer1a21b8c2017-07-21 09:42:42 -0700477
Shane Farmer0a5b2012017-06-22 12:24:12 -0700478 const Maybe<std::string>& name = x86.ToArtifactName("something.${abi${abi}}.apk", &diag);
479 ASSERT_TRUE(name);
480 EXPECT_EQ(name.value(), "something.${abix86}.apk");
Shane Farmer1a21b8c2017-07-21 09:42:42 -0700481}
482
483TEST(ArtifactTest, Recursive) {
484 StdErrDiagnostics diag;
485 Artifact artifact;
Shane Farmer0a5b2012017-06-22 12:24:12 -0700486 artifact.device_feature_group = {"${gl}"};
Shane Farmer1a21b8c2017-07-21 09:42:42 -0700487 artifact.gl_texture_group = {"glx1"};
488
Shane Farmer0a5b2012017-06-22 12:24:12 -0700489 EXPECT_FALSE(artifact.ToArtifactName("app.${feature}.${gl}.apk", &diag));
Shane Farmer1a21b8c2017-07-21 09:42:42 -0700490
491 artifact.device_feature_group = {"df1"};
Shane Farmer0a5b2012017-06-22 12:24:12 -0700492 artifact.gl_texture_group = {"${feature}"};
Shane Farmer1a21b8c2017-07-21 09:42:42 -0700493 {
Shane Farmer0a5b2012017-06-22 12:24:12 -0700494 const auto& result = artifact.ToArtifactName("app.${feature}.${gl}.apk", &diag);
495 ASSERT_TRUE(result);
496 EXPECT_EQ(result.value(), "app.df1.${feature}.apk");
Shane Farmer1a21b8c2017-07-21 09:42:42 -0700497 }
498
499 // This is an invalid case, but should be the only possible case due to the ordering of
500 // replacement.
Shane Farmer0a5b2012017-06-22 12:24:12 -0700501 artifact.device_feature_group = {"${gl}"};
Shane Farmer1a21b8c2017-07-21 09:42:42 -0700502 artifact.gl_texture_group = {"glx1"};
503 {
Shane Farmer0a5b2012017-06-22 12:24:12 -0700504 const auto& result = artifact.ToArtifactName("app.${feature}.apk", &diag);
505 ASSERT_TRUE(result);
Shane Farmer1a21b8c2017-07-21 09:42:42 -0700506 EXPECT_EQ(result.value(), "app.glx1.apk");
507 }
508}
509
Shane Farmer74cdea32017-05-12 16:22:36 -0700510} // namespace
511} // namespace aapt