mirror of
https://github.com/revanced/Apktool.git
synced 2024-12-05 02:22:55 +01: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 {
|
||||
Directory unk = apkFile.getDirectory();
|
||||
Set<String> files = unk.getFiles(true);
|
||||
String ext = "";
|
||||
|
||||
for (String file : files) {
|
||||
if (isAPKFileNames(file) && unk.getCompressionLevel(file) == 0) {
|
||||
String ext = "";
|
||||
if (unk.getSize(file) != 0) {
|
||||
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
|
||||
public void drawableXxhdpiTest() throws BrutException, IOException {
|
||||
compareResFolder("drawable-xxhdpi");
|
||||
|
@ -82,7 +82,13 @@ public class BuildAndDecodeTest extends BaseTest {
|
||||
@Test
|
||||
public void confirmZeroByteFileExtensionIsNotStored() throws BrutException {
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user