mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-01 10:55:12 +00:00
AS3: Tests
This commit is contained in:
41
trunk/test/com/jpexs/decompiler/flash/RecompileTest.java
Normal file
41
trunk/test/com/jpexs/decompiler/flash/RecompileTest.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package com.jpexs.decompiler.flash;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.NotSameException;
|
||||
import java.io.*;
|
||||
import static org.testng.Assert.*;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
|
||||
public class RecompileTest {
|
||||
public static final String TESTDATADIR = "testdata";
|
||||
|
||||
private void testRecompileOne(String filename) {
|
||||
try {
|
||||
SWF swf = new SWF(new FileInputStream(TESTDATADIR + File.separator + filename));
|
||||
Main.DEBUG_COPY = true;
|
||||
swf.saveTo(new ByteArrayOutputStream());
|
||||
} catch (IOException ex) {
|
||||
fail();
|
||||
} catch (NotSameException ex) {
|
||||
fail("File is different after recompiling: " + filename);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRecompile() {
|
||||
File dir=new File(TESTDATADIR);
|
||||
File files[]=dir.listFiles(new FilenameFilter(){
|
||||
public boolean accept(File dir, String name) {
|
||||
return name.toLowerCase().endsWith(".swf");
|
||||
}
|
||||
});
|
||||
for(File f:files){
|
||||
testRecompileOne(f.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user