use of com.android.tools.build.bundletool.testing.BundleModuleBuilder in project bundletool by google.
the class AssetsTargetingValidatorTest method validateModule_emptyTargetedDirectory_throws.
@Test
public void validateModule_emptyTargetedDirectory_throws() throws Exception {
Assets config = assets(targetedAssetsDirectory("assets/dir#tcf_etc1", assetsDirectoryTargeting(textureCompressionTargeting(TextureCompressionFormatAlias.ETC1_RGB8))));
BundleModule module = new BundleModuleBuilder("testModule").setAssetsConfig(config).setManifest(androidManifest("com.test.app")).build();
InvalidBundleException e = assertThrows(InvalidBundleException.class, () -> new AssetsTargetingValidator().validateModule(module));
assertThat(e).hasMessageThat().contains("Targeted directory 'assets/dir#tcf_etc1' is empty.");
}
use of com.android.tools.build.bundletool.testing.BundleModuleBuilder in project bundletool by google.
the class AssetsTargetingValidatorTest method validateModule_pointDirectlyToAssets_succeeds.
@Test
public void validateModule_pointDirectlyToAssets_succeeds() throws Exception {
Assets config = assets(targetedAssetsDirectory("assets", AssetsDirectoryTargeting.getDefaultInstance()));
BundleModule module = new BundleModuleBuilder("testModule").addFile("assets/file.dat").setAssetsConfig(config).setManifest(androidManifest("com.test.app")).build();
new AssetsTargetingValidator().validateModule(module);
}
use of com.android.tools.build.bundletool.testing.BundleModuleBuilder in project bundletool by google.
the class BundleConfigValidatorTest method optimizations_defaultDeviceTier_targeted_specified.
@Test
public void optimizations_defaultDeviceTier_targeted_specified() throws Exception {
AppBundleBuilder appBundleBuilder = new AppBundleBuilder().setBundleConfig(BundleConfigBuilder.create().addSplitDimension(Value.DEVICE_TIER, false, false, "1").build()).addModule(new BundleModuleBuilder("base").addFile("assets/textures#tier_1/level1.assets").addFile("assets/textures#tier_2/level1.assets").setManifest(androidManifest("com.test.app")).build());
new BundleConfigValidator().validateBundle(appBundleBuilder.build());
}
use of com.android.tools.build.bundletool.testing.BundleModuleBuilder in project bundletool by google.
the class VariantGeneratorTest method targetsPreLOnlyInManifest_throws.
@Test
public void targetsPreLOnlyInManifest_throws() throws Exception {
int preL = 20;
BundleModule bundleModule = new BundleModuleBuilder("testModule").setManifest(androidManifest("com.test.app", withMaxSdkVersion(preL))).build();
CommandExecutionException exception = assertThrows(CommandExecutionException.class, () -> new VariantGenerator().generateVariants(bundleModule));
assertThat(exception).hasMessageThat().contains("does not target devices on Android L or above");
}
use of com.android.tools.build.bundletool.testing.BundleModuleBuilder in project bundletool by google.
the class VariantGeneratorTest method variantsWithV3SigningRestrictedToRPlus.
@Test
public void variantsWithV3SigningRestrictedToRPlus() throws Exception {
BundleModule bundleModule = new BundleModuleBuilder("testModule").setManifest(androidManifest("com.test.app")).build();
VariantGenerator variantGenerator = new VariantGenerator();
ImmutableCollection<VariantTargeting> splits = variantGenerator.generateVariants(bundleModule, ApkGenerationConfiguration.builder().setMinSdkForAdditionalVariantWithV3Rotation(ANDROID_R_API_VERSION).build());
assertThat(splits).containsExactly(lPlusVariantTargeting(), variantMinSdkTargeting(ANDROID_R_API_VERSION));
}
Aggregations