From 73bff1e8519bb73f17a801f45977d41b69b5b0d0 Mon Sep 17 00:00:00 2001 From: Adam Lesinski Date: Fri, 8 Dec 2017 16:06:10 -0800 Subject: AAPT2: Allow compatible duplicate Attributes If a resource XML file defines two compatible Attributes, they should be merged without throwing an error. Ex: In this case, string|reference and string are the same, so these should merge correctly. Bug: 65699599 Test: make aapt2_tests Test: make AaptBasicTest Change-Id: I7b0f956d2332f7f0b458acd59ca0a606b2cfdf95 --- tools/aapt2/java/JavaClassGenerator_test.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'tools/aapt2/java/JavaClassGenerator_test.cpp') diff --git a/tools/aapt2/java/JavaClassGenerator_test.cpp b/tools/aapt2/java/JavaClassGenerator_test.cpp index 5beb594bd92f..e449546f9399 100644 --- a/tools/aapt2/java/JavaClassGenerator_test.cpp +++ b/tools/aapt2/java/JavaClassGenerator_test.cpp @@ -57,7 +57,7 @@ TEST(JavaClassGeneratorTest, TransformInvalidJavaIdentifierCharacter) { .SetPackageId("android", 0x01) .AddSimple("android:id/hey-man", ResourceId(0x01020000)) .AddValue("android:attr/cool.attr", ResourceId(0x01010000), - test::AttributeBuilder(false).Build()) + test::AttributeBuilder().Build()) .AddValue("android:styleable/hey.dude", ResourceId(0x01030000), test::StyleableBuilder() .AddItem("android:attr/cool.attr", ResourceId(0x01010000)) @@ -229,10 +229,8 @@ TEST(JavaClassGeneratorTest, EmitOtherPackagesAttributesInStyleable) { test::ResourceTableBuilder() .SetPackageId("android", 0x01) .SetPackageId("com.lib", 0x02) - .AddValue("android:attr/bar", ResourceId(0x01010000), - test::AttributeBuilder(false).Build()) - .AddValue("com.lib:attr/bar", ResourceId(0x02010000), - test::AttributeBuilder(false).Build()) + .AddValue("android:attr/bar", ResourceId(0x01010000), test::AttributeBuilder().Build()) + .AddValue("com.lib:attr/bar", ResourceId(0x02010000), test::AttributeBuilder().Build()) .AddValue("android:styleable/foo", ResourceId(0x01030000), test::StyleableBuilder() .AddItem("android:attr/bar", ResourceId(0x01010000)) @@ -290,7 +288,7 @@ TEST(JavaClassGeneratorTest, CommentsForSimpleResourcesArePresent) { TEST(JavaClassGeneratorTest, CommentsForEnumAndFlagAttributesArePresent) {} TEST(JavaClassGeneratorTest, CommentsForStyleablesAndNestedAttributesArePresent) { - Attribute attr(false); + Attribute attr; attr.SetComment(StringPiece("This is an attribute")); Styleable styleable; @@ -375,7 +373,7 @@ TEST(JavaClassGeneratorTest, StyleableAndIndicesAreColocated) { } TEST(JavaClassGeneratorTest, CommentsForRemovedAttributesAreNotPresentInClass) { - Attribute attr(false); + Attribute attr; attr.SetComment(StringPiece("removed")); std::unique_ptr table = @@ -413,7 +411,7 @@ TEST(JavaClassGeneratorTest, GenerateOnResourcesLoadedCallbackForSharedLibrary) std::unique_ptr table = test::ResourceTableBuilder() .SetPackageId("android", 0x00) - .AddValue("android:attr/foo", ResourceId(0x00010000), util::make_unique(false)) + .AddValue("android:attr/foo", ResourceId(0x00010000), util::make_unique()) .AddValue("android:id/foo", ResourceId(0x00020000), util::make_unique()) .AddValue( "android:style/foo", ResourceId(0x00030000), -- cgit v1.2.3