diff options
Diffstat (limited to 'libs/androidfw/tests/ResTable_test.cpp')
-rw-r--r-- | libs/androidfw/tests/ResTable_test.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/libs/androidfw/tests/ResTable_test.cpp b/libs/androidfw/tests/ResTable_test.cpp index 7cd7fb5cd711..b8b46259f0d1 100644 --- a/libs/androidfw/tests/ResTable_test.cpp +++ b/libs/androidfw/tests/ResTable_test.cpp @@ -39,8 +39,20 @@ namespace { */ #include "data/basic/basic_arsc.h" +/** + * Include a binary library resource table. + * + * Package: com.android.test.basic + */ #include "data/lib/lib_arsc.h" +/** + * Include a system resource table. + * + * Package: android + */ +#include "data/system/system_arsc.h" + TEST(ResTableTest, shouldLoadSuccessfully) { ResTable table; ASSERT_EQ(NO_ERROR, table.add(basic_arsc, basic_arsc_len)); @@ -324,4 +336,25 @@ TEST(ResTableTest, ShareButDontModifyResTable) { ASSERT_EQ(uint32_t(600), val.data); } +TEST(ResTableTest, GetConfigurationsReturnsUniqueList) { + ResTable table; + ASSERT_EQ(NO_ERROR, table.add(system_arsc, system_arsc_len)); + ASSERT_EQ(NO_ERROR, table.add(basic_arsc, basic_arsc_len)); + + ResTable_config configSv; + memset(&configSv, 0, sizeof(configSv)); + configSv.language[0] = 's'; + configSv.language[1] = 'v'; + + Vector<ResTable_config> configs; + table.getConfigurations(&configs); + + EXPECT_EQ(1, std::count(configs.begin(), configs.end(), configSv)); + + Vector<String8> locales; + table.getLocales(&locales); + + EXPECT_EQ(1, std::count(locales.begin(), locales.end(), String8("sv"))); +} + } // namespace |