summaryrefslogtreecommitdiff
path: root/tools/aapt2/ResourceTable_test.cpp
diff options
context:
space:
mode:
authorAdam Lesinski <adamlesinski@google.com>2017-03-29 13:52:38 -0700
committerAdam Lesinski <adamlesinski@google.com>2017-03-29 20:56:32 +0000
commitb1afa07745280c7a36077beda6293b69c6ba4ea2 (patch)
tree77483b34ca63be514c3ee1caa562c7fd503cd3da /tools/aapt2/ResourceTable_test.cpp
parent22ea35187f7d8a55ad7ede0d0e97be65b83801be (diff)
AAPT2: Allow arbitrary entry names with aapt2 optimize
Presumably, the apps build fine for the developers, so just feed the existing names through without validation. Validation still exists when building an app from source. Bug: 36051854 Change-Id: Idc64ee91b08dce67d3c28f3c5284a7afa1312df1 Test: run aapt2 optimize on the apks from b/36051854 and build aapt2_tests
Diffstat (limited to 'tools/aapt2/ResourceTable_test.cpp')
-rw-r--r--tools/aapt2/ResourceTable_test.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/aapt2/ResourceTable_test.cpp b/tools/aapt2/ResourceTable_test.cpp
index cb3699a00f75..e2b37be994ff 100644
--- a/tools/aapt2/ResourceTable_test.cpp
+++ b/tools/aapt2/ResourceTable_test.cpp
@@ -40,6 +40,14 @@ TEST(ResourceTableTest, FailToAddResourceWithBadName) {
test::GetDiagnostics()));
}
+TEST(ResourceTableTest, AddResourceWithWeirdNameWhenAddingMangledResources) {
+ ResourceTable table;
+
+ EXPECT_TRUE(table.AddResourceAllowMangled(
+ test::ParseNameOrDie("android:id/heythere "), ConfigDescription{}, "",
+ test::ValueBuilder<Id>().SetSource("test.xml", 21u).Build(), test::GetDiagnostics()));
+}
+
TEST(ResourceTableTest, AddOneResource) {
ResourceTable table;
@@ -130,7 +138,7 @@ TEST(ResourceTableTest, ProductVaryingValues) {
table.FindResource(test::ParseNameOrDie("android:string/foo"));
AAPT_ASSERT_TRUE(sr);
std::vector<ResourceConfigValue*> values =
- sr.value().entry->findAllValues(test::ParseConfigOrDie("land"));
+ sr.value().entry->FindAllValues(test::ParseConfigOrDie("land"));
ASSERT_EQ(2u, values.size());
EXPECT_EQ(std::string("phone"), values[0]->product);
EXPECT_EQ(std::string("tablet"), values[1]->product);