Quantcast
Channel: Adobe Community: Message List - FlexUnit Development
Viewing all articles
Browse latest Browse all 104

Re: how to access stage in flexunit

$
0
0

I found this BDD project page, which includes a stage access example:

Cuke4AS3 https://github.com/flashquartermaster/Cuke4AS3/

 

[EDIT]

After much research and complication, I ended up using a Singleton that provides a stage reference that was passed in from a `creationComplete` handler in my TestRunner.

 

=======TestRunner.mxml==========================================

 

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"

    creationComplete="onCreationComplete()"

    xmlns:flexUnitUIRunner="http://www.adobe.com/2009/flexUnitUIRunner"

    styleName="flexUnitApplication"

    layout="absolute" height="800" width="1000">

    <mx:Script>

        <![CDATA[

            import org.flexunit.runner.FlexUnitCore;

            private var core:FlexUnitCore;

            public function onCreationComplete():void {

                core = new FlexUnitCore();

                core.addListener( new TraceListener() );

                core.addListener( new UIListener( uiListener ));

                new StageLocator(systemManager.stage);

                core.run(MyTestSuite);

            }

        ]]>

    </mx:Script>

    <mx:Style>

        Application {

               backgroundColor: #3872b2;

               backgroundGradientColors: #3872b2, #0c1a3d;

               backgroundGradientAlphas: 1, 1;

               themeColor: #ffffff;

               color: #444444;

               fontFamily: "Myriad Pro Semibold";

               fontSize: 12;

            }

    </mx:Style>

    <flexUnitUIRunner:TestRunnerBase id="uiListener" width="100%" height="100%" />

</mx:Application>

 

=======StageLocator.as==========================================

 

package {

import flash.display.Stage;

public class StageLocator {

    public static var instance:StageLocator;

    public static var stage:Stage;

    public function StageLocator ($stage:Stage) {

        instance = this;

        stage = $stage;

    }

}

}


Viewing all articles
Browse latest Browse all 104

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>