Merge "Make configs differing only in density siblings" am: db0a92a881
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1430088 Change-Id: Ibe1ca214e65376d9c531c40bd7f89dc931e709ef
This commit is contained in:
@@ -177,9 +177,8 @@ inline ConfigDescription& ConfigDescription::operator=(ConfigDescription&& o) no
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool ConfigDescription::MatchWithDensity(
|
inline bool ConfigDescription::MatchWithDensity(const ConfigDescription& o) const {
|
||||||
const ConfigDescription& o) const {
|
return match(o) && (density == 0 || o.density != 0);
|
||||||
return match(o) && (density == 0 || density == o.density);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool ConfigDescription::operator<(const ConfigDescription& o) const {
|
inline bool ConfigDescription::operator<(const ConfigDescription& o) const {
|
||||||
|
|||||||
@@ -173,4 +173,30 @@ TEST(DominatorTreeTest, LocalesAreNeverDominated) {
|
|||||||
EXPECT_EQ(expected, printer.ToString(&tree));
|
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
|
} // namespace aapt
|
||||||
|
|||||||
Reference in New Issue
Block a user