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 [14/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/ContinueAfterRuntimeException/StdAfx.h
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/as3/src/mustella/ContinueAfterRuntimeException/StdAfx.h?rev=1333232&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/as3/src/mustella/ContinueAfterRuntimeException/StdAfx.h (added)
+++ incubator/flex/trunk/mustella/as3/src/mustella/ContinueAfterRuntimeException/StdAfx.h Wed May  2 22:44:38 2012
@@ -0,0 +1,52 @@
+/*
+ *
+ * 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.
+ *
+ */
+// stdafx.h : include file for standard system include files,
+//  or project specific include files that are used frequently, but
+//      are changed infrequently
+//
+
+#if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_)
+#define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#define WIN32_LEAN_AND_MEAN		// Exclude rarely-used stuff from Windows headers
+
+
+// Windows Header Files:
+#include <windows.h>
+#include <winsock2.h>
+#include <ws2tcpip.h>
+
+// C RunTime Header Files
+#include <stdlib.h>
+#include <malloc.h>
+#include <memory.h>
+#include <tchar.h>
+
+// Local Header Files
+
+// TODO: reference additional headers your program requires here
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_)

Propchange: incubator/flex/trunk/mustella/as3/src/mustella/ContinueAfterRuntimeException/StdAfx.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/trunk/mustella/as3/src/mustella/ContinueAfterRuntimeException/resource.h
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/as3/src/mustella/ContinueAfterRuntimeException/resource.h?rev=1333232&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/as3/src/mustella/ContinueAfterRuntimeException/resource.h (added)
+++ incubator/flex/trunk/mustella/as3/src/mustella/ContinueAfterRuntimeException/resource.h 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.
+ *
+ */
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by CONTINUEAFTERRUNTIMEEXCEPTION.RC
+//
+#define IDR_MAINFRAME					128
+#define IDD_CONTINUEAFTERRUNTIMEEXCEPTION_DIALOG		102
+#define IDD_ABOUTBOX					103
+#define IDS_APP_TITLE					103
+#define IDM_ABOUT						104
+#define IDM_EXIT						105
+#define IDS_HELLO						106
+#define IDI_CONTINUEAFTERRUNTIMEEXCEPTION	            107
+#define IDI_SMALL						108
+#define IDC_CONTINUEAFTERRUNTIMEEXCEPTION	            109
+#define IDC_MYICON						2
+#define IDC_STATIC	                    -1
+// Next default values for new objects
+// 
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+
+#define _APS_NEXT_RESOURCE_VALUE        129
+#define _APS_NEXT_COMMAND_VALUE         32771
+#define _APS_NEXT_CONTROL_VALUE         1000
+#define _APS_NEXT_SYMED_VALUE           110
+#endif
+#endif

Propchange: incubator/flex/trunk/mustella/as3/src/mustella/ContinueAfterRuntimeException/resource.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/trunk/mustella/as3/src/mustella/CoverageTimeout.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/as3/src/mustella/CoverageTimeout.as?rev=1333232&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/as3/src/mustella/CoverageTimeout.as (added)
+++ incubator/flex/trunk/mustella/as3/src/mustella/CoverageTimeout.as Wed May  2 22:44:38 2012
@@ -0,0 +1,43 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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;
+
+[Mixin]
+/**
+ *  set a timeout to linger around for coverage data
+ */
+public class CoverageTimeout
+{
+
+	/**
+	 *  Mixin callback that gets everything ready to go.
+	 *  The UnitTester waits for an event before starting
+	 */
+	public static function init(root:DisplayObject):void
+	{
+		UnitTester.coverageTimeout = 30000;
+	}
+
+
+}
+}

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

Added: incubator/flex/trunk/mustella/as3/src/mustella/CreateBitmapReferences.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/as3/src/mustella/CreateBitmapReferences.as?rev=1333232&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/as3/src/mustella/CreateBitmapReferences.as (added)
+++ incubator/flex/trunk/mustella/as3/src/mustella/CreateBitmapReferences.as Wed May  2 22:44:38 2012
@@ -0,0 +1,46 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 "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 CreateBitmapReferences 
+{
+
+	/**
+	 *  Mixin callback that gets everything ready to go.
+	 *  The UnitTester waits for an event before starting
+	 */
+	public static function init(root:DisplayObject):void
+	{
+		UnitTester.createBitmapReferences = true;
+		/// change this to suit your locally running server: 
+		UnitTester.bitmapServerPrefix = "http://localhost:9998/baselines/baseline.jsp?filename=";
+	}
+
+}
+
+}

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

Added: incubator/flex/trunk/mustella/as3/src/mustella/DesktopMacSettings.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/as3/src/mustella/DesktopMacSettings.as?rev=1333232&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/as3/src/mustella/DesktopMacSettings.as (added)
+++ incubator/flex/trunk/mustella/as3/src/mustella/DesktopMacSettings.as Wed May  2 22:44:38 2012
@@ -0,0 +1,40 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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]
+/**
+ * By including this mixin via CompileMustellaSwfs, we
+ * can set up some variables for UnitTester to use for
+ * a run of mobile tests on the desktop.
+ */
+public class DesktopMacSettings
+{
+	public static function init(root:DisplayObject):void
+	{
+		if( UnitTester.cv == null ){
+			UnitTester.cv = new ConditionalValue();
+		}
+	
+		UnitTester.cv.os = "mac";
+	}
+}
+}

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

Added: incubator/flex/trunk/mustella/as3/src/mustella/DesktopWinSettings.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/as3/src/mustella/DesktopWinSettings.as?rev=1333232&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/as3/src/mustella/DesktopWinSettings.as (added)
+++ incubator/flex/trunk/mustella/as3/src/mustella/DesktopWinSettings.as Wed May  2 22:44:38 2012
@@ -0,0 +1,40 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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]
+/**
+ * By including this mixin via CompileMustellaSwfs, we
+ * can set up some variables for UnitTester to use for
+ * a run of mobile tests on the desktop.
+ */
+public class DesktopWinSettings
+{
+	public static function init(root:DisplayObject):void
+	{
+		if( UnitTester.cv == null ){
+			UnitTester.cv = new ConditionalValue();
+		}
+		
+		UnitTester.cv.os = "win";
+	}
+}
+}

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

