Search in sources :

Example 6 with ModuleTargeting

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

the class BundleModuleTest method moduleTargeting_noConditions_noMinSdkInherited.

@Test
public void moduleTargeting_noConditions_noMinSdkInherited() {
    BundleModule bundleModule = createMinimalModuleBuilder().setAndroidManifestProto(androidManifest("com.test.app", withMinSdkVersion(24))).build();
    ModuleTargeting moduleTargeting = bundleModule.getModuleMetadata().getTargeting();
    assertThat(moduleTargeting).isEqualToDefaultInstance();
}
Also used : TargetingUtils.mergeModuleTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.mergeModuleTargeting) ModuleTargeting(com.android.bundle.Targeting.ModuleTargeting) Test(org.junit.Test)

Example 7 with ModuleTargeting

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

the class BundleModuleTest method moduleTargeting_noModuleMinSdkVersion_noConditionsAddded.

@Test
public void moduleTargeting_noModuleMinSdkVersion_noConditionsAddded() {
    BundleModule bundleModule = createMinimalModuleBuilder().setAndroidManifestProto(androidManifest("com.test.app", withFeatureCondition("com.feature1"))).build();
    ModuleTargeting moduleTargeting = bundleModule.getModuleMetadata().getTargeting();
    assertThat(moduleTargeting).ignoringRepeatedFieldOrder().isEqualTo(moduleFeatureTargeting("com.feature1"));
}
Also used : TargetingUtils.mergeModuleTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.mergeModuleTargeting) ModuleTargeting(com.android.bundle.Targeting.ModuleTargeting) Test(org.junit.Test)

Example 8 with ModuleTargeting

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

the class ModuleConditionsTest method toTargeting_minMaxSdkVersions.

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

Example 9 with ModuleTargeting

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

the class ModuleConditionsTest method toTargeting_userCountriesCondition.

@Test
public void toTargeting_userCountriesCondition() {
    ModuleConditions moduleConditions = ModuleConditions.builder().setUserCountriesCondition(UserCountriesCondition.create(ImmutableList.of("PL", "US"), /* exclude= */
    false)).build();
    ModuleTargeting moduleTargeting = moduleConditions.toTargeting();
    assertThat(moduleTargeting).ignoringRepeatedFieldOrder().isEqualTo(mergeModuleTargeting(moduleIncludeCountriesTargeting("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 10 with ModuleTargeting

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

the class ModuleConditionsTest method toTargeting_maxSdkVersion.

@Test
public void toTargeting_maxSdkVersion() {
    ModuleConditions moduleConditions = ModuleConditions.builder().setMaxSdkVersion(26).build();
    ModuleTargeting moduleTargeting = moduleConditions.toTargeting();
    assertThat(moduleTargeting).isEqualTo(moduleMaxSdkVersionTargeting(26));
}
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