view bindings/as3/ext/asunit/textui/FlexTestRunner.as @ 765:337e72088f76

Fix for some sample bugs a + b ? c : d does not do what I think it does. That bug mostly masked a thorough logic error in building the table of counts of possible sequences; there was too much cumulativeness. There apparently remain problems
author mas01cr
date Thu, 02 Jun 2011 16:31:35 +0000
parents 3a0b9700b3d2
children
line wrap: on
line source
package asunit.textui {
    import flash.display.DisplayObject;
    import flash.events.Event;
    import mx.core.IUIComponent;
    import asunit.textui.TestRunner;

    /**
    *   @private
    **/
    public class FlexTestRunner extends TestRunner {

        public function FlexTestRunner() {
            setPrinter(new ResultPrinter());
        }
    
        protected override function addedHandler(event:Event):void {
            if(event.target === this) {
                parent.addEventListener(Event.RESIZE, resizeHandler);
                resizeHandler(new Event(Event.RESIZE));
            }
            else {
                event.stopPropagation();
            }
        }
    
        public override function set width(w:Number):void {
            fPrinter.width = w;
        }
    
        public override function set height(h:Number):void {
            fPrinter.height = h;
        }
    
        public function resizeHandler(event:Event):void {
            width = parent.width;
            height = parent.height;
        }
    
        public override function addChild(child:DisplayObject):DisplayObject {
            if(parent && child is IUIComponent) {
                // AND check for 'is' UIUComponent...
                return parent.addChild(child);
            }
            else {
                return super.addChild(child);
            }
        }
    
        public override function removeChild(child:DisplayObject):DisplayObject {
            if(child is IUIComponent) {
                return parent.removeChild(child);
            }
            else {
                return super.removeChild(child);
            }
        }
    }
}