Added: incubator/flex/trunk/mustella/as3/src/mustella/DeviceNames.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/as3/src/mustella/DeviceNames.as?rev=1333232&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/as3/src/mustella/DeviceNames.as (added)
+++ incubator/flex/trunk/mustella/as3/src/mustella/DeviceNames.as Wed May  2 22:44:38 2012
@@ -0,0 +1,58 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.system.Capabilities;
+
+/**
+ *  allowed values for deviceName
+ *
+ */
+public class DeviceNames
+{
+	public static const ANDROID:String = "android";
+	public static const IOS:String = "iphone";
+	public static const QNX:String = "qnx";
+	public static const MAC:String = "mac";
+	public static const WIN:String = "win";
+
+	public static const OS_VALUES:Array = [WIN, MAC, ANDROID, IOS, QNX];
+	public static const OS_VERSION_VALUES:Array = ["android22", "android23", "ios3x", "ios40", "ios41"];
+	public static const DEVICE_VALUES:Array = ["desire","droid","droid2","droidX","evo","incredible","nexusOne","playbook"];
+
+	public static function getFromOS ():String 
+	{
+
+		if (Capabilities.os.substring (0, Capabilities.os.indexOf (" ")) == "Windows" )
+		{
+			return WIN;
+		} else if (Capabilities.os.substring (0, Capabilities.os.indexOf (" ")) == "Mac" )
+		{
+			return MAC;
+
+		} else 
+		{
+			return "";
+		}
+
+	}
+
+}
+}

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

Added: incubator/flex/trunk/mustella/as3/src/mustella/DispatchEvent.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/as3/src/mustella/DispatchEvent.as?rev=1333232&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/as3/src/mustella/DispatchEvent.as (added)
+++ incubator/flex/trunk/mustella/as3/src/mustella/DispatchEvent.as Wed May  2 22:44:38 2012
@@ -0,0 +1,139 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.Event;
+import flash.system.ApplicationDomain;
+
+import mx.core.mx_internal;
+use namespace mx_internal;
+
+/**
+ *  The test step that fakes an event.  Do not use for MouseEvent or KeyboardEvent
+ *  MXML attributes:
+ *  bubbles
+ *  cancelable
+ *  eventClass
+ *  properties
+ *  target
+ *  type
+ *  waitTarget (optional)
+ *  waitEvent (optional)
+ *  timeout (optional);
+ */
+public class DispatchEvent extends TestStep
+{
+
+	/**
+	 *  @private
+	 */
+	override public function execute(root:DisplayObject, context:UnitTester, testCase:TestCase, testResult:TestResult):Boolean
+	{
+		if (waitEvent && waitTarget == null)
+			waitTarget = target;
+		return super.execute(root, context, testCase, testResult);
+	}
+
+	/**
+	 *  Set the target's property to the specified value
+	 */
+	override protected function doStep():void
+	{
+		UnitTester.blockFocusEvents = false;
+
+		var actualTarget:Object = context.stringToObject(target);
+		if (!actualTarget)
+		{
+			testResult.doFail("Target " + target + " not found");
+			UnitTester.blockFocusEvents = false;
+			return;
+		}
+
+		var c:Class = ApplicationDomain.currentDomain.getDefinition(eventClass) as Class;
+		var event:Event = new c(type, bubbles, cancelable);
+		if (properties)
+		{
+			for (var s:String in properties)
+			{
+				event[s] = properties[s];
+			}
+		}
+		try
+		{
+			actualTarget.dispatchEvent(event);
+		}
+		catch (e2:Error)
+		{
+			TestOutput.logResult("Exception thrown in DispatchEvent.");
+			testResult.doFail (e2.getStackTrace());	
+		}
+
+		UnitTester.blockFocusEvents = true;
+	}
+
+	/**
+	 *  The qualified name of the class for the event
+	 *  i.e. flash.events.Event
+	 */
+	public var eventClass:String;
+
+	/**
+	 *  The object that receives the mouse event
+	 */
+	public var target:String;
+
+	/**
+	 *  The type of the event to send (mouseUp, mouseDown, etc).
+	 */
+	public var type:String;
+
+	/**
+	 *  The bubbles property on the Event (optional)
+	 */
+	public var bubbles:Boolean;
+
+	/**
+	 *  The cancelable property on the Event (optional)
+	 */
+	public var cancelable:Boolean;
+
+
+	/**
+	 *  The relatedObject property on the MouseEvent (optional)
+	 */
+	public var properties:Object;
+
+
+	/**
+	 *  customize string representation
+	 */
+	override public function toString():String
+	{
+		var s:String = "DispatchEvent: target = ";
+		s += target;
+		if (type)
+			s += ", type = " + type;
+		return s;
+	}
+}
+
+}

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

