diff options
author | Ryan Mitchell <rtmitchell@google.com> | 2021-03-19 14:54:17 -0700 |
---|---|---|
committer | Ryan Mitchell <rtmitchell@google.com> | 2021-03-29 10:22:10 -0700 |
commit | 1d008d1d2a73a8b796add4e18924fcc99220a839 (patch) | |
tree | 7f7b52c0ede88aa53389f3f5361c6e7e43ad41db /tools/aapt2/cmd/Link_test.cpp | |
parent | 9634efb6f44d8d3f5edbcc7118ad9e3d8e3f9aa9 (diff) |
Refactor aapt2 tests ResourceTable changes
This changes refactors tests to use the NewResourceBuilder class
that makes it easier to construct resource entries.
Bug: 183102797
Test: aapt2_tests
Change-Id: I851f9fb99a003769f8df8c1876997eee0864822a
Diffstat (limited to 'tools/aapt2/cmd/Link_test.cpp')
-rw-r--r-- | tools/aapt2/cmd/Link_test.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/aapt2/cmd/Link_test.cpp b/tools/aapt2/cmd/Link_test.cpp index 73072a963d09..27cbe88fde38 100644 --- a/tools/aapt2/cmd/Link_test.cpp +++ b/tools/aapt2/cmd/Link_test.cpp @@ -47,6 +47,8 @@ TEST_F(LinkTest, RemoveRawXmlStrings) { // Load the binary xml tree android::ResXMLTree tree; std::unique_ptr<LoadedApk> apk = LoadedApk::LoadApkFromPath(out_apk, &diag); + ASSERT_THAT(apk, Ne(nullptr)); + std::unique_ptr<io::IData> data = OpenFileAsData(apk.get(), "res/xml/test.xml"); ASSERT_THAT(data, Ne(nullptr)); AssertLoadXml(apk.get(), data.get(), &tree); @@ -73,6 +75,8 @@ TEST_F(LinkTest, KeepRawXmlStrings) { // Load the binary xml tree android::ResXMLTree tree; std::unique_ptr<LoadedApk> apk = LoadedApk::LoadApkFromPath(out_apk, &diag); + ASSERT_THAT(apk, Ne(nullptr)); + std::unique_ptr<io::IData> data = OpenFileAsData(apk.get(), "res/xml/test.xml"); ASSERT_THAT(data, Ne(nullptr)); AssertLoadXml(apk.get(), data.get(), &tree); @@ -208,6 +212,8 @@ TEST_F(LinkTest, OverlayStyles) { ASSERT_TRUE(Link(link_args, compiled_files_dir, &diag)); std::unique_ptr<LoadedApk> apk = LoadedApk::LoadApkFromPath(out_apk, &diag); + ASSERT_THAT(apk, Ne(nullptr)); + const Style* actual_style = test::GetValue<Style>( apk->GetResourceTable(), std::string(kDefaultPackageName) + ":style/MyStyle"); ASSERT_NE(actual_style, nullptr); @@ -250,6 +256,8 @@ TEST_F(LinkTest, OverrideStylesInsteadOfOverlaying) { ASSERT_TRUE(Link(link_args, compiled_files_dir, &diag)); std::unique_ptr<LoadedApk> apk = LoadedApk::LoadApkFromPath(out_apk, &diag); + ASSERT_THAT(apk, Ne(nullptr)); + const Style* actual_style = test::GetValue<Style>( apk->GetResourceTable(), std::string(kDefaultPackageName) + ":style/MyStyle"); ASSERT_NE(actual_style, nullptr); |