incubator-flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject svn commit: r1333232 [16/34] - in /incubator/flex/trunk: ./ frameworks/tests/ frameworks/tests/basicTests/ frameworks/tests/basicTests/dmv/ frameworks/tests/basicTests/dmv/scripts/ frameworks/tests/basicTests/dmv/views/ frameworks/tests/basicTests/fxg/...
Date Wed, 02 May 2012 22:45:08 GMT
Added: incubator/flex/trunk/mustella/as3/src/mustella/IncludeFileLocation.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/as3/src/mustella/IncludeFileLocation.as?rev=1333232&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/as3/src/mustella/IncludeFileLocation.as (added)
+++ incubator/flex/trunk/mustella/as3/src/mustella/IncludeFileLocation.as Wed May  2 22:44:38 2012
@@ -0,0 +1,97 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package {
+
+import flash.display.DisplayObject;
+import flash.net.URLLoader;
+import flash.net.URLRequest;
+import flash.events.Event;
+import flash.system.Capabilities;
+
+[Mixin]
+/**
+ *  A hash table of tests not to run, read from IncludeList.txt
+ *  The file is one test per line of the form ScriptName$TestID
+ *  The location of the file is assumed to be c:/tmp on windows, 
+ *  or /tmp on Unix
+ */
+public class IncludeFileLocation
+{
+
+	private static var loader:URLLoader;
+
+	/**
+	 * tell UnitTester it should wait for this load to complete
+	 */
+	UnitTester.waitForIncludes = true;
+
+	/**
+	 *  Mixin callback that gets everything ready to go.
+	 *  Table is of form: ScriptName$TestID: 1,
+	 */
+	public static function init(root:DisplayObject):void
+	{
+
+
+		var currentOS:String = Capabilities.os;
+
+		var useFile:String;
+
+		if (currentOS.indexOf ("Windows") != -1)
+		{
+			useFile = "c:/tmp/IncludeList.txt";	
+		} else { 
+
+			useFile = "/tmp/IncludeList.txt";	
+
+		}
+
+
+		var req:URLRequest = new URLRequest(useFile);
+		loader = new URLLoader();
+		loader.addEventListener("complete", completeHandler);
+		loader.load(req);
+
+	}
+
+	private static function completeHandler(event:Event):void
+	{
+		var data:String = loader.data;
+		// DOS end of line
+		var delimiter:RegExp = new RegExp("\r\n", "g");
+		data = data.replace(delimiter, ",");
+		// Unix end of line
+		delimiter = new RegExp("\n", "g");
+		data = data.replace(delimiter, ",");
+
+		UnitTester.includeList = new Object();
+		var items:Array = data.split(",");
+		var n:int = items.length;
+		for (var i:int = 0; i < n; i++)
+		{
+			var s:String = items[i];
+			if (s.length)
+				UnitTester.includeList[s] = 1;
+		}
+		UnitTester.waitForIncludes = false;
+		UnitTester.pre_startEventHandler(event);
+	}
+}
+
+}

Propchange: incubator/flex/trunk/mustella/as3/src/mustella/IncludeFileLocation.as
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/trunk/mustella/as3/src/mustella/IncludeList.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/as3/src/mustella/IncludeList.as?rev=1333232&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/as3/src/mustella/IncludeList.as (added)
+++ incubator/flex/trunk/mustella/as3/src/mustella/IncludeList.as Wed May  2 22:44:38 2012
@@ -0,0 +1,45 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package {
+
+import flash.display.DisplayObject;
+
+[Mixin]
+/**
+ *  A hash table of tests not to run.
+ */
+public class IncludeList 
+{
+
+	/**
+	 *  Mixin callback that gets everything ready to go.
+	 *  Table is of form: ScriptName$TestID: 1,
+	 */
+	public static function init(root:DisplayObject):void
+	{
+		UnitTester.includeList = {
+			CBTester: 1,
+			CBTester$myButtonTest1: 1,
+			CBTester$myTest2: 1
+		};
+	}
+
+}
+
+}

Propchange: incubator/flex/trunk/mustella/as3/src/mustella/IncludeList.as
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/trunk/mustella/as3/src/mustella/IncludeList.txt
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/as3/src/mustella/IncludeList.txt?rev=1333232&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/as3/src/mustella/IncludeList.txt (added)
+++ incubator/flex/trunk/mustella/as3/src/mustella/IncludeList.txt Wed May  2 22:44:38 2012
@@ -0,0 +1 @@
+CBTester$myButtonTest1
\ No newline at end of file

Propchange: incubator/flex/trunk/mustella/as3/src/mustella/IncludeList.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/trunk/mustella/as3/src/mustella/IncludeListTextFile.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/as3/src/mustella/IncludeListTextFile.as?rev=1333232&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/as3/src/mustella/IncludeListTextFile.as (added)
+++ incubator/flex/trunk/mustella/as3/src/mustella/IncludeListTextFile.as Wed May  2 22:44:38 2012
@@ -0,0 +1,71 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package {
+
+import flash.display.DisplayObject;
+import flash.net.URLLoader;
+import flash.net.URLRequest;
+import flash.events.Event;
+
+[Mixin]
+/**
+ *  A hash table of tests not to run, read from IncludeList.txt
+ *  The file is one test per line of the form ScriptName$TestID
+ */
+public class IncludeListTextFile
+{
+
+	private static var loader:URLLoader;
+
+	/**
+	 *  Mixin callback that gets everything ready to go.
+	 *  Table is of form: ScriptName$TestID: 1,
+	 */
+	public static function init(root:DisplayObject):void
+	{
+		var req:URLRequest = new URLRequest("IncludeList.txt");
+		loader = new URLLoader();
+		loader.addEventListener("complete", completeHandler);
+		loader.load(req);
+
+	}
+
+	private static function completeHandler(event:Event):void
+	{
+		var data:String = loader.data;
+		// DOS end of line
+		var delimiter:RegExp = new RegExp("\r\n", "g");
+		data = data.replace(delimiter, ",");
+		// Unix end of line
+		delimiter = new RegExp("\n", "g");
+		data = data.replace(delimiter, ",");
+
+		UnitTester.includeList = new Object();
+		var items:Array = data.split(",");
+		var n:int = items.length;
+		for (var i:int = 0; i < n; i++)
+		{
+			var s:String = items[i];
+			if (s.length)
+				UnitTester.includeList[s] = 1;
+		}
+	}
+}
+
+}

