diff options
author | Ryan Mitchell <rtmitchell@google.com> | 2020-12-14 20:42:03 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2020-12-14 20:42:03 +0000 |
commit | 314863c132479b108f0ce61a5a753123cd3a15ca (patch) | |
tree | 8c2c62e7f5964b3ed503f1f2c753d0850ac70dec /libs/androidfw/tests/AttributeResolution_test.cpp | |
parent | 2991744d472491889d9ba465c8f96c1022af5df0 (diff) | |
parent | a45506e6f6619f59ce1ae94b20ad377b86966be0 (diff) |
Merge changes from topic "inc-hard-am"
* changes:
Revert^2 "Cache resolved theme values"
Set resource id correctly when resolve fails
Revert^2 "libandroidfw hardening for IncFs"
idmap2: remove call to obsolete 'idmap2 verify' from valgrind.sh
idmap2: remove the 'scan' command
Diffstat (limited to 'libs/androidfw/tests/AttributeResolution_test.cpp')
-rw-r--r-- | libs/androidfw/tests/AttributeResolution_test.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/libs/androidfw/tests/AttributeResolution_test.cpp b/libs/androidfw/tests/AttributeResolution_test.cpp index 24361b5817f4..bb9129ad01c8 100644 --- a/libs/androidfw/tests/AttributeResolution_test.cpp +++ b/libs/androidfw/tests/AttributeResolution_test.cpp @@ -77,9 +77,9 @@ TEST(AttributeResolutionLibraryTest, ApplyStyleWithDefaultStyleResId) { {fix_package_id(R::attr::attr_one, 0x02), fix_package_id(R::attr::attr_two, 0x02)}}; std::array<uint32_t, attrs.size() * STYLE_NUM_ENTRIES> values; std::array<uint32_t, attrs.size() + 1> indices; - ApplyStyle(theme.get(), nullptr /*xml_parser*/, 0u /*def_style_attr*/, - fix_package_id(R::style::StyleOne, 0x02), attrs.data(), attrs.size(), values.data(), - indices.data()); + ASSERT_TRUE(ApplyStyle(theme.get(), nullptr /*xml_parser*/, 0u /*def_style_attr*/, + fix_package_id(R::style::StyleOne, 0x02), attrs.data(), attrs.size(), + values.data(), indices.data()).has_value()); const uint32_t public_flag = ResTable_typeSpec::SPEC_PUBLIC; @@ -102,7 +102,7 @@ TEST(AttributeResolutionLibraryTest, ApplyStyleWithDefaultStyleResId) { TEST_F(AttributeResolutionTest, Theme) { std::unique_ptr<Theme> theme = assetmanager_.NewTheme(); - ASSERT_TRUE(theme->ApplyStyle(R::style::StyleTwo)); + ASSERT_TRUE(theme->ApplyStyle(R::style::StyleTwo).has_value()); std::array<uint32_t, 5> attrs{{R::attr::attr_one, R::attr::attr_two, R::attr::attr_three, R::attr::attr_four, R::attr::attr_empty}}; @@ -110,7 +110,7 @@ TEST_F(AttributeResolutionTest, Theme) { ASSERT_TRUE(ResolveAttrs(theme.get(), 0u /*def_style_attr*/, 0u /*def_style_res*/, nullptr /*src_values*/, 0 /*src_values_length*/, attrs.data(), - attrs.size(), values.data(), nullptr /*out_indices*/)); + attrs.size(), values.data(), nullptr /*out_indices*/).has_value()); const uint32_t public_flag = ResTable_typeSpec::SPEC_PUBLIC; @@ -162,7 +162,7 @@ TEST_F(AttributeResolutionXmlTest, XmlParser) { std::array<uint32_t, attrs.size() * STYLE_NUM_ENTRIES> values; ASSERT_TRUE(RetrieveAttributes(&assetmanager_, &xml_parser_, attrs.data(), attrs.size(), - values.data(), nullptr /*out_indices*/)); + values.data(), nullptr /*out_indices*/).has_value()); uint32_t* values_cursor = values.data(); EXPECT_EQ(Res_value::TYPE_NULL, values_cursor[STYLE_TYPE]); @@ -207,15 +207,15 @@ TEST_F(AttributeResolutionXmlTest, XmlParser) { TEST_F(AttributeResolutionXmlTest, ThemeAndXmlParser) { std::unique_ptr<Theme> theme = assetmanager_.NewTheme(); - ASSERT_TRUE(theme->ApplyStyle(R::style::StyleTwo)); + ASSERT_TRUE(theme->ApplyStyle(R::style::StyleTwo).has_value()); std::array<uint32_t, 6> attrs{{R::attr::attr_one, R::attr::attr_two, R::attr::attr_three, R::attr::attr_four, R::attr::attr_five, R::attr::attr_empty}}; std::array<uint32_t, attrs.size() * STYLE_NUM_ENTRIES> values; std::array<uint32_t, attrs.size() + 1> indices; - ApplyStyle(theme.get(), &xml_parser_, 0u /*def_style_attr*/, 0u /*def_style_res*/, attrs.data(), - attrs.size(), values.data(), indices.data()); + ASSERT_TRUE(ApplyStyle(theme.get(), &xml_parser_, 0u /*def_style_attr*/, 0u /*def_style_res*/, + attrs.data(), attrs.size(), values.data(), indices.data()).has_value()); const uint32_t public_flag = ResTable_typeSpec::SPEC_PUBLIC; |