summaryrefslogtreecommitdiff
path: root/tools/aapt2/DominatorTree_test.cpp
diff options
context:
space:
mode:
authorRyan Mitchell <rtmitchell@google.com>2020-11-15 21:41:24 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2020-11-15 21:41:24 +0000
commit8f2f4e14deb73eee88094a40091c1cbaf2952d26 (patch)
treecdab2fb44da8a1b01d172b8165ba044080389511 /tools/aapt2/DominatorTree_test.cpp
parentba6f39518816a8e0060bfa90b9b7cb0472613e7d (diff)
parent527ebbaa55f42e90a05f12f0154294d2e9d16903 (diff)
Merge "Fix DominatorTree for locale and mcc/mnc config"
Diffstat (limited to 'tools/aapt2/DominatorTree_test.cpp')
-rw-r--r--tools/aapt2/DominatorTree_test.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/tools/aapt2/DominatorTree_test.cpp b/tools/aapt2/DominatorTree_test.cpp
index 3e49034310c3..52949da1b64f 100644
--- a/tools/aapt2/DominatorTree_test.cpp
+++ b/tools/aapt2/DominatorTree_test.cpp
@@ -198,5 +198,33 @@ TEST(DominatorTreeTest, NonZeroDensitiesMatch) {
EXPECT_EQ(expected, printer.ToString(&tree));
}
+TEST(DominatorTreeTest, MccMncIsPeertoLocale) {
+ const ConfigDescription default_config = {};
+ const ConfigDescription de_config = test::ParseConfigOrDie("de");
+ const ConfigDescription fr_config = test::ParseConfigOrDie("fr");
+ const ConfigDescription mcc_config = test::ParseConfigOrDie("mcc262");
+ const ConfigDescription mcc_fr_config = test::ParseConfigOrDie("mcc262-fr");
+ const ConfigDescription mnc_config = test::ParseConfigOrDie("mnc2");
+ const ConfigDescription mnc_fr_config = test::ParseConfigOrDie("mnc2-fr");
+ std::vector<std::unique_ptr<ResourceConfigValue>> configs;
+ configs.push_back(util::make_unique<ResourceConfigValue>(default_config, ""));
+ configs.push_back(util::make_unique<ResourceConfigValue>(de_config, ""));
+ configs.push_back(util::make_unique<ResourceConfigValue>(fr_config, ""));
+ configs.push_back(util::make_unique<ResourceConfigValue>(mcc_config, ""));
+ configs.push_back(util::make_unique<ResourceConfigValue>(mcc_fr_config, ""));
+ configs.push_back(util::make_unique<ResourceConfigValue>(mnc_config, ""));
+ configs.push_back(util::make_unique<ResourceConfigValue>(mnc_fr_config, ""));
+ DominatorTree tree(configs);
+ PrettyPrinter printer;
+ std::string expected =
+ "<default>\n"
+ "de\n"
+ "fr\n"
+ "mcc262\n"
+ "mcc262-fr\n"
+ "mnc2\n"
+ "mnc2-fr\n";
+ EXPECT_EQ(expected, printer.ToString(&tree));
+}
} // namespace aapt