Sha256: c24a943594c3780c611fb11de9e1e0f13a6de5f27efaeee7743a147c62fdc625

Contents?: true

Size: 1.78 KB

Versions: 3

Compression:

Stored size: 1.78 KB

Contents

package asunit.framework {
    
    import asunit.asserts.*;
    
    import flash.display.Sprite;
    import flash.utils.setTimeout;

    public class AsyncMethodTest {

        [Inject]
        public var async:IAsync;

        [Inject]
        public var sprite:Sprite;

        [Before]
        protected function setUp():void {
            var handler:Function = async.add(asyncSetupHandler);
            setTimeout(handler, 0);
        }

        public function asyncSetupHandler():void{
        }

        [Test]
        public function testInstantiated():void {
            assertTrue("Sprite instantiated", sprite is Sprite);
        }

        [Test]
        public function testAsyncMethod():void {
            var handler:Function = async.add(asyncHandler);
            setTimeout(handler, 0);
        }
        
        private function asyncHandler():void {
            assertTrue(sprite is Sprite);
        }
        
        [Test]
        public function testAsyncVisualEntity():void {
            var handler:Function = async.add(spriteHandler);
            setTimeout(handler, 0);
        }
        
        private function spriteHandler():void {
            assertTrue(sprite is Sprite);
        }

        [Test]
        public function testAsyncVisualEntity2():void {
            var handler:Function = async.add(spriteHandler);
            setTimeout(handler, 0);
        }
        
        [Test]
        public function testMultipleAsyncMethod():void {
            var handler1:Function = async.add(spriteHandler);
            var handler2:Function = async.add(spriteHandler);
            setTimeout(handler1, 0);
            setTimeout(handler2, 0);
        }
        
        [Test]
        public function testAsyncSetup():void{
            assertTrue(sprite is Sprite);
        }
    }
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
asunit4-4.2.3.pre test/asunit/framework/AsyncMethodTest.as
asunit4-4.2.2.pre test/asunit/framework/AsyncMethodTest.as
asunit4-4.2.1.pre test/asunit/framework/AsyncMethodTest.as