diff options
author | Adam Lesinski <adamlesinski@google.com> | 2015-12-14 16:08:50 -0800 |
---|---|---|
committer | Adam Lesinski <adamlesinski@google.com> | 2015-12-17 11:01:55 -0800 |
commit | 7ff3ee19f4b831a526baf4b928d1ac172d070d82 (patch) | |
tree | 6b80cd676d4d9d3e98f4382090011834be106228 /tools/aapt2/ResourceParser_test.cpp | |
parent | 36a832dd128c18628783cc629b89b2ae399db4f8 (diff) |
AAPT2: Respect format attribute of <item> tag
An <item> is a general tag that can override certain behavior. For
instance, this is allowed:
<item name="foo" type="integer" format="float">0.4</item>
Even though without the format attribute, this would be illegal.
Change-Id: I8133ce59e14719a70d7476a1464c3f564c435289
Diffstat (limited to 'tools/aapt2/ResourceParser_test.cpp')
-rw-r--r-- | tools/aapt2/ResourceParser_test.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/aapt2/ResourceParser_test.cpp b/tools/aapt2/ResourceParser_test.cpp index 84f67c6be005..2cc94d4e97d5 100644 --- a/tools/aapt2/ResourceParser_test.cpp +++ b/tools/aapt2/ResourceParser_test.cpp @@ -575,4 +575,14 @@ TEST_F(ResourceParserTest, AddResourcesElementShouldAddEntryWithUndefinedSymbol) EXPECT_EQ(SymbolState::kUndefined, entry->symbolStatus.state); } +TEST_F(ResourceParserTest, ParseItemElementWithFormat) { + std::string input = R"EOF(<item name="foo" type="integer" format="float">0.3</item>)EOF"; + ASSERT_TRUE(testParse(input)); + + BinaryPrimitive* val = test::getValue<BinaryPrimitive>(&mTable, u"@integer/foo"); + ASSERT_NE(nullptr, val); + + EXPECT_EQ(uint32_t(android::Res_value::TYPE_FLOAT), val->value.dataType); +} + } // namespace aapt |