Packageorg.fluint.uiImpersonation
Classpublic class UIImpersonator
InheritanceUIImpersonator Inheritance Assert Inheritance Object

Provides access to the visual test environment through static methods



Public Properties
 PropertyDefined By
 InheritedassertionsMade : uint
[static] [read-only] Returns the number of assertions that have been made
Assert
  numChildren : int
[static] [read-only] Number of child components in the TestEnvironment.
UIImpersonator
Public Methods
 MethodDefined By
  
addChild(child:DisplayObject):DisplayObject
[static] Adds a child DisplayObject to the TestEnvironment.
UIImpersonator
  
addChildAt(child:DisplayObject, index:int):DisplayObject
[static] Adds a child DisplayObject to the TestEnvironment.
UIImpersonator
 Inherited
assertEquals(... rest):void
[static] Asserts that two provided values are equal.
Assert
 Inherited
assertFalse(... rest):void
[static] Asserts that a condition is false.
Assert
 Inherited
assertNotNull(... rest):void
[static] Asserts that an object is not null.
Assert
 Inherited
assertNull(... rest):void
[static] Asserts that an object is null.
Assert
 Inherited
assertStrictlyEquals(... rest):void
[static] / Asserts that the provided values are strictly equal.
Assert
 Inherited
assertTrue(... rest):void
[static] Asserts that a condition is true.
Assert
 Inherited
fail(failMessage:String):void
[static] Fails a test with the argument message.
Assert
 Inherited
failNotNull(message:String, object:Object):void
[static] Asserts that an object is not null.
Assert
 Inherited
failNotTrue(message:String, condition:Boolean):void
[static] Asserts that a condition is not true.
Assert
 Inherited
failNull(message:String, object:Object):void
[static] Asserts that an object is not null.
Assert
 Inherited
failTrue(message:String, condition:Boolean):void
[static] Asserts that a condition is false.
Assert
  
getChildAt(index:int):DisplayObject
[static] Gets the nth child component object.
UIImpersonator
  
getChildByName(name:String):DisplayObject
[static] Returns the child whose name property is the specified String.
UIImpersonator
  
getChildIndex(child:DisplayObject):int
[static] Gets the zero-based index of a specific child.
UIImpersonator
  
[static] Removes all children from the child list of this container.
UIImpersonator
  
removeChild(child:DisplayObject):DisplayObject
[static] Removes a child DisplayObject from the child list of the TestEnviroment.
UIImpersonator
  
removeChildAt(index:int):DisplayObject
[static] Removes a child DisplayObject from the child list of the TestEnvironment at the specified index.
UIImpersonator
 Inherited
[static] Resets the count for the number of assertions that have been made back to zero
Assert
  
setChildIndex(child:DisplayObject, newIndex:int):void
[static] Sets the index of a particular child.
UIImpersonator
Property Detail
numChildrenproperty
numChildren:int  [read-only]

Number of child components in the TestEnvironment.

The number of children is initially equal to the number of children declared in MXML. At runtime, new children may be added by calling addChild() or addChildAt(), and existing children may be removed by calling removeChild(), removeChildAt(), or removeAllChildren().


Implementation
    public static function get numChildren():int
Method Detail
addChild()method
public static function addChild(child:DisplayObject):DisplayObject

Adds a child DisplayObject to the TestEnvironment. The child is added after other existing children, so that the first child added has index 0, the next has index 1, an so on.

Note: While the child argument to the method is specified as of type DisplayObject, the argument must implement the IUIComponent interface to be added as a child of a container. All Flex components implement this interface.

Parameters

child:DisplayObject — The DisplayObject to add as a child of the TestEnvironment. It must implement the IUIComponent interface.

Returns
DisplayObject — The added child as an object of type DisplayObject. You typically cast the return value to UIComponent, or to the type of the added component.

See also

mx.core.Container
addChildAt()method 
public static function addChildAt(child:DisplayObject, index:int):DisplayObject

