diff --git a/src/index.n b/src/index.n index b515a5c..0719070 100644 Binary files a/src/index.n and b/src/index.n differ diff --git a/src/massive/munit/async/AsyncDelegate.hx b/src/massive/munit/async/AsyncDelegate.hx index d678919..a416619 100644 --- a/src/massive/munit/async/AsyncDelegate.hx +++ b/src/massive/munit/async/AsyncDelegate.hx @@ -136,7 +136,7 @@ class AsyncDelegate function timeoutHandler() { - #if flash + #if (flash && !air) //pushing timeout onto next frame to prevent raxe condition bug when flash framerate drops too low and timeout timer executes prior to response on same frame deferredTimer = Timer.delay(actualTimeoutHandler, 1); #else diff --git a/src/massive/munit/client/PrintClient.hx b/src/massive/munit/client/PrintClient.hx index 868b4b6..2d9c824 100644 --- a/src/massive/munit/client/PrintClient.hx +++ b/src/massive/munit/client/PrintClient.hx @@ -58,7 +58,7 @@ class PrintClient extends PrintClientBase */ public static inline var DEFAULT_ID:String = "print"; - #if (js || flash) + #if (js || (flash && !air)) var external:ExternalPrintClient; #if flash var textField:flash.text.TextField; @@ -78,7 +78,7 @@ class PrintClient extends PrintClientBase super.init(); #if nodejs - #elseif (js || flash) + #elseif (js || (flash && !air)) external = new ExternalPrintClientJS(); #if flash initFlash(); @@ -91,7 +91,7 @@ class PrintClient extends PrintClientBase haxe.Log.trace = customTrace; } - #if flash + #if (flash && !air) function initFlash() { if(!flash.external.ExternalInterface.available) @@ -128,7 +128,7 @@ class PrintClient extends PrintClientBase super.printOverallResult(result); #if nodejs - #elseif (js || flash) + #elseif (js || (flash && !air)) external.setResult(result); external.setResultBackground(result); #end @@ -139,11 +139,15 @@ class PrintClient extends PrintClientBase addTrace(value, info); } + #if (flash && air) + private var flashOutput = ""; + #end + override public function print(value:Dynamic) { super.print(value); - #if flash + #if (flash && !air) textField.appendText(value); textField.scrollV = textField.maxScrollV; #end @@ -152,8 +156,16 @@ class PrintClient extends PrintClientBase untyped process.stdout.write(value); #elseif (neko || cpp || java || cs || python || php || hl || eval) Sys.print(value); - #elseif (js || flash) + #elseif (js || (flash && !air)) external.print(value); + #elseif (flash && air) + flashOutput += value; + while (flashOutput.indexOf("\n") > -1) + { + var index = flashOutput.indexOf("\n") + 1; + flash.Lib.trace(flashOutput.substr(0, index)); + flashOutput = flashOutput.substr(index); + } #end } } \ No newline at end of file diff --git a/src/massive/munit/client/PrintClientBase.hx b/src/massive/munit/client/PrintClientBase.hx index 5cda00c..e6a6cf0 100644 --- a/src/massive/munit/client/PrintClientBase.hx +++ b/src/massive/munit/client/PrintClientBase.hx @@ -252,7 +252,7 @@ class ExternalPrintClientJS implements ExternalPrintClient { public function new() { - #if flash + #if (flash && !air) if(!flash.external.ExternalInterface.available) { throw new MUnitException("ExternalInterface not available"); @@ -279,7 +279,7 @@ class ExternalPrintClientJS implements ExternalPrintClient #end } - #if flash + #if (flash && !air) static var externalInterfaceQueue:Array = []; static var flashInitialised:Bool = false; static var externalInterfaceCounter:Int = 0; @@ -400,7 +400,7 @@ class ExternalPrintClientJS implements ExternalPrintClient public function queue(method:String, ?args:Dynamic):Bool { - #if (!js && !flash || nodejs) + #if (!js && (!flash || air) || nodejs) //throw new MUnitException("Cannot call from non JS/Flash targets"); return false; #end @@ -411,7 +411,7 @@ class ExternalPrintClientJS implements ExternalPrintClient var jsCode = convertToJavaScript(method, a); #if js return js.Lib.eval(jsCode); - #elseif flash + #elseif (flash && !air) externalInterfaceQueue.push(jsCode); #end return false; diff --git a/src/massive/munit/client/RichPrintClient.hx b/src/massive/munit/client/RichPrintClient.hx index 36ce2bc..4e1a7a4 100644 --- a/src/massive/munit/client/RichPrintClient.hx +++ b/src/massive/munit/client/RichPrintClient.hx @@ -223,11 +223,23 @@ class RichPrintClient extends PrintClientBase external.trace(t); } + #if (flash && air) + private var flashOutput = ""; + #end + override public function print(value:Dynamic) { super.print(value); #if(neko || cpp || java || cs || python || php || hl || eval) Sys.print(value); + #elseif (flash && air) + flashOutput += value; + while (flashOutput.indexOf("\n") > -1) + { + var index = flashOutput.indexOf("\n"); + flash.Lib.trace(flashOutput.substr(0, index)); + flashOutput = flashOutput.substr(index + 1); + } #elseif nodejs js.Node.process.stdout.write(Std.string(value)); #end diff --git a/src/run.n b/src/run.n index 12ab17e..08876ce 100644 Binary files a/src/run.n and b/src/run.n differ diff --git a/tool/template/test-main.mtt b/tool/template/test-main.mtt index cbc2b8f..40dd86f 100644 --- a/tool/template/test-main.mtt +++ b/tool/template/test-main.mtt @@ -61,7 +61,9 @@ class TestMain { try { - #if flash + #if (flash && air) + flash.desktop.NativeApplication.nativeApplication.exit(); + #elseif flash flash.external.ExternalInterface.call("testResult", successful); #elseif js js.Lib.eval("testResult(" + successful + ");");