From: <i_t...@us...> - 2008-07-12 18:34:26
|
Revision: 192 http://asunit.svn.sourceforge.net/asunit/?rev=192&view=rev Author: i_tyrrell Date: 2008-07-12 11:34:34 -0700 (Sat, 12 Jul 2008) Log Message: ----------- Accidentally missed unversioned files from r191 - patch for multiple Asynchronous operations. Added Paths: ----------- branches/ityrrell/framework/as3/asunit/framework/AsyncOperation.as branches/ityrrell/framework-test/as3/asunit/AllTests.as branches/ityrrell/framework-test/as3/asunit/textui/AllTests.as branches/ityrrell/framework-test/as3/asunit/util/AllTests.as Added: branches/ityrrell/framework/as3/asunit/framework/AsyncOperation.as =================================================================== --- branches/ityrrell/framework/as3/asunit/framework/AsyncOperation.as (rev 0) +++ branches/ityrrell/framework/as3/asunit/framework/AsyncOperation.as 2008-07-12 18:34:34 UTC (rev 192) @@ -0,0 +1,54 @@ +package asunit.framework { + import flash.errors.IllegalOperationError; + + import asunit.errors.AssertionFailedError; + + import flash.events.TimerEvent; + import flash.utils.Timer; + + + public class AsyncOperation{ + + private var timeout:Timer; + private var testCase:TestCase; + private var callback:Function; + private var duration:Number; + + public function AsyncOperation(testCase:TestCase, handler:Function, duration:Number){ + this.testCase = testCase; + this.duration = duration; + timeout = new Timer(duration, 1); + timeout.addEventListener(TimerEvent.TIMER_COMPLETE, onTimeoutComplete); + timeout.start(); + if(handler == null) { + handler = function(args:*):* {return;}; + } + var context:AsyncOperation = this; + callback = function(args:*):* { + timeout.stop(); + try { + handler.apply(testCase, arguments); + } + catch(e:AssertionFailedError) { + testCase.getResult().addFailure(testCase, e); + } + catch(ioe:IllegalOperationError) { + testCase.getResult().addError(testCase, ioe); + } + finally { + testCase.asyncOperationComplete(context); + } + return; + }; + } + + public function getCallback():Function{ + return callback; + } + + private function onTimeoutComplete(event:TimerEvent):void { + testCase.asyncOperationTimeout(this, duration); + } + } + +} Added: branches/ityrrell/framework-test/as3/asunit/AllTests.as =================================================================== --- branches/ityrrell/framework-test/as3/asunit/AllTests.as (rev 0) +++ branches/ityrrell/framework-test/as3/asunit/AllTests.as 2008-07-12 18:34:34 UTC (rev 192) @@ -0,0 +1,15 @@ +package asunit { + import asunit.framework.TestSuite; + import asunit.framework.AllTests; + import asunit.textui.AllTests; + import asunit.util.AllTests; + + public class AllTests extends TestSuite { + + public function AllTests() { + addTest(new asunit.framework.AllTests()); + addTest(new asunit.textui.AllTests()); + addTest(new asunit.util.AllTests()); + } + } +} Added: branches/ityrrell/framework-test/as3/asunit/textui/AllTests.as =================================================================== --- branches/ityrrell/framework-test/as3/asunit/textui/AllTests.as (rev 0) +++ branches/ityrrell/framework-test/as3/asunit/textui/AllTests.as 2008-07-12 18:34:34 UTC (rev 192) @@ -0,0 +1,11 @@ +package asunit.textui { + import asunit.framework.TestSuite; + import asunit.textui.TestRunnerTest; + + public class AllTests extends TestSuite { + + public function AllTests() { + addTest(new asunit.textui.TestRunnerTest()); + } + } +} Added: branches/ityrrell/framework-test/as3/asunit/util/AllTests.as =================================================================== --- branches/ityrrell/framework-test/as3/asunit/util/AllTests.as (rev 0) +++ branches/ityrrell/framework-test/as3/asunit/util/AllTests.as 2008-07-12 18:34:34 UTC (rev 192) @@ -0,0 +1,11 @@ +package asunit.util { + import asunit.framework.TestSuite; + import asunit.util.ArrayIteratorTest; + + public class AllTests extends TestSuite { + + public function AllTests() { + addTest(new asunit.util.ArrayIteratorTest()); + } + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <i_t...@us...> - 2008-07-13 20:02:25
|
Revision: 196 http://asunit.svn.sourceforge.net/asunit/?rev=196&view=rev Author: i_tyrrell Date: 2008-07-13 13:02:35 -0700 (Sun, 13 Jul 2008) Log Message: ----------- Further progress on port, now running. Modified Paths: -------------- branches/ityrrell/framework/as25/asunit/flash/events/Event.as branches/ityrrell/framework/as25/asunit/flash/events/EventDispatcher.as branches/ityrrell/framework/as25/asunit/flash/utils/Timer.as branches/ityrrell/framework/as25/asunit/framework/TestCase.as branches/ityrrell/framework/as25/asunit/framework/TestResult.as branches/ityrrell/framework/as25/asunit/framework/TestSuite.as branches/ityrrell/framework/as25/asunit/textui/SuccessBar.as branches/ityrrell/framework/as25/asunit/textui/TestRunner.as branches/ityrrell/framework-test/as25/AsUnitTestRunner.as branches/ityrrell/framework-test/as25/asunit/framework/AssertTest.as branches/ityrrell/framework-test/as25/asunit/framework/AsyncMethodTest.as branches/ityrrell/framework-test/as25/asunit/framework/TestCaseTest.as branches/ityrrell/framework-test/as25/asunit/framework/TestFailureTest.as branches/ityrrell/framework-test/as25/asunit/framework/VisualTestCaseTest.as branches/ityrrell/framework-test/as25/asunit/textui/TestRunnerTest.as branches/ityrrell/framework-test/as25/asunit/util/ArrayIteratorTest.as Modified: branches/ityrrell/framework/as25/asunit/flash/events/Event.as =================================================================== --- branches/ityrrell/framework/as25/asunit/flash/events/Event.as 2008-07-13 19:28:39 UTC (rev 195) +++ branches/ityrrell/framework/as25/asunit/flash/events/Event.as 2008-07-13 20:02:35 UTC (rev 196) @@ -7,7 +7,6 @@ private var _target:Object; public function Event(type:String, target:Object) { - trace("Event::constructor: type: " + type); _type = type; _target = target==undefined ? null : target; } Modified: branches/ityrrell/framework/as25/asunit/flash/events/EventDispatcher.as =================================================================== --- branches/ityrrell/framework/as25/asunit/flash/events/EventDispatcher.as 2008-07-13 19:28:39 UTC (rev 195) +++ branches/ityrrell/framework/as25/asunit/flash/events/EventDispatcher.as 2008-07-13 20:02:35 UTC (rev 196) @@ -18,19 +18,15 @@ if(listeners[type] instanceof Array){ listeners[type].push(l); }else{ - trace("create new listener"); listeners[type] = [l]; } } public function dispatchEvent(event : Event) : Void { - trace("EventDispatcher::dispatchEvent: type: " + event.type); if(listeners[event.type] instanceof Array){ - trace("listerner is array") ArrayUtil.forEach(listeners[event.type], function(listener:Object):Void{ - trace("dispatching event..."); - var callback:Function = listener.c; + var callback:Function = listener.c; var scope:Object = listener.s; callback.call(scope, event); } Modified: branches/ityrrell/framework/as25/asunit/flash/utils/Timer.as =================================================================== --- branches/ityrrell/framework/as25/asunit/flash/utils/Timer.as 2008-07-13 19:28:39 UTC (rev 195) +++ branches/ityrrell/framework/as25/asunit/flash/utils/Timer.as 2008-07-13 20:02:35 UTC (rev 196) @@ -14,7 +14,6 @@ private var state:Number; public function Timer(delay:Number, repeatCount:Number) { - trace("new Timer"); if(repeatCount==undefined) repeatCount=0; _delay = delay; _repeatCount = repeatCount; @@ -44,7 +43,6 @@ } private function onInterval():Void{ - trace("Timer::onInterval"); _currentCount++; if(_currentCount==_repeatCount) { stop(); @@ -60,7 +58,6 @@ * _global.setTimeout() is only available in FP8+ */ public static function setTimeout(scope:Object, callback:Object, duration:Number):Void{ - trace("Timer::setTimeout"); var t:Timer = new Timer(duration, 1); var args:Array = arguments.length > 3 ? arguments.slice(3) : []; // normalise callback as Function Modified: branches/ityrrell/framework/as25/asunit/framework/TestCase.as =================================================================== --- branches/ityrrell/framework/as25/asunit/framework/TestCase.as 2008-07-13 19:28:39 UTC (rev 195) +++ branches/ityrrell/framework/as25/asunit/framework/TestCase.as 2008-07-13 20:02:35 UTC (rev 196) @@ -110,7 +110,7 @@ } else { setTestMethods(this); } - setName(className); + setName(this.className); // I don't think this is necessary for as2 // resolveLayoutManager(); asyncQueue = []; @@ -146,14 +146,17 @@ fName = name; } - private function setTestMethods(obj:Object):Void { - testMethods = []; - for(var prop:String in obj) { - // look for functions starting with "test" - if((prop.indexOf("test")==0) && (obj[prop] instanceof Function)){ + private function setTestMethods(obj:Object):Void { + testMethods = []; + _global.ASSetPropFlags(obj.__proto__, null, 6, true); + for(var prop:String in obj) { + // look for functions starting with "test" + if((prop.indexOf("test")==0) && (obj[prop] instanceof Function)){ testMethods.push(prop); } - } + } + _global.ASSetPropFlags(this.__proto__, null, 1, true); + testMethods.reverse(); } public function getTestMethods():Array { Modified: branches/ityrrell/framework/as25/asunit/framework/TestResult.as =================================================================== --- branches/ityrrell/framework/as25/asunit/framework/TestResult.as 2008-07-13 19:28:39 UTC (rev 195) +++ branches/ityrrell/framework/as25/asunit/framework/TestResult.as 2008-07-13 20:02:35 UTC (rev 196) @@ -20,7 +20,7 @@ private var fRunTests:Number; private var fStop:Boolean; - public function TestResult() { + public function TestResult() { fFailures = new Array(); fErrors = new Array(); fListeners = new Array(); @@ -119,8 +119,8 @@ /** * Informs the result that a test will be started. */ - public function startTest(test:Test):Void { - var count:Number = test.countTestCases(); + public function startTest(test:Test):Void { + var count:Number = test.countTestCases(); fRunTests += count; var len:Number = fListeners.length; Modified: branches/ityrrell/framework/as25/asunit/framework/TestSuite.as =================================================================== --- branches/ityrrell/framework/as25/asunit/framework/TestSuite.as 2008-07-13 19:28:39 UTC (rev 195) +++ branches/ityrrell/framework/as25/asunit/framework/TestSuite.as 2008-07-13 20:02:35 UTC (rev 196) @@ -48,11 +48,14 @@ /** * Counts the number of tests that will be run by this Suite. */ - public function countTestCases():Number { + public function countTestCases():Number { + trace("countTestCases"); var count:Number = 0; ArrayUtil.forEach(fTests, function(test:TestCase):Void{ + trace("test: "+ test); count = count + test.countTestCases(); + trace("count: " + count); } ); return count; Modified: branches/ityrrell/framework/as25/asunit/textui/SuccessBar.as =================================================================== --- branches/ityrrell/framework/as25/asunit/textui/SuccessBar.as 2008-07-13 19:28:39 UTC (rev 195) +++ branches/ityrrell/framework/as25/asunit/textui/SuccessBar.as 2008-07-13 20:02:35 UTC (rev 196) @@ -6,7 +6,7 @@ private var failingColor:Number = 0xFD0000; public static function create(movieClip:MovieClip):SuccessBar{ - movieClip.__proto__ = SuccessBar; + movieClip.__proto__ = SuccessBar.prototype; Function(SuccessBar).apply(movieClip); return SuccessBar(movieClip); } Modified: branches/ityrrell/framework/as25/asunit/textui/TestRunner.as =================================================================== --- branches/ityrrell/framework/as25/asunit/textui/TestRunner.as 2008-07-13 19:28:39 UTC (rev 195) +++ branches/ityrrell/framework/as25/asunit/textui/TestRunner.as 2008-07-13 20:02:35 UTC (rev 196) @@ -33,16 +33,14 @@ fPrinter = null; result = null; startTime = 0; - trace("TestRunner::constructor"); configureListeners(); } private function configureListeners():Void { - Timer.setTimeout(this, addedHandler, 10); + addedHandler(); } private function addedHandler():Void { - trace("TestRunner::addedHandler"); Stage.align = "TL"; Stage.scaleMode = "noScale"; var tR:TestRunner = this; @@ -106,7 +104,7 @@ startTime = getTimer(); test.setResult(result); test.setContext(parent); - test.addEventListener(Event.COMPLETE, testCompleteHandler); + test.addEventListener(Event.COMPLETE, testCompleteHandler, this); test.run(); return result; } @@ -114,6 +112,7 @@ private function testCompleteHandler(event:Event):Void { var endTime:Number = getTimer(); var runTime:Number = endTime - startTime; + getPrinter().printResult(result, runTime); } @@ -122,6 +121,7 @@ if(printer) printer.destroyAssets(); fPrinter = printer; fPrinter.setParent(parent); + resizeHandler(); } public function getPrinter():ResultPrinter { Modified: branches/ityrrell/framework-test/as25/AsUnitTestRunner.as =================================================================== --- branches/ityrrell/framework-test/as25/AsUnitTestRunner.as 2008-07-13 19:28:39 UTC (rev 195) +++ branches/ityrrell/framework-test/as25/AsUnitTestRunner.as 2008-07-13 20:02:35 UTC (rev 196) @@ -7,10 +7,6 @@ } public function AsUnitTestRunner() { - try{ start(AllTests); - }catch(e){ - trace(e); - } } } \ No newline at end of file Modified: branches/ityrrell/framework-test/as25/asunit/framework/AssertTest.as =================================================================== --- branches/ityrrell/framework-test/as25/asunit/framework/AssertTest.as 2008-07-13 19:28:39 UTC (rev 195) +++ branches/ityrrell/framework-test/as25/asunit/framework/AssertTest.as 2008-07-13 20:02:35 UTC (rev 196) @@ -3,6 +3,8 @@ class asunit.framework.AssertTest extends TestCase { + public var className:String = "asunit.framework.AssertTest"; + public function AssertTest(testMethod:String) { super(testMethod); } Modified: branches/ityrrell/framework-test/as25/asunit/framework/AsyncMethodTest.as =================================================================== --- branches/ityrrell/framework-test/as25/asunit/framework/AsyncMethodTest.as 2008-07-13 19:28:39 UTC (rev 195) +++ branches/ityrrell/framework-test/as25/asunit/framework/AsyncMethodTest.as 2008-07-13 20:02:35 UTC (rev 196) @@ -1,7 +1,10 @@ import asunit.flash.utils.Timer; import asunit.framework.TestCase; -class asunit.framework.AsyncMethodTest extends TestCase { +class asunit.framework.AsyncMethodTest extends TestCase { + + public var className:String = "asunit.framework.AsyncMethodTest"; + private var instance:MovieClip; public function AsyncMethodTest(testMethod:String) { Modified: branches/ityrrell/framework-test/as25/asunit/framework/TestCaseTest.as =================================================================== --- branches/ityrrell/framework-test/as25/asunit/framework/TestCaseTest.as 2008-07-13 19:28:39 UTC (rev 195) +++ branches/ityrrell/framework-test/as25/asunit/framework/TestCaseTest.as 2008-07-13 20:02:35 UTC (rev 196) @@ -6,7 +6,7 @@ class asunit.framework.TestCaseTest extends TestCase { - private var className:String = "asunit.framework.TestCaseTest"; + public var className:String = "asunit.framework.TestCaseTest"; public function TestCaseTest(testMethod:String) { super(testMethod); Modified: branches/ityrrell/framework-test/as25/asunit/framework/TestFailureTest.as =================================================================== --- branches/ityrrell/framework-test/as25/asunit/framework/TestFailureTest.as 2008-07-13 19:28:39 UTC (rev 195) +++ branches/ityrrell/framework-test/as25/asunit/framework/TestFailureTest.as 2008-07-13 20:02:35 UTC (rev 196) @@ -3,6 +3,8 @@ class asunit.framework.TestFailureTest extends TestCase { + public var className:String = "asunit.framework.TestFailureTest"; + public function TestFailureTest(testMethod:String) { super(testMethod); } Modified: branches/ityrrell/framework-test/as25/asunit/framework/VisualTestCaseTest.as =================================================================== --- branches/ityrrell/framework-test/as25/asunit/framework/VisualTestCaseTest.as 2008-07-13 19:28:39 UTC (rev 195) +++ branches/ityrrell/framework-test/as25/asunit/framework/VisualTestCaseTest.as 2008-07-13 20:02:35 UTC (rev 196) @@ -2,7 +2,7 @@ class asunit.framework.VisualTestCaseTest extends TestCase { - private var className:String = "asunit.framework.VisualTestCaseTest"; + public var className:String = "asunit.framework.VisualTestCaseTest"; private var instance:MovieClip; Modified: branches/ityrrell/framework-test/as25/asunit/textui/TestRunnerTest.as =================================================================== --- branches/ityrrell/framework-test/as25/asunit/textui/TestRunnerTest.as 2008-07-13 19:28:39 UTC (rev 195) +++ branches/ityrrell/framework-test/as25/asunit/textui/TestRunnerTest.as 2008-07-13 20:02:35 UTC (rev 196) @@ -1,7 +1,10 @@ import asunit.textui.TestRunner; import asunit.framework.TestCase; -class asunit.textui.TestRunnerTest extends TestCase { +class asunit.textui.TestRunnerTest extends TestCase { + + public var className:String = "asunit.textui.TestRunnerTest"; + private var instance : TestRunner; public function TestRunnerTest(testMethod:String) { Modified: branches/ityrrell/framework-test/as25/asunit/util/ArrayIteratorTest.as =================================================================== --- branches/ityrrell/framework-test/as25/asunit/util/ArrayIteratorTest.as 2008-07-13 19:28:39 UTC (rev 195) +++ branches/ityrrell/framework-test/as25/asunit/util/ArrayIteratorTest.as 2008-07-13 20:02:35 UTC (rev 196) @@ -2,6 +2,8 @@ import asunit.framework.TestCase; class asunit.util.ArrayIteratorTest extends TestCase { + + public var className:String = "asunit.util.ArrayIteratorTest"; private var itr : ArrayIterator; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |