I am running FlexUnit tests through Ant. The test test1
fails with the message "Timeout Occurred before expected event" but test2
passes. The only difference between the two tests is that one uses UIImpersonator.addChild()
whereas the other uses FlexGlobals.topLevelApplication.addElement()
.
test1
fails even if I listen for "addedToStage"
event. Listening for "added"
event, however, makes test1
pass.
[Test(async, ui, description="Fails")]
public function test1():void
{
var c:UIComponent = new UIComponent;
Async.proceedOnEvent(this, c, FlexEvent.CREATION_COMPLETE);
UIImpersonator.addChild(c);
}
[Test(async, ui, description="Passes")]
public function test2():void
{
var c:UIComponent = new UIComponent;
Async.proceedOnEvent(this, c, FlexEvent.CREATION_COMPLETE);
FlexGlobals.topLevelApplication.addElement(c);
}