Fixed tests

This commit is contained in:
Jindra Petřík
2022-11-25 20:16:00 +01:00
parent b156340a83
commit 54d7cb38bc
14 changed files with 38 additions and 36 deletions

View File

@@ -409,14 +409,14 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
public static final int LIBRARY_AIR = 0;
public static final int LIBRARY_FLASH = 1;
public static AbcIndexing getPlayerGlobalAbcIndex() {
return playerGlobalAbcIndex;
}
public static AbcIndexing getAirGlobalAbcIndex() {
return airGlobalAbcIndex;
}
}
public AbcIndexing getAbcIndex() {
if (abcIndex != null) {
@@ -428,21 +428,20 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
if (conf.getCustomData(CustomConfigurationKeys.KEY_LIBRARY, "" + LIBRARY_FLASH).equals("" + LIBRARY_AIR)) {
air = true;
}
}
}
try {
SWF.initPlayer();
} catch (IOException | InterruptedException ex) {
Logger.getLogger(SWF.class.getName()).log(Level.SEVERE, null, ex);
}
abcIndex = new AbcIndexing(air ? SWF.getAirGlobalAbcIndex() : SWF.getPlayerGlobalAbcIndex());
for (Tag tag:tags) {
if (tag instanceof ABCContainerTag) {
abcIndex.addAbc(((ABCContainerTag)tag).getABC());
for (Tag tag : tags) {
if (tag instanceof ABCContainerTag) {
abcIndex.addAbc(((ABCContainerTag) tag).getABC());
}
}
return abcIndex;
}
public static void initPlayer() throws IOException, InterruptedException {
if (playerGlobalAbcIndex == null) {
@@ -1609,6 +1608,9 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
if (fileTitle != null) {
return fileTitle;
}
if (file == null) {
return "_";
}
return new File(file).getName();
}

View File

@@ -118,10 +118,10 @@ public abstract class AVM2Item extends GraphTargetItem {
data.namespaceIndex = namespaceIndex;*/
if (((FullMultinameAVM2Item) propertyName).name != null) {
/*if (((FullMultinameAVM2Item) propertyName).namespace != null) {
writer.hilightSpecial(".", HighlightSpecialType.PROPERTY_PARENT_TYPE, 0, data);
}*/
writer.append(".");
if (((FullMultinameAVM2Item) propertyName).namespace != null) {
writer.append(".");
//writer.hilightSpecial(".", HighlightSpecialType.PROPERTY_PARENT_TYPE, 0, data);
}
return propertyName.toString(writer, localData);
} else {
//writer.hilightSpecial(".", HighlightSpecialType.PROPERTY_PARENT_TYPE, 0, data);

View File

@@ -76,7 +76,7 @@ public class ActionScript3ClassicAirDecompileTest extends ActionScript3Decompile
+ "var extraLine:Boolean = false;\r\n"
+ "var r:int = 7;\r\n"
+ "var t:int = 0;\r\n"
+ "t = int(this.getInt());\r\n"
+ "t = this.getInt();\r\n"
+ "if(t + 1 < g.length)\r\n"
+ "{\r\n"
+ "t++;\r\n"
@@ -218,7 +218,7 @@ public class ActionScript3ClassicAirDecompileTest extends ActionScript3Decompile
public void testConvert() {
decompileMethod("classic_air", "testConvert", "var s:String = \"a\";\r\n"
+ "var i:int = int(s);\r\n"
+ "var j:int = int(n);\r\n"
+ "var j:int = n;\r\n"
+ "s = String(j);\r\n"
+ "s = ns;\r\n",
false);
@@ -280,7 +280,7 @@ public class ActionScript3ClassicAirDecompileTest extends ActionScript3Decompile
@Test
public void testDeobfuscation() {
decompileMethod("classic_air", "testDeobfuscation", "var r:int = int(Math.random());\r\n"
decompileMethod("classic_air", "testDeobfuscation", "var r:int = Math.random();\r\n"
+ "if(r > 5)\r\n"
+ "{\r\n"
+ "trace(\"A\");\r\n"
@@ -909,7 +909,7 @@ public class ActionScript3ClassicAirDecompileTest extends ActionScript3Decompile
@Test
public void testIfFinally() {
decompileMethod("classic_air", "testIfFinally", "var a:int = int(Math.random());\r\n"
decompileMethod("classic_air", "testIfFinally", "var a:int = Math.random();\r\n"
+ "if(a == 5)\r\n"
+ "{\r\n"
+ "try\r\n"
@@ -979,7 +979,7 @@ public class ActionScript3ClassicAirDecompileTest extends ActionScript3Decompile
@Test
public void testIgnoreAndOr() {
decompileMethod("classic_air", "testIgnoreAndOr", "var k:int = int(Math.random());\r\n"
decompileMethod("classic_air", "testIgnoreAndOr", "var k:int = Math.random();\r\n"
+ "if(k > 5)\r\n"
+ "{\r\n"
+ "trace(\"A\");\r\n"
@@ -1244,7 +1244,7 @@ public class ActionScript3ClassicAirDecompileTest extends ActionScript3Decompile
+ "var a:* = ns::unnamespacedFunc();\r\n"
+ "var b:* = ns::[name];\r\n"
+ "trace(b.c);\r\n"
+ "var c:* = myInternal::neco;\r\n",
+ "var c:int = myInternal::neco;\r\n",
false);
}
@@ -1472,7 +1472,7 @@ public class ActionScript3ClassicAirDecompileTest extends ActionScript3Decompile
@Test
public void testTryIf() {
decompileMethod("classic_air", "testTryIf", "var a:int = int(Math.random());\r\n"
decompileMethod("classic_air", "testTryIf", "var a:int = Math.random();\r\n"
+ "try\r\n"
+ "{\r\n"
+ "if(a > 5 && a < 50)\r\n"

View File

@@ -76,7 +76,7 @@ public class ActionScript3ClassicDecompileTest extends ActionScript3DecompileTes
+ "var extraLine:Boolean = false;\r\n"
+ "var r:int = 7;\r\n"
+ "var t:int = 0;\r\n"
+ "t = int(this.getInt());\r\n"
+ "t = this.getInt();\r\n"
+ "if(t + 1 < g.length)\r\n"
+ "{\r\n"
+ "t++;\r\n"
@@ -217,7 +217,7 @@ public class ActionScript3ClassicDecompileTest extends ActionScript3DecompileTes
public void testConvert() {
decompileMethod("classic", "testConvert", "var s:String = \"a\";\r\n"
+ "var i:int = int(s);\r\n"
+ "var j:int = int(this.n);\r\n"
+ "var j:int = this.n;\r\n"
+ "s = String(j);\r\n"
+ "s = this.ns;\r\n",
false);
@@ -279,7 +279,7 @@ public class ActionScript3ClassicDecompileTest extends ActionScript3DecompileTes
@Test
public void testDeobfuscation() {
decompileMethod("classic", "testDeobfuscation", "var r:int = int(Math.random());\r\n"
decompileMethod("classic", "testDeobfuscation", "var r:int = Math.random();\r\n"
+ "if(r > 5)\r\n"
+ "{\r\n"
+ "trace(\"A\");\r\n"
@@ -974,7 +974,7 @@ public class ActionScript3ClassicDecompileTest extends ActionScript3DecompileTes
@Test
public void testIgnoreAndOr() {
decompileMethod("classic", "testIgnoreAndOr", "var k:int = int(Math.random());\r\n"
decompileMethod("classic", "testIgnoreAndOr", "var k:int = Math.random();\r\n"
+ "if(k > 5)\r\n"
+ "{\r\n"
+ "trace(\"A\");\r\n"

View File

@@ -79,7 +79,7 @@ public class ActionScript3CrossCompileDecompileTest extends ActionScript3Decompi
@Test(dataProvider = "swfNamesProvider")
public void testTryCatchInIf(String swfUsed) {
decompileMethod(swfUsed, "testTryCatchInIf", "var a:int = int(Math.random());\r\n"
decompileMethod(swfUsed, "testTryCatchInIf", "var a:int = Math.random();\r\n"
+ "if(a > 10)\r\n"
+ "{\r\n"
+ "try\r\n"
@@ -96,7 +96,7 @@ public class ActionScript3CrossCompileDecompileTest extends ActionScript3Decompi
@Test(dataProvider = "swfNamesProvider")
public void testTryCatchInIf2(String swfUsed) {
decompileMethod(swfUsed, "testTryCatchInIf2", "var a:int = int(Math.random());\r\n"
decompileMethod(swfUsed, "testTryCatchInIf2", "var a:int = Math.random();\r\n"
+ "if(a > 10)\r\n"
+ "{\r\n"
+ "try\r\n"
@@ -744,7 +744,7 @@ public class ActionScript3CrossCompileDecompileTest extends ActionScript3Decompi
@Test(dataProvider = "swfNamesProvider")
public void testTryFinallyReturnNested(String swfUsed) {
decompileMethod(swfUsed, "testTryFinallyReturnNested", "var a:int = int(Math.random() * 5);\r\n"
decompileMethod(swfUsed, "testTryFinallyReturnNested", "var a:int = Math.random() * 5;\r\n"
+ "try\r\n"
+ "{\r\n"
+ "trace(\"before try2\");\r\n"
@@ -776,7 +776,7 @@ public class ActionScript3CrossCompileDecompileTest extends ActionScript3Decompi
@Test(dataProvider = "swfNamesProvider")
public void testTryFinallyReturnNested2(String swfUsed) {
decompileMethod(swfUsed, "testTryFinallyReturnNested2", "var a:int = int(Math.random() * 5);\r\n"
decompileMethod(swfUsed, "testTryFinallyReturnNested2", "var a:int = Math.random() * 5;\r\n"
+ "try\r\n"
+ "{\r\n"
+ "try\r\n"
@@ -828,7 +828,7 @@ public class ActionScript3CrossCompileDecompileTest extends ActionScript3Decompi
@Test(dataProvider = "swfNamesProvider")
public void testTryFinallyReturnVoid(String swfUsed) {
decompileMethod(swfUsed, "testTryFinallyReturnVoid", "var a:int = int(Math.random() * 5);\r\n"
decompileMethod(swfUsed, "testTryFinallyReturnVoid", "var a:int = Math.random() * 5;\r\n"
+ "trace(\"before try\");\r\n"
+ "try\r\n"
+ "{\r\n"

View File

@@ -70,7 +70,7 @@ public class ActionScript3CrossCompileSwfToolsDecompileTest extends ActionScript
@Test
public void testTryCatchInIf() {
decompileMethod("swftools", "testTryCatchInIf", "var _loc1_:int = int(Math.random());\r\n"
decompileMethod("swftools", "testTryCatchInIf", "var _loc1_:int = Math.random();\r\n"
+ "if(_loc1_ > 10)\r\n"
+ "{\r\n"
+ "try\r\n"
@@ -87,7 +87,7 @@ public class ActionScript3CrossCompileSwfToolsDecompileTest extends ActionScript
@Test
public void testTryCatchInIf2() {
decompileMethod("swftools", "testTryCatchInIf2", "var _loc1_:* = int(Math.random());\r\n"
decompileMethod("swftools", "testTryCatchInIf2", "var _loc1_:int = Math.random();\r\n"
+ "if(_loc1_ > 10)\r\n"
+ "{\r\n"
+ "try\r\n"
@@ -762,7 +762,7 @@ public class ActionScript3CrossCompileSwfToolsDecompileTest extends ActionScript
@Test
public void testTryFinallyReturnNested() {
decompileMethod("swftools", "testTryFinallyReturnNested", "var _loc1_:* = int(Math.random() * 5);\r\n"
decompileMethod("swftools", "testTryFinallyReturnNested", "var _loc1_:int = Math.random() * 5;\r\n"
+ "try\r\n"
+ "{\r\n"
+ "trace(\"before try2\");\r\n"
@@ -803,7 +803,7 @@ public class ActionScript3CrossCompileSwfToolsDecompileTest extends ActionScript
@Test
public void testTryFinallyReturnNested2() {
decompileMethod("swftools", "testTryFinallyReturnNested2", "var _loc1_:* = int(Math.random() * 5);\r\n"
decompileMethod("swftools", "testTryFinallyReturnNested2", "var _loc1_:int = Math.random() * 5;\r\n"
+ "try\r\n"
+ "{\r\n"
+ "try\r\n"
@@ -870,7 +870,7 @@ public class ActionScript3CrossCompileSwfToolsDecompileTest extends ActionScript
@Test
public void testTryFinallyReturnVoid() {
decompileMethod("swftools", "testTryFinallyReturnVoid", "var _loc1_:* = int(Math.random() * 5);\r\n"
decompileMethod("swftools", "testTryFinallyReturnVoid", "var _loc1_:int = Math.random() * 5;\r\n"
+ "trace(\"before try\");\r\n"
+ "try\r\n"
+ "{\r\n"

View File

@@ -10,7 +10,7 @@ package tests
public function run():void
{
var a:int = int(Math.random());
var a:int = Math.random();
if (a > 10)
{

View File

@@ -9,7 +9,7 @@ package tests
public function run() : String
{
var a:int = int(Math.random() * 5);
var a:int = Math.random() * 5;
try
{
trace("before try2");

View File

@@ -10,7 +10,7 @@ package tests
public function run() : String
{
var a:int = int(Math.random() * 5);
var a:int = Math.random() * 5;
try
{
try

View File

@@ -9,7 +9,7 @@ package tests
public function run() : void
{
var a:int = int(Math.random() * 5);
var a:int = Math.random() * 5;
trace("before try");
try
{