diff options
Diffstat (limited to 'tools/aapt2/ResourceParser_test.cpp')
-rw-r--r-- | tools/aapt2/ResourceParser_test.cpp | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/tools/aapt2/ResourceParser_test.cpp b/tools/aapt2/ResourceParser_test.cpp index 144ebd22e105..9a5cd3edb47f 100644 --- a/tools/aapt2/ResourceParser_test.cpp +++ b/tools/aapt2/ResourceParser_test.cpp @@ -22,7 +22,7 @@ #include "ResourceTable.h" #include "ResourceUtils.h" #include "ResourceValues.h" -#include "io/StringInputStream.h" +#include "io/StringStream.h" #include "test/Test.h" #include "xml/XmlPullParser.h" @@ -790,4 +790,49 @@ TEST_F(ResourceParserTest, ParsePlatformIndependentNewline) { ASSERT_TRUE(TestParse(R"(<string name="foo">%1$s %n %2$s</string>)")); } +TEST_F(ResourceParserTest, ParseOverlayableTagWithSystemPolicy) { + std::string input = R"( + <overlayable policy="illegal_policy"> + <item type="string" name="foo" /> + </overlayable>)"; + EXPECT_FALSE(TestParse(input)); + + input = R"( + <overlayable policy="system"> + <item name="foo" /> + </overlayable>)"; + EXPECT_FALSE(TestParse(input)); + + input = R"( + <overlayable policy="system"> + <item type="attr" /> + </overlayable>)"; + EXPECT_FALSE(TestParse(input)); + + input = R"( + <overlayable policy="system"> + <item type="bad_type" name="foo" /> + </overlayable>)"; + EXPECT_FALSE(TestParse(input)); + + input = R"(<overlayable policy="system" />)"; + EXPECT_TRUE(TestParse(input)); + + input = R"(<overlayable />)"; + EXPECT_TRUE(TestParse(input)); + + input = R"( + <overlayable policy="system"> + <item type="string" name="foo" /> + <item type="dimen" name="foo" /> + </overlayable>)"; + ASSERT_TRUE(TestParse(input)); + + input = R"( + <overlayable> + <item type="string" name="bar" /> + </overlayable>)"; + ASSERT_TRUE(TestParse(input)); +} + } // namespace aapt |