Propchange: incubator/flex/trunk/mustella/as3/src/mustella/IncludeListTextFile.as
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/trunk/mustella/as3/src/mustella/MouseSnifferRemote.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/as3/src/mustella/MouseSnifferRemote.as?rev=1333232&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/as3/src/mustella/MouseSnifferRemote.as (added)
+++ incubator/flex/trunk/mustella/as3/src/mustella/MouseSnifferRemote.as Wed May  2 22:44:38 2012
@@ -0,0 +1,282 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package 
+{
+import flash.display.DisplayObject;
+import flash.events.Event;
+import flash.events.FocusEvent;
+import flash.events.KeyboardEvent;
+import flash.events.MouseEvent;
+import flash.events.StatusEvent;
+import flash.geom.Point;
+import flash.net.LocalConnection;
+import flash.utils.describeType;
+import flash.utils.getQualifiedClassName;
+
+import mx.core.IDeferredInstantiationUIComponent;
+import mx.core.IUIComponent;
+import mx.managers.SystemManager;
+
+import mx.core.mx_internal;
+use namespace mx_internal;
+
+[Mixin]
+/**
+ *  Tries to show location and target path of mouse
+ */
+public class MouseSnifferRemote
+{
+	public function MouseSnifferRemote()
+	{
+	}
+
+	public static function init(root:Object):void
+	{
+		document = root;
+  		connection = new LocalConnection();
+		connection.allowDomain("*");
+  		connection.addEventListener(StatusEvent.STATUS, statusHandler);
+
+        // Turn on only if the SnifferRemoteClient app's checkbox
+        // for this item is checked.
+        connection.send("_MouseSniffer", "toggleSniffersEnabled");
+
+		mousecommandconnection = new LocalConnection();
+		mousecommandconnection.allowDomain("*");
+		mousecommandconnection.client = MouseSnifferRemote;
+		mousecommandconnection.connect("_MouseSnifferCommands");
+	}
+
+	private static function statusHandler(event:Event):void
+	{
+	}
+
+    /**
+     *  @private
+	 *  The document containing a reference to this object
+     */
+    private static var document:Object;
+
+    /**
+     *  @private
+	 *  The local connection to the remote client
+     */
+    private static var connection:LocalConnection;
+    private static var mousecommandconnection:LocalConnection;
+
+	public static function enableSniffer():void
+	{
+        //trace("MouseSnifferRemote enabled");	    
+
+		document.stage.addEventListener(MouseEvent.CLICK, uberListener, true);
+		document.stage.addEventListener(MouseEvent.DOUBLE_CLICK, uberListener, true);
+		document.stage.addEventListener(MouseEvent.MOUSE_DOWN, uberListener, true);
+		document.stage.addEventListener(MouseEvent.MOUSE_MOVE, uberListener, true);
+		document.stage.addEventListener(MouseEvent.MOUSE_OUT, uberListener, true);
+		document.stage.addEventListener(MouseEvent.MOUSE_OVER, uberListener, true);
+		document.stage.addEventListener(MouseEvent.MOUSE_UP, uberListener, true);
+		document.stage.addEventListener(MouseEvent.MOUSE_WHEEL, uberListener, true);
+		document.stage.addEventListener(MouseEvent.ROLL_OUT, uberListener, true);
+		document.stage.addEventListener(MouseEvent.ROLL_OVER, uberListener, true);
+	}
+
+	public static function disableSniffer():void
+	{
+        //trace("MouseSnifferRemote disabled");	    
+        
+		document.stage.removeEventListener(MouseEvent.CLICK, uberListener, true);
+		document.stage.removeEventListener(MouseEvent.DOUBLE_CLICK, uberListener, true);
+		document.stage.removeEventListener(MouseEvent.MOUSE_DOWN, uberListener, true);
+		document.stage.removeEventListener(MouseEvent.MOUSE_MOVE, uberListener, true);
+		document.stage.removeEventListener(MouseEvent.MOUSE_OUT, uberListener, true);
+		document.stage.removeEventListener(MouseEvent.MOUSE_OVER, uberListener, true);
+		document.stage.removeEventListener(MouseEvent.MOUSE_UP, uberListener, true);
+		document.stage.removeEventListener(MouseEvent.MOUSE_WHEEL, uberListener, true);
+		document.stage.removeEventListener(MouseEvent.ROLL_OUT, uberListener, true);
+		document.stage.removeEventListener(MouseEvent.ROLL_OVER, uberListener, true);
+	}
+
+	public static var propLists:Object = new Object();
+
+	private static function uberListener(event:MouseEvent):void
+	{
+		var target:String = findPath(event.target);
+		var pt:Point = new Point(event.stageX, event.stageY);
+		var obj:Object = document.document;
+		var s:String = target;
+		var dot:int = s.indexOf(".");
+  	    var info:Object = new Object();
+
+		if (dot != -1)
+		{
+			var pieces:Array = s.split(".");
+			for (var i:int = 0; i < pieces.length; i++)
+			{
+				s = pieces[i];
+				if (s != null && s.indexOf("getChildAt(") == 0)
+				{
+					s = s.substring(11);
+					s = s.substring(0, s.length - 1);
+					obj = obj.getChildAt(parseInt(s));
+				}
+				else
+				{
+					if (obj!=null && s != null && s in obj)
+						obj = obj[s];
+					else
+					{
+						// couldn't find the piece so document chain is broken.
+						// Containers as item renderers break this
+						target = "";
+						for (var j:int = 0; j < i; j++)
+						{
+							target += pieces[j];
+							if (j < i - 1)
+								target += "."
+						}
+						break;
+					}
+				}
+			}
+		}
+		else if (s.length && s.indexOf(" ") == -1)
+			obj = obj[s];
+
+		if (obj != null)
+			pt = obj.globalToLocal(pt);
+
+		if (target == null || target == ""){
+			//connection.send("_MouseSniffer", "appendLog", "Mouse", "stage: " + pt.x + "," + pt.y + "  stage: " + event.stageX + "," + event.stageY);
+
+    	    info.dataSource = "Mouse";
+    	    info.target = "stage: " + pt.x + "," + pt.y + "  stage: " + event.stageX + "," + event.stageY;
+    	    info.eventName = "";
+    	    info.event = "";
+
+    	    connection.send("_MouseSniffer", "appendLog", info);
+			
+		}else{
+			//connection.send("_MouseSniffer", "appendLog", "Mouse", target + " " + pt.x + "," + pt.y + "   stage: " + event.stageX + "," + event.stageY);
+    	    info.dataSource = "Mouse";
+    	    info.target = target + " " + pt.x + "," + pt.y + "   stage: " + event.stageX + "," + event.stageY;
+    	    info.eventName = "";
+    	    info.event = "";
+
+    	    connection.send("_MouseSniffer", "appendLog", info);
+
+		}
+	}
+
+	private static function findPath(target:Object, name:String = ""):String
+	{
+		var s:String = target.toString();
+		var dot:int = s.indexOf(".");
+		if (dot == -1)
+		{
+			if (target == document.document || target.parent == document.document)
+				return name;
+		}
+
+		while (target)
+		{
+			if (target is IDeferredInstantiationUIComponent)
+			{
+				var targetName:String = target.id;
+				// id of component in document
+				if (target.id && target.id in target.document)
+				{
+					if (target.document[target.id] is Array)
+					{
+						var arr:Array = target.document[target.id];
+						for (var i:int = 0; i < arr.length; i++)
+						{
+							if (arr[i] == target)
+							{
+								targetName += "." + i;
+								break;
+							}
+						}
+					}
+
+					name = (name == "") ? targetName : targetName + "." + name;
+					return findPath(target.document, name);
+				}
+				// MXML component has id in parent document
+				if (target.id && target.document == target)
+				{
+					name = (name == "") ? target.id : target.id + "." + name;
+					return findPath(target.parent.document, name);
+				}
+			}
+			if (target.parent == document.document)
+				break;
+
+			if (target.parent is SystemManager)
+			{
+				// must be a popup
+				if (target is IUIComponent)
+				{
+					s = findPropertyInOwner(target)
+					if (s)
+					{
+						name = (name == "") ? s : s + "." + name;
+						target = target.owner;
+						continue;
+					}
+				}
+
+				var index:int = document.document.systemManager.rawChildren.getChildIndex(target as DisplayObject);
+				s = "systemManager.rawChildren.getChildAt(" + index + ")";
+				name = (name == "") ? s : s + "." + name;
+				return name;
+			}
+			target = target.parent;
+		}
+		return "no component with id under mouse";
+
+	}
+
+	private static function findPropertyInOwner(target:Object):String
+	{
+		var owner:Object = target.owner;
+		var className:String = getQualifiedClassName(owner);
+		var propList:XMLList = propLists[className];
+		if (!propList)
+		{
+			var dt:XML = describeType(owner);
+			propList = dt..accessor.(@type != "Number" && @type != "String" && @type != "int" && @type != "Boolean"
+					&& @type != "Array" && @type != "Object" && @type != "Class" && @access != "writeonly") +
+					dt..variable.(@type != "Number" && @type != "String" && @type != "int" && @type != "Boolean"
+					&& @type != "Array" && @type != "Object" && @type != "Class");
+			propLists[className] = propList;
+		}
+		var n:int = propList.length();
+		for (var i:int = 0; i < n; i++)
+		{
+			var propName:String = propList[i].@name.toString();
+			if (owner[propName] == target)
+				return propName;
+		}
+		return null;
+	}
+
+
+}
+
+}