Added: incubator/flex/trunk/mustella/as3/src/mustella/DispatchKeyEvent.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/as3/src/mustella/DispatchKeyEvent.as?rev=1333232&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/as3/src/mustella/DispatchKeyEvent.as (added)
+++ incubator/flex/trunk/mustella/as3/src/mustella/DispatchKeyEvent.as Wed May  2 22:44:38 2012
@@ -0,0 +1,604 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.Event;
+import flash.events.FocusEvent;
+import flash.events.TextEvent;
+
+import flash.text.TextField;
+import flash.ui.Keyboard;
+import flash.system.Capabilities;
+
+
+/**
+ *  The test step that fakes a keyboard event
+ *  MXML attributes:
+ *  type (optional)
+ *  charCode
+ *  ctrlKey (optional)
+ *  keyCode (optional)
+ *  keyLocation (optional)
+ *  shiftKey (optional)
+ *  waitTarget (optional)
+ *  waitEvent (optional)
+ *  timeout (optional);
+ *  cancelable (optional)
+ */
+
+
+public class DispatchKeyEvent extends TestStep
+{
+	// These are constants from flash.ui.Keyboard.  They are not
+	// available in non-AIR compilations, so they are reproduced here
+	// to avoid compile errors.
+	// If they change in AIR, these will need to be updated.
+	public static const FLASH_UI_KEYBOARD_BACK:uint = 0x01000016;
+	public static const FLASH_UI_KEYBOARD_MENU:uint = 0x01000012;
+	public static const FLASH_UI_KEYBOARD_SEARCH:uint = 0x0100001F;
+	
+    /**
+     *  Set the target's property to the specified value
+     */
+    override protected function doStep():void
+    {
+        UnitTester.blockFocusEvents = false;
+
+        var sendBoth:Boolean = false;
+
+        if (!type)
+        {
+            sendBoth = true;
+            type = "keyDown";
+        }
+        
+        var i:int;
+        var n:int;
+        var charSequence:Array = new Array();
+        var keySequence:Array = new Array();
+		
+		
+        if (charCode)
+        {
+            charSequence.push(charCode);
+            keySequence.push(keyCode ? keyCode : CharCodeToKeyCode[charCode] ? CharCodeToKeyCode[charCode] : charCode);
+        }
+        else if (keyCode)
+        {
+            charSequence.push(KeyCodeToCharCode[keyCode] ? KeyCodeToCharCode[keyCode] : 0);
+            keySequence.push(keyCode);
+        }
+        else if (char)
+        {
+            n = char.length;
+            for (i = 0; i < n; i++)
+            {
+                var c:uint = char.charCodeAt(i) 
+                charSequence.push(c);
+                keySequence.push(CharCodeToKeyCode[c]);
+            }
+        }
+        else if (key || keys)
+        {
+            var sequence:Array;
+            if (key)
+                sequence = [ key ];
+            else
+                sequence = keys;
+            n = sequence.length;
+            for (i = 0; i < n; i++)
+            {
+                var kc:uint = Keyboard[sequence[i]];
+                if (kc == 0)
+                {
+                    testResult.doFail(key + " is not a valid flash.ui.Keyboard constant");
+                    UnitTester.blockFocusEvents = true;
+                    return;
+                }
+                keySequence.push(kc);
+                charSequence.push(KeyCodeToCharCode[kc] ? KeyCodeToCharCode[kc] : 0);
+            }
+        }
+        else
+        {
+            testResult.doFail("no keys specified");
+            UnitTester.blockFocusEvents = true;
+            return;
+        }
+		
+        try
+        {
+            for (i = 0; i < repeatCount; i++)
+            {
+                var m:int = charSequence.length;
+                for (var j:int = 0; j < m; j++)
+                {
+                    var event:KeyboardEvent = new KeyboardEvent(type, true, cancelable); // all keyboard events bubble
+                    event.ctrlKey = ctrlKey;
+                    event.shiftKey = shiftKey;
+                    event.charCode = charSequence[j];
+                    event.keyCode = keySequence[j];
+                    event.keyLocation = keyLocation;
+
+
+                    // note that we don't check Window activation since we want to run in the background
+                    // and window activation is a player function
+					
+                    var actualTarget:Object;
+
+                    if (window)
+                    {
+                        actualTarget = context.stringToObject(window);
+                        actualTarget = actualTarget.stage.focus;
+                    }
+                    else
+                    {
+                        actualTarget = root.stage.focus;
+                        if (!actualTarget)
+                        {
+                            actualTarget = UnitTester.getFocus();
+                        }
+                    }
+					
+					// BACK, MENU, and SEARCH are buttons on mobile (Android) devices.  
+					// On Android devices right now, actualTarget is still null at this point.  Dispatching the event to the stage works.
+					// Using the constants in flash.ui.Keyboard will cause an error in a non-AIR runs, so the constants are also defined
+					// in this file, above.  There is risk here.
+					if (keySequence[j] == FLASH_UI_KEYBOARD_BACK ||
+						keySequence[j] == FLASH_UI_KEYBOARD_MENU ||
+						keySequence[j] == FLASH_UI_KEYBOARD_SEARCH){
+						
+						actualTarget = root.stage;
+					}
+					
+                    if (actualTarget)
+                    {
+                        var targetType:TypeInfo = context.getTypeInfo(actualTarget);
+                        var isTextView:Boolean = targetType.isAssignableTo("spark.components::RichEditableText");
+
+
+                        if (actualTarget is TextField)
+                        {
+                            if (event.charCode)
+                            {
+                                if (actualTarget.type == "input")
+                                {
+                                    actualTarget.replaceSelectedText(String.fromCharCode(event.charCode));
+                                    // actualTarget.dispatchEvent(new Event("change", true));
+                                    actualTarget.dispatchEvent(new Event("change"));
+                                }
+                            }
+                            else
+                            {
+                                if (actualTarget.selectable)
+                                    emulateKey(actualTarget, event);
+                            }
+                        }
+
+                        actualTarget.dispatchEvent(event);
+
+
+
+                        if (isTextView)
+                        {
+                            if (event.keyCode == Keyboard.DELETE ||
+
+                                event.keyCode == Keyboard.BACKSPACE ||
+
+                                event.keyCode == Keyboard.INSERT ||
+
+                                ctrlKey)
+
+                            {
+
+                                // don't send TEXT_INPUT event
+
+                            }
+
+                            else
+
+                            {
+
+                                var textEvent:TextEvent = new TextEvent(TextEvent.TEXT_INPUT, true, true);
+
+                                textEvent.text = String.fromCharCode(charSequence[j]);
+
+                                actualTarget.dispatchEvent(textEvent);
+
+                            }
+
+                        }
+
+                        if (keySequence[j] == Keyboard.TAB && type == "keyDown")
+                        {
+                            var fm:Object;
+                            var newTarget:Object = actualTarget;
+                            while (!fm && newTarget)
+                            {   
+                                if ("focusManager" in newTarget)
+                                    fm = newTarget["focusManager"];
+                                newTarget = newTarget.parent;
+                            }
+                            newTarget = null;
+                            if (fm)
+                            {
+                                try
+                                {
+                                    newTarget = fm.getNextFocusManagerComponent(shiftKey);
+                                }
+                                catch (e:Error)
+                                {
+                                    // ignore error thrown here.  Should only throw if the
+                                    // current FM became inactive as a result of dispatching
+                                    // the key event.  We don't really care too much about
+                                    // getting an accurate newTarget in this case because
+                                    // newTarget is often wrong since the Player is offering
+                                    // it up and the Player has that wonky algorithm for
+                                    // determining newTarget.   In theory, none of our code
+                                    // truly cares as long as it doesn't point to old focus
+                                    // object.
+                                }
+                            }
+
+                            actualTarget.dispatchEvent(new FocusEvent(FocusEvent.KEY_FOCUS_CHANGE, true, true, InteractiveObject(newTarget), shiftKey, Keyboard.TAB));
+                        }
+                        
+                        if (sendBoth)
+                        {
+                            event = new KeyboardEvent("keyUp", true, cancelable);
+                            event.ctrlKey = ctrlKey;
+                            event.shiftKey = shiftKey;
+                            event.charCode = charSequence[j];
+                            event.keyCode = keySequence[j];
+                            event.keyLocation = keyLocation;
+                            actualTarget.dispatchEvent(event);
+                        }
+                    }
+                    else
+                    {
+                        if (keySequence[j] == Keyboard.TAB && type == "keyDown")
+                        {
+
+                            var thisRoot:DisplayObject
+							
+                            // note that we don't check Window activation since we want to run in the background
+                            // and window activation is a player function
+                            if (window)
+                            {
+                                thisRoot = context.stringToObject(window).root;
+                            }
+                            else
+                                thisRoot = root;
+                            try
+                            {
+                                thisRoot.stage.dispatchEvent(new FocusEvent(FocusEvent.KEY_FOCUS_CHANGE, true, true, InteractiveObject(actualTarget), shiftKey, Keyboard.TAB));
+                            }
+                            catch(se2:SecurityError)
+                            {
+                                thisRoot.dispatchEvent(new FocusEvent(FocusEvent.KEY_FOCUS_CHANGE, true, true, InteractiveObject(actualTarget), shiftKey, Keyboard.TAB));
+                            }
+                        }						
+						
+                    }
+                }
+            }
+        }
+        catch (e1:Error)
+        {
+            TestOutput.logResult("Exception thrown in DispatchKeyEvent.");
+            testResult.doFail (e1.getStackTrace()); 
+        }
+
+        UnitTester.blockFocusEvents = true;
+    }
+
+    /**
+
+     *  (Optional) name of a UI object whose Window/Stage
+
+     *  will be used to dispatch the event
+
+     */
+
+    public var window:String;
+
+
+
+    /**
+     *  The type of the event to send (keyUp, keyDown, etc).
+     *  If not set, we'll send both a keyDown and a keyUp
+     */
+    public var type:String;
+
+    /**
+     *  The char or sequence of chars to send as a string/char if you don't know the charCode (optional)
+     */
+    public var char:String;
+
+    /**
+     *  The charCode property on the KeyboardEvent (optional)
+     */
+    public var charCode:uint;
+
+    /**
+     *  The ctrlKey property on the KeyboardEvent (optional)
+     */
+    public var ctrlKey:Boolean;
+
+    /**
+     *  The Keyboard key if you don't know the keyCode (optional)
+     */
+    public var key:String;
+
+    /**
+     *  The sequence of keys (optional) e.g ["LEFT", "UP"]
+     */
+    public var keys:Array;
+
+    /**
+     *  The keyCode property on the KeyboardEvent (optional)
+     */
+    public var keyCode:uint;
+
+    /**
+     *  The keyLocation property on the KeyboardEvent (optional)
+     */
+    public var keyLocation:uint;
+
+    /**
+     *  The number of times to repeat the sequence (optional)
+     */
+    public var repeatCount:uint = 1;
+
+    /**
+     *  The shiftKey property on the KeyboardEvent (optional)
+     */
+    public var shiftKey:Boolean;
+
+    /**
+     *  Designate the created event to be cancelable. by default, they are not
+     */
+    public var cancelable:Boolean = false;
+
+    /**
+     *  The FlashPlayer TextField doesn't actually handle keyboard events so we have to
+     *  emulate them
+     */
+    private function emulateKey(actualTarget:Object, event:KeyboardEvent):void
+    {
+        var begin:int = actualTarget.selectionBeginIndex;
+        var end:int = actualTarget.selectionEndIndex;
+        var caret:int = actualTarget.caretIndex;
+        // trace("begin =", begin, "end =", end, "caret =", caret);
+
+        if (event.keyCode == Keyboard.LEFT)
+        {
+            if (event.shiftKey)
+            {
+                if (caret > 0)
+                {
+                    if (caret == begin)
+                    {
+                        begin--;
+                        // last param defines caret position
+                        actualTarget.setSelection(end, begin);
+                    }
+                    else if (caret == end)
+                    {
+                        end--;
+                        if (end < begin)
+                            begin = end;
+			            actualTarget.setSelection(end, begin);
+
+                    }
+                }
+            }
+            else
+            {
+                if (begin != end)
+                    actualTarget.setSelection(begin, begin);
+
+               else if (caret > 0)
+                    actualTarget.setSelection(caret - 1, caret - 1);
+            }
+        }
+        else if (event.keyCode == Keyboard.RIGHT)
+        {
+            if (event.shiftKey)
+            {
+                if (caret < actualTarget.length)
+                {
+                    if (caret == end)
+                    {
+                        end++;
+                        actualTarget.setSelection(begin, end);
+
+                    }
+                    else if (caret == begin)
+                    {
+                        begin++;
+                        if (end < begin)
+                            end = begin;
+                        // last param defines caret position
+                        actualTarget.setSelection(end, begin);
+
+                    }
+                }
+            }
+            else
+            {
+                if (begin != end)
+                    actualTarget.setSelection(end, end); 
+
+               else if (caret > 0)
+                    actualTarget.setSelection(caret + 1, caret + 1);
+            }
+        }
+    }
+
+    private var KeyCodeToCharCode:Object = {
+                    8: 8,
+                    13: 13,
+                    96: 48,
+                    97: 49,
+                    98: 50,
+                    99: 51,
+                    100: 52, 
+                    101: 53,
+                    102: 54,
+                    103: 55,
+                    104: 56,
+                    105: 57,
+                    106: 42,
+                    107: 43,
+                    109: 45,
+                    110: 46,
+                    111: 47
+    }
+
+    private var CharCodeToKeyCode:Object = {
+                    13: 13,
+                    33: 49,
+                    34: 222,
+                    35: 51,
+                    36: 52,
+                    37: 53,
+                    38: 55,
+                    39: 222,
+                    40: 57,
+                    41: 48,
+                    42: 56,
+                    43: 187,
+                    44: 188,
+                    45: 189,
+                    46: 190,
+                    47: 191,
+                    48: 48,
+                    49: 49,
+                    50: 50,
+                    51: 51,
+                    52: 52,
+                    53: 53,
+                    54: 54,
+                    55: 55,
+                    56: 56,
+                    57: 57,
+                    58: 186,
+                    59: 186,
+                    60: 188,
+                    61: 187,
+                    62: 190,
+                    63: 191,
+                    64: 50,
+                    65: 65,
+                    66: 66,
+                    67: 67,
+                    68: 68,
+                    69: 69,
+                    70: 70,
+                    71: 71,
+                    72: 72,
+                    73: 73,
+                    74: 74,
+                    75: 75,
+                    76: 76,
+                    77: 77,
+                    78: 78,
+                    79: 79,
+                    80: 80,
+                    81: 81,
+                    82: 82,
+                    83: 83,
+                    84: 84,
+                    85: 85,
+                    86: 86,
+                    87: 87,
+                    88: 88,
+                    89: 89,
+                    90: 90,
+                    91: 219,
+                    92: 220,
+                    93: 221,
+                    94: 54,
+                    95: 189,
+                    96: 192,
+                    97: 65,
+                    98: 66,
+                    99: 67,
+                    100: 68,
+                    101: 69,
+                    102: 70,
+                    103: 71,
+                    104: 72,
+                    105: 73,
+                    106: 74,
+                    107: 75,
+                    108: 76,
+                    109: 77,
+                    110: 78,
+                    111: 79,
+                    112: 80,
+                    113: 81,
+                    114: 82,
+                    115: 83,
+                    116: 84,
+                    117: 85,
+                    118: 86,
+                    119: 87,
+                    120: 88,
+                    121: 89,
+                    122: 90,
+                    123: 219,
+                    124: 220,
+                    125: 221,
+                    126: 192
+    }
+
+    /**
+     *  customize string representation
+     */
+    override public function toString():String
+    {
+        var s:String = "DispatchKeyEvent";
+        if (charCode)
+            s += ": charCode = " + charCode.toString();
+        if (keyCode)
+            s += ": keyCode = " + keyCode.toString();
+        if (char)
+            s += ": char = " + char;
+        if (key)
+            s += ": key = " + key;
+        if (keys)
+            s += ": keys = " + keys.toString();
+        if (type)
+            s += ", type = " + type;
+        if (shiftKey)
+            s += ", shiftKey = " + shiftKey.toString();
+        if (ctrlKey)
+            s += ", ctrlKey = " + ctrlKey.toString();
+        if (repeatCount)
+            s += ", repeatCount = " + repeatCount.toString();
+        return s;
+    }
+}
+
+}

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

