AAPT2: Add support for comments in R.java

Change-Id: Iaa5f3b75bf7de9dbf458fa5c452f7312989f4c4f
This commit is contained in:
Adam Lesinski
2015-10-30 16:31:42 -07:00
parent 104e028c3a
commit 3b4cd94034
9 changed files with 249 additions and 52 deletions

View File

@@ -198,4 +198,35 @@ TEST(JavaClassGeneratorTest, EmitOtherPackagesAttributesInStyleable) {
EXPECT_NE(std::string::npos, output.find("int foo_com_lib_bar ="));
}
TEST(JavaClassGeneratorTest, CommentsForSimpleResourcesArePresent) {
std::unique_ptr<ResourceTable> table = test::ResourceTableBuilder()
.setPackageId(u"android", 0x01)
.addSimple(u"@android:id/foo", ResourceId(0x01010000))
.build();
test::getValue<Id>(table.get(), u"@android:id/foo")
->setComment(std::u16string(u"This is a comment\n@deprecated"));
JavaClassGenerator generator(table.get(), {});
std::stringstream out;
ASSERT_TRUE(generator.generate(u"android", &out));
std::string actual = out.str();
EXPECT_NE(std::string::npos, actual.find(
R"EOF(/**
* This is a comment
* @deprecated
*/
@Deprecated
public static final int foo = 0x01010000;)EOF"));
}
TEST(JavaClassGeneratorTest, CommentsForEnumAndFlagAttributesArePresent) {
}
TEST(JavaClassGeneratorTest, CommentsForStyleablesAndNestedAttributesArePresent) {
}
} // namespace aapt