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/05/19 06:47:15 UTC

[royale-asjs] 03/05: Updates and tweaks to XML. Port adhoc tests and add new XML tests (97 assertions for XML) to UnitTests manualtest

This is an automated email from the ASF dual-hosted git repository.

gregdove pushed a commit to branch improvements/Language
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git

commit b20dccedeae6c0689c160325d2b80d2b0664755e
Author: greg-dove <gr...@gmail.com>
AuthorDate: Sun May 19 17:35:37 2019 +1200

    Updates and tweaks to XML. Port adhoc tests and add new XML tests (97 assertions for XML) to UnitTests manualtest
---
 .../projects/Language/src/main/royale/QName.as     |   3 +-
 frameworks/projects/XML/src/main/royale/XML.as     |   3 +-
 manualtests/UnitTests/build.xml                    |  20 +-
 manualtests/UnitTests/pom.xml                      |  27 +-
 .../src/main/config/compile-app-config.xml         |  17 +-
 .../UnitTests/src/main/royale/MyInitialView.mxml   |  66 +-
 .../UnitTests/src/main/royale/TestClasses.as       |   3 +-
 .../UnitTests/src/main/royale/UnitTests.mxml       |  13 +-
 .../language/LanguageTesterTestVector.as           | 238 ++++---
 .../flexUnitTests/xml/XMLTesterGeneralTest.as      | 699 ++++++++++++++++++---
 .../flexUnitTests/xml/XMLTesterStringifyTest.as    | 114 +++-
 .../main/royale/testshim/RoyaleUnitTestRunner.as   |  36 +-
 manualtests/UnitTests/testsview/index.html         |   2 +-
 manualtests/build_example.xml                      |  20 +-
 14 files changed, 1021 insertions(+), 240 deletions(-)

diff --git a/frameworks/projects/Language/src/main/royale/QName.as b/frameworks/projects/Language/src/main/royale/QName.as
index a0199ef..cdb01eb 100644
--- a/frameworks/projects/Language/src/main/royale/QName.as
+++ b/frameworks/projects/Language/src/main/royale/QName.as
@@ -117,12 +117,13 @@ package
 		COMPILE::JS
 		public function equals(name:QName):Boolean
 		{
-			return this.uri == name.uri && this.localName == name.localName; // this.prefix == name.prefix &&
+			return name != null && this.uri == name.uri && this.localName == name.localName; // this.prefix == name.prefix &&
 		}
 		
     	COMPILE::JS
 		public function matches(name:QName):Boolean
 		{
+			if (name == null) return this.localName == "*";
 			if(this.uri == "*" || name.uri == "*")
 				return this.localName == "*" || name.localName == "*" || this.localName == name.localName;
 
diff --git a/frameworks/projects/XML/src/main/royale/XML.as b/frameworks/projects/XML/src/main/royale/XML.as
index 01229c2..f0ae94f 100644
--- a/frameworks/projects/XML/src/main/royale/XML.as
+++ b/frameworks/projects/XML/src/main/royale/XML.as
@@ -817,9 +817,10 @@ package
 			else
 			{
 				len = childrenLength();
+				var all:Boolean = propertyName.localName == "*";
 				for(i=0;i<len;i++)
 				{
-					if(propertyName.matches(_children[i].name()))
+					if(all || propertyName.matches(_children[i].name()))
 						list.append(_children[i]);
 				}
 			}
diff --git a/manualtests/UnitTests/build.xml b/manualtests/UnitTests/build.xml
index 55b9a7d..e4fbad5 100644
--- a/manualtests/UnitTests/build.xml
+++ b/manualtests/UnitTests/build.xml
@@ -22,11 +22,12 @@
 <project name="UnitTests" default="main" basedir=".">
     <property name="ROYALE_HOME" location="../.."/>
     <property name="example" value="UnitTests" />
-
     <!-- adding flexuint style meta collection, and additional testing meta tags (Event,Bindable,TestMeta)-->
-    <property name="theme_arg" value="-keep-as3-metadata+=Test,BeforeClass,AfterClass,Before,After,TestVariance,Event,Bindable,TestMeta" />
+    <!--<property name="theme_arg" value="-keep-as3-metadata+=Test,BeforeClass,AfterClass,Before,After,TestVariance,Event,Bindable,TestMeta" />-->
+    <property name="theme_arg" value="-keep-code-with-metadata=Test,BeforeClass,AfterClass,Before,After,TestVariance,TestMeta" />
     <!-- adding flexuint style meta collection, and additional testing meta tags (Event,Bindable,TestMeta)-->
-    <property name="extlib_arg" value="-keep-code-with-metadata=Test,BeforeClass,AfterClass,Before,After,TestVariance,TestMeta" />
+    <!--<property name="extlib_arg" value="-keep-code-with-metadata=Test,BeforeClass,AfterClass,Before,After,TestVariance,TestMeta" />-->
+    <property name="swf.version" value="30" />
 
     <property file="${ROYALE_HOME}/env.properties"/>
     <property environment="env"/>
@@ -35,16 +36,19 @@
 
 	<!-- make ant src and output consistent with maven -->
 	<property name="maven_compat" value="true"/>
-
+    <!--<property name="swf.version" value="30" />
+    <property name="playerglobal.version" value="19" />-->
+    <property name="destDir" value="${basedir}/target/swf"/>
+    <property name="html_template_base" value="${basedir}/src/main/resources" />
     <include file="${basedir}/../build_example.xml" />
 
-    <target name="main" depends="clean,build_example.compile" description="Clean build of ${example}">
+    <target name="main" depends="clean" description="Clean build of ${example}">
+        <antcall target="build_example.compile">
+            <param name="debug" value="false"/>
+        </antcall>
     </target>
 
     <target name="clean">
-        <delete dir="${basedir}/bin" failonerror="false" />
-        <delete dir="${basedir}/bin-debug" failonerror="false" />
-        <delete dir="${basedir}/bin-release" failonerror="false" />
         <delete dir="${basedir}/target" failonerror="false" />
     </target>
 
diff --git a/manualtests/UnitTests/pom.xml b/manualtests/UnitTests/pom.xml
index 43f0f66..a411728 100644
--- a/manualtests/UnitTests/pom.xml
+++ b/manualtests/UnitTests/pom.xml
@@ -52,15 +52,22 @@
 				<artifactId>royale-maven-plugin</artifactId>
 				<extensions>true</extensions>
 				<configuration>
-					<targets>SWF</targets>
+					<targets>SWF,JSRoyale</targets>
 					<mainClass>${project.artifactId}.mxml</mainClass>
                     <removeCirculars>true</removeCirculars>
-					<debug>true</debug>
-					<additionalCompilerOptions>-swf-version=18;-keep-as3-metadata+=Test,BeforeClass,AfterClass,Before,After,TestVariance,Event,Bindable,TestMeta</additionalCompilerOptions>
-					<outputDirectory>${basedir}/target/bin-debug</outputDirectory>
-					<flashOutputFileName>${project.artifactId}.swf</flashOutputFileName>
+					<debug>false</debug>
+					<additionalCompilerOptions>
+						-swf-version=30;
+						-js-default-initializers;
+						-source-map=true;
+						-keep-as3-metadata+=Test,BeforeClass,AfterClass,Before,After,TestVariance,Event,Bindable,TestMeta;
+						-keep-code-with-metadata=Test,BeforeClass,AfterClass,Before,After,TestVariance,TestMeta;
+					</additionalCompilerOptions>
+					<outputDirectory>${basedir}/target</outputDirectory>
+					<flashOutputFileName>swf/${project.artifactId}.swf</flashOutputFileName>
+					<javascriptOutputDirectoryName>javascript</javascriptOutputDirectoryName>
 				</configuration>
-				<executions>
+				<!--<executions>
 					<execution>
 						<id>compile-js</id>
 						<phase>process-sources</phase>
@@ -75,7 +82,7 @@
 							<outputDirectory>${basedir}/target</outputDirectory>
 						</configuration>
 					</execution>
-				</executions>
+				</executions>-->
 			</plugin>
 			<plugin>
 				<artifactId>maven-resources-plugin</artifactId>
@@ -88,7 +95,7 @@
 							<goal>copy-resources</goal>
 						</goals>
 						<configuration>
-							<outputDirectory>${basedir}/target/bin-debug</outputDirectory>
+							<outputDirectory>${basedir}/target/swf</outputDirectory>
 							<includeEmptyDirs>true</includeEmptyDirs>
 							<resources>
 								<resource>
@@ -112,8 +119,8 @@
 							<goal>rename</goal>
 						</goals>
 						<configuration>
-							<sourceFile>${basedir}/target/bin-debug/index.template.html</sourceFile>
-							<destinationFile>${basedir}/target/bin-debug/${project.artifactId}.html</destinationFile>
+							<sourceFile>${basedir}/target/swf/index.template.html</sourceFile>
+							<destinationFile>${basedir}/target/swf/${project.artifactId}.html</destinationFile>
 						</configuration>
 					</execution>
 				</executions>
diff --git a/manualtests/UnitTests/src/main/config/compile-app-config.xml b/manualtests/UnitTests/src/main/config/compile-app-config.xml
index 8774ac7..9e40011 100644
--- a/manualtests/UnitTests/src/main/config/compile-app-config.xml
+++ b/manualtests/UnitTests/src/main/config/compile-app-config.xml
@@ -17,10 +17,25 @@
 
 -->
 <royale-config>
-    <js-output-optimization>
+   <!--
+   <js-output-optimization>
         <optimization>skipFunctionCoercions</optimization>
     </js-output-optimization>
+    -->
     <js-default-initializers>true</js-default-initializers>
+    <swf-version>30</swf-version>
+    <source-map>true</source-map>
     <compiler>
+        <keep-as3-metadata append="true">
+            <name>Test</name>
+            <name>BeforeClass</name>
+            <name>AfterClass</name>
+            <name>Before</name>
+            <name>After</name>
+            <name>TestVariance</name>
+            <name>Event</name>
+            <name>Bindable</name>
+            <name>TestMeta</name>
+        </keep-as3-metadata>
     </compiler>
 </royale-config>
diff --git a/manualtests/UnitTests/src/main/royale/MyInitialView.mxml b/manualtests/UnitTests/src/main/royale/MyInitialView.mxml
index d927fe5..32eaa9e 100644
--- a/manualtests/UnitTests/src/main/royale/MyInitialView.mxml
+++ b/manualtests/UnitTests/src/main/royale/MyInitialView.mxml
@@ -25,15 +25,31 @@ limitations under the License.
 >
 
 	<fx:Style>
-		.title {
+
+		@namespace "library://ns.apache.org/royale/basic";
+		Label {
 			font-size: 16px;
+			font-family: sans-serif;
+		}
+
+		.title {
 			font-weight: bold;
+			font-family: sans-serif;
 		}
-		.body {
+
+		.output {
+			top:50px;
+			bottom: 5px;
+			display: flex;
+			flex-direction: column;
+			position: absolute;
+			overflow-y: scroll;
+			font-family: sans-serif;
+			font-size: 16px;
 			left:10px;
 			right:10px;
-			font-family: sans-serif;
 		}
+
 		.royale .Label {
 			white-space: pre-wrap !important;
 		}
@@ -50,11 +66,29 @@ limitations under the License.
 		import testshim.RoyaleUnitTestRunner;
 		import testshim.TestResult;
 
+		//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 '';
+		}
 
 
 		private var _tests:Array;
 
 		public function runTests():void {
+			setPlatform();
+			RoyaleUnitTestRunner.swfVersion = getSwfVersion();
 			var label:Label;
 			var groups:Array = TestClasses.testClasses;
 			var spaces:String = PLATFORM == "JS" ? "\u00A0\u00A0\u00A0" : "   ";
@@ -162,27 +196,37 @@ limitations under the License.
 		}
 
 
-		private static function getPlatform():String {
+		private function setPlatform():void {
 			var platform:String;
+			var variant:String;
 			COMPILE::JS{
-				platform = "JS";
+				PLATFORM = "JS";
+				variant = ' ';
 			}
 			COMPILE::SWF{
-				platform = "SWF";
+				PLATFORM = "SWF";
+				variant = ' [version:' + getSwfVersion()+'] ';
 			}
-			return platform;
+
+			PLATFORM_VARIANT = getPlayerVersion() ? variant + ' [player:'+getPlayerVersion()+'] ' : variant;
 		}
 
-		public static const PLATFORM:String = getPlatform();
+		[Bindable]
+		public var PLATFORM:String;
+
+		[Bindable]
+		public var PLATFORM_VARIANT:String = '';
 		]]>
 	</fx:Script>
 	<js:beads>
 		<js:ViewDataBinding/>
 	</js:beads>
-	<js:Group id="cont" height="50" className="body">
-		<js:Label text="{PLATFORM} Cross-compiled Unit Tests" className="title" />
+	<js:Group localId="cont" height="50" className="header">
+		<js:Label text="{PLATFORM}{PLATFORM_VARIANT}Cross-compiled Unit Tests" className="title" />
 	</js:Group>
-	<js:Group id="output" height="700" y="50" className="body">
+	<js:Group localId="output"
+			  y="50"
+			  className="output">
 		<js:beads>
 			<js:VerticalFlexLayout />
 		</js:beads>
diff --git a/manualtests/UnitTests/src/main/royale/TestClasses.as b/manualtests/UnitTests/src/main/royale/TestClasses.as
index e96a3d9..e112fc9 100644
--- a/manualtests/UnitTests/src/main/royale/TestClasses.as
+++ b/manualtests/UnitTests/src/main/royale/TestClasses.as
@@ -32,7 +32,8 @@ package
 						ReflectionTester,
 						ObservedBugsTester,
 						GithubIssuesTester,
-						NetworkTester
+						NetworkTester,
+						XMLTester
 					];
 		}
 	}
