Search in sources :

Example 11 with ModuleTargeting

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

the class ModuleConditionsTest method toTargeting_deviceGroupsConditions.

@Test
public void toTargeting_deviceGroupsConditions() {
    ModuleConditions moduleConditions = ModuleConditions.builder().setDeviceGroupsCondition(DeviceGroupsCondition.create(ImmutableSet.of("group1", "group2"))).build();
    ModuleTargeting moduleTargeting = moduleConditions.toTargeting();
    assertThat(moduleTargeting).ignoringRepeatedFieldOrder().isEqualTo(moduleDeviceGroupsTargeting("group1", "group2"));
}
Also used : TargetingUtils.mergeModuleTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.mergeModuleTargeting) ModuleTargeting(com.android.bundle.Targeting.ModuleTargeting) Test(org.junit.Test)

Example 12 with ModuleTargeting

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

the class ModuleConditionsTest method toTargeting_exludeUserCountriesCondition.

@Test
public void toTargeting_exludeUserCountriesCondition() {
    ModuleConditions moduleConditions = ModuleConditions.builder().setUserCountriesCondition(UserCountriesCondition.create(ImmutableList.of("PL", "US"), /* exclude= */
    true)).build();
    ModuleTargeting moduleTargeting = moduleConditions.toTargeting();
    assertThat(moduleTargeting).ignoringRepeatedFieldOrder().isEqualTo(mergeModuleTargeting(moduleExcludeCountriesTargeting("PL", "US")));
}
Also used : TargetingUtils.mergeModuleTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.mergeModuleTargeting) ModuleTargeting(com.android.bundle.Targeting.ModuleTargeting) Test(org.junit.Test)

Example 13 with ModuleTargeting

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

the class ModuleConditionsTest method toTargeting_minSdkVersion.

@Test
public void toTargeting_minSdkVersion() {
    ModuleConditions moduleConditions = ModuleConditions.builder().setMinSdkVersion(26).build();
    ModuleTargeting moduleTargeting = moduleConditions.toTargeting();
    assertThat(moduleTargeting).isEqualTo(moduleMinSdkVersionTargeting(26));
}
Also used : TargetingUtils.mergeModuleTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.mergeModuleTargeting) ModuleTargeting(com.android.bundle.Targeting.ModuleTargeting) Test(org.junit.Test)

Example 14 with ModuleTargeting

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

the class ModuleConditionsTest method toTargeting_deviceFeatureConditions.

@Test
public void toTargeting_deviceFeatureConditions() {
    ModuleConditions moduleConditions = ModuleConditions.builder().addDeviceFeatureCondition(DeviceFeatureCondition.create("com.feature1")).addDeviceFeatureCondition(DeviceFeatureCondition.create("com.feature2")).build();
    ModuleTargeting moduleTargeting = moduleConditions.toTargeting();
    assertThat(moduleTargeting).ignoringRepeatedFieldOrder().isEqualTo(mergeModuleTargeting(moduleFeatureTargeting("com.feature1"), moduleFeatureTargeting("com.feature2")));
}
Also used : TargetingUtils.mergeModuleTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.mergeModuleTargeting) ModuleTargeting(com.android.bundle.Targeting.ModuleTargeting) Test(org.junit.Test)

Example 15 with ModuleTargeting

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

the class ModuleConditionsTest method toTargeting_deviceFeatureVersionedConditions.

@Test
public void toTargeting_deviceFeatureVersionedConditions() {
    ModuleConditions moduleConditions = ModuleConditions.builder().addDeviceFeatureCondition(DeviceFeatureCondition.create("com.feature1", Optional.of(12))).build();
    ModuleTargeting moduleTargeting = moduleConditions.toTargeting();
    assertThat(moduleTargeting).ignoringRepeatedFieldOrder().isEqualTo(mergeModuleTargeting(moduleFeatureTargeting("com.feature1", 12)));
}
Also used : 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