summaryrefslogtreecommitdiff
path: root/tools/aapt2/java/JavaClassGenerator_test.cpp
diff options
context:
space:
mode:
authorMichael Wright <michaelwr@google.com>2016-05-16 13:29:54 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-05-16 13:29:54 +0000
commit837b33ab9ce9fcbbdb795ff7f5fbec4be6f9f2a0 (patch)
tree578a69b68f4172a37a059e685a7b9109e73060a8 /tools/aapt2/java/JavaClassGenerator_test.cpp
parent883c25a510b62c33c1e95f3195a2566716c4981b (diff)
parent365eaeef5fb511225f979fc2b55a32cbdcbd933c (diff)
Merge "Stop emitting javadoc for @removed attributes." into nyc-dev am: c4033e7c66
am: 365eaeef5f * commit '365eaeef5fb511225f979fc2b55a32cbdcbd933c': Stop emitting javadoc for @removed attributes. Change-Id: Ib62aa382b5f626f98c1b560e0483a243d960d0e8
Diffstat (limited to 'tools/aapt2/java/JavaClassGenerator_test.cpp')
-rw-r--r--tools/aapt2/java/JavaClassGenerator_test.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/tools/aapt2/java/JavaClassGenerator_test.cpp b/tools/aapt2/java/JavaClassGenerator_test.cpp
index 7d0aa83a0fb8..46266b3f3e89 100644
--- a/tools/aapt2/java/JavaClassGenerator_test.cpp
+++ b/tools/aapt2/java/JavaClassGenerator_test.cpp
@@ -289,4 +289,37 @@ TEST(JavaClassGeneratorTest, CommentsForStyleablesAndNestedAttributesArePresent)
EXPECT_NE(std::string::npos, actual.find(util::utf16ToUtf8(styleable.getComment())));
}
+TEST(JavaClassGeneratorTest, CommentsForRemovedAttributesAreNotPresentInClass) {
+ Attribute attr(false);
+ attr.setComment(StringPiece16(u"@removed"));
+
+
+ std::unique_ptr<ResourceTable> table = test::ResourceTableBuilder()
+ .setPackageId(u"android", 0x01)
+ .addValue(u"@android:attr/one", util::make_unique<Attribute>(attr))
+ .build();
+
+ std::unique_ptr<IAaptContext> context = test::ContextBuilder()
+ .addSymbolSource(util::make_unique<ResourceTableSymbolSource>(table.get()))
+ .setNameManglerPolicy(NameManglerPolicy{ u"android" })
+ .build();
+ JavaClassGeneratorOptions options;
+ options.useFinal = false;
+ JavaClassGenerator generator(context.get(), table.get(), options);
+ std::stringstream out;
+ ASSERT_TRUE(generator.generate(u"android", &out));
+ std::string actual = out.str();
+
+ std::cout << actual << std::endl;
+
+ EXPECT_EQ(std::string::npos, actual.find("@attr name android:one"));
+ EXPECT_EQ(std::string::npos, actual.find("@attr description"));
+
+ // We should find @removed only in the attribute javadoc and not anywhere else (i.e. the class
+ // javadoc).
+ const size_t pos = actual.find("@removed");
+ EXPECT_NE(std::string::npos, pos);
+ EXPECT_EQ(std::string::npos, actual.find("@removed", pos + 1));
+}
+
} // namespace aapt