Propchange: incubator/flex/trunk/mustella/as3/src/mustella/MouseSnifferRemote.as
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/trunk/mustella/as3/src/mustella/MultiResult.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/as3/src/mustella/MultiResult.as?rev=1333232&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/as3/src/mustella/MultiResult.as (added)
+++ incubator/flex/trunk/mustella/as3/src/mustella/MultiResult.as Wed May  2 22:44:38 2012
@@ -0,0 +1,188 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package
+{
+
+	import flash.display.*;
+	import mx.core.FlexGlobals;
+	import mx.core.mx_internal;
+	
+	use namespace mx_internal;
+	
+	[DefaultProperty("conditionalValues")]	
+	public class MultiResult
+	{
+		private var conditionalValues:Vector.<ConditionalValue>;
+
+		public function MultiResult(){
+		}
+
+		/**
+		 *  Loop through the conditional values and process the ones which apply to our configuration.
+		 *  Functionally, it should work like this:
+		 *	1) Any number of mismatches will case a CV to be ignored.
+		 *	2) Empty CVs will be ignored.
+		 *  3) Among device matches, pick the best.
+		 *  4) If no match yet, among the remaining, pick the one with the most matches.
+		 *  5) If no match yet, the TestStep's is used.
+		 *
+		 * Called by determineResult() and CompareBitmap's execute().
+  		 **/
+		public function chooseCV(conditionalValues:Vector.<ConditionalValue>):ConditionalValue{
+			var i:int;
+			var cv:ConditionalValue;
+			//var cvToUse:ConditionalValue = null;
+			var cvUT:ConditionalValue = UnitTester.cv;
+			
+			var bestDeviceMatch:ConditionalValue = null;
+			var bestNonDeviceMatch:ConditionalValue = null;
+			
+			var bestDeviceMatchCount:int = 0;		// # matches for the best match, among device matches
+			var bestNonDeviceMatchCount:int = 0;	// # matches for the best match
+			var numMatches:int = 0;
+			
+			// When running mobile on desktop, set some items in UnitTester's CV later
+			if( cvUT.deviceWidth == -1 ){
+				cvUT.deviceWidth = FlexGlobals.topLevelApplication.width;
+			}
+
+			if( cvUT.deviceHeight == -1 ){
+				cvUT.deviceHeight = FlexGlobals.topLevelApplication.height;
+			}
+
+			//trace("MultiResult.chooseCV(): Actual test environment is: \n" + cvUT.toString());
+			
+			for(i = 0; i < conditionalValues.length; ++i){
+				cv = conditionalValues[ i ];
+				
+				// This is an empty one; ignore it.
+				if( cv.isDefault() ){
+					continue;
+				}
+				
+				numMatches = countMatches( cv, cvUT );
+				
+				if( numMatches <= 0 ) // -1 is a mismatch, and 0 is no matches.
+					continue;	
+				
+				if( cv.device && cvUT.device && (cv.device == cvUT.device) ){
+					
+					if( numMatches > bestDeviceMatchCount ){
+						bestDeviceMatchCount = numMatches;
+						bestDeviceMatch = cv;
+					}
+				}else{
+					
+					if( numMatches > bestNonDeviceMatchCount ){
+						bestNonDeviceMatchCount = numMatches;
+						bestNonDeviceMatch = cv;
+					}
+				}
+			}
+
+			/**
+				if( bestDeviceMatch != null )
+					trace("MultiResult.chooseCV(): bestDeviceMatch:\n" + bestDeviceMatch.toString());
+				else
+					trace("MultiResult.chooseCV(): bestDeviceMatch: null");
+
+				if( bestNonDeviceMatch != null )				
+					trace("MultiResult.chooseCV(): bestNonDeviceMatch:\n" + bestNonDeviceMatch.toString());
+				else
+					trace("MultiResult.chooseCV(): bestNonDeviceMatch: null");
+			**/	
+				
+			if( bestDeviceMatch != null )
+				return bestDeviceMatch;
+			else if( bestNonDeviceMatch != null )
+				return bestNonDeviceMatch;
+			else
+				return null;
+		}
+		
+		
+		/**
+		* Count the matches between two CVs.
+		* If a value is unset in either, it's not a match or a mismatch.
+		* Returns 0 if no matches.
+		* Returns -1 immediately if a mismatch occurs.
+		**/
+		private function countMatches( cv1:ConditionalValue, cv2:ConditionalValue ):int{
+			var ret:int = 0;
+			
+			if( (cv1.os != null) && (cv2.os != null) ){
+				if( cv1.os != cv2.os )
+					return -1;
+				else
+					++ret;
+			}
+
+			if( (cv1.osVersion != null) && (cv2.osVersion != null) ){
+				if( cv1.osVersion != cv2.osVersion )
+					return -1;
+				else
+					++ret;
+			}
+
+			if( (cv1.screenDPI > -1) && (cv2.screenDPI > -1) ){
+				if( cv1.screenDPI != cv2.screenDPI )
+					return -1;
+				else
+					++ret;
+			}
+
+			if( (cv1.deviceDensity > -1) && (cv2.deviceDensity > -1) ){
+				if( cv1.deviceDensity != cv2.deviceDensity )
+					return -1;
+				else
+					++ret;
+			}
+
+			if( (cv1.deviceWidth > -1) && (cv2.deviceWidth > -1) ){
+				if( cv1.deviceWidth != cv2.deviceWidth )
+					return -1;
+				else
+					++ret;
+			}
+
+			if( (cv1.deviceHeight > -1) && (cv2.deviceHeight > -1) ){
+				if( cv1.deviceHeight != cv2.deviceHeight )
+					return -1;
+				else
+					++ret;
+			}
+
+			if( (cv1.color > -1) && (cv2.color > -1) ){
+				if( cv1.color != cv2.color )
+					return -1;
+				else
+					++ret;
+			}
+
+			if( (cv1.device != null) && (cv2.device != null) ){
+				if( cv1.device != cv2.device )
+					return -1;
+				else
+					++ret;
+			}
+
+			return ret;
+		}
+	}
+}
\ No newline at end of file

Propchange: incubator/flex/trunk/mustella/as3/src/mustella/MultiResult.as
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/trunk/mustella/as3/src/mustella/MustellaLogEvent.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/as3/src/mustella/MustellaLogEvent.as?rev=1333232&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/as3/src/mustella/MustellaLogEvent.as (added)
+++ incubator/flex/trunk/mustella/as3/src/mustella/MustellaLogEvent.as Wed May  2 22:44:38 2012
@@ -0,0 +1,44 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package {
+
+import flash.events.Event;
+
+/**
+ *  The event passed into any code being
+ *  run in a RunCode step.  It supplies
+ *  some useful references
+ */
+public class MustellaLogEvent extends Event
+{
+	public function MustellaLogEvent (type:String, msg:String)
+	{
+		super(type);
+		this.msg = msg;
+	}
+
+	/**
+	 *  The msg to be logged
+	 */
+	public var msg:String;
+
+
+}
+
+}

Propchange: incubator/flex/trunk/mustella/as3/src/mustella/MustellaLogEvent.as
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/trunk/mustella/as3/src/mustella/MustellaPNGEncoder.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/as3/src/mustella/MustellaPNGEncoder.as?rev=1333232&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/as3/src/mustella/MustellaPNGEncoder.as (added)
+++ incubator/flex/trunk/mustella/as3/src/mustella/MustellaPNGEncoder.as Wed May  2 22:44:38 2012
@@ -0,0 +1,183 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * writes bitmaps into PNG format. 
+ * original author, Ely
+ */
+package  {
+
+	import flash.display.*;
+	import flash.geom.*;
+	import flash.utils.*;
+	import flash.net.*;
+	
+public class MustellaPNGEncoder {
+	
+	
+	private var _png:ByteArray;
+
+	// empty constructor
+	public function MustellaPNGEncoder () { 
+	}
+	
+	public function encode(img:BitmapData):ByteArray
+	{
+		var imgWidth:uint = img.width;
+		var imgHeight:uint = img.height;
+
+		var imgData:ByteArray = img.getPixels(new Rectangle(0,0,imgWidth,imgHeight));
+				
+		_png = new ByteArray();
+		
+		_png.writeByte(137);
+		_png.writeByte(80);
+		_png.writeByte(78);
+		_png.writeByte(71);
+		_png.writeByte(13);
+		_png.writeByte(10);
+		_png.writeByte(26);
+		_png.writeByte(10);
+		
+		var IHDR:ByteArray = new ByteArray();
+		IHDR.writeInt(imgWidth);
+		IHDR.writeInt(imgHeight);
+		IHDR.writeByte(8); // color depth: 8 bpp
+		IHDR.writeByte(6); // color type: RGBA
+		IHDR.writeByte(0); // compression: ZLIB
+		IHDR.writeByte(0); // filter method
+		IHDR.writeByte(0); // not interlaced;
+		
+		writeChunk([0x49,0x48,0x44,0x52],IHDR);
+		
+		var IDAT:ByteArray= new ByteArray();
+		for(var i:uint=0;i<imgHeight;i++) {
+			IDAT.writeByte(0);
+			for(var j:uint=0;j<imgWidth;j++) {
+				var p:uint = img.getPixel32(j,i);
+				IDAT.writeByte((p>>16)&0xFF);
+				IDAT.writeByte((p>> 8)&0xFF);
+				IDAT.writeByte((p    )&0xFF);
+				IDAT.writeByte((p>>24)&0xFF);
+			}
+		}		
+		
+		IDAT.compress();
+		writeChunk([0x49,0x44,0x41,0x54],IDAT);
+
+
+
+		writeChunk([0x49,0x45,0x4E,0x44],null);
+		return _png;
+	}
+
+	public function dump():String
+	{
+		_png.position = 0;
+		var out:String ="";
+		for(var i:uint=0;i<_png.length;i++) {
+			var code:String = "0123456789abcdef";
+			var v:uint = _png.readUnsignedByte();
+			out += code.charAt((v & 0xF0) >> 4);
+			out += code.charAt(v & 0xF);
+			out += " ";
+		}
+		return out;
+	}
+	private function writeChunk(type:Array,data:ByteArray):void
+	{
+		var len:uint = 0;
+		if(data != null)
+			len = data.length; // data length
+		_png.writeUnsignedInt(len);
+
+		var p:uint = _png.position;
+
+		_png.writeByte(type[0]);
+		_png.writeByte(type[1]);
+		_png.writeByte(type[2]);
+		_png.writeByte(type[3]);
+		if(data != null)
+			_png.writeBytes(data);
+		
+		var endP:uint = _png.position;
+		_png.position = p;
+		var c:uint = crc(_png,endP-p);
+		_png.position = endP;
+		_png.writeUnsignedInt(c);
+	}
+
+   /* Table of CRCs of all 8-bit messages. */
+   private static var crc_table:Array;
+   
+   /* Flag: has the table been computed? Initially false. */
+   private static var crc_table_computed:Boolean = false;
+   
+   /* Make the table for a fast CRC. */
+   private function make_crc_table():void
+   {
+     var c:uint;
+     var n:int;
+     var k:int;
+   
+   	 crc_table = [];
+   	 
+     for (n = 0; n < 256; n++) {
+       c = n;
+       for (k = 0; k < 8; k++) {
+         if (c & 1)
+           c = uint(uint(0xedb88320) ^ uint(c >>> 1));
+         else
+           c = uint(c >>> 1);
+       }
+       crc_table[n] = c;
+     }
+     crc_table_computed = true;
+   }
+   
+   /* Update a running CRC with the bytes buf[0..len-1]--the CRC
+      should be initialized to all 1's, and the transmitted value
+      is the 1's complement of the final running CRC (see the
+      crc() routine below)). */
+   
+   private function update_crc(crc:uint, buf:ByteArray,
+                            len:uint):uint
+   {
+     var c:uint = crc;
+     var n:int;
+	var v:uint;
+	   
+     if (!crc_table_computed)
+       make_crc_table();
+     for (n = 0; n < len; n++) {
+     	v = buf.readUnsignedByte();
+       c = uint(crc_table[(c ^ v) & uint(0xff)] ^ uint(c >>> 8));
+     }
+     return c;
+   }
+   
+   /* Return the CRC of the bytes buf[0..len-1]. */
+   private function crc(buf:ByteArray, len:uint):uint
+   {
+     var cc:uint = update_crc(uint(0xffffffff), buf, len);
+     return uint(cc ^ uint(0xffffffff));
+   }	
+	
+}
+}

