Search in sources :

Example 86 with AppBundleBuilder

use of com.android.tools.build.bundletool.testing.AppBundleBuilder in project bundletool by google.

the class TextureCompressionFormatParityValidatorTest method sameTCFsWithProperDefaultSuffix_ok.

@Test
public void sameTCFsWithProperDefaultSuffix_ok() 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_etc2/etc2_file.assets").setManifest(androidManifest("com.test.app")).build();
    AppBundle appBundle = new AppBundleBuilder().addModule(moduleA).addModule(moduleB).setBundleConfig(BundleConfigBuilder.create().addSplitDimension(Value.TEXTURE_COMPRESSION_FORMAT, /* negate= */
    false, /* stripSuffix= */
    false, /* defaultSuffix= */
    "astc").build()).build();
    new TextureCompressionFormatParityValidator().validateBundle(appBundle);
    new TextureCompressionFormatParityValidator().validateAllModules(ImmutableList.of(moduleA, moduleB));
}
Also used : AppBundle(com.android.tools.build.bundletool.model.AppBundle) BundleModuleBuilder(com.android.tools.build.bundletool.testing.BundleModuleBuilder) AppBundleBuilder(com.android.tools.build.bundletool.testing.AppBundleBuilder) BundleModule(com.android.tools.build.bundletool.model.BundleModule) Test(org.junit.Test)

Example 87 with AppBundleBuilder

use of com.android.tools.build.bundletool.testing.AppBundleBuilder in project bundletool by google.

the class TextureCompressionFormatParityValidatorTest method sameTCFsIncludingFallbackAndNoTCF_ok.

@Test
public void sameTCFsIncludingFallbackAndNoTCF_ok() throws Exception {
    BundleModule moduleA = new BundleModuleBuilder("a").addFile("assets/textures#tcf_astc/level1.assets").addFile("assets/textures#tcf_etc2/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").addFile("assets/other_textures#tcf_etc2/etc2_file.assets").addFile("assets/other_textures/fallback_file.assets").setManifest(androidManifest("com.test.app")).build();
    BundleModule moduleC = new BundleModuleBuilder("c").addFile("assets/untargeted_textures/level3.assets").setManifest(androidManifest("com.test.app")).build();
    AppBundle appBundle = new AppBundleBuilder().addModule(moduleA).addModule(moduleB).build();
    new TextureCompressionFormatParityValidator().validateAllModules(ImmutableList.of(moduleA, moduleB, moduleC));
    new TextureCompressionFormatParityValidator().validateBundle(appBundle);
}
Also used : AppBundle(com.android.tools.build.bundletool.model.AppBundle) BundleModuleBuilder(com.android.tools.build.bundletool.testing.BundleModuleBuilder) AppBundleBuilder(com.android.tools.build.bundletool.testing.AppBundleBuilder) BundleModule(com.android.tools.build.bundletool.model.BundleModule) Test(org.junit.Test)

Example 88 with AppBundleBuilder

use of com.android.tools.build.bundletool.testing.AppBundleBuilder in project bundletool by google.

the class TextureCompressionFormatParityValidatorTest method sameTCFsIncludingFallback_ok.

@Test
public void sameTCFsIncludingFallback_ok() throws Exception {
    BundleModule moduleA = new BundleModuleBuilder("a").addFile("assets/textures#tcf_astc/level1.assets").addFile("assets/textures#tcf_etc2/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").addFile("assets/other_textures#tcf_etc2/etc2_file.assets").addFile("assets/other_textures/fallback_file.assets").setManifest(androidManifest("com.test.app")).build();
    AppBundle appBundle = new AppBundleBuilder().addModule(moduleA).addModule(moduleB).build();
    new TextureCompressionFormatParityValidator().validateBundle(appBundle);
    new TextureCompressionFormatParityValidator().validateAllModules(ImmutableList.of(moduleA, moduleB));
}
Also used : AppBundle(com.android.tools.build.bundletool.model.AppBundle) BundleModuleBuilder(com.android.tools.build.bundletool.testing.BundleModuleBuilder) AppBundleBuilder(com.android.tools.build.bundletool.testing.AppBundleBuilder) BundleModule(com.android.tools.build.bundletool.model.BundleModule) Test(org.junit.Test)

Example 89 with AppBundleBuilder

use of com.android.tools.build.bundletool.testing.AppBundleBuilder in project bundletool by google.

the class BundleConfigValidatorTest method optimizations_defaultDeviceTier_targeted_unspecified_success.

@Test
public void optimizations_defaultDeviceTier_targeted_unspecified_success() throws Exception {
    AppBundleBuilder appBundleBuilder = new AppBundleBuilder().addModule(new BundleModuleBuilder("base").setManifest(androidManifest("com.test.app")).build()).addModule(new BundleModuleBuilder("a").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());
}
Also used : BundleModuleBuilder(com.android.tools.build.bundletool.testing.BundleModuleBuilder) AppBundleBuilder(com.android.tools.build.bundletool.testing.AppBundleBuilder) Test(org.junit.Test)

Example 90 with AppBundleBuilder

use of com.android.tools.build.bundletool.testing.AppBundleBuilder in project bundletool by google.

the class BundleConfigValidatorTest method optimizations_defaultDeviceTier_untargeted_unspecified.

@Test
public void optimizations_defaultDeviceTier_untargeted_unspecified() throws Exception {
    AppBundleBuilder appBundleBuilder = new AppBundleBuilder().addModule(new BundleModuleBuilder("base").addFile("assets/textures#tcf_astc/level1.assets").addFile("assets/textures#tcf_astc/level1.assets").setManifest(androidManifest("com.test.app")).build());
    new BundleConfigValidator().validateBundle(appBundleBuilder.build());
}
Also used : BundleModuleBuilder(com.android.tools.build.bundletool.testing.BundleModuleBuilder) AppBundleBuilder(com.android.tools.build.bundletool.testing.AppBundleBuilder) Test(org.junit.Test)

Aggregations

AppBundleBuilder (com.android.tools.build.bundletool.testing.AppBundleBuilder)155 Test (org.junit.Test)153 AppBundle (com.android.tools.build.bundletool.model.AppBundle)134 ManifestProtoUtils.androidManifest (com.android.tools.build.bundletool.testing.ManifestProtoUtils.androidManifest)123 Truth.assertThat (com.google.common.truth.Truth.assertThat)123 RunWith (org.junit.runner.RunWith)123 Path (java.nio.file.Path)113 ZipFile (java.util.zip.ZipFile)113 Before (org.junit.Before)113 Rule (org.junit.Rule)113 TemporaryFolder (org.junit.rules.TemporaryFolder)113 Assertions.assertThrows (org.junit.jupiter.api.Assertions.assertThrows)112 AppBundleSerializer (com.android.tools.build.bundletool.io.AppBundleSerializer)105 ImmutableList (com.google.common.collect.ImmutableList)102 BuildApksResult (com.android.bundle.Commands.BuildApksResult)101 Variant (com.android.bundle.Commands.Variant)94 InvalidBundleException (com.android.tools.build.bundletool.model.exceptions.InvalidBundleException)91 AndroidManifest (com.android.tools.build.bundletool.model.AndroidManifest)88 ApkDescription (com.android.bundle.Commands.ApkDescription)87 BundleConfig (com.android.bundle.Config.BundleConfig)87