diff --git a/trunk/test/com/jpexs/decompiler/flash/ActionScript3Test.java b/trunk/test/com/jpexs/decompiler/flash/ActionScript3Test.java index b02414911..ec336dcec 100644 --- a/trunk/test/com/jpexs/decompiler/flash/ActionScript3Test.java +++ b/trunk/test/com/jpexs/decompiler/flash/ActionScript3Test.java @@ -36,12 +36,13 @@ public class ActionScript3Test { clsIndex = tag.getABC().findClassByName("classes.Test"); assertTrue(clsIndex > -1); this.abc = tag.getABC(); + Configuration.setConfig("autoDeobfuscate", false); } private void decompileMethod(String methodName, String expectedResult, boolean isStatic) { int bodyIndex = abc.findMethodBodyByName(clsIndex, methodName); assertTrue(bodyIndex > -1); - String actualResult = abc.bodies[bodyIndex].toString(methodName, false, isStatic, -1/*FIX?*/,clsIndex, abc, abc.constants, abc.method_info, new Stack(), false, false, new ArrayList(), abc.instance_info[clsIndex].instance_traits); + String actualResult = abc.bodies[bodyIndex].toString(methodName, false, isStatic, -1/*FIX?*/, clsIndex, abc, abc.constants, abc.method_info, new Stack(), false, false, new ArrayList(), abc.instance_info[clsIndex].instance_traits); actualResult = actualResult.replaceAll("[ \r\n]", ""); expectedResult = expectedResult.replaceAll("[ \r\n]", ""); assertEquals(actualResult, expectedResult); @@ -531,7 +532,18 @@ public class ActionScript3Test { @Test public void testMissingDefault() { - decompileMethod("testMissingDefault", "var jj:* = 1;\r\n", false); + decompileMethod("testMissingDefault", "var jj:* = 1;\r\n" + + "switch(jj)\r\n" + + "{\r\n" + + "case 1:\r\n" + + "jj=1;\r\n" + + "break;\r\n" + + "case 2:\r\n" + + "jj=2;\r\n" + + "break;\r\n" + + "default:\r\n" + + "jj=3;\r\n" + + "}\r\n", false); } @Test @@ -559,7 +571,11 @@ public class ActionScript3Test { + "finally\r\n" + "{\r\n" + "trace(\"hi \");\r\n" - + "return \"hu\"+str;\r\n" + + "if(5==4)\r\n" + + "{\r\n" + + "return _loc5_;\r\n" + + "}\r\n" + + "return _loc5_;\r\n" + "}\r\n", false); } @@ -735,6 +751,11 @@ public class ActionScript3Test { public void testWhileAnd() { decompileMethod("testWhileAnd", "var a:* = 5;\r\n" + "var b:* = 10;\r\n" + + "while(a<10&&b>1)\r\n" + + "{\r\n" + + "a++;\r\n" + + "b--;\r\n" + + "}\r\n" + "a=7;\r\n" + "b=9;\r\n", false); } diff --git a/trunk/test/com/jpexs/decompiler/flash/Generator.java b/trunk/test/com/jpexs/decompiler/flash/Generator.java index bb50636bb..101f1fe05 100644 --- a/trunk/test/com/jpexs/decompiler/flash/Generator.java +++ b/trunk/test/com/jpexs/decompiler/flash/Generator.java @@ -20,6 +20,7 @@ import java.util.Stack; public class Generator { public static void main(String[] args) throws Exception { + Configuration.setConfig("autoDeobfuscate", false); SWF swf = new SWF(new FileInputStream("testdata/as3/TestMovie.swf")); DoABCDefineTag tag = null; for (Tag t : swf.tags) { @@ -40,7 +41,7 @@ public class Generator { s.append("(){\r\ndecompileMethod(\""); s.append(name); s.append("\", "); - String src = abc.findBody(((TraitMethodGetterSetter) t).method_info).toString("", false, false,-1/*FIX?*/, classId, abc, abc.constants, abc.method_info, new Stack(), false, false, new ArrayList(), abc.instance_info[classId].instance_traits); + String src = abc.findBody(((TraitMethodGetterSetter) t).method_info).toString("", false, false, -1/*FIX?*/, classId, abc, abc.constants, abc.method_info, new Stack(), false, false, new ArrayList(), abc.instance_info[classId].instance_traits); String srcs[] = src.split("[\r\n]+"); for (int i = 0; i < srcs.length; i++) { String ss = srcs[i]; diff --git a/trunk/test/com/jpexs/decompiler/flash/RecompileTest.java b/trunk/test/com/jpexs/decompiler/flash/RecompileTest.java index 8b1cb6b73..99214ae77 100644 --- a/trunk/test/com/jpexs/decompiler/flash/RecompileTest.java +++ b/trunk/test/com/jpexs/decompiler/flash/RecompileTest.java @@ -11,7 +11,7 @@ import org.testng.annotations.Test; */ public class RecompileTest { - public static final String TESTDATADIR = "testdata"; + public static final String TESTDATADIR = "testdata/recompile"; private void testRecompileOne(String filename) { try { @@ -28,6 +28,9 @@ public class RecompileTest { @Test public void testRecompile() { File dir = new File(TESTDATADIR); + if (!dir.exists()) { + return; + } File files[] = dir.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { @@ -35,7 +38,7 @@ public class RecompileTest { } }); for (File f : files) { - testRecompileOne(f.getAbsolutePath()); + testRecompileOne(f.getName()); } } }