Propchange: incubator/flex/trunk/mustella/as3/src/mustella/MustellaPNGEncoder.as
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/trunk/mustella/as3/src/mustella/MustellaRealTimeLogger.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/as3/src/mustella/MustellaRealTimeLogger.as?rev=1333232&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/as3/src/mustella/MustellaRealTimeLogger.as (added)
+++ incubator/flex/trunk/mustella/as3/src/mustella/MustellaRealTimeLogger.as Wed May  2 22:44:38 2012
@@ -0,0 +1,68 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package
+{
+	import flash.events.DataEvent;
+	import flash.net.XMLSocket;
+	
+	public class MustellaRealTimeLogger
+	{
+		private static var socketAvailable:Boolean = false;
+		private static var isInitialized:Boolean = false;
+        private static var xmlsock:XMLSocket = new XMLSocket();
+
+		public static function Init():void
+		{
+		    try
+		    {
+	            xmlsock.connect("127.0.0.1", 13000);
+	            //xmlsock.addEventListener(DataEvent.DATA, onData);
+
+    	        socketAvailable = true;
+    	        isInitialized = true;
+	        }
+	        catch(e:Error)
+	        { 
+	        } 
+		}
+
+        public function onData(event:DataEvent):void
+        {
+	        //indata.text = event.text;
+        }
+
+        public static function sendData(xmlFormattedData:String):void
+        { 
+    	    if(!isInitialized)
+    	    {
+    		    Init();	
+    	    } 
+        	
+    	    xmlsock.send(xmlFormattedData + "\n");
+        }
+        
+        public static function Close():void
+        {
+            if((socketAvailable) && (isInitialized))
+            {
+            	xmlsock.close();
+            }
+        }
+	}
+}
\ No newline at end of file

Propchange: incubator/flex/trunk/mustella/as3/src/mustella/MustellaRealTimeLogger.as
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/trunk/mustella/as3/src/mustella/MustellaSandboxEvent.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/as3/src/mustella/MustellaSandboxEvent.as?rev=1333232&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/as3/src/mustella/MustellaSandboxEvent.as (added)
+++ incubator/flex/trunk/mustella/as3/src/mustella/MustellaSandboxEvent.as Wed May  2 22:44:38 2012
@@ -0,0 +1,53 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package {
+
+import flash.events.Event;
+
+/**
+ *  An event used as a message passed across security domain boundaries
+ */
+public class MustellaSandboxEvent extends Event
+{
+	public static const MUSTELLA_STARTED:String = "mustellaStarted";
+	public static const STRING_TO_OBJECT:String = "stringToObject";
+	public static const GET_BITMAP:String = "getBitmap";
+	public static const GET_EFFECTS:String = "getEffects";
+	public static const GET_OBJECTS_UNDER_POINT:String = "getObjectsUnderPoint";
+	public static const RESET_COMPONENT:String = "resetComponent";
+	public static const MOUSEXY:String = "mouseXY";
+	public static const GET_FOCUS:String = "getFocus";
+	public static const APP_READY:String = "appReady";
+
+	/**
+	 *  
+	 */
+	public function MustellaSandboxEvent(type:String)
+	{
+		super(type);
+	}
+
+	// the string to be parsed and turned into an object
+	public var string:String;
+
+	// the object returned.
+	public var obj:Object;
+}
+
+}

Propchange: incubator/flex/trunk/mustella/as3/src/mustella/MustellaSandboxEvent.as
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/trunk/mustella/as3/src/mustella/NoFail.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/as3/src/mustella/NoFail.as?rev=1333232&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/as3/src/mustella/NoFail.as (added)
+++ incubator/flex/trunk/mustella/as3/src/mustella/NoFail.as Wed May  2 22:44:38 2012
@@ -0,0 +1,41 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package {
+
+import flash.display.DisplayObject;
+
+[Mixin]
+/**
+ *  Class to report no failures. 
+ *  allows tests to continue. Useful for bitmap replacement, etc
+ */
+public class NoFail
+{
+
+	/**
+	 *  Set a flag to ignore all failures (and don't report them)
+	 */
+	public static function init(root:DisplayObject):void
+	{
+		UnitTester.noFail = true;
+	}
+
+
+}
+}

Propchange: incubator/flex/trunk/mustella/as3/src/mustella/NoFail.as
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/trunk/mustella/as3/src/mustella/ObjectSnifferRemote.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/as3/src/mustella/ObjectSnifferRemote.as?rev=1333232&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/as3/src/mustella/ObjectSnifferRemote.as (added)
+++ incubator/flex/trunk/mustella/as3/src/mustella/ObjectSnifferRemote.as Wed May  2 22:44:38 2012
@@ -0,0 +1,333 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package
+{
+import flash.display.BitmapData;
+import flash.display.DisplayObject;
+import flash.events.Event;
+import flash.events.MouseEvent;
+import flash.events.StatusEvent;
+import flash.geom.Matrix;
+import flash.geom.Point;
+import flash.net.LocalConnection;
+import flash.utils.getQualifiedClassName;
+
+import mx.managers.IFocusManagerComponent;
+import mx.managers.SystemManager;
+import mx.core.FlexGlobals;
+import mx.core.IFlexDisplayObject;
+import mx.core.IMXMLObject;
+import mx.core.UIComponent;
+// import mx.core.Container;
+import mx.utils.ObjectUtil;
+
+import mx.core.mx_internal;
+use namespace mx_internal;
+
+[Mixin]
+/**
+ *  Displays object properties and values to SnifferRemoteClient
+ */
+public class ObjectSnifferRemote
+{
+	public function ObjectSnifferRemote()
+	{
+	}
+
+	public static function init(root:Object):void
+	{
+
+		_root = document = root;
+		if (document)
+			document.addEventListener("applicationComplete", initHandler);
+		connection = new LocalConnection();
+		connection.allowDomain("*");
+		connection.addEventListener(StatusEvent.STATUS, statusHandler);
+
+		commandconnection = new LocalConnection();
+		commandconnection.allowDomain("*");
+		commandconnection.client = ObjectSnifferRemote;
+		commandconnection.connect("_ObjectSnifferCommands");
+	}
+
+	private static function initHandler(event:Event):void
+	{
+		//enableSniffer();
+	}
+
+	private static function statusHandler(event:Event):void
+	{
+	}
+
+    /**
+     *  @private
+	 *  The document containing a reference to this object
+     */
+    private static var document:Object;
+	private static var _root:Object;
+
+    /**
+     *  @private
+	 *  The local connection to the remote client
+     */
+    private static var connection:LocalConnection;
+    private static var commandconnection:LocalConnection;
+
+	private static var snifferEnabled:Boolean = true;
+
+	public static function enableSniffer():void
+	{
+		snifferEnabled = true;
+	}
+
+	public static function disableSniffer():void
+	{
+		snifferEnabled = false;
+	}
+
+	private static function appendLog(s:String):void
+	{
+		//connection.send("_ObjectSniffer", "appendLog", "Object", s);
+
+	    var info:Object = new Object();
+	    
+        info.dataSource = "Object";
+        info.target = s;
+        info.eventName = "";
+        info.event = "";
+
+        /**        
+        trace("ObjectSniffer is sending: ");
+        trace ("    info.dataSource: " + info.dataSource);
+        trace ("    info.target: " + info.target);
+        trace ("    info.eventName: " + info.eventName);
+        trace ("    info.event: " + info.event);
+        **/
+        
+        connection.send("_ObjectSniffer", "appendLog", info);
+	}
+
+	public static function dumpObject(s:String):void
+	{
+		if (!snifferEnabled)
+			return;
+
+		var obj:* = stringToObject(s);
+		if (obj === null)
+		{
+			appendLog(s + " = null");
+		}
+		else if (obj === undefined)
+		{
+			appendLog(s + " = undefined");
+		}
+		else if (obj is String)
+		{
+			appendLog(s + " = " + obj);
+		}
+		else if (obj is Boolean)
+		{
+			appendLog(s + " = " + obj.toString());
+		}
+		else if (obj is uint)
+		{
+			appendLog(s + " = " + obj.toString(10) + " (0x" + obj.toString(16).toUpperCase() + ")");
+		}
+		else if (obj is Number)
+		{
+			appendLog(s + " = " + obj.toString());
+		}
+		else if (obj is XML || obj is XMLList)
+		{
+			if (obj is XMLList && obj.length() == 1)
+				appendLog(s + " = " + obj.toString());
+			else if (obj is XMLList && obj.length() == 0)
+				appendLog(s + " not found");
+			else
+				appendLog(s + " = " + obj.toXMLString());
+		}
+		else if (obj is Array)
+		{
+			appendLog(s + " = Array");
+		}
+		else appendLog(s + " = " + getQualifiedClassName(obj));
+	}
+
+	public static function listProperties(s:String):void
+	{
+		document.document.callLater(listProperties_cb, [s]);
+	}
+
+	public static function listProperties_cb(s:String):void
+	{
+		if (!snifferEnabled)
+			return;
+
+		var n:int;
+		var i:int;
+
+		var obj:* = stringToObject(s);
+		if (obj === null)
+		{
+			appendLog(s + " is null, has no properties");
+		}
+		else if (obj === undefined)
+		{
+			appendLog(s + " is undefined, has no properties");
+		}
+		else if (obj is String)
+		{
+			appendLog(s + " is String, has no properties");
+		}
+		else if (obj is uint)
+		{
+			appendLog(s + " is uint, has no properties");
+		}
+		else if (obj is uint)
+		{
+			appendLog(s + " is int, has no properties");
+		}
+		else if (obj is Number)
+		{
+			appendLog(s + " is Number, has no properties");
+		}
+		else if (obj is XML)
+		{
+			appendLog(s);
+			appendLog("  attributes:");
+			var attrs:XMLList = obj.attributes();
+			n = attrs.length();
+			for (i = 0; i < n; i++)
+			{
+				appendLog("    " + attrs[i].name());
+			}
+			var children:XMLList = obj.children();
+			n = children.length();
+			var namesTable:Object = {};
+			for (i = 0; i < n; i++)
+			{
+				namesTable[children[i].name()] = 1;
+			}
+			appendLog("  children:");
+			for (var p:String in namesTable)
+				appendLog("    " + p);
+		}
+		else if (obj is Array)
+		{
+			appendLog(s + " is Array of length " + obj.length);
+		}
+		else 
+		{
+			var info:Object = ObjectUtil.getClassInfo(obj, null, { includeReadOnly: true, includeTransient: true, uris: ["", "mx_internal"] } );
+			appendLog(s + " = " + info.name);
+			n = info.properties.length;
+			for (i = 0; i < n; i++)
+				appendLog("  " + info.properties[i]);
+		}
+
+	}
+
+	/**
+	 *  direct copy of UnitTester's stringToObject, except that it doesn't handle "script"
+	 *  take an expression, find the object.
+	 *  handles mx_internal:propName
+	 *  a.b.c
+	 *  getChildAt()
+	 */
+	public static function stringToObject(s:*):*
+	{
+		if (s == null || s == "")
+			return _root["document"];
+
+		try
+		{
+			var propName:* = s;
+			if (s.indexOf("mx_internal:") == 0)
+				propName = new QName("mx_internal", s.substring(12));
+			if (s.indexOf("getChildAt(") == 0 && s.indexOf(".") == -1)
+			{
+				s = s.substring(11);
+				s = s.substring(0, s.indexOf(")"));
+				return _root["document"].getChildAt(parseInt(s));
+			}
+			return _root["document"][propName];
+		}
+		catch (e:Error)
+		{
+			// maybe it is a class
+			var dot:int;
+			var cc:int = s.indexOf("::");
+			var className:String = s;
+			var obj:Object = _root["document"];
+			if (cc > 0)
+			{
+				dot = s.indexOf(".", cc);
+				if (dot >= 0)
+				{
+					className = s.substring(0, dot);
+					s = s.substring(dot + 1);
+				}
+				else
+					s = "";
+			}
+			else
+				dot = s.indexOf(".");
+
+			try
+			{
+				obj = _root["info"]().currentDomain.getDefinition(className);		
+			}
+			catch (e:Error)
+			{
+				if (dot == -1)
+					return undefined;
+			}
+			if (dot == -1)
+				return obj;
+
+			var list:Array = s.split(".");
+			while (list.length)
+			{
+				try 
+				{
+					s = list.shift();
+					if (s.indexOf("mx_internal:") == 0)
+						s = new QName(mx_internal, s.substring(12));
+					if (s is String && s.indexOf("getChildAt(") == 0)
+					{
+						s = s.substring(11);
+						s = s.substring(0, s.indexOf(")"));
+						obj = obj.getChildAt(parseInt(s));
+					}
+					else
+						obj = obj[s];
+				}
+				catch (e:Error)
+				{
+					return undefined;
+				}
+			}
+			return obj;
+		}
+		return null;
+	}
+
+}
+
+}

