use of com.android.tools.build.bundletool.model.exceptions.InvalidBundleException in project bundletool by google.
the class AssetsTargetingValidatorTest method validateModule_assetModuleLanguageTargeting_throws.
@Test
public void validateModule_assetModuleLanguageTargeting_throws() throws Exception {
Assets config = assets(targetedAssetsDirectory("assets/dir#lang_en", assetsDirectoryTargeting(languageTargeting("en"))));
BundleModule module = new BundleModuleBuilder("testModule").addFile("assets/dir#lang_en/raw.dat").setAssetsConfig(config).setManifest(androidManifestForAssetModule("com.test.app")).build();
InvalidBundleException e = assertThrows(InvalidBundleException.class, () -> new AssetsTargetingValidator().validateModule(module));
assertThat(e).hasMessageThat().contains("Language targeting for asset packs is not supported, but found in module testModule.");
}
use of com.android.tools.build.bundletool.model.exceptions.InvalidBundleException in project bundletool by google.
the class AssetsTargetingValidatorTest method validateModule_pathOutsideAssets_throws.
@Test
public void validateModule_pathOutsideAssets_throws() throws Exception {
Assets config = assets(targetedAssetsDirectory("lib/x86", assetsDirectoryTargeting(abiTargeting(X86))), targetedAssetsDirectory("assets/dir#tcf_etc1", assetsDirectoryTargeting(textureCompressionTargeting(TextureCompressionFormatAlias.ETC1_RGB8))));
BundleModule module = new BundleModuleBuilder("testModule").setAssetsConfig(config).addFile("assets/dir#tcf_etc1/file.txt").setManifest(androidManifest("com.test.app")).build();
InvalidBundleException e = assertThrows(InvalidBundleException.class, () -> new AssetsTargetingValidator().validateModule(module));
assertThat(e).hasMessageThat().contains("directory must start with 'assets/'");
}
use of com.android.tools.build.bundletool.model.exceptions.InvalidBundleException in project bundletool by google.
the class AssetsTargetingValidatorTest method validateModule_defaultInstanceOfLanguageTargeting_throws.
@Test
public void validateModule_defaultInstanceOfLanguageTargeting_throws() throws Exception {
Assets config = assets(targetedAssetsDirectory("assets/dir", AssetsDirectoryTargeting.newBuilder().setLanguage(LanguageTargeting.getDefaultInstance()).build()));
BundleModule module = new BundleModuleBuilder("testModule").addFile("assets/dir/raw.dat").setAssetsConfig(config).setManifest(androidManifestForAssetModule("com.test.app")).build();
InvalidBundleException e = assertThrows(InvalidBundleException.class, () -> new AssetsTargetingValidator().validateModule(module));
assertThat(e).hasMessageThat().contains("set but empty language targeting");
}
use of com.android.tools.build.bundletool.model.exceptions.InvalidBundleException in project bundletool by google.
the class AssetsTargetingValidatorTest method validateModule_defaultInstanceOfAbiTargeting_throws.
@Test
public void validateModule_defaultInstanceOfAbiTargeting_throws() throws Exception {
Assets config = assets(targetedAssetsDirectory("assets/dir", AssetsDirectoryTargeting.newBuilder().setAbi(AbiTargeting.getDefaultInstance()).build()));
BundleModule module = new BundleModuleBuilder("testModule").addFile("assets/dir/raw.dat").setAssetsConfig(config).setManifest(androidManifestForAssetModule("com.test.app")).build();
InvalidBundleException e = assertThrows(InvalidBundleException.class, () -> new AssetsTargetingValidator().validateModule(module));
assertThat(e).hasMessageThat().contains("set but empty ABI targeting");
}
use of com.android.tools.build.bundletool.model.exceptions.InvalidBundleException in project bundletool by google.
the class AssetsTargetingValidatorTest method validateModule_defaultInstanceOfTcfTargeting_throws.
@Test
public void validateModule_defaultInstanceOfTcfTargeting_throws() throws Exception {
Assets config = assets(targetedAssetsDirectory("assets/dir", AssetsDirectoryTargeting.newBuilder().setTextureCompressionFormat(TextureCompressionFormatTargeting.getDefaultInstance()).build()));
BundleModule module = new BundleModuleBuilder("testModule").addFile("assets/dir/raw.dat").setAssetsConfig(config).setManifest(androidManifestForAssetModule("com.test.app")).build();
InvalidBundleException e = assertThrows(InvalidBundleException.class, () -> new AssetsTargetingValidator().validateModule(module));
assertThat(e).hasMessageThat().contains("set but empty Texture Compression Format targeting");
}
Aggregations