Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified src/index.n
Binary file not shown.
2 changes: 1 addition & 1 deletion src/massive/munit/async/AsyncDelegate.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 18 additions & 6 deletions src/massive/munit/client/PrintClient.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
Expand All @@ -91,7 +91,7 @@ class PrintClient extends PrintClientBase
haxe.Log.trace = customTrace;
}

#if flash
#if (flash && !air)
function initFlash()
{
if(!flash.external.ExternalInterface.available)
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
}
}
8 changes: 4 additions & 4 deletions src/massive/munit/client/PrintClientBase.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -279,7 +279,7 @@ class ExternalPrintClientJS implements ExternalPrintClient
#end
}

#if flash
#if (flash && !air)
static var externalInterfaceQueue:Array<String> = [];
static var flashInitialised:Bool = false;
static var externalInterfaceCounter:Int = 0;
Expand Down Expand Up @@ -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
Expand All @@ -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;
Expand Down
12 changes: 12 additions & 0 deletions src/massive/munit/client/RichPrintClient.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Binary file modified src/run.n
Binary file not shown.
4 changes: 3 additions & 1 deletion tool/template/test-main.mtt
Original file line number Diff line number Diff line change
Expand Up @@ -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 + ");");
Expand Down