Propchange: incubator/flex/trunk/mustella/as3/src/mustella/ObjectSnifferRemote.as
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/trunk/mustella/as3/src/mustella/Pause.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/as3/src/mustella/Pause.as?rev=1333232&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/as3/src/mustella/Pause.as (added)
+++ incubator/flex/trunk/mustella/as3/src/mustella/Pause.as Wed May  2 22:44:38 2012
@@ -0,0 +1,66 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package {
+
+import flash.display.DisplayObject;
+import flash.utils.setTimeout;
+
+import mx.core.mx_internal;
+use namespace mx_internal;
+
+/**
+ *  The test step that sets a property to some value
+ *  MXML attributes:
+ *  
+ *  waitTarget (optional)
+ *  waitEvent (optional)
+ *  timeout 
+ */
+public class Pause extends TestStep
+{
+    public var reason:String;
+    
+	override public function execute(root:DisplayObject, context:UnitTester, testCase:TestCase, testResult:TestResult):Boolean
+	{
+		this.root = root;
+		this.context = context;
+		this.testCase = testCase;
+		this.testResult = testResult;
+
+		setTimeout(stepComplete, timeout);
+		TestOutput.logResult(this.toString());
+
+		return false;
+	}
+
+	/**
+	 *  customize string representation
+	 */
+	override public function toString():String
+	{
+	    var s:String = "Paused for " + timeout + "ms.";
+	    
+	    if(this.reason != null)
+	        s = s + " Reason: " + this.reason;
+
+		return s;
+	}
+}
+
+}

Propchange: incubator/flex/trunk/mustella/as3/src/mustella/Pause.as
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/trunk/mustella/as3/src/mustella/PixelSnifferRemote.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/as3/src/mustella/PixelSnifferRemote.as?rev=1333232&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/as3/src/mustella/PixelSnifferRemote.as (added)
+++ incubator/flex/trunk/mustella/as3/src/mustella/PixelSnifferRemote.as Wed May  2 22:44:38 2012
@@ -0,0 +1,205 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package
+{
+import flash.display.BitmapData;
+import flash.display.DisplayObject;
+import flash.events.Event;
+import flash.events.MouseEvent;
+import flash.events.StatusEvent;
+import flash.geom.Matrix;
+import flash.geom.Point;
+import flash.net.LocalConnection;
+
+import mx.managers.IFocusManagerComponent;
+import mx.managers.SystemManager;
+import mx.core.FlexGlobals;
+import mx.core.IFlexDisplayObject;
+import mx.core.IMXMLObject;
+import mx.core.UIComponent;
+import mx.core.IVisualElementContainer;
+import mx.core.mx_internal;
+use namespace mx_internal;
+
+[Mixin]
+/**
+ *  Displays positions and pixel colors to SnifferRemoteClient.swf
+ */
+public class PixelSnifferRemote
+{
+	public function PixelSnifferRemote()
+	{
+	}
+
+	public static function init(root:Object):void
+	{
+		document = root;
+		if (document)
+			document.addEventListener("applicationComplete", initHandler);
+			
+		connection = new LocalConnection();
+		connection.allowDomain("*");
+		connection.addEventListener(StatusEvent.STATUS, statusHandler);
+
+		pixelcommandconnection = new LocalConnection();
+		pixelcommandconnection.allowDomain("*");
+		pixelcommandconnection.client = PixelSnifferRemote;
+		pixelcommandconnection.connect("_PixelSnifferCommands");
+	}
+
+    // Turn on only if the SnifferRemoteClient app's checkbox
+    // for this item is checked.
+	private static function initHandler(event:Event):void
+	{
+        connection.send("_PixelSniffer", "toggleSniffersEnabled");
+	}
+
+	private static function statusHandler(event:Event):void
+	{
+	}
+
+    /**
+     *  @private
+	 *  The document containing a reference to this object
+     */
+    private static var document:Object;
+
+    /**
+     *  @private
+	 *  The local connection to the remote client
+     */
+    private static var connection:LocalConnection;
+    private static var pixelcommandconnection:LocalConnection;    
+
+
+	public static function enableSniffer():void
+	{
+
+		// hook UIComponent so we can see all events
+		document.stage.addEventListener("mouseMove", mouseMoveHandler);
+	}
+
+	public static function disableSniffer():void
+	{
+        //trace("PixelSnifferRemote disabled");
+        
+		document.stage.removeEventListener("mouseMove", mouseMoveHandler);
+	}
+
+	private static function mouseMoveHandler(event:MouseEvent):void
+	{
+		var c:DisplayObject = findComponent(DisplayObject(event.target));
+		var pt:Point = c.globalToLocal(new Point(event.stageX, event.stageY));
+		/// we're combining these (perhaps for now) because the other side only 	
+		/// really cares about event Name, not event
+		appendLog(c.toString(), "[mousedata] "+ pt.toString() + " " + pixelValue(c, pt), "");
+	}
+
+	/* a heuristic for figuring out which component should be the target */
+	private static function findComponent(target:DisplayObject):DisplayObject
+	{
+		var o:DisplayObject = target;
+		while (o)
+		{
+			if (o is IFocusManagerComponent && IFocusManagerComponent(o).focusEnabled)
+				return o;
+
+
+
+			/* was: (before the spark -only universe)
+			if (o.parent is Container)
+			{
+				var c:Container = o.parent as Container;
+				var children:Array = c.createdComponents;
+				var numChildren:int = children.length;
+				for (var i:int = 0; i < numChildren; i++)
+				{
+					if (children[i] == o)
+						return o;
+				}
+			}
+			*/
+
+
+			/// post-mobile universe
+			if (o.parent is IVisualElementContainer) 
+			{
+
+				var c:IVisualElementContainer = o.parent as IVisualElementContainer;
+				var numChildren:int = c.numElements;
+				for (var i:int = 0; i < numChildren; i++)
+				{
+					if (c.getElementAt(i) == o) 
+					{ 
+						return o;
+					}
+
+				 }
+			}
+			else if (o.parent is SystemManager)
+			{
+				return o;
+			}
+			o = o.parent;
+		}
+		return target;
+	}
+
+	private static function pixelValue(target:DisplayObject, pt:Point):String
+	{
+		var stagePt:Point = target.localToGlobal(new Point(0, 0));
+		var screenBits:BitmapData = new BitmapData(target.width, target.height);
+		screenBits.draw(document.stage, new Matrix(1, 0, 0, 1, -stagePt.x, -stagePt.y));
+
+		var clr:uint = screenBits.getPixel(pt.x, pt.y);
+		var s:String = clr.toString(16);
+		while (s.length < 6)
+		{
+			s = "0" + s;
+		}
+
+		return s.toUpperCase();
+	}
+
+	private static function appendLog(c:String, s:String, col:String):void
+	{
+//		connection.send("_PixelSniffer", "appendLog", "Pixel", c, s, col);
+
+	    var info:Object = new Object();
+	    
+	    info.dataSource = "Pixel";
+	    info.target = c;
+	    info.eventName = s;
+	    info.event = col;
+
+        /**
+        trace("PixelSniffer is sending: ");
+        trace ("    info.dataSource: " + info.dataSource);
+        trace ("    info.target: " + info.target);
+        trace ("    info.eventName: " + info.eventName);
+        trace ("    info.event: " + info.event);
+	    **/
+	    
+	    connection.send("_PixelSniffer", "appendLog", info);
+
+	}
+
+}
+
+}

