You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by gr...@apache.org on 2019/10/06 21:14:33 UTC
[royale-asjs] 01/04: Porting latest TDD tests across to RoyaleUnit.
This is an automated email from the ASF dual-hosted git repository.
gregdove pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
commit 2c7287b42c2b83777d0505afe4f3bb79ac3bf172
Author: greg-dove <gr...@gmail.com>
AuthorDate: Sun Oct 6 19:28:06 2019 +1300
Porting latest TDD tests across to RoyaleUnit.
---
.../src/main/resources/jewel-example-styles.css | 6 -
frameworks/build.xml | 5 +
.../CollectionsJS/src/test/royale/build.xml | 192 ++++++++++++
frameworks/projects/Collections/build.xml | 11 +-
.../royale/FlexUnitRoyaleApplication-config.xml | 105 +++++++
.../src/test/royale/FlexUnitRoyaleApplication.mxml | 82 ++++++
.../projects/Collections/src/test/royale/build.xml | 115 ++++++++
.../royale/flexUnitTests/CollectionsTester.as} | 24 +-
.../language/LanguageTesterTestArraylikeGetSet.as | 63 ++--
.../language/LanguageTesterTestForEach.as | 201 +++++++++++++
.../language/support/checkArrayLikeFunc.as} | 29 +-
.../src/test/royale/flexUnitTests/NetworkTester.as | 11 +-
.../network/URLVariablesTesterTest.as | 121 ++++++++
.../XML/src/test/royale/flexUnitTests/XMLTester.as | 23 +-
.../flexUnitTests/xml/XMLNamespaceClassTest.as | 142 +++++++++
.../royale/flexUnitTests/xml/XMLNamespaceTest.as | 325 ++++++++++++++++++---
.../test/royale/flexUnitTests/xml/XMLQNameTest.as | 303 +++++++++++++++++++
.../flexUnitTests/xml/XMLTesterGeneralTest.as | 82 ++++--
.../flexUnitTests/xml/XMLTesterNamespaceQueries.as | 207 +++++++++++++
.../flexUnitTests/xml/XMLTesterStringifyTest.as | 28 +-
.../flexUnitTests/xml/support/NamespaceTest.as | 193 ++++++++++++
.../royale/flexUnitTests/xml/support/QNameTest.as | 97 ++++++
.../src/main/royale/flexUnitTests/XMLTester.as | 4 +-
.../language/LanguageTesterTestArraylikeGetSet.as | 8 +-
.../flexUnitTests/xml/XMLTesterGeneralTest.as | 4 +
25 files changed, 2213 insertions(+), 168 deletions(-)
diff --git a/examples/royale/TourDeJewel/src/main/resources/jewel-example-styles.css b/examples/royale/TourDeJewel/src/main/resources/jewel-example-styles.css
index fabdcdb..9471b35 100644
--- a/examples/royale/TourDeJewel/src/main/resources/jewel-example-styles.css
+++ b/examples/royale/TourDeJewel/src/main/resources/jewel-example-styles.css
@@ -112,9 +112,6 @@
.navigation-section-group{
IItemRenderer: ClassReference("itemRenderers.NavigationIconLinkItemRenderer");
}
-/* .navigation-section-group .navigationlink{
- background-color:rgba(56, 172, 241, 0.31);
-} */
.navSectionItemRenderer{
IItemRenderer: ClassReference("itemRenderers.NavigationGroupExampleItemRenderer");
@@ -123,7 +120,4 @@
{
margin-right: 24px;
}
-/* .navSectionItemRenderer.jewel.navigation{
- background-color: aliceblue;
-} */
diff --git a/frameworks/build.xml b/frameworks/build.xml
index 5c9a998..e3c5a47 100644
--- a/frameworks/build.xml
+++ b/frameworks/build.xml
@@ -154,6 +154,7 @@
<antcall target="ReflectionTest"/>
<antcall target="NetworkTest"/>
<antcall target="XMLTest"/>
+ <antcall target="CollectionsTest"/>
</target>
<target name="fonts">
@@ -261,6 +262,10 @@
<ant dir="${basedir}/projects/Collections"/>
</target>
+ <target name="CollectionsTest" description="Test of Collections.swc">
+ <ant dir="${basedir}/projects/Collections" target="test"/>
+ </target>
+
<target name="CreateJS" description="Clean build of CreateJS.swc">
<ant dir="${basedir}/projects/CreateJS"/>
</target>
diff --git a/frameworks/js/projects/CollectionsJS/src/test/royale/build.xml b/frameworks/js/projects/CollectionsJS/src/test/royale/build.xml
new file mode 100644
index 0000000..6e20c38
--- /dev/null
+++ b/frameworks/js/projects/CollectionsJS/src/test/royale/build.xml
@@ -0,0 +1,192 @@
+<?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="CoreJS.test" default="main" basedir=".">
+ <property name="ROYALE_HOME" location="../../../../../../.."/>
+
+ <property file="${ROYALE_HOME}/env.properties"/>
+ <property environment="env"/>
+ <property file="${ROYALE_HOME}/build.properties"/>
+ <property name="ROYALE_HOME" value="${env.ROYALE_HOME}"/>
+ <property name="ROYALE_SWF_COMPILER_HOME" value="${env.ROYALE_SWF_COMPILER_HOME}"/>
+ <property name="target.name" value="CoreJS-${release.version}.swc" />
+
+ <!--
+ Windows browser:
+ try chrome first because it's the most popular browser
+ otherwise, try to fall back to firefox
+ DON'T use internet explorer! it cannot run scripts in local pages
+ -->
+ <condition property="royaleunit.browser" value="${env.ProgramFiles}/Google/Chrome/Application/chrome.exe">
+ <and>
+ <os family="windows"/>
+ <available file="${env.ProgramFiles}/Google/Chrome/Application/chrome.exe"/>
+ </and>
+ </condition>
+ <condition property="royaleunit.browser" value="${env.ProgramFiles(x86)}/Google/Chrome/Application/chrome.exe">
+ <and>
+ <os family="windows"/>
+ <available file="${env.ProgramFiles(x86)}/Google/Chrome/Application/chrome.exe"/>
+ </and>
+ </condition>
+ <condition property="royaleunit.browser" value="${env.ProgramFiles}/Mozilla Firefox/firefox.exe">
+ <and>
+ <os family="windows"/>
+ <available file="${env.ProgramFiles}/Mozilla Firefox/firefox.exe"/>
+ </and>
+ </condition>
+ <condition property="royaleunit.browser" value="${env.ProgramFiles(x86)}/Mozilla Firefox/firefox.exe">
+ <and>
+ <os family="windows"/>
+ <available file="${env.ProgramFiles(x86)}/Mozilla Firefox/firefox.exe"/>
+ </and>
+ </condition>
+
+ <!--
+ macOS browser:
+ try chrome first because it's the most popular browser
+ otherwise, try to fall back to firefox
+ DON'T use safari! it asks the user to confirm opening local pages
+ -->
+ <condition property="royaleunit.browser" value="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome">
+ <and>
+ <os family="mac"/>
+ <available file="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"/>
+ </and>
+ </condition>
+ <condition property="royaleunit.browser" value="/Applications/Firefox.app/Contents/MacOS/firefox">
+ <and>
+ <os family="mac"/>
+ <available file="/Applications/Firefox.app/Contents/MacOS/firefox"/>
+ </and>
+ </condition>
+
+ <!--
+ Linux/Unix browser
+ -->
+ <condition property="royaleunit.browser" value="/usr/bin/firefox">
+ <and>
+ <os family="unix"/>
+ <available file="/usr/bin/firefox"/>
+ </and>
+ </condition>
+
+ <property name="report.dir" value="${basedir}/out" />
+
+ <target name="main" depends="clean,compile,test" description="Clean test of ${target.name}">
+ </target>
+
+ <target name="clean">
+ <delete failonerror="false" includeemptydirs="true">
+ <fileset dir="${basedir}/target">
+ <include name="**/**"/>
+ </fileset>
+ </delete>
+ <delete failonerror="false" includeemptydirs="true">
+ <fileset dir="${report.dir}">
+ <include name="**/**"/>
+ </fileset>
+ </delete>
+ </target>
+
+ <path id="lib.path">
+ <fileset dir="${ROYALE_COMPILER_HOME}/lib" includes="compiler-royaleTasks.jar"/>
+ <fileset dir="${ROYALE_COMPILER_HOME}/lib" includes="royaleUnitTasks.jar"/>
+ </path>
+
+ <target name="compile" description="Cross-compiles tests">
+ <echo message="Cross-compiling tests"/>
+ <echo message="ROYALE_HOME: ${ROYALE_HOME}"/>
+ <echo message="ROYALE_SWF_COMPILER_HOME: ${ROYALE_SWF_COMPILER_HOME}"/>
+ <echo message="playerglobal.version: ${playerglobal.version}"/>
+
+ <!-- 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 RoyaleUIClasses.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}/../../../../../../projects/Core/src/test/royale/FlexUnitRoyaleApplication.mxml">
+ <jvmarg line="${mxmlc.jvm.args}"/>
+ <!--
+ <jvmarg value="-Xdebug" />
+ <jvmarg value="-Xnoagent" />
+ <jvmarg value="-Xrunjdwp:transport=dt_socket,address=8763,server=y,suspend=y" />
+ -->
+ <arg value="-debug" />
+ <arg value="-compiler.targets=JSRoyale" />
+ <arg value="-js-output=target" />
+ <arg value="+playerglobal.version=${playerglobal.version}" />
+ <arg value="+env.PLAYERGLOBAL_HOME=${env.PLAYERGLOBAL_HOME}" />
+ </mxmlc>
+ </target>
+
+ <target name="check-royaleunit-browser" if="royaleunit.browser" unless="skip-tests">
+ <!--
+ if the royaleunit.browser property was provided manually,
+ check if the file actually exists
+ -->
+ <condition property="royaleunit.browser.exists">
+ <and>
+ <isset property="royaleunit.browser" />
+ <available file="${royaleunit.browser}" type="file" />
+ </and>
+ </condition>
+
+ <fail unless="royaleunit.browser.exists" message="Invalid royaleunit.browser path: "${royaleunit.browser}". To skip RoyaleUnit tests, use -Dskip-tests." />
+ </target>
+
+ <target name="test" depends="check-royaleunit-browser" if="royaleunit.browser.exists" unless="skip-tests">
+ <!-- Load the <royaleunit> task. We can't do this at the <project> level -->
+ <!-- because targets that run before royaleUnitTasks.jar gets built would fail. -->
+ <taskdef resource="royaleUnitTasks.tasks" classpathref="lib.path"/>
+ <mkdir dir="${report.dir}" />
+ <royaleunit
+ player="html"
+ swf="${basedir}/target/bin/js-debug/index.html"
+ command="${royaleunit.browser}"
+ workingDir="${basedir}"
+ toDir="${report.dir}"
+ haltonfailure="true"
+ verbose="true"
+ localTrusted="true"
+ timeout="90000" />
+
+ <!-- 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>
diff --git a/frameworks/projects/Collections/build.xml b/frameworks/projects/Collections/build.xml
index 16f0f10..2f52335 100644
--- a/frameworks/projects/Collections/build.xml
+++ b/frameworks/projects/Collections/build.xml
@@ -34,7 +34,7 @@
</tstamp>
<echo>swc-date is ${royale.swc-date}</echo>
- <target name="main" depends="clean,check-compiler,compile,compile-js,copy-swc,test" description="Full build of ${ant.project.name}.swc">
+ <target name="main" depends="clean,check-compiler,compile,compile-js,copy-swc" description="Full build of ${ant.project.name}.swc">
</target>
<target name="compile-js">
@@ -65,6 +65,15 @@
<target name="test" depends="check-for-tests,check-compiler" unless="skip-tests">
<ant dir="src/test/royale" />
+ <antcall target="test-js" />
+ </target>
+
+ <target name="test-js">
+ <ant dir="${ROYALE_HOME}/frameworks/js/projects/${ant.project.name}JS/" inheritAll="false" target="test">
+ <property name="ROYALE_SWF_COMPILER_HOME" value="${ROYALE_SWF_COMPILER_HOME}"/>
+ <property name="ROYALE_COMPILER_HOME" value="${ROYALE_COMPILER_HOME}"/>
+ <property name="ROYALE_HOME" value="${ROYALE_HOME}"/>
+ </ant>
</target>
<target name="clean">
diff --git a/frameworks/projects/Collections/src/test/royale/FlexUnitRoyaleApplication-config.xml b/frameworks/projects/Collections/src/test/royale/FlexUnitRoyaleApplication-config.xml
new file mode 100644
index 0000000..6d2a736
--- /dev/null
+++ b/frameworks/projects/Collections/src/test/royale/FlexUnitRoyaleApplication-config.xml
@@ -0,0 +1,105 @@
+<!--
+
+ 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.
+
+-->
+<royale-config>
+
+ <compiler>
+ <accessible>false</accessible>
+
+ <targets>
+ <target>SWF</target>
+ </targets>
+ <strict-xml>true</strict-xml>
+
+ <external-library-path>
+ <path-element>{playerglobalHome}/{targetPlayerMajorVersion}.{targetPlayerMinorVersion}/playerglobal.swc</path-element>
+ </external-library-path>
+
+ <js-external-library-path>
+ <path-element>../../../../../../js/libs/js.swc</path-element>
+ <path-element>../../../../../../js/libs/gcl.swc</path-element>
+ </js-external-library-path>
+
+ <library-path>
+ <path-element>../../../../../libs/Basic.swc</path-element>
+ <path-element>../../../../../libs/Binding.swc</path-element>
+ <path-element>../../../../../libs/Core.swc</path-element>
+ <path-element>../../../../../libs/Graphics.swc</path-element>
+ <path-element>../../../../../libs/Collections.swc</path-element>
+ <path-element>../../../../../libs/Language.swc</path-element>
+ <path-element>../../../../../libs/Reflection.swc</path-element>
+ <path-element>../../../../../libs/RoyaleUnit.swc</path-element>
+ </library-path>
+
+ <js-library-path>
+ <path-element>../../../../../js/libs/BasicJS.swc</path-element>
+ <path-element>../../../../../js/libs/BindingJS.swc</path-element>
+ <path-element>../../../../../js/libs/CoreJS.swc</path-element>
+ <path-element>../../../../../js/libs/GraphicsJS.swc</path-element>
+ <path-element>../../../../../js/libs/CollectionsJS.swc</path-element>
+ <path-element>../../../../../js/libs/LanguageJS.swc</path-element>
+ <path-element>../../../../../js/libs/ReflectionJS.swc</path-element>
+ <path-element>../../../../../js/libs/RoyaleUnitJS.swc</path-element>
+ </js-library-path>
+
+ <allow-subclass-overrides>true</allow-subclass-overrides>
+
+ <mxml>
+ <children-as-data>true</children-as-data>
+ </mxml>
+ <binding-value-change-event>org.apache.royale.events.ValueChangeEvent</binding-value-change-event>
+ <binding-value-change-event-kind>org.apache.royale.events.ValueChangeEvent</binding-value-change-event-kind>
+ <binding-value-change-event-type>valueChange</binding-value-change-event-type>
+ <fxg-base-class>flash.display.Sprite</fxg-base-class>
+
+ <keep-as3-metadata>
+ <name>Bindable</name>
+ <name>Managed</name>
+ <name>ChangeEvent</name>
+ <name>NonCommittingChangeEvent</name>
+ <name>Transient</name>
+ <name>SWFOverride</name>
+
+ <!-- RoyaleUnit -->
+ <name>Test</name>
+ <name>Before</name>
+ <name>After</name>
+ <name>BeforeClass</name>
+ <name>AfterClass</name>
+ <name>Ignore</name>
+ <name>Suite</name>
+ <name>RunWith</name>
+ </keep-as3-metadata>
+
+ <locale/>
+
+ <library-path/>
+
+ <namespaces>
+ <namespace>
+ <uri>library://ns.apache.org/royale/basic</uri>
+ <manifest>../../main/resources/basic-manifest.xml</manifest>
+ </namespace>
+ </namespaces>
+
+ <warn-no-constructor>false</warn-no-constructor>
+ </compiler>
+
+ <target-player>${playerglobal.version}</target-player>
+
+</royale-config>
diff --git a/frameworks/projects/Collections/src/test/royale/FlexUnitRoyaleApplication.mxml b/frameworks/projects/Collections/src/test/royale/FlexUnitRoyaleApplication.mxml
new file mode 100644
index 0000000..327e710
--- /dev/null
+++ b/frameworks/projects/Collections/src/test/royale/FlexUnitRoyaleApplication.mxml
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+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.
+
+-->
+
+<js:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:js="library://ns.apache.org/royale/basic"
+ xmlns:test="org.apache.royale.test.*"
+ applicationComplete="runTests()"
+ >
+ <fx:Declarations>
+ <test:RoyaleUnitCore id="core"/>
+ </fx:Declarations>
+ <fx:Script>
+ <![CDATA[
+ COMPILE::SWF
+ {
+ import flash.system.fscommand;
+ }
+
+ import flexUnitTests.CollectionsTester;
+
+ import org.apache.royale.events.Event;
+ import org.apache.royale.test.listeners.CIListener;
+ import org.apache.royale.test.Runtime;
+
+ //account for swf version variance in some test results due to fixed player bugs etc
+ public function getSwfVersion():uint{
+ COMPILE::SWF{
+ return this.stage.loaderInfo.bytes[3];
+
+ }
+ return 0;
+ }
+
+ public function getPlayerVersion():String{
+ COMPILE::SWF{
+ import flash.system.Capabilities;
+ return Capabilities.version;
+ }
+ return '';
+ }
+
+ public function runTests():void
+ {
+ Runtime.swfVersion = getSwfVersion();
+ core.addListener(new CIListener());
+ core.addEventListener(Event.COMPLETE, core_completeHandler);
+ core.runClasses(CollectionsTester);
+ }
+
+ private function core_completeHandler(event:Event):void
+ {
+ COMPILE::SWF
+ {
+ fscommand("quit");
+ }
+ }
+
+ ]]>
+ </fx:Script>
+ <js:valuesImpl>
+ <!-- for such a simple app, we just set values to an empty array so it thinks it doesn't have any values -->
+ <js:SimpleValuesImpl values="[]"/>
+ </js:valuesImpl>
+
+</js:Application>
diff --git a/frameworks/projects/Collections/src/test/royale/build.xml b/frameworks/projects/Collections/src/test/royale/build.xml
new file mode 100644
index 0000000..f222076
--- /dev/null
+++ b/frameworks/projects/Collections/src/test/royale/build.xml
@@ -0,0 +1,115 @@
+<?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="Core.test" default="main" basedir=".">
+ <property name="ROYALE_HOME" location="../../../../../.."/>
+
+ <property file="${ROYALE_HOME}/env.properties"/>
+ <property environment="env"/>
+ <property file="${ROYALE_HOME}/build.properties"/>
+ <property name="ROYALE_HOME" value="${env.ROYALE_HOME}"/>
+ <property name="ROYALE_SWF_COMPILER_HOME" value="${env.ROYALE_SWF_COMPILER_HOME}"/>
+ <property name="target.name" value="Core-${release.version}.swc" />
+
+ <property name="report.dir" value="${basedir}/out" />
+
+ <target name="main" depends="clean,compile,test" description="Clean test of ${target.name}">
+ </target>
+
+ <target name="clean">
+ <delete failonerror="false">
+ <fileset dir="${basedir}">
+ <include name="FlexUnitRoyaleApplication.swf"/>
+ </fileset>
+ </delete>
+ <delete failonerror="false" includeemptydirs="true">
+ <fileset dir="${report.dir}">
+ <include name="**/**"/>
+ </fileset>
+ </delete>
+ </target>
+
+ <path id="lib.path">
+ <fileset dir="${ROYALE_COMPILER_HOME}/lib" includes="compiler-royaleTasks.jar"/>
+ <fileset dir="${ROYALE_COMPILER_HOME}/lib" includes="royaleUnitTasks.jar"/>
+ </path>
+
+ <target name="compile" description="Compiles FlexUnitRoyaleApplication.swf">
+ <echo message="Compiling FlexUnitRoyaleApplication.swf"/>
+ <echo message="ROYALE_HOME: ${ROYALE_HOME}"/>
+ <echo message="ROYALE_SWF_COMPILER_HOME: ${ROYALE_SWF_COMPILER_HOME}"/>
+ <echo message="playerglobal.version: ${playerglobal.version}"/>
+
+ <!-- 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 RoyaleUIClasses.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}/FlexUnitRoyaleApplication.mxml"
+ output="${basedir}/FlexUnitRoyaleApplication.swf">
+ <jvmarg line="${mxmlc.jvm.args}"/>
+ <!--
+ <jvmarg value="-Xdebug" />
+ <jvmarg value="-Xnoagent" />
+ <jvmarg value="-Xrunjdwp:transport=dt_socket,address=8763,server=y,suspend=y" />
+ -->
+ <arg value="-debug" />
+ <arg value="-compiler.targets=SWF" />
+ <arg value="+playerglobal.version=${playerglobal.version}" />
+ <arg value="+env.PLAYERGLOBAL_HOME=${env.PLAYERGLOBAL_HOME}" />
+ </mxmlc>
+ </target>
+
+ <target name="test">
+ <!-- Load the <royaleunit> task. We can't do this at the <project> level -->
+ <!-- because targets that run before royaleUnitTasks.jar gets built would fail. -->
+ <taskdef resource="royaleUnitTasks.tasks" classpathref="lib.path"/>
+ <mkdir dir="${report.dir}" />
+ <royaleunit
+ swf="${basedir}/FlexUnitRoyaleApplication.swf"
+ workingDir="${basedir}"
+ toDir="${report.dir}"
+ haltonfailure="true"
+ verbose="true"
+ localTrusted="true"
+ timeout="90000" />
+
+ <!-- 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>
diff --git a/frameworks/projects/Network/src/test/royale/flexUnitTests/NetworkTester.as b/frameworks/projects/Collections/src/test/royale/flexUnitTests/CollectionsTester.as
similarity index 58%
copy from frameworks/projects/Network/src/test/royale/flexUnitTests/NetworkTester.as
copy to frameworks/projects/Collections/src/test/royale/flexUnitTests/CollectionsTester.as
index 60308e8..2c20a94 100644
--- a/frameworks/projects/Network/src/test/royale/flexUnitTests/NetworkTester.as
+++ b/frameworks/projects/Collections/src/test/royale/flexUnitTests/CollectionsTester.as
@@ -18,29 +18,17 @@
////////////////////////////////////////////////////////////////////////////////
package flexUnitTests
{
- import flexUnitTests.network.*
+ import flexUnitTests.language.*
[Suite]
[RunWith("org.apache.royale.test.runners.SuiteRunner")]
- /**
- * @royalesuppresspublicvarwarning
- */
- public class NetworkTester
+ public class CollectionsTester
{
- public function NetworkTester()
- {
- // for JS, force-link these classes in the output
- var arr:Array = [AMFBinaryDataTesterTest];
- }
- // in JS, using a class as a type won't include the class in
- // the output since types are not chcked in JS. It is when
- // the actual class is referenced that it will be included
- // in the output.
- // Is there a reason to use reflection to gather the set
- // of tests? I would think an array of tests would wokr
- // better and allow you to define order.
- public var amfBinaryDataTesterTest:AMFBinaryDataTesterTest;
+ //language tests
+ public var testArrayLikeGetSet:LanguageTesterTestArraylikeGetSet;
+ public var testArrayLikeForEach:LanguageTesterTestForEach;
+
}
}
diff --git a/manualtests/UnitTests/src/main/royale/flexUnitTests/language/LanguageTesterTestArraylikeGetSet.as b/frameworks/projects/Collections/src/test/royale/flexUnitTests/language/LanguageTesterTestArraylikeGetSet.as
similarity index 93%
copy from manualtests/UnitTests/src/main/royale/flexUnitTests/language/LanguageTesterTestArraylikeGetSet.as
copy to frameworks/projects/Collections/src/test/royale/flexUnitTests/language/LanguageTesterTestArraylikeGetSet.as
index 8ff14fe..8e451ab 100644
--- a/manualtests/UnitTests/src/main/royale/flexUnitTests/language/LanguageTesterTestArraylikeGetSet.as
+++ b/frameworks/projects/Collections/src/test/royale/flexUnitTests/language/LanguageTesterTestArraylikeGetSet.as
@@ -27,7 +27,7 @@ package flexUnitTests.language
import org.apache.royale.collections.ArrayListView;
import org.apache.royale.collections.IArrayList;
import org.apache.royale.utils.BinaryData;
- import testshim.RoyaleUnitTestRunner;
+ //import testshim.RoyaleUnitTestRunner;
/**
* @royalesuppresspublicvarwarning
@@ -58,15 +58,12 @@ package flexUnitTests.language
public function tearDown():void
{
}
-
-
- /*public function LanguageTesterTestArraylikeGetSet(){
-
- }*/
+
+
public var arrayList:ArrayList;
- /* [Test]
+ [Test]
public function testImpl():void
{
var other:ArrayList = new ArrayList([1,2,3]);
@@ -75,7 +72,7 @@ package flexUnitTests.language
assertEquals(arrayList.getItemAt(0),'gerbil', 'unexpected get/set result')
//RoyaleUnitTestRunner.consoleOut(arrayList.source.toString());
arrayList.setItemAt('manually assigned gerbil',0);
- RoyaleUnitTestRunner.consoleOut(arrayList.source.toString());
+ // RoyaleUnitTestRunner.consoleOut(arrayList.source.toString());
if (arrayList[0] == 'manually assigned gerbil') {
arrayList[0] = local[1];
}
@@ -85,35 +82,35 @@ package flexUnitTests.language
collect.push(other[i]); //'getItemAt'
}
assertEquals(collect.toString(),'1,2,3', 'unexpected loop result');
-
+
if (arrayList[0] == 'not the value') {
arrayList[0] = 'bad assignment';
} else {
arrayList[0] = 'correct assignment';
}
assertEquals(arrayList.getItemAt(0),'correct assignment', 'unexpected assignment result in else block');
- RoyaleUnitTestRunner.consoleOut(arrayList.source.toString());
-
+ // RoyaleUnitTestRunner.consoleOut(arrayList.source.toString());
+
try{
arrayList[0] = "inside try";
} catch (e:Error)
{
- //no error
+ //no error
} finally{
arrayList[1] = "inside finally";
}
assertEquals(arrayList.getItemAt(0),'inside try', 'unexpected try/catch/finally result');
assertEquals(arrayList.getItemAt(1),'inside finally', 'unexpected try/catch/finally result');
-
- }
+ }
+
[Test]
public function testSubClass():void{
//test 'inheritance' via class (ArrayListView in this case)
arrayList= new ArrayList(['dog', 'cat','mouse','gerbil']);
var other:ArrayList = new ArrayList([1,2,3]);
var local:ArrayList = new ArrayList(['gerbil','something else']);
-
+
var alv:ArrayListView = new ArrayListView(arrayList);
var alv1:ArrayListView = new ArrayListView(other);
var alv2:ArrayListView = new ArrayListView(local);
@@ -121,7 +118,7 @@ package flexUnitTests.language
assertEquals(alv.getItemAt(0),'gerbil', 'unexpected get/set result');
//RoyaleUnitTestRunner.consoleOut(arrayList.source.toString());
alv.setItemAt('manually assigned gerbil',0);
- RoyaleUnitTestRunner.consoleOut(alv.source.toString());
+ // RoyaleUnitTestRunner.consoleOut(alv.source.toString());
if (alv[0] == 'manually assigned gerbil') {
alv[0] = alv2[1];
}
@@ -131,15 +128,15 @@ package flexUnitTests.language
collect.push(alv1[i]); //'getItemAt'
}
assertEquals(collect.toString(),'1,2,3', 'unexpected loop result');
-
+
if (alv[0] == 'not the value') {
alv[0] = 'bad assignment';
} else {
alv[0] = 'correct assignment';
}
assertEquals(alv.getItemAt(0),'correct assignment', 'unexpected assignment result in else block');
- RoyaleUnitTestRunner.consoleOut(alv.source.toString());
-
+ // RoyaleUnitTestRunner.consoleOut(alv.source.toString());
+
try{
alv[0] = "inside try";
} catch (e:Error)
@@ -151,35 +148,35 @@ package flexUnitTests.language
assertEquals(alv.getItemAt(0),'inside try', 'unexpected try/catch/finally result');
assertEquals(alv.getItemAt(1),'inside finally', 'unexpected try/catch/finally result');
}
- */
+
[Test]
public function testNested():void
{
arrayList= new ArrayList(['dog', 'cat','mouse','gerbil']);
-
+
var f:Function = function something():String{
arrayList[1] = 'another dog';
return arrayList[1] as String;
};
-
+
var f2:Function = function():String{
arrayList[1] = 'yet another dog';
return arrayList[1] as String;
};
-
+
var check:String = f();
assertEquals(check,'another dog', 'unexpected get/set result');
-
+
assertEquals(arrayList.getItemAt(1),'another dog', 'unexpected get/set result');
-
+
check = f2();
assertEquals(check,'yet another dog', 'unexpected get/set result');
-
+
assertEquals(arrayList.getItemAt(1),'yet another dog', 'unexpected get/set result');
-
- }
+ }
+
private function localReturn(val:ArrayList):String{
val[0] = 'get and set from localMethod';
return val[0] as String;
@@ -193,18 +190,18 @@ package flexUnitTests.language
assertEquals(check,'get and set from localMethod', 'unexpected get/set result');
assertEquals(arrayList.getItemAt(0),'get and set from localMethod', 'unexpected get/set result');
}
-
-
+
+
[Test]
public function testExternalFunc():void{
arrayList= new ArrayList(['dog', 'cat','mouse','gerbil']);
-
+
var check:String = checkArrayLikeFunc(arrayList);
assertEquals(check,'get and set from checkArrayLikeFunc', 'unexpected get/set result');
assertEquals(arrayList.getItemAt(0),'get and set from checkArrayLikeFunc', 'unexpected get/set result');
}
-
-
+
+
public function testBinaryData():void{
var bd:BinaryData = new BinaryData();
bd.length = 100;
diff --git a/frameworks/projects/Collections/src/test/royale/flexUnitTests/language/LanguageTesterTestForEach.as b/frameworks/projects/Collections/src/test/royale/flexUnitTests/language/LanguageTesterTestForEach.as
new file mode 100644
index 0000000..bb7187d
--- /dev/null
+++ b/frameworks/projects/Collections/src/test/royale/flexUnitTests/language/LanguageTesterTestForEach.as
@@ -0,0 +1,201 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+package flexUnitTests.language
+{
+
+
+ import org.apache.royale.test.asserts.*;
+
+ import flexUnitTests.language.support.*;
+ import org.apache.royale.collections.ArrayList;
+ import org.apache.royale.collections.IArrayList;
+
+ // import testshim.RoyaleUnitTestRunner;
+
+ /**
+ * @royalesuppresspublicvarwarning
+ */
+ public class LanguageTesterTestForEach
+ {
+
+
+ public static var isJS:Boolean = COMPILE::JS;
+
+ [BeforeClass]
+ public static function setUpBeforeClass():void
+ {
+
+ }
+
+ [AfterClass]
+ public static function tearDownAfterClass():void
+ {
+ }
+
+ [Before]
+ public function setUp():void
+ {
+ _myList = new ArrayList(['dog', 'cat','mouse','gerbil'])
+ }
+
+ [After]
+ public function tearDown():void
+ {
+ }
+ private var _animal:String;
+ private var _char:String;
+ private var _myList:ArrayList
+
+
+ [Test]
+ public function testNested1():void
+ {
+ var arrayList:ArrayList = new ArrayList(['dog', 'cat','mouse','gerbil']);
+
+ var foundItems:Array = [];
+ var charItems:Array = [];
+ for each(var animal:String in arrayList) {
+ foundItems.push(animal);
+ var deepList:ArrayList = new ArrayList(animal.split(''));
+ for each(var char:String in deepList) {
+ // RoyaleUnitTestRunner.consoleOut(char);
+ charItems.push(char);
+ }
+ }
+ // RoyaleUnitTestRunner.consoleOut(value + '');
+ assertEquals(foundItems.toString(), 'dog,cat,mouse,gerbil', 'unexpected for each result');
+ //check nested loop content
+ assertEquals(charItems.toString(), 'd,o,g,c,a,t,m,o,u,s,e,g,e,r,b,i,l', 'unexpected for each result');
+ }
+
+
+
+ [Test]
+ public function testNested1a():void
+ {
+ var array:Array=['dog', 'cat','mouse','gerbil'];
+
+ var foundItems:Array = [];
+ var charItems:Array = [];
+ for each(_animal in array) {
+ foundItems.push(_animal);
+ var deepList:Array = _animal.split('');
+ for each(_char in deepList) {
+ // RoyaleUnitTestRunner.consoleOut(char);
+ charItems.push(_char);
+ }
+ }
+ // RoyaleUnitTestRunner.consoleOut(value + '');
+ assertEquals(foundItems.toString(), 'dog,cat,mouse,gerbil', 'unexpected for each result');
+ //check nested loop content
+ assertEquals(charItems.toString(), 'd,o,g,c,a,t,m,o,u,s,e,g,e,r,b,i,l', 'unexpected for each result');
+ }
+
+ [Test]
+ public function testNested1b():void
+ {
+ //using a target referenced externally
+ var foundItems:Array = [];
+ var charItems:Array = [];
+ for each(_animal in _myList) {
+ foundItems.push(_animal);
+ var deepList:ArrayList = new ArrayList(_animal.split(''));
+ for each(_char in deepList) {
+ // RoyaleUnitTestRunner.consoleOut(char);
+ charItems.push(_char);
+ }
+ }
+ // RoyaleUnitTestRunner.consoleOut(value + '');
+ assertEquals(foundItems.toString(), 'dog,cat,mouse,gerbil', 'unexpected for each result');
+ //check nested loop content
+ assertEquals(charItems.toString(), 'd,o,g,c,a,t,m,o,u,s,e,g,e,r,b,i,l', 'unexpected for each result');
+ }
+
+
+ [Test]
+ public function testNested2():void
+ {
+ var arrayList:ArrayList = new ArrayList(['dog', 'cat','mouse','gerbil']);
+
+ var foundItems:Array = [];
+ var charItems:Array = [];
+ for each(_animal in arrayList) {
+ foundItems.push(_animal);
+ var deepList:ArrayList = new ArrayList(_animal.split(''));
+ for each(_char in deepList) {
+ // RoyaleUnitTestRunner.consoleOut(char);
+ charItems.push(_char);
+ }
+ }
+ // RoyaleUnitTestRunner.consoleOut(value + '');
+ assertEquals(foundItems.toString(), 'dog,cat,mouse,gerbil', 'unexpected for each result');
+ //check nested loop content
+ assertEquals(charItems.toString(), 'd,o,g,c,a,t,m,o,u,s,e,g,e,r,b,i,l', 'unexpected for each result');
+ }
+
+
+ [Test]
+ public function testNested3():void
+ {
+ var arrayList:IArrayList = new ArrayList(['dog', 'cat','mouse','gerbil']);
+
+ var foundItems:Array = [];
+ var charItems:Array = [];
+ for each(_animal in arrayList) {
+ foundItems.push(_animal);
+ var deepList:IArrayList = new ArrayList(_animal.split(''));
+ for each(_char in deepList) {
+ // RoyaleUnitTestRunner.consoleOut(char);
+ charItems.push(_char);
+ }
+ }
+ // RoyaleUnitTestRunner.consoleOut(value + '');
+ assertEquals(foundItems.toString(), 'dog,cat,mouse,gerbil', 'unexpected for each result');
+ //check nested loop content
+ assertEquals(charItems.toString(), 'd,o,g,c,a,t,m,o,u,s,e,g,e,r,b,i,l', 'unexpected for each result');
+ }
+
+
+
+
+ [Test]
+ public function testTargetMutation():void{
+ var arrayList:ArrayList = new ArrayList(['dog', 'cat','mouse','gerbil']);
+
+ var foundItems:Array = [];
+ for each(var animal:String in arrayList) {
+ foundItems.push(animal);
+ if (arrayList.length) arrayList.removeAll();//should stop iterating after first item
+ }
+ assertEquals(foundItems.toString(), 'dog', 'unexpected for each result');
+ }
+
+
+ [Test]
+ public function testForIn():void{
+ var arrayList:ArrayList = new ArrayList(['dog', 'cat','mouse','gerbil']);
+
+ var foundItems:Array = [];
+ for (var key:String in arrayList) {
+ foundItems.push(arrayList.getItemAt(uint(key)));
+ }
+ assertEquals(foundItems.toString(), 'dog,cat,mouse,gerbil', 'unexpected for in result');
+ }
+ }
+}
diff --git a/frameworks/projects/Network/src/test/royale/flexUnitTests/NetworkTester.as b/frameworks/projects/Collections/src/test/royale/flexUnitTests/language/support/checkArrayLikeFunc.as
similarity index 52%
copy from frameworks/projects/Network/src/test/royale/flexUnitTests/NetworkTester.as
copy to frameworks/projects/Collections/src/test/royale/flexUnitTests/language/support/checkArrayLikeFunc.as
index 60308e8..11ae093 100644
--- a/frameworks/projects/Network/src/test/royale/flexUnitTests/NetworkTester.as
+++ b/frameworks/projects/Collections/src/test/royale/flexUnitTests/language/support/checkArrayLikeFunc.as
@@ -16,31 +16,14 @@
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////////
-package flexUnitTests
+package flexUnitTests.language.support
{
- import flexUnitTests.network.*
+ import org.apache.royale.collections.ArrayList;
- [Suite]
- [RunWith("org.apache.royale.test.runners.SuiteRunner")]
- /**
- * @royalesuppresspublicvarwarning
- */
- public class NetworkTester
+ public function checkArrayLikeFunc(val:ArrayList):String
{
- public function NetworkTester()
- {
- // for JS, force-link these classes in the output
- var arr:Array = [AMFBinaryDataTesterTest];
- }
-
- // in JS, using a class as a type won't include the class in
- // the output since types are not chcked in JS. It is when
- // the actual class is referenced that it will be included
- // in the output.
- // Is there a reason to use reflection to gather the set
- // of tests? I would think an array of tests would wokr
- // better and allow you to define order.
- public var amfBinaryDataTesterTest:AMFBinaryDataTesterTest;
-
+ val[0] = 'get and set from checkArrayLikeFunc';
+ return val[0] as String;
+ // return val.getItemAt(0) as String;
}
}
diff --git a/frameworks/projects/Network/src/test/royale/flexUnitTests/NetworkTester.as b/frameworks/projects/Network/src/test/royale/flexUnitTests/NetworkTester.as
index 60308e8..317c6c8 100644
--- a/frameworks/projects/Network/src/test/royale/flexUnitTests/NetworkTester.as
+++ b/frameworks/projects/Network/src/test/royale/flexUnitTests/NetworkTester.as
@@ -30,17 +30,12 @@ package flexUnitTests
public function NetworkTester()
{
// for JS, force-link these classes in the output
- var arr:Array = [AMFBinaryDataTesterTest];
+ var arr:Array = [AMFBinaryDataTesterTest, URLVariablesTesterTest];
}
- // in JS, using a class as a type won't include the class in
- // the output since types are not chcked in JS. It is when
- // the actual class is referenced that it will be included
- // in the output.
- // Is there a reason to use reflection to gather the set
- // of tests? I would think an array of tests would wokr
- // better and allow you to define order.
public var amfBinaryDataTesterTest:AMFBinaryDataTesterTest;
+ public var urlVariablesTesterTest:URLVariablesTesterTest;
+
}
}
diff --git a/frameworks/projects/Network/src/test/royale/flexUnitTests/network/URLVariablesTesterTest.as b/frameworks/projects/Network/src/test/royale/flexUnitTests/network/URLVariablesTesterTest.as
new file mode 100644
index 0000000..ef6bd26
--- /dev/null
+++ b/frameworks/projects/Network/src/test/royale/flexUnitTests/network/URLVariablesTesterTest.as
@@ -0,0 +1,121 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+package flexUnitTests.network
+{
+
+
+
+
+ import org.apache.royale.test.asserts.*;
+
+
+ import org.apache.royale.net.URLVariables;
+
+
+ public class URLVariablesTesterTest
+ {
+
+ [Before]
+ public function setUp():void
+ {
+ }
+
+ [After]
+ public function tearDown():void
+ {
+ }
+
+ [BeforeClass]
+ public static function setUpBeforeClass():void
+ {
+ }
+
+ [AfterClass]
+ public static function tearDownAfterClass():void
+ {
+ }
+
+
+ private function encodedStringContentsMatch(string1:String, string2:String):Boolean{
+ if (string1.length == string2.length) {
+ var content1:Array = string1.split('&');
+ var content2:Array = string2.split('&');
+ if (content1.length == content2.length) {
+ while(content1.length) {
+ if (content2.indexOf(content1.pop()) == -1) return false;
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+ [Test]
+ public function testEncoding():void
+ {
+ var tester:URLVariables = new URLVariables();
+ tester['test1'] = 'test1Value';
+ assertEquals(tester.toString(), 'test1=test1Value', 'unexpected encoded string');
+
+ tester['test2'] = 'test2Value';
+ //handle arbitrary order of encoded values when testing:
+ assertTrue(encodedStringContentsMatch(tester.toString(), 'test1=test1Value&test2=test2Value'), 'unexpected encoded string')
+ }
+
+ [Test]
+ public function testDecoding():void
+ {
+ var tester:URLVariables = new URLVariables('test1=test1Value');
+ assertEquals(tester['test1'], 'test1Value', 'unexpected decoded value');
+
+ tester.decode('test2=test2Value');
+
+ //cumulative:
+ assertEquals(tester['test1'], 'test1Value', 'unexpected decoded value');
+ assertEquals(tester['test2'], 'test2Value', 'unexpected decoded value');
+
+ //test empty string as name in pair
+ tester = new URLVariables('=EmptyStringValue');
+ assertEquals(tester[''], 'EmptyStringValue', 'unexpected decoded value');
+
+ }
+
+
+
+ [Test]
+ public function testDecodingError():void
+ {
+
+ var wasError:Boolean;
+ var tester:URLVariables = new URLVariables();
+ try{
+ //test2 name does not include a value:
+ tester.decode('test1=1&test2');
+ }catch(e:Error){
+ wasError = true;
+ }
+ assertTrue(wasError, 'Error should be thrown for incomplete name-value pair');
+ assertEquals(tester['test1'], '1', 'partially decoded value should be present');
+
+
+ }
+
+ }
+}
diff --git a/frameworks/projects/XML/src/test/royale/flexUnitTests/XMLTester.as b/frameworks/projects/XML/src/test/royale/flexUnitTests/XMLTester.as
index 33f103c..7057fe8 100644
--- a/frameworks/projects/XML/src/test/royale/flexUnitTests/XMLTester.as
+++ b/frameworks/projects/XML/src/test/royale/flexUnitTests/XMLTester.as
@@ -29,25 +29,24 @@ package flexUnitTests
{
public function XMLTester()
{
- // for JS, force-link these classes in the output
- var arr:Array = [XMLTesterGeneralTest, XMLTesterStringifyTest, XMLListTesterGeneralTest, XMLNamespaceTest];
+
+ //var arr:Array = [XMLTesterGeneralTest, XMLTesterStringifyTest, XMLListTesterGeneralTest, XMLNamespaceTest];
}
-
- // in JS, using a class as a type won't include the class in
- // the output since types are not chcked in JS. It is when
- // the actual class is referenced that it will be included
- // in the output.
- // Is there a reason to use reflection to gather the set
- // of tests? I would think an array of tests would wokr
- // better and allow you to define order.
-
+
+
public var xmlTesterGeneralTest:XMLTesterGeneralTest;
-
+
public var xmlTesterStringifyTest:XMLTesterStringifyTest;
public var xmlListTesterGeneralTest:XMLListTesterGeneralTest;
public var xmlNamespaceTest:XMLNamespaceTest;
+
+ public var xmlNamespaceClassTest:XMLNamespaceClassTest;
+
+ public var xmlQNameTest:XMLQNameTest;
+
+ public var xmlNamespaceQueries:XMLTesterNamespaceQueries;
}
}
diff --git a/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/XMLNamespaceClassTest.as b/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/XMLNamespaceClassTest.as
new file mode 100644
index 0000000..bfea70a
--- /dev/null
+++ b/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/XMLNamespaceClassTest.as
@@ -0,0 +1,142 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+package flexUnitTests.xml
+{
+
+
+ import flexUnitTests.xml.support.QNameTest;
+ import org.apache.royale.test.asserts.*;
+
+ // import testshim.RoyaleUnitTestRunner;
+
+ /**
+ * @royalesuppresspublicvarwarning
+ */
+ public class XMLNamespaceClassTest
+ {
+
+ // private namespace atom = "http://www.w3.org/2005/Atom";
+ public static var ATOM_NS:Namespace = new Namespace("http://www.w3.org/2005/Atom");
+ private var atom:Namespace = ATOM_NS;
+
+ public static var isJS:Boolean = COMPILE::JS;
+
+ private var settings:Object;
+
+ private var source:String;
+
+ [Before]
+ public function setUp():void
+ {
+ settings = XML.settings();
+ }
+
+ [After]
+ public function tearDown():void
+ {
+ source=null;
+ XML.setSettings(settings);
+ }
+
+ [BeforeClass]
+ public static function setUpBeforeClass():void
+ {
+ }
+
+ [AfterClass]
+ public static function tearDownAfterClass():void
+ {
+ }
+
+
+
+
+ [Test]
+ public function basicNamespaceChecks():void{
+ var ns:Namespace = new Namespace();
+
+ assertStrictlyEquals(ns.uri,'', 'unexpected namespace uri value');
+ assertStrictlyEquals(ns.prefix,'', 'unexpected namespace prefix value');
+ ns = new Namespace('');
+ assertStrictlyEquals(ns.uri,'', 'unexpected namespace uri value');
+ assertStrictlyEquals(ns.prefix,'', 'unexpected namespace prefix value');
+ ns = new Namespace("http://royale/");
+ assertStrictlyEquals(ns.uri,"http://royale/", 'unexpected namespace uri value');
+ assertStrictlyEquals(ns.prefix,undefined, 'unexpected namespace prefix value');
+ ns = new Namespace("royale", "http://royale/");
+ assertStrictlyEquals(ns.uri,"http://royale/", 'unexpected namespace uri value');
+ assertStrictlyEquals(ns.prefix,"royale", 'unexpected namespace prefix value');
+
+ var ns2:Namespace = new Namespace(ns);
+ assertStrictlyEquals(ns.uri,ns2.uri, 'unexpected namespace uri value');
+ assertStrictlyEquals(ns.prefix,ns2.prefix, 'unexpected namespace prefix value');
+ var err:Boolean = false;
+ try{
+ ns = new Namespace("ns", "");
+ } catch(e:Error){
+ err = true;
+ }
+ assertTrue(err, 'expected an error')
+ }
+
+
+
+ [Test]
+ public function basicNamespaceNamespaceArgs():void{
+ var n:Namespace = new Namespace("http://example.org/");
+ var n1:Namespace = new Namespace("n1Pre","http://example.org/n1");
+ var n2:Namespace = new Namespace("n2Pre","http://example.org/n2");
+
+ assertStrictlyEquals(n.uri,'http://example.org/', 'unexpected namespace uri value');
+ assertStrictlyEquals(n.prefix,undefined, 'unexpected namespace prefix value');
+
+ var ns:Namespace = new Namespace(n);
+ assertStrictlyEquals(ns.uri,'http://example.org/', 'unexpected namespace uri value');
+ assertStrictlyEquals(ns.prefix,undefined, 'unexpected namespace prefix value');
+
+ ns = new Namespace(undefined, n);
+ assertStrictlyEquals(ns.uri,'http://example.org/', 'unexpected namespace uri value');
+ assertStrictlyEquals(ns.prefix,undefined, 'unexpected namespace prefix value');
+
+ ns = new Namespace(n, undefined);
+ assertStrictlyEquals(ns.uri,'undefined', 'unexpected namespace uri value');
+ assertStrictlyEquals(ns.prefix,undefined, 'unexpected namespace prefix value');
+
+ ns = new Namespace(n, null);
+ assertStrictlyEquals(ns.uri,'null', 'unexpected namespace uri value');
+ assertStrictlyEquals(ns.prefix,undefined, 'unexpected namespace prefix value');
+
+ ns = new Namespace(n1, n2);
+ assertStrictlyEquals(ns.uri,'http://example.org/n2', 'unexpected namespace uri value');
+ assertStrictlyEquals(ns.prefix,undefined, 'unexpected namespace prefix value');
+
+ ns = new Namespace(n2, n2);
+ assertStrictlyEquals(ns.uri,'http://example.org/n2', 'unexpected namespace uri value');
+ assertStrictlyEquals(ns.prefix,undefined, 'unexpected namespace prefix value');
+
+ ns = new Namespace(n2);
+ assertStrictlyEquals(ns.uri,'http://example.org/n2', 'unexpected namespace uri value');
+ assertStrictlyEquals(ns.prefix,'n2Pre', 'unexpected namespace prefix value');
+
+ }
+
+
+
+ }
+}
diff --git a/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/XMLNamespaceTest.as b/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/XMLNamespaceTest.as
index cb94a80..2946c06 100644
--- a/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/XMLNamespaceTest.as
+++ b/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/XMLNamespaceTest.as
@@ -20,6 +20,8 @@ package flexUnitTests.xml
{
+ import flexUnitTests.xml.support.NamespaceTest;
+
import org.apache.royale.test.asserts.*;
// import testshim.RoyaleUnitTestRunner;
@@ -30,6 +32,7 @@ package flexUnitTests.xml
public class XMLNamespaceTest
{
+ private namespace atom = "http://www.w3.org/2005/Atom";
public static var ATOM_NS:Namespace = new Namespace("http://www.w3.org/2005/Atom");
@@ -87,8 +90,60 @@ package flexUnitTests.xml
{
}
+ [Test]
+ public function testMinimalDefault():void{
+ default xml namespace = 'test';
+ var xml:XML = <root/>;
+
+ var ns:Namespace = xml.namespace();
+ assertStrictlyEquals(ns.prefix, undefined, 'unexpected prefix value');
+ assertEquals(ns.uri, 'test', 'unexpected uri value from specific default namespace');
+
+ //try top level function
+ xml = XML('<root/>');
+ ns= xml.namespace();
+ assertStrictlyEquals(ns.prefix, undefined, 'unexpected prefix value');
+ assertEquals(ns.uri, 'test', 'unexpected uri value from specific default namespace');
+
+ }
+
- private var atom:Namespace = ATOM_NS;
+ [Test]
+ public function basicNamespaceChecks():void{
+ var ns:Namespace = new Namespace();
+
+ assertStrictlyEquals(ns.uri,'', 'unexpected namespace uri value');
+ assertStrictlyEquals(ns.prefix,'', 'unexpected namespace prefix value');
+ ns = new Namespace('');
+ assertStrictlyEquals(ns.uri,'', 'unexpected namespace uri value');
+ assertStrictlyEquals(ns.prefix,'', 'unexpected namespace prefix value');
+ ns = new Namespace("http://royale/");
+ assertStrictlyEquals(ns.uri,"http://royale/", 'unexpected namespace uri value');
+ assertStrictlyEquals(ns.prefix,undefined, 'unexpected namespace prefix value');
+ ns = new Namespace("royale", "http://royale/");
+ assertStrictlyEquals(ns.uri,"http://royale/", 'unexpected namespace uri value');
+ assertStrictlyEquals(ns.prefix,"royale", 'unexpected namespace prefix value');
+
+ var ns2:Namespace = new Namespace(ns);
+ assertStrictlyEquals(ns.uri,ns2.uri, 'unexpected namespace uri value');
+ assertStrictlyEquals(ns.prefix,ns2.prefix, 'unexpected namespace prefix value');
+ var err:Boolean = false;
+ try{
+ ns = new Namespace("ns", "");
+ } catch(e:Error){
+ err = true;
+ }
+ assertTrue(err, 'expected an error')
+ }
+
+
+
+ //private var atom:Namespace = ATOM_NS;
+
+
+
+
+
[Test]
@@ -98,49 +153,248 @@ package flexUnitTests.xml
var atomLinks:XMLList = xml.rss.channel.atom::link;
assertEquals(atomLinks.length(),2, 'unexpected results from namespace based child query');
+ //account for browser DOMParser variation to order of 'attrributes' - use length comparison
+ // RoyaleUnitTestRunner.consoleOut(atomLinks.toString());
+ assertEquals(atomLinks.toString().length, 459, 'unexpected list content length');
- //@todo:
- //RoyaleUnitTestRunner.consoleOut('atomLinks');
- //RoyaleUnitTestRunner.consoleOut(atomLinks.toString());
- //SWF Output includes ancestor namespaces:
- /*
- <atom10:link rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/AnonymizedName" xmlns:atom10="http://www.w3.org/2005/Atom" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0"/>
- <atom10:link rel="hub" href="http://pubsubhubbub.appspot.com/" xmlns:atom10="http://www.w3.org/2005/Atom" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0"/>
-
- */
- //JS Output does not (yet) include ancestor namespaces:
- /*
- <atom10:link rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/AnonymizedName" xmlns:atom10="http://www.w3.org/2005/Atom"/>
- <atom10:link rel="hub" href="http://pubsubhubbub.appspot.com/" xmlns:atom10="http://www.w3.org/2005/Atom"/>
-
- */
+ /*RoyaleUnitTestRunner.consoleOut('atomLinks');
+ RoyaleUnitTestRunner.consoleOut(atomLinks.toString());
+ RoyaleUnitTestRunner.consoleOut(atomLinks.toString().length+'');*/
}
[Test]
public function testDescendantsQueryWithNamespace():void{
-
var xml:XML = new XML(source);
var atomLinks:XMLList = xml..atom::link;
assertEquals(atomLinks.length(),2, 'unexpected results from namespace based child query');
+ //account for browser DOMParser variation to order of 'attributes' - use length comparison
+ // RoyaleUnitTestRunner.consoleOut(atomLinks.toString());
+ assertEquals(atomLinks.toString().length, 459, 'unexpected list content length');
+
+ /*RoyaleUnitTestRunner.consoleOut('descendants atomLinks');
+ RoyaleUnitTestRunner.consoleOut(atomLinks.toString());
+ RoyaleUnitTestRunner.consoleOut(atomLinks.toString().length+'');*/
+
+ }
+
+ [Test]
+ public function testInscopeNamespaces():void{
+ //needs a local var in the output
+ namespace atom = "http://www.w3.org/2005/Atom"
+
+ var feed:XML = new XML(
+ '<feed xmlns="http://www.w3.org/2005/Atom" xmlns:m="nothing">\n' +
+ ' <link rel="self" type="application/atom+xml" href="config/blahblah/user/123123" xmlns:blah="blah"/>'+
+ ' <link rel="customer" href="customer/999973324764966"/>\n' +
+ ' <link rel="domain" href="customer/443512501473324764966/domain/"/>\n' +
+ ' <link rel="tags" href="config/45545/domain/"/>\n' +
+ ' <m:link rel="nothing" href="config/45545/domain/"/>\n' +
+ '</feed>\n');
+
+
+ var inscopes:Array = feed.inScopeNamespaces();
+
+ assertEquals(inscopes.length, 2, 'unexpected namespace count');
+ //account for browser DOMParser variation to order of 'attributes' - use length comparison
+ assertEquals(inscopes.toString().length, 'http://www.w3.org/2005/Atom,nothing'.length, 'unexpected namespace content');
+ /* RoyaleUnitTestRunner.consoleOut(inscopes.length+":"+inscopes.toString());
+ for each(var ns:Namespace in inscopes) {
+ RoyaleUnitTestRunner.consoleOut('prefix:\''+ns.prefix+'\', '+ns.uri);
+ }*/
+
+ var links:XMLList = feed.atom::link;
+ var link1:XML = links[0];
+
+ inscopes = link1.inScopeNamespaces();
+
+ assertEquals(inscopes.length, 3, 'unexpected namespace count');
+ //account for browser DOMParser variation to order of 'attributes' - use length comparison
+ assertEquals(inscopes.toString().length, 'blah,http://www.w3.org/2005/Atom,nothing'.length, 'unexpected namespace content');
+ /* RoyaleUnitTestRunner.consoleOut(inscopes.length+":"+inscopes.toString());
+ for each(var ns:Namespace in inscopes) {
+ RoyaleUnitTestRunner.consoleOut('prefix:\''+ns.prefix+'\', '+ns.uri);
+ }*/
+ }
+
+ [Test]
+ public function testNamespaceDeclarations():void{
+ namespace atom = "http://www.w3.org/2005/Atom"
+
+ var feed:XML = new XML(
+ '<feed xmlns="http://www.w3.org/2005/Atom" xmlns:m="nothing">\n' +
+ ' <link rel="self" type="application/atom+xml" href="config/blahblah/user/123123" xmlns:blah="blah"/>'+
+ ' <link rel="customer" href="customer/999973324764966"/>\n' +
+ ' <link rel="domain" href="customer/443512501473324764966/domain/"/>\n' +
+ ' <link rel="tags" href="config/45545/domain/"/>\n' +
+ ' <m:link rel="nothing" href="config/45545/domain/"/>\n' +
+ '</feed>\n');
+
+
+ var declarations:Array = feed.namespaceDeclarations();
+
+ assertEquals(declarations.length, 2, 'unexpected namespace count');
+ //account for browser DOMParser variation to order of 'attrributes' - use length comparison
+ assertEquals(declarations.toString().length, 'http://www.w3.org/2005/Atom,nothing'.length, 'unexpected namespace content');
+
+
+ var links:XMLList = feed.atom::link;
+ var link1:XML = links[0];
+
+ declarations = link1.namespaceDeclarations();
+
+ assertEquals(declarations.length, 1, 'unexpected namespace count');
+ assertEquals(declarations.toString(), 'blah', 'unexpected namespace content');
+
+ }
- //@todo:
- // RoyaleUnitTestRunner.consoleOut('dscendants atomLinks');
- //RoyaleUnitTestRunner.consoleOut(atomLinks.toString());
- //SWF Output includes ancestor namespaces:
- /*
- <atom10:link rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/AnonymizedName" xmlns:atom10="http://www.w3.org/2005/Atom" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0"/>
- <atom10:link rel="hub" href="http://pubsubhubbub.appspot.com/" xmlns:atom10="http://www.w3.org/2005/Atom" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0"/>
-
- */
- //JS Output does not (yet) include ancestor namespaces:
- /*
- <atom10:link rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/AnonymizedName" xmlns:atom10="http://www.w3.org/2005/Atom"/>
- <atom10:link rel="hub" href="http://pubsubhubbub.appspot.com/" xmlns:atom10="http://www.w3.org/2005/Atom"/>
-
- */
+ [Test]
+ public function testAddNamespace():void{
+
+ var test1:Namespace = new Namespace('what',"what");
+ var test2:Namespace = new Namespace('what',"what1");
+ var feed:XML = new XML(
+ '<feed xmlns:delim="delimiter" xmlns="http://www.w3.org/2005/Atom" xmlns:what="what" xmlns:m="nothing" >\n' +
+ ' <link rel="self" type="application/atom+xml" href="config/blahblah/user/123123" xmlns:blah="blah"/>'+
+ '</feed>\n');
+
+ var originalDeclarations:Array = feed.namespaceDeclarations();
+
+ assertEquals(originalDeclarations.length, 4, 'unexpected namespace count');
+
+ feed.addNamespace(test1);
+
+ assertEquals(feed.inScopeNamespaces().indexOf(test1), -1, 'unexpected inScopeNamespaces presence');
+ var latest:Array = feed.namespaceDeclarations();
+ assertEquals(latest.indexOf(test1), 4, 'unexpected namespaceDeclarations location');
+ assertEquals(latest.length, 5, 'unexpected namespaceDeclarations location');
+ //account for browser DOMParser variation to order of 'attrributes' - use length comparison
+ assertEquals(latest.toString().length, 'delimiter,http://www.w3.org/2005/Atom,what,nothing,what'.length, 'unexpected namespaceDeclarations location');
+
+ feed.addNamespace(test2);
+ latest = feed.namespaceDeclarations();
+ assertEquals(latest.indexOf(test1), -1, 'unexpected namespaceDeclarations presence');
+ assertEquals(latest.indexOf(test2), 4, 'unexpected namespaceDeclarations location');
+ assertEquals(latest.length, 5, 'unexpected namespaceDeclarations location');
+ //account for browser DOMParser variation to order of 'attrributes' - use length comparison
+ assertEquals(latest.toString().length, 'delimiter,http://www.w3.org/2005/Atom,what,nothing,what1'.length, 'unexpected namespaceDeclarations location');
+
+
+ }
+
+
+ [Test]
+ public function testUseNamespaceVariationsInsideClass():void{
+ var testInstance:NamespaceTest = new NamespaceTest();
+
+ var list:XMLList = testInstance.test1();
+
+ assertEquals(list.length(), 4, 'unexpected list length');
+ //account for browser DOMParser variation to order of 'attrributes' - use length comparison
+ assertEquals(list.toXMLString().length, 466, 'unexpected list content');
+
+
+ list = testInstance.test2();
+ /* RoyaleUnitTestRunner.consoleOut(list);
+ RoyaleUnitTestRunner.consoleOut('2 end -----------------'+list.length());
+ RoyaleUnitTestRunner.consoleOut(String(list.toXMLString().length));*/
+
+ assertEquals(list.length(), 5, 'unexpected list length');
+ //account for browser DOMParser variation to order of 'attrributes' - use length comparison
+ assertEquals(list.toXMLString().length, 572, 'unexpected list content');
+
+
+ list = testInstance.test3();
+ /* RoyaleUnitTestRunner.consoleOut(list);
+ RoyaleUnitTestRunner.consoleOut('3 end -----------------'+list.length());
+ RoyaleUnitTestRunner.consoleOut(String(list.toXMLString().length));*/
+
+ assertEquals(list.length(), 4, 'unexpected list length');
+ //account for browser DOMParser variation to order of 'attrributes' - use length comparison
+ assertEquals(list.toXMLString().length, 466, 'unexpected list content');
+
+
+
+ list = testInstance.test4();
+ /*RoyaleUnitTestRunner.consoleOut(list);
+ RoyaleUnitTestRunner.consoleOut('4 end -----------------'+list.length());
+ RoyaleUnitTestRunner.consoleOut(String(list.toXMLString().length));*/
+
+ assertEquals(list.length(), 4, 'unexpected list length');
+ //account for browser DOMParser variation to order of 'attrributes' - use length comparison
+ assertEquals(list.toXMLString().length, 466, 'unexpected list content');
+
+
+ list = testInstance.test11();
+ assertEquals(list.length(), 5, 'unexpected list length');
+ //account for browser DOMParser variation to order of 'attrributes' - use length comparison
+ assertEquals(list.toXMLString().length, 618, 'unexpected list content');
+
+ /* RoyaleUnitTestRunner.consoleOut(list);
+ RoyaleUnitTestRunner.consoleOut('11 end -----------------'+list.length());
+ RoyaleUnitTestRunner.consoleOut(String(list.toXMLString().length));*/
+
+
+ list = testInstance.test12();
+ assertEquals(list.length(), 6, 'unexpected list length');
+ //account for browser DOMParser variation to order of 'attrributes' - use length comparison
+ assertEquals(list.toXMLString().length, 729, 'unexpected list content');
+ /* RoyaleUnitTestRunner.consoleOut(list);
+ RoyaleUnitTestRunner.consoleOut('12 end -----------------'+list.length());
+ RoyaleUnitTestRunner.consoleOut(String(list.toXMLString().length));*/
+
+
+ list = testInstance.test13();
+ assertEquals(list.length(), 4, 'unexpected list length');
+ assertEquals(list.toXMLString().length, 506, 'unexpected list content');
+ // RoyaleUnitTestRunner.consoleOut(list);
+ // RoyaleUnitTestRunner.consoleOut('13 end -----------------'+list.length()+","+list.toXMLString().length);
+ list = testInstance.test14();
+ assertEquals(list.length(), 5, 'unexpected list length');
+ assertEquals(list.toXMLString().length, 618, 'unexpected list content');
+
+ /*
+ RoyaleUnitTestRunner.consoleOut(list);
+ RoyaleUnitTestRunner.consoleOut('14 end -----------------'+list.length()+","+list.toXMLString().length);
+ */
+
+ }
+
+
+ [Test]
+ [TestVariance(variance="JS",description="Some browsers (IE11/Edge legacy) can parse to a different order of attributes and namespace declarations (which affects stringified content comparisons)")]
+ public function testUseNamespace():void{
+ use namespace atom;
+ namespace royale = "https://royale.apache.org"
+ use namespace royale;
+ var feed:XML = new XML(
+ '<feed xmlns="http://www.w3.org/2005/Atom" xmlns:royale="https://royale.apache.org">\n' +
+ ' <link rel="self" type="application/atom+xml" href="config/blahblah/user/123123"/>'+
+ ' <link rel="customer" href="customer/999973324764966"/>\n' +
+ ' <royale:link rel="self" href="customer/443512501473324764966/domain/"/>\n' +
+ ' <link rel="tags" royale:rel="self" href="config/45545/domain/"/>\n' +
+ '</feed>\n');
+
+
+ //try filtered content;
+
+ var url:String = feed.link.(@rel=="self").@href;
+
+ // RoyaleUnitTestRunner.consoleOut('testUseNamespace::'+feed.link.(@rel=="self").@href);
+ // RoyaleUnitTestRunner.consoleOut('testUseNamespace::'+url);
+ assertEquals(url, 'config/blahblah/user/123123customer/443512501473324764966/domain/', 'unexpected query result');
+
+ var links:XMLList = feed.link;
+ assertEquals(links.toString().length, 581, 'unexpected query result');
+
+ //RoyaleUnitTestRunner.consoleOut('testUseNamespace::'+links);
+ //IE11/Edge failure because of order
+ /*assertEquals(links.toString(), '<link rel="self" type="application/atom+xml" href="config/blahblah/user/123123" xmlns="http://www.w3.org/2005/Atom" xmlns:royale="https://royale.apache.org"/>\n' +
+ '<link rel="customer" href="customer/999973324764966" xmlns="http://www.w3.org/2005/Atom" xmlns:royale="https://royale.apache.org"/>\n' +
+ '<royale:link rel="self" href="customer/443512501473324764966/domain/" xmlns="http://www.w3.org/2005/Atom" xmlns:royale="https://royale.apache.org"/>\n' +
+ '<link rel="tags" royale:rel="self" href="config/45545/domain/" xmlns="http://www.w3.org/2005/Atom" xmlns:royale="https://royale.apache.org"/>', 'unexpected query result');*/
}
@@ -148,9 +402,8 @@ package flexUnitTests.xml
public function testQueryWithAnyNamespace():void{
var xml:XML = new XML(source);
- //var anyLinks:XMLList = xml..*::link;
- //assertEquals(anyLinks.length(),5, 'unexpected results from *any* namespace based descendants query');
- assertTrue(true)
+ var anyLinks:XMLList = xml..*::link;
+ assertEquals(anyLinks.length(),5, 'unexpected results from *any* namespace based descendants query');
/* RoyaleUnitTestRunner.consoleOut('descendants any * Links');
RoyaleUnitTestRunner.consoleOut(anyLinks.toString());*/
}
@@ -159,7 +412,7 @@ package flexUnitTests.xml
[Test]
public function testUnusualLanguageNamespaces():void{
var xml:XML = new XML(source);
-
+
//public: (seems to behave like 'default')
var unusualLinks:XMLList = xml..public::link;
assertEquals(unusualLinks.length(),3, 'unexpected results from public namespace based descendants query');
diff --git a/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/XMLQNameTest.as b/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/XMLQNameTest.as
new file mode 100644
index 0000000..6412658
--- /dev/null
+++ b/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/XMLQNameTest.as
@@ -0,0 +1,303 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+package flexUnitTests.xml
+{
+
+
+ import flexUnitTests.xml.support.QNameTest;
+ import org.apache.royale.test.asserts.*;
+
+ // import testshim.RoyaleUnitTestRunner;
+
+ /**
+ * @royalesuppresspublicvarwarning
+ */
+ public class XMLQNameTest
+ {
+
+
+ public static var ATOM_NS:Namespace = new Namespace("http://www.w3.org/2005/Atom");
+ private var atom:Namespace = ATOM_NS;
+
+ public static var isJS:Boolean = COMPILE::JS;
+
+ private var settings:Object;
+
+ private var source:String;
+
+ [Before]
+ public function setUp():void
+ {
+ settings = XML.settings();
+ }
+
+ [After]
+ public function tearDown():void
+ {
+ source=null;
+ XML.setSettings(settings);
+ }
+
+ [BeforeClass]
+ public static function setUpBeforeClass():void
+ {
+ }
+
+ [AfterClass]
+ public static function tearDownAfterClass():void
+ {
+ }
+
+
+
+
+
+ [Test]
+ public function testPrimitiveArgs():void{
+ var qName:QName;
+
+ qName = new QName('*');
+ assertEquals(qName.uri,null, 'unexpected uri value');
+ assertEquals(qName.localName,'*', 'unexpected localName value');
+ assertEquals(qName,'*::*', 'unexpected toString value');
+
+ qName = new QName(qName);
+ assertEquals(qName.uri,null, 'unexpected uri value');
+ assertEquals(qName.localName,'*', 'unexpected localName value');
+ assertEquals(qName,'*::*', 'unexpected toString value');
+
+ //anything/anywhere
+ qName = new QName('*','*');
+ assertEquals(qName.uri,'*', 'unexpected uri value');
+ assertEquals(qName.localName,'*', 'unexpected localName value');
+ assertEquals(qName,'*::*', 'unexpected toString value');
+ //clone
+ qName = new QName(qName);
+ assertEquals(qName.uri,'*', 'unexpected uri value');
+ assertEquals(qName.localName,'*', 'unexpected localName value');
+ assertEquals(qName,'*::*', 'unexpected toString value');
+
+ qName = new QName('localNameOnly');
+ assertEquals(qName.uri,'', 'unexpected uri value');
+ assertEquals(qName.localName,'localNameOnly', 'unexpected localName value');
+ assertEquals(qName,'localNameOnly', 'unexpected toString value');
+
+ qName = new QName(null, 'localNameOnly');
+ assertEquals(qName.uri,null, 'unexpected uri value');
+ assertEquals(qName.localName,'localNameOnly', 'unexpected localName value');
+ assertEquals(qName,'*::localNameOnly', 'unexpected toString value');
+
+ qName = new QName(qName);
+ assertEquals(qName.uri,null, 'unexpected uri value');
+ assertEquals(qName.localName,'localNameOnly', 'unexpected localName value');
+ assertEquals(qName,'*::localNameOnly', 'unexpected toString value');
+ }
+
+ [Test]
+ public function testCombos():void{
+ var qName:QName;
+ qName = new QName( 'test','something');
+
+ qName = new QName(undefined, qName);
+ assertEquals(qName.uri,'test', 'unexpected uri value');
+ assertEquals(qName.localName,'something', 'unexpected localName value');
+ assertEquals(qName,'test::something', 'unexpected toString value');
+
+ qName = new QName( 'test','*');
+
+ qName = new QName(undefined, qName);
+ assertEquals(qName.uri,'test', 'unexpected uri value');
+ assertEquals(qName.localName,'*', 'unexpected localName value');
+ assertEquals(qName,'test::*', 'unexpected toString value');
+ }
+
+ [Test]
+ public function testEquality():void{
+ assertTrue(new QName('test') == new QName('test'), 'unexpected equality result');
+ assertFalse(new QName('test') === new QName('test'), 'unexpected strict equality result');
+ }
+
+ [Test]
+ public function testDefaultNamespaceDirective():void{
+ var qName:QName;
+ var pre1QName:QName=new QName();
+ var pre2QName:QName=new QName('pre2');
+ var pre3QName:QName=new QName('pre3NS','pre3');
+ var pre4QName:QName=new QName(new Namespace('pre4NS'),'pre4');
+
+ default xml namespace = 'foo';
+ var post1QName:QName=new QName();
+ var post2QName:QName=new QName('post2');
+ var post3QName:QName=new QName('post3NS','post3');
+ var post4QName:QName=new QName(new Namespace('post4NS'),'post4');
+
+
+
+ qName = new QName('something');
+ assertEquals(qName.uri,'foo', 'unexpected uri value');
+ assertEquals(qName.localName,'something', 'unexpected localName value');
+ assertEquals(qName,'foo::something', 'unexpected toString value');
+
+
+ qName = new QName();
+ assertEquals(qName.uri,'foo', 'unexpected uri value');
+ assertEquals(qName.localName,'', 'unexpected localName value');
+ assertEquals(qName,'foo::', 'unexpected toString value');
+
+ qName = new QName('');
+ assertEquals(qName.uri,'foo', 'unexpected uri value');
+ assertEquals(qName.localName,'', 'unexpected localName value');
+ assertEquals(qName,'foo::', 'unexpected toString value');
+
+ qName = new QName(pre1QName);
+ assertEquals(qName.uri,'', 'unexpected uri value');
+ assertEquals(qName.localName,'', 'unexpected localName value');
+ assertEquals(qName,'', 'unexpected toString value');
+
+ qName = new QName(post1QName);
+ assertEquals(qName.uri,'foo', 'unexpected uri value');
+ assertEquals(qName.localName,'', 'unexpected localName value');
+ assertEquals(qName,'foo::', 'unexpected toString value');
+
+ qName = new QName(pre2QName);
+ assertEquals(qName.uri,'', 'unexpected uri value');
+ assertEquals(qName.localName,'pre2', 'unexpected localName value');
+ assertEquals(qName,'pre2', 'unexpected toString value');
+
+ qName = new QName(post2QName);
+ assertEquals(qName.uri,'foo', 'unexpected uri value');
+ assertEquals(qName.localName,'post2', 'unexpected localName value');
+ assertEquals(qName,'foo::post2', 'unexpected toString value');
+
+ qName = new QName(pre3QName);
+ assertEquals(qName.uri,'pre3NS', 'unexpected uri value');
+ assertEquals(qName.localName,'pre3', 'unexpected localName value');
+ assertEquals(qName,'pre3NS::pre3', 'unexpected toString value');
+
+ qName = new QName(post3QName);
+ assertEquals(qName.uri,'post3NS', 'unexpected uri value');
+ assertEquals(qName.localName,'post3', 'unexpected localName value');
+ assertEquals(qName,'post3NS::post3', 'unexpected toString value');
+
+ qName = new QName(pre4QName);
+ assertEquals(qName.uri,'pre4NS', 'unexpected uri value');
+ assertEquals(qName.localName,'pre4', 'unexpected localName value');
+ assertEquals(qName,'pre4NS::pre4', 'unexpected toString value');
+
+ qName = new QName(post4QName);
+ assertEquals(qName.uri,'post4NS', 'unexpected uri value');
+ assertEquals(qName.localName,'post4', 'unexpected localName value');
+ assertEquals(qName,'post4NS::post4', 'unexpected toString value');
+ }
+
+
+ [Test]
+ public function testDefaultNamespaceVariants():void{
+ var qName:QName;
+ var test:QNameTest = new QNameTest();
+
+ qName = test.getStaticBeforeQName();
+ assertEquals(qName.uri,'', 'unexpected uri value');
+ assertEquals(qName.localName,'staticBefore', 'unexpected localName value');
+ assertEquals(qName,'staticBefore', 'unexpected toString value');
+
+ qName = test.getStaticAfterQName();
+ assertEquals(qName.uri,'', 'unexpected uri value');
+ assertEquals(qName.localName,'staticAfter', 'unexpected localName value');
+ assertEquals(qName,'staticAfter', 'unexpected toString value');
+
+ qName = test.getInstanceBeforeQName();
+ assertEquals(qName.uri,'', 'unexpected uri value');
+ assertEquals(qName.localName,'instanceBefore', 'unexpected localName value');
+ assertEquals(qName,'instanceBefore', 'unexpected toString value');
+
+ qName = test.getInstanceAfterQName();
+ assertEquals(qName.uri,'', 'unexpected uri value');
+ assertEquals(qName.localName,'instanceAfter', 'unexpected localName value');
+ assertEquals(qName,'instanceAfter', 'unexpected toString value');
+
+
+ qName = QNameTest.getInstanceDeclaredInsideStaticMethod();
+ assertEquals(qName.uri,'', 'unexpected uri value');
+ assertEquals(qName.localName,'localfoo', 'unexpected localName value');
+ assertEquals(qName,'localfoo', 'unexpected toString value');
+
+
+ qName = test.getInstanceDeclaredInsideInstanceMethod();
+ assertEquals(qName.uri,'', 'unexpected uri value');
+ assertEquals(qName.localName,'localfoo', 'unexpected localName value');
+ assertEquals(qName,'localfoo', 'unexpected toString value');
+
+
+ qName = QNameTest.getInstanceWithDefaultChangeDeclaredInsideStaticMethod();
+ assertEquals(qName.uri,'foo', 'unexpected uri value');
+ assertEquals(qName.localName,'localfoo', 'unexpected localName value');
+ assertEquals(qName,'foo::localfoo', 'unexpected toString value');
+
+
+ qName = test.getInstanceWithDefaultChangeDeclaredInsideInstanceMethod();
+ assertEquals(qName.uri,'foo', 'unexpected uri value');
+ assertEquals(qName.localName,'localfoo', 'unexpected localName value');
+ assertEquals(qName,'foo::localfoo', 'unexpected toString value');
+
+ /* RoyaleUnitTestRunner.consoleOut('qName '+qName);
+ qName = test.test2();
+ RoyaleUnitTestRunner.consoleOut('qName '+qName);
+
+ assertTrue(true);*/
+ }
+
+ [Test]
+ public function testAdvancedWildcards():void{
+ var ns:Namespace = new Namespace('*');
+ var ns2:Namespace = new Namespace('');
+ var test1:QName = new QName('*');
+
+ var test2:QName = new QName(null,'*');
+ var test3:QName = new QName('*','*');
+ var test4:QName = new QName(ns,'*');
+ var test5:QName = new QName(ns2,'*');
+ var test6:QName = new QName(undefined,'*');
+
+ assertEquals(test1.uri, null, 'unexpected toString');
+ assertEquals(test2.uri, null, 'unexpected toString');
+ assertEquals(test3.uri, '*', 'unexpected toString');
+ assertEquals(test4.uri, '*', 'unexpected toString');
+ assertEquals(test5.uri, '', 'unexpected toString');
+ assertEquals(test6.uri, null, 'unexpected toString');
+
+ assertEquals(test1.toString(), '*::*', 'unexpected toString');
+ assertEquals(test2.toString(), '*::*', 'unexpected toString');
+ assertEquals(test3.toString(), '*::*', 'unexpected toString');
+ assertEquals(test4.toString(), '*::*', 'unexpected toString');
+ assertEquals(test5.toString(), '*', 'unexpected toString');
+ assertEquals(test6.toString(), '*::*', 'unexpected toString');
+
+ assertTrue(test2 == test1, 'unexpected equality result');
+ assertFalse(test3 == test1, 'unexpected equality result');
+ assertFalse(test3 == test1, 'unexpected equality result');
+ assertFalse(test4 == test1, 'unexpected equality result');
+ assertFalse(test5 == test1, 'unexpected equality result');
+ assertTrue(test6 == test1, 'unexpected equality result');
+
+ }
+
+
+ }
+}
diff --git a/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/XMLTesterGeneralTest.as b/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/XMLTesterGeneralTest.as
index 05ca072..6139fd1 100644
--- a/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/XMLTesterGeneralTest.as
+++ b/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/XMLTesterGeneralTest.as
@@ -191,6 +191,13 @@ package flexUnitTests.xml
}
+ [Test]
+ public function testMinimum():void{
+ var xml:XML = new XML();
+ assertEquals(xml.nodeKind(), 'text', 'unexpected default nodeKind');
+ assertEquals(xml.toString(), '', 'unexpected default stringification');
+ }
+
[Test]
public function testXMLMethods1():void
@@ -504,23 +511,57 @@ package flexUnitTests.xml
[Test]
public function testChildList():void{
var xml:XML = <root> asdasdas <element/> asdasqdasd<otherElement/></root>;
-
-
+
var list:XMLList = xml.*;
-
- //var list:XMLList = xml.child('*')
-
+
assertEquals( 4, list.length(), 'Error in list length');
- //trace(list.length());
+ assertEquals( list.toXMLString(), 'asdasdas\n' + '<element/>\n' +'asdasqdasd\n' +'<otherElement/>', 'Error in list length');
+
list = xml.element;
assertEquals( 1, list.length(), 'Error in list length');
- //list = xml.child('element')
+ assertEquals( list.toXMLString(),'<element/>', 'Error in list length');
+
+ list = xml.otherElement;
+
+ assertEquals( 1, list.length(), 'Error in list length');
+ assertEquals( list.toXMLString(),'<otherElement/>', 'Error in list length');
+
+ list = xml.otherElement;
+ assertEquals( 1, list.length(), 'Error in list length');
- // trace(list.length())
+ }
+
+ [Test]
+ [TestVariance(variance="JS",description="Some browsers (IE11/Edge legacy) can parse to a different order of attributes and namespace declarations (which affects stringified content comparisons)")]
+ public function testChildVariants():void{
+ var xml:XML = <root xmlns:foo="foo" xmlns:other="other"> asdasdas <element/> asdasqdasd<otherElement/><foo:otherElement/><other:otherElement/></root>;
+
+ var list:XMLList = xml.*::*;
+
+ assertEquals( 4, list.length(), 'Error in list length');
+ //IE11/Edge issues
+ /*assertEquals( list.toXMLString(), '<element xmlns:foo="foo" xmlns:other="other"/>\n' +
+ '<otherElement xmlns:foo="foo" xmlns:other="other"/>\n' +
+ '<foo:otherElement xmlns:foo="foo" xmlns:other="other"/>\n' +
+ '<other:otherElement xmlns:foo="foo" xmlns:other="other"/>', 'Error in list content');*/
+ assertEquals( list.toXMLString().length, 212, 'Error in list content');
+
list = xml.otherElement;
- //list = xml.child('otherElement')
assertEquals( 1, list.length(), 'Error in list length');
+ //IE11/Edge issues
+ /* assertEquals( list.toXMLString(),'<otherElement xmlns:foo="foo" xmlns:other="other"/>', 'Error in list content');*/
+ assertEquals( list.toXMLString().length,51, 'Error in list content');
+
+ list = xml.*;
+ assertEquals( 6, list.length(), 'Error in list length');
+ /* assertEquals( list.toXMLString(),'asdasdas\n' +
+ '<element xmlns:foo="foo" xmlns:other="other"/>\n' +
+ 'asdasqdasd\n' +
+ '<otherElement xmlns:foo="foo" xmlns:other="other"/>\n' +
+ '<foo:otherElement xmlns:foo="foo" xmlns:other="other"/>\n' +
+ '<other:otherElement xmlns:foo="foo" xmlns:other="other"/>', 'Error in list content');*/
+ assertEquals( list.toXMLString().length,232, 'Error in list content');
}
@@ -570,7 +611,7 @@ package flexUnitTests.xml
assertTrue( caughtError, 'Unexpected Error state with duplicate attribute declarations');
}
-
+
[Test]
public function testParsingWhitespaceSetting1():void{
var originalSetting:Boolean = XML.ignoreWhitespace;
@@ -718,11 +759,10 @@ package flexUnitTests.xml
}
[Test]
- [TestVariance(variance="JS",description="Some browsers can parse to a different order of attributes and namespace declarations (which affects stringified content comparisons)")]
+ [TestVariance(variance="JS",description="Some browsers (IE11/Edge legacy) can parse to a different order of attributes and namespace declarations (which affects stringified content comparisons)")]
public function testLargeComplex():void{
var xmlString:String = xml.toXMLString();
-
-
+
//IE and MS Edge: inlcude alternate output check
//account for variation in output order of attributes and namespace declarations (from native DOMParser)
assertTrue( xmlString.length == 2060, 'unexpected complex stringify results');
@@ -992,7 +1032,7 @@ package flexUnitTests.xml
assertTrue( localXml == sizes[0], 'XML content was unexpected');
}
-
+
[Test]
public function testChildren():void{
XML.setSettings(XML.defaultSettings());
@@ -1038,9 +1078,9 @@ package flexUnitTests.xml
' <!-- comment -->\n' +
' surrounded With Whitespace\n' +
'</root>' , 'unexpected parsing with ignoreComments = false and ignoreProcessingInstructions= false and ignoreWhitespace= false string output');
-
+
//try something different
-
+
XML.ignoreComments = true;
xml = <root> <test/><?foo bar?>Something<!-- comment --> surrounded With Whitespace </root>;
//because ignoreComments is true, the following is parsed as an empty test node:
@@ -1055,7 +1095,7 @@ package flexUnitTests.xml
' surrounded With Whitespace\n' +
' \n' +
'</root>' , 'unexpected parsing with ignoreComments = true and ignoreProcessingInstructions= false and ignoreWhitespace= false and appending comment... string output');
-
+
XML.ignoreComments = false;
var comment:XML = <xml><!-- appended comment --></xml>;
comment = comment.comments()[0];
@@ -1064,7 +1104,7 @@ package flexUnitTests.xml
xml = <root> <test/><?foo bar?>Something<!-- comment --> surrounded With Whitespace </root>;
//because ignoreComments is true, the following is parsed as an empty test node:
xml.appendChild(comment);
-
+
assertEquals(xml.children().length(),6 , 'unexpected parsing with ignoreComments = true and ignoreProcessingInstructions= false and ignoreWhitespace= false and appending comment... children length');
assertEquals(xml.toXMLString(),
'<root>\n' +
@@ -1075,9 +1115,9 @@ package flexUnitTests.xml
' surrounded With Whitespace\n' +
' <!-- appended comment -->\n' +
'</root>' , 'unexpected parsing with ignoreComments = true and ignoreProcessingInstructions= false and ignoreWhitespace= false and appending comment... string output');
-
-
-
+
+
+
XML.setSettings(XML.defaultSettings());
}
}
diff --git a/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/XMLTesterNamespaceQueries.as b/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/XMLTesterNamespaceQueries.as
new file mode 100644
index 0000000..6de1744
--- /dev/null
+++ b/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/XMLTesterNamespaceQueries.as
@@ -0,0 +1,207 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+package flexUnitTests.xml
+{
+
+
+ import org.apache.royale.test.asserts.*;
+
+ // import testshim.RoyaleUnitTestRunner;
+
+ /**
+ * @royalesuppresspublicvarwarning
+ */
+ public class XMLTesterNamespaceQueries
+ {
+
+ public static var isJS:Boolean = COMPILE::JS;
+
+ private var settings:Object;
+
+ [Before]
+ public function setUp():void
+ {
+ settings = XML.settings();
+ }
+
+
+
+ [After]
+ public function tearDown():void
+ {
+ XML.setSettings(settings);
+ }
+
+ [BeforeClass]
+ public static function setUpBeforeClass():void
+ {
+ }
+
+ [AfterClass]
+ public static function tearDownAfterClass():void
+ {
+ }
+
+
+ [Test]
+ [TestVariance(variance="JS",description="Some browsers (IE11/Edge legacy) can parse to a different order of attributes and namespace declarations (which affects stringified content comparisons)")]
+ public function minimalTest():void{
+ var feed:XML = new XML(
+ '<feed xmlns:atom="http://www.w3.org/2005/Atom" xmlns:m="nothing">\n' +
+ ' <link rel="no_namespace" href="blah/12321/domain/"/>\n' +
+ '</feed>\n');
+
+ var atomSpace:Namespace = new Namespace('http://www.w3.org/2005/Atom');
+ var atom:XMLList = feed.child(new QName('http://www.w3.org/2005/Atom','link'));
+ assertEquals(atom[0].name().uri,'', 'unexpected uri (should be empty)');
+ //IE11... order is different:
+ //assertEquals(atom.toXMLString(),'<link rel="no_namespace" href="blah/12321/domain/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:m="nothing"/>', 'unexpected content');
+ assertEquals(atom.toXMLString().length,111, 'unexpected content');
+
+ atom = feed.atomSpace::link;
+ assertEquals(atom.length(),0, 'unexpected query result');
+
+
+ atom = feed.child(new QName(atomSpace,'link'));
+ assertEquals(atom[0].name().uri,'', 'unexpected uri (should be empty)');
+ //IE11... order is different:
+ //assertEquals(atom.toXMLString(),'<link rel="no_namespace" href="blah/12321/domain/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:m="nothing"/>', 'unexpected content');
+ assertEquals(atom.toXMLString().length,111, 'unexpected content');
+
+
+ atom = feed.child(atomSpace);
+ assertEquals(atom.length(),0, 'unexpected query result');
+
+ }
+
+ [Test]
+ [TestVariance(variance="JS",description="Some browsers (IE11/Edge legacy) can parse to a different order of attributes and namespace declarations (which affects stringified content comparisons)")]
+ public function testNamespace():void{
+ var xml:XML = <test xmlns='testingspace' xmlns:other='otherspace'>
+ <child att='child:testingspace_attvalue' other:att='child:otherspace_attvalue' original="child"/>
+ <other:child att='other:child:testingspace_attvalue' other:att='other:child:otherspace_attvalue' original="other:child"/>
+ </test>;
+
+ assertEquals(xml.child.length(),0, 'unexpected child query length');
+ assertEquals(xml.child.@att.length(),0, 'unexpected child att query length');
+
+ default xml namespace ='testingspace';
+
+ assertEquals(xml.child.length(),1, 'unexpected child query length');
+ //IE11... order is different:
+ //assertEquals(xml.child.toXMLString(),'<child att="child:testingspace_attvalue" other:att="child:otherspace_attvalue" original="child" xmlns="testingspace" xmlns:other="otherspace"/>', 'unexpected child query content');
+ assertEquals(xml.child.toXMLString().length,143, 'unexpected child query content');
+
+ assertEquals(xml.child.@att.length(),1, 'unexpected child att query length');
+ assertEquals(xml.child.@att.toXMLString(),'child:testingspace_attvalue', 'unexpected child att query content');
+ var ns:Namespace = new Namespace('otherspace');
+ //IE11... order is different:
+ //assertEquals(xml.ns::child.toXMLString(),'<other:child att="other:child:testingspace_attvalue" other:att="other:child:otherspace_attvalue" original="other:child" xmlns="testingspace" xmlns:other="otherspace"/>', 'unexpected child query content');
+ assertEquals(xml.ns::child.toXMLString().length,167, 'unexpected child query content');
+
+ assertEquals(xml.ns::child.@att.toXMLString(),'other:child:testingspace_attvalue', 'unexpected child att query content');
+
+ assertEquals(xml.child.@ns::att.toXMLString(),'child:otherspace_attvalue', 'unexpected child att query content');
+ assertEquals(xml.ns::child.@ns::att.toXMLString(),'other:child:otherspace_attvalue', 'unexpected child att query content');
+ default xml namespace ='otherspace';
+
+ assertEquals(xml.child.@ns::att.toXMLString(),'other:child:otherspace_attvalue', 'unexpected child att query content');
+ assertEquals(xml.child.length(),1, 'unexpected child query length');
+ //IE11... order is different:
+ //assertEquals(xml.child.toXMLString(),'<other:child att="other:child:testingspace_attvalue" other:att="other:child:otherspace_attvalue" original="other:child" xmlns="testingspace" xmlns:other="otherspace"/>', 'unexpected child query content');
+ assertEquals(xml.child.toXMLString().length,167, 'unexpected child query content');
+
+
+ /* RoyaleUnitTestRunner.consoleOut('--');
+ RoyaleUnitTestRunner.consoleOut(xml.child.toXMLString());
+ RoyaleUnitTestRunner.consoleOut('--');
+ RoyaleUnitTestRunner.consoleOut(xml.child.@att.toXMLString());*/
+
+ assertEquals(xml.child.@att.length(),2, 'unexpected child att query length');
+ //IE11... order is different:
+ //assertEquals(xml.child.@att.toXMLString(),'other:child:testingspace_attvalue\n' +'other:child:otherspace_attvalue', 'unexpected child att query content');
+ assertEquals(xml.child.@att.toXMLString().length,65, 'unexpected child att query content');
+
+ }
+
+ [Test]
+ [TestVariance(variance="JS",description="Some browsers (IE11/Edge legacy) can parse to a different order of attributes and namespace declarations (which affects stringified content comparisons)")]
+ public function testNamespace2():void{
+ var xml:XML = <test xmlns='testingspace' xmlns:other='otherspace' xmlns:also="testingspace">
+ <child att='child:testingspace_attvalue' other:att='child:otherspace_attvalue' original="child"/>
+ <other:child att='other:child:testingspace_attvalue' other:att='other:child:otherspace_attvalue' original="other:child"/>
+ <also:child att='also:child:testingspace_attvalue' also:att='also:child:testingspace_attvalue' other:att='also:child:otherspace_attvalue' original="also:child"/>
+ </test>;
+ assertEquals(xml.child.length(),0, 'xml.child.length()');
+ assertEquals(xml.child.@att.length(),0, 'xml.child.@att.length()');
+
+
+ /* RoyaleUnitTestRunner.consoleOut(xml.children()[2].toXMLString());
+ RoyaleUnitTestRunner.consoleOut(xml.toXMLString());
+ RoyaleUnitTestRunner.consoleOut("------");*/
+
+ //IE11/Edge issues
+ /*assertEquals(xml.toXMLString(),'<test xmlns="testingspace" xmlns:other="otherspace" xmlns:also="testingspace">\n' +
+ ' <child att="child:testingspace_attvalue" other:att="child:otherspace_attvalue" original="child"/>\n' +
+ ' <other:child att="other:child:testingspace_attvalue" other:att="other:child:otherspace_attvalue" original="other:child"/>\n' +
+ ' <child att="also:child:testingspace_attvalue" att="also:child:testingspace_attvalue" other:att="also:child:otherspace_attvalue" original="also:child"/>\n' +
+ '</test>', 'unexpected strinfification');*/
+ assertEquals(xml.toXMLString().length,464, 'unexpected strinfgification');
+
+ //change to default ns:
+ default xml namespace ='testingspace';
+
+ assertEquals(xml.child.length(),2, 'unexpected child query length');
+ //IE11/Edge issues
+ /* assertEquals(xml.child.toXMLString(),'<child att="child:testingspace_attvalue" other:att="child:otherspace_attvalue" original="child" xmlns="testingspace" xmlns:other="otherspace" xmlns:also="testingspace"/>\n' +
+ '<child att="also:child:testingspace_attvalue" att="also:child:testingspace_attvalue" other:att="also:child:otherspace_attvalue" original="also:child" xmlns="testingspace" xmlns:other="otherspace" xmlns:also="testingspace"/>', 'unexpected child query content');*/
+ assertEquals(xml.child.toXMLString().length,393, 'unexpected child query content');
+
+
+ assertEquals(xml.child.@att.length(),3, 'unexpected child att query length');
+ assertEquals(xml.child.@att.toXMLString(),'child:testingspace_attvalue\n' +
+ 'also:child:testingspace_attvalue\n' +
+ 'also:child:testingspace_attvalue', 'unexpected child att query content');
+
+ //use specific ns
+ var ns:Namespace = new Namespace('otherspace');
+ //IE11/Edge issue:
+ /*assertEquals(xml.ns::child.toXMLString(),'<other:child att="other:child:testingspace_attvalue" other:att="other:child:otherspace_attvalue" original="other:child" xmlns="testingspace" xmlns:other="otherspace" xmlns:also="testingspace"/>', 'unexpected child query content');*/
+ assertEquals(xml.ns::child.toXMLString().length,193, 'unexpected child query content');
+
+ assertEquals(xml.ns::child.@att.toXMLString(),'other:child:testingspace_attvalue', 'unexpected child att query content');
+ assertEquals(xml.child.@ns::att.toXMLString(),'child:otherspace_attvalue\n' + 'also:child:otherspace_attvalue', 'unexpected child att query content');
+ assertEquals(xml.ns::child.@ns::att.toXMLString(),'other:child:otherspace_attvalue', 'unexpected child att query content');
+ default xml namespace ='otherspace';
+
+ assertEquals(xml.child.@ns::att.toXMLString(),'other:child:otherspace_attvalue', 'unexpected child att query content');
+ assertEquals(xml.child.length(),1, 'unexpected child query length');
+ //IE11/Edge issue:
+ //assertEquals(xml.child.toXMLString(),'<other:child att="other:child:testingspace_attvalue" other:att="other:child:otherspace_attvalue" original="other:child" xmlns="testingspace" xmlns:other="otherspace" xmlns:also="testingspace"/>', 'unexpected child query content');
+ assertEquals(xml.child.toXMLString().length,193, 'unexpected child query content');
+
+ assertEquals(xml.child.@att.length(),2, 'unexpected child att query length');
+ //IE11/Edge issue:
+ /*assertEquals(xml.child.@att.toXMLString(),'other:child:testingspace_attvalue\n' +'other:child:otherspace_attvalue', 'unexpected child att query content');*/
+ assertEquals(xml.child.@att.toXMLString().length,65, 'unexpected child att query content');
+
+ }
+
+ }
+}
diff --git a/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/XMLTesterStringifyTest.as b/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/XMLTesterStringifyTest.as
index 71b9a74..032cfe6 100644
--- a/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/XMLTesterStringifyTest.as
+++ b/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/XMLTesterStringifyTest.as
@@ -90,7 +90,7 @@ package flexUnitTests.xml
[Test]
- [TestVariance(variance="JS",description="Some browsers can parse to a different order of attributes and namespace declarations (which affects stringified content comparisons)")]
+ [TestVariance(variance="JS",description="Some browsers (IE11/Edge legacy) can parse to a different order of attributes and namespace declarations (which affects stringified content comparisons)")]
public function testStringifyAdvanced():void{
XML.ignoreWhitespace = true;
XML.prettyPrinting = false;
@@ -316,8 +316,30 @@ package flexUnitTests.xml
'<script><![CDATA[private function onStylesLoaded(ev:Event):void {currentState = "normal";facade = ApplicationFacade.getInstance();facade.notifyObservers(new Notification(ApplicationFacade.CMD_STARTUP, this));} ]]></script>',
script.toXMLString(), 'unexpected toXMLString with child CDATA')
}
-
-
+
+ [Test]
+ [TestVariance(variance="JS",description="Some browsers (IE11/Edge legacy) can parse to a different order of attributes and namespace declarations (which affects stringified content comparisons)")]
+ public function testDeclarationOrder():void{
+ var xml:XML = <root xmlns:also="def" xmlns="def"><child/></root>;
+ var check:String = xml.children().toXMLString();
+ var options:Array = ['<also:child xmlns:also="def" xmlns="def"/>','<child xmlns="def" xmlns:also="def"/>'];
+ if (options.indexOf(check) != 0) {
+ trace('testDeclarationOrder: this browser does not conform to swf behavior')
+ //RoyaleUnitTestRunner.consoleOut('testDeclarationOrder:0 this browser does not conform to swf behavior')
+ }
+ assertTrue(
+ options.indexOf(check) != -1, 'unexpected toXMLString with declaration order')
+
+ xml = <root xmlns="def" xmlns:also="def"><child/></root>;
+ check = xml.children().toXMLString();
+ if (options.indexOf(check) != 1) {
+ trace('testDeclarationOrder: this browser does not conform to swf behavior')
+ //RoyaleUnitTestRunner.consoleOut('testDeclarationOrder:1 this browser does not conform to swf behavior')
+ }
+ assertTrue(
+ options.indexOf(check) != -1, 'unexpected toXMLString content')
+
+ }
}
}
diff --git a/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/support/NamespaceTest.as b/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/support/NamespaceTest.as
new file mode 100644
index 0000000..02373cf
--- /dev/null
+++ b/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/support/NamespaceTest.as
@@ -0,0 +1,193 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+package flexUnitTests.xml.support
+{
+
+ public class NamespaceTest {
+
+ private namespace atom = "http://www.w3.org/2005/Atom";
+ private namespace nothing = "nothing";
+
+ public function NamespaceTest() {
+ // constructor code
+
+ }
+
+ private var feed:XML = new XML(
+ '<feed xmlns="http://www.w3.org/2005/Atom" xmlns:m="nothing">\n' +
+ ' <link rel="self" type="application/atom+xml" href="config/blahblah/user/123123"/>'+
+ ' <link rel="customer" href="customer/999973324764966"/>\n' +
+ ' <link rel="domain" href="customer/443512501473324764966/domain/"/>\n' +
+ ' <link rel="tags" href="config/45545/domain/"/>\n' +
+ ' <m:link rel="nothing" href="config/45545/domain/"/>\n' +
+ '</feed>\n');
+
+
+ private var feed2:XML = new XML(
+ '<feed xmlns:atom="http://www.w3.org/2005/Atom" xmlns:m="nothing">\n' +
+ ' <atom:link rel="self" type="application/atom+xml" href="config/blahblah/user/123123"/>'+
+ ' <atom:link rel="customer" href="customer/999973324764966"/>\n' +
+ ' <atom:link rel="domain" href="customer/443512501473324764966/domain/"/>\n' +
+ ' <atom:link rel="tags" href="config/45545/domain/"/>\n' +
+ ' <m:link rel="nothing" href="config/45545/domain/"/>\n' +
+ ' <link rel="no_namespace" href="blah/12321/domain/"/>\n' +
+ '</feed>\n');
+
+ public function test1():XMLList{
+ use namespace atom;
+ //no conflict with namespace name and local var name:
+ var atom1:XMLList = feed.link;
+ return atom1;
+ }
+
+ public function test1a():XMLList{
+ use namespace atom;
+ //conflict between namespace name and local var name:
+ var atom:XMLList = feed.link;
+ return atom;
+ }
+
+ public function test2():XMLList{
+ use namespace atom;
+ use namespace nothing;
+ //no conflict with namespace name and local var name, multiple use directives
+ var atom1:XMLList = feed.link;
+ return atom1
+ }
+
+ public function test2a():XMLList{
+ use namespace atom;
+ use namespace nothing;
+ //conflict with namespace name and local var name, multiple use directives
+ var atom:XMLList = feed.link;
+ return atom
+ }
+
+ public function test3():XMLList{
+ //explicit namespace usage
+ var atomSpace:Namespace = new Namespace('http://www.w3.org/2005/Atom');
+
+ var atom:XMLList = feed.atomSpace::link;
+ return atom;
+ }
+
+
+ public function test4():XMLList{
+ //explicit QName
+
+ var atom:XMLList = feed.child(new QName('http://www.w3.org/2005/Atom','link'));
+ return atom;
+ }
+
+ public function test5():XMLList{
+ //explicit QName children filter
+ const atomLink:QName = new QName('http://www.w3.org/2005/Atom','link');
+ var atom:XMLList = feed.children().(name()==atomLink);
+ return atom;
+ }
+
+ /*public function test6():XMLList{
+ //explicit QNames children filter
+ const atomLink:QName = new QName('http://www.w3.org/2005/Atom','link');
+ const nothingLink:QName = new QName('nothing','link');
+ var atom:XMLList = feed.children().(atomLink || nothingLink);
+ return atom;
+ }*/
+
+
+ public function test7():XMLList{
+ var atomSpace:Namespace = new Namespace('http://www.w3.org/2005/Atom');
+
+ var atom:XMLList = feed.atomSpace::link;
+ atom = atom.@rel;
+ return atom;
+ }
+
+
+ public function test11():XMLList{
+ use namespace atom;
+ //no conflict with namespace name and local var name:
+ var atom1:XMLList = feed2.link;
+ return atom1;
+ }
+
+ public function test11a():XMLList{
+ use namespace atom;
+ //conflict between namespace name and local var name:
+ var atom:XMLList = feed2.link;
+ return atom;
+ }
+
+ public function test12():XMLList{
+ use namespace atom;
+ use namespace nothing;
+ //no conflict with namespace name and local var name, multiple use directives
+ var atom1:XMLList = feed2.link;
+ return atom1
+ }
+
+ public function test12a():XMLList{
+ use namespace atom;
+ use namespace nothing;
+ //conflict with namespace name and local var name, multiple use directives
+ var atom:XMLList = feed2.link;
+ return atom
+ }
+
+ public function test13():XMLList{
+ //explicit namespace usage
+ var atomSpace:Namespace = new Namespace('http://www.w3.org/2005/Atom');
+
+ var atom:XMLList = feed2.atomSpace::link;
+ return atom;
+ }
+
+
+ public function test14():XMLList{
+ //explicit QName
+
+ var atom:XMLList = feed2.child(new QName('http://www.w3.org/2005/Atom','link'));
+ return atom;
+ }
+
+
+ public function test16():XMLList{
+ //explicit QName children filter
+ const atomLink:QName = new QName('http://www.w3.org/2005/Atom','link');
+ var atom:XMLList = feed2.children().('link' == name());
+ return atom;
+ }
+
+ public function test16a():XMLList{
+ //explicit QName children filter
+ const atomLink:QName = new QName('http://www.w3.org/2005/Atom','link');
+ var atom:XMLList = feed2.children().(name() == atomLink);
+ return atom;
+ }
+
+ //@todo process generated filter function for namespaces
+ public function test15():XMLList{
+ //explicit QName children filter
+ const atomLink:QName = new QName('http://www.w3.org/2005/Atom','link');
+ var atom:XMLList = feed2.children().(atomLink == name());
+ return atom;
+ }
+ }
+
+}
diff --git a/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/support/QNameTest.as b/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/support/QNameTest.as
new file mode 100644
index 0000000..df8f9b5
--- /dev/null
+++ b/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/support/QNameTest.as
@@ -0,0 +1,97 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+package flexUnitTests.xml.support
+{
+
+
+ /**
+ * @royalesuppresspublicvarwarning
+ */
+ public class QNameTest {
+
+
+ public static var staticBefore:QName = new QName('staticBefore');
+
+ public var instanceBefore:QName = new QName('instanceBefore');
+ default xml namespace = "foo"; //this appears to do nothing in this context
+
+ public static var staticAfter:QName = new QName('staticAfter');
+ public var instanceAfter:QName = new QName('instanceAfter');
+
+ public function QNameTest() {
+ // constructor code
+ }
+
+
+ /**
+ * QName instance was declared as static in source code before the source code default namespace directive
+ */
+ public function getStaticBeforeQName():QName{
+ return staticBefore;
+ }
+ /**
+ * QName instance was declared as static in source code after the source code default namespace directive
+ */
+ public function getStaticAfterQName():QName{
+ return staticAfter;
+ }
+
+ /**
+ * QName instance was declared in source code before the source code default namespace directive
+ */
+ public function getInstanceBeforeQName():QName{
+ return instanceBefore;
+ }
+
+ /**
+ * QName instance was declared in source code after the source code default namespace directive
+ */
+ public function getInstanceAfterQName():QName{
+ return instanceAfter;
+ }
+
+ public static function getInstanceDeclaredInsideStaticMethod():QName{
+ var qName:QName = new QName('localfoo');
+ return qName;
+ }
+
+ public function getInstanceDeclaredInsideInstanceMethod():QName{
+ var qName:QName = new QName('localfoo');
+ return qName;
+ }
+
+
+ public static function getInstanceWithDefaultChangeDeclaredInsideStaticMethod():QName{
+ default xml namespace = 'foo';
+ var qName:QName = new QName('localfoo');
+ return qName;
+ }
+
+ public function getInstanceWithDefaultChangeDeclaredInsideInstanceMethod():QName{
+ default xml namespace = 'foo';
+ var qName:QName = new QName('localfoo');
+ return qName;
+ }
+
+
+
+
+ }
+
+}
diff --git a/manualtests/UnitTests/src/main/royale/flexUnitTests/XMLTester.as b/manualtests/UnitTests/src/main/royale/flexUnitTests/XMLTester.as
index 460f423..0d3009c 100644
--- a/manualtests/UnitTests/src/main/royale/flexUnitTests/XMLTester.as
+++ b/manualtests/UnitTests/src/main/royale/flexUnitTests/XMLTester.as
@@ -34,7 +34,7 @@ package flexUnitTests
}
- public var xmlTesterGeneralTest:XMLTesterGeneralTest;
+ /*public var xmlTesterGeneralTest:XMLTesterGeneralTest;
public var xmlTesterStringifyTest:XMLTesterStringifyTest;
@@ -44,7 +44,7 @@ package flexUnitTests
public var xmlNamespaceClassTest:XMLNamespaceClassTest;
- public var xmlQNameTest:XMLQNameTest;
+ public var xmlQNameTest:XMLQNameTest;*/
public var xmlNamespaceQueries:XMLTesterNamespaceQueries;
diff --git a/manualtests/UnitTests/src/main/royale/flexUnitTests/language/LanguageTesterTestArraylikeGetSet.as b/manualtests/UnitTests/src/main/royale/flexUnitTests/language/LanguageTesterTestArraylikeGetSet.as
index 8ff14fe..4282afa 100644
--- a/manualtests/UnitTests/src/main/royale/flexUnitTests/language/LanguageTesterTestArraylikeGetSet.as
+++ b/manualtests/UnitTests/src/main/royale/flexUnitTests/language/LanguageTesterTestArraylikeGetSet.as
@@ -60,13 +60,11 @@ package flexUnitTests.language
}
- /*public function LanguageTesterTestArraylikeGetSet(){
-
- }*/
+
public var arrayList:ArrayList;
- /* [Test]
+ [Test]
public function testImpl():void
{
var other:ArrayList = new ArrayList([1,2,3]);
@@ -151,7 +149,7 @@ package flexUnitTests.language
assertEquals(alv.getItemAt(0),'inside try', 'unexpected try/catch/finally result');
assertEquals(alv.getItemAt(1),'inside finally', 'unexpected try/catch/finally result');
}
- */
+
[Test]
public function testNested():void
diff --git a/manualtests/UnitTests/src/main/royale/flexUnitTests/xml/XMLTesterGeneralTest.as b/manualtests/UnitTests/src/main/royale/flexUnitTests/xml/XMLTesterGeneralTest.as
index f9676af..e5e9986 100644
--- a/manualtests/UnitTests/src/main/royale/flexUnitTests/xml/XMLTesterGeneralTest.as
+++ b/manualtests/UnitTests/src/main/royale/flexUnitTests/xml/XMLTesterGeneralTest.as
@@ -527,6 +527,10 @@ package flexUnitTests.xml
assertEquals( 1, list.length(), 'Error in list length');
assertEquals( list.toXMLString(),'<otherElement/>', 'Error in list length');
+
+ list = xml.otherElement;
+ assertEquals( 1, list.length(), 'Error in list length');
+
}
[Test]