diff --git a/manualtests/UnitTests/src/main/royale/UnitTests.mxml b/manualtests/UnitTests/src/main/royale/UnitTests.mxml
index 3d088dd..57564e3 100644
--- a/manualtests/UnitTests/src/main/royale/UnitTests.mxml
+++ b/manualtests/UnitTests/src/main/royale/UnitTests.mxml
@@ -28,12 +28,23 @@
 		@namespace js "library://ns.apache.org/royale/basic";
 		js|Application {
 			background-color:#ffffff ;
+			position:absolute;
+			top:0;
+			bottom:0;
+			left:0;
+			right:0;
 		}
+
+		.view{
+			width: 100%;
+			height: 100%;
+		}
+
 	</fx:Style>
 	<js:valuesImpl>
 		<js:SimpleCSSValuesImpl />
 	</js:valuesImpl>
 	<js:initialView>
-		<local:MyInitialView />
+		<local:MyInitialView className="view" />
 	</js:initialView>
 </js:Application>
diff --git a/manualtests/UnitTests/src/main/royale/flexUnitTests/language/LanguageTesterTestVector.as b/manualtests/UnitTests/src/main/royale/flexUnitTests/language/LanguageTesterTestVector.as
index 7231610..0e7652e 100644
--- a/manualtests/UnitTests/src/main/royale/flexUnitTests/language/LanguageTesterTestVector.as
+++ b/manualtests/UnitTests/src/main/royale/flexUnitTests/language/LanguageTesterTestVector.as
@@ -22,6 +22,8 @@ package flexUnitTests.language
     import flexunit.framework.Assert;
     import flexUnitTests.language.support.*;
     
+    import testshim.RoyaleUnitTestRunner;
+    
     /**
      * @royalesuppresspublicvarwarning
      */
@@ -29,6 +31,20 @@ package flexUnitTests.language
     {
         
         public static var isJS:Boolean;
+    
+    
+        public static function hasInsertAtRemoveAt():Boolean{
+            //this checks the build for swf-version that has insertAt/removeAt support in Vector
+            COMPILE::SWF{
+                //see; http://fpdownload.macromedia.com/pub/labs/flashruntimes/shared/air19_flashplayer19_releasenotes.pdf
+                // "Please use swf-version 30 or greater and namespace 19.0 or greater to access the new APIs."
+                return RoyaleUnitTestRunner.swfVersion >= 30;
+            }
+            COMPILE::JS {
+                //always supported
+                return true
+            }
+        }
         
         [BeforeClass]
         public static function setUpBeforeClass():void
@@ -199,6 +215,7 @@ package flexUnitTests.language
         }
         
         [Test]
+        [TestVariance(variance="SWF",description="SWF tests for insertAt/removeAt are not run when swf version<30")]
         public function testFixedVectorBasicMethods():void
         {
             var nested:Vector.<Vector.<TestClass1>> = new Vector.<Vector.<TestClass1>>(20, false);
@@ -246,26 +263,33 @@ package flexUnitTests.language
             }
             
             Assert.assertTrue('Unexpected Vector check', caughtError);
-            try
-            {
-                caughtError = false;
-                nested.removeAt(0);
-            } catch (e:Error)
-            {
-                caughtError = e is RangeError
-            }
-            
-            Assert.assertTrue('Unexpected Vector check', caughtError);
-            try
-            {
-                caughtError = false;
-                nested.insertAt(0, null);
-            } catch (e:Error)
-            {
-                caughtError = e is RangeError
+    
+            if (hasInsertAtRemoveAt()) {
+                try
+                {
+                    caughtError = false;
+                    nested['removeAt'](0);
+                } catch (e:Error)
+                {
+                    caughtError = e is RangeError
+                }
+                
+                Assert.assertTrue('Unexpected Vector check', caughtError);
+            
+                try
+                {
+                    caughtError = false;
+                    nested['insertAt'](0, null);
+                } catch (e:Error)
+                {
+                    caughtError = e is RangeError
+                }
+    
+                Assert.assertTrue('Unexpected Vector check', caughtError);
+            } else {
+                RoyaleUnitTestRunner.consoleOut('Variance: The current target does not have support for Vector insertAt/removeAt methods', 'warn')
             }
             
-            Assert.assertTrue('Unexpected Vector check', caughtError);
         }
     
         [Test]
@@ -343,6 +367,7 @@ package flexUnitTests.language
         }
         
         [Test]