Propchange: incubator/flex/trunk/mustella/as3/src/mustella/PixelSnifferRemote.as
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/trunk/mustella/as3/src/mustella/PlaybackControl.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/as3/src/mustella/PlaybackControl.as?rev=1333232&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/as3/src/mustella/PlaybackControl.as (added)
+++ incubator/flex/trunk/mustella/as3/src/mustella/PlaybackControl.as Wed May  2 22:44:38 2012
@@ -0,0 +1,91 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package {
+
+import flash.display.DisplayObject;
+import flash.net.*;
+import flash.events.Event;
+import flash.events.StatusEvent;
+
+[Mixin]
+/**
+ *  A "marker" class that causes test scripts to write out
+ *  bitmaps to the urls instead of reading and comparing
+ *  so that baselines/reference-points can be created for
+ *  future comparing.
+ */
+public class PlaybackControl
+{
+
+	/**
+	 *  Mixin callback that gets everything ready to go.
+	 *  The UnitTester waits for an event before starting
+	 */
+	public static function init(root:DisplayObject):void
+	{
+		connection = new LocalConnection();
+		connection.allowDomain("*");
+		connection.addEventListener(StatusEvent.STATUS, statusHandler);
+
+		commandconnection = new LocalConnection();
+		connection.allowDomain("*");
+		commandconnection.client = PlaybackControl;
+		commandconnection.connect("_PlaybackCommands");
+
+		connection.send("_PlaybackSniffer", "getPausedState");
+	
+	}
+
+	private static function statusHandler(event:Event):void
+	{
+
+	}
+
+    /**
+     *  @private
+	 *  The document containing a reference to this object
+     */
+    private static var document:Object;
+	private static var _root:Object;
+
+    /**
+     *  @private
+	 *  The local connection to the remote client
+     */
+    private static var connection:LocalConnection;
+    private static var commandconnection:LocalConnection;
+
+
+	public static function pause():void
+	{
+		UnitTester.playbackControl = "pause";
+	}
+
+	public static function playback():void
+	{
+		UnitTester.playbackControl = "play";
+	}
+
+	public static function step():void
+	{
+		UnitTester.playbackControl = "step";
+	}
+
+}
+}

Propchange: incubator/flex/trunk/mustella/as3/src/mustella/PlaybackControl.as
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/trunk/mustella/as3/src/mustella/README
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/as3/src/mustella/README?rev=1333232&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/as3/src/mustella/README (added)
+++ incubator/flex/trunk/mustella/as3/src/mustella/README Wed May  2 22:44:38 2012
@@ -0,0 +1,271 @@
+
+Prototype of new test framework. 
+
+
+Example test: CBTester.mxml
+
+Example test-swf: main.mxml
+
+
+
+To compile the sample: 
+
+	mxmlc -includes=CBTester main.mxml
+
+To run: 
+
+	SAFlashPlayer.exe main.swf
+
+
+Multiple scripts can be applied to a single Test swf, as in
+
+	mxmlc -includes=CBTester main.mxml -includes=CBTester2 
+	
+
+Currently, output goes only to trace. 
+
+
+
+What's in a test file? There are some mandatory items: notice the top of CBTester.mxml
+
+        <mx:Script>
+        <![CDATA[
+        public static function init(o:DisplayObject):void
+        {
+        }
+        ]]>
+        </mx:Script>
+        <mx:Metadata>
+        <![CDATA[
+                [Mixin]
+        ]]>
+        </mx:Metadata>
+
+
+These need not vary.
+
+The init function is called by the swf under test. You can add things here if you like, 
+but do so carefully. Note that the application isn't complete by the time this is called.
+
+The [Mixin] is required by the compiler to include this class as a Mixin.
+
+
+
+The UnitTester tag must name what swf it is associated with, using the testSWF tag.
+in CBTester:
+	 testSWF="main.mxml"
+
+
+
+TestCases must have a testID attribute: for example, 
+
+   <TestCase testID="myTest1">
+
+
+The testID should be unique. 
+
+
+
+Description of Available Tags
+
+
+
+<testCases>   - no attributes.  children are of type TestCase
+
+
+<TestCase testID="myTest1">    
+	attributes:
+
+		testID - a unique identifier for the TestCase
+
+	child elements: 
+
+		<setup>  - no attributes
+		<body>   - no attributes 
+		<cleanup>- no attributes
+
+
+	setup, body, and cleanup may have the following elements: 
+
+	AssertPixelValue
+		attributes: 
+			target - the object that has the property to verify
+			x - the X coordinate, relative to the target. 
+			y - the Y coordinate, relative to the target. 
+			value - the expected value (eg, 0XFFFFFF)
+			valueExpression - a code expression, generally setting value=<code>
+			waitEvent - (optional) - the event to wait for. The test will not
+				     advance until this event is received, or a timeout occurs. 
+			waitTarget - the object that will dispatch the waitEvent event
+			timeout - in milliseconds. default is 3000 milliseconds.
+
+	AssertPropertyValue
+		attributes: 
+			target - the object that has the property to verify
+			propertyName - the property to verify
+			value - the expected value
+			valueExpression - a code expression, generally setting value=<code>
+			waitEvent - (optional) - the event to wait for. The test will not
+				     advance until this event is received, or a timeout occurs. 
+			waitTarget - the object that will dispatch the waitEvent event
+			timeout - in milliseconds. default is 3000 milliseconds.
+
+	AssertMethodValue
+		attributes: 
+			target - the object that has the property to verify
+			propertyName - the property to verify
+			value - the expected value
+			valueExpression - a code expression, generally setting value=<code>
+			waitEvent - (optional) - the event to wait for. The test will not
+				     advance until this event is received, or a timeout occurs. 
+			waitTarget - the object that will dispatch the waitEvent event
+			timeout - in milliseconds. default is 3000 milliseconds.
+
+	AssertStyleValue
+		attributes: 
+			target - the object on which to assert the style
+			styleName - the name of the style to verify
+			value - the expected value
+			valueExpression - a code expression, generally setting value=<code>
+			waitEvent - (optional) - the event to wait for. The test will not advance
+			            until this event is received or a timeout occurs.
+			waitTarget - the object that will dispatch the waitEvent event
+			timeout - in milliseconds. default is 3000 milliseconds.
+
+	CompareBitmap   (see below for more description)
+		attributes: 
+			target - the object on which to assert the style
+			url - the name of the file to save/read
+			waitEvent - do not use!
+			waitTarget - do not use!
+			timeout - in milliseconds. default is 3000 milliseconds.
+
+
+	DispatchKeyEvent 
+				
+			key  - the key to press 
+			char  - the character to enter 
+			waitEvent - (optional) - the event to wait for. The test will not
+				     advance until this event is received, or a timeout occurs. 
+			waitTarget - the object that will dispatch the waitEvent event
+			timeout - in milliseconds. default is 3000 milliseconds.
+
+
+
+	DispatchMouseEvent 
+			target - the object on which to target the event.
+			type - the type of MouseEvent to dispatch. For instance, "mouseUp"
+			localX - the X coordinate, relative to the target. 
+			localY - the Y coordinate, relative to the target. 
+			waitEvent - (optional) - the event to wait for. The test will not
+				     advance until this event is received, or a timeout occurs. 
+			waitTarget - the object that will dispatch the waitEvent event
+			timeout - in milliseconds. default is 3000 milliseconds.
+
+	Pause
+			timeout - how long to wait. (Does not cause an error)
+		
+
+	RunCode
+		attributes: 
+			code - the code to run. This might be a method call or the actual code.
+			waitEvent - (optional) - the event to wait for. The test will not
+				     advance until this event is received, or a timeout occurs. 
+			waitTarget - the object that will dispatch the waitEvent event
+			timeout - in milliseconds. default is 3000 milliseconds.
+
+
+	SetProperty 
+		attributes: 
+			target - the object on which to set the style
+			propertyName - the name of the style to set
+			value - the value to set the property to
+			waitEvent - (optional) - the event to wait for. The test will not
+				     advance until this event is received, or a timeout occurs. 
+			waitTarget - the object that will dispatch the waitEvent event
+			timeout - in milliseconds. default is 3000 milliseconds.
+
+		example: 
+
+			<SetProperty target="cb" propertyName="dataProvider" value="[1,2,3,4]" waitEvent="updateComplete" waitTarget="cb" />
+:w
+
+	
+	SetStyle
+		attributes: 
+			target - the object whose style you will set
+			styleName - the style you want to set
+			value - the value to set the property to
+			waitEvent - (optional) - the event to wait for. The test will not
+				     advance until this event is received, or a timeout occurs. 
+			waitTarget - the object that will dispatch the waitEvent event
+
+
+
+			<AssertPropertyValue target="cb" propertyName="selectedItem" value="3" />
+
+
+
+
+
+
+
+
+
+
+
+
+Bitmap Comparison: 
+
+
+To use bitmap verification, use the CompareBitmap tag: 
+
+for instance: 
+
+	<CompareBitmap target="cb" url="myTest4.png" timeout="4500" />
+
+This associates a bitmap of cb to save in a file names myTest4.png. 
+
+It is safest to preceed the bitmap call with a call that synchronizes (using waitFor and waitTarget). Do not use waitFor and WaitTarget on the bitmap call itself!
+
+
+To write new bitmaps, it is necessary to mixin the CreateBitmapReferences class. 
+
+
+	mxmlc -includes=CBTester -includes=CreateBitmapReferences main.mxml
+
+
+(and, because of the current bug, it is necessary to have a reference to CreateBitmapReferences in main.mxml). 
+
+
+Because writing to the local disk is a security violation, a server is required. The server is available in ~depot/flex/qa/skunkworks/baselinewriter/baselinewriter.zip. 
+
+
+This is meant to be run by jrun. To install, unzip it under servers/default in a jrun installation. 
+
+
+The root url that mustella writes bitmaps to is defined in CreateBitmapReferences.as; very likely you will have to alter the server port, local directory location, and the base url to make this work. 
+
+
+Let me know of any difficulties setting up the server: bolaughl@adobe.com
+
+
+
+issues: 
+
+	mixin currently requires a reference to the mixin file(s). (bug)
+
+
+
+
+
+
+
+USEFUL TOOLS
+
+
+EventSniffer - include an EventSniffer tag in your test swf. This sniffs all events and displays them. Start, stop, mark and clear controls. 
+
+PixelSniffer - include a PixelSniffer tag in your test swf. This sniffs all mouse locations and pixel values under the mouse. Start, stop, mark and clear controls. 
+ca
+going 

