summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/aapt2/DominatorTree_test.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/tools/aapt2/DominatorTree_test.cpp b/tools/aapt2/DominatorTree_test.cpp
index fe4f951a5cd0..3e49034310c3 100644
--- a/tools/aapt2/DominatorTree_test.cpp
+++ b/tools/aapt2/DominatorTree_test.cpp
@@ -173,4 +173,30 @@ TEST(DominatorTreeTest, LocalesAreNeverDominated) {
EXPECT_EQ(expected, printer.ToString(&tree));
}
+TEST(DominatorTreeTest, NonZeroDensitiesMatch) {
+ const ConfigDescription sw600_config = test::ParseConfigOrDie("sw600dp");
+ const ConfigDescription sw600_hdpi_config = test::ParseConfigOrDie("sw600dp-hdpi");
+ const ConfigDescription sw800_hdpi_config = test::ParseConfigOrDie("sw800dp-hdpi");
+ const ConfigDescription sw800_xxhdpi_config = test::ParseConfigOrDie("sw800dp-xxhdpi");
+
+ std::vector<std::unique_ptr<ResourceConfigValue>> configs;
+ configs.push_back(util::make_unique<ResourceConfigValue>(ConfigDescription::DefaultConfig(), ""));
+ configs.push_back(util::make_unique<ResourceConfigValue>(sw600_config, ""));
+ configs.push_back(util::make_unique<ResourceConfigValue>(sw600_hdpi_config, ""));
+ configs.push_back(util::make_unique<ResourceConfigValue>(sw800_hdpi_config, ""));
+ configs.push_back(util::make_unique<ResourceConfigValue>(sw800_xxhdpi_config, ""));
+
+ DominatorTree tree(configs);
+ PrettyPrinter printer;
+
+ std::string expected =
+ "<default>\n"
+ " sw600dp-v13\n"
+ " sw600dp-hdpi-v13\n"
+ " sw800dp-hdpi-v13\n"
+ " sw800dp-xxhdpi-v13\n";
+ EXPECT_EQ(expected, printer.ToString(&tree));
+}
+
+
} // namespace aapt