+        [TestVariance(variance="SWF",description="SWF tests for insertAt/removeAt are not run when swf version<30")]
         public function testVectorAdvancedMethods():void
         {
             
@@ -364,98 +389,105 @@ package flexUnitTests.language
             Assert.assertTrue('Unexpected Vector check', vcustom3[0] is TestClass1);
             Assert.assertTrue('Unexpected Vector check', vcustom2[1] is TestClass2);
             
-            vcustom3.insertAt(0, new TestClass2());
-            Assert.assertTrue('Unexpected Vector check', vcustom3.length == 2);
-            Assert.assertTrue('Unexpected Vector check', vcustom3[0] is TestClass2);
-            Assert.assertTrue('Unexpected Vector check', vcustom3[1] is TestClass1);
             
-            var removedItem:* = vcustom3.removeAt(0);
-            Assert.assertTrue('Unexpected Vector check', vcustom3.length == 1);
-            Assert.assertTrue('Unexpected Vector check', vcustom3[0] is TestClass1);
-            Assert.assertTrue('Unexpected Vector check', removedItem is TestClass2);
+            if (hasInsertAtRemoveAt()) {
+                vcustom3['insertAt'](0, new TestClass2());
+                Assert.assertTrue('Unexpected Vector check', vcustom3.length == 2);
+                Assert.assertTrue('Unexpected Vector check', vcustom3[0] is TestClass2);
+                Assert.assertTrue('Unexpected Vector check', vcustom3[1] is TestClass1);
     
-            var tc1Vec:Vector.<TestClass1> = new Vector.<TestClass1>(4);
+                var removedItem:* = vcustom3['removeAt'](0);
+                Assert.assertTrue('Unexpected Vector check', vcustom3.length == 1);
+                Assert.assertTrue('Unexpected Vector check', vcustom3[0] is TestClass1);
+                Assert.assertTrue('Unexpected Vector check', removedItem is TestClass2);
     
-            //insert at invalid index:
-            tc1Vec.insertAt(6, new TestClass1());
-            //no error, insertAt minimises the specified index to the Vector's length and inserts there
-            Assert.assertTrue('Unexpected Vector check', tc1Vec.length == 5);
-            Assert.assertTrue('Unexpected Vector check', tc1Vec[4] is TestClass1);
-            
-            var caughtError:Boolean;
-            try
-            {
-                caughtError = false;
-                tc1Vec.removeAt(6);
-            } catch (e:Error)
-            {
-                caughtError = e is RangeError
-            }
+                var tc1Vec:Vector.<TestClass1> = new Vector.<TestClass1>(4);
     
-            try
-            {
-                caughtError = false;
-                tc1Vec.removeAt(-1);
-            } catch (e:Error)
-            {
-                caughtError = e is RangeError
-            }
-            Assert.assertTrue('Unexpected Vector check', tc1Vec.length == 4);
-            Assert.assertEquals('Unexpected Vector check', 'null,null,null,null', tc1Vec.toString());
-            //no error
-            Assert.assertFalse('Unexpected Vector check', caughtError);
+                //insert at invalid index:
+                tc1Vec['insertAt'](6, new TestClass1());
+                //no error, insertAt minimises the specified index to the Vector's length and inserts there
+                Assert.assertTrue('Unexpected Vector check', tc1Vec.length == 5);
+                Assert.assertTrue('Unexpected Vector check', tc1Vec[4] is TestClass1);
     
-            try
-            {
-                caughtError = false;
-                tc1Vec.insertAt(-1, new TestClass1());
-            } catch (e:Error)
-            {
-                caughtError = e is RangeError
-            }
+                var caughtError:Boolean;
+                try
+                {
+                    caughtError = false;
+                    tc1Vec['removeAt'](6);
+                } catch (e:Error)
+                {
+                    caughtError = e is RangeError
+                }
     
-            Assert.assertTrue('Unexpected Vector check', tc1Vec.length == 5);
-            //new item is at position 3
-            Assert.assertNotNull('Unexpected Vector check', tc1Vec[3]);
-            //moving the original content (null) from position 3 to 4
-            Assert.assertNull('Unexpected Vector check', tc1Vec[4]);
-            //no error
-            Assert.assertFalse('Unexpected Vector check', caughtError);
-            
-            try
-            {
-                caughtError = false;
-                //even though this is out of range, it still works without error
-                tc1Vec.insertAt(-200, new TestClass1());
-            } catch (e:Error)
-            {
-                caughtError = e is RangeError
-            }
-            
-            Assert.assertTrue('Unexpected Vector check', tc1Vec.length == 6);
-            //new item is at position 0
-            Assert.assertNotNull('Unexpected Vector check', tc1Vec[0]);
-            //the other non-null item is now at postion 4
-            Assert.assertNotNull('Unexpected Vector check', tc1Vec[4]);
-            //no error
-            Assert.assertFalse('Unexpected Vector check', caughtError);
-            
-            try
-            {
-                caughtError = false;
-                tc1Vec.removeAt(-200);
-            } catch (e:Error)
-            {
-                caughtError = e is RangeError;
-            }
+                try
+                {
+                    caughtError = false;
+                    tc1Vec['removeAt'](-1);
+                } catch (e:Error)
+                {
+                    caughtError = e is RangeError
+                }
+                Assert.assertTrue('Unexpected Vector check', tc1Vec.length == 4);
+                Assert.assertEquals('Unexpected Vector check', 'null,null,null,null', tc1Vec.toString());
+                //no error
+                Assert.assertFalse('Unexpected Vector check', caughtError);
     
-            Assert.assertTrue('Unexpected Vector check', tc1Vec.length == 5);
-            //position 0 is now null
-            Assert.assertNull('Unexpected Vector check', tc1Vec[0]);
-            //the non-null item is now at postion 3
-            Assert.assertNotNull('Unexpected Vector check', tc1Vec[3]);
-            //no error
-            Assert.assertFalse('Unexpected Vector check', caughtError);
+                try
+                {
+                    caughtError = false;
+                    tc1Vec['insertAt'](-1, new TestClass1());
+                } catch (e:Error)
+                {
+                    caughtError = e is RangeError
+                }
+    
+                Assert.assertTrue('Unexpected Vector check', tc1Vec.length == 5);
+                //new item is at position 3
+                Assert.assertNotNull('Unexpected Vector check', tc1Vec[3]);
+                //moving the original content (null) from position 3 to 4
+                Assert.assertNull('Unexpected Vector check', tc1Vec[4]);
+                //no error
+                Assert.assertFalse('Unexpected Vector check', caughtError);
+    
+                try
+                {
+                    caughtError = false;
+                    //even though this is out of range, it still works without error
+                    tc1Vec['insertAt'](-200, new TestClass1());
+                } catch (e:Error)
+                {
+                    caughtError = e is RangeError
+                }
+    
+                Assert.assertTrue('Unexpected Vector check', tc1Vec.length == 6);
+                //new item is at position 0
+                Assert.assertNotNull('Unexpected Vector check', tc1Vec[0]);
+                //the other non-null item is now at postion 4
+                Assert.assertNotNull('Unexpected Vector check', tc1Vec[4]);
+                //no error
+                Assert.assertFalse('Unexpected Vector check', caughtError);
+    
+                try
+                {
+                    caughtError = false;
+                    tc1Vec['removeAt'](-200);
+                } catch (e:Error)
+                {
+                    caughtError = e is RangeError;
+                }
+    
+                Assert.assertTrue('Unexpected Vector check', tc1Vec.length == 5);
+                //position 0 is now null
+                Assert.assertNull('Unexpected Vector check', tc1Vec[0]);
+                //the non-null item is now at postion 3
+                Assert.assertNotNull('Unexpected Vector check', tc1Vec[3]);
+                //no error
+                Assert.assertFalse('Unexpected Vector check', caughtError);
+                
+            }  else {
+                RoyaleUnitTestRunner.consoleOut('Variance: The current target does not have support for Vector insertAt/removeAt methods, so these are untested', 'warn')
+            }
+           
             
         }
         
diff --git a/manualtests/UnitTests/src/main/royale/flexUnitTests/xml/XMLTesterGeneralTest.as b/manualtests/UnitTests/src/main/royale/flexUnitTests/xml/XMLTesterGeneralTest.as
index 9e941b5..356a024 100644
--- a/manualtests/UnitTests/src/main/royale/flexUnitTests/xml/XMLTesterGeneralTest.as
+++ b/manualtests/UnitTests/src/main/royale/flexUnitTests/xml/XMLTesterGeneralTest.as
@@ -22,11 +22,14 @@ package flexUnitTests.xml
     
     import flexunit.framework.Assert;
     
-    import org.apache.royale.reflection.*;
-    
+    import testshim.RoyaleUnitTestRunner;
     
