diff options
author | Steven Laver <lavers@google.com> | 2019-01-20 16:40:46 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2019-01-20 16:40:46 +0000 |
commit | c470daee1cf372142e66d4786f98b157f284dacb (patch) | |
tree | c118879b496f19919078294bd68a7867dc7e5d0f /tools/aapt2/java/JavaClassGenerator_test.cpp | |
parent | be058067720e1688137c15e68d5c4e50c4d66904 (diff) | |
parent | 67924d836712134f300f2952dad900daa5f3c98d (diff) |
Merge changes from topic "QP1A.190107.001" into q-keystone-qcom-dev
* changes:
Clear verification completed flag if an optional verifier is used
telephony: hide added members in DisconnectCause
location: fix build errors
Update CarrierIdentifier constructors to match public API signature
remove duplicate 'data_connection_5g'
Move persist.debug.trace handling to frameworks
Merge QP1A.190107.001
Diffstat (limited to 'tools/aapt2/java/JavaClassGenerator_test.cpp')
-rw-r--r-- | tools/aapt2/java/JavaClassGenerator_test.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tools/aapt2/java/JavaClassGenerator_test.cpp b/tools/aapt2/java/JavaClassGenerator_test.cpp index fa208be120ed..4f51fc48c80e 100644 --- a/tools/aapt2/java/JavaClassGenerator_test.cpp +++ b/tools/aapt2/java/JavaClassGenerator_test.cpp @@ -366,6 +366,46 @@ TEST(JavaClassGeneratorTest, CommentsForStyleablesAndNestedAttributesArePresent) ASSERT_TRUE(generator.Generate("android", &out)); out.Flush(); + EXPECT_THAT(output, HasSubstr("#Container_one android:one")); + EXPECT_THAT(output, HasSubstr("@see #Container_one")); + EXPECT_THAT(output, HasSubstr("attr name android:one")); + EXPECT_THAT(output, HasSubstr("attr description")); + EXPECT_THAT(output, HasSubstr(attr.GetComment())); + EXPECT_THAT(output, HasSubstr(styleable.GetComment())); +} + +TEST(JavaClassGeneratorTest, CommentsForStyleableHiddenAttributesAreNotPresent) { + Attribute attr; + attr.SetComment(StringPiece("This is an attribute @hide")); + + Styleable styleable; + styleable.entries.push_back(Reference(test::ParseNameOrDie("android:attr/one"))); + styleable.SetComment(StringPiece("This is a styleable")); + + std::unique_ptr<ResourceTable> table = + test::ResourceTableBuilder() + .SetPackageId("android", 0x01) + .AddValue("android:attr/one", util::make_unique<Attribute>(attr)) + .AddValue("android:styleable/Container", + std::unique_ptr<Styleable>(styleable.Clone(nullptr))) + .Build(); + + std::unique_ptr<IAaptContext> context = + test::ContextBuilder() + .AddSymbolSource(util::make_unique<ResourceTableSymbolSource>(table.get())) + .SetNameManglerPolicy(NameManglerPolicy{"android"}) + .Build(); + JavaClassGeneratorOptions options; + options.use_final = false; + JavaClassGenerator generator(context.get(), table.get(), options); + + std::string output; + StringOutputStream out(&output); + ASSERT_TRUE(generator.Generate("android", &out)); + out.Flush(); + + EXPECT_THAT(output, Not(HasSubstr("#Container_one android:one"))); + EXPECT_THAT(output, Not(HasSubstr("@see #Container_one"))); EXPECT_THAT(output, HasSubstr("attr name android:one")); EXPECT_THAT(output, HasSubstr("attr description")); EXPECT_THAT(output, HasSubstr(attr.GetComment())); |