API Documentation | All Packages | All Classes | Index | Frames No Frames |
UIImpersonator

Package | org.fluint.uiImpersonation
Class | public class UIImpersonator
Inheritance | UIImpersonator Assert Object

Provides access to the visual test environment through static methods

Public Properties
Hide Inherited Public Properties
Show Inherited Public Properties

| Property | Defined By
--- | --- | ---
|  | assertionsMade : 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
|  | testDisplay : Sprite [static] [read-only] Returns the base display component for all components added to the impersonator. | UIImpersonator

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined 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
|  | addElement(element:DisplayObject):DisplayObject [static] Used for Flex 4 components since addChild is not used on these components. | UIImpersonator
|  | addElementAt(element:DisplayObject, index:int):DisplayObject [static] Adds an element DisplayObject to the TestEnvironment. | UIImpersonator
|  | assertEquals(... rest):void [static] Asserts that two provided values are equal. | Assert
|  | assertFalse(... rest):void [static] Asserts that a condition is false. | Assert
|  | assertNotNull(... rest):void [static] Asserts that an object is not null. | Assert
|  | assertNull(... rest):void [static] Asserts that an object is null. | Assert
|  | assertStrictlyEquals(... rest):void [static] / Asserts that the provided values are strictly equal. | Assert
|  | assertTrue(... rest):void [static] Asserts that a condition is true. | Assert
|  | fail(failMessage:String):void [static] Fails a test with the argument message. | Assert
|  | failNotNull(message:String, object:Object):void [static] Asserts that an object is not null. | Assert
|  | failNotTrue(message:String, condition:Boolean):void [static] Asserts that a condition is not true. | Assert
|  | failNull(message:String, object:Object):void [static] Asserts that an object is not null. | Assert
|  | 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
|  | getElementAt(elementIndex:int):DisplayObject [static] Gets the nth element component object. | UIImpersonator
|  | getElementIndex(element:DisplayObject):int [static] Gets the zero-based index of a specific child. | UIImpersonator
|  | removeAllChildren():void [static] Removes all children from the child list of this container. | UIImpersonator
|  | removeAllElements():void [static] Removes all elements 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
|  | removeElement(element:DisplayObject):DisplayObject [static] Removes an element DisplayObject from the child list of the TestEnviroment. | UIImpersonator
|  | removeElementAt(index:int):DisplayObject [static] Removes an element DisplayObject from the child list of the TestEnvironment at the specified index. | UIImpersonator
|  | resetAssertionsFields():void [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

numChildren | property

`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`

testDisplay | property |

`testDisplay:Sprite` [read-only]

Returns the base display component for all components added to the impersonator. In the case of an ActionScript project, this will be a Sprite. For a Flex 3 and earlier project, this will be a Container. For a Flex 4 and beyond project, this will be a Group. The testDisplay should typically be type cast depending on the developers intent.

Implementation
`public static function get testDisplay():Sprite`
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

addElement | () | method |

`public static function addElement(element:DisplayObject):DisplayObject`

Used for Flex 4 components since addChild is not used on these components. Adds an element DisplayObject to the TestEnvironment. The element is added after other existing children, so that the first element added has index 0, the next has index 1, an so on.

Note: While the `element` argument to the method is specified as of type DisplayObject, the argument must implement the IVisualElement interface to be added as an element of a Flex 4 group. All Flex 4 components implement this interface.

Parameters

| `element:DisplayObject` — The DisplayObject to add as a element of the TestEnvironment. It must implement the IVisualElement interface.

Returns

| `DisplayObject` — The added element as an object of type DisplayObject. You typically cast the return value to IVisualElement, or to the type of the added component.

See also

spark.components.Group

addElementAt | () | method |

`public static function addElementAt(element:DisplayObject, index:int):DisplayObject`

Adds an element DisplayObject to the TestEnvironment. The element is added at the index specified.

Note: While the `element` argument to the method is specified as of type DisplayObject, the argument must implement the IVisualElement interface to be added as an element of TestEnvironment. All Flex 4 components implement this interface.

Parameters

| `element:DisplayObject` — The DisplayObject to add as an element of the TestEnvironment. It must implement the IVisualElement interface.
| `index:int` — The index to add the element at.

Returns

| `DisplayObject` — The added element as an object of type DisplayObject. You typically cast the return value to IVisualElement, or to the type of the added component.

See also

spark.components.Group

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).

getElementAt | () | method |

`public static function getElementAt(elementIndex:int):DisplayObject`

Gets the nth element component object.

The element returned from this method includes elements that are declared in MXML and elements that are added using the `addElement()` or `addElementAt()` method.

Parameters

| `elementIndex:int` — Number from 0 to (numChildren - 1).

Returns

| `DisplayObject` — Reference to the element 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.

getElementIndex | () | method |

`public static function getElementIndex(element:DisplayObject):int`

Gets the zero-based index of a specific child.

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

If you add a element by calling the `addElement()` method, the new element's index is equal to the largest index among existing elements plus one. You can insert an element at a specified index by using the `addElementAt()` method; in that case the indices of the element previously at that index, and the elements 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 an element by calling `removeElement()` or `removeelementAt()` method, then the indices of the remaining elements are adjusted so that all indices fall in the range from 0 to `(numChildren - 1)`.

If `myView.getElementIndex(myChild)` returns 5, then `myView.getElementAt(5)` returns myElement.

Parameters

| `element:DisplayObject` — Reference to element 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.

removeAllElements | () | method |

`public static function removeAllElements():void`

Removes all elements 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.

removeElement | () | method |

`public static function removeElement(element:DisplayObject):DisplayObject`

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

Parameters

| `element:DisplayObject` — The DisplayObject to remove.

Returns

| `DisplayObject` — The removed element as an object of type DisplayObject. You typically cast the return value to UIComponent, or to the type of the removed component.

removeElementAt | () | method |

`public static function removeElementAt(index:int):DisplayObject`

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

Parameters

| `index:int` — The element index of the DisplayObject to remove.

Returns

| `DisplayObject` — The removed element 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).

Thu Apr 10 2014, 08:07 AM +10:00