comparison 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
comparison
equal deleted inserted replaced
731:65134dd772fc 732:3a0b9700b3d2
1 package asunit.textui {
2 import flash.display.DisplayObject;
3 import flash.events.Event;
4 import mx.core.IUIComponent;
5 import asunit.textui.TestRunner;
6
7 /**
8 * @private
9 **/
10 public class FlexTestRunner extends TestRunner {
11
12 public function FlexTestRunner() {
13 setPrinter(new ResultPrinter());
14 }
15
16 protected override function addedHandler(event:Event):void {
17 if(event.target === this) {
18 parent.addEventListener(Event.RESIZE, resizeHandler);
19 resizeHandler(new Event(Event.RESIZE));
20 }
21 else {
22 event.stopPropagation();
23 }
24 }
25
26 public override function set width(w:Number):void {
27 fPrinter.width = w;
28 }
29
30 public override function set height(h:Number):void {
31 fPrinter.height = h;
32 }
33
34 public function resizeHandler(event:Event):void {
35 width = parent.width;
36 height = parent.height;
37 }
38
39 public override function addChild(child:DisplayObject):DisplayObject {
40 if(parent && child is IUIComponent) {
41 // AND check for 'is' UIUComponent...
42 return parent.addChild(child);
43 }
44 else {
45 return super.addChild(child);
46 }
47 }
48
49 public override function removeChild(child:DisplayObject):DisplayObject {
50 if(child is IUIComponent) {
51 return parent.removeChild(child);
52 }
53 else {
54 return super.removeChild(child);
55 }
56 }
57 }
58 }