|
From: <luk...@us...> - 2006-09-21 01:33:12
|
Revision: 116
http://svn.sourceforge.net/asunit/?rev=116&view=rev
Author: lukebayes
Date: 2006-09-20 18:33:07 -0700 (Wed, 20 Sep 2006)
Log Message:
-----------
Async test cases and suites seem to be working properly
Modified Paths:
--------------
trunk/framework-test/as3/asunit/framework/TestCaseTest.as
trunk/framework-test/as3/asunit/textui/TestRunnerTest.as
Modified: trunk/framework-test/as3/asunit/framework/TestCaseTest.as
===================================================================
--- trunk/framework-test/as3/asunit/framework/TestCaseTest.as 2006-09-21 01:32:40 UTC (rev 115)
+++ trunk/framework-test/as3/asunit/framework/TestCaseTest.as 2006-09-21 01:33:07 UTC (rev 116)
@@ -1,5 +1,10 @@
package asunit.framework {
+ import flash.events.EventDispatcher;
+ import flash.events.Event;
+ import flash.utils.setTimeout;
+ import flash.errors.IllegalOperationError;
+
public class TestCaseTest extends TestCase {
public function TestCaseTest(testMethod:String = null) {
@@ -41,5 +46,20 @@
assertTrue("testMethod2Run", mock.testMethod2Run);
assertTrue("testMethod3Run", mock.testMethod3Run);
}
+
+ public function testAsync():void {
+ trace("TEST ASYNC");
+ var dispatcher:EventDispatcher = new EventDispatcher();
+ var handler:Function = addAsync(asyncHandler, 400);
+ trace("METHOD IS ASYNC? : " + methodIsAsynchronous);
+ dispatcher.addEventListener(Event.COMPLETE, handler);
+ setTimeout(dispatcher.dispatchEvent, 200, new Event(Event.COMPLETE));
+ }
+
+ private function asyncHandler(event:Event):void {
+ assertEquals(event.type, Event.COMPLETE);
+// assertTrue(false);
+// throw new IllegalOperationError("broken");
+ }
}
}
\ No newline at end of file
Modified: trunk/framework-test/as3/asunit/textui/TestRunnerTest.as
===================================================================
--- trunk/framework-test/as3/asunit/textui/TestRunnerTest.as 2006-09-21 01:32:40 UTC (rev 115)
+++ trunk/framework-test/as3/asunit/textui/TestRunnerTest.as 2006-09-21 01:33:07 UTC (rev 116)
@@ -24,32 +24,5 @@
public function testInstantiated():void {
assertTrue("TestRunner instantiated with: " + instance, instance is TestRunner);
}
-
- public function testAsync():void {
- var handler:Function = addAsync(asyncCompleteHandler);
- setTimeout(handler, 400, new Event(Event.ACTIVATE));
- }
-
- public function asyncCompleteHandler(event:Event):void {
-// throw new IllegalOperationError("what the heck?");
- }
-
- public function testAsync2():void {
- var handler:Function = addAsync(async2CompleteHandler);
- setTimeout(handler, 40);
- }
-
- public function async2CompleteHandler():void {
-// fail("test async complete failed");
- }
-
- public function testSomethingComplete():void {
- }
-
- public function testSomethingElse():void {
- }
-
- public function testAnotherThing():void {
- }
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|