+    /**
+     * @royalesuppresspublicvarwarning
+     */
     public class XMLTesterGeneralTest
     {
+        public static var isJS:Boolean = COMPILE::JS;
         
         private var xmlStr:String;
         
@@ -36,11 +39,24 @@ package flexUnitTests.xml
         private var text:String;
         private var xml2:XML;
         
+        private var settings:Object;
+        
+        public static function getSwfVersion():uint{
+            COMPILE::SWF{
+                return RoyaleUnitTestRunner.swfVersion;
+            }
+            COMPILE::JS {
+                //this mimics the version of the flash player that has xml toString support 'fixed'
+                return 21
+            }
+        }
         
         [Before]
         public function setUp():void
         {
-            xmlStr = '<?xml version="1.0" encoding="UTF-8" ?>' +
+            settings = XML.settings();
+            
+            xmlStr ='<?xml version="1.0" encoding="UTF-8" ?>' +
                     '<catalog xmlns:fx="http://ns.adobe.com/mxml/2009"' +
                     '              xmlns:dac="com.printui.view.components.DesignAreaComponents.*">' +
                     '<' + '!' + '-' + '- just a comment -' + '-' + '>' +
@@ -100,6 +116,8 @@ package flexUnitTests.xml
             xml = null;
             text = null;
             xml2 = null;
+            
+            XML.setSettings(settings);
         }
         
         [BeforeClass]
@@ -116,23 +134,29 @@ package flexUnitTests.xml
         [Test]
         public function testSimpleAttributes():void
         {
-            var args:Array;
-            var j:int;
-            var m:int;
-            var list1:XMLList;
-            var list2:XMLList;
-            var list3:XMLList;
-            var list4:XMLList;
+            
             var xml1:XML = <foo baz="true"/>;
             Assert.assertTrue('<foo baz="true"/> should have attribute @baz', xml1.hasOwnProperty("@baz"));
             Assert.assertFalse('<foo baz="true"/> should not have attribute @foo', xml1.hasOwnProperty("@foo"));
             Assert.assertFalse('<foo baz="true"/> should not have attribute baz', xml1.hasOwnProperty("baz"));
             Assert.assertTrue('<foo baz="true"/> toXMLString should be <foo baz="true"/>', xml1.toXMLString() == '<foo baz="true"/>');
             
+            Assert.assertTrue('xml1.@baz.toString() should be "true"', xml1.@baz.toString() == 'true');
+    
             var baz:XMLList = xml1.@baz;
-            trace("baz: " + xml1.@baz.toString() + " //true");
+            Assert.assertTrue('baz.toString() should be "true"', baz.toString() == 'true');
+            Assert.assertEquals('baz.length() should be 1', baz.length(),1);
+            var xml3:XML = <root/>;
+            xml3.bar.baz = "baz";
+            xml3.foo.@boo = "boo";
+    
+            Assert.assertEquals('xml3.bar.baz should be "baz"', xml3.bar.baz,'baz');
+            Assert.assertEquals('xml3.foo.@boo should be "boo"', xml3.foo.@boo,'boo');
+
         }
         
+       
+        
         
         [Test]
         public function testSimpleXMLList():void
@@ -143,37 +167,25 @@ package flexUnitTests.xml
             var xml3:XML = <root/>;
             xml3.bar.baz = "baz";
             xml3.foo.@boo = "boo";
-            trace(xml3.bar.baz)
+
             Assert.assertEquals('toString value should be "baz" ', xml3.bar.baz.toString(), "baz");
             Assert.assertEquals('toString value should be "boo" ', xml3.foo.@boo.toString(), "boo");
             
-            
-            //trace("baz: " + xml1.@baz.toString() + " //true");
-            
-            //trace("baz? " + xml3.bar.baz);
-            //	trace("boo? " + xml3.foo.@boo);
-            var ampXML:XML = new XML("<Content>Bat & Ball</Content>");
-            var amp2XML:XML = new XML("<Content>Bat &amp; Ball</Content>");
-            Assert.assertEquals('escaped ampersands should be equal" ', ampXML.toXMLString(), amp2XML.toXMLString());
-            
-            Assert.assertTrue("ampersand should not be escaped", ampXML.toString().indexOf("&amp;") == -1);
-            //	trace(ampXML.toXMLString());
-            //	trace(amp2XML.toXMLString());
-            //	trace("escaped ampersands should be equal? " + (ampXML.toXMLString() == amp2XML.toXMLString()));
-            //	trace("ampersand should not be escaped: " + ampXML.toString());
-            
             var newContent:XML = <Content/>;
             newContent.Properties.Leading.@type = "string";
             newContent.Properties.Leading = 36;
             
-            
-            trace("Leading should be @type=string: " + (newContent.Properties.Leading.@type == "string"));
             Assert.assertEquals("Leading should be @type=string", newContent.Properties.Leading.@type, "string");
-            trace("Leading should be 36: " + newContent.Properties.Leading);
             Assert.assertStrictlyEquals("Leading should be 36", newContent.Properties.Leading.toString(), "36");
-            
+            Assert.assertStrictlyEquals("unexpected toXMLString() value",
+                    newContent.toXMLString(),
+                    "<Content>\n" +
+                    "  <Properties>\n" +
+                    "    <Leading type=\"string\">36</Leading>\n" +
+                    "  </Properties>\n" +
+                    "</Content>");
+
             newContent.Properties.Leading = 72;
-            trace("Leading should be 72: " + newContent.Properties.Leading);
             Assert.assertStrictlyEquals("Leading should be 72", newContent.Properties.Leading.toString(), "72");
             
         }
@@ -183,83 +195,296 @@ package flexUnitTests.xml
         public function testXMLMethods1():void
         {
             var xml1:XML = <foo baz="true"/>;
-            var child:XML = <pop>
-                <child name="Sam"/>
-            </pop>;
+            var child:XML = <pop><child name="Sam"/></pop>;
             xml1.appendChild(child);
-            child = <pop>
-                <child name="George"/>
-            </pop>;
+            child = <pop><child name="George"/></pop>;
             xml1.appendChild(child);
             
             Assert.assertTrue('unexpected child result', xml1.pop[0].child.@name.toString() == 'Sam');
             Assert.assertTrue('unexpected child result', xml1.pop[1].child.@name.toString() == 'George');
             
-            /*Greg: I think the above *should* output as:
-            
-            flexunit.framework.Assert.assertTrue('unexpected child result', xml1.child('pop')[0].child('child').attribute('name').toString() == 'Sam');
-              flexunit.framework.Assert.assertTrue('unexpected child result', xml1.child('pop')[1].child('child').attribute('name').toString() == 'George');
-            
-            but the "child('child')." part is currently outputting as "child."
-            
-            */
         }
-        
+
+    
+        [TestVariance(variance="JS", description="toLocaleString has a substantially different output in javascript")]
+        [TestVariance(variance="SWF", description="(observed) some of the XML methods for SWF had incorrect results before swf version 21")]
         [Test]
         public function testXMLMethods2():void
         {
             var xml1:XML = <foo baz="true"/>;
             var child:XML = <pop>
-                <child name="Sam"/>
-            </pop>;
+                                <child name="Sam"/>
+                            </pop>;
             xml1.appendChild(child);
             child = <pop>
-                <child name="George"/>
-            </pop>;
+                        <child name="George"/>
+                    </pop>;
             xml1.appendChild(child);
+            Assert.assertEquals('unexpected output with xml1.pop[0].toString()',
+                    xml1.pop[0].toString(),
+                    '<pop>\n' +
+                    '  <child name="Sam"/>\n' +
+                    '</pop>');
+            Assert.assertEquals('unexpected output with xml1.pop[1].toString()',
+                    xml1.pop[1].toString(),
+                    '<pop>\n' +
+                    '  <child name="George"/>\n' +
+                    '</pop>');
             
-            //trace(xml1.pop[0].toString());
-            //trace(xml1.pop[1].toString());
+
             var pop:XMLList = xml1.pop;
             pop[pop.length()] = <pop>
-                <child name="Fred"/>
-            </pop>;
-            trace(pop.toString());
-            trace(xml1.toString());
-            pop[0] = <pop>
-                <child name="Fred"/>
-            </pop>;
-            trace(pop.toString());
-            trace(xml1.toString());
-            
-            var parent:XML = <parent/>;
+                                    <child name="Fred"/>
+                                </pop>;
+
+            Assert.assertEquals('unexpected output with pop.toString()',
+                    pop.toString(),
+                    '<pop>\n' +
+                    '  <child name="Sam"/>\n' +
+                    '</pop>\n' +
+                    '<pop>\n' +
+                    '  <child name="George"/>\n' +
+                    '</pop>\n' +
+                    '<pop>\n' +
+                    '  <child name="Fred"/>\n' +
+                    '</pop>');
+    
+            Assert.assertEquals('unexpected output with xml1.toString()',
+                    xml1.toString(),
+                    '<foo baz="true">\n' +
+                    '  <pop>\n' +
+                    '    <child name="Sam"/>\n' +
+                    '  </pop>\n' +
+                    '  <pop>\n' +
+                    '    <child name="George"/>\n' +
+                    '  </pop>\n' +
+                    '  <pop>\n' +
+                    '    <child name="Fred"/>\n' +
+                    '  </pop>\n' +
+                    '</foo>');
+            
+            
+            pop[0] =    <pop>
+                            <child name="Fred"/>
+                        </pop>;
+    
+            Assert.assertEquals('unexpected output with pop.toString()',
+                    pop.toString(),
+                    '<pop>\n' +
+                    '  <child name="Fred"/>\n' +
+                    '</pop>\n' +
+                    '<pop>\n' +
+                    '  <child name="George"/>\n' +
+                    '</pop>\n' +
+                    '<pop>\n' +
+                    '  <child name="Fred"/>\n' +
+                    '</pop>');
+    
+            Assert.assertEquals('unexpected output with xml1.toString()',
+                    xml1.toString(),
+                    '<foo baz="true">\n' +
+                    '  <pop>\n' +
+                    '    <child name="Fred"/>\n' +
+                    '  </pop>\n' +
+                    '  <pop>\n' +
+                    '    <child name="George"/>\n' +
+                    '  </pop>\n' +
+                    '  <pop>\n' +
+                    '    <child name="Fred"/>\n' +
+                    '  </pop>\n' +
+                    '</foo>');
+            
+            //toLocaleString
+            //VARIANCE
+            
+            var expected:String = isJS
+                    ? '<foo baz="true">\n' +
+                    '  <pop>\n' +
+                    '    <child name="Fred"/>\n' +
+                    '  </pop>\n' +
+                    '  <pop>\n' +
+                    '    <child name="George"/>\n' +
+                    '  </pop>\n' +
+                    '  <pop>\n' +
+                    '    <child name="Fred"/>\n' +
+                    '  </pop>\n' +
+                    '</foo>' //js
+                    : '[object XML]';// swf
+            
+            Assert.assertEquals('unexpected output with xml1.toLocaleString()',
+                    xml1.toLocaleString(),
+                    expected);
+            
+            expected = isJS
+                ?   '<pop>\n' +
+                    '  <child name="Fred"/>\n' +
+                    '</pop>\n' +
+                    '<pop>\n' +
+                    '  <child name="George"/>\n' +
+                    '</pop>\n' +
+                    '<pop>\n' +
+                    '  <child name="Fred"/>\n' +
+                    '</pop>' //js
+                    : '[object XMLList]';//swf
+    
+            Assert.assertEquals('unexpected output with xml1.pop.toLocaleString()',
+                    xml1.pop.toLocaleString(),
+                    expected);
+
+            
+            var parentXML:XML = <parent/>;
             var childXML:XML = <child/>;
-            parent.appendChild(childXML);
-            trace(childXML.toXMLString() + " is child of" + parent.toXMLString() + "? " + (childXML.parent() == parent));
+            parentXML.appendChild(childXML);
+            Assert.assertTrue('child/parent relationship was unexpected', (childXML.parent() == parentXML));
+            Assert.assertEquals('unexpected output following re-parenting',
+                    parentXML.toXMLString(),
+                    '<parent>\n' +
+                    '  <child/>\n' +
+                    '</parent>');
+            
             var newParent:XML = <newparent/>;
             newParent.appendChild(childXML);
-            trace("moving to <newparent/>");
-            trace(childXML.toXMLString() + " is child of" + parent.toXMLString() + "? " + (childXML.parent() == parent));
-            trace(childXML.toXMLString() + " is child of" + newParent.toXMLString() + "? " + (childXML.parent() == newParent));
+
+            
+            if (getSwfVersion() < 21) {
+                //I think, a bug in old swf version, some 'remnant' of the old 'child' is still present in the'old' parent
+                expected =  '<parent>\n' +
+                            '  <child/>\n' +
+                            '</parent>'
+            } else {
+                expected = '<parent/>';
+            }
+    
+            Assert.assertEquals('unexpected output following re-parenting',
+                    parentXML.toXMLString(),
+                    expected);
+    
+            Assert.assertEquals('unexpected output following re-parenting',
+                    newParent.toXMLString(),
+                    '<newparent>\n' +
+                    '  <child/>\n' +
+                    '</newparent>');
+            
+            Assert.assertFalse('child/parent relationship was unexpected', (childXML.parent() == parentXML));
+            
+            var expectedLength:uint = getSwfVersion() < 21 ? 1 : 0;
+            //another bug in old swf version, some 'remnant' of the old 'child' is still present in the'old' parent
+            Assert.assertTrue('child/parent relationship was unexpected', (parentXML.children().length() == expectedLength));
+            Assert.assertTrue('child/parent relationship was unexpected', (childXML.parent() == newParent));
+            
             childXML = <Content>• <?ACE 7?>Some amazing content</Content>;
             var childXMLStr:String = childXML.text();
-            trace(childXMLStr + " (should be) •Some amazing content? " + (childXMLStr == "•Some amazing content"));
+
+            Assert.assertEquals(" (should be) •Some amazing content", childXMLStr, '•Some amazing content');
+        }
+        [Test]
+        public function testInvalidAppendChild():void{
+            var root:XML = new XML('test');
+            root.appendChild('test');
+    
+            Assert.assertEquals('testInvalidAppendChild 1 result is bad',root.toString(), 'test');
+            Assert.assertEquals('testInvalidAppendChild 2 result is bad',root.toXMLString(), 'test');
+        }
+    
+        [Test]
+        public function testAppendNonXMLChild():void{
+            var root:XML = <root/>;
+            root.appendChild('test');
+    
+            Assert.assertEquals('testAppendNonXMLChild 1 result is bad',root.toString(), 'test');
+            Assert.assertEquals('testAppendNonXMLChild 2 result is bad',root.toXMLString(), '<root>test</root>');
+            
+            root = <root><test><something/></test></root>;
+            root.appendChild('test');
+    
+            Assert.assertEquals('testAppendNonXMLChild 3 result is bad',
+                    root.toString(),
+                    '<root>\n' +
+                    '  <test>\n' +
+                    '    <something/>\n' +
+                    '  </test>\n' +
+                    '  <test>test</test>\n' +
+                    '</root>');
+            
+            Assert.assertEquals('testAppendNonXMLChild 4 result is bad',
+                    root.toXMLString(),
+                    '<root>\n' +
+                    '  <test>\n' +
+                    '    <something/>\n' +
+                    '  </test>\n' +
+                    '  <test>test</test>\n' +
+                    '</root>');
+            
         }
         
         
         [Test]
