use of com.android.tools.build.bundletool.model.exceptions.InvalidBundleException in project bundletool by google.
the class TextureCompressionFormatParityValidatorTest method differentTCFs_throws.
@Test
public void differentTCFs_throws() throws Exception {
BundleModule moduleA = new BundleModuleBuilder("a").addFile("assets/textures#tcf_astc/level1.assets").addFile("assets/textures#tcf_etc2/level1.assets").setManifest(androidManifest("com.test.app")).build();
BundleModule moduleB = new BundleModuleBuilder("b").addFile("assets/other_textures#tcf_astc/astc_file.assets").addFile("assets/other_textures#tcf_pvrtc/etc2_file.assets").setManifest(androidManifest("com.test.app")).build();
InvalidBundleException exception = assertThrows(InvalidBundleException.class, () -> new TextureCompressionFormatParityValidator().validateAllModules(ImmutableList.of(moduleA, moduleB)));
assertThat(exception).hasMessageThat().contains("All modules with targeted textures must have the same set of texture formats, but" + " module 'a' has formats [ASTC, ETC2] (without fallback directories) and module" + " 'b' has formats [ASTC, PVRTC] (without fallback directories).");
}
use of com.android.tools.build.bundletool.model.exceptions.InvalidBundleException in project bundletool by google.
the class TextureCompressionFormatParityValidatorTest method differentFallbacks_throws.
@Test
public void differentFallbacks_throws() throws Exception {
BundleModule moduleA = new BundleModuleBuilder("a").addFile("assets/textures#tcf_astc/level1.assets").addFile("assets/textures/level1.assets").setManifest(androidManifest("com.test.app")).build();
BundleModule moduleB = new BundleModuleBuilder("b").addFile("assets/other_textures#tcf_astc/astc_file.assets").setManifest(androidManifest("com.test.app")).build();
InvalidBundleException exception = assertThrows(InvalidBundleException.class, () -> new TextureCompressionFormatParityValidator().validateAllModules(ImmutableList.of(moduleA, moduleB)));
assertThat(exception).hasMessageThat().contains("All modules with targeted textures must have the same set of texture formats, but" + " module 'a' has formats [ASTC] (with fallback directories) and module 'b' has" + " formats [ASTC] (without fallback directories).");
}
use of com.android.tools.build.bundletool.model.exceptions.InvalidBundleException in project bundletool by google.
the class DeviceTierParityValidatorTest method differentTiersInDifferentFolders_throws.
@Test
public void differentTiersInDifferentFolders_throws() {
BundleModule moduleA = new BundleModuleBuilder("a").addFile("assets/img1#tier_0/image.jpg").addFile("assets/img1#tier_1/image.jpg").addFile("assets/img2#tier_0/image.jpg").setManifest(androidManifest("com.test.app")).build();
InvalidBundleException exception = assertThrows(InvalidBundleException.class, () -> new DeviceTierParityValidator().validateAllModules(ImmutableList.of(moduleA)));
assertThat(exception).hasMessageThat().contains("All device-tier-targeted folders in a module must support the same set of tiers, but" + " module 'a' supports [0, 1] and folder 'assets/img2' supports only [0].");
}
use of com.android.tools.build.bundletool.model.exceptions.InvalidBundleException in project bundletool by google.
the class DexFilesValidatorTest method singleDexFile_hasClasses1_throws.
@Test
public void singleDexFile_hasClasses1_throws() throws Exception {
BundleModule module = new BundleModuleBuilder("base").addFile("dex/classes1.dex").setManifest(androidManifest("com.test.app")).build();
InvalidBundleException exception = assertThrows(InvalidBundleException.class, () -> new DexFilesValidator().validateModule(module));
assertThat(exception).hasMessageThat().contains("expecting file 'classes.dex' but found 'classes1.dex'");
}
use of com.android.tools.build.bundletool.model.exceptions.InvalidBundleException in project bundletool by google.
the class DexFilesValidatorTest method manyDexFiles_hasClasses1_throws.
@Test
public void manyDexFiles_hasClasses1_throws() throws Exception {
BundleModule module = new BundleModuleBuilder("base").addFile("dex/classes.dex").addFile("dex/classes1.dex").addFile("dex/classes2.dex").setManifest(androidManifest("com.test.app")).build();
InvalidBundleException exception = assertThrows(InvalidBundleException.class, () -> new DexFilesValidator().validateModule(module));
assertThat(exception).hasMessageThat().contains("expecting file 'classes2.dex' but found 'classes1.dex'");
}
Aggregations