Search in sources :

Example 26 with ApkTargeting

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

the class MergingUtilsTest method mergeShardTargetings_equalLanguages_ok.

@Test
public void mergeShardTargetings_equalLanguages_ok() {
    ApkTargeting targeting = apkLanguageTargeting("en");
    assertThat(MergingUtils.mergeShardTargetings(targeting, targeting)).isEqualTo(apkLanguageTargeting("en"));
}
Also used : ApkTargeting(com.android.bundle.Targeting.ApkTargeting) TargetingUtils.mergeApkTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.mergeApkTargeting) Test(org.junit.Test)

Example 27 with ApkTargeting

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

the class MergingUtilsTest method mergeShardTargetings_equalTextureCompressionFormat_ok.

@Test
public void mergeShardTargetings_equalTextureCompressionFormat_ok() {
    ApkTargeting targeting = apkTextureTargeting(textureCompressionTargeting(S3TC, ImmutableSet.of(ETC1_RGB8)));
    assertThat(MergingUtils.mergeShardTargetings(targeting, targeting)).isEqualTo(apkTextureTargeting(textureCompressionTargeting(S3TC, ImmutableSet.of(ETC1_RGB8))));
}
Also used : ApkTargeting(com.android.bundle.Targeting.ApkTargeting) TargetingUtils.mergeApkTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.mergeApkTargeting) Test(org.junit.Test)

Example 28 with ApkTargeting

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

the class MergingUtilsTest method mergeShardTargetings_differentDeviceTiers_ok.

@Test
public void mergeShardTargetings_differentDeviceTiers_ok() {
    ApkTargeting targeting1 = apkDeviceTierTargeting(deviceTierTargeting(0, ImmutableList.of(1)));
    ApkTargeting targeting2 = apkDeviceTierTargeting(deviceTierTargeting(0, ImmutableList.of(2)));
    assertThat(MergingUtils.mergeShardTargetings(targeting1, targeting2)).isEqualTo(apkDeviceTierTargeting(deviceTierTargeting(0, ImmutableList.of(1, 2))));
}
Also used : ApkTargeting(com.android.bundle.Targeting.ApkTargeting) TargetingUtils.mergeApkTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.mergeApkTargeting) Test(org.junit.Test)

Example 29 with ApkTargeting

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

the class MergingUtilsTest method mergeShardTargetings_equalAbis_ok.

@Test
public void mergeShardTargetings_equalAbis_ok() {
    ApkTargeting targeting = apkAbiTargeting(AbiAlias.X86);
    ApkTargeting merged = MergingUtils.mergeShardTargetings(targeting, targeting);
    assertThat(merged).isEqualTo(targeting);
    assertThat(merged.hasScreenDensityTargeting()).isFalse();
}
Also used : ApkTargeting(com.android.bundle.Targeting.ApkTargeting) TargetingUtils.mergeApkTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.mergeApkTargeting) Test(org.junit.Test)

Example 30 with ApkTargeting

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

the class MergingUtilsTest method mergeShardTargetings_sdkTargetingSecondTargeting_throws.

@Test
public void mergeShardTargetings_sdkTargetingSecondTargeting_throws() {
    ApkTargeting targeting = apkMinSdkTargeting(1);
    CommandExecutionException exception = assertThrows(CommandExecutionException.class, () -> MergingUtils.mergeShardTargetings(apkAbiTargeting(AbiAlias.X86), targeting));
    assertThat(exception).hasMessageThat().contains("Expecting only ABI, screen density, language and texture compression format" + " targeting");
}
Also used : ApkTargeting(com.android.bundle.Targeting.ApkTargeting) TargetingUtils.mergeApkTargeting(com.android.tools.build.bundletool.testing.TargetingUtils.mergeApkTargeting) CommandExecutionException(com.android.tools.build.bundletool.model.exceptions.CommandExecutionException) Test(org.junit.Test)

Aggregations

ApkTargeting (com.android.bundle.Targeting.ApkTargeting)49 Test (org.junit.Test)44 TargetingUtils.mergeApkTargeting (com.android.tools.build.bundletool.testing.TargetingUtils.mergeApkTargeting)28 ModuleSplit (com.android.tools.build.bundletool.model.ModuleSplit)22 BundleModule (com.android.tools.build.bundletool.model.BundleModule)18 BundleModuleBuilder (com.android.tools.build.bundletool.testing.BundleModuleBuilder)18 ResourceTableBuilder (com.android.tools.build.bundletool.testing.ResourceTableBuilder)10 ResourceTable (com.android.aapt.Resources.ResourceTable)8 DensityAlias (com.android.bundle.Targeting.ScreenDensity.DensityAlias)7 ImmutableList (com.google.common.collect.ImmutableList)7 ImmutableSet (com.google.common.collect.ImmutableSet)7 ApexImages (com.android.bundle.Files.ApexImages)6 ImmutableList.toImmutableList (com.google.common.collect.ImmutableList.toImmutableList)6 ImmutableSet.toImmutableSet (com.google.common.collect.ImmutableSet.toImmutableSet)6 Configuration (com.android.aapt.ConfigurationOuterClass.Configuration)5 ZipPath (com.android.tools.build.bundletool.model.ZipPath)5 ManifestProtoUtils.androidManifest (com.android.tools.build.bundletool.testing.ManifestProtoUtils.androidManifest)5 MDPI (com.android.tools.build.bundletool.testing.ResourcesTableFactory.MDPI)5 USER_PACKAGE_OFFSET (com.android.tools.build.bundletool.testing.ResourcesTableFactory.USER_PACKAGE_OFFSET)5 ImmutableMap (com.google.common.collect.ImmutableMap)5