+        public function testXMLNormalize():void{
+            var xml:XML = <root/>;
+            xml.appendChild("test1");
+            xml.appendChild("test2");
+            xml.appendChild(<element/>);
+            xml.appendChild("test3");
+            xml.appendChild("test4");
+            
+    
+            Assert.assertEquals('testXMLNormalize 1 result is bad',
+                    xml.toString(),
+                    '<root>\n' +
+                    '  test1\n' +
+                    '  test2\n' +
+                    '  <element/>\n' +
+                    '  <element>test3</element>\n' +
+                    '  <element>test4</element>\n' +
+                    '</root>');
+    
+            Assert.assertEquals('testXMLNormalize 2 result is bad',
+                    xml.toXMLString(),
+                    '<root>\n' +
+                    '  test1\n' +
+                    '  test2\n' +
+                    '  <element/>\n' +
+                    '  <element>test3</element>\n' +
+                    '  <element>test4</element>\n' +
+                    '</root>');
+            
+   
+            xml.normalize();
+    
+            Assert.assertEquals('testXMLNormalize 3 result is bad',
+                    xml.toString(),
+                    '<root>\n' +
+                    '  test1test2\n' +
+                    '  <element/>\n' +
+                    '  <element>test3</element>\n' +
+                    '  <element>test4</element>\n' +
+                    '</root>');
+    
+            Assert.assertEquals('testXMLNormalize 4 result is bad',
+                    xml.toXMLString(),
+                    '<root>\n' +
+                    '  test1test2\n' +
+                    '  <element/>\n' +
+                    '  <element>test3</element>\n' +
+                    '  <element>test4</element>\n' +
+                    '</root>');
+
+            
+        }
+        
+        [Test]
         public function testSVG():void
         {
-            var svg:XML = <svg>
-                <group>
-                    <rect id="1"/>
-                    <rect id="2"/>
-                </group>
-                <group>
-                    <rect id="3"/>
-                    <rect id="4"/>
-                </group>
-            </svg>;
+            var svg:XML =   <svg>
+                                <group>
+                                    <rect id="1"/>
+                                    <rect id="2"/>
+                                </group>
+                                <group>
+                                    <rect id="3"/>
+                                    <rect id="4"/>
+                                </group>
+                            </svg>;
             
             var rects:XMLList = svg..rect;
             rects[1].@width = "100px";
@@ -271,8 +496,320 @@ package flexUnitTests.xml
                     + '<rect id="3" height="100px"/>' + '\n'
                     + '<rect id="4"/>';
             
-            //trace(rects.toXMLString());
             Assert.assertTrue('string output was unexpected', rects.toXMLString() == expected);
         }
