Quantcast
Channel: Adobe Community : Popular Discussions - FlexUnit
Viewing all articles
Browse latest Browse all 25673

proceedOnEvent() timeout waiting for creationComplete

$
0
0

Hello,

 

I have a test case that will not run due to proceedOnEvent not seeing the desired event.  Here's the test code:

 

package com.mine.components.buttonBar

{

          import flexunit.framework.Assert;

 

          import mx.collections.ArrayList;

          import mx.core.FlexGlobals;

          import mx.events.FlexEvent;

 

          import org.flexunit.async.Async;

          import org.fluint.uiImpersonation.UIImpersonator;

          import org.hamcrest.assertThat;

          import org.hamcrest.collection.hasItems;

          import org.hamcrest.object.equalTo;

          import org.hamcrest.object.notNullValue;

 

          public class ButtonBarTest

          {

                    private var buttonBar: ButtonBar;

 

                    private var buttonData: Array = [{label: "one"  },{label: "two"},{label: "three"},{label: "four"},{label: "five"}];

 

 

                    [Before(async, ui)]

                    public function setUp():void

                    {

                              buttonBar = new ButtonBar();

                              buttonBar.dataProvider = new ArrayList( buttonData );

 

                              Async.proceedOnEvent( this, buttonBar, FlexEvent.CREATION_COMPLETE, 3000 );

                              UIImpersonator.addChild( buttonBar );

                    }

 

                    [After(async,ui)]

                    public function tearDown():void

                    {

                              UIImpersonator.removeChild( buttonBar );

                              buttonBar.dataProvider = null;

                              buttonBar = null;

                    }

 

                    [BeforeClass]

                    public static function setUpBeforeClass():void

                    {

                    }

 

                    [AfterClass]

                    public static function tearDownAfterClass():void

                    {

                    }

 

                    [Test(async, ui)]

                    public function testGet_selectedIndices():void

                    {

                              assertThat( buttonBar, notNullValue() );

                              var selectedIndices: Vector.<int> = buttonBar.selectedIndices;

                              assertThat( selectedIndices, notNullValue() );

                              assertThat( selectedIndices, equalTo( 0 ) );

                              buttonBar.selectedIndices = new Vector.<int>( 0, 2, 4 );

                              assertThat( buttonBar.selectedIndices, hasItems( 0, 2, 4 ) );

                    }

          }

}

 

I can run the test within flashbuilder or from ant using a test runner and I get the same result.

 

The button bar component is derived from spark.components.SkinnableDataContainer and has its own skin.  Buttons are added to a DataGroup, one button for each dataProvider element.  The buttons and data group are added by the skin classes associated with the button bar.

I am using flexunit-4.1.0-8-4.1.016076.

 

I'd really appreciate some help in getting this test case to work correctly.

 

Thanks,

Jeff


Viewing all articles
Browse latest Browse all 25673

Trending Articles