use of com.android.bundle.Files.Assets in project bundletool by google.
the class TargetingGeneratorTest method generateTargetingForAssets_emptyInput_emptyOutput.
@Test
public void generateTargetingForAssets_emptyInput_emptyOutput() throws Exception {
Assets assetsConfig = new TargetingGenerator().generateTargetingForAssets(ImmutableList.of());
assertThat(assetsConfig).isEqualToDefaultInstance();
}
use of com.android.bundle.Files.Assets in project bundletool by google.
the class TargetingGeneratorTest method generateTargetingForAssets_deviceTierTargeting.
@Test
public void generateTargetingForAssets_deviceTierTargeting() {
Assets assetsConfig = new TargetingGenerator().generateTargetingForAssets(ImmutableList.of(ZipPath.create("assets/img#tier_0"), ZipPath.create("assets/img#tier_1"), ZipPath.create("assets/img#tier_2")));
assertThat(assetsConfig).ignoringRepeatedFieldOrder().isEqualTo(Assets.newBuilder().addDirectory(TargetedAssetsDirectory.newBuilder().setPath("assets/img#tier_0").setTargeting(assetsDirectoryTargeting(deviceTierTargeting(/* value= */
0, /* alternatives= */
ImmutableList.of(1, 2))))).addDirectory(TargetedAssetsDirectory.newBuilder().setPath("assets/img#tier_1").setTargeting(assetsDirectoryTargeting(deviceTierTargeting(/* value= */
1, /* alternatives= */
ImmutableList.of(0, 2))))).addDirectory(TargetedAssetsDirectory.newBuilder().setPath("assets/img#tier_2").setTargeting(assetsDirectoryTargeting(deviceTierTargeting(/* value= */
2, /* alternatives= */
ImmutableList.of(0, 1))))).build());
}
use of com.android.bundle.Files.Assets in project bundletool by google.
the class TargetingGeneratorTest method generateTargetingForAssets_NonTargeted_midpath.
@Test
public void generateTargetingForAssets_NonTargeted_midpath() {
Assets assetsConfig = new TargetingGenerator().generateTargetingForAssets(ImmutableList.of(ZipPath.create("assets/world/texture#tcf_atc/rest/i18n#lang_en"), ZipPath.create("assets/world/texture#tcf_atc/rest/i18n#lang_ru"), // Note that the two below should not have any alternatives for OpenGL version.
ZipPath.create("assets/world/texture#tcf_etc1/rest/i18n#lang_ru"), ZipPath.create("assets/world/texture#tcf_etc1/i18n#lang_en")));
assertThat(assetsConfig).ignoringRepeatedFieldOrder().isEqualTo(Assets.newBuilder().addDirectory(TargetedAssetsDirectory.newBuilder().setPath("assets/world/texture#tcf_etc1/i18n#lang_en").setTargeting(mergeAssetsTargeting(assetsDirectoryTargeting(languageTargeting("en")), assetsDirectoryTargeting(textureCompressionTargeting(TextureCompressionFormatAlias.ETC1_RGB8, ImmutableSet.of(TextureCompressionFormatAlias.ATC)))))).addDirectory(TargetedAssetsDirectory.newBuilder().setPath("assets/world/texture#tcf_etc1/rest/i18n#lang_ru").setTargeting(mergeAssetsTargeting(assetsDirectoryTargeting(languageTargeting("ru")), assetsDirectoryTargeting(textureCompressionTargeting(TextureCompressionFormatAlias.ETC1_RGB8, ImmutableSet.of(TextureCompressionFormatAlias.ATC)))))).addDirectory(TargetedAssetsDirectory.newBuilder().setPath("assets/world/texture#tcf_atc/rest/i18n#lang_ru").setTargeting(mergeAssetsTargeting(assetsDirectoryTargeting(languageTargeting("ru")), assetsDirectoryTargeting(textureCompressionTargeting(TextureCompressionFormatAlias.ATC, ImmutableSet.of(TextureCompressionFormatAlias.ETC1_RGB8)))))).addDirectory(TargetedAssetsDirectory.newBuilder().setPath("assets/world/texture#tcf_atc/rest/i18n#lang_en").setTargeting(mergeAssetsTargeting(assetsDirectoryTargeting(languageTargeting("en")), assetsDirectoryTargeting(textureCompressionTargeting(TextureCompressionFormatAlias.ATC, ImmutableSet.of(TextureCompressionFormatAlias.ETC1_RGB8)))))).build());
}
use of com.android.bundle.Files.Assets in project bundletool by google.
the class TargetingGeneratorTest method generateTargetingForAssets_languageTargeting.
@Test
public void generateTargetingForAssets_languageTargeting() {
Assets assetsConfig = new TargetingGenerator().generateTargetingForAssets(ImmutableList.of(ZipPath.create("assets/world/i18n#lang_de"), ZipPath.create("assets/world/i18n#lang_jp"), ZipPath.create("assets/world/i18n"), // compression format.
ZipPath.create("assets/world/texture#tcf_etc1/i18n#lang_pl"), ZipPath.create("assets/world/texture#tcf_etc1/i18n")));
assertThat(assetsConfig).ignoringRepeatedFieldOrder().isEqualTo(Assets.newBuilder().addDirectory(TargetedAssetsDirectory.newBuilder().setPath("assets/world/i18n#lang_de").setTargeting(assetsDirectoryTargeting(languageTargeting("de")))).addDirectory(TargetedAssetsDirectory.newBuilder().setPath("assets/world/i18n#lang_jp").setTargeting(assetsDirectoryTargeting(languageTargeting("jp")))).addDirectory(TargetedAssetsDirectory.newBuilder().setPath("assets/world/i18n").setTargeting(assetsDirectoryTargeting(alternativeLanguageTargeting("de", "jp")))).addDirectory(TargetedAssetsDirectory.newBuilder().setPath("assets/world/texture#tcf_etc1/i18n#lang_pl").setTargeting(mergeAssetsTargeting(assetsDirectoryTargeting(languageTargeting("pl")), assetsDirectoryTargeting(textureCompressionTargeting(TextureCompressionFormatAlias.ETC1_RGB8))))).addDirectory(TargetedAssetsDirectory.newBuilder().setPath("assets/world/texture#tcf_etc1/i18n").setTargeting(mergeAssetsTargeting(assetsDirectoryTargeting(alternativeLanguageTargeting("pl")), assetsDirectoryTargeting(textureCompressionTargeting(TextureCompressionFormatAlias.ETC1_RGB8))))).build());
}
use of com.android.bundle.Files.Assets in project bundletool by google.
the class TargetingGeneratorTest method generateTargetingForAssets_nonTargetedDirectories.
@Test
public void generateTargetingForAssets_nonTargetedDirectories() throws Exception {
Assets assetsConfig = new TargetingGenerator().generateTargetingForAssets(ImmutableList.of(ZipPath.create("assets/static"), ZipPath.create("assets/world/static"), ZipPath.create("assets/world/static-alt")));
assertThat(assetsConfig).ignoringRepeatedFieldOrder().isEqualTo(Assets.newBuilder().addDirectory(TargetedAssetsDirectory.newBuilder().setPath("assets/static").setTargeting(AssetsDirectoryTargeting.getDefaultInstance())).addDirectory(TargetedAssetsDirectory.newBuilder().setPath("assets/world/static").setTargeting(AssetsDirectoryTargeting.getDefaultInstance())).addDirectory(TargetedAssetsDirectory.newBuilder().setPath("assets/world/static-alt").setTargeting(AssetsDirectoryTargeting.getDefaultInstance())).build());
}
Aggregations