Mercurial > hg > audiodb
annotate bindings/as3/ext/asunit/textui/FlexTestRunner.as @ 732:3a0b9700b3d2
* Initial AS3 commit
author | mas01mj |
---|---|
date | Tue, 14 Sep 2010 16:47:10 +0000 |
parents | |
children |
rev | line source |
---|---|
mas01mj@732 | 1 package asunit.textui { |
mas01mj@732 | 2 import flash.display.DisplayObject; |
mas01mj@732 | 3 import flash.events.Event; |
mas01mj@732 | 4 import mx.core.IUIComponent; |
mas01mj@732 | 5 import asunit.textui.TestRunner; |
mas01mj@732 | 6 |
mas01mj@732 | 7 /** |
mas01mj@732 | 8 * @private |
mas01mj@732 | 9 **/ |
mas01mj@732 | 10 public class FlexTestRunner extends TestRunner { |
mas01mj@732 | 11 |
mas01mj@732 | 12 public function FlexTestRunner() { |
mas01mj@732 | 13 setPrinter(new ResultPrinter()); |
mas01mj@732 | 14 } |
mas01mj@732 | 15 |
mas01mj@732 | 16 protected override function addedHandler(event:Event):void { |
mas01mj@732 | 17 if(event.target === this) { |
mas01mj@732 | 18 parent.addEventListener(Event.RESIZE, resizeHandler); |
mas01mj@732 | 19 resizeHandler(new Event(Event.RESIZE)); |
mas01mj@732 | 20 } |
mas01mj@732 | 21 else { |
mas01mj@732 | 22 event.stopPropagation(); |
mas01mj@732 | 23 } |
mas01mj@732 | 24 } |
mas01mj@732 | 25 |
mas01mj@732 | 26 public override function set width(w:Number):void { |
mas01mj@732 | 27 fPrinter.width = w; |
mas01mj@732 | 28 } |
mas01mj@732 | 29 |
mas01mj@732 | 30 public override function set height(h:Number):void { |
mas01mj@732 | 31 fPrinter.height = h; |
mas01mj@732 | 32 } |
mas01mj@732 | 33 |
mas01mj@732 | 34 public function resizeHandler(event:Event):void { |
mas01mj@732 | 35 width = parent.width; |
mas01mj@732 | 36 height = parent.height; |
mas01mj@732 | 37 } |
mas01mj@732 | 38 |
mas01mj@732 | 39 public override function addChild(child:DisplayObject):DisplayObject { |
mas01mj@732 | 40 if(parent && child is IUIComponent) { |
mas01mj@732 | 41 // AND check for 'is' UIUComponent... |
mas01mj@732 | 42 return parent.addChild(child); |
mas01mj@732 | 43 } |
mas01mj@732 | 44 else { |
mas01mj@732 | 45 return super.addChild(child); |
mas01mj@732 | 46 } |
mas01mj@732 | 47 } |
mas01mj@732 | 48 |
mas01mj@732 | 49 public override function removeChild(child:DisplayObject):DisplayObject { |
mas01mj@732 | 50 if(child is IUIComponent) { |
mas01mj@732 | 51 return parent.removeChild(child); |
mas01mj@732 | 52 } |
mas01mj@732 | 53 else { |
mas01mj@732 | 54 return super.removeChild(child); |
mas01mj@732 | 55 } |
mas01mj@732 | 56 } |
mas01mj@732 | 57 } |
mas01mj@732 | 58 } |