+    
+    
+        [Test]
+        public function testChildList():void{
+            var xml:XML = <root> asdasdas <element/> asdasqdasd<otherElement/></root>;
+    
+    
+            var list:XMLList = xml.*;
+    
+            //var list:XMLList = xml.child('*')
+    
+            Assert.assertEquals('Error in list length', 4, list.length());
+            //trace(list.length());
+            list = xml.element;
+            Assert.assertEquals('Error in list length', 1, list.length());
+            //list = xml.child('element')
+    
+           // trace(list.length())
+            list = xml.otherElement;
+            //list = xml.child('otherElement')
+            Assert.assertEquals('Error in list length', 1, list.length());
+        
+        }
+    
+    
+        [Test]
+        public function testNamespaceRetrieval():void{
+            var  content:XML = <Document>
+                <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.3-c011 66.145661, 2012/02/06-14:56:27        " >
+                </x:xmpmeta>
+            </Document>;
+        
+            var namespace:Namespace = content.children()[0].namespace();
+            Assert.assertEquals('Error in namespace prefix', namespace.prefix, 'x');
+            Assert.assertEquals('Error in namespace uri', namespace.uri, 'adobe:ns:meta/');
+        
+        }
+    
+    
+        [Test]
+        [TestVariance(variance="JS",description="Javascript does not support duplicate namespace declarations (Error thrown)")]
+        public function testNamespaceRetrieval2():void{
+            var caughtError:Boolean;
+            try {
+                var  content:XML = <Document>
+                    <x:xmpmeta xmlns:x="adobe:ns:meta/" xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.3-c011 66.145661, 2012/02/06-14:56:27        " >
+                    </x:xmpmeta>
+                </Document>;
+            } catch(e:Error) {
+                caughtError = true;
+            }
+        
+            if (isJS) {
+                caughtError = !caughtError;
+            }
+            Assert.assertFalse('Unexpected Error state with duplicate namespace declarations', caughtError);
+        
+        }
+    
+        [Test]
+        public function testDuplicateAttributesError():void{
+            var caughtError:Boolean;
+            try {
+                var  content:XML = <root myVal="something" myVal="somethingElse"/>;
+            } catch(e:Error) {
+                caughtError = true;
+            }
+        
+            Assert.assertTrue('Unexpected Error state with duplicate attribute declarations', caughtError);
+        
+        }
+    
+        [Test]
+        public function testParsingWhitespaceSetting1():void{
+            var originalSetting:Boolean = XML.ignoreWhitespace;
+            XML.ignoreWhitespace = true;
+            var script:XML = <script>   <![CDATA[private function onStylesLoaded(ev:Event):void {currentState = "normal";facade = ApplicationFacade.getInstance();facade.notifyObservers(new Notification(ApplicationFacade.CMD_STARTUP, this));}  ]]>  </script>;
+    
+            Assert.assertEquals('unexpected children number after parsing',1, script.children().length());
+            Assert.assertEquals('unexpected toString value after parsing',
+                    '<script><![CDATA[private function onStylesLoaded(ev:Event):void {currentState = "normal";facade = ApplicationFacade.getInstance();facade.notifyObservers(new Notification(ApplicationFacade.CMD_STARTUP, this));}  ]]></script>', 
+                    script.toXMLString());
+
+            XML.ignoreWhitespace = false;
+            script = <script>   <![CDATA[private function onStylesLoaded(ev:Event):void {currentState = "normal";facade = ApplicationFacade.getInstance();facade.notifyObservers(new Notification(ApplicationFacade.CMD_STARTUP, this));}  ]]>  </script>;
+            Assert.assertEquals('unexpected children number after parsing',3, script.children().length());
+            
+
+            Assert.assertEquals('unexpected toString value after parsing',
+                    '<script>\n' +
+                    '  \n' +
+                    '  <![CDATA[private function onStylesLoaded(ev:Event):void {currentState = "normal";facade = ApplicationFacade.getInstance();facade.notifyObservers(new Notification(ApplicationFacade.CMD_STARTUP, this));}  ]]>\n' +
+                    '  \n' +
+                    '</script>',
+                    script.toXMLString());
+            XML.ignoreWhitespace = originalSetting;
+        }
+        [Test]
+        public function testSingleProcessingInstructions():void{
+            var original:Boolean = XML.ignoreProcessingInstructions;
+            XML.ignoreProcessingInstructions = true;
+            var xml:XML = new XML('<?bar foo?>');
+            Assert.assertEquals('unexpected nodeKind with XML.ignoreProcessingInstructions = true', 'text', xml.nodeKind());
+            Assert.assertEquals('unexpected toXMLString with XML.ignoreProcessingInstructions = true', '', xml.toXMLString());
+            XML.ignoreProcessingInstructions = false;
+            xml = new XML('<?bar foo?>');
+            Assert.assertEquals('unexpected nodeKind with XML.ignoreProcessingInstructions = false', 'processing-instruction', xml.nodeKind());
+            Assert.assertEquals('unexpected toXMLString with XML.ignoreProcessingInstructions = false', '<?bar foo?>', xml.toXMLString());
+    
+            XML.ignoreProcessingInstructions = original;
+        }
+    
+    
+        [Test]
+        public function testSingleCDATA():void{
+            var original:Boolean = XML.ignoreWhitespace;
+            XML.ignoreWhitespace = true;
+            var xml:XML = new XML('   <![CDATA[ my cdata ]]>   ');
+            Assert.assertEquals('unexpected cdata result with XML.ignoreWhitespace = true', 'text', xml.nodeKind());
+            Assert.assertEquals('unexpected toXMLString with XML.ignoreWhitespace = true', '<![CDATA[ my cdata ]]>', xml.toXMLString());
+            Assert.assertNull('unexpected name value with CDATA', xml.name());
+            XML.ignoreWhitespace = false;
+            var caughtError:Boolean = false;
+            try {
+                xml = new XML('   <![CDATA[ my cdata ]]>   ');
+            } catch(e:Error) {
+                caughtError = true;
+            }
+            
+            Assert.assertTrue('unexpected error status for single cdata string parsing with XML.ignoreWhitespace = false', caughtError);
+        
+            XML.ignoreWhitespace = original;
+        }
+    
+    
+        [Test]
+        public function testSingleText():void{
+            var original:Boolean = XML.ignoreWhitespace;
+            XML.ignoreWhitespace = true;
+            var xml:XML = new XML('   my text   ');
+            Assert.assertEquals('unexpected text result with XML.ignoreWhitespace = true', 'text', xml.nodeKind());
+            Assert.assertEquals('unexpected toXMLString with XML.ignoreWhitespace = true', 'my text', xml.toXMLString());
+            Assert.assertNull('unexpected name value with text', xml.name());
+            XML.ignoreWhitespace = false;
+            var caughtError:Boolean = false;
+            try {
+                xml = new XML('   my text   ');
+            } catch(e:Error) {
+                caughtError = true;
+            }
+        
+            Assert.assertFalse('unexpected error status for text string parsing with XML.ignoreWhitespace = false', caughtError);
+            Assert.assertEquals('unexpected text result with XML.ignoreWhitespace = true', 'text', xml.nodeKind());
+            Assert.assertEquals('unexpected toXMLString with XML.ignoreWhitespace = true', '   my text   ', xml.valueOf());
+            XML.ignoreWhitespace = original;
+        }
+    
+        [Test]
+        public function testSingleComment():void{
+            var original:Boolean = XML.ignoreWhitespace;
+            var originalComments:Boolean = XML.ignoreComments;
+            XML.ignoreWhitespace = true;
+            XML.ignoreComments = false;
+            var xml:XML = new XML('  <!-- my test comment -->  ');
+            Assert.assertEquals('unexpected comment result with XML.ignoreWhitespace = true', 'comment', xml.nodeKind());
+            Assert.assertEquals('unexpected toXMLString with XML.ignoreWhitespace = true', '<!-- my test comment -->', xml.toXMLString());
+            Assert.assertNull('unexpected name value with text', xml.name());
+            XML.ignoreWhitespace = false;
+            var caughtError:Boolean = false;
+            try {
+                xml = new XML('   <!-- my test comment -->   ');
+            } catch(e:Error) {
+                caughtError = true;
+            }
+        
+            Assert.assertTrue('unexpected error status for comment parsing with XML.ignoreWhitespace = false', caughtError);
+    
+            xml = new XML('<!-- my test comment -->');
+            Assert.assertNull('unexpected name value with comment', xml.name());
+            
+            Assert.assertEquals('unexpected comment result with XML.ignoreWhitespace = true', 'comment', xml.nodeKind());
+            Assert.assertEquals('unexpected toXMLString with XML.ignoreWhitespace = true', '<!-- my test comment -->', xml.toXMLString());
+            XML.ignoreComments = true;
+            xml = new XML('<!-- my test comment -->');
+            Assert.assertNull('unexpected name value with text', xml.name());
+    
+            Assert.assertEquals('unexpected comment result with XML.ignoreComments = true', 'text', xml.nodeKind());
+            Assert.assertEquals('unexpected toXMLString with XML.ignoreComments = true', '', xml.toXMLString());
+            
+            
+            XML.ignoreWhitespace = original;
+            XML.ignoreComments = originalComments;
+        }
+    
+        [Test]
+        public function testIgnoreComments():void{
+            var original:Boolean = XML.ignoreWhitespace;
+            var originalComments:Boolean = XML.ignoreComments;
+            XML.ignoreWhitespace = true;
+            XML.ignoreComments = false;
+            var xml:XML = new XML('<root><!-- my test comment --></root>');
+            Assert.assertEquals('unexpected comment result with XML.ignoreComments = false', 1, xml.children().length());
+            RoyaleUnitTestRunner.consoleOut(xml.toXMLString());
+            Assert.assertEquals('unexpected toXMLString with XML.ignoreComments = false',
+                    '<root>\n' +
+                    '  <!-- my test comment -->\n' +
+                    '</root>',
+                    xml.toXMLString());
+            Assert.assertNull('unexpected name value with comment', xml.children()[0].name());
+            XML.ignoreComments = true;
+            xml = new XML('<root><!-- my test comment --></root>');
+            Assert.assertEquals('unexpected comment result with XML.ignoreComments = true', 0, xml.children().length());
+            Assert.assertEquals('unexpected toXMLString with XML.ignoreComments = true', '<root/>', xml.toXMLString());
+    
+            XML.ignoreWhitespace = original;
+            XML.ignoreComments = originalComments;
+        }
+        
+        [Test]
+        [TestVariance(variance="JS",description="Some browsers 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();
+    
+            var expected:String = '<catalog xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:dac="com.printui.view.components.DesignAreaComponents.*">\n' +
+                    '  bla bla\n' +
+                    '  <product description="Cardigan Sweater" product_image="cardigan.jpg">\n' +
+                    '    <fx:catalog_item gender="Men\'s" fx:foo="bah">\n' +
+                    '      <item_number>QWZ5671</item_number>\n' +
+                    '      <price>39.95</price>\n' +
+                    '      <size description="Medium">\n' +
+                    '        <color_swatch image="red_cardigan.jpg">Red</color_swatch>\n' +
+                    '        <color_swatch image="burgundy_cardigan.jpg">Burgundy</color_swatch>\n' +
+                    '      </size>\n' +
+                    '      <size description="Large">\n' +
+                    '        <color_swatch image="red_cardigan.jpg">Red</color_swatch>\n' +
+                    '        <color_swatch image="burgundy_cardigan.jpg">Burgundy</color_swatch>\n' +
+                    '      </size>\n' +
+                    '    </fx:catalog_item>\n' +
+                    '    <script><![CDATA[private function onStylesLoaded(ev:Event):void {currentState = "normal";facade = ApplicationFacade.getInstance();facade.notifyObservers(new Notification(ApplicationFacade.CMD_STARTUP, this));}  ]]></script>\n' +
+                    '    <catalog_item gender="Women\'s">\n' +
+                    '      <item_number>RRX9856</item_number>\n' +
+                    '      <price>42.50</price>\n' +
+                    '      <size description="Small">\n' +
+                    '        <color_swatch image="red_cardigan.jpg">Red</color_swatch>\n' +
+                    '        <color_swatch image="navy_cardigan.jpg">Navy</color_swatch>\n' +
+                    '        <color_swatch image="burgundy_cardigan.jpg">Burgundy</color_swatch>\n' +
+                    '      </size>\n' +
+                    '      <size description="Medium">\n' +
+                    '        <color_swatch image="red_cardigan.jpg">Red</color_swatch>\n' +
+                    '        <color_swatch image="navy_cardigan.jpg">Navy</color_swatch>\n' +
+                    '        <color_swatch image="burgundy_cardigan.jpg">Burgundy</color_swatch>\n' +
+                    '        <color_swatch image="black_cardigan.jpg">Black</color_swatch>\n' +
+                    '      </size>\n' +
+                    '      <size description="Large">\n' +
+                    '        <color_swatch image="navy_cardigan.jpg">Navy</color_swatch>\n' +
+                    '        <color_swatch image="black_cardigan.jpg">Black</color_swatch>\n' +
+                    '      </size>\n' +
+                    '      <size description="Extra Large">\n' +
+                    '        <color_swatch image="burgundy_cardigan.jpg">Burgundy</color_swatch>\n' +
+                    '        <color_swatch image="black_cardigan.jpg">Black</color_swatch>\n' +
+                    '      </size>\n' +
+                    '    </catalog_item>\n' +
+                    '  </product>\n' +
+                    '</catalog>';
+    
+            var alternate:String = '<catalog xmlns:dac="com.printui.view.components.DesignAreaComponents.*" xmlns:fx="http://ns.adobe.com/mxml/2009">\n' +
+                    '  bla bla\n' +
+                    '  <product product_image="cardigan.jpg" description="Cardigan Sweater">\n' +
+                    '    <fx:catalog_item fx:foo="bah" gender="Men\'s">\n' +
+                    '      <item_number>QWZ5671</item_number>\n' +
+                    '      <price>39.95</price>\n' +
+                    '      <size description="Medium">\n' +
+                    '        <color_swatch image="red_cardigan.jpg">Red</color_swatch>\n' +
+                    '        <color_swatch image="burgundy_cardigan.jpg">Burgundy</color_swatch>\n' +
+                    '      </size>\n' +
+                    '      <size description="Large">\n' +
+                    '        <color_swatch image="red_cardigan.jpg">Red</color_swatch>\n' +
+                    '        <color_swatch image="burgundy_cardigan.jpg">Burgundy</color_swatch>\n' +
+                    '      </size>\n' +
+                    '    </fx:catalog_item>\n' +
+                    '    <script><![CDATA[private function onStylesLoaded(ev:Event):void {currentState = "normal";facade = ApplicationFacade.getInstance();facade.notifyObservers(new Notification(ApplicationFacade.CMD_STARTUP, this));}  ]]></script>\n' +
+                    '    <catalog_item gender="Women\'s">\n' +
+                    '      <item_number>RRX9856</item_number>\n' +
+                    '      <price>42.50</price>\n' +
+                    '      <size description="Small">\n' +
+                    '        <color_swatch image="red_cardigan.jpg">Red</color_swatch>\n' +
+                    '        <color_swatch image="navy_cardigan.jpg">Navy</color_swatch>\n' +
+                    '        <color_swatch image="burgundy_cardigan.jpg">Burgundy</color_swatch>\n' +
+                    '      </size>\n' +
+                    '      <size description="Medium">\n' +
+                    '        <color_swatch image="red_cardigan.jpg">Red</color_swatch>\n' +
+                    '        <color_swatch image="navy_cardigan.jpg">Navy</color_swatch>\n' +
+                    '        <color_swatch image="burgundy_cardigan.jpg">Burgundy</color_swatch>\n' +
+                    '        <color_swatch image="black_cardigan.jpg">Black</color_swatch>\n' +
+                    '      </size>\n' +
+                    '      <size description="Large">\n' +
+                    '        <color_swatch image="navy_cardigan.jpg">Navy</color_swatch>\n' +
+                    '        <color_swatch image="black_cardigan.jpg">Black</color_swatch>\n' +
+                    '      </size>\n' +
+                    '      <size description="Extra Large">\n' +
+                    '        <color_swatch image="burgundy_cardigan.jpg">Burgundy</color_swatch>\n' +
+                    '        <color_swatch image="black_cardigan.jpg">Black</color_swatch>\n' +
+                    '      </size>\n' +
+                    '    </catalog_item>\n' +
+                    '  </product>\n' +
+                    '</catalog>';
+
+            //RoyaleUnitTestRunner.consoleOut('testLargeComplex is alternate:\n' + (xmlString == alternate));
+            
+            //IE and MS Edge: inlcude alternate output check
+            //account for variation in output order of attributes and namespace declarations (from native DOMParser)
+            Assert.assertTrue('unexpected complex stringify results',  xmlString == expected || xmlString == alternate);
+        }
     }
 }