Added: incubator/flex/trunk/mustella/as3/src/mustella/DispatchMouseClickEvent.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/as3/src/mustella/DispatchMouseClickEvent.as?rev=1333232&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/as3/src/mustella/DispatchMouseClickEvent.as (added)
+++ incubator/flex/trunk/mustella/as3/src/mustella/DispatchMouseClickEvent.as Wed May  2 22:44:38 2012
@@ -0,0 +1,295 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.MouseEvent;
+import flash.geom.Point;
+import flash.text.TextField;
+
+import mx.core.mx_internal;
+use namespace mx_internal;
+
+/**
+ *  The test step that fakes a mouse event
+ *  MXML attributes:
+ *  target
+ *  type
+ *  ctrlKey (optional)
+ *  delta (optional)
+ *  localX
+ *  localY
+ *  relatedObject (optional)
+ *  shiftKey (optional)
+ *  stageX
+ *  stageY
+ *  waitTarget (optional)
+ *  waitEvent (optional)
+ *  timeout (optional);
+ */
+public class DispatchMouseClickEvent extends TestStep
+{
+
+	private static var mouseX:QName = new QName(mx_internal, "_mouseX");
+	private static var mouseY:QName = new QName(mx_internal, "_mouseY");
+
+	/**
+	 *  @private
+	 */
+	override public function execute(root:DisplayObject, context:UnitTester, testCase:TestCase, testResult:TestResult):Boolean
+	{
+		if (waitEvent && waitTarget == null)
+			waitTarget = target;
+		return super.execute(root, context, testCase, testResult);
+	}
+
+	/**
+	 *  Set the target's property to the specified value
+	 */
+	override protected function doStep():void
+	{
+		UnitTester.blockFocusEvents = false;
+
+		var actualTarget:Object = context.stringToObject(target);
+		if (!actualTarget)
+		{
+			testResult.doFail("Target " + target + " not found");
+			UnitTester.blockFocusEvents = true;
+			return;
+		}
+		dispatchMouseEvent(actualTarget, "mouseDown");
+		dispatchMouseEvent(actualTarget, "mouseUp");
+		dispatchMouseEvent(actualTarget, "click");
+
+		UnitTester.blockFocusEvents = true;
+
+	}
+
+	private function dispatchMouseEvent(actualTarget:Object, type:String):void
+	{
+		var event:MouseEvent = new MouseEvent(type, true); // all mouse events bubble
+		event.ctrlKey = ctrlKey;
+		event.shiftKey = shiftKey;
+		event.buttonDown = type == "mouseDown";
+		event.delta = delta;
+		if (relatedObject && relatedObject.length > 0)
+		{
+			event.relatedObject = InteractiveObject(context.stringToObject(relatedObject));
+		}
+		
+		var stagePt:Point;
+		if (!isNaN(localX) && !isNaN(localY))
+		{
+			stagePt = actualTarget.localToGlobal(new Point(localX, localY));
+		}
+		else if (!isNaN(stageX) && !isNaN(stageY))
+		{
+			stagePt = new Point(stageX, stageY);
+		}
+		else
+		{
+			stagePt = actualTarget.localToGlobal(new Point(0, 0));
+		}
+		root[mouseX] = stagePt.x;
+		root[mouseY] = stagePt.y;
+		UnitTester.setMouseXY(stagePt);
+		if (root["topLevelSystemManager"] != root)
+		{
+			root["topLevelSystemManager"][mouseX] = stagePt.x;
+			root["topLevelSystemManager"][mouseY] = stagePt.y;
+		}
+
+		if (actualTarget is DisplayObjectContainer)
+		{
+			var targets:Array = actualTarget.stage.getObjectsUnderPoint(stagePt);
+			var arr:Array = UnitTester.getObjectsUnderPoint(DisplayObject(actualTarget), stagePt);
+			targets = targets.concat(arr);
+
+			for (var i:int = targets.length - 1; i >= 0; i--)
+			{
+				if (targets[i] is InteractiveObject)
+				{
+					if (targets[i] is TextField && !targets[i].selectable)
+					{
+						actualTarget = targets[i].parent;
+						break;
+					}
+
+					if (isMouseTarget(InteractiveObject(targets[i])))
+					{
+						actualTarget = targets[i];
+						break;
+					}
+				}
+/*				else
+				{
+					try
+					{
+						actualTarget = targets[i].parent;
+						while (actualTarget)
+						{
+							if (actualTarget is InteractiveObject)
+							{
+								if (isMouseTarget(InteractiveObject(actualTarget)))
+								{
+									break;
+								}
+							}
+							actualTarget = actualTarget.parent;
+						}
+						if (actualTarget && actualTarget != root)
+							break;
+					}
+					catch (e:Error)
+					{
+						if (actualTarget)
+							break;
+					}
+				}
+*/			}
+		}
+
+		var localPt:Point = actualTarget.globalToLocal(stagePt);
+		event.localX = localPt.x;
+		event.localY = localPt.y;
+
+		if (actualTarget is TextField)
+		{
+			if (type == "mouseDown")
+			{
+				var charIndex:int = actualTarget.getCharIndexAtPoint(event.localX, event.localY);
+				actualTarget.setSelection(charIndex + 1, charIndex + 1);
+			}
+		}
+
+		try
+		{
+			actualTarget.dispatchEvent(event);
+		}
+		catch (e2:Error)
+		{
+			TestOutput.logResult("Exception thrown in DispatchMouseClickEvent.");
+			testResult.doFail (e2.getStackTrace());	
+			return;
+		}
+	}
+
+	/**
+	 *  The object that receives the mouse event
+	 */
+	public var target:String;
+
+	/**
+	 *  The ctrlKey property on the MouseEvent (optional)
+	 */
+	public var ctrlKey:Boolean;
+
+	/**
+	 *  The delta property on the MouseEvent (optional)
+	 */
+	public var delta:int;
+
+	/**
+	 *  The localX property on the MouseEvent (optional)
+	 *  Either set stageX/stageY or localX/localY, but not both.
+	 */
+	public var localX:Number;
+
+	/**
+	 *  The localY property on the MouseEvent (optional)
+	 *  Either set stageX/stageY or localX/localY, but not both.
+	 */
+	public var localY:Number;
+
+	/**
+	 *  The stageX property on the MouseEvent (optional)
+	 *  Either set stageX/stageY or localX/localY, but not both.
+	 */
+	public var stageX:Number;
+
+	/**
+	 *  The stageY property on the MouseEvent (optional)
+	 *  Either set stageX/stageY or localX/localY, but not both.
+	 */
+	public var stageY:Number;
+
+	/**
+	 *  The shiftKey property on the MouseEvent (optional)
+	 */
+	public var shiftKey:Boolean;
+
+	/**
+	 *  The relatedObject property on the MouseEvent (optional)
+	 */
+	public var relatedObject:String;
+
+
+    private function isMouseTarget(target:InteractiveObject):Boolean
+    {
+        if (!target.mouseEnabled)
+            return false;
+
+		// Examine parent chain for "mouseChildren" set to false:
+		try
+		{
+			var parent:DisplayObjectContainer = target.parent;
+			while (parent)
+			{
+				if (!parent.mouseChildren)
+					return false;
+				parent = parent.parent;
+			}
+		}
+		catch (e1:Error)
+		{
+		}
+
+        return true;
+    }
+
+	/**
+	 *  customize string representation
+	 */
+	override public function toString():String
+	{
+		var s:String = "DispatchMouseClickEvent: target = ";
+		s += target;
+		if (!isNaN(localX))
+			s += ", localX = " + localX.toString();
+		if (!isNaN(localY))
+			s += ", localY = " + localY.toString();
+		if (!isNaN(stageX))
+			s += ", stageX = " + stageX.toString();
+		if (!isNaN(stageY))
+			s += ", stageY = " + stageY.toString();
+		if (shiftKey)
+			s += ", shiftKey = " + shiftKey.toString();
+		if (ctrlKey)
+			s += ", ctrlKey = " + ctrlKey.toString();
+		if (relatedObject)
+			s += ", relatedObject = " + relatedObject.toString();
+		if (delta)
+			s += ", delta = " + delta.toString();
+		return s;
+	}
+}
+
+}

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