Propchange: incubator/flex/trunk/mustella/as3/src/mustella/README
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/trunk/mustella/as3/src/mustella/ResetComponent.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/as3/src/mustella/ResetComponent.as?rev=1333232&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/as3/src/mustella/ResetComponent.as (added)
+++ incubator/flex/trunk/mustella/as3/src/mustella/ResetComponent.as Wed May  2 22:44:38 2012
@@ -0,0 +1,469 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package {
+
+import flash.display.DisplayObject;
+import flash.display.DisplayObjectContainer;
+import flash.display.InteractiveObject;
+import flash.events.KeyboardEvent;
+import flash.events.FocusEvent;
+import flash.net.LocalConnection;
+import flash.system.ApplicationDomain;
+import flash.ui.Keyboard;
+import flash.utils.getQualifiedClassName;
+import flash.utils.getTimer;
+
+import mx.core.mx_internal;
+use namespace mx_internal;
+
+/**
+ *  The test step that fakes a keyboard event
+ *  MXML attributes:
+ *  target 
+ *  className
+ *  waitTarget
+ *  waitEvent
+ *  timeout
+ */
+public class ResetComponent extends TestStep
+{
+    private static var effectsInEffect:QName = new QName(mx_internal, "effectsInEffect");
+    private static var activeTweens:QName = new QName(mx_internal, "activeTweens");
+    private static var tooltipReset:QName = new QName(mx_internal, "reset");
+
+    private var actualWaitEvent:String;
+
+    private var waited:Boolean = false;
+
+    /**
+     *  Called by the TestCase when it is time to start this step
+     *  fake waitEvent because we don't want to listen to the old one
+     */
+    override public function execute(root:DisplayObject, context:UnitTester, testCase:TestCase, testResult:TestResult):Boolean
+    {
+        if (waitTarget == null)
+            waitTarget = target;
+
+        // let super think there is no waitEvent
+        if (waitEvent && waitTarget == target)
+        {
+            actualWaitEvent = waitEvent;
+            waitEvent = null;
+        }
+        var val:Boolean = super.execute(root, context, testCase, testResult);
+        if (actualWaitEvent && !waited)
+        {
+            var actualTarget:Object = context.stringToObject(waitTarget);
+            if (!actualTarget)
+            {
+                testResult.doFail("Target " + waitTarget + " not found");
+                return true;
+            }
+            waitEvent = actualWaitEvent;
+            actualTarget.addEventListener(actualWaitEvent, waitEventHandler);
+            testCase.setExpirationTime(getTimer() + timeout);
+        }
+        return (actualWaitEvent || waited) ? false : val;
+    }
+
+    /**
+     *  Set the target's property to the specified value
+     */
+    override protected function doStep():void
+    {
+        var effects:Boolean = false;
+
+        var appDom:ApplicationDomain = root["topLevelSystemManager"]["info"]().currentDomain;
+        if (!appDom)
+            appDom = ApplicationDomain.currentDomain;
+        
+        var effectMgr:Class = Class(appDom.getDefinition("mx.effects.EffectManager"));
+
+        if (effectMgr)
+        {
+            effects = effectMgr[effectsInEffect]();
+        }
+        if (!effects)
+        {
+            effectMgr = Class(appDom.getDefinition("mx.effects.Tween"));
+            if (effectMgr)
+            {
+                effects = effectMgr[activeTweens].length > 0;
+            }
+        }
+        if (!effects)
+            effects = UnitTester.getSandboxedEffects();
+
+        if (!effects)
+        {
+            actuallyDoStep(waited);
+            waited = false;
+        }
+        else
+        {
+            UnitTester.callback = doStep;
+            waited = true;
+        }
+    }
+
+    private function actuallyDoStep(addListener:Boolean):void
+    {
+        
+        var actualTarget:Object = context.stringToObject(target);
+        if (!actualTarget)
+        {
+            testResult.doFail("Target " + target + " not found");
+            return;
+        }
+        
+        // Introspect target type.
+        var targetType:TypeInfo = context.getTypeInfo(actualTarget);
+        var targetIsGraphic:Boolean = targetType.implementsInterface("spark.core::IGraphicElement");
+        
+        // Save id to apply later.
+        if (actualTarget is DisplayObject)
+        {
+            var id:String = actualTarget.id;
+        }
+        
+        try
+        {
+           // Save parent context.
+           if (actualTarget is DisplayObject || targetIsGraphic)
+           {
+                var parent:Object = actualTarget.parent;
+            
+                if (!parent)
+                {
+                    testResult.doFail("Target " + target + " not parented");
+                    return;
+                }
+            }
+        }
+        catch (se:SecurityError)
+        {
+            UnitTester.resetSandboxedComponent(target, className);
+            return;
+        }
+
+        // Garbage collect.
+        attemptGC();
+        
+        // Introspect parent type.
+        if (parent)
+        {
+            var parentType:TypeInfo = context.getTypeInfo(parent);
+            var parentIsGroup:Boolean = parentType.isAssignableTo("spark.components::Group");
+        }
+        
+        // Ensure parent of graphic primitive is a Group.
+        if (targetIsGraphic && !parentIsGroup)
+        {
+            testResult.doFail("Graphic primitive " + target + " not parented by a Group.");
+            return;
+        }
+            
+        // Infer className is none provided.
+        className = className != null ? className : targetType.className;
+        
+        var targetClass:Class;
+        var child:Object;
+        var appdom:ApplicationDomain = UnitTester.getApplicationDomain(target, actualTarget, className);
+        if (!appdom)
+        {
+            UnitTester.resetSandboxedComponent(target, className);
+            return;
+        }
+        
+        if (actualTarget is DisplayObject || targetIsGraphic)
+        {
+            // Remove original instance
+            if (parentIsGroup)
+            {
+                var index:int = parent.getElementIndex(actualTarget);
+                parent.removeElement(actualTarget);
+            }
+            else
+            {
+                index = parent.getChildIndex(actualTarget);
+                parent.removeChild(actualTarget);
+            }
+            
+            // Cleanup any related or housekeeping objects.
+            cleanupOtherDisplayObjects();
+            
+            // Lookup requested type for new instance.
+            targetClass = Class(appdom.getDefinition(className));
+            if (!targetClass)
+            {
+                testResult.doFail("className " + className + " is not a valid class");
+                return;
+            }
+
+            // Create new instance.
+            child = new targetClass();
+            var childType:TypeInfo = context.getTypeInfo(child);
+            if (!(child is DisplayObject) && !childType.implementsInterface("spark.core::IGraphicElement"))
+            {
+                testResult.doFail("className " + className + " is not a DisplayObject or GraphicElement primitive.");
+                return;
+            }
+            
+            // Re-add new instance to visual DOM.
+            if (parentIsGroup)
+                parent.addElementAt(child, index);
+            else
+                parent.addChildAt(child as DisplayObject, index);   
+        }
+        else
+        {
+            // Fallback for non-DOM component instances.
+            targetClass = Class(appdom.getDefinition(className));
+            if (!targetClass)
+            {
+                testResult.doFail("className " + className + " is not a valid class");
+                return;
+            }
+
+            child = new targetClass();
+        }
+
+        // Update top level document slots with reference to new instance.
+        var obj:Object;
+        var varName:String;
+        if (target.indexOf(".") == -1)
+        {
+            if (target.indexOf("script:") == 0)
+            {
+                obj = context;
+                varName = target.substring(7);
+            }
+            else
+            {
+                obj = root["document"];
+                varName = target;
+            }
+        }
+        else
+        {
+            var path:String = target.substring(0, target.lastIndexOf("."));
+            obj = context.stringToObject(path);
+            varName = target.substring(target.lastIndexOf(".") + 1);
+        }
+        if (!obj)
+        {
+            testResult.doFail("path " + path + " is not valid");
+            return;
+        }
+        if (!(varName in obj))
+        {
+            testResult.doFail("property " + varName + " is not valid");
+            return;
+        }
+
+        if (actualTarget is DisplayObject)
+            if (id && child)
+                Object(child).id = id;
+
+        try 
+        {
+            obj[varName] = child;
+        }
+        catch (e1:Error)
+        {
+            TestOutput.logResult("Exception thrown setting path to new class instance.");
+            testResult.doFail (e1.getStackTrace()); 
+        }
+
+        // Initiate wait if requested, otherwise complete step.
+        if (actualWaitEvent && addListener)
+        {
+            actualTarget = context.stringToObject(waitTarget);
+            if (!actualTarget)
+            {
+                testResult.doFail("Target " + waitTarget + " not found");
+                stepComplete();
+                return;
+            }
+            waitEvent = actualWaitEvent;
+            actualTarget.addEventListener(actualWaitEvent, waitEventHandler);
+            testCase.setExpirationTime(getTimer() + timeout);
+        }
+        else if (addListener)
+        {
+            stepComplete();
+        }
+    
+    }
+
+    private function cleanupOtherDisplayObjects():void
+    {
+        var r:Object;
+        var i:int;
+        var n:int;
+        var c:Object;
+
+        var appDom:ApplicationDomain = root["info"]().currentDomain;
+        if (!appDom)
+            appDom = ApplicationDomain.currentDomain;
+
+        r = root;
+        r = root["topLevelSystemManager"];
+
+        UnitTester.blockFocusEvents = false;
+        r.stage.focus = null;
+        UnitTester.blockFocusEvents = true;
+
+        n = r.numChildren;
+        for (i = 0; i < n; i++)
+        {
+            if (context.knownDisplayObjects[r.getChildAt(i)] == null)
+            {
+                c = r.getChildAt(i);
+                if (getQualifiedClassName(c) == "mx.managers::SystemManagerProxy")
+                {
+                    while (c.rawChildren.numChildren)
+                    c.rawChildren.removeChildAt(c.rawChildren.numChildren - 1);
+                }
+                else
+                    r.removeChildAt(i);
+                i--;
+                n--;
+            }
+        }
+
+        r = root;
+        r = root["topLevelSystemManager"];
+        r = r.popUpChildren;
+        n = r.numChildren;
+        for (i = 0; i < n; i++)
+        {
+            if (context.knownDisplayObjects[r.getChildAt(i)] == null)
+            {
+                c = r.getChildAt(i);
+                if (getQualifiedClassName(c) == "mx.managers::SystemManagerProxy")
+                {
+                    while (c.rawChildren.numChildren)
+                        c.rawChildren.removeChildAt(c.rawChildren.numChildren - 1);
+                }
+                else
+                    r.removeChildAt(i);
+
+                i--;
+                n--;
+            }
+        }
+
+        r = root;
+        r = root["topLevelSystemManager"];
+        r = r.toolTipChildren;
+        n = r.numChildren;
+        if (n > 0)
+        {
+            var mgr:Class = Class(appDom.getDefinition("mx.core.Singleton"));
+            var impl:Object = mgr["getInstance"]("mx.managers::IToolTipManager2");
+            try
+            {
+                impl[tooltipReset]();
+            }
+            catch (e:Error)
+            {
+                // ignore, chart datatips don't setup tooltipmanager so reset will RTE.
+            }
+        }
+        n = r.numChildren;
+        for (i = 0; i < n; i++)
+        {
+            if (context.knownDisplayObjects[r.getChildAt(i)] == null)
+            {
+                r.removeChildAt(i);
+                i--;
+                n--;
+            }
+        }
+
+        r = root;
+        r = root["topLevelSystemManager"];
+        r = r.cursorChildren;
+        n = r.numChildren;
+        if (n > 0)
+        {
+            var cmgr:Class = Class(appDom.getDefinition("mx.core.Singleton"));
+            var cimpl:Object = cmgr["getInstance"]("mx.managers::ICursorManager");
+            cimpl["removeAllCursors"]();
+        }
+        n = r.numChildren;
+        for (i = 0; i < n; i++)
+        {
+            var o:DisplayObject = r.getChildAt(i);
+            if (context.knownDisplayObjects[o] == null)
+            {
+                if (o.name == "cursorHolder")
+                    continue;
+
+                r.removeChildAt(i);
+                i--;
+                n--;
+            }
+        }
+
+    }
+
+    private function attemptGC():void
+    {
+        // unsupported hack that seems to force a full GC
+        try 
+        {
+            var lc1:LocalConnection = new LocalConnection();
+            var lc2:LocalConnection = new LocalConnection();
+
+            lc1.connect('name');
+            lc2.connect('name');
+        }
+        catch (e:Error)
+        {
+        }
+    }
+
+    /**
+     *  The type of the event to send (keyUp, keyDown, etc).
+     *  If not set, we'll send both a keyDown and a keyUp
+     */
+    public var target:String;
+
+    /**
+     *  The char to send as a string/char if you don't know the charCode (optional)
+     */
+    public var className:String;
+
+    /**
+     *  customize string representation
+     */
+    override public function toString():String
+    {
+        var s:String = "ResetComponent";
+        if (target)
+            s += ": target = " + target;
+        if (className)
+            s += ", className = " + className;
+        return s;
+    }
+}
+
+}