diff --git a/manualtests/UnitTests/src/main/royale/flexUnitTests/xml/XMLTesterStringifyTest.as b/manualtests/UnitTests/src/main/royale/flexUnitTests/xml/XMLTesterStringifyTest.as
index 76ab734..f7a1b1e 100644
--- a/manualtests/UnitTests/src/main/royale/flexUnitTests/xml/XMLTesterStringifyTest.as
+++ b/manualtests/UnitTests/src/main/royale/flexUnitTests/xml/XMLTesterStringifyTest.as
@@ -22,20 +22,28 @@ package flexUnitTests.xml
     
     import flexunit.framework.Assert;
     
-    import org.apache.royale.reflection.*;
-    
+    import testshim.RoyaleUnitTestRunner;
     
+    /**
+     * @royalesuppresspublicvarwarning
+     */
     public class XMLTesterStringifyTest
     {
+    
+        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]
@@ -52,25 +60,109 @@ package flexUnitTests.xml
         [Test]
         public function testPrettyPrintingSimple():void
         {
+            var originalIndent:uint = XML.prettyIndent;
+            var originalPretty:Boolean = XML.prettyPrinting;
             XML.prettyIndent = 2;
             XML.prettyPrinting = true;
-            var xml:XML = <xml>
-                <item/>
-            </xml>;
+            var xml:XML = <xml><item/></xml>;
             
-            Assert.assertEquals('Error in pretty Printing', xml.toXMLString(), '<xml>\n  <item/>\n</xml>')
+            Assert.assertEquals('Error in pretty Printing', xml.toXMLString(), '<xml>\n  <item/>\n</xml>');
             XML.prettyIndent = 4;
-            Assert.assertEquals('Error in pretty Printing', xml.toXMLString(), '<xml>\n    <item/>\n</xml>')
+            Assert.assertEquals('Error in pretty Printing', xml.toXMLString(), '<xml>\n    <item/>\n</xml>');
             XML.prettyIndent = 0;
-            Assert.assertEquals('Error in pretty Printing', xml.toXMLString(), '<xml>\n<item/>\n</xml>')
+            Assert.assertEquals('Error in pretty Printing', xml.toXMLString(), '<xml>\n<item/>\n</xml>');
+    
+            XML.prettyIndent = originalIndent;
+            XML.prettyPrinting = originalPretty;
             
         }
+    
+        [Test]
+        public function testToStringVariants():void{
+            var ampXML:XML = new XML("<Content>Bat & Ball</Content>");
+            var amp2XML:XML = new XML("<Content>Bat &amp; Ball</Content>");
+            Assert.assertEquals('ampersand entities are output with toXMLString', ampXML.toXMLString(),'<Content>Bat &amp; Ball</Content>');
+            Assert.assertEquals('ampersand entities are output with toXMLString', amp2XML.toXMLString(),'<Content>Bat &amp; Ball</Content>');
+            Assert.assertEquals('ampersand entities are not output with toString', ampXML.toString(),'Bat & Ball');
+            Assert.assertEquals('ampersand entities are not output with toString', amp2XML.toString(),'Bat & Ball');
+        
+        }
         
