コード例 #1
0
TEST(RuleGeneratorTest, testDensityRulesWithAnyDpi) {
    Vector<int> densities;
    const ssize_t highIndex = densities.add(ConfigDescription::DENSITY_HIGH);
    const ssize_t xhighIndex = densities.add(ConfigDescription::DENSITY_XHIGH);
    const ssize_t xxhighIndex = densities.add(ConfigDescription::DENSITY_XXHIGH);
    const ssize_t anyIndex = densities.add(ConfigDescription::DENSITY_ANY);

    EXPECT_RULES_EQ(RuleGenerator::generateDensity(densities, highIndex),
            AndRule()
            .add(LtRule(Rule::SDK_VERSION, SDK_LOLLIPOP))
            .add(LtRule(Rule::SCREEN_DENSITY, 263))
    );

    EXPECT_RULES_EQ(RuleGenerator::generateDensity(densities, xhighIndex),
            AndRule()
            .add(LtRule(Rule::SDK_VERSION, SDK_LOLLIPOP))
            .add(GtRule(Rule::SCREEN_DENSITY, 262))
            .add(LtRule(Rule::SCREEN_DENSITY, 363))
    );

    EXPECT_RULES_EQ(RuleGenerator::generateDensity(densities, xxhighIndex),
            AndRule()
            .add(LtRule(Rule::SDK_VERSION, SDK_LOLLIPOP))
            .add(GtRule(Rule::SCREEN_DENSITY, 362))
    );

    // We expect AlwaysTrue because anydpi always has attached v21 to the configuration
    // and the rest of the rule generation code generates the sdk version checks.
    EXPECT_RULES_EQ(RuleGenerator::generateDensity(densities, anyIndex), AlwaysTrue());
}
コード例 #2
0
ファイル: Limit.hpp プロジェクト: jakobandersen/mod
Limit<Next> makeLimit(std::size_t maxHits, Next next = AlwaysTrue()) {
	return Limit<Next>(maxHits, next);
}