use of com.android.tools.build.bundletool.model.ZipPath in project bundletool by google.
the class ZipUtilsTest method allFileEntries_multipleFiles.
@Test
public void allFileEntries_multipleFiles() throws Exception {
try (ZipFile zipFile = createZipFileWithFiles("a", "b", "c")) {
ImmutableList<ZipPath> files = ZipUtils.allFileEntriesPaths(zipFile).collect(toImmutableList());
assertThat(files.stream().map(ZipPath::toString).collect(toList())).containsExactly("a", "b", "c");
}
}
use of com.android.tools.build.bundletool.model.ZipPath in project bundletool by google.
the class ZipUtilsTest method getPath_deepResourcePath.
@Test
public void getPath_deepResourcePath() {
ZipPath path = ZipUtils.convertBundleToModulePath(ZipPath.create("/module2/assets/en-gb/text.txt"));
assertThat(path.toString()).isEqualTo("assets/en-gb/text.txt");
}
use of com.android.tools.build.bundletool.model.ZipPath in project bundletool by google.
the class ZipUtilsTest method allFileEntriesPaths_emptyZip.
@Test
public void allFileEntriesPaths_emptyZip() throws Exception {
try (ZipFile zipFile = createZipFileWithFiles()) {
ImmutableList<ZipPath> files = ZipUtils.allFileEntriesPaths(zipFile).collect(toImmutableList());
assertThat(files).isEmpty();
}
}
use of com.android.tools.build.bundletool.model.ZipPath in project bundletool by google.
the class ZipUtilsTest method convertBundleToModulePath_pathPreservesAllDirectories.
@Test
public void convertBundleToModulePath_pathPreservesAllDirectories() {
ZipPath path = ZipPath.create("/resource1");
assertThat(path.toString()).isEqualTo("resource1");
}
use of com.android.tools.build.bundletool.model.ZipPath in project bundletool by google.
the class TargetedDirectoryTest method simpleDirectory_tokenization.
@Test
public void simpleDirectory_tokenization() {
ZipPath path = ZipPath.create("assets/texture#tcf_etc2");
TargetedDirectory actual = TargetedDirectory.parse(path);
assertThat(actual.getPathSegments()).hasSize(2);
assertThat(actual.getPathSegments().get(0).getName()).isEqualTo("assets");
assertThat(actual.getPathSegments().get(0).getTargeting()).isEqualTo(AssetsDirectoryTargeting.getDefaultInstance());
assertThat(actual.getPathSegments().get(1).getName()).isEqualTo("texture");
assertThat(actual.getPathSegments().get(1).getTargeting()).isEqualTo(assetsDirectoryTargeting(textureCompressionTargeting(TextureCompressionFormatAlias.ETC2)));
}
Aggregations