-        /*[Test]
-        public function testPrettyPrintingAdvanced():void{
         
-        }*/
+        [Test]
+        [TestVariance(variance="JS",description="Some browsers 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;
+            var content:XML = new XML(
+                    '<root>' +
+                    '	<content><![CDATA[<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>' +
+                    '<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.3-c011 66.145661, 2012/02/06-14:56:27        ">' +
+                    '   <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">' +
+                    '      <rdf:Description rdf:about=""/>' +
+                    '   </rdf:RDF>' +
+                    '</x:xmpmeta>' +
+                    '<?xpacket end="r"?>]'+']></content>' +
+                    '</root>');
+            var contentStr:String = content.toXMLString();
+            var correctStr:String = '<root><content><![CDATA[<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?><x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.3-c011 66.145661, 2012/02/06-14:56:27        ">   <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">      <rdf:Description rdf:about=""/>   </rdf:RDF></x:xmpmeta><?xpacket end="r"?>]'+']></content></root>';
+    
+            Assert.assertEquals('testStringifyAdvanced 1:content.toXMLString() was incorrect',correctStr, contentStr);
+    
+    
+            Assert.assertEquals('testStringifyAdvanced 1:content.toXMLString() was incorrect',correctStr, content.toXMLString());
+            
+            content = <Document>
+                <?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
+                <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.3-c011 66.145661, 2012/02/06-14:56:27        ">
+                    <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+                        <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" rdf:about="">
+                            <dc:format>application/x-indesign</dc:format>
+                        </rdf:Description>
+                        <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" xmlns:xmpGImg="http://ns.adobe.com/xap/1.0/g/img/" rdf:about="">
+                            <xmp:CreatorTool>Adobe InDesign CS6 (Windows)</xmp:CreatorTool>
+                            <xmp:CreateDate>2018-02-19T09:17:41Z</xmp:CreateDate>
+                            <xmp:MetadataDate>2018-02-19T09:17:41Z</xmp:MetadataDate>
+                            <xmp:ModifyDate>2018-02-19T09:17:41Z</xmp:ModifyDate>
+                            <xmp:Thumbnails>
+                                <rdf:Alt>
+                                    <rdf:li rdf:parseType="Resource">
+                                        <xmpGImg:format>JPEG</xmpGImg:format>
+                                        <xmpGImg:width>512</xmpGImg:width>
+                                        <xmpGImg:height>512</xmpGImg:height>
+                                        <xmpGImg:image>FOO</xmpGImg:image>
+                                    </rdf:li>
+                                </rdf:Alt>
+                            </xmp:Thumbnails>
+                        </rdf:Description>
+                    </rdf:RDF>
+                </x:xmpmeta>
+                <?xpacket end="r"?>
+            </Document>;
+            
+            
+            contentStr = content.toXMLString();
+            //RoyaleUnitTestRunner.consoleOut(contentStr);
+            var expected:String =  '<Document><x:xmpmeta x:xmptk="Adobe XMP Core 5.3-c011 66.145661, 2012/02/06-14:56:27        " xmlns:x="adobe:ns:meta/"><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><rdf:Description rdf:about="" xmlns:dc="http://purl.org/dc/elements/1.1/"><dc:format>application/x-indesign</dc:format></rdf:Description><rdf:Description rdf:about="" xmlns:xmp="http://ns.adobe.com/xap/1.0/" xmlns:xmpGImg="http://ns.adobe.com/xap/1.0/g/img/"><xmp:CreatorT [...]
+            //IE and Edge:
+            var alternate:String = '<Document><x:xmpmeta x:xmptk="Adobe XMP Core 5.3-c011 66.145661, 2012/02/06-14:56:27        " xmlns:x="adobe:ns:meta/"><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><rdf:Description rdf:about="" xmlns:dc="http://purl.org/dc/elements/1.1/"><dc:format>application/x-indesign</dc:format></rdf:Description><rdf:Description rdf:about="" xmlns:xmpGImg="http://ns.adobe.com/xap/1.0/g/img/" xmlns:xmp="http://ns.adobe.com/xap/1.0/"><xmp:CreatorT [...]
+            
+            Assert.assertTrue('testStringifyAdvanced 1:content.toXMLString() was incorrect',
+                    (contentStr == expected) || (contentStr == alternate));
+    
+
+        }
+        
+        [Test]
+        public function testCDATA():void{
+            var script:XML = <script>   <![CDATA[private function onStylesLoaded(ev:Event):void {currentState = "normal";facade = ApplicationFacade.getInstance();facade.notifyObservers(new Notification(ApplicationFacade.CMD_STARTUP, this));}  ]]>  </script>;
+
+            Assert.assertEquals('unexpected toXMLString with child CDATA',
+                    '<script><![CDATA[private function onStylesLoaded(ev:Event):void {currentState = "normal";facade = ApplicationFacade.getInstance();facade.notifyObservers(new Notification(ApplicationFacade.CMD_STARTUP, this));}  ]]></script>',
+                    script.toXMLString())
+        }
         
+
         
     }
 }
diff --git a/manualtests/UnitTests/src/main/royale/testshim/RoyaleUnitTestRunner.as b/manualtests/UnitTests/src/main/royale/testshim/RoyaleUnitTestRunner.as
index ff5eda9..8d99136 100644
--- a/manualtests/UnitTests/src/main/royale/testshim/RoyaleUnitTestRunner.as
+++ b/manualtests/UnitTests/src/main/royale/testshim/RoyaleUnitTestRunner.as
@@ -27,15 +27,32 @@ package testshim
     
     import flexunit.framework.Assert;
     
+    /**
+     * @royalesuppresspublicvarwarning
+     */
     public class RoyaleUnitTestRunner
     {
+        
+        
+        public static var swfVersion:uint=0;
+        
+        public static function getCurrentPlatform():String{
+            COMPILE::SWF{
+                return 'SWF';
+            }
+            COMPILE::JS{
+                return 'JS';
+            }
+        
+            //return '';
+        }
     
         public static function consoleOut(message:String, type:String = 'log', ...args):void
         {
             args.unshift(message + '\n');
             COMPILE::JS {
                 args.unshift('[JS]');
-                console[type].apply(null, args);
+                console[type].apply(console, args);
             }
             COMPILE::SWF{
                 import flash.external.ExternalInterface;
@@ -53,6 +70,8 @@ package testshim
                 }
             }
         }
+        
+        
     
         public static function getErrorStack(e:Error):String
         {
@@ -209,6 +228,7 @@ package testshim
             consoleOut('running test in ' + testClass + ":" + methodName);
             var varianceMetas:Array = methodDef.retrieveMetaDataByName("TestVariance");
             
+            
             var method:Function = instance[methodName] as Function;
             var preAssertCount:uint = Assert.assertionsMade;
             var result:TestResult = new TestResult();
@@ -221,13 +241,20 @@ package testshim
             while (varianceMetas.length)
             {
                 var varianceMeta:MetaDataDefinition = varianceMetas.shift() as MetaDataDefinition;
+
+                
                 var varianceArgs:Array = varianceMeta.getArgsByKey("variance");
+               
                 var i:uint = 0, l:uint = varianceArgs.length;
                 if (l)
                 {
-                    result.hasVariance = true;
-                    for (; i < l; i++) varianceArgs[i] = varianceArgs[i].value;
-                    result.varianceTarget = varianceArgs.join(",");
+                    for (; i < l; i++) {
+                        var target:String = varianceArgs[i] = varianceArgs[i].value;
+                        if (target == getCurrentPlatform()) {
+                            result.hasVariance = true;
+                            result.varianceTarget = varianceArgs.join(",");
+                        }
+                    }
                 }
                 if (result.hasVariance)
                 {
@@ -239,6 +266,7 @@ package testshim
                         result.varianceDescription += description.value;
                         if (descriptionArgs.length) result.varianceDescription += ", ";
                     }
+                    break;
                 }
             }
             //run the test method
diff --git a/manualtests/UnitTests/testsview/index.html b/manualtests/UnitTests/testsview/index.html
index 3103498..b697ee0 100644
--- a/manualtests/UnitTests/testsview/index.html
+++ b/manualtests/UnitTests/testsview/index.html
@@ -111,7 +111,7 @@
 
 	function onSwfFrameReady(){
         //this supports intellij's 'launch in browser'
-        var swfFrameSource = "/target/bin-debug/UnitTests.html";
+        var swfFrameSource = "/target/swf/UnitTests.html";
         if (window.location.search) {
            var append = window.location.search;
            if (append) swfFrameSource += append;
diff --git a/manualtests/build_example.xml b/manualtests/build_example.xml
index cf67ea4..7e626cd 100644
--- a/manualtests/build_example.xml
+++ b/manualtests/build_example.xml
@@ -164,11 +164,12 @@
         <property name="config_arg" value="royale" />
         <property name="file_suffix" value="mxml" />
         <property name="optional_arg" value="-define+=CONFIG::dummy,true" />
+        <property name="debug" value="true" />
         <!-- this is a dummy var placeholder in case some example needs to define a theme
             then they would set theme_arg=-theme=<path to theme> -->
         <property name="theme_arg" value="-define+=CONFIG::theme,false" />
 		<mxmlc fork="true"
-               debug="true"
+               debug="${debug}"
                configname="${config_arg}"
                swf-version="${swf.version}"
                closure-lib="${GOOG_HOME}"
@@ -188,6 +189,7 @@
 
         <antcall target="build_example.wrapper">
 			<param name="output" value="${destDir}"/>
+			<param name="templatebase" value="${html_template_base}"/>
 		</antcall>
 		
         <copy todir="${destDir}">
@@ -298,6 +300,7 @@
         
 		<antcall target="build_example.wrapper">
 			<param name="output" value="${destDir}"/>
+			<param name="templatebase" value="${html_template_base}"/>
 		</antcall>   
     </target>
  
@@ -350,14 +353,17 @@
 	
 	<target name="wrapper" depends="check-air" unless="is.air">
 		<property name="output" value="${basedir}/bin-debug"/>
+        <property name="templatebase" value="${ROYALE_HOME}/templates"/>
+        <echo>creating html-wrapper from ${templatebase}</echo>
         <html-wrapper
         height="100%"
         width="100%"
         bgcolor="#ffffff"
         name="${example}"
         versionmajor="11"
-        versionminor="1"
+        versionminor="5"
         versionrevision="0"
+        templatebase="${templatebase}"
         output="${output}"/>
     </target>
 	
@@ -365,7 +371,8 @@
         <copy toDir="${basedir}/bin-debug" file="${basedir}/${example}-app.xml" />
         <copy toDir="${basedir}/bin-release" file="${basedir}/${example}-app.xml" />
     </target>
-    
+
+    <property name="html_template_base" value="${ROYALE_HOME}/templates" />
     <macrodef name="html-wrapper">
         <attribute name="width"/>
         <attribute name="height"/>
@@ -375,16 +382,17 @@
         <attribute name="versionminor"/>
         <attribute name="versionrevision"/>
         <attribute name="output"/>
+        <attribute name="templatebase" default="${html_template_base}"/>
         <sequential>
             <copy toFile="@{output}/@{name}.html"
-            file="${ROYALE_HOME}/templates/swfobject/index.template.html" />
+            file="@{templatebase}/swfobject/index.template.html" />
             <copy toDir="@{output}/history">
-                <fileset dir="${ROYALE_HOME}/templates/swfobject/history">
+                <fileset dir="@{templatebase}/swfobject/history">
                     <include name="**"/>
                 </fileset>
             </copy>
             <copy toDir="@{output}">
-                <fileset dir="${ROYALE_HOME}/templates/swfobject">
+                <fileset dir="@{templatebase}/swfobject">
                     <include name="*"/>
                     <exclude name="index.template.html"/>
                 </fileset>