Added: incubator/flex/trunk/mustella/as3/src/mustella/DispatchMouseEvent.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/as3/src/mustella/DispatchMouseEvent.as?rev=1333232&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/as3/src/mustella/DispatchMouseEvent.as (added)
+++ incubator/flex/trunk/mustella/as3/src/mustella/DispatchMouseEvent.as Wed May  2 22:44:38 2012
@@ -0,0 +1,304 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.text.TextField;
+import flash.events.MouseEvent;
+import flash.geom.Point;
+
+import mx.core.mx_internal;
+use namespace mx_internal;
+
+/**
+ *  The test step that fakes a mouse event
+ *  MXML attributes:
+ *  target
+ *  type
+ *  ctrlKey (optional)
+ *  delta (optional)
+ *  localX
+ *  localY
+ *  relatedObject (optional)
+ *  shiftKey (optional)
+ *  stageX
+ *  stageY
+ *  waitTarget (optional)
+ *  waitEvent (optional)
+ *  timeout (optional);
+ */
+public class DispatchMouseEvent extends TestStep
+{
+	private static var mouseX:QName = new QName(mx_internal, "_mouseX");
+	private static var mouseY:QName = new QName(mx_internal, "_mouseY");
+
+	/**
+	 *  @private
+	 */
+	override public function execute(root:DisplayObject, context:UnitTester, testCase:TestCase, testResult:TestResult):Boolean
+	{
+		if (waitEvent && waitTarget == null)
+			waitTarget = target;
+		return super.execute(root, context, testCase, testResult);
+	}
+
+	/**
+	 *  Set the target's property to the specified value
+	 */
+	override protected function doStep():void
+	{
+		UnitTester.blockFocusEvents = false;
+
+		var actualTarget:Object = context.stringToObject(target);
+		if (!actualTarget)
+		{
+			testResult.doFail("Target " + target + " not found");
+			UnitTester.blockFocusEvents = false;
+			return;
+		}
+
+		var event:MouseEvent = new MouseEvent(type, true); // all mouse events bubble
+		event.ctrlKey = ctrlKey;
+		event.shiftKey = shiftKey;
+		event.buttonDown = buttonDown || type == "mouseDown";
+		event.delta = delta;
+		if (relatedObject && relatedObject.length > 0)
+		{
+			event.relatedObject = InteractiveObject(context.stringToObject(relatedObject));
+			if (!event.relatedObject)
+			{
+				testResult.doFail("RelatedObject " + relatedObject + " not found");
+				UnitTester.blockFocusEvents = false;
+				return;
+			}
+		}
+		
+		var stagePt:Point;
+		if (!isNaN(localX) && !isNaN(localY))
+		{
+			stagePt = actualTarget.localToGlobal(new Point(localX, localY));
+		}
+		else if (!isNaN(stageX) && !isNaN(stageY))
+		{
+			stagePt = new Point(stageX, stageY);
+		}
+		else
+		{
+			stagePt = actualTarget.localToGlobal(new Point(0, 0));
+		}
+		root[mouseX] = stagePt.x;
+		root[mouseY] = stagePt.y;
+		UnitTester.setMouseXY(stagePt);
+		if (root["topLevelSystemManager"] != root)
+		{
+			root["topLevelSystemManager"][mouseX] = stagePt.x;
+			root["topLevelSystemManager"][mouseY] = stagePt.y;
+		}
+
+		if (actualTarget is DisplayObjectContainer)
+		{
+			var targets:Array = actualTarget.stage.getObjectsUnderPoint(stagePt);
+			var arr:Array = UnitTester.getObjectsUnderPoint(DisplayObject(actualTarget), stagePt);
+			targets = targets.concat(arr);
+
+			for (var i:int = targets.length - 1; i >= 0; i--)
+			{
+				if (targets[i] is InteractiveObject)
+				{
+					if (targets[i] is TextField && !targets[i].selectable)
+					{
+						actualTarget = targets[i].parent;
+						break;
+					}
+
+					if (isMouseTarget(InteractiveObject(targets[i])))
+					{
+						actualTarget = targets[i];
+						break;
+					}
+				}
+/*				else
+				{
+					try
+					{
+						actualTarget = targets[i].parent;
+						while (actualTarget)
+						{
+							if (actualTarget is InteractiveObject)
+							{
+								if (isMouseTarget(InteractiveObject(actualTarget)))
+								{
+									break;
+								}
+							}
+							actualTarget = actualTarget.parent;
+						}
+						if (actualTarget && actualTarget != root)
+							break;
+					}
+					catch (e:Error)
+					{
+						if (actualTarget)
+							break;
+					}
+				}
+*/			}
+		}
+
+		var localPt:Point = actualTarget.globalToLocal(stagePt);
+		event.localX = localPt.x;
+		event.localY = localPt.y;
+
+		if (actualTarget is TextField)
+		{
+			if (type == "mouseDown")
+			{
+				var charIndex:int = actualTarget.getCharIndexAtPoint(event.localX, event.localY);
+				actualTarget.setSelection(charIndex + 1, charIndex + 1);
+			}
+		}
+
+		try
+		{
+			actualTarget.dispatchEvent(event);
+		}
+		catch (e2:Error)
+		{
+			TestOutput.logResult("Exception thrown in DispatchMouseClickEvent.");
+			testResult.doFail (e2.getStackTrace());	
+		}
+
+		UnitTester.blockFocusEvents = true;
+	}
+
+	/**
+	 *  The object that receives the mouse event
+	 */
+	public var target:String;
+
+	/**
+	 *  The type of the event to send (mouseUp, mouseDown, etc).
+	 */
+	public var type:String;
+
+	/**
+	 *  The buttonDown property on the MouseEvent (optional)
+	 */
+	public var buttonDown:Boolean;
+
+	/**
+	 *  The ctrlKey property on the MouseEvent (optional)
+	 */
+	public var ctrlKey:Boolean;
+
+	/**
+	 *  The delta property on the MouseEvent (optional)
+	 */
+	public var delta:int;
+
+	/**
+	 *  The localX property on the MouseEvent (optional)
+	 *  Either set stageX/stageY or localX/localY, but not both.
+	 */
+	public var localX:Number;
+
+	/**
+	 *  The localY property on the MouseEvent (optional)
+	 *  Either set stageX/stageY or localX/localY, but not both.
+	 */
+	public var localY:Number;
+
+	/**
+	 *  The stageX property on the MouseEvent (optional)
+	 *  Either set stageX/stageY or localX/localY, but not both.
+	 */
+	public var stageX:Number;
+
+	/**
+	 *  The stageY property on the MouseEvent (optional)
+	 *  Either set stageX/stageY or localX/localY, but not both.
+	 */
+	public var stageY:Number;
+
+	/**
+	 *  The shiftKey property on the MouseEvent (optional)
+	 */
+	public var shiftKey:Boolean;
+
+	/**
+	 *  The relatedObject property on the MouseEvent (optional)
+	 */
+	public var relatedObject:String;
+
+
+    private function isMouseTarget(target:InteractiveObject):Boolean
+    {
+        if (!target.mouseEnabled)
+            return false;
+
+		// Examine parent chain for "mouseChildren" set to false:
+		try
+		{
+			var parent:DisplayObjectContainer = target.parent;
+			while (parent)
+			{
+				if (!parent.mouseChildren)
+					return false;
+				parent = parent.parent;
+			}
+		}
+		catch (e1:Error)
+		{
+		}
+
+        return true;
+    }
+
+	/**
+	 *  customize string representation
+	 */
+	override public function toString():String
+	{
+		var s:String = "DispatchMouseEvent: target = ";
+		s += target;
+		if (type)
+			s += ", type = " + type;
+		if (!isNaN(localX))
+			s += ", localX = " + localX.toString();
+		if (!isNaN(localY))
+			s += ", localY = " + localY.toString();
+		if (!isNaN(stageX))
+			s += ", stageX = " + stageX.toString();
+		if (!isNaN(stageY))
+			s += ", stageY = " + stageY.toString();
+		if (shiftKey)
+			s += ", shiftKey = " + shiftKey.toString();
+		if (ctrlKey)
+			s += ", ctrlKey = " + ctrlKey.toString();
+		if (relatedObject)
+			s += ", relatedObject = " + relatedObject.toString();
+		if (delta)
+			s += ", delta = " + delta.toString();
+		return s;
+	}
+}
+
+}

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

