diff options
Diffstat (limited to 'tools/aapt2/ResourceParser_test.cpp')
-rw-r--r-- | tools/aapt2/ResourceParser_test.cpp | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/tools/aapt2/ResourceParser_test.cpp b/tools/aapt2/ResourceParser_test.cpp index 2cc94d4e97d5..ab44a064a953 100644 --- a/tools/aapt2/ResourceParser_test.cpp +++ b/tools/aapt2/ResourceParser_test.cpp @@ -215,7 +215,7 @@ TEST_F(ResourceParserTest, ParseFlagAttr) { ASSERT_TRUE(testParse(input)); Attribute* flagAttr = test::getValue<Attribute>(&mTable, u"@attr/foo"); - ASSERT_NE(flagAttr, nullptr); + ASSERT_NE(nullptr, flagAttr); EXPECT_EQ(flagAttr->typeMask, android::ResTable_map::TYPE_FLAGS); ASSERT_EQ(flagAttr->symbols.size(), 3u); @@ -233,7 +233,7 @@ TEST_F(ResourceParserTest, ParseFlagAttr) { std::unique_ptr<BinaryPrimitive> flagValue = ResourceUtils::tryParseFlagSymbol(flagAttr, u"baz|bat"); - ASSERT_NE(flagValue, nullptr); + ASSERT_NE(nullptr, flagValue); EXPECT_EQ(flagValue->value.data, 1u | 2u); } @@ -255,7 +255,7 @@ TEST_F(ResourceParserTest, ParseStyle) { ASSERT_TRUE(testParse(input)); Style* style = test::getValue<Style>(&mTable, u"@style/foo"); - ASSERT_NE(style, nullptr); + ASSERT_NE(nullptr, style); AAPT_ASSERT_TRUE(style->parent); AAPT_ASSERT_TRUE(style->parent.value().name); EXPECT_EQ(test::parseNameOrDie(u"@style/fu"), style->parent.value().name.value()); @@ -276,7 +276,7 @@ TEST_F(ResourceParserTest, ParseStyleWithShorthandParent) { ASSERT_TRUE(testParse(input)); Style* style = test::getValue<Style>(&mTable, u"@style/foo"); - ASSERT_NE(style, nullptr); + ASSERT_NE(nullptr, style); AAPT_ASSERT_TRUE(style->parent); AAPT_ASSERT_TRUE(style->parent.value().name); EXPECT_EQ(test::parseNameOrDie(u"@com.app:style/Theme"), style->parent.value().name.value()); @@ -288,7 +288,7 @@ TEST_F(ResourceParserTest, ParseStyleWithPackageAliasedParent) { ASSERT_TRUE(testParse(input)); Style* style = test::getValue<Style>(&mTable, u"@style/foo"); - ASSERT_NE(style, nullptr); + ASSERT_NE(nullptr, style); AAPT_ASSERT_TRUE(style->parent); AAPT_ASSERT_TRUE(style->parent.value().name); EXPECT_EQ(test::parseNameOrDie(u"@android:style/Theme"), style->parent.value().name.value()); @@ -302,7 +302,7 @@ TEST_F(ResourceParserTest, ParseStyleWithPackageAliasedItems) { ASSERT_TRUE(testParse(input)); Style* style = test::getValue<Style>(&mTable, u"@style/foo"); - ASSERT_NE(style, nullptr); + ASSERT_NE(nullptr, style); ASSERT_EQ(1u, style->entries.size()); EXPECT_EQ(test::parseNameOrDie(u"@android:attr/bar"), style->entries[0].key.name.value()); } @@ -312,7 +312,7 @@ TEST_F(ResourceParserTest, ParseStyleWithInferredParent) { ASSERT_TRUE(testParse(input)); Style* style = test::getValue<Style>(&mTable, u"@style/foo.bar"); - ASSERT_NE(style, nullptr); + ASSERT_NE(nullptr, style); AAPT_ASSERT_TRUE(style->parent); AAPT_ASSERT_TRUE(style->parent.value().name); EXPECT_EQ(style->parent.value().name.value(), test::parseNameOrDie(u"@style/foo")); @@ -324,11 +324,21 @@ TEST_F(ResourceParserTest, ParseStyleWithInferredParentOverridenByEmptyParentAtt ASSERT_TRUE(testParse(input)); Style* style = test::getValue<Style>(&mTable, u"@style/foo.bar"); - ASSERT_NE(style, nullptr); + ASSERT_NE(nullptr, style); AAPT_EXPECT_FALSE(style->parent); EXPECT_FALSE(style->parentInferred); } +TEST_F(ResourceParserTest, ParseStyleWithPrivateParentReference) { + std::string input = R"EOF(<style name="foo" parent="*android:style/bar" />)EOF"; + ASSERT_TRUE(testParse(input)); + + Style* style = test::getValue<Style>(&mTable, u"@style/foo"); + ASSERT_NE(nullptr, style); + AAPT_ASSERT_TRUE(style->parent); + EXPECT_TRUE(style->parent.value().privateReference); +} + TEST_F(ResourceParserTest, ParseAutoGeneratedIdReference) { std::string input = "<string name=\"foo\">@+id/bar</string>"; ASSERT_TRUE(testParse(input)); |