mirror of
https://github.com/revanced/Apktool.git
synced 2025-04-30 06:04:25 +02:00
Add tests to ensure empty, uncompressed files are put on the doNotCompress list.
Also, fix a bug where ext would retain its value from a previous iteration of the loop, since we don't always overwrite it now.
This commit is contained in:
parent
05f81f9dd0
commit
408050ffde
@ -163,10 +163,10 @@ public class Androlib {
|
|||||||
try {
|
try {
|
||||||
Directory unk = apkFile.getDirectory();
|
Directory unk = apkFile.getDirectory();
|
||||||
Set<String> files = unk.getFiles(true);
|
Set<String> files = unk.getFiles(true);
|
||||||
String ext = "";
|
|
||||||
|
|
||||||
for (String file : files) {
|
for (String file : files) {
|
||||||
if (isAPKFileNames(file) && unk.getCompressionLevel(file) == 0) {
|
if (isAPKFileNames(file) && unk.getCompressionLevel(file) == 0) {
|
||||||
|
String ext = "";
|
||||||
if (unk.getSize(file) != 0) {
|
if (unk.getSize(file) != 0) {
|
||||||
ext = FilenameUtils.getExtension(file);
|
ext = FilenameUtils.getExtension(file);
|
||||||
}
|
}
|
||||||
|
@ -501,6 +501,12 @@ public class BuildAndDecodeTest extends BaseTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void confirmZeroByteFileIsStored() throws BrutException {
|
||||||
|
MetaInfo metaInfo = new Androlib().readMetaFile(sTestNewDir);
|
||||||
|
assertTrue(metaInfo.doNotCompress.contains("assets/0byte_file.jpg"));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void drawableXxhdpiTest() throws BrutException, IOException {
|
public void drawableXxhdpiTest() throws BrutException, IOException {
|
||||||
compareResFolder("drawable-xxhdpi");
|
compareResFolder("drawable-xxhdpi");
|
||||||
|
@ -82,7 +82,13 @@ public class BuildAndDecodeTest extends BaseTest {
|
|||||||
@Test
|
@Test
|
||||||
public void confirmZeroByteFileExtensionIsNotStored() throws BrutException {
|
public void confirmZeroByteFileExtensionIsNotStored() throws BrutException {
|
||||||
MetaInfo metaInfo = new Androlib().readMetaFile(sTestNewDir);
|
MetaInfo metaInfo = new Androlib().readMetaFile(sTestNewDir);
|
||||||
assertNull(metaInfo.doNotCompress);
|
assertFalse(metaInfo.doNotCompress.contains("jpg"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void confirmZeroByteFileIsStored() throws BrutException {
|
||||||
|
MetaInfo metaInfo = new Androlib().readMetaFile(sTestNewDir);
|
||||||
|
assertTrue(metaInfo.doNotCompress.contains("assets/0byte_file.jpg"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
x
Reference in New Issue
Block a user