Added: incubator/flex/trunk/mustella/as3/src/mustella/DragAndDropMain.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/as3/src/mustella/DragAndDropMain.mxml?rev=1333232&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/as3/src/mustella/DragAndDropMain.mxml (added)
+++ incubator/flex/trunk/mustella/as3/src/mustella/DragAndDropMain.mxml Wed May  2 22:44:38 2012
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+  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.
+
+-->
+<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" >
+
+	<mx:Script>
+	<![CDATA[
+		// uncomment this to write bitmaps
+		// public var createBitmapReferences:CreateBitmapReferences;
+
+		public var script:DragAndDropScript;
+
+		// public var cbTester2:CBTester2;					
+
+	]]>
+	</mx:Script>
+		
+	<mx:List id="lb" dragEnabled="true" dragMoveEnabled="true" initialize="lb.dataProvider=['alpha', 'beta', 'gamma', 'delta']" />
+
+	<mx:List id="lb1" dropEnabled="true" initialize="lb1.dataProvider=['apple']" />
+
+	<!-- probably best to uncomment one at a time -->
+	<!--<EventSniffer />-->
+	<!--<PixelSniffer />-->
+</mx:Application>

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

Added: incubator/flex/trunk/mustella/as3/src/mustella/DragAndDropScript.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/as3/src/mustella/DragAndDropScript.mxml?rev=1333232&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/as3/src/mustella/DragAndDropScript.mxml (added)
+++ incubator/flex/trunk/mustella/as3/src/mustella/DragAndDropScript.mxml Wed May  2 22:44:38 2012
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+  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.
+
+-->
+<UnitTester xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" testSWF="NSMain.mxml">
+
+	<!-- this set of lines form a template that must be in each unit test -->
+	<mx:Script>
+	<![CDATA[
+	public static function init(o:DisplayObject):void
+	{
+	}					
+	]]>
+	</mx:Script>
+	<mx:Metadata>
+	<![CDATA[
+		[Mixin]
+	]]>
+	</mx:Metadata>	
+	<!-- end of set of lines that must be in each unit test -->
+
+	<mx:Script>
+	<![CDATA[
+	]]>
+	</mx:Script>
+
+	<testCases>
+		<TestCase testID="myProp1">
+			<body>
+ 				<DispatchMouseEvent target="lb" type="mouseOver" localX="10" localY="30" />
+ 				<DispatchMouseEvent target="lb" type="mouseDown" localX="10" localY="30" />
+ 				<DispatchMouseEvent target="lb" type="mouseMove" buttonDown="true" localX="2" localY="30" waitTarget="lb" waitEvent="dragStart" />
+ 				<DispatchMouseEvent target="stage" type="mouseMove" buttonDown="true" stageX="228" stageY="57" 
+									waitTarget="mx.managers::DragManager.mx_internal:dragProxy" waitEvent="move"/>
+ 				<DispatchMouseEvent target="stage" type="mouseMove" buttonDown="true" stageX="208" stageY="77"
+									waitTarget="mx.managers::DragManager.mx_internal:dragProxy" waitEvent="move"/>
+ 				<DispatchMouseEvent target="stage" type="mouseMove" buttonDown="true" stageX="208" stageY="107"
+									waitTarget="mx.managers::DragManager.mx_internal:dragProxy" waitEvent="move"/>
+ 				<DispatchMouseEvent target="stage" type="mouseMove" buttonDown="true" stageX="218" stageY="157"
+									waitTarget="mx.managers::DragManager.mx_internal:dragProxy" waitEvent="move"/>
+ 				<DispatchMouseEvent target="stage" type="mouseMove" buttonDown="true" stageX="228" stageY="217"
+									waitTarget="mx.managers::DragManager.mx_internal:dragProxy" waitEvent="move"/>
+ 				<DispatchMouseEvent target="stage" type="mouseMove" buttonDown="true" stageX="238" stageY="237" waitTarget="lb1" waitEvent="dragEnter"/>
+ 				<DispatchMouseEvent target="stage" type="mouseUp" stageX="238" stageY="237" waitTarget="lb1" waitEvent="dragDrop" />
+				<AssertEvent target="lb" eventName="dragComplete" eventClass="mx.events::DragEvent" />
+				<AssertPropertyValue target="lb.dataProvider" propertyName="length" value="3" />
+				<AssertPropertyValue target="lb1.dataProvider" propertyName="length" value="2" />
+			</body>
+		</TestCase>
+  	</testCases>
+</UnitTester>
\ No newline at end of file

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



Mime
View raw message