Adds a child DisplayObject to the TestEnvironment. The child is added at the index specified.

Note: While the child argument to the method is specified as of type DisplayObject, the argument must implement the IUIComponent interface to be added as a child of TestEnvironment. All Flex components implement this interface.

Parameters

child:DisplayObject — The DisplayObject to add as a child of the TestEnvironment. It must implement the IUIComponent interface.
 
index:int — The index to add the child at.

Returns
DisplayObject — The added child as an object of type DisplayObject. You typically cast the return value to UIComponent, or to the type of the added component.

See also

mx.core.Container
getChildAt()method 
public static function getChildAt(index:int):DisplayObject

Gets the nth child component object.

The children returned from this method include children that are declared in MXML and children that are added using the addChild() or addChildAt() method.

Parameters

index:int — Number from 0 to (numChildren - 1).

Returns
DisplayObject — Reference to the child as an object of type DisplayObject. You typically cast the return value to UIComponent, or to the type of a specific Flex control, such as ComboBox or TextArea.
getChildByName()method 
public static function getChildByName(name:String):DisplayObject

Returns the child whose name property is the specified String.

Parameters

name:String — The identifier of the child.

Returns
DisplayObject — The DisplayObject representing the child as an object of type DisplayObject. You typically cast the return value to UIComponent, or to the type of a specific Flex control, such as ComboBox or TextArea.
getChildIndex()method 
public static function getChildIndex(child:DisplayObject):int

Gets the zero-based index of a specific child.

The first child of the Test Environment (i.e.: the first child tag that appears in the MXML declaration) has an index of 0, the second child has an index of 1, and so on. The indexes of the test environemnt children determine the order in which they get laid out. For example, in a VBox the child with index 0 is at the top, the child with index 1 is below it, etc.

If you add a child by calling the addChild() method, the new child's index is equal to the largest index among existing children plus one. You can insert a child at a specified index by using the addChildAt() method; in that case the indices of the child previously at that index, and the children at higher indices, all have their index increased by 1 so that all indices fall in the range from 0 to (numChildren - 1).

If you remove a child by calling removeChild() or removeChildAt() method, then the indices of the remaining children are adjusted so that all indices fall in the range from 0 to (numChildren - 1).

If myView.getChildIndex(myChild) returns 5, then myView.getChildAt(5) returns myChild.

The index of a child may be changed by calling the setChildIndex() method.

Parameters

child:DisplayObject — Reference to child whose index to get.

Returns
int — Number between 0 and (numChildren - 1).
removeAllChildren()method 
public static function removeAllChildren():void

Removes all children from the child list of this container.

removeChild()method 
public static function removeChild(child:DisplayObject):DisplayObject

Removes a child DisplayObject from the child list of the TestEnviroment. The removed child will have its parent property set to null. The child will still exist unless explicitly destroyed. If you add it to another container, it will retain its last known state.

Parameters

child:DisplayObject — The DisplayObject to remove.

Returns
DisplayObject — The removed child as an object of type DisplayObject. You typically cast the return value to UIComponent, or to the type of the removed component.
removeChildAt()method 
public static function removeChildAt(index:int):DisplayObject

Removes a child DisplayObject from the child list of the TestEnvironment at the specified index. The removed child will have its parent property set to null. The child will still exist unless explicitly destroyed. If you add it to another container, it will retain its last known state.

Parameters

index:int — The child index of the DisplayObject to remove.

Returns
DisplayObject — The removed child as an object of type DisplayObject. You typically cast the return value to UIComponent, or to the type of the removed component.
setChildIndex()method 
public static function setChildIndex(child:DisplayObject, newIndex:int):void

Sets the index of a particular child. See the getChildIndex() method for a description of the child's index.

Parameters

child:DisplayObject — Reference to child whose index to set.
 
newIndex:int — Number that indicates the new index. Must be an integer between 0 and (numChildren - 1).