You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2014/03/25 16:46:49 UTC

[1/2] git commit: [flex-asjs] [refs/heads/develop] - add our very first flexunit tests for flexjsjx and flexjsui. More tests needed

Repository: flex-asjs
Updated Branches:
  refs/heads/develop 2380008e2 -> a0bd0cd54


add our very first flexunit tests for flexjsjx and flexjsui.  More tests needed


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/a0bd0cd5
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/a0bd0cd5
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/a0bd0cd5

Branch: refs/heads/develop
Commit: a0bd0cd543d21b4e2eb94d095b8407332629c62b
Parents: a5d74b3
Author: Alex Harui <ah...@apache.org>
Authored: Tue Mar 25 08:46:30 2014 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Mar 25 08:46:42 2014 -0700

----------------------------------------------------------------------
 frameworks/as/projects/FlexJSJX/build.xml       |   1 +
 .../tests/FlexUnitFlexJSApplication.mxml        |  30 +++++
 frameworks/as/projects/FlexJSJX/tests/build.xml | 133 +++++++++++++++++++
 .../tests/flexUnitTests/DataGridColumnTester.as |   9 ++
 .../flexUnitTests/DataGridColumnTesterTest.as   |  37 ++++++
 frameworks/as/projects/FlexJSUI/build.xml       |   1 +
 .../tests/FlexUnitFlexJSApplication.mxml        |  30 +++++
 frameworks/as/projects/FlexJSUI/tests/build.xml | 133 +++++++++++++++++++
 .../tests/flexUnitTests/StrandTester.as         |   9 ++
 .../tests/flexUnitTests/StrandTesterTest.as     |  37 ++++++
 10 files changed, 420 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a0bd0cd5/frameworks/as/projects/FlexJSJX/build.xml
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/build.xml b/frameworks/as/projects/FlexJSJX/build.xml
index 4fab5e1..1cb8d23 100644
--- a/frameworks/as/projects/FlexJSJX/build.xml
+++ b/frameworks/as/projects/FlexJSJX/build.xml
@@ -29,6 +29,7 @@
     <property name="FALCON_HOME" value="${env.FALCON_HOME}"/>
 
     <target name="main" depends="clean,compile" description="Clean build of FlexJSJX.swc">
+        <ant dir="tests" />
     </target>
     
     <target name="clean">

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a0bd0cd5/frameworks/as/projects/FlexJSJX/tests/FlexUnitFlexJSApplication.mxml
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/tests/FlexUnitFlexJSApplication.mxml b/frameworks/as/projects/FlexJSJX/tests/FlexUnitFlexJSApplication.mxml
new file mode 100644
index 0000000..d4acdae
--- /dev/null
+++ b/frameworks/as/projects/FlexJSJX/tests/FlexUnitFlexJSApplication.mxml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!-- This is an auto generated file and is not intended for modification. -->
+
+<basic:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+                   xmlns:basic="library://ns.apache.org/flexjs/basic" 
+                   applicationComplete="runTests()"
+                   >
+    <fx:Script>
+        <![CDATA[
+            import flexUnitTests.DataGridColumnTesterTest;
+            import flexUnitTests.DataGridColumnTester;
+            
+            import org.flexunit.listeners.CIListener;
+            import org.flexunit.runner.FlexUnitCore;
+            
+            public function runTests() : void
+            {
+                var core : FlexUnitCore = new FlexUnitCore();
+                core.addListener(new CIListener());
+                core.run(DataGridColumnTester);
+            }
+            
+        ]]>
+    </fx:Script>
+    <basic:valuesImpl>
+        <basic:SimpleValuesImpl />
+    </basic:valuesImpl>
+
+</basic:Application>

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a0bd0cd5/frameworks/as/projects/FlexJSJX/tests/build.xml
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/tests/build.xml b/frameworks/as/projects/FlexJSJX/tests/build.xml
new file mode 100644
index 0000000..9f78b53
--- /dev/null
+++ b/frameworks/as/projects/FlexJSJX/tests/build.xml
@@ -0,0 +1,133 @@
+<?xml version="1.0"?>
+<!--
+
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+-->
+
+
+<project name="flexjsjx.test" default="main" basedir=".">
+    <property name="FLEXJS_HOME" location="../../../../.."/>
+    
+    <property file="${FLEXJS_HOME}/env.properties"/>
+    <property environment="env"/>
+    <property file="${FLEXJS_HOME}/build.properties"/>
+    <property name="FLEX_HOME" value="${env.FLEX_HOME}"/>
+    <property name="FALCON_HOME" value="${env.FALCON_HOME}"/>
+    <property name="browser" value="/Applications/Safari.app/Contents/MacOS/Safari" />
+    <property name="report.dir" value="${basedir}/out" />
+    
+    <available file="${FLEXJS_HOME}/../flex-flexunit"
+        type="dir"
+        property="FLEXUNIT_HOME"
+        value="${FLEXJS_HOME}/../flex-flexunit" />
+    
+    <available file="${FLEXJS_HOME}/../flexunit"
+        type="dir"
+        property="FLEXUNIT_HOME"
+        value="${FLEXJS_HOME}/../flexunit" />
+	
+    <available file="${env.FLEXUNIT_HOME}"
+        type="dir"
+        property="FLEXUNIT_HOME"
+        value="${env.FLEXUNIT_HOME}"/>
+
+    <target name="main" depends="clean,compile,test" description="Clean test of FlexJSUI.swc">
+    </target>
+    
+    <target name="clean">
+        <delete failonerror="false">
+            <fileset dir="${basedir}">
+                <include name="FlexUnitFlexJSApplication.swf"/>
+            </fileset>
+        </delete>
+    </target>
+    
+    <path id="lib.path">
+      <fileset dir="${FALCON_HOME}/lib" includes="falcon-flexTasks.jar"/>
+    </path>
+
+    <target name="compile" description="Compiles FlexUnitApplication.swf">
+        <echo message="Compiling FlexUnitFlexJSApplication.swf"/>
+        <echo message="FLEX_HOME: ${FLEX_HOME}"/>
+        <echo message="FALCON_HOME: ${FALCON_HOME}"/>
+        <echo message="FLEXUNIT_HOME: ${FLEXUNIT_HOME}"/>
+
+        <!-- Load the <compc> task. We can't do this at the <project> level -->
+        <!-- because targets that run before flexTasks.jar gets built would fail. -->
+        <taskdef resource="flexTasks.tasks" classpathref="lib.path"/>
+        <!--
+            Link in the classes (and their dependencies) for the MXML tags
+            listed in this project's manifest.xml.
+            Also link the additional classes (and their dependencies)
+            listed in FlexJSUIClasses.as,
+            because these aren't referenced by the manifest classes.
+            Keep the standard metadata when compiling.
+            Include the appropriate CSS files and assets in the SWC.
+            Don't include any resources in the SWC.
+            Write a bundle list of referenced resource bundles
+            into the file bundles.properties in this directory.
+        -->
+        <mxmlc fork="true"
+            file="${basedir}/FlexUnitFlexJSApplication.mxml"
+            output="${basedir}/FlexUnitFlexJSApplication.swf">
+            <jvmarg line="${mxmlc.jvm.args}"/>
+            <arg value="+flexlib=${FLEXJS_HOME}/frameworks" />
+            <arg value="-debug" />
+            <arg value="-compiler.mxml.children-as-data" />
+            <arg value="-compiler.binding-value-change-event=org.apache.flex.events.ValueChangeEvent" />
+            <arg value="-compiler.binding-value-change-event-kind=org.apache.flex.events.ValueChangeEvent" />
+            <arg value="-compiler.binding-value-change-event-type=valueChange" />
+            <arg value="+playerglobal.version=${playerglobal.version}" />
+            <arg value="+env.PLAYERGLOBAL_HOME=${env.PLAYERGLOBAL_HOME}" />
+            <arg value="-source-path+=${FLEXJS_HOME}/frameworks/as/projects/FlexJSJX/src" />
+            <arg value="-library-path+=${FLEXJS_HOME}/frameworks/as/libs" />
+            <arg value="-library-path+=${FLEXUNIT_HOME}/FlexUnit4/target" />
+            <arg value="-library-path+=${FLEXUNIT_HOME}/FlexUnit4CIListener/target" />
+        </mxmlc>
+    </target>
+
+    <target name="test">
+        <taskdef resource="flexUnitTasks.tasks">
+            <classpath>
+                <fileset dir="${FLEXUNIT_HOME}/FlexUnit4AntTasks/target">
+                    <include name="flexUnitTasks*.jar" />
+                </fileset>
+            </classpath>
+        </taskdef>
+		<mkdir dir="${report.dir}" />
+		<flexunit
+            swf="${basedir}/FlexUnitFlexJSApplication.swf"
+		    workingDir="${basedir}"
+		    toDir="${report.dir}"
+			haltonfailure="false"
+			verbose="true"
+			localTrusted="true"
+			command="${browser}">
+            <source dir="${FLEXJS_HOME}/frameworks/as/projects/FlexJSJX/src" />
+            <library dir="${FLEXJS_HOME}/frameworks/as/libs" />
+        </flexunit>
+        
+		<!-- Generate readable JUnit-style reports -->
+		<junitreport todir="${report.dir}">
+			<fileset dir="${report.dir}">
+				<include name="TEST-*.xml" />
+			</fileset>
+			<report format="frames" todir="${report.dir}/html" />
+		</junitreport>
+        
+    </target>
+</project>

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a0bd0cd5/frameworks/as/projects/FlexJSJX/tests/flexUnitTests/DataGridColumnTester.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/tests/flexUnitTests/DataGridColumnTester.as b/frameworks/as/projects/FlexJSJX/tests/flexUnitTests/DataGridColumnTester.as
new file mode 100644
index 0000000..038dae2
--- /dev/null
+++ b/frameworks/as/projects/FlexJSJX/tests/flexUnitTests/DataGridColumnTester.as
@@ -0,0 +1,9 @@
+package flexUnitTests
+{
+    [Suite]
+    [RunWith("org.flexunit.runners.Suite")]
+    public class DataGridColumnTester
+    {
+        public var dataGridColumnTesterTest:DataGridColumnTesterTest;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a0bd0cd5/frameworks/as/projects/FlexJSJX/tests/flexUnitTests/DataGridColumnTesterTest.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/tests/flexUnitTests/DataGridColumnTesterTest.as b/frameworks/as/projects/FlexJSJX/tests/flexUnitTests/DataGridColumnTesterTest.as
new file mode 100644
index 0000000..9720119
--- /dev/null
+++ b/frameworks/as/projects/FlexJSJX/tests/flexUnitTests/DataGridColumnTesterTest.as
@@ -0,0 +1,37 @@
+package flexUnitTests
+{
+    import flexunit.framework.Assert;
+    
+    import org.apache.flex.html.staticControls.supportClasses.DataGridColumn;
+    
+    public class DataGridColumnTesterTest
+    {		
+        [Before]
+        public function setUp():void
+        {
+        }
+        
+        [After]
+        public function tearDown():void
+        {
+        }
+        
+        [BeforeClass]
+        public static function setUpBeforeClass():void
+        {
+        }
+        
+        [AfterClass]
+        public static function tearDownAfterClass():void
+        {
+        }
+        
+        [Test]
+        public function testLabelProperty():void
+        {
+            var column:DataGridColumn = new DataGridColumn();
+            column.label = "foo";
+            Assert.assertEquals("Error testing DataGridColumn.label", column.label, "foo");
+        }        
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a0bd0cd5/frameworks/as/projects/FlexJSUI/build.xml
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/build.xml b/frameworks/as/projects/FlexJSUI/build.xml
index 2ef20e6..9470db3 100644
--- a/frameworks/as/projects/FlexJSUI/build.xml
+++ b/frameworks/as/projects/FlexJSUI/build.xml
@@ -29,6 +29,7 @@
     <property name="FALCON_HOME" value="${env.FALCON_HOME}"/>
 
     <target name="main" depends="clean,compile" description="Clean build of FlexJSUI.swc">
+        <ant dir="tests" />
     </target>
     
     <target name="clean">

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a0bd0cd5/frameworks/as/projects/FlexJSUI/tests/FlexUnitFlexJSApplication.mxml
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/tests/FlexUnitFlexJSApplication.mxml b/frameworks/as/projects/FlexJSUI/tests/FlexUnitFlexJSApplication.mxml
new file mode 100644
index 0000000..d1a9ace
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/tests/FlexUnitFlexJSApplication.mxml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!-- This is an auto generated file and is not intended for modification. -->
+
+<basic:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+                   xmlns:basic="library://ns.apache.org/flexjs/basic" 
+                   applicationComplete="runTests()"
+                   >
+    <fx:Script>
+        <![CDATA[
+            import flexUnitTests.StrandTesterTest;
+            import flexUnitTests.StrandTester;
+            
+            import org.flexunit.listeners.CIListener;
+            import org.flexunit.runner.FlexUnitCore;
+            
+            public function runTests() : void
+            {
+                var core : FlexUnitCore = new FlexUnitCore();
+                core.addListener(new CIListener());
+                core.run(StrandTester);
+            }
+            
+        ]]>
+    </fx:Script>
+    <basic:valuesImpl>
+        <basic:SimpleValuesImpl />
+    </basic:valuesImpl>
+
+</basic:Application>

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a0bd0cd5/frameworks/as/projects/FlexJSUI/tests/build.xml
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/tests/build.xml b/frameworks/as/projects/FlexJSUI/tests/build.xml
new file mode 100644
index 0000000..7a885d8
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/tests/build.xml
@@ -0,0 +1,133 @@
+<?xml version="1.0"?>
+<!--
+
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+-->
+
+
+<project name="flexjsui.test" default="main" basedir=".">
+    <property name="FLEXJS_HOME" location="../../../../.."/>
+    
+    <property file="${FLEXJS_HOME}/env.properties"/>
+    <property environment="env"/>
+    <property file="${FLEXJS_HOME}/build.properties"/>
+    <property name="FLEX_HOME" value="${env.FLEX_HOME}"/>
+    <property name="FALCON_HOME" value="${env.FALCON_HOME}"/>
+    <property name="browser" value="/Applications/Safari.app/Contents/MacOS/Safari" />
+    <property name="report.dir" value="${basedir}/out" />
+    
+    <available file="${FLEXJS_HOME}/../flex-flexunit"
+        type="dir"
+        property="FLEXUNIT_HOME"
+        value="${FLEXJS_HOME}/../flex-flexunit" />
+    
+    <available file="${FLEXJS_HOME}/../flexunit"
+        type="dir"
+        property="FLEXUNIT_HOME"
+        value="${FLEXJS_HOME}/../flexunit" />
+	
+    <available file="${env.FLEXUNIT_HOME}"
+        type="dir"
+        property="FLEXUNIT_HOME"
+        value="${env.FLEXUNIT_HOME}"/>
+    
+    <target name="main" depends="clean,compile,test" description="Clean test of FlexJSUI.swc">
+    </target>
+    
+    <target name="clean">
+        <delete failonerror="false">
+            <fileset dir="${basedir}">
+                <include name="FlexUnitFlexJSApplication.swf"/>
+            </fileset>
+        </delete>
+    </target>
+    
+    <path id="lib.path">
+      <fileset dir="${FALCON_HOME}/lib" includes="falcon-flexTasks.jar"/>
+    </path>
+
+    <target name="compile" description="Compiles FlexUnitApplication.swf">
+        <echo message="Compiling FlexUnitFlexJSApplication.swf"/>
+        <echo message="FLEX_HOME: ${FLEX_HOME}"/>
+        <echo message="FALCON_HOME: ${FALCON_HOME}"/>
+        <echo message="FLEXUNIT_HOME: ${FLEXUNIT_HOME}"/>
+
+        <!-- Load the <compc> task. We can't do this at the <project> level -->
+        <!-- because targets that run before flexTasks.jar gets built would fail. -->
+        <taskdef resource="flexTasks.tasks" classpathref="lib.path"/>
+        <!--
+            Link in the classes (and their dependencies) for the MXML tags
+            listed in this project's manifest.xml.
+            Also link the additional classes (and their dependencies)
+            listed in FlexJSUIClasses.as,
+            because these aren't referenced by the manifest classes.
+            Keep the standard metadata when compiling.
+            Include the appropriate CSS files and assets in the SWC.
+            Don't include any resources in the SWC.
+            Write a bundle list of referenced resource bundles
+            into the file bundles.properties in this directory.
+        -->
+        <mxmlc fork="true"
+            file="${basedir}/FlexUnitFlexJSApplication.mxml"
+            output="${basedir}/FlexUnitFlexJSApplication.swf">
+            <jvmarg line="${mxmlc.jvm.args}"/>
+            <arg value="+flexlib=${FLEXJS_HOME}/frameworks" />
+            <arg value="-debug" />
+            <arg value="-compiler.mxml.children-as-data" />
+            <arg value="-compiler.binding-value-change-event=org.apache.flex.events.ValueChangeEvent" />
+            <arg value="-compiler.binding-value-change-event-kind=org.apache.flex.events.ValueChangeEvent" />
+            <arg value="-compiler.binding-value-change-event-type=valueChange" />
+            <arg value="+playerglobal.version=${playerglobal.version}" />
+            <arg value="+env.PLAYERGLOBAL_HOME=${env.PLAYERGLOBAL_HOME}" />
+            <arg value="-source-path+=${FLEXJS_HOME}/frameworks/as/projects/FlexJSUI/src" />
+            <arg value="-library-path+=${FLEXJS_HOME}/frameworks/as/libs" />
+            <arg value="-library-path+=${FLEXUNIT_HOME}/FlexUnit4/target" />
+            <arg value="-library-path+=${FLEXUNIT_HOME}/FlexUnit4CIListener/target" />
+        </mxmlc>
+    </target>
+
+    <target name="test">
+        <taskdef resource="flexUnitTasks.tasks">
+            <classpath>
+                <fileset dir="${FLEXUNIT_HOME}/FlexUnit4AntTasks/target">
+                    <include name="flexUnitTasks*.jar" />
+                </fileset>
+            </classpath>
+        </taskdef>
+		<mkdir dir="${report.dir}" />
+		<flexunit
+            swf="${basedir}/FlexUnitFlexJSApplication.swf"
+		    workingDir="${basedir}"
+		    toDir="${report.dir}"
+			haltonfailure="false"
+			verbose="true"
+			localTrusted="true"
+			command="${browser}">
+            <source dir="${FLEXJS_HOME}/frameworks/as/projects/FlexJSUI/src" />
+            <library dir="${FLEXJS_HOME}/frameworks/as/libs" />
+        </flexunit>
+        
+		<!-- Generate readable JUnit-style reports -->
+		<junitreport todir="${report.dir}">
+			<fileset dir="${report.dir}">
+				<include name="TEST-*.xml" />
+			</fileset>
+			<report format="frames" todir="${report.dir}/html" />
+		</junitreport>
+        
+    </target>
+</project>

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a0bd0cd5/frameworks/as/projects/FlexJSUI/tests/flexUnitTests/StrandTester.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/tests/flexUnitTests/StrandTester.as b/frameworks/as/projects/FlexJSUI/tests/flexUnitTests/StrandTester.as
new file mode 100644
index 0000000..a4f2dfe
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/tests/flexUnitTests/StrandTester.as
@@ -0,0 +1,9 @@
+package flexUnitTests
+{
+    [Suite]
+    [RunWith("org.flexunit.runners.Suite")]
+    public class StrandTester
+    {
+        public var strandTesterTest:StrandTesterTest;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a0bd0cd5/frameworks/as/projects/FlexJSUI/tests/flexUnitTests/StrandTesterTest.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/tests/flexUnitTests/StrandTesterTest.as b/frameworks/as/projects/FlexJSUI/tests/flexUnitTests/StrandTesterTest.as
new file mode 100644
index 0000000..23a2a87
--- /dev/null
+++ b/frameworks/as/projects/FlexJSUI/tests/flexUnitTests/StrandTesterTest.as
@@ -0,0 +1,37 @@
+package flexUnitTests
+{
+    import flexunit.framework.Assert;
+    
+    import org.apache.flex.core.Strand;
+    
+    public class StrandTesterTest
+    {		
+        [Before]
+        public function setUp():void
+        {
+        }
+        
+        [After]
+        public function tearDown():void
+        {
+        }
+        
+        [BeforeClass]
+        public static function setUpBeforeClass():void
+        {
+        }
+        
+        [AfterClass]
+        public static function tearDownAfterClass():void
+        {
+        }
+        
+        [Test]
+        public function testIdProperty():void
+        {
+            var strand:Strand = new Strand();
+            strand.id = "foo";
+            Assert.assertEquals("Error testing Srand.id", strand.id, "foo");
+        }        
+    }
+}
\ No newline at end of file


[2/2] git commit: [flex-asjs] [refs/heads/develop] - make application a little more tolerant so it can be used in flexunit tests

Posted by ah...@apache.org.
make application a little more tolerant so it can be used in flexunit tests


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/a5d74b31
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/a5d74b31
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/a5d74b31

Branch: refs/heads/develop
Commit: a5d74b31c34433282913c5980b470566d117753c
Parents: 2380008
Author: Alex Harui <ah...@apache.org>
Authored: Tue Mar 25 08:45:45 2014 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Mar 25 08:46:42 2014 -0700

----------------------------------------------------------------------
 .../src/org/apache/flex/core/Application.as     | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a5d74b31/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/Application.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/Application.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/Application.as
index 80e3961..ce76df5 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/Application.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/Application.as
@@ -58,6 +58,17 @@ package org.apache.flex.core
     [Event(name="viewChanged", type="org.apache.flex.events.Event")]
     
     /**
+     *  Dispatched at startup after the initial view has been
+     *  put on the display list.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 10.2
+     *  @playerversion AIR 2.6
+     *  @productversion FlexJS 0.0
+     */
+    [Event(name="applicationComplete", type="org.apache.flex.events.Event")]
+
+    /**
      *  The Application class is the main class and entry point for a FlexJS
      *  application.  This Application class is different than the
      *  Flex SDK's mx:Application or spark:Application in that it does not contain
@@ -112,9 +123,12 @@ package org.apache.flex.core
 
             dispatchEvent(new Event("initialize"));
 
-            initialView.applicationModel =  model;
-    	    this.addElement(initialView);
-    	    dispatchEvent(new Event("viewChanged"));
+            if (initialView)
+            {
+                initialView.applicationModel =  model;
+        	    this.addElement(initialView);
+                dispatchEvent(new Event("viewChanged"));
+            }
             dispatchEvent(new Event("applicationComplete"));
         }