Search in sources :

Example 1 with ModuleTargeting

use of com.android.bundle.Targeting.ModuleTargeting in project bundletool by google.

the class ModuleMatcherTest method matchesModuleTargeting_negative_wrongDeviceTier.

@Test
public void matchesModuleTargeting_negative_wrongDeviceTier() {
    ModuleTargeting targeting = mergeModuleTargeting(moduleMinSdkVersionTargeting(21), moduleFeatureTargeting("feature1"), moduleDeviceGroupsTargeting("highRam"));
    DeviceSpec deviceSpec = mergeSpecs(deviceWithSdk(22), deviceGroups("lowRam"));
    ModuleMatcher moduleMatcher = new ModuleMatcher(deviceSpec);
    assertThat(moduleMatcher.matchesModuleTargeting(targeting)).isFalse();
}
Also used : DeviceSpec(com.android.bundle.Devices.DeviceSpec) TargetingUtils.mergeModuleTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.mergeModuleTargeting) ModuleTargeting(com.android.bundle.Targeting.ModuleTargeting) Test(org.junit.Test)

Example 2 with ModuleTargeting

use of com.android.bundle.Targeting.ModuleTargeting in project bundletool by google.

the class ModuleMatcherTest method matchesModuleTargeting_negative_sdkTooLow.

@Test
public void matchesModuleTargeting_negative_sdkTooLow() {
    ModuleTargeting targeting = mergeModuleTargeting(moduleMinSdkVersionTargeting(21), moduleFeatureTargeting("feature1"));
    DeviceSpec deviceSpecLowSdk = mergeSpecs(deviceWithSdk(19), deviceFeatures("feature1", "feature2"));
    ModuleMatcher moduleMatcher = new ModuleMatcher(deviceSpecLowSdk);
    assertThat(moduleMatcher.matchesModuleTargeting(targeting)).isFalse();
}
Also used : DeviceSpec(com.android.bundle.Devices.DeviceSpec) TargetingUtils.mergeModuleTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.mergeModuleTargeting) ModuleTargeting(com.android.bundle.Targeting.ModuleTargeting) Test(org.junit.Test)

Example 3 with ModuleTargeting

use of com.android.bundle.Targeting.ModuleTargeting in project bundletool by google.

the class ModuleMatcherTest method matchesModuleTargeting_negative_openGlVersionTooLow.

@Test
public void matchesModuleTargeting_negative_openGlVersionTooLow() {
    ModuleTargeting targeting = mergeModuleTargeting(moduleMinSdkVersionTargeting(21), moduleFeatureTargeting(CONDITIONAL_MODULES_OPEN_GL_NAME, 0x30001));
    DeviceSpec deviceSpec = mergeSpecs(deviceWithSdk(22), deviceFeatures("reqGlEsVersion=0x30000"));
    ModuleMatcher moduleMatcher = new ModuleMatcher(deviceSpec);
    assertThat(moduleMatcher.matchesModuleTargeting(targeting)).isFalse();
}
Also used : DeviceSpec(com.android.bundle.Devices.DeviceSpec) TargetingUtils.mergeModuleTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.mergeModuleTargeting) ModuleTargeting(com.android.bundle.Targeting.ModuleTargeting) Test(org.junit.Test)

Example 4 with ModuleTargeting

use of com.android.bundle.Targeting.ModuleTargeting in project bundletool by google.

the class ModuleMatcherTest method matchesModuleTargeting_positive.

@Test
public void matchesModuleTargeting_positive() {
    ModuleTargeting targeting = mergeModuleTargeting(moduleMinSdkVersionTargeting(21), moduleFeatureTargeting("feature1"), moduleFeatureTargeting(CONDITIONAL_MODULES_OPEN_GL_NAME, 0x30001), moduleDeviceGroupsTargeting("highRam"));
    DeviceSpec deviceSpec = mergeSpecs(deviceWithSdk(22), deviceFeatures("feature1", "feature2", "reqGlEsVersion=0x30002"), deviceGroups("highRam"));
    ModuleMatcher moduleMatcher = new ModuleMatcher(deviceSpec);
    assertThat(moduleMatcher.matchesModuleTargeting(targeting)).isTrue();
}
Also used : DeviceSpec(com.android.bundle.Devices.DeviceSpec) TargetingUtils.mergeModuleTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.mergeModuleTargeting) ModuleTargeting(com.android.bundle.Targeting.ModuleTargeting) Test(org.junit.Test)

Example 5 with ModuleTargeting

use of com.android.bundle.Targeting.ModuleTargeting in project bundletool by google.

the class ModuleMatcherTest method matchesModuleTargeting_negative_featureNotPresent.

@Test
public void matchesModuleTargeting_negative_featureNotPresent() {
    ModuleTargeting targeting = mergeModuleTargeting(moduleMinSdkVersionTargeting(21), moduleFeatureTargeting("feature1"));
    DeviceSpec deviceSpecNoFeature = mergeSpecs(deviceWithSdk(21), deviceFeatures("feature2"));
    ModuleMatcher moduleMatcher = new ModuleMatcher(deviceSpecNoFeature);
    assertThat(moduleMatcher.matchesModuleTargeting(targeting)).isFalse();
}
Also used : DeviceSpec(com.android.bundle.Devices.DeviceSpec) TargetingUtils.mergeModuleTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.mergeModuleTargeting) ModuleTargeting(com.android.bundle.Targeting.ModuleTargeting) Test(org.junit.Test)

Aggregations

ModuleTargeting (com.android.bundle.Targeting.ModuleTargeting)18 TargetingUtils.mergeModuleTargeting (com.android.tools.build.bundletool.testing.TargetingUtils.mergeModuleTargeting)18 Test (org.junit.Test)18 DeviceSpec (com.android.bundle.Devices.DeviceSpec)5