Propchange: incubator/flex/trunk/mustella/as3/src/mustella/ResetComponent.as
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/trunk/mustella/as3/src/mustella/RunCode.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/as3/src/mustella/RunCode.as?rev=1333232&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/as3/src/mustella/RunCode.as (added)
+++ incubator/flex/trunk/mustella/as3/src/mustella/RunCode.as Wed May  2 22:44:38 2012
@@ -0,0 +1,72 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package {
+
+import flash.display.DisplayObject;
+import flash.events.Event;
+import flash.events.EventDispatcher;
+
+/**
+ *  Instead of a property, we use an event so the MXML
+ *  compiler will wrap the code in a function for us
+ */
+[Event(name="code", type="flash.events.Event")]
+
+/**
+ *  A test step that runs an arbitrary set of actionscript
+ *  MXML attributes
+ *  code (a sequence of actionscript)
+ */
+public class RunCode extends TestStep
+{
+	/** 
+	 *  Execute the code by passing it an event.
+	 */
+	override protected function doStep():void
+	{
+		UnitTester.blockFocusEvents = false;
+		try
+		{
+			dispatchEvent(new RunCodeEvent("code", root["document"], context, testCase, testResult));
+		}
+		catch (e1:Error)
+		{
+			TestOutput.logResult("Exception thrown in RunCode.");
+			testResult.doFail (e1.getStackTrace());	
+			UnitTester.blockFocusEvents = true;
+			return;
+		}
+		UnitTester.blockFocusEvents = true;
+	}
+
+	/*
+	public var code:Function; // Event metadata takes care of this
+	*/
+
+	/**
+	 *  customize string representation
+	 */
+	override public function toString():String
+	{
+		var s:String = "RunCode: (code attribute cannot be shown)";
+		return s;
+	}
+}
+
+}

Propchange: incubator/flex/trunk/mustella/as3/src/mustella/RunCode.as
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message