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 <[email protected]> Authored: Tue Mar 25 08:46:30 2014 -0700 Committer: Alex Harui <[email protected]> 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
