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/08/09 04:46:37 UTC
[royale-asjs] branch develop updated (7d6d754 -> 6337bcb)
This is an automated email from the ASF dual-hosted git repository.
gregdove pushed a change to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git.
from 7d6d754 Migrate other manualtests/UnitTests to alternate assertion methods to match RoyaleUnit (prep for adding new tests to RoyaleUnit)
new 26b1541 Porting remnants of manualtests/UnitTests to RoyaleUnit-compatible assertions
new 0e0ec3c Migrating most manualtests/UnitTests tests to RoyaleUnit. Added [Ignore] to failing XML tests for now. Added support for swfVersion awareness/variation in RoyaleUnit tests.
new 6337bcb Updates following class level @royalesuppressexport directive now working. Removed instanceof warnings from Language in maven build.
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
frameworks/build.xml | 19 +++-
.../src/test/royale/build.xml | 6 +-
.../src/test/royale/build.xml | 6 +-
.../{CoreJS => XMLJS}/src/test/royale/build.xml | 6 +-
.../src/test/royale/FlexUnitRoyaleApplication.mxml | 21 +++-
.../src/test/royale/FlexUnitRoyaleApplication.mxml | 21 +++-
.../language/LanguageTesterTestVector.as | 6 +-
frameworks/projects/Language/pom.xml | 1 +
.../royale/org/apache/royale/utils/Language.as | 111 ++++++---------------
frameworks/projects/Network/build.xml | 11 +-
.../royale/FlexUnitRoyaleApplication-config.xml | 4 +
.../src/test/royale/FlexUnitRoyaleApplication.mxml | 25 ++++-
.../src/test/royale/build.xml | 4 +-
.../test}/royale/flexUnitTests/NetworkTester.as | 2 +-
.../network/AMFBinaryDataTesterTest.as | 0
.../network/support/DynamicPropertyWriter.as | 0
.../network/support/DynamicTestClass.as | 0
.../network/support/DynamicTestClass2.as | 0
.../flexUnitTests/network/support/TestClass1.as | 0
.../flexUnitTests/network/support/TestClass2.as | 0
.../flexUnitTests/network/support/TestClass3.as | 0
.../flexUnitTests/network/support/TestClass4.as | 0
frameworks/projects/Reflection/build.xml | 20 +++-
.../org/apache/royale/reflection/ExtraData.as | 7 --
.../royale/FlexUnitRoyaleApplication-config.xml | 3 +
.../src/test/royale/FlexUnitRoyaleApplication.mxml | 25 ++++-
.../{Core => Reflection}/src/test/royale/build.xml | 4 +-
.../test}/royale/flexUnitTests/ReflectionTester.as | 2 +-
.../reflection/ReflectionTesterNativeTypes.as | 15 ++-
.../reflection/ReflectionTesterTest.as | 19 +---
.../reflection/ReflectionTesterTestAlias.as | 18 +---
.../reflection/ReflectionTesterTestDynamic.as | 7 +-
.../reflection/ReflectionTesterTestUseCache.as | 18 +---
.../reflection/support/DynamicTestClass.as | 0
.../reflection/support/DynamicTestClass2.as | 0
.../reflection/support/DynamicTestClass3.as | 0
.../reflection/support/ITestInterface.as | 0
.../reflection/support/ITestInterface2.as | 0
.../reflection/support/ITestInterface3.as | 0
.../reflection/support/ITestInterface4.as | 0
.../flexUnitTests/reflection/support/TestClass1.as | 0
.../flexUnitTests/reflection/support/TestClass2.as | 0
.../flexUnitTests/reflection/support/TestClass3.as | 0
.../flexUnitTests/reflection/support/TestClass4.as | 0
.../flexUnitTests/reflection/support/TestClass5.as | 0
.../src/main/royale/RoyaleUnitClasses.as | 3 +-
.../main/royale/org/apache/royale/test/Runtime.as} | 23 +++--
.../src/test/royale/FlexUnitRoyaleApplication.mxml | 19 ++++
frameworks/projects/XML/build.xml | 11 +-
.../royale/FlexUnitRoyaleApplication-config.xml | 2 +
.../src/test/royale/FlexUnitRoyaleApplication.mxml | 26 ++++-
.../{Core => XML}/src/test/royale/build.xml | 4 +-
.../src/test}/royale/flexUnitTests/XMLTester.as | 2 +-
.../flexUnitTests/xml/XMLListTesterGeneralTest.as | 4 +-
.../flexUnitTests/xml/XMLTesterGeneralTest.as | 11 +-
.../flexUnitTests/xml/XMLTesterStringifyTest.as | 2 +-
.../royale/flexUnitTests/core/ArrayTesterTest.as | 38 +++----
.../src/main/royale/flexUnitTests/core/MD5Test.as | 8 +-
.../flexUnitTests/github/GithubIssues2018.as | 6 +-
.../flexUnitTests/github/GithubIssues2019.as | 4 +-
60 files changed, 309 insertions(+), 235 deletions(-)
copy frameworks/js/projects/{CoreJS => NetworkJS}/src/test/royale/build.xml (96%)
copy frameworks/js/projects/{CoreJS => ReflectionJS}/src/test/royale/build.xml (96%)
copy frameworks/js/projects/{CoreJS => XMLJS}/src/test/royale/build.xml (97%)
copy frameworks/projects/{Core => Network}/src/test/royale/FlexUnitRoyaleApplication-config.xml (94%)
copy frameworks/projects/{Core => Network}/src/test/royale/FlexUnitRoyaleApplication.mxml (73%)
copy frameworks/projects/{RoyaleUnit => Network}/src/test/royale/build.xml (97%)
copy {manualtests/UnitTests/src/main => frameworks/projects/Network/src/test}/royale/flexUnitTests/NetworkTester.as (96%)
copy {manualtests/UnitTests/src/main => frameworks/projects/Network/src/test}/royale/flexUnitTests/network/AMFBinaryDataTesterTest.as (100%)
copy {manualtests/UnitTests/src/main => frameworks/projects/Network/src/test}/royale/flexUnitTests/network/support/DynamicPropertyWriter.as (100%)
copy {manualtests/UnitTests/src/main => frameworks/projects/Network/src/test}/royale/flexUnitTests/network/support/DynamicTestClass.as (100%)
copy {manualtests/UnitTests/src/main => frameworks/projects/Network/src/test}/royale/flexUnitTests/network/support/DynamicTestClass2.as (100%)
copy {manualtests/UnitTests/src/main => frameworks/projects/Network/src/test}/royale/flexUnitTests/network/support/TestClass1.as (100%)
copy {manualtests/UnitTests/src/main => frameworks/projects/Network/src/test}/royale/flexUnitTests/network/support/TestClass2.as (100%)
copy {manualtests/UnitTests/src/main => frameworks/projects/Network/src/test}/royale/flexUnitTests/network/support/TestClass3.as (100%)
copy {manualtests/UnitTests/src/main => frameworks/projects/Network/src/test}/royale/flexUnitTests/network/support/TestClass4.as (100%)
copy frameworks/projects/{Core => Reflection}/src/test/royale/FlexUnitRoyaleApplication-config.xml (98%)
copy frameworks/projects/{Core => Reflection}/src/test/royale/FlexUnitRoyaleApplication.mxml (73%)
copy frameworks/projects/{Core => Reflection}/src/test/royale/build.xml (97%)
copy {manualtests/UnitTests/src/main => frameworks/projects/Reflection/src/test}/royale/flexUnitTests/ReflectionTester.as (96%)
copy {manualtests/UnitTests/src/main => frameworks/projects/Reflection/src/test}/royale/flexUnitTests/reflection/ReflectionTesterNativeTypes.as (91%)
copy {manualtests/UnitTests/src/main => frameworks/projects/Reflection/src/test}/royale/flexUnitTests/reflection/ReflectionTesterTest.as (96%)
copy {manualtests/UnitTests/src/main => frameworks/projects/Reflection/src/test}/royale/flexUnitTests/reflection/ReflectionTesterTestAlias.as (81%)
copy {manualtests/UnitTests/src/main => frameworks/projects/Reflection/src/test}/royale/flexUnitTests/reflection/ReflectionTesterTestDynamic.as (98%)
copy {manualtests/UnitTests/src/main => frameworks/projects/Reflection/src/test}/royale/flexUnitTests/reflection/ReflectionTesterTestUseCache.as (81%)
copy {manualtests/UnitTests/src/main => frameworks/projects/Reflection/src/test}/royale/flexUnitTests/reflection/support/DynamicTestClass.as (100%)
copy {manualtests/UnitTests/src/main => frameworks/projects/Reflection/src/test}/royale/flexUnitTests/reflection/support/DynamicTestClass2.as (100%)
copy {manualtests/UnitTests/src/main => frameworks/projects/Reflection/src/test}/royale/flexUnitTests/reflection/support/DynamicTestClass3.as (100%)
copy {manualtests/UnitTests/src/main => frameworks/projects/Reflection/src/test}/royale/flexUnitTests/reflection/support/ITestInterface.as (100%)
copy {manualtests/UnitTests/src/main => frameworks/projects/Reflection/src/test}/royale/flexUnitTests/reflection/support/ITestInterface2.as (100%)
copy {manualtests/UnitTests/src/main => frameworks/projects/Reflection/src/test}/royale/flexUnitTests/reflection/support/ITestInterface3.as (100%)
copy {manualtests/UnitTests/src/main => frameworks/projects/Reflection/src/test}/royale/flexUnitTests/reflection/support/ITestInterface4.as (100%)
copy {manualtests/UnitTests/src/main => frameworks/projects/Reflection/src/test}/royale/flexUnitTests/reflection/support/TestClass1.as (100%)
copy {manualtests/UnitTests/src/main => frameworks/projects/Reflection/src/test}/royale/flexUnitTests/reflection/support/TestClass2.as (100%)
copy {manualtests/UnitTests/src/main => frameworks/projects/Reflection/src/test}/royale/flexUnitTests/reflection/support/TestClass3.as (100%)
copy {manualtests/UnitTests/src/main => frameworks/projects/Reflection/src/test}/royale/flexUnitTests/reflection/support/TestClass4.as (100%)
copy {manualtests/UnitTests/src/main => frameworks/projects/Reflection/src/test}/royale/flexUnitTests/reflection/support/TestClass5.as (100%)
copy frameworks/projects/{Basic/src/main/royale/org/apache/royale/html/PanelTitleBar.as => RoyaleUnit/src/main/royale/org/apache/royale/test/Runtime.as} (74%)
copy frameworks/projects/{Core => XML}/src/test/royale/FlexUnitRoyaleApplication-config.xml (98%)
copy frameworks/projects/{Core => XML}/src/test/royale/FlexUnitRoyaleApplication.mxml (73%)
copy frameworks/projects/{Core => XML}/src/test/royale/build.xml (97%)
copy {manualtests/UnitTests/src/main => frameworks/projects/XML/src/test}/royale/flexUnitTests/XMLTester.as (97%)
copy {manualtests/UnitTests/src/main => frameworks/projects/XML/src/test}/royale/flexUnitTests/xml/XMLListTesterGeneralTest.as (98%)
copy {manualtests/UnitTests/src/main => frameworks/projects/XML/src/test}/royale/flexUnitTests/xml/XMLTesterGeneralTest.as (99%)
copy {manualtests/UnitTests/src/main => frameworks/projects/XML/src/test}/royale/flexUnitTests/xml/XMLTesterStringifyTest.as (99%)
[royale-asjs] 03/03: Updates following class level
@royalesuppressexport directive now working. Removed instanceof warnings
from Language in maven build.
Posted by gr...@apache.org.
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 6337bcb01b882b09603703b24b92f3e495a317a0
Author: greg-dove <gr...@gmail.com>
AuthorDate: Fri Aug 9 16:45:49 2019 +1200
Updates following class level @royalesuppressexport directive now working.
Removed instanceof warnings from Language in maven build.
---
frameworks/projects/Language/pom.xml | 1 +
.../royale/org/apache/royale/utils/Language.as | 111 ++++++---------------
.../org/apache/royale/reflection/ExtraData.as | 7 --
3 files changed, 29 insertions(+), 90 deletions(-)
diff --git a/frameworks/projects/Language/pom.xml b/frameworks/projects/Language/pom.xml
index cda8000..d217933 100644
--- a/frameworks/projects/Language/pom.xml
+++ b/frameworks/projects/Language/pom.xml
@@ -46,6 +46,7 @@
</includeClasses>
<skipExtern>true</skipExtern>
<skipAS>${royale.skipAS}</skipAS>
+ <additionalCompilerOptions combine.self="append">-warn-instance-of-changes=false</additionalCompilerOptions>
</configuration>
</plugin>
</plugins>
diff --git a/frameworks/projects/Language/src/main/royale/org/apache/royale/utils/Language.as b/frameworks/projects/Language/src/main/royale/org/apache/royale/utils/Language.as
index 0de85e8..d502aef 100644
--- a/frameworks/projects/Language/src/main/royale/org/apache/royale/utils/Language.as
+++ b/frameworks/projects/Language/src/main/royale/org/apache/royale/utils/Language.as
@@ -291,7 +291,7 @@ package org.apache.royale.utils
value: boundMethod
});
return boundMethod;
- };
+ }
/**
* @param arr
@@ -299,7 +299,6 @@ package org.apache.royale.utils
* @param opt
*
* @royaleignorecoercion Function
- * @royalesuppressexport
*/
public static function sort(arr:Array, ...args):void
{
@@ -368,7 +367,6 @@ package org.apache.royale.utils
* @param arr
* @param names
* @param opt
- * @royalesuppressexport
*/
public static function sortOn(arr:Array, names:Object, opt:Object = 0):void
{
@@ -448,7 +446,6 @@ package org.apache.royale.utils
/**
* no export (allow dead code elimination if never used):
- * @royalesuppressexport
*/
public static function resolveUncertain(val:*):*
{
@@ -460,18 +457,12 @@ package org.apache.royale.utils
}
private static var _synthType:Class;
- /**
- * @royalesuppressexport
- */
+
public static const SYNTH_TAG_FIELD:String = goog.DEBUG ? '_synthType' : '_s';
- /**
- * @royalesuppressexport
- */
+
public static const CHECK_INDEX:String = goog.DEBUG ? 'chkIdx' : '_ci';
- /**
- * @royalesuppressexport
- */
+
public static function isSynthType(def:Object):Boolean{
return (_synthType && def && def.constructor == _synthType);
}
@@ -485,8 +476,8 @@ package org.apache.royale.utils
* Supports a 'plugin' style addition of extra types beyond the basic defaults
*
* @royalesuppressresolveuncertain true, _synthType
- * no export (allow dead code elimination if never used):
- * @royalesuppressexport
+ * @royalesuppresscompleximplicitcoercion true
+ *
*/
public static function synthType(typeName:String, newDefinition:*):Class
{
@@ -557,8 +548,8 @@ package org.apache.royale.utils
* Uses cached lookups and 'plugin' style addition of synthTypes for each distinct requested Vector subclass type
*
* @royaleignorecoercion Array
- * no export (allow dead code elimination if never used):
- * @royalesuppressexport
+ * @royalesuppresscompleximplicitcoercion true
+ *
*/
public static function synthVector(elementType:String):Class
{
@@ -638,7 +629,6 @@ package org.apache.royale.utils
*
* @royaleignorecoercion Array
* no export (allow dead code elimination if never used):
- * @royalesuppressexport
*/
public static function Vector(size:int = 0, baseType:String = null, fixed:Boolean = false):*
{
@@ -650,7 +640,6 @@ package org.apache.royale.utils
* Support for legacy vectorEmulationClass=Array approach.
*
* no export (allow dead code elimination if never used):
- * @royalesuppressexport
*/
public static function arrayAsVector(size:int = 0, baseType:String = null):Array
{
@@ -686,34 +675,19 @@ class VectorSupport {
//Warning : code in this class is very dependent on non-generation of closures and possibly other 'quirks'
//If you make any changes, please verify this against Vector unit tests, across different targets
- /**
- * @royalesuppressexport
- */
public static const fixedRangeError:String = 'Error #1126: Cannot change the length of a fixed Vector';
- /**
- * @royalesuppressexport
- */
+
public static const nonConstructorError:String = 'Error #1007: Instantiation attempted on a non-constructor.';
- /**
- * @royalesuppressexport
- */
+
public static var langSynthType:Object;
- /**
- * @royalesuppressexport
- */
+
public static const COERCE_ELEMENT:String = goog.DEBUG ? 'coerceElement' : 'cE';
- /**
- * @royalesuppressexport
- */
+
public static const DEFAULT_VALUE:String = goog.DEBUG ? 'defaultValue' : 'dV';
- /**
- * @royalesuppressexport
- */
+
public static const ELEMENT_TYPE:String = goog.DEBUG ? 'elementType' : 'eT';
- /**
- * @royalesuppressexport
- */
+
public static const FIXED_LEN:String = goog.DEBUG ? 'fixedLen' : 'fL';
private static function indexRangerError(index:Number, limit:uint):String{
@@ -721,8 +695,7 @@ class VectorSupport {
}
/**
- * internal use only: v should be an Array.
- * @royalesuppressexport
+ * internal use only: v should be an Array.
*/
public static function checkIsVector(v:Object, typeName:String):Boolean
{
@@ -735,9 +708,7 @@ class VectorSupport {
}
return ret;
}
- /**
- * @royalesuppressexport
- */
+
public static function vectorElementDefault(elementType:String, synthVectorClass:Object ):Object {
if (synthVectorClass[VectorSupport.DEFAULT_VALUE] !== undefined) return synthVectorClass[VectorSupport.DEFAULT_VALUE];
const standardDefaults:Object = {
@@ -757,8 +728,8 @@ class VectorSupport {
/**
*
- * @royaleignorecoercion Function
- * @royalesuppressexport
+ * @royaleignorecoercion Function
+ * @royalesuppresscompleximplicitcoercion true
*/
public static function vectorElementCoercion(elementType:String, synthVectorClass:Object, deferred:Boolean):Function{
if (synthVectorClass[VectorSupport.COERCE_ELEMENT]) return synthVectorClass[VectorSupport.COERCE_ELEMENT] as Function;
@@ -838,7 +809,6 @@ class VectorSupport {
/**
* @royaleignorecoercion Function
- * @royalesuppressexport
*/
public static function arrayVector(arr:Array, size:int, basetype:String,fixed:Boolean , tag:Object, construct:Boolean = true):Array
{
@@ -866,8 +836,8 @@ class VectorSupport {
return arr;
}
/**
- * @royalesuppressexport
* @royalesuppressclosure
+ * @royalesuppresscompleximplicitcoercion true
*/
public static function tagVectorArray(array:Array, elementType:String, fixed:Boolean, inst:Object):Array
{
@@ -949,7 +919,7 @@ class VectorSupport {
private static var _instance:VectorSupport;
private static var _baseObject:Object;
/**
- * @royalesuppressexport
+
* prevent closure generation for the method references:
* @royalesuppressclosure
*/
@@ -975,7 +945,6 @@ class VectorSupport {
private static var _nonFixedTypeSafetyOverrides:Object;
private static var _fixedTypeSafetyOverrides:Object;
/**
- * @royalesuppressexport
* @royalesuppressclosure
*/
public static function getMutationTypeSafetyOverrides(fixed:Boolean):Object{
@@ -1021,22 +990,18 @@ class VectorSupport {
};
return fixed ? _fixedTypeSafetyOverrides : _nonFixedTypeSafetyOverrides;
}
- /**
- * @royalesuppressexport
- */
+
public function toString():String{
return Array.prototype.map.call(this, String).toString();
}
/**
* @royaleignorecoercion Array
- * @royalesuppressexport
*/
public function map(callback:Function):* {
var inst:Object= this[Language.SYNTH_TAG_FIELD]; return tagVectorArray(Array.prototype.map.call(this, function(item:Object, index:int, source:*):Object{return inst[COERCE_ELEMENT](callback(item,index,source))}) as Array, inst[ELEMENT_TYPE],false,null);
}
/**
* @royaleignorecoercion Array
- * @royalesuppressexport
*/
public function splice():* {
var a:Array = Array.prototype.slice.call(arguments) as Array;var inst:Object= this[Language.SYNTH_TAG_FIELD]; var ret:Array = Array.prototype.splice.apply(this, a) as Array; if (inst[FIXED_LEN] > -1) inst[FIXED_LEN] = this['length']; return tagVectorArray(ret, inst[ELEMENT_TYPE], false, null);
@@ -1044,7 +1009,6 @@ class VectorSupport {
/**
* @royaleignorecoercion Array
- * @royalesuppressexport
*/
public function slice():* {
var a:Array = Array.prototype.slice.call(arguments) as Array;var inst:Object= this[Language.SYNTH_TAG_FIELD]; var ret:Array = Array.prototype.slice.apply(this, a) as Array; return tagVectorArray(ret, inst[ELEMENT_TYPE], false, null);
@@ -1052,7 +1016,6 @@ class VectorSupport {
/**
* @royaleignorecoercion Array
- * @royalesuppressexport
*/
public function filter():* {
var a:Array = Array.prototype.slice.call(arguments) as Array;var inst:Object= this[Language.SYNTH_TAG_FIELD]; var ret:Array = Array.prototype.filter.apply(this, a) as Array; return tagVectorArray(ret, inst[ELEMENT_TYPE], false, null);
@@ -1061,7 +1024,6 @@ class VectorSupport {
/**
* @royaleignorecoercion Array
* @royaleignorecoercion String
- * @royalesuppressexport
*/
public function concat():* {
var a:Array = Array.prototype.slice.call(arguments) as Array;var inst:Object = this[Language.SYNTH_TAG_FIELD];
@@ -1075,21 +1037,15 @@ class VectorSupport {
var ret:Array = Array.prototype.concat.apply(this, a) as Array;
return tagVectorArray(ret,inst[ELEMENT_TYPE], false, null);
}
- /**
- * @royalesuppressexport
- */
+
public function uncheckedInsertAt(index:Number,item:*):* {
return Array.prototype.splice.call(this, index, 0, item);
}
- /**
- * @royalesuppressexport
- */
+
public function uncheckedRemoveAt(index:Number):* {
return Array.prototype.splice.call(this, index, 1)[0];
}
- /**
- * @royalesuppressexport
- */
+
public function get_len():Number{
//'this' inside here is the synthType instance. It has a value property that refers to the
//Array instance that it 'tags'
@@ -1097,7 +1053,6 @@ class VectorSupport {
}
/**
* @royaleignorecoercion Array
- * @royalesuppressexport
*/
public function set_len(value:Number):void{
//'this' here is the synthType instance. It has a value property that refers to the
@@ -1116,7 +1071,6 @@ class VectorSupport {
//fixed-length vector-like array overrides
/**
* @royaleignorecoercion Array
- * @royalesuppressexport
*/
public function push(v:*):* {
var a:Array = Array.prototype.slice.call(arguments) as Array;
@@ -1127,7 +1081,6 @@ class VectorSupport {
}
/**
* @royaleignorecoercion Array
- * @royalesuppressexport
*/
public function unshift(v:*):* {
var a:Array = Array.prototype.slice.call(arguments) as Array;
@@ -1136,30 +1089,22 @@ class VectorSupport {
if (err) throw new (err.constructor)(err.message);
return len;
}
- /**
- * @royalesuppressexport
- */
+
public function insertAt(index:int, item:*):void {
this[Language.SYNTH_TAG_FIELD]['insertAt'].call(this,index,item);
}
- /**
- * @royalesuppressexport
- */
+
public function removeAt(index:int):Object {
const idx:int = index < 0 ? Math.max(this['length'] + index, 0) : index;
if (idx >= this['length']) throw new RangeError(indexRangerError(index, this['length']));
return this[Language.SYNTH_TAG_FIELD]['removeAt'].call(this, idx);
}
- /**
- * @royalesuppressexport
- */
+
public function throwRangeError():void{
throw new RangeError(fixedRangeError);
}
- /**
- * @royalesuppressexport
- */
+
public function chkIdx(index:Number):Number {
var limit:Number = this[Language.SYNTH_TAG_FIELD][FIXED_LEN];
var fail:Boolean = index >>> 0 !== index; //fail if not a uint value (also covers negative value range check)
diff --git a/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/ExtraData.as b/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/ExtraData.as
index ad516fd..afd2d65 100644
--- a/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/ExtraData.as
+++ b/frameworks/projects/Reflection/src/main/royale/org/apache/royale/reflection/ExtraData.as
@@ -78,7 +78,6 @@ package org.apache.royale.reflection {
/**
* this is non-reflectable
- * @royalesuppressexport
*/
public static function get isRelevant():Boolean{
return true;
@@ -86,7 +85,6 @@ package org.apache.royale.reflection {
/**
* this is non-reflectable
- * @royalesuppressexport
*/
public static function hasData(key:*):Boolean{
return reflectionData && reflectionData.has(key);
@@ -94,7 +92,6 @@ package org.apache.royale.reflection {
/**
* this is non-reflectable
- * @royalesuppressexport
*/
public static function getData(key:*):Object{
return reflectionData.get(key);
@@ -114,8 +111,6 @@ package org.apache.royale.reflection {
* import org.apache.royale.reflection.nativejs.AS3Array
* ExtraData.addExternalDefinition(AS3Array())
*
- * @royalesuppressexport
-
*/
public static function addExternDefintion(item:Object):void{
if (!reflectionData) reflectionData = new Map();
@@ -133,8 +128,6 @@ package org.apache.royale.reflection {
* If this method is never used, the dependencies inside it
* will not be included in release build
*
- * @royalesuppressexport
-
*/
public static function addAll():void{
var items:Array = [
[royale-asjs] 02/03: Migrating most manualtests/UnitTests tests to
RoyaleUnit. Added [Ignore] to failing XML tests for now. Added support for
swfVersion awareness/variation in RoyaleUnit tests.
Posted by gr...@apache.org.
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 0e0ec3c445cdb8974bd7cd7ba050a8e3cbc167df
Author: greg-dove <gr...@gmail.com>
AuthorDate: Fri Aug 9 12:35:47 2019 +1200
Migrating most manualtests/UnitTests tests to RoyaleUnit. Added [Ignore] to failing XML tests for now.
Added support for swfVersion awareness/variation in RoyaleUnit tests.
---
frameworks/build.xml | 19 +-
.../projects/NetworkJS/src/test/royale/build.xml | 192 ++++
.../ReflectionJS/src/test/royale/build.xml | 192 ++++
.../js/projects/XMLJS/src/test/royale/build.xml | 192 ++++
.../src/test/royale/FlexUnitRoyaleApplication.mxml | 21 +-
.../src/test/royale/FlexUnitRoyaleApplication.mxml | 21 +-
.../language/LanguageTesterTestVector.as | 6 +-
frameworks/projects/Network/build.xml | 11 +-
.../royale/FlexUnitRoyaleApplication-config.xml | 109 ++
.../src/test/royale/FlexUnitRoyaleApplication.mxml | 25 +-
.../projects/Network/src/test/royale/build.xml | 115 +++
.../src/test/royale/flexUnitTests/NetworkTester.as | 46 +
.../network/AMFBinaryDataTesterTest.as | 537 ++++++++++
.../network/support/DynamicPropertyWriter.as | 61 ++
.../network/support/DynamicTestClass.as | 36 +
.../network/support/DynamicTestClass2.as | 36 +
.../flexUnitTests/network/support/TestClass1.as | 34 +
.../flexUnitTests/network/support/TestClass2.as | 39 +
.../flexUnitTests/network/support/TestClass3.as | 55 +
.../flexUnitTests/network/support/TestClass4.as | 34 +
frameworks/projects/Reflection/build.xml | 20 +-
.../royale/FlexUnitRoyaleApplication-config.xml | 108 ++
.../src/test/royale/FlexUnitRoyaleApplication.mxml | 25 +-
.../projects/Reflection/src/test/royale/build.xml | 115 +++
.../test/royale/flexUnitTests/ReflectionTester.as | 52 +
.../reflection/ReflectionTesterNativeTypes.as | 237 +++++
.../reflection/ReflectionTesterTest.as | 376 +++++++
.../reflection/ReflectionTesterTestAlias.as | 81 ++
.../reflection/ReflectionTesterTestDynamic.as | 218 ++++
.../reflection/ReflectionTesterTestUseCache.as | 89 ++
.../reflection/support/DynamicTestClass.as | 99 ++
.../reflection/support/DynamicTestClass2.as | 65 ++
.../reflection/support/DynamicTestClass3.as | 37 +
.../reflection/support/ITestInterface.as | 27 +
.../reflection/support/ITestInterface2.as | 29 +
.../reflection/support/ITestInterface3.as | 27 +
.../reflection/support/ITestInterface4.as | 29 +
.../flexUnitTests/reflection/support/TestClass1.as | 103 ++
.../flexUnitTests/reflection/support/TestClass2.as | 120 +++
.../flexUnitTests/reflection/support/TestClass3.as | 42 +
.../flexUnitTests/reflection/support/TestClass4.as | 112 ++
.../flexUnitTests/reflection/support/TestClass5.as | 92 ++
.../src/main/royale/RoyaleUnitClasses.as | 3 +-
.../main/royale/org/apache/royale/test/Runtime.as | 37 +
.../src/test/royale/FlexUnitRoyaleApplication.mxml | 19 +
frameworks/projects/XML/build.xml | 11 +-
.../royale/FlexUnitRoyaleApplication-config.xml | 107 ++
.../src/test/royale/FlexUnitRoyaleApplication.mxml | 26 +-
frameworks/projects/XML/src/test/royale/build.xml | 115 +++
.../XML/src/test/royale/flexUnitTests/XMLTester.as | 51 +
.../flexUnitTests/xml/XMLListTesterGeneralTest.as | 195 ++++
.../flexUnitTests/xml/XMLTesterGeneralTest.as | 1085 ++++++++++++++++++++
.../flexUnitTests/xml/XMLTesterStringifyTest.as | 323 ++++++
53 files changed, 5835 insertions(+), 21 deletions(-)
diff --git a/frameworks/build.xml b/frameworks/build.xml
index e73f8c7..5c9a998 100644
--- a/frameworks/build.xml
+++ b/frameworks/build.xml
@@ -114,9 +114,9 @@
<antcall target="Binding"/>
<antcall target="Reflection"/>
<antcall target="RoyaleUnit"/>
- <antcall target="Network"/>
<antcall target="Collections"/>
<antcall target="Basic"/>
+
<antcall target="Ace"/>
<antcall target="HTML"/>
<antcall target="Effects"/>
@@ -132,6 +132,7 @@
<antcall target="Storage"/>
<antcall target="XML"/>
+ <antcall target="Network"/>
<antcall target="Text"/>
<antcall target="TLF"/>
<antcall target="MaterialDesignLite"/>
@@ -150,6 +151,9 @@
<antcall target="RoyaleUnitTest"/>
<antcall target="CoreTest"/>
<antcall target="BasicTest"/>
+ <antcall target="ReflectionTest"/>
+ <antcall target="NetworkTest"/>
+ <antcall target="XMLTest"/>
</target>
<target name="fonts">
@@ -333,10 +337,18 @@
<ant dir="${basedir}/projects/Network"/>
</target>
+ <target name="NetworkTest" description="Test of Network.swc">
+ <ant dir="${basedir}/projects/Network" target="test"/>
+ </target>
+
<target name="Reflection" description="Clean build of Reflection.swc">
<ant dir="${basedir}/projects/Reflection"/>
</target>
+ <target name="ReflectionTest" description="Test of Reflection.swc">
+ <ant dir="${basedir}/projects/Reflection" target="test"/>
+ </target>
+
<target name="RoyaleUnit" description="Clean build of RoyaleUnit.swc">
<ant dir="${basedir}/projects/RoyaleUnit"/>
</target>
@@ -351,6 +363,11 @@
<target name="XML" description="Clean build of XML.swc">
<ant dir="${basedir}/projects/XML"/>
</target>
+
+ <target name="XMLTest" description="Test of XML.swc">
+ <ant dir="${basedir}/projects/XML" target="test"/>
+ </target>
+
<target name="Text" description="Clean build of Text.swc">
<ant dir="${basedir}/projects/Text"/>
</target>
diff --git a/frameworks/js/projects/NetworkJS/src/test/royale/build.xml b/frameworks/js/projects/NetworkJS/src/test/royale/build.xml
new file mode 100644
index 0000000..903c7f4
--- /dev/null
+++ b/frameworks/js/projects/NetworkJS/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="NetworkJS.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="NetworkJS-${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/Network/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/js/projects/ReflectionJS/src/test/royale/build.xml b/frameworks/js/projects/ReflectionJS/src/test/royale/build.xml
new file mode 100644
index 0000000..b5be476
--- /dev/null
+++ b/frameworks/js/projects/ReflectionJS/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="ReflectionJS.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="ReflectionJS-${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/Reflection/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/js/projects/XMLJS/src/test/royale/build.xml b/frameworks/js/projects/XMLJS/src/test/royale/build.xml
new file mode 100644
index 0000000..27e2d62
--- /dev/null
+++ b/frameworks/js/projects/XMLJS/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="XMLJS.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="XMLJS-${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/XML/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/Basic/src/test/royale/FlexUnitRoyaleApplication.mxml b/frameworks/projects/Basic/src/test/royale/FlexUnitRoyaleApplication.mxml
index 9e2e355..487d1e7 100644
--- a/frameworks/projects/Basic/src/test/royale/FlexUnitRoyaleApplication.mxml
+++ b/frameworks/projects/Basic/src/test/royale/FlexUnitRoyaleApplication.mxml
@@ -37,9 +37,28 @@ limitations under the License.
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(DataGridColumnTester);
diff --git a/frameworks/projects/Core/src/test/royale/FlexUnitRoyaleApplication.mxml b/frameworks/projects/Core/src/test/royale/FlexUnitRoyaleApplication.mxml
index 3512e39..7d13b1a 100644
--- a/frameworks/projects/Core/src/test/royale/FlexUnitRoyaleApplication.mxml
+++ b/frameworks/projects/Core/src/test/royale/FlexUnitRoyaleApplication.mxml
@@ -37,9 +37,28 @@ limitations under the License.
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(CoreTester);
diff --git a/frameworks/projects/Core/src/test/royale/flexUnitTests/language/LanguageTesterTestVector.as b/frameworks/projects/Core/src/test/royale/flexUnitTests/language/LanguageTesterTestVector.as
index 933f173..ec0610f 100644
--- a/frameworks/projects/Core/src/test/royale/flexUnitTests/language/LanguageTesterTestVector.as
+++ b/frameworks/projects/Core/src/test/royale/flexUnitTests/language/LanguageTesterTestVector.as
@@ -21,7 +21,7 @@ package flexUnitTests.language
import org.apache.royale.test.asserts.*;
import flexUnitTests.language.support.*;
-
+ import org.apache.royale.test.Runtime;
/**
* @royalesuppresspublicvarwarning
@@ -37,9 +37,7 @@ package flexUnitTests.language
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;
-
- return false;
+ return Runtime.swfVersion >= 30;
}
COMPILE::JS {
//always supported
diff --git a/frameworks/projects/Network/build.xml b/frameworks/projects/Network/build.xml
index 2e0b42c..cadbdb6 100644
--- a/frameworks/projects/Network/build.xml
+++ b/frameworks/projects/Network/build.xml
@@ -59,8 +59,17 @@
<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">
<delete failonerror="false">
<fileset dir="${ROYALE_HOME}/frameworks/libs">
diff --git a/frameworks/projects/Network/src/test/royale/FlexUnitRoyaleApplication-config.xml b/frameworks/projects/Network/src/test/royale/FlexUnitRoyaleApplication-config.xml
new file mode 100644
index 0000000..1fd2f20
--- /dev/null
+++ b/frameworks/projects/Network/src/test/royale/FlexUnitRoyaleApplication-config.xml
@@ -0,0 +1,109 @@
+<!--
+
+ 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/Network.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/NetworkJS.swc</path-element>
+ <path-element>../../../../../js/libs/XMLJS.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/RoyaleUnit/src/test/royale/FlexUnitRoyaleApplication.mxml b/frameworks/projects/Network/src/test/royale/FlexUnitRoyaleApplication.mxml
similarity index 73%
copy from frameworks/projects/RoyaleUnit/src/test/royale/FlexUnitRoyaleApplication.mxml
copy to frameworks/projects/Network/src/test/royale/FlexUnitRoyaleApplication.mxml
index d921be9..9bcda91 100644
--- a/frameworks/projects/RoyaleUnit/src/test/royale/FlexUnitRoyaleApplication.mxml
+++ b/frameworks/projects/Network/src/test/royale/FlexUnitRoyaleApplication.mxml
@@ -33,16 +33,35 @@ limitations under the License.
import flash.system.fscommand;
}
- import tests.RoyaleUnitSuite;
+ import flexUnitTests.NetworkTester;
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(RoyaleUnitSuite);
+ core.runClasses(NetworkTester);
}
private function core_completeHandler(event:Event):void
diff --git a/frameworks/projects/Network/src/test/royale/build.xml b/frameworks/projects/Network/src/test/royale/build.xml
new file mode 100644
index 0000000..716fa1f
--- /dev/null
+++ b/frameworks/projects/Network/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="Reflection.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="Reflection-${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/Network/src/test/royale/flexUnitTests/NetworkTester.as
new file mode 100644
index 0000000..60308e8
--- /dev/null
+++ b/frameworks/projects/Network/src/test/royale/flexUnitTests/NetworkTester.as
@@ -0,0 +1,46 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+{
+ import flexUnitTests.network.*
+
+ [Suite]
+ [RunWith("org.apache.royale.test.runners.SuiteRunner")]
+ /**
+ * @royalesuppresspublicvarwarning
+ */
+ public class NetworkTester
+ {
+ 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;
+
+ }
+}
diff --git a/frameworks/projects/Network/src/test/royale/flexUnitTests/network/AMFBinaryDataTesterTest.as b/frameworks/projects/Network/src/test/royale/flexUnitTests/network/AMFBinaryDataTesterTest.as
new file mode 100644
index 0000000..144d034
--- /dev/null
+++ b/frameworks/projects/Network/src/test/royale/flexUnitTests/network/AMFBinaryDataTesterTest.as
@@ -0,0 +1,537 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 flexUnitTests.network.support.DynamicPropertyWriter;
+ import flexUnitTests.network.support.DynamicTestClass2;
+ import flexUnitTests.network.support.TestClass1;
+ import flexUnitTests.network.support.TestClass2;
+ import flexUnitTests.network.support.TestClass3;
+ import flexUnitTests.network.support.TestClass4;
+ import flexUnitTests.network.support.DynamicTestClass;
+
+ import org.apache.royale.test.asserts.*;
+
+ import org.apache.royale.net.remoting.amf.AMFBinaryData;
+ import org.apache.royale.reflection.*;
+
+
+ public class AMFBinaryDataTesterTest
+ {
+
+ [Before]
+ public function setUp():void
+ {
+ }
+
+ [After]
+ public function tearDown():void
+ {
+ }
+
+ [BeforeClass]
+ public static function setUpBeforeClass():void
+ {
+ }
+
+ [AfterClass]
+ public static function tearDownAfterClass():void
+ {
+ }
+
+
+ //util check functions
+ private static function bytesMatchExpectedData(bd:AMFBinaryData, expected:Array, offset:int = 0):Boolean
+ {
+ var len:uint = expected.length;
+ var end:uint = offset + len;
+ for (var i:int = offset; i < end; i++)
+ {
+ var check:uint = bd.readByteAt(i);
+ if (expected[i - offset] != check)
+ {
+ // trace('failed at ',i,expected[i-offset],check);
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private static function dynamicKeyCountMatches(forObject:Object, expectedCount:uint):Boolean
+ {
+ var keyCount:uint = 0;
+ for (var key:String in forObject)
+ {
+ keyCount++;
+ }
+ return keyCount === expectedCount;
+
+ }
+
+ [Test]
+ public function testStringObjectEncoding():void
+ {
+ var ba:AMFBinaryData = new AMFBinaryData();
+ var testString:String = 'testString';
+
+ ba.writeObject(testString);
+
+ assertEquals( ba.length, 12, "post-write length was not correct");
+ assertEquals( ba.position, 12, "post-write position was not correct");
+ ba.position = 0;
+ var readString:String = ba.readObject() as String;
+ assertEquals( readString, testString, "post-write read of written string was not correct");
+ }
+
+ [Test]
+ public function testBooleanObjectEncoding():void
+ {
+ var ba:AMFBinaryData = new AMFBinaryData();
+
+ ba.writeObject(false);
+ ba.writeObject(true);
+
+ assertEquals( ba.length, 2, "post-write length was not correct");
+ assertEquals( ba.position, 2, "post-write position was not correct");
+ ba.position = 0;
+
+ assertTrue( ba.readObject() === false, "post-write read of written boolean was not correct");
+ assertTrue( ba.readObject() === true, "post-write read of written boolean was not correct");
+ }
+
+ [Test]
+ public function testNumberEncoding():void
+ {
+ var ba:AMFBinaryData = new AMFBinaryData();
+
+
+ ba.writeObject(NaN);
+ ba.writeObject(1.0);
+ ba.writeObject(-1.0);
+ ba.writeObject(1.5);
+ ba.writeObject(-1.5);
+ ba.writeObject(Infinity);
+ ba.writeObject(-Infinity);
+
+ assertEquals( ba.length, 52, "post-write length was not correct");
+ assertEquals( ba.position, 52, "post-write position was not correct");
+ ba.position = 0;
+
+ var num:Number = ba.readObject();
+ assertTrue( (num is Number), "post-write read of written Number was not correct");
+ assertTrue( isNaN(num), "post-write read of written Number was not correct");
+ num = ba.readObject();
+ assertTrue( (num is Number), "post-write read of written Number was not correct");
+ assertTrue( num === 1.0, "post-write read of written Number was not correct");
+ num = ba.readObject();
+ assertTrue( (num is Number), "post-write read of written Number was not correct");
+ assertTrue( num === -1.0, "post-write read of written Number was not correct");
+ num = ba.readObject();
+ assertTrue( (num is Number), "post-write read of written Number was not correct");
+ assertTrue( num === 1.5, "post-write read of written Number was not correct");
+ num = ba.readObject();
+ assertTrue( (num is Number), "post-write read of written Number was not correct");
+ assertTrue( num === -1.5, "post-write read of written Number was not correct");
+ num = ba.readObject();
+ assertTrue( (num is Number), "post-write read of written Number was not correct");
+ assertTrue( !isFinite(num), "post-write read of written Number was not correct");
+ assertTrue( (num > 0), "post-write read of written Number was not correct");
+ num = ba.readObject();
+ assertTrue( (num is Number), "post-write read of written Number was not correct");
+ assertTrue( !isFinite(num), "post-write read of written Number was not correct");
+ assertTrue( (num < 0), "post-write read of written Number was not correct");
+ }
+
+
+ [Test]
+ public function testArrayInstance():void
+ {
+ var ba:AMFBinaryData = new AMFBinaryData();
+ var instance:Array = [];
+ ba.writeObject(instance);
+
+ assertEquals( ba.length, 3, "post-write length was not correct");
+ assertEquals( ba.position, 3, "post-write position was not correct");
+
+ instance = [99];
+ ba.length = 0;
+ ba.writeObject(instance);
+ ba.position = 0;
+ assertTrue( bytesMatchExpectedData(ba, [9, 3, 1, 4, 99]), "post-write bytes did not match expected data");
+ instance = ba.readObject() as Array;
+ assertTrue( instance.length == 1 && instance[0] == 99, "post-write read did not match expected result");
+ //sparse array
+ instance = [];
+ instance[100] = '100';
+ ba.length = 0;
+ ba.writeObject(instance);
+ assertEquals( ba.length, 9, "post-write length was not correct");
+ assertEquals( ba.position, 9, "post-write position was not correct");
+ assertTrue( bytesMatchExpectedData(ba, [9, 1, 7, 49, 48, 48, 6, 0, 1]), "post-write bytes did not match expected data");
+ //check that read matches
+ ba.position = 0;
+ instance = ba.readObject();
+
+ assertEquals( instance.length, 101, "post-write read was not correct");
+ assertEquals( instance[100], '100', "post-write read was not correct");
+ assertTrue( instance[0] === undefined, "post-write read was not correct");
+ //sparse with associative content
+ instance = [];
+ instance['test'] = true;
+ instance[10] = 'I am number 10';
+ ba.length = 0;
+ ba.writeObject(instance);
+ assertEquals( ba.length, 28, "post-write length was not correct");
+ assertEquals( ba.position, 28, "post-write position was not correct");
+ assertTrue( bytesMatchExpectedData(ba, [9, 1, 5, 49, 48, 6, 29, 73, 32, 97, 109, 32, 110, 117, 109, 98, 101, 114, 32, 49, 48, 9, 116, 101, 115, 116, 3, 1]), "post-write bytes did not match expected data");
+
+ //check that read matches
+ ba.position = 0;
+ instance = ba.readObject();
+ assertEquals( instance.length, 11, "post-write read was not correct");
+ assertEquals( instance[10], 'I am number 10', "post-write read was not correct");
+ assertEquals( instance['test'], true, "post-write read was not correct");
+ assertTrue( instance[0] === undefined, "post-write read was not correct");
+
+ //edge cases
+ instance = [];
+ //length ==2 and Object.keys().length ==2
+ //but no dense keys;
+ instance[1] = true;
+ instance['test'] = true;
+ ba.length = 0;
+ ba.writeObject(instance);
+ assertEquals( ba.length, 12, "post-write length was not correct");
+ assertEquals( ba.position, 12, "post-write position was not correct");
+
+ assertTrue( bytesMatchExpectedData(ba, [9, 1, 3, 49, 3, 9, 116, 101, 115, 116, 3, 1]), "post-write bytes did not match expected data");
+
+ //empty array with length
+ instance = new Array(100);
+ assertEquals( instance.length, 100, "pre-write array length was not correct");
+ ba.length = 0;
+ ba.writeObject(instance);
+ assertEquals( ba.length, 3, "post-write length was not correct");
+ assertEquals( ba.position, 3, "post-write position was not correct");
+ assertTrue( bytesMatchExpectedData(ba, [9, 1, 1]), "post-write bytes did not match expected data");
+
+ ba.position = 0;
+ instance = ba.readObject() as Array;
+ //although the Array had a length of 100 on write, it has length zero on read:
+ assertTrue( instance.length == 0, "post-write read did not match expected value");
+
+ var ar:Array = [1, 2, 3];
+ var f:Function = function ():void
+ {
+ trace('func')
+ };
+ ar['__AS3__.vec'] = f;
+ ba.length = 0;
+ ba.writeObject(ar);
+ assertEquals( ba.length, 9, "post-write length was not correct");
+ assertEquals( ba.position, 9, "post-write position was not correct");
+ assertTrue( bytesMatchExpectedData(ba, [9, 7, 1, 4, 1, 4, 2, 4, 3]), "post-write bytes did not match expected data");
+ ar = [f, 1, 2, 3, f];
+ ba.length = 0;
+ ba.writeObject(ar);
+ assertEquals( ba.length, 15, "post-write length was not correct");
+ assertEquals( ba.position, 15, "post-write position was not correct");
+ assertTrue( bytesMatchExpectedData(ba, [9, 1, 3, 49, 4, 1, 3, 50, 4, 2, 3, 51, 4, 3, 1]), "post-write bytes did not match expected data");
+ //post write read is an array with length of 4 instead of 5.
+ ba.position = 0;
+ ar = ba.readObject();
+ assertEquals( ar.length, 4, "post-write read length was not correct");
+
+
+ ar = [Object, 1, 2, 3, Object];
+ ba.length = 0;
+ ba.writeObject(ar);
+ assertEquals( ba.length, 15, "post-write length was not correct");
+ assertEquals( ba.position, 15, "post-write position was not correct");
+ assertTrue( bytesMatchExpectedData(ba, [9, 11, 1, 10, 11, 1, 1, 4, 1, 4, 2, 4, 3, 10, 2]), "post-write bytes did not match expected data");
+
+
+ }
+
+
+ [Test]
+ public function testAnonObject():void
+ {
+ var ba:AMFBinaryData = new AMFBinaryData();
+
+ var instance:Object = {};
+ ba.writeObject(instance);
+
+ assertEquals( ba.length, 4, "post-write length was not correct");
+ assertEquals( ba.position, 4, "post-write position was not correct");
+ ba.position = 0;
+
+ assertTrue( bytesMatchExpectedData(ba, [10, 11, 1, 1]), "post-write bytes did not match expected data");
+ instance = ba.readObject();
+ assertTrue( dynamicKeyCountMatches(instance, 0), "post-write read did not match expected result");
+
+ var obj1:Object = {test: true};
+ var obj2:Object = {test: 'maybe'};
+ var obj3:Object = {test: true};
+ ba.length = 0;
+ ba.writeObject([obj1, obj2, obj3]);
+ ba.position = 0;
+ assertTrue( bytesMatchExpectedData(ba, [9, 7, 1, 10, 11, 1, 9, 116, 101, 115, 116, 3, 1, 10, 1, 0, 6, 11, 109, 97, 121, 98, 101, 1, 10, 1, 0, 3, 1]), "post-write bytes did not match expected data");
+
+ }
+
+
+ [Test]
+ public function testFunction():void
+ {
+ var ba:AMFBinaryData = new AMFBinaryData();
+ //functions are always encoded as undefined
+ var instance:Function = function ():void
+ {
+ };
+ ba.writeObject(instance);
+
+ assertEquals( ba.length, 1, "post-write length was not correct");
+ assertEquals( ba.position, 1, "post-write position was not correct");
+ ba.position = 0;
+
+ assertTrue( bytesMatchExpectedData(ba, [0]), "post-write bytes did not match expected data");
+ instance = ba.readObject();
+
+ assertTrue( instance === null, "post-write read did not match expected result");
+
+ //for a property that has a function value, the property is also undefined
+ var objectWithFunction:Object = {
+ 'function': function ():void
+ {
+ }
+ };
+ ba.length = 0;
+ ba.writeObject(objectWithFunction);
+
+ assertEquals( ba.length, 4, "post-write length was not correct");
+ assertEquals( ba.position, 4, "post-write position was not correct");
+ ba.position = 0;
+ assertTrue( bytesMatchExpectedData(ba, [10, 11, 1, 1]), "post-write bytes did not match expected data");
+
+ //the dynamic deserialized object has no key for the function value
+ var obj:Object = ba.readObject();
+ assertTrue( dynamicKeyCountMatches(obj, 0), "post-write read did not match expected result");
+
+ ba.length = 0;
+ var tc4:TestClass4 = new TestClass4();
+ tc4.testField1 = function ():void
+ {
+ };
+
+ ba.writeObject(tc4);
+ assertEquals( ba.length, 15, "post-write length was not correct");
+ assertEquals( ba.position, 15, "post-write position was not correct");
+
+ assertTrue( bytesMatchExpectedData(ba, [10, 19, 1, 21, 116, 101, 115, 116, 70, 105, 101, 108, 100, 49, 0]), "post-write bytes did not match expected data");
+
+ }
+
+
+ [Test]
+ /**
+ * @royaleignorecoercion TestClass1
+ */
+ public function testBasicClassInstance():void
+ {
+ var ba:AMFBinaryData = new AMFBinaryData();
+
+ var instance:TestClass1 = new TestClass1();
+ ba.writeObject(instance);
+
+ assertEquals( ba.length, 16, "post-write length was not correct");
+ assertEquals( ba.position, 16, "post-write position was not correct");
+
+ ba.position = 0;
+ assertTrue( bytesMatchExpectedData(ba, [10, 19, 1, 21, 116, 101, 115, 116, 70, 105, 101, 108, 100, 49, 6, 1]), "post-write bytes did not match expected data");
+ ba.position = 0;
+
+ var anonObject:Object = ba.readObject();
+
+ assertTrue(anonObject['testField1'] === instance.testField1, "post-write read did not match expected value" );
+
+ var multipleDifferentInstances:Array = [new TestClass1(), new TestClass2()];
+ ba.length = 0;
+ ba.writeObject(multipleDifferentInstances);
+
+ assertEquals( ba.length, 24, "post-write length was not correct");
+ assertEquals( ba.position, 24, "post-write position was not correct");
+ ba.position = 0;
+
+ assertTrue( bytesMatchExpectedData(ba, [9, 5, 1, 10, 19, 1, 21, 116, 101, 115, 116, 70, 105, 101, 108, 100, 49, 6, 1, 10, 19, 1, 0, 3]), "post-write bytes did not match expected data");
+
+ }
+
+ [Test]
+ public function testDynamicClassInstance():void
+ {
+ var ba:AMFBinaryData = new AMFBinaryData();
+ var instance:DynamicTestClass = new DynamicTestClass();
+ ba.writeObject(instance);
+
+ assertEquals( ba.length, 25, "post-write length was not correct");
+ assertEquals( ba.position, 25, "post-write position was not correct");
+ ba.position = 0;
+ assertTrue( bytesMatchExpectedData(ba, [10, 27, 1, 39, 115, 101, 97, 108, 101, 100, 73, 110, 115, 116, 97, 110, 99, 101, 80, 114, 111, 112, 49, 2, 1]), "post-write bytes did not match expected data");
+
+ instance['someDynamicField'] = 'nonSealedPropValue';
+
+ ba.writeObject(instance);
+ assertEquals( ba.length, 62, "post-write length was not correct");
+ assertEquals( ba.position, 62, "post-write position was not correct");
+ ba.position = 0;
+ assertTrue( bytesMatchExpectedData(ba, [10, 27, 1, 39, 115, 101, 97, 108, 101, 100, 73, 110, 115, 116, 97, 110, 99, 101, 80, 114, 111, 112, 49, 2, 33, 115, 111, 109, 101, 68, 121, 110, 97, 109, 105, 99, 70, 105, 101, 108, 100, 6, 37, 110, 111, 110, 83, 101, 97, 108, 101, 100, 80, 114, 111, 112, 86, 97, 108, 117, 101, 1]), "post-write bytes did not match expected data");
+
+ var instanceAnon:Object = ba.readObject();
+ assertTrue(instanceAnon['someDynamicField'] === 'nonSealedPropValue', "post-write read did not match expected value");
+
+
+ }
+
+ [Test]
+ public function testByteArray():void
+ {
+ //on swf it is native ByteArray that encodes to 'ByteArray', in js it is AMFBinaryData
+ COMPILE::SWF{
+ import flash.utils.ByteArray;
+
+ var source:ByteArray = new ByteArray();
+ }
+
+ COMPILE::JS{
+ var source:AMFBinaryData = new AMFBinaryData();
+ }
+
+ for (var i:uint = 0; i < 26; i++) source.writeByte(i);
+ var ba:AMFBinaryData = new AMFBinaryData();
+ var holder:Array = [source, source];
+
+ ba.writeObject(holder);
+ assertEquals( ba.length, 33, "post-write error length was not correct");
+ assertEquals( ba.position, 33, "post-write error position was not correct");
+ ba.position = 0;
+ assertTrue( bytesMatchExpectedData(ba, [9, 5, 1, 12, 53, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 12, 2]), "post-write bytes did not match expected data");
+ }
+
+
+ [Test]
+ public function testExternalizable():void
+ {
+ var ba:AMFBinaryData = new AMFBinaryData();
+ var test3:TestClass3 = new TestClass3();
+ //TestClass3 is externalizable and does not have an alias, this is an error in flash
+
+ var err:Error;
+ try
+ {
+ ba.writeObject(test3);
+ } catch (e:Error)
+ {
+ err = e;
+ }
+
+ assertTrue( err != null, "externalizable writing should fail without an alias registered");
+ assertEquals( ba.length, 1, "post-write error length was not correct");
+ assertEquals( ba.position, 1, "post-write error position was not correct");
+ ba.position = 0;
+ assertTrue( bytesMatchExpectedData(ba, [10]), "post-write bytes did not match expected data");
+
+ ba.length = 0;
+ //register an alias
+ registerClassAlias('TestClass3', TestClass3);
+ ba.writeObject(test3);
+ assertEquals( ba.length, 18, "post-write length was not correct");
+ assertEquals( ba.position, 18, "post-write position was not correct");
+
+ ba.position = 0;
+ assertTrue( bytesMatchExpectedData(ba, [10, 7, 21, 84, 101, 115, 116, 67, 108, 97, 115, 115, 51, 9, 3, 1, 6, 0]), "post-write bytes did not match expected data");
+
+ test3.content[0] = (test3.content[0]).split("").reverse().join("");
+ ba.writeObject(test3);
+ assertEquals( ba.length, 28, "post-write length was not correct");
+ assertEquals( ba.position, 28, "post-write position was not correct");
+ assertTrue( bytesMatchExpectedData(ba, [10, 7, 21, 84, 101, 115, 116, 67, 108, 97, 115, 115, 51, 9, 3, 1, 6, 21, 51, 115, 115, 97, 108, 67, 116, 115, 101, 84]), "post-write bytes did not match expected data");
+
+ ba.position = 0;
+ var test3Read:TestClass3 = ba.readObject() as TestClass3;
+
+ //proof that it created a new instance, and that the reversed content string content is present in the new instance
+ assertTrue( test3Read.content[0] == test3.content[0], "post-write read did not match expected data");
+
+ }
+
+
+ [Test]
+ public function testDynamicPropertyWriter():void
+ {
+ var ba:AMFBinaryData = new AMFBinaryData();
+ var instance:DynamicTestClass2 = new DynamicTestClass2();
+ instance['_underscore'] = 'pseudo - private value';
+ instance['raining'] = 'cats and dogs';
+
+ ba.writeObject(instance);
+
+ assertEquals( ba.length, 84, "post-write length was not correct");
+ assertEquals( ba.position, 84, "post-write position was not correct");
+
+ //in this case the order of encoding the dynamic fields is not defined. So we need to account for the valid serialization options of either output sequence of the two fields
+ var raining_then_underscore:Array = [10, 27, 1, 39, 115, 101, 97, 108, 101, 100, 73, 110, 115, 116, 97, 110, 99, 101, 80, 114, 111, 112, 49, 2, 15, 114, 97, 105, 110, 105, 110, 103, 6, 27, 99, 97, 116, 115, 32, 97, 110, 100, 32, 100, 111, 103, 115, 23, 95, 117, 110, 100, 101, 114, 115, 99, 111, 114, 101, 6, 45, 112, 115, 101, 117, 100, 111, 32, 45, 32, 112, 114, 105, 118, 97, 116, 101, 32, 118, 97, 108, 117, 101, 1];
+ var underscore_then_raining:Array = [10, 27, 1, 39, 115, 101, 97, 108, 101, 100, 73, 110, 115, 116, 97, 110, 99, 101, 80, 114, 111, 112, 49, 2, 23, 95, 117, 110, 100, 101, 114, 115, 99, 111, 114, 101, 6, 45, 112, 115, 101, 117, 100, 111, 32, 45, 32, 112, 114, 105, 118, 97, 116, 101, 32, 118, 97, 108, 117, 101, 15, 114, 97, 105, 110, 105, 110, 103, 6, 27, 99, 97, 116, 115, 32, 97, 110, 100, 32, 100, 111, 103, 115, 1];
+
+ ba.position = 0;
+ assertTrue( bytesMatchExpectedData(ba, raining_then_underscore) || bytesMatchExpectedData(ba, underscore_then_raining), "post-write bytes did not match expected data");
+
+ //now test the same instance with an IDynamicPropertyWriter that ignores the underscored field, only outputting the 'raining' field
+ ba.length = 0;
+ AMFBinaryData.dynamicPropertyWriter = new DynamicPropertyWriter();
+ ba.writeObject(instance);
+ assertEquals( ba.length, 48, "post-write length was not correct");
+ assertEquals( ba.position, 48, "post-write position was not correct");
+ ba.position = 0;
+ assertTrue( bytesMatchExpectedData(ba, [10, 27, 1, 39, 115, 101, 97, 108, 101, 100, 73, 110, 115, 116, 97, 110, 99, 101, 80, 114, 111, 112, 49, 2, 15, 114, 97, 105, 110, 105, 110, 103, 6, 27, 99, 97, 116, 115, 32, 97, 110, 100, 32, 100, 111, 103, 115, 1]), "post-write bytes did not match expected data");
+
+ //remove the custom dynamicPropertyWriter
+ AMFBinaryData.dynamicPropertyWriter = null;
+
+ }
+
+ [Test]
+ public function testXML():void
+ {
+ var ba:AMFBinaryData = new AMFBinaryData();
+ var xml:XML = <xml><item/></xml>;
+
+ ba.writeObject(xml);
+ ba.position = 0;
+
+ var xml2:XML = ba.readObject() as XML;
+
+ //javascript toXMLString pretty printing does not match exactly flash...
+ assertTrue( xml.toXMLString() === xml2.toXMLString(), "XML round-tripping failed");
+ }
+
+ }
+}
diff --git a/frameworks/projects/Network/src/test/royale/flexUnitTests/network/support/DynamicPropertyWriter.as b/frameworks/projects/Network/src/test/royale/flexUnitTests/network/support/DynamicPropertyWriter.as
new file mode 100644
index 0000000..ccc4b33
--- /dev/null
+++ b/frameworks/projects/Network/src/test/royale/flexUnitTests/network/support/DynamicPropertyWriter.as
@@ -0,0 +1,61 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.support
+{
+ import org.apache.royale.utils.net.IDynamicPropertyWriter;
+ import org.apache.royale.reflection.*;
+
+ COMPILE::JS{
+ import org.apache.royale.utils.net.IDynamicPropertyOutput;
+ }
+
+ COMPILE::SWF{
+ import flash.net.IDynamicPropertyOutput;
+ }
+
+ /**
+ * @royalesuppresspublicvarwarning
+ */
+ public class DynamicPropertyWriter implements IDynamicPropertyWriter
+ {
+ //Note: do not change this test class unless you change the related tests to
+ //support any changes that might appear when testing with it
+
+
+ public function DynamicPropertyWriter()
+ {
+ // constructor code
+ }
+
+ public var excludeBeginningUnderscores:Boolean = true;
+
+ public function writeDynamicProperties(obj:Object, output:IDynamicPropertyOutput):void
+ {
+ var dynamicProperties:Array = getDynamicFields(obj);
+ while (dynamicProperties.length)
+ {
+ var prop:String = dynamicProperties.shift();
+ if (excludeBeginningUnderscores && (prop.charAt(0) == '_')) continue;
+ output.writeDynamicProperty(prop, obj[prop]);
+ }
+ }
+
+ }
+
+}
diff --git a/frameworks/projects/Network/src/test/royale/flexUnitTests/network/support/DynamicTestClass.as b/frameworks/projects/Network/src/test/royale/flexUnitTests/network/support/DynamicTestClass.as
new file mode 100644
index 0000000..703479d
--- /dev/null
+++ b/frameworks/projects/Network/src/test/royale/flexUnitTests/network/support/DynamicTestClass.as
@@ -0,0 +1,36 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.support
+{
+
+
+ /**
+ * @royalesuppresspublicvarwarning
+ */
+ dynamic public class DynamicTestClass
+ {
+ //Note: do not change this test class unless you change the related tests to
+ //support any changes that might appear when testing with it
+
+
+ public var sealedInstanceProp1:Boolean;
+
+
+ }
+}
diff --git a/frameworks/projects/Network/src/test/royale/flexUnitTests/network/support/DynamicTestClass2.as b/frameworks/projects/Network/src/test/royale/flexUnitTests/network/support/DynamicTestClass2.as
new file mode 100644
index 0000000..2e72d2c
--- /dev/null
+++ b/frameworks/projects/Network/src/test/royale/flexUnitTests/network/support/DynamicTestClass2.as
@@ -0,0 +1,36 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.support
+{
+
+
+ /**
+ * @royalesuppresspublicvarwarning
+ */
+ dynamic public class DynamicTestClass2
+ {
+ //Note: do not change this test class unless you change the related tests to
+ //support any changes that might appear when testing with it
+
+
+ public var sealedInstanceProp1:Boolean;
+
+
+ }
+}
diff --git a/frameworks/projects/Network/src/test/royale/flexUnitTests/network/support/TestClass1.as b/frameworks/projects/Network/src/test/royale/flexUnitTests/network/support/TestClass1.as
new file mode 100644
index 0000000..3ccc02f
--- /dev/null
+++ b/frameworks/projects/Network/src/test/royale/flexUnitTests/network/support/TestClass1.as
@@ -0,0 +1,34 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.support
+{
+ /**
+ * @royalesuppresspublicvarwarning
+ */
+ public class TestClass1
+ {
+ public function TestClass1()
+ {
+ }
+
+ public var testField1:String = '';
+
+
+ }
+}
diff --git a/frameworks/projects/Network/src/test/royale/flexUnitTests/network/support/TestClass2.as b/frameworks/projects/Network/src/test/royale/flexUnitTests/network/support/TestClass2.as
new file mode 100644
index 0000000..e98f23c
--- /dev/null
+++ b/frameworks/projects/Network/src/test/royale/flexUnitTests/network/support/TestClass2.as
@@ -0,0 +1,39 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.support
+{
+
+ /**
+ * @royalesuppresspublicvarwarning
+ */
+ public class TestClass2
+ {
+ //Note: do not change this test class unless you change the related tests to
+ //support any changes that might appear when testing reflection into it
+
+ public function TestClass2()
+ {
+
+ }
+
+
+ public var testField1:Boolean = true;
+
+ }
+}
diff --git a/frameworks/projects/Network/src/test/royale/flexUnitTests/network/support/TestClass3.as b/frameworks/projects/Network/src/test/royale/flexUnitTests/network/support/TestClass3.as
new file mode 100644
index 0000000..a82137c
--- /dev/null
+++ b/frameworks/projects/Network/src/test/royale/flexUnitTests/network/support/TestClass3.as
@@ -0,0 +1,55 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.support
+{
+ import org.apache.royale.utils.net.IExternalizable;
+
+ COMPILE::JS{
+ import org.apache.royale.utils.net.IDataInput;
+ import org.apache.royale.utils.net.IDataOutput;
+ }
+
+ COMPILE::SWF{
+ import flash.utils.IDataInput;
+ import flash.utils.IDataOutput;
+ }
+
+ /**
+ * @royalesuppresspublicvarwarning
+ */
+ public class TestClass3 implements IExternalizable
+ {
+
+ public var content:Array = ["TestClass3"];
+
+
+ public function readExternal(input:IDataInput):void
+ {
+ var content:Array = input.readObject() as Array;
+ this.content = content;
+ }
+
+ public function writeExternal(output:IDataOutput):void
+ {
+ output.writeObject(content);
+ }
+
+ }
+
+}
diff --git a/frameworks/projects/Network/src/test/royale/flexUnitTests/network/support/TestClass4.as b/frameworks/projects/Network/src/test/royale/flexUnitTests/network/support/TestClass4.as
new file mode 100644
index 0000000..c40e523
--- /dev/null
+++ b/frameworks/projects/Network/src/test/royale/flexUnitTests/network/support/TestClass4.as
@@ -0,0 +1,34 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.support
+{
+ /**
+ * @royalesuppresspublicvarwarning
+ */
+ public class TestClass4
+ {
+ public function TestClass4()
+ {
+ }
+
+ public var testField1:Function;
+
+
+ }
+}
diff --git a/frameworks/projects/Reflection/build.xml b/frameworks/projects/Reflection/build.xml
index 968ba53..c8bed17 100644
--- a/frameworks/projects/Reflection/build.xml
+++ b/frameworks/projects/Reflection/build.xml
@@ -33,7 +33,8 @@
</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">
+ <!-- test needs to be run after Basic is built -->
+ <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">
@@ -54,10 +55,25 @@
<available file="${basedir}/src/test/royale/build.xml" />
</not>
</condition>
+ <!-- exclude from js-only build -->
+ <condition property="skip-tests" >
+ <not>
+ <isset property="env.AIR_HOME" />
+ </not>
+ </condition>
</target>
<target name="test" depends="check-for-tests,check-compiler" unless="skip-tests">
- <ant dir="src/test/royale" />
+ <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/Reflection/src/test/royale/FlexUnitRoyaleApplication-config.xml b/frameworks/projects/Reflection/src/test/royale/FlexUnitRoyaleApplication-config.xml
new file mode 100644
index 0000000..b28b644
--- /dev/null
+++ b/frameworks/projects/Reflection/src/test/royale/FlexUnitRoyaleApplication-config.xml
@@ -0,0 +1,108 @@
+<!--
+
+ 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>
+
+ <!--Reflection testing Meta -->
+ <name>TestMeta</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/RoyaleUnit/src/test/royale/FlexUnitRoyaleApplication.mxml b/frameworks/projects/Reflection/src/test/royale/FlexUnitRoyaleApplication.mxml
similarity index 73%
copy from frameworks/projects/RoyaleUnit/src/test/royale/FlexUnitRoyaleApplication.mxml
copy to frameworks/projects/Reflection/src/test/royale/FlexUnitRoyaleApplication.mxml
index d921be9..7b22b19 100644
--- a/frameworks/projects/RoyaleUnit/src/test/royale/FlexUnitRoyaleApplication.mxml
+++ b/frameworks/projects/Reflection/src/test/royale/FlexUnitRoyaleApplication.mxml
@@ -33,16 +33,35 @@ limitations under the License.
import flash.system.fscommand;
}
- import tests.RoyaleUnitSuite;
+ import flexUnitTests.ReflectionTester;
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(RoyaleUnitSuite);
+ core.runClasses(ReflectionTester);
}
private function core_completeHandler(event:Event):void
diff --git a/frameworks/projects/Reflection/src/test/royale/build.xml b/frameworks/projects/Reflection/src/test/royale/build.xml
new file mode 100644
index 0000000..4b1d153
--- /dev/null
+++ b/frameworks/projects/Reflection/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="Network.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="Network-${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/Reflection/src/test/royale/flexUnitTests/ReflectionTester.as b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/ReflectionTester.as
new file mode 100644
index 0000000..63005aa
--- /dev/null
+++ b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/ReflectionTester.as
@@ -0,0 +1,52 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+{
+ import flexUnitTests.reflection.*;
+
+ [Suite]
+ [RunWith("org.apache.royale.test.runners.SuiteRunner")]
+ /**
+ * @royalesuppresspublicvarwarning
+ */
+ public class ReflectionTester
+ {
+ public function ReflectionTester()
+ {
+ // see notes in CoreTester
+ var arr:Array = [
+ ReflectionTesterTest,
+ ReflectionTesterTestUseCache,
+ ReflectionTesterTestAlias,
+ ReflectionTesterTestDynamic,
+ ReflectionTesterNativeTypes
+ ];
+ }
+
+ public var reflectionTesterCacheTest:ReflectionTesterTestUseCache;
+ public var reflectionTesterTest:ReflectionTesterTest;
+
+ public var reflectionTesterAliasTest:ReflectionTesterTestAlias;
+
+
+ public var reflectionTesterDynamicTest:ReflectionTesterTestDynamic;
+
+ public var reflectionTesterNativeTypes:ReflectionTesterNativeTypes;
+ }
+}
diff --git a/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/ReflectionTesterNativeTypes.as b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/ReflectionTesterNativeTypes.as
new file mode 100644
index 0000000..0e80fef
--- /dev/null
+++ b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/ReflectionTesterNativeTypes.as
@@ -0,0 +1,237 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.reflection
+{
+ import org.apache.royale.test.asserts.*;
+ import flexUnitTests.reflection.support.*;
+ import org.apache.royale.reflection.*;
+ //import testshim.RoyaleUnitTestRunner;
+
+ /**
+ * @royalesuppresspublicvarwarning
+ */
+ public class ReflectionTesterNativeTypes
+ {
+
+ public static var isJS:Boolean = COMPILE::JS;;
+
+ [BeforeClass]
+ public static function setUpBeforeClass():void
+ {
+ }
+
+ [AfterClass]
+ public static function tearDownAfterClass():void
+ {
+ }
+
+ [Before]
+ public function setUp():void
+ {
+ ExtraData.addAll();
+ }
+
+ [After]
+ public function tearDown():void
+ {
+ }
+
+ private static function retrieveItemWithName(collection:Array, name:String):DefinitionBase
+ {
+ var ret:DefinitionBase;
+ var i:uint = 0, l:uint = collection.length;
+ for (; i < l; i++)
+ {
+ if (collection[i].name == name)
+ {
+ ret = collection[i];
+ break;
+ }
+ }
+
+ return ret;
+ }
+
+
+ [Test]
+ public function testArrayClass():void
+ {
+ assertEquals( getQualifiedClassName(Array), "Array", "Unexpected type name");
+ assertEquals( getDefinitionByName("Array"), Array, "Unexpected type");
+ var def:TypeDefinition = describeType(Array);
+ assertTrue( def.accessors.length == 1, "unexpected value");
+ assertEquals( def.name, "Array", "Unexpected type name");
+ }
+
+
+ [Test]
+ public function testArrayInstance():void
+ {
+ var inst:Array = [];
+ assertEquals( getQualifiedClassName(inst), "Array", "Unexpected type name");
+
+ var def:TypeDefinition = describeType([]);
+ assertTrue( def.accessors.length == 1, "unexpected value");
+ assertEquals( def.name, "Array", "Unexpected type name");
+
+ }
+
+ [Test]
+ public function testStringClass():void
+ {
+ assertEquals( getQualifiedClassName(String), "String", "Unexpected type name");
+ assertEquals( getDefinitionByName("String"), String, "Unexpected type");
+ var def:TypeDefinition = describeType(String);
+ assertTrue( def.accessors.length == 1, "unexpected value");
+ assertEquals( def.name, "String", "Unexpected type name");
+ }
+
+
+ [Test]
+ public function testStringInstance():void
+ {
+ var inst:String = '';
+ assertEquals( getQualifiedClassName(inst), "String", "Unexpected type name");
+
+ var def:TypeDefinition = describeType(inst);
+ assertTrue( def.accessors.length == 1, "unexpected value");
+ assertEquals( def.name, "String", "Unexpected type name");
+ }
+
+
+ [Test]
+ public function testNumberClass():void
+ {
+ assertEquals( getQualifiedClassName(Number), "Number", "Unexpected type name");
+ assertEquals( getDefinitionByName("Number"), Number, "Unexpected type");
+ var def:TypeDefinition = describeType(Number);
+ //player 11.2 and below has zero static methods in the Number class reflection.
+ //from player 11.3 and above it has 18 (same as javascript)
+ const expectedCount:uint = COMPILE::JS ? 18 : 0;
+ assertEquals( def.staticMethods.length , expectedCount, "unexpected value");
+ assertEquals( def.name, "Number", "Unexpected type name");
+ }
+
+
+ [Test]
+ public function testNumberInstance():void
+ {
+ var inst:Number = 1.5;
+ assertEquals( getQualifiedClassName(inst), "Number", "Unexpected type name");
+
+ var def:TypeDefinition = describeType(inst);
+ //This is resolved as Number
+ assertEquals( def.name, "Number", "Unexpected type name");
+ //player 11.2 and below has zero static methods in the Number class reflection.
+ //from player 11.3 and above it has 18 (same as javascript)
+ const expectedCount:uint = COMPILE::JS ? 18 : 0;
+ assertEquals( def.staticMethods.length , expectedCount, "unexpected value");
+
+ }
+
+ [Test]
+ public function testIntClass():void
+ {
+
+ assertEquals( getQualifiedClassName(int), "int", "Unexpected type name");
+ assertEquals( getDefinitionByName("int"), int, "Unexpected type");
+ var def:TypeDefinition = describeType(int);
+
+ assertEquals( def.name, "int", "Unexpected type name");
+ }
+
+
+ [Test]
+ public function testIntInstance():void
+ {
+ var inst:int = -268435456;
+
+ assertEquals( getQualifiedClassName(inst), "int", "Unexpected type name");
+ inst-=1;
+ //resolves to Number outside boundary:
+ assertEquals( getQualifiedClassName(inst), "Number", "Unexpected type name");
+ inst = 268435455;
+
+ assertEquals( getQualifiedClassName(inst), "int", "Unexpected type name");
+ inst+=1;
+ //resolves to Number outside boundary:
+ assertEquals( getQualifiedClassName(inst), "Number", "Unexpected type name");
+ inst = -268435456;
+
+ var def:TypeDefinition = describeType(inst);
+
+ // RoyaleUnitTestRunner.consoleOut('def name is '+def.name);
+
+ //This is treated as Number
+ assertEquals( def.name, "int", "Unexpected type name");
+
+ }
+
+ [Test]
+ public function testUintClass():void
+ {
+ assertEquals( getQualifiedClassName(uint), "uint", "Unexpected type name");
+ assertEquals( getDefinitionByName("uint"), uint, "Unexpected type");
+
+ var def:TypeDefinition = describeType(uint);
+ assertEquals( def.name, "uint", "Unexpected type name");
+
+ }
+
+
+ [Test]
+ public function testUintInstance():void
+ {
+ var inst:uint = 1;
+ //resolves to Number:
+ assertEquals( getQualifiedClassName(inst), "int", "Unexpected type name");
+
+ var def:TypeDefinition = describeType(inst);
+ //This is treated as Number
+ assertEquals( def.name, "int", "Unexpected type name");
+
+ }
+
+
+ [Test]
+ public function testSpecificVectorClass():void
+ {
+ assertEquals( getQualifiedClassName(Vector.<uint>), "Vector.<uint>", "Unexpected type name");
+ assertEquals( getDefinitionByName("Vector.<uint>"), Vector.<uint>, "Unexpected type");
+ var def:TypeDefinition = describeType(Vector.<uint>);
+ // RoyaleUnitTestRunner.consoleOut(def.toString(true));
+ assertEquals( def.name, "Vector.<uint>", "Unexpected type name");
+
+ }
+
+
+ [Test]
+ public function testSpecificVectorInstance():void
+ {
+ var inst:Vector.<uint> = new Vector.<uint>();
+ //resolves to Number:
+ assertEquals( getQualifiedClassName(inst), "Vector.<uint>", "Unexpected type name");
+
+ var def:TypeDefinition = describeType(inst);
+ assertEquals( def.name, "Vector.<uint>", "Unexpected type name");
+
+ }
+
+ }
+}
diff --git a/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/ReflectionTesterTest.as b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/ReflectionTesterTest.as
new file mode 100644
index 0000000..dc4c4d1
--- /dev/null
+++ b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/ReflectionTesterTest.as
@@ -0,0 +1,376 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.reflection
+{
+ import org.apache.royale.test.asserts.*;
+
+ import flexUnitTests.reflection.support.*;
+
+ import org.apache.royale.reflection.*;
+
+ /**
+ * @royalesuppresspublicvarwarning
+ */
+ public class ReflectionTesterTest
+ {
+
+ public static var isJS:Boolean = COMPILE::JS;
+
+ [BeforeClass]
+ public static function setUpBeforeClass():void
+ {
+
+ }
+
+ [AfterClass]
+ public static function tearDownAfterClass():void
+ {
+ }
+
+ [Before]
+ public function setUp():void
+ {
+ TestClass2.testStaticVar = "testStaticVar_val";
+ TestClass2.testStaticWriteOnly = "staticAccessor_initial_value";
+ }
+
+ [After]
+ public function tearDown():void
+ {
+ }
+
+ private static function retrieveItemWithName(collection:Array, name:String):DefinitionBase
+ {
+ var ret:DefinitionBase;
+ var i:uint = 0, l:uint = collection.length;
+ for (; i < l; i++)
+ {
+ if (collection[i].name == name)
+ {
+ ret = collection[i];
+ break;
+ }
+ }
+
+ return ret;
+ }
+
+
+ [Test]
+ public function testBasicDescribeTypeClass():void
+ {
+ var def:TypeDefinition = describeType(TestClass2);
+
+ assertEquals( def.packageName, "flexUnitTests.reflection.support", "Unexpected package name");
+ assertEquals( def.name, "TestClass2", "Unexpected type name");
+
+ var variables:Array = def.variables;
+ assertEquals( 1, variables.length, "unexpected variables length");
+
+
+ var methods:Array = def.methods;
+ assertEquals( 2, methods.length, "unexpected methods length");
+
+ var accessors:Array = def.accessors;
+ assertEquals( 3, accessors.length, "unexpected accessors length");
+
+ var constructor:MethodDefinition = def.constructorMethod;
+ assertEquals( constructor.declaredBy.qualifiedName,
+ "flexUnitTests.reflection.support.TestClass2", "unexpected constructor declaredBy");
+
+ assertEquals(
+ 1,
+ constructor.parameters.length, "unexpected constructor params");
+
+ var meta:Array = def.retrieveMetaDataByName("TestMeta");
+ assertEquals(
+ 1,
+ meta.length, "unexpected class specific meta length");
+
+
+ def = describeType(TestClass4);
+ assertEquals( def.packageName, "flexUnitTests.reflection.support", "Unexpected package name");
+ assertEquals( def.name, "TestClass4", "Unexpected type name");
+
+ variables = def.variables;
+ assertEquals( 2, variables.length, "unexpected variables length");
+
+
+ methods = def.methods;
+ assertEquals( 4, methods.length, "unexpected methods length");
+
+ accessors = def.accessors;
+ assertEquals( 6, accessors.length, "unexpected accessors length");
+
+ constructor = def.constructorMethod;
+ assertEquals(
+ "flexUnitTests.reflection.support.TestClass4",
+ constructor.declaredBy.qualifiedName, "unexpected constructor declaredBy");
+
+ assertEquals(
+ 0,
+ constructor.parameters.length, "unexpected constructor params");
+
+
+ }
+
+
+ [TestVariance(variance="JS", description="Variance in test due to current inability for js target to reflect into non-Royale base classes or typedefs")]
+ [Test]
+ public function testDescribeTypeClass():void
+ {
+ var def:TypeDefinition = describeType(TestClass1);
+ var expected:*;
+ assertEquals( "flexUnitTests.reflection.support", def.packageName, "Unexpected package name");
+ assertEquals( def.name, "TestClass1", "Unexpected type name");
+
+ var variables:Array = def.variables;
+ assertEquals( 3, variables.length, "unexpected instance variables length");
+
+ //there is a difference based on the EventDispatcher inheritance chain differences between js and swf:
+ expected = isJS ? 4 : 7;
+ var methods:Array = def.methods;
+ assertEquals( expected, methods.length, "unexpected instance methods length");
+
+ var accessors:Array = def.accessors;
+ assertEquals( 4, accessors.length, "unexpected instance accessors length");
+
+ var staticVariables:Array = def.staticVariables;
+ assertEquals( 2, staticVariables.length, "unexpected static variables length");
+
+ var staticMethods:Array = def.staticMethods;
+ assertEquals( 1, staticMethods.length, "unexpected static methods length");
+ //there is a difference based on the native inheritance of readonly 'prototype' not collected from 'Class' (or Object for js):
+ expected = isJS ? 3 : 4;
+ var staticAccessors:Array = def.staticAccessors;
+ assertEquals( expected, staticAccessors.length, "unexpected static accessors length");
+
+
+ }
+
+ [TestVariance(variance="JS", description="Variance in test due to current inability for js target to reflect into non-Royale base classes or typedefs")]
+ [Test]
+ public function testDescribeTypeInstance():void
+ {
+ var def:TypeDefinition = describeType(new TestClass1());
+ var expected:*;
+ assertEquals( "flexUnitTests.reflection.support", def.packageName, "Unexpected package name");
+ assertEquals( def.name, "TestClass1", "Unexpected type name");
+
+ var variables:Array = def.variables;
+ assertEquals( 3, variables.length, "unexpected instance variables length");
+
+ //there is a difference based on the EventDispatcher inheritance chain differences between js and swf:
+ expected = isJS ? 4 : 7;
+ var methods:Array = def.methods;
+ assertEquals( expected, methods.length, "unexpected instance methods length");
+
+ var accessors:Array = def.accessors;
+ assertEquals( 4, accessors.length, "unexpected instance accessors length");
+
+ var staticVariables:Array = def.staticVariables;
+ assertEquals( 2, staticVariables.length, "unexpected static variables length");
+
+ var staticMethods:Array = def.staticMethods;
+ assertEquals( 1, staticMethods.length, "unexpected static methods length");
+ //there is a difference based on the native inheritance of readonly 'prototype' not collected from 'Class' (or Object for js):
+ expected = isJS ? 3 : 4;
+ var staticAccessors:Array = def.staticAccessors;
+ assertEquals( expected, staticAccessors.length, "unexpected static accessors length");
+
+
+ }
+
+ [TestVariance(variance="JS", description="Variance in baseClasses due to current inability for js target to reflect into non-Royale base classes or typedefs")]
+ [Test]
+ public function testBaseClasses():void
+ {
+ var def:TypeDefinition = describeType(TestClass1);
+
+ var baseClasses:Array = def.baseClasses;
+ var expected:uint = isJS ? 1 : 3;
+ assertEquals( expected, baseClasses.length, "unexpected baseclasses length");
+ }
+
+
+ [Test]
+ public function testMemberAccess():void
+ {
+ //all of these should succeed without error
+ var inst:TestClass2 = new TestClass2("");
+ var def:TypeDefinition = describeType(inst);
+
+ /** instance variables **/
+
+ var variables:Array = def.variables;
+ var variable:VariableDefinition = variables[0];
+ assertEquals( "testVar", variable.name, "unexpected variable name");
+ var meta:MetaDataDefinition = variable.retrieveMetaDataByName("TestMeta")[0];
+ assertEquals( "TestMeta", meta.name, "unexpected meta name");
+
+ var metaArg:MetaDataArgDefinition = meta.getArgsByKey("foo")[0];
+ assertEquals( "foo", metaArg.name, "unexpected meta arg name");
+ assertEquals( "instanceVariable", metaArg.value, "unexpected meta arg value");
+
+ // assertEquals("testVar_val",inst[variable.name], "unexpected reflection initial variable value");
+ assertEquals( "testVar_val", variable.getValue(inst), "unexpected reflection initial variable value");
+ variable.setValue(inst, "testVar_val_reflection_set");
+ assertEquals( "testVar_val_reflection_set", variable.getValue(inst), "unexpected reflection initial variable value");
+ inst.testVar = "testVar_val";
+
+ var accessors:Array = def.accessors;
+ var testReadOnly:AccessorDefinition = retrieveItemWithName(accessors, "testReadOnly") as AccessorDefinition;
+ meta = testReadOnly.retrieveMetaDataByName("TestMeta")[0];
+ assertEquals( "TestMeta", meta.name, "unexpected meta name");
+
+ metaArg = meta.getArgsByKey("foo")[0];
+ assertEquals( "foo", metaArg.name, "unexpected meta arg name");
+ assertEquals( "instanceAccessor", metaArg.value, "unexpected meta arg value");
+
+ /** instance accessors **/
+ var testWriteOnly:AccessorDefinition = retrieveItemWithName(accessors, "testWriteOnly") as AccessorDefinition;
+ var testReadWrite:AccessorDefinition = retrieveItemWithName(accessors, "testReadWrite") as AccessorDefinition;
+ assertNotNull(testReadOnly);
+ assertNotNull(testWriteOnly);
+ assertNotNull(testReadWrite);
+
+ assertEquals( "instanceAccessor_initial_value", inst[testReadOnly.name], "unexpected accessor initial value");
+ assertEquals( "instanceAccessor_initial_value", inst[testReadWrite.name], "unexpected accessor initial value");
+
+ inst[testWriteOnly.name] = "test";
+ assertEquals( "test", inst[testReadOnly.name], "unexpected accessor initial value");
+ assertEquals( "test", inst[testReadWrite.name], "unexpected accessor initial value");
+
+ inst[testReadWrite.name] = "test2";
+ assertEquals( "test2", inst[testReadOnly.name], "unexpected accessor initial value");
+ assertEquals( "test2", inst[testReadWrite.name], "unexpected accessor initial value");
+
+ /** instance methods **/
+ var methods:Array = def.methods;
+ var testMethod:MethodDefinition = retrieveItemWithName(methods, "testMethod") as MethodDefinition;
+ meta = testMethod.retrieveMetaDataByName("TestMeta")[0];
+ assertEquals( "TestMeta", meta.name, "unexpected meta name");
+
+ metaArg = meta.getArgsByKey("foo")[0];
+ assertEquals( "foo", metaArg.name, "unexpected meta arg name");
+ assertEquals( "instanceMethod", metaArg.value, "unexpected meta arg value");
+ assertEquals( 0, testMethod.parameters.length, "unexpected parameter count");
+ inst[testMethod.name]();
+ assertEquals( "testMethod was called", inst[testReadWrite.name], "unexpected method invocation result");
+
+ var testMethodWithArgs:MethodDefinition = retrieveItemWithName(methods, "testMethodWithArgs") as MethodDefinition;
+ assertEquals( 2, testMethodWithArgs.parameters.length, "unexpected parameter count");
+ assertTrue( inst[testMethodWithArgs.name]("test"), "unexpected method invocation result");
+ assertFalse( inst[testMethodWithArgs.name]("test", false), "unexpected method invocation result");
+ assertEquals( "testMethodWithArgs was called", inst[testReadWrite.name], "unexpected method invocation result");
+
+
+ /** static vars **/
+ variables = def.staticVariables;
+
+
+ variable = variables[0];
+ assertEquals( "testStaticVar", variable.name, "unexpected variable name");
+ meta = variable.retrieveMetaDataByName("TestMeta")[0];
+ assertEquals( "TestMeta", meta.name, "unexpected meta name");
+
+ metaArg = meta.getArgsByKey("foo")[0];
+ assertEquals( "foo", metaArg.name, "unexpected meta arg name");
+ assertEquals( "staticVariable", metaArg.value, "unexpected meta arg value");
+
+ // assertEquals("testStaticVar_val",TestClass2[variable.name], "unexpected reflection initial variable value");
+ assertEquals( "testStaticVar_val", variable.getValue(), "unexpected reflection initial variable value");
+ variable.setValue("testStaticVar_val_reflection_set");
+ assertEquals( "testStaticVar_val_reflection_set", variable.getValue(), "unexpected reflection initial variable value");
+ TestClass2.testStaticVar = "testStaticVar_val";
+
+
+ /** static accessors **/
+
+ accessors = def.staticAccessors;
+
+
+ testReadOnly = retrieveItemWithName(accessors, "testStaticReadOnly") as AccessorDefinition;
+ meta = testReadOnly.retrieveMetaDataByName("TestMeta")[0];
+ assertEquals( "TestMeta", meta.name, "unexpected meta name");
+
+ metaArg = meta.getArgsByKey("foo")[0];
+ assertEquals( "foo", metaArg.name, "unexpected meta arg name");
+ assertEquals( "staticAccessor", metaArg.value, "unexpected meta arg value");
+
+
+ testWriteOnly = retrieveItemWithName(accessors, "testStaticWriteOnly") as AccessorDefinition;
+ testReadWrite = retrieveItemWithName(accessors, "testStaticReadWrite") as AccessorDefinition;
+ assertNotNull(testReadOnly);
+ assertNotNull(testWriteOnly);
+ assertNotNull(testReadWrite);
+
+ assertEquals( "staticAccessor_initial_value", TestClass2[testReadOnly.name], "unexpected accessor initial value");
+ assertEquals( "staticAccessor_initial_value", TestClass2[testReadWrite.name], "unexpected accessor initial value");
+
+ TestClass2[testWriteOnly.name] = "test";
+ assertEquals( "test", TestClass2[testReadOnly.name], "unexpected accessor initial value");
+ assertEquals( "test", TestClass2[testReadWrite.name], "unexpected accessor initial value");
+
+ TestClass2[testReadWrite.name] = "test2";
+ assertEquals( "test2", TestClass2[testReadOnly.name], "unexpected accessor initial value");
+ assertEquals( "test2", TestClass2[testReadWrite.name], "unexpected accessor initial value");
+
+
+ /** static methods **/
+ methods = def.staticMethods;
+ testMethod = retrieveItemWithName(methods, "testStaticMethod") as MethodDefinition;
+ meta = testMethod.retrieveMetaDataByName("TestMeta")[0];
+ assertEquals( "TestMeta", meta.name, "unexpected meta name");
+
+ metaArg = meta.getArgsByKey("foo")[0];
+ assertEquals( "foo", metaArg.name, "unexpected meta arg name");
+ assertEquals( "staticMethod", metaArg.value, "unexpected meta arg value");
+ assertEquals( 0, testMethod.parameters.length, "unexpected parameter count");
+ TestClass2[testMethod.name]();
+ assertEquals( "testStaticMethod was called", TestClass2[testReadWrite.name], "unexpected method invocation result");
+
+ testMethodWithArgs = retrieveItemWithName(methods, "testStaticMethodWithArgs") as MethodDefinition;
+ assertEquals( 2, testMethodWithArgs.parameters.length, "unexpected parameter count");
+ assertTrue( TestClass2[testMethodWithArgs.name]("test"), "unexpected method invocation result");
+ assertFalse( TestClass2[testMethodWithArgs.name]("test", false), "unexpected method invocation result");
+ assertEquals( "testStaticMethodWithArgs was called", TestClass2[testReadWrite.name], "unexpected method invocation result");
+
+ }
+
+
+ [Test]
+ public function testInterfaceReflection():void
+ {
+ var def:TypeDefinition = describeType(ITestInterface4);
+ assertEquals( "interface", def.kind, "unexpected kind value");
+ assertEquals( 3, def.interfaces.length, "unexpected interfaces length");
+ assertEquals( 1, def.accessors.length, "unexpected accessors length");
+ assertEquals( 1, def.methods.length, "unexpected methods length");
+
+ assertEquals( 0, def.variables.length, "unexpected variables length");
+ assertEquals( 0, def.staticVariables.length, "unexpected staticVariables length");
+ assertEquals( 0, def.staticMethods.length, "unexpected variables length");
+ assertEquals( 0, def.staticAccessors.length, "unexpected staticVariables length");
+ assertNull( def.constructorMethod, "unexpected constructor Method definition");
+ }
+
+
+ }
+}
diff --git a/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/ReflectionTesterTestAlias.as b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/ReflectionTesterTestAlias.as
new file mode 100644
index 0000000..57aeb95
--- /dev/null
+++ b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/ReflectionTesterTestAlias.as
@@ -0,0 +1,81 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.reflection
+{
+ import org.apache.royale.test.asserts.*;
+
+ import flexUnitTests.reflection.support.*;
+
+ import org.apache.royale.reflection.*;
+
+ /**
+ * @royalesuppresspublicvarwarning
+ */
+ public class ReflectionTesterTestAlias
+ {
+
+ public static var isJS:Boolean = COMPILE::JS;
+
+ [BeforeClass]
+ public static function setUpBeforeClass():void
+ {
+ }
+
+ [AfterClass]
+ public static function tearDownAfterClass():void
+ {
+ }
+
+ [Before]
+ public function setUp():void
+ {
+
+ }
+
+ [After]
+ public function tearDown():void
+ {
+
+ }
+
+
+ [Test]
+ public function testBasicAlias():void
+ {
+ //no initial alias
+ assertNull(getAliasByClass(TestClass2));
+ registerClassAlias("fjsTest", TestClass2);
+ //alias is registered
+ assertEquals( "fjsTest", getAliasByClass(TestClass2), "unexpected Alias value");
+ //register same alias for another class
+ registerClassAlias("fjsTest", TestClass3);
+ //original alias mapping is deregistered
+ assertNull(getAliasByClass(TestClass2));
+ //alias is registered for new class
+ assertEquals( "fjsTest", getAliasByClass(TestClass3), "unexpected Alias value");
+
+ //class is retrievable by alias
+ assertEquals( TestClass3, getClassByAlias("fjsTest"), "unexpected Class value");
+
+
+ }
+
+
+ }
+}
diff --git a/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/ReflectionTesterTestDynamic.as b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/ReflectionTesterTestDynamic.as
new file mode 100644
index 0000000..730ef71
--- /dev/null
+++ b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/ReflectionTesterTestDynamic.as
@@ -0,0 +1,218 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.reflection
+{
+ import org.apache.royale.test.asserts.*;
+
+ import flexUnitTests.reflection.support.*;
+
+ import org.apache.royale.reflection.*;
+
+ /**
+ * @royalesuppresspublicvarwarning
+ */
+ public class ReflectionTesterTestDynamic
+ {
+
+ public static var isJS:Boolean = COMPILE::JS;
+
+ [BeforeClass]
+ public static function setUpBeforeClass():void
+ {
+ }
+
+ [AfterClass]
+ public static function tearDownAfterClass():void
+ {
+ }
+
+ [Before]
+ public function setUp():void
+ {
+
+ }
+
+ [After]
+ public function tearDown():void
+ {
+
+ }
+
+ private static function contentStringsMatch(arr1:Array, arr2:Array):Boolean
+ {
+ if (arr1 == arr2) return true;
+ if (!arr1 || !arr2) return false;
+ if (arr1.length != arr2.length) return false;
+ const arr1Copy:Array = arr1.concat();
+ var l:uint = arr1Copy.length;
+ while (l--)
+ {
+ var s:String = arr1Copy.shift();
+ if (arr2.indexOf(s) == -1) return false
+ }
+ return true;
+ }
+
+
+ [Test]
+ public function testisDynamic():void
+ {
+ //class
+
+ assertTrue( isDynamicObject(Object), "class should be dynamic");
+
+ assertTrue( isDynamicObject(TestClass1), "class should be dynamic");
+ //interface is dynamic (even if it doesn't make much sense)
+ assertTrue( isDynamicObject(ITestInterface), "interface should be dynamic");
+ //instance
+ assertTrue( isDynamicObject({}), "generic object should be dynamic");
+
+ assertFalse( isDynamicObject(new TestClass1()), "sealed class instance should not be dynamic");
+
+ assertTrue( isDynamicObject(new DynamicTestClass()), "dynamic class instance should be dynamic");
+
+
+ assertFalse( isDynamicObject("String"), "String instance should not be dynamic");
+ assertFalse( isDynamicObject(99), "int instance should not be dynamic");
+ assertFalse( isDynamicObject(99.99), "Number instance should not be dynamic");
+ assertFalse( isDynamicObject(true), "Boolean instance should not be dynamic");
+
+
+ assertTrue( isDynamicObject(function ():void
+ {
+ }), "function instance should be dynamic");
+ assertTrue( isDynamicObject([]), "Array instance should be dynamic");
+ }
+
+
+ [TestVariance(variance="JS", description="Variance in test due to reliance on 'js-default-initializers=true' throughout entire inheritance chain for 'getDynamicFields' function")]
+ [Test]
+ public function testGetDynamicFields():void
+ {
+
+ const emptyArray:Array = [];
+ const singleDynField:Array = ['test'];
+ assertTrue( contentStringsMatch(getDynamicFields(Object), emptyArray), "dynamic fields should match reference list");
+ Object['test'] = true;
+ assertTrue( contentStringsMatch(getDynamicFields(Object), singleDynField), "dynamic fields should match reference list");
+ delete Object['test'];
+
+ assertTrue( contentStringsMatch(getDynamicFields(TestClass1), emptyArray), "dynamic fields should match reference list");
+ TestClass1['test'] = true;
+ assertTrue( contentStringsMatch(getDynamicFields(TestClass1), singleDynField), "dynamic fields should match reference list");
+ delete TestClass1['test'];
+
+ //interface is dynamic (even if it doesn't make much sense)
+ assertTrue( contentStringsMatch(getDynamicFields(ITestInterface), emptyArray), "dynamic fields should match reference list");
+ ITestInterface['test'] = true;
+ assertTrue( contentStringsMatch(getDynamicFields(ITestInterface), singleDynField), "dynamic fields should match reference list");
+ delete ITestInterface['test'];
+
+ //instance
+ assertTrue( contentStringsMatch(getDynamicFields({}), emptyArray), "dynamic fields should match reference list");
+ assertTrue( contentStringsMatch(getDynamicFields({test: true}), singleDynField), "dynamic fields should match reference list");
+
+ assertTrue( contentStringsMatch(getDynamicFields(new TestClass1()), emptyArray), "dynamic fields should match reference list");
+
+ const dynInstance:DynamicTestClass = new DynamicTestClass();
+ dynInstance.test = true;
+ assertTrue( contentStringsMatch(getDynamicFields(dynInstance), singleDynField), "dynamic fields should match reference list");
+
+
+ assertTrue( contentStringsMatch(getDynamicFields("String"), emptyArray), "dynamic fields should match reference list");
+ assertTrue( contentStringsMatch(getDynamicFields(99), emptyArray), "dynamic fields should match reference list");
+ assertTrue( contentStringsMatch(getDynamicFields(99.99), emptyArray), "dynamic fields should match reference list");
+ assertTrue( contentStringsMatch(getDynamicFields(true), emptyArray), "dynamic fields should match reference list");
+
+ assertTrue( contentStringsMatch(getDynamicFields(function ():void
+ {
+ }), emptyArray), "dynamic fields should match reference list");
+
+ const numericFields:Array = ["0", "1", "2", "3"];
+ var arr:Array = [1, 2, 3, 4];
+ assertTrue( contentStringsMatch(getDynamicFields(arr), numericFields), "dynamic fields should match reference list");
+ numericFields.push('test');
+ arr['test'] = true;
+ assertTrue( contentStringsMatch(getDynamicFields(arr), numericFields), "dynamic fields should match reference list");
+
+
+ var testclass2:DynamicTestClass2 = new DynamicTestClass2();
+ testclass2.test = true;
+ testclass2.something = '*something*';
+ assertTrue( contentStringsMatch(getDynamicFields(testclass2), singleDynField), "dynamic fields should match reference list");
+
+
+ testclass2.test = 'test';
+ testclass2.something = '*something else*';
+
+ assertTrue( contentStringsMatch(getDynamicFields(testclass2), singleDynField), "dynamic fields should match reference list");
+ var testClass3:DynamicTestClass3 = new DynamicTestClass3();
+ var swapAssertion:Boolean;
+ COMPILE::JS{
+ var check:Boolean = new CompilationData(testClass3).hasSameAncestry(CompilationData.WITH_DEFAULT_INITIALIZERS);
+ if (!check)
+ {
+ //variance... due framework ancestry having different compilation settings
+ swapAssertion = true;
+ }
+ }
+
+ if (!swapAssertion)
+ {
+ assertTrue( contentStringsMatch(getDynamicFields(testClass3), emptyArray), "dynamic fields should match reference list");
+ } else
+ {
+ assertFalse( contentStringsMatch(getDynamicFields(testClass3), emptyArray), "dynamic fields should match reference list");
+ trace('[WARN] Variance: a test is technically wrong in javascript, but is expected to be wrong, because the compilation settings do not support it throughout the inheritance chain');
+ }
+ testClass3.test = 'true';
+ testClass3.x = 10;
+ testClass3.className = 'hello';
+
+
+ if (!swapAssertion)
+ {
+ assertTrue( contentStringsMatch(getDynamicFields(testClass3), singleDynField), "dynamic fields should match reference list");
+ } else
+ {
+ assertFalse( contentStringsMatch(getDynamicFields(testClass3), singleDynField), "dynamic fields should not match reference list");
+ trace('[WARN] Variance: a test is technically wrong in javascript, but is expected to be wrong, because the compilation settings do not support it throughout the inheritance chain');
+ }
+
+ }
+
+ [Test]
+ public function testGetDynamicFieldsWithPredicate():void
+ {
+ const test:Object = {
+ 'test1': true,
+ 'test2': true,
+ '_underscore': true
+ };
+ const withoutUnderscores:Array = ['test1', 'test2'];
+ var excludeUnderscores:Function = function (prop:String):Boolean
+ {
+ return prop && prop.charAt(0) != '_';
+ };
+ assertTrue( contentStringsMatch(getDynamicFields(test, excludeUnderscores), withoutUnderscores), "dynamic fields should match reference list");
+
+ }
+
+ }
+}
diff --git a/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/ReflectionTesterTestUseCache.as b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/ReflectionTesterTestUseCache.as
new file mode 100644
index 0000000..547325d
--- /dev/null
+++ b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/ReflectionTesterTestUseCache.as
@@ -0,0 +1,89 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.reflection
+{
+ import org.apache.royale.test.asserts.*;
+
+ import flexUnitTests.reflection.support.*;
+
+ import org.apache.royale.reflection.*;
+
+ /**
+ * @royalesuppresspublicvarwarning
+ */
+ public class ReflectionTesterTestUseCache
+ {
+
+ public static var isJS:Boolean = COMPILE::JS;
+
+ [BeforeClass]
+ public static function setUpBeforeClass():void
+ {
+ }
+
+ [AfterClass]
+ public static function tearDownAfterClass():void
+ {
+ }
+
+ [Before]
+ public function setUp():void
+ {
+ TypeDefinition.useCache = true;
+ TestClass2.testStaticVar = "testStaticVar_val";
+ TestClass2.testStaticWriteOnly = "staticAccessor_initial_value";
+ }
+
+ [After]
+ public function tearDown():void
+ {
+ TypeDefinition.useCache = false;
+ }
+
+ private static function retrieveItemWithName(collection:Array, name:String):DefinitionBase
+ {
+ var ret:DefinitionBase;
+ var i:uint = 0, l:uint = collection.length;
+ for (; i < l; i++)
+ {
+ if (collection[i].name == name)
+ {
+ ret = collection[i];
+ break;
+ }
+ }
+
+ return ret;
+ }
+
+
+ [Test]
+ public function testBasicCache():void
+ {
+ var def:TypeDefinition = describeType(TestClass2);
+
+ var def2:TypeDefinition = describeType(TestClass2);
+
+ assertEquals( def, def2, "cache not working");
+
+ }
+
+
+ }
+}
diff --git a/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/support/DynamicTestClass.as b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/support/DynamicTestClass.as
new file mode 100644
index 0000000..92b5c34
--- /dev/null
+++ b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/support/DynamicTestClass.as
@@ -0,0 +1,99 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.reflection.support
+{
+
+
+ /**
+ * @royalesuppresspublicvarwarning
+ */
+ dynamic public class DynamicTestClass
+ {
+ //Note: do not change this test class unless you change the related tests to
+ //support any changes that might appear when testing reflection into it
+
+ /*public function DynamicTestClass(){
+
+ }*/
+
+
+ [TestMeta(foo="instanceMethod")]
+ public function method():void
+ {
+
+ }
+
+ [TestMeta(foo="instanceMethod")]
+ public function methodWithArgs(mandatory:String, optional:Boolean = true):void
+ {
+ _test = mandatory;
+ }
+
+ [TestMeta(foo="instanceVariable")]
+ public var testVar:String;
+
+ [TestMeta(foo="instanceAccessor")]
+ public function get testGetter():String
+ {
+ return null
+ }
+
+ [TestMeta(foo="instanceAccessor")]
+ public function set testSetter(value:String):void
+ {
+
+ }
+
+ private var _test:String;
+
+ [TestMeta(foo="staticMethod")]
+ public static function method():void
+ {
+ }
+
+ [TestMeta(foo="staticMethod")]
+ public static function methodWithArgs(mandatory:String, optional:Boolean = true):void
+ {
+ }
+
+ [TestMeta(foo="staticVariable")]
+ public static var testVar:String;
+
+ [TestMeta(foo="staticAccessor")]
+ public static function get testGetter():String
+ {
+ return null
+ }
+
+ [TestMeta(foo="staticAccessor")]
+ public static function set testSetter(value:String):void
+ {
+
+ }
+
+ private var private_var:Boolean;
+
+ protected var protected_var:Boolean;
+
+ private static var private_var:Boolean;
+
+ protected static var protected_var:Boolean;
+
+ }
+}
diff --git a/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/support/DynamicTestClass2.as b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/support/DynamicTestClass2.as
new file mode 100644
index 0000000..75f7a50
--- /dev/null
+++ b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/support/DynamicTestClass2.as
@@ -0,0 +1,65 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.reflection.support
+{
+
+
+ /**
+ * @royalesuppresspublicvarwarning
+ */
+ dynamic public class DynamicTestClass2 extends TestClass1
+ {
+ //Note: do not change this test class unless you change the related tests to
+ //support any changes that might appear when testing reflection into it
+
+ public function DynamicTestClass2()
+ {
+ //his.constructorDynTest = 'constructorDynTest';
+ }
+
+ public var something:String;
+
+ [TestMeta(foo="staticMethod")]
+ public static function method():void
+ {
+ }
+
+ [TestMeta(foo="staticMethod")]
+ public static function methodWithArgs(mandatory:String, optional:Boolean = true):void
+ {
+ }
+
+ [TestMeta(foo="staticVariable")]
+ public static var testVar:String;
+
+ [TestMeta(foo="staticAccessor")]
+ public static function get testGetter():String
+ {
+ return null
+ }
+
+ [TestMeta(foo="staticAccessor")]
+ public static function set testSetter(value:String):void
+ {
+
+ }
+
+
+ }
+}
diff --git a/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/support/DynamicTestClass3.as b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/support/DynamicTestClass3.as
new file mode 100644
index 0000000..4e86b91
--- /dev/null
+++ b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/support/DynamicTestClass3.as
@@ -0,0 +1,37 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.reflection.support
+{
+
+ import org.apache.royale.core.UIBase;
+
+ dynamic public class DynamicTestClass3 extends UIBase
+ {
+ //Note: do not change this test class unless you change the related tests to
+ //support any changes that might appear when testing reflection into it
+
+ public function DynamicTestClass3()
+ {
+
+
+ }
+
+
+ }
+}
diff --git a/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/support/ITestInterface.as b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/support/ITestInterface.as
new file mode 100644
index 0000000..05b66c7
--- /dev/null
+++ b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/support/ITestInterface.as
@@ -0,0 +1,27 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.reflection.support
+{
+
+ public interface ITestInterface
+ {
+ function someMethod(compulsoryArg:int, optArg:String = null):TestClass1;
+
+ }
+}
diff --git a/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/support/ITestInterface2.as b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/support/ITestInterface2.as
new file mode 100644
index 0000000..a9e979e
--- /dev/null
+++ b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/support/ITestInterface2.as
@@ -0,0 +1,29 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.reflection.support
+{
+
+ public interface ITestInterface2 extends ITestInterface
+ {
+ function someMethod2(compulsoryArg:int, optArg:String = null):TestClass1;
+
+ function get someValue2():Boolean;
+
+ }
+}
diff --git a/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/support/ITestInterface3.as b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/support/ITestInterface3.as
new file mode 100644
index 0000000..51f9ca4
--- /dev/null
+++ b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/support/ITestInterface3.as
@@ -0,0 +1,27 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.reflection.support
+{
+
+ public interface ITestInterface3
+ {
+ //empty
+
+ }
+}
diff --git a/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/support/ITestInterface4.as b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/support/ITestInterface4.as
new file mode 100644
index 0000000..cd0a956
--- /dev/null
+++ b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/support/ITestInterface4.as
@@ -0,0 +1,29 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.reflection.support
+{
+
+ public interface ITestInterface4 extends ITestInterface2, ITestInterface3
+ {
+ function someMethod3(compulsoryArg:int, optArg:String = null):TestClass1;
+
+ function get someValue3():Boolean;
+
+ }
+}
diff --git a/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/support/TestClass1.as b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/support/TestClass1.as
new file mode 100644
index 0000000..91b9f35
--- /dev/null
+++ b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/support/TestClass1.as
@@ -0,0 +1,103 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.reflection.support
+{
+
+ import org.apache.royale.reflection.TypeDefinition;
+
+ [RemoteClass(alias="TestClass1_alias")]
+ /**
+ * @royalesuppresspublicvarwarning
+ */
+ public class TestClass1 implements ITestInterface
+ {
+ public function TestClass1()
+ {
+ // var something:ITestInterface2;
+ }
+
+ [Bindable]
+ [Event(name="foo", type="org.apache.royale.events.Event")]
+ public var bindableVar:String;
+
+ [Event(name="foo", type="org.apache.royale.events.Event")]
+ public var temp:Boolean;
+
+ public static var tempStatic:Boolean;
+
+ public var typeDef:TypeDefinition;
+
+ public var testVar:String = "testVar_val";
+
+ public static var staticTestVar:String = "statictestVar_val";
+
+ private var _atestval:String = "accessorTest_val";
+
+ public function get accessorTest():String
+ {
+ return _atestval;
+ }
+
+ public function set accessorTest(val:String):void
+ {
+ _atestval = val;
+ }
+
+ private static var _staticAtestval:String = "staticAccessorTest_val";
+
+ public static function get staticAccessorTest():String
+ {
+ return _staticAtestval;
+ }
+
+ public static function set staticAccessorTest(val:String):void
+ {
+ _staticAtestval = val;
+ }
+
+ [Bindable]
+ public static var bindableStaticVar:String;
+
+ [Bindable]
+ public var bindableInstanceVar:String;
+
+
+ public function someMethod(compulsoryArg:int, optArg:String = null):TestClass1
+ {
+ return null;
+ }
+
+ public static function someStaticMethod(compulsoryArg:int, optArg:String = null):TestClass1
+ {
+ return null;
+ }
+
+ public function get testAccessorType():TypeDefinition
+ {
+ return null;
+ }
+
+ public const instanceConstant:String = "instanceConstant_val";
+
+
+ public static const staticConstant:String = "staticConstant_val";
+
+
+ }
+}
diff --git a/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/support/TestClass2.as b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/support/TestClass2.as
new file mode 100644
index 0000000..375c95f
--- /dev/null
+++ b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/support/TestClass2.as
@@ -0,0 +1,120 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.reflection.support
+{
+
+
+ [TestMeta(foo="class")]
+ /**
+ * @royalesuppresspublicvarwarning
+ */
+ public class TestClass2
+ {
+ //Note: do not change this test class unless you change the related tests to
+ //support any changes that might appear when testing reflection into it
+
+ public function TestClass2(blah:String)
+ {
+
+ }
+
+
+ [TestMeta(foo="instanceMethod")]
+ public function testMethod():void
+ {
+ _testReadWrite = "testMethod was called";
+ }
+
+ [TestMeta(foo="instanceMethod")]
+ public function testMethodWithArgs(mandatory:String, optional:Boolean = true):Boolean
+ {
+ _testReadWrite = "testMethodWithArgs was called";
+ return optional;
+ }
+
+ [TestMeta(foo="instanceVariable")]
+ public var testVar:String = "testVar_val";
+
+ [TestMeta(foo="instanceAccessor")]
+ public function get testReadOnly():String
+ {
+ return _testReadWrite
+ }
+
+ [TestMeta(foo="instanceAccessor")]
+ public function set testWriteOnly(value:String):void
+ {
+ _testReadWrite = value;
+ }
+
+ [TestMeta(foo="instanceAccessor")]
+ public function get testReadWrite():String
+ {
+ return _testReadWrite
+ }
+
+ public function set testReadWrite(value:String):void
+ {
+ _testReadWrite = value;
+ }
+
+ [TestMeta(foo="staticMethod")]
+ public static function testStaticMethod():void
+ {
+ _testStaticReadWrite = "testStaticMethod was called";
+ }
+
+ [TestMeta(foo="staticMethod")]
+ public static function testStaticMethodWithArgs(mandatory:String, optional:Boolean = true):Boolean
+ {
+ _testStaticReadWrite = "testStaticMethodWithArgs was called";
+ return optional;
+ }
+
+ [TestMeta(foo="staticVariable")]
+ public static var testStaticVar:String = "testStaticVar_val";
+
+ [TestMeta(foo="staticAccessor")]
+ public static function get testStaticReadOnly():String
+ {
+ return _testStaticReadWrite
+ }
+
+ [TestMeta(foo="staticAccessor")]
+ public static function set testStaticWriteOnly(value:String):void
+ {
+ _testStaticReadWrite = value;
+ }
+
+ [TestMeta(foo="staticAccessor")]
+ public static function get testStaticReadWrite():String
+ {
+ return _testStaticReadWrite;
+ }
+
+ public static function set testStaticReadWrite(value:String):void
+ {
+ _testStaticReadWrite = value;
+ }
+
+
+ private static var _testStaticReadWrite:String = "staticAccessor_initial_value";
+ private var _testReadWrite:String = "instanceAccessor_initial_value";
+ }
+}
diff --git a/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/support/TestClass3.as b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/support/TestClass3.as
new file mode 100644
index 0000000..6a7d9b1
--- /dev/null
+++ b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/support/TestClass3.as
@@ -0,0 +1,42 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.reflection.support
+{
+
+
+ /**
+ * @royalesuppresspublicvarwarning
+ */
+ public class TestClass3 extends TestClass1 implements ITestInterface2, ITestInterface3
+ {
+
+ public var something:String;
+
+
+ public function someMethod2(compulsoryArg:int, optArg:String = null):TestClass1
+ {
+ return null;
+ }
+
+ public function get someValue2():Boolean
+ {
+ return false;
+ }
+ }
+}
diff --git a/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/support/TestClass4.as b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/support/TestClass4.as
new file mode 100644
index 0000000..945071e
--- /dev/null
+++ b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/support/TestClass4.as
@@ -0,0 +1,112 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.reflection.support
+{
+
+
+ /**
+ * @royalesuppresspublicvarwarning
+ */
+ public class TestClass4 extends TestClass2
+ {
+ //Note: do not change this test class unless you change the related tests to
+ //support any changes that might appear when testing reflection into it
+
+ public function TestClass4()
+ {
+ super("");
+ }
+
+
+ [TestMeta(foo="instanceMethod")]
+ public function testMethod2():void
+ {
+
+ }
+
+ [TestMeta(foo="instanceMethod")]
+ public function testMethodWithArgs2(mandatory:String, optional:Boolean = true):void
+ {
+
+ }
+
+ [TestMeta(foo="instanceVariable")]
+ public var testVar2:String;
+
+ [TestMeta(foo="instanceAccessor")]
+ public function get testReadonly2():String
+ {
+ return null
+ }
+
+ [TestMeta(foo="instanceAccessor")]
+ public function set testWriteonly2(value:String):void
+ {
+
+ }
+
+ [TestMeta(foo="instanceAccessor")]
+ public function get testReadeWrite2():String
+ {
+ return null
+ }
+
+ public function set testReadeWrite2(value:String):void
+ {
+
+ }
+
+ [TestMeta(foo="staticMethod")]
+ public static function testStaticMethod():void
+ {
+ }
+
+ [TestMeta(foo="staticMethod")]
+ public static function testStaticMethodWithArgs(mandatory:String, optional:Boolean = true):void
+ {
+ }
+
+ [TestMeta(foo="staticVariable")]
+ public static var testStaticVar:String;
+
+ [TestMeta(foo="staticAccessor")]
+ public static function get testStaticReadonly():String
+ {
+ return null
+ }
+
+ [TestMeta(foo="staticAccessor")]
+ public static function set testStaticWriteonly(value:String):void
+ {
+
+ }
+
+ [TestMeta(foo="staticAccessor")]
+ public static function get testStaticReadeWrite():String
+ {
+ return null
+ }
+
+ public static function set testStaticReadeWrite(value:String):void
+ {
+
+ }
+
+ }
+}
diff --git a/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/support/TestClass5.as b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/support/TestClass5.as
new file mode 100644
index 0000000..83de8e7
--- /dev/null
+++ b/frameworks/projects/Reflection/src/test/royale/flexUnitTests/reflection/support/TestClass5.as
@@ -0,0 +1,92 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.reflection.support
+{
+
+
+ /**
+ * @royalesuppresspublicvarwarning
+ */
+ public class TestClass5
+ {
+ //Note: do not change this test class unless you change the related tests to
+ //support any changes that might appear when testing reflection into it
+
+ public function TestClass5()
+ {
+
+ }
+
+
+ [TestMeta(foo="instanceMethod")]
+ public function method():void
+ {
+
+ }
+
+ [TestMeta(foo="instanceMethod")]
+ public function methodWithArgs(mandatory:String, optional:Boolean = true):void
+ {
+
+ }
+
+ [TestMeta(foo="instanceVariable")]
+ public var testVar:String;
+
+ [TestMeta(foo="instanceAccessor")]
+ public function get testGetter():String
+ {
+ return null
+ }
+
+ [TestMeta(foo="instanceAccessor")]
+ public function set testSetter(value:String):void
+ {
+
+ }
+
+
+ [TestMeta(foo="staticMethod")]
+ public static function method():void
+ {
+ }
+
+ [TestMeta(foo="staticMethod")]
+ public static function methodWithArgs(mandatory:String, optional:Boolean = true):void
+ {
+ }
+
+ [TestMeta(foo="staticVariable")]
+ public static var testVar:String;
+
+ [TestMeta(foo="staticAccessor")]
+ public static function get testGetter():String
+ {
+ return null
+ }
+
+ [TestMeta(foo="staticAccessor")]
+ public static function set testSetter(value:String):void
+ {
+
+ }
+
+
+ }
+}
diff --git a/frameworks/projects/RoyaleUnit/src/main/royale/RoyaleUnitClasses.as b/frameworks/projects/RoyaleUnit/src/main/royale/RoyaleUnitClasses.as
index 8cb0343..0088dcc 100644
--- a/frameworks/projects/RoyaleUnit/src/main/royale/RoyaleUnitClasses.as
+++ b/frameworks/projects/RoyaleUnit/src/main/royale/RoyaleUnitClasses.as
@@ -50,5 +50,6 @@ internal class RoyaleUnitClasses
import org.apache.royale.test.runners.notification.IRunNotifier;IRunNotifier;
import org.apache.royale.test.runners.notification.Result;Result;
import org.apache.royale.test.runners.notification.RunNotifier;RunNotifier;
+ import org.apache.royale.test.Runtime;Runtime;
+}
}
-}
\ No newline at end of file
diff --git a/frameworks/projects/RoyaleUnit/src/main/royale/org/apache/royale/test/Runtime.as b/frameworks/projects/RoyaleUnit/src/main/royale/org/apache/royale/test/Runtime.as
new file mode 100644
index 0000000..b55b911
--- /dev/null
+++ b/frameworks/projects/RoyaleUnit/src/main/royale/org/apache/royale/test/Runtime.as
@@ -0,0 +1,37 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 org.apache.royale.test
+{
+ public class Runtime {
+
+ /**
+ * @royalesuppresspublicvarwarning
+ */
+ public static var swfVersion:uint=0;
+
+ public static function getCurrentPlatform():String{
+ COMPILE::SWF{
+ return 'SWF';
+ }
+ COMPILE::JS{
+ return 'JS';
+ }
+ }
+ }
+}
diff --git a/frameworks/projects/RoyaleUnit/src/test/royale/FlexUnitRoyaleApplication.mxml b/frameworks/projects/RoyaleUnit/src/test/royale/FlexUnitRoyaleApplication.mxml
index d921be9..9548b23 100644
--- a/frameworks/projects/RoyaleUnit/src/test/royale/FlexUnitRoyaleApplication.mxml
+++ b/frameworks/projects/RoyaleUnit/src/test/royale/FlexUnitRoyaleApplication.mxml
@@ -37,9 +37,28 @@ limitations under the License.
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(RoyaleUnitSuite);
diff --git a/frameworks/projects/XML/build.xml b/frameworks/projects/XML/build.xml
index 885e876..dd59434 100644
--- a/frameworks/projects/XML/build.xml
+++ b/frameworks/projects/XML/build.xml
@@ -59,8 +59,17 @@
<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">
<delete failonerror="false">
<fileset dir="${ROYALE_HOME}/frameworks/libs">
diff --git a/frameworks/projects/XML/src/test/royale/FlexUnitRoyaleApplication-config.xml b/frameworks/projects/XML/src/test/royale/FlexUnitRoyaleApplication-config.xml
new file mode 100644
index 0000000..fbfeb8b
--- /dev/null
+++ b/frameworks/projects/XML/src/test/royale/FlexUnitRoyaleApplication-config.xml
@@ -0,0 +1,107 @@
+<!--
+
+ 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/XMLJS.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/RoyaleUnit/src/test/royale/FlexUnitRoyaleApplication.mxml b/frameworks/projects/XML/src/test/royale/FlexUnitRoyaleApplication.mxml
similarity index 73%
copy from frameworks/projects/RoyaleUnit/src/test/royale/FlexUnitRoyaleApplication.mxml
copy to frameworks/projects/XML/src/test/royale/FlexUnitRoyaleApplication.mxml
index d921be9..ac5b0b1 100644
--- a/frameworks/projects/RoyaleUnit/src/test/royale/FlexUnitRoyaleApplication.mxml
+++ b/frameworks/projects/XML/src/test/royale/FlexUnitRoyaleApplication.mxml
@@ -33,16 +33,36 @@ limitations under the License.
import flash.system.fscommand;
}
- import tests.RoyaleUnitSuite;
+ import flexUnitTests.XMLTester;
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(RoyaleUnitSuite);
+ core.runClasses(XMLTester);
}
private function core_completeHandler(event:Event):void
diff --git a/frameworks/projects/XML/src/test/royale/build.xml b/frameworks/projects/XML/src/test/royale/build.xml
new file mode 100644
index 0000000..10890cc
--- /dev/null
+++ b/frameworks/projects/XML/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="XML.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="XML-${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/XML/src/test/royale/flexUnitTests/XMLTester.as b/frameworks/projects/XML/src/test/royale/flexUnitTests/XMLTester.as
new file mode 100644
index 0000000..333a875
--- /dev/null
+++ b/frameworks/projects/XML/src/test/royale/flexUnitTests/XMLTester.as
@@ -0,0 +1,51 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+{
+ import flexUnitTests.xml.*
+
+ [Suite]
+ [RunWith("org.apache.royale.test.runners.SuiteRunner")]
+ /**
+ * @royalesuppresspublicvarwarning
+ */
+ public class XMLTester
+ {
+ public function XMLTester()
+ {
+ // for JS, force-link these classes in the output
+ var arr:Array = [XMLTesterGeneralTest, XMLTesterStringifyTest, XMLListTesterGeneralTest];
+ }
+
+ // 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;
+
+ }
+}
diff --git a/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/XMLListTesterGeneralTest.as b/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/XMLListTesterGeneralTest.as
new file mode 100644
index 0000000..f1f4ccb
--- /dev/null
+++ b/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/XMLListTesterGeneralTest.as
@@ -0,0 +1,195 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 org.apache.royale.test.Runtime;
+
+ /**
+ * @royalesuppresspublicvarwarning
+ */
+ public class XMLListTesterGeneralTest
+ {
+ public static var isJS:Boolean = COMPILE::JS;
+
+
+ private var settings:Object;
+
+ public static function getSwfVersion():uint{
+ COMPILE::SWF{
+ return Runtime.swfVersion;
+ }
+ COMPILE::JS {
+ //this mimics the version of the flash player that has xml toString support 'fixed'
+ return 21
+ }
+ }
+
+ [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]
+ public function testXMLListBoolean():void
+ {
+
+ var xmllist:XMLList = XMLList(true);
+ assertTrue( xmllist.length() == 1, 'XMLList length was unexpected');
+ assertTrue( xmllist[0].nodeKind() == 'text', 'XMLList content was unexpected');
+ assertTrue( xmllist.toString() == 'true', 'XMLList content was unexpected');
+
+ xmllist = XMLList(false);
+ assertTrue( xmllist.length() == 1, 'XMLList length was unexpected');
+ assertTrue( xmllist[0].nodeKind() == 'text', 'XMLList content was unexpected');
+ assertTrue( xmllist.toString() == 'false', 'XMLList content was unexpected');
+ }
+
+
+ [Test]
+ public function testXMLListNull():void
+ {
+ var xmllist:XMLList;
+ var caughtError:Boolean = false;
+ try{
+ xmllist = XMLList(null);
+ } catch(e:Error) {
+ caughtError = true;
+ }
+ //as3 docs say this is an error, but it is not (in AVM)
+ assertFalse( caughtError, 'XMLList error status was unexpected');
+ assertTrue( xmllist.length() == 0, 'XMLList length was unexpected');
+
+ }
+
+ [Test]
+ public function testXMLListNumber():void
+ {
+ var xmllist:XMLList = XMLList(99.9);
+ assertTrue( xmllist.length() == 1, 'XMLList length was unexpected');
+ assertTrue( xmllist[0].nodeKind() == 'text', 'XMLList content was unexpected');
+ assertTrue( xmllist.toString() == '99.9', 'XMLList content was unexpected');
+
+ }
+
+ [Test]
+ public function testXMLListString():void
+ {
+ var xmllist:XMLList = XMLList('test');
+ assertTrue( xmllist.length() == 1, 'XMLList length was unexpected');
+ assertTrue( xmllist[0].nodeKind() == 'text', 'XMLList content was unexpected');
+ assertTrue( xmllist.toString() == 'test', 'XMLList content was unexpected');
+
+ xmllist = XMLList('');
+ assertTrue( xmllist.length() == 0, 'XMLList length was unexpected');
+ }
+
+ [Test]
+ public function testXMLListUndefined():void
+ {
+ var xmllist:XMLList;
+ var caughtError:Boolean = false;
+ try{
+ xmllist = XMLList(undefined);
+ } catch(e:Error) {
+ caughtError = true;
+ }
+
+ //as3 docs say this is an error, but it is not (in AVM)
+ assertFalse( caughtError, 'XMLList error status was unexpected');
+ assertTrue( xmllist.length() == 0, 'XMLList length was unexpected');
+
+ }
+
+
+ [Test]
+ public function testXMLListObject():void
+ {
+ var xmllist:XMLList = XMLList({});
+
+ //as3 docs say this is an error, but it is not (in AVM)
+ assertTrue( xmllist.length() == 1, 'XMLList length was unexpected');
+ assertTrue( xmllist[0].nodeKind() == 'text', 'XMLList content was unexpected');
+ assertTrue( xmllist.toString() == '[object Object]', 'XMLList content was unexpected');
+
+ }
+
+ [Test]
+ public function testXMLListFromStringContent():void
+ {
+ var contentString:String = '<size description="Medium" xmlns:fx="http://ns.adobe.com/mxml/2009" >\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" xmlns:fx="http://ns.adobe.com/mxml/2009" >\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="Small" xmlns:fx="http://ns.adobe.com/mxml/2009" >\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" xmlns:fx="http://ns.adobe.com/mxml/2009" >\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" xmlns:fx="http://ns.adobe.com/mxml/2009" >\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" xmlns:fx="http://ns.adobe.com/mxml/2009" >\n' +
+ ' <color_swatch image="burgundy_cardigan.jpg">Burgundy</color_swatch>\n' +
+ ' <color_swatch image="black_cardigan.jpg">Black</color_swatch>\n' +
+ '</size>';
+
+ var xmllist:XMLList = XMLList(contentString);
+
+
+ assertTrue( xmllist.length() == 6, 'XMLList length was unexpected');
+ //use length here to account for variation in attribute/namespace sequence outputs
+ assertTrue( xmllist.toXMLString().length == 1431, 'XMLList length was unexpected');
+ }
+
+
+ }
+}
diff --git a/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/XMLTesterGeneralTest.as b/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/XMLTesterGeneralTest.as
new file mode 100644
index 0000000..48bbd99
--- /dev/null
+++ b/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/XMLTesterGeneralTest.as
@@ -0,0 +1,1085 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 org.apache.royale.test.Runtime;
+
+ /**
+ * @royalesuppresspublicvarwarning
+ */
+ public class XMLTesterGeneralTest
+ {
+ public static var isJS:Boolean = COMPILE::JS;
+
+ private var xmlStr:String;
+
+ private var quotedXML:XML;
+
+ private var xml:XML;
+ private var text:String;
+ private var xml2:XML;
+
+ private var settings:Object;
+
+ public static function getSwfVersion():uint{
+ COMPILE::SWF{
+ return Runtime.swfVersion;
+ }
+ COMPILE::JS {
+ //this mimics the version of the flash player that has xml toString support 'fixed'
+ return 21
+ }
+ }
+
+ [Before]
+ public function setUp():void
+ {
+ 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 -' + '-' + '>' +
+ '<?bla fud?>' +
+ ' bla bla<product description="Cardigan Sweater" product_image="cardigan.jpg">' +
+ ' <fx:catalog_item gender="Men\'s" fx:foo="bah">' +
+ ' <item_number>QWZ5671</item_number>' +
+ ' <price>39.95</price>' +
+ ' <size description="Medium">' +
+ ' <color_swatch image="red_cardigan.jpg">Red</color_swatch>' +
+ ' <color_swatch image="burgundy_cardigan.jpg">Burgundy</color_swatch>' +
+ ' </size>' +
+ ' <size description="Large">' +
+ ' <color_swatch image="red_cardigan.jpg">Red</color_swatch>' +
+ ' <color_swatch image="burgundy_cardigan.jpg">Burgundy</color_swatch>' +
+ ' </size>' +
+ ' </fx:catalog_item>' +
+ ' <script> <![CDATA[private function onStylesLoaded(ev:Event):void {currentState = "normal";facade = ApplicationFacade.getInstance();facade.notifyObservers(new Notification(ApplicationFacade.CMD_STARTUP, this));} ]' + ']> </script>' +
+ ' <catalog_item gender="Women\'s">' +
+ ' <item_number>RRX9856</item_number>' +
+ ' <price>42.50</price>' +
+ ' <size description="Small">' +
+ ' <color_swatch image="red_cardigan.jpg">Red</color_swatch>' +
+ ' <color_swatch image="navy_cardigan.jpg">Navy</color_swatch>' +
+ ' <color_swatch image="burgundy_cardigan.jpg">Burgundy</color_swatch>' +
+ ' </size>' +
+ ' <size description="Medium">' +
+ ' <color_swatch image="red_cardigan.jpg">Red</color_swatch>' +
+ ' <color_swatch image="navy_cardigan.jpg">Navy</color_swatch>' +
+ ' <color_swatch image="burgundy_cardigan.jpg">Burgundy</color_swatch>' +
+ ' <color_swatch image="black_cardigan.jpg">Black</color_swatch>' +
+ ' </size>' +
+ ' <size description="Large">' +
+ ' <color_swatch image="navy_cardigan.jpg">Navy</color_swatch>' +
+ ' <color_swatch image="black_cardigan.jpg">Black</color_swatch>' +
+ ' </size>' +
+ ' <size description="Extra Large">' +
+ ' <color_swatch image="burgundy_cardigan.jpg">Burgundy</color_swatch>' +
+ ' <color_swatch image="black_cardigan.jpg">Black</color_swatch>' +
+ ' </size>' +
+ ' </catalog_item>' +
+ ' </product>' +
+ '</catalog>';
+
+ quotedXML = <root title="That's Entertainment"/>;
+ xml = new XML(xmlStr);
+ text = "hi";
+ xml2 = new XML('<root xmlns:fz="http://ns.adobe.com/mxml/2009"><a><b/></a><a name="fred"/><a>hi<b>yeah!</b></a><a name="frank"/><c/></root>');
+
+ }
+
+ [After]
+ public function tearDown():void
+ {
+ xmlStr = null;
+ quotedXML = null;
+ xml = null;
+ text = null;
+ xml2 = null;
+
+ XML.setSettings(settings);
+ }
+
+ [BeforeClass]
+ public static function setUpBeforeClass():void
+ {
+ }
+
+ [AfterClass]
+ public static function tearDownAfterClass():void
+ {
+ }
+
+
+ [Test]
+ public function testSimpleAttributes():void
+ {
+
+ var xml1:XML = <foo baz="true"/>;
+ assertTrue( xml1.hasOwnProperty("@baz"), '<foo baz="true"/> should have attribute @baz');
+ assertFalse( xml1.hasOwnProperty("@foo"), '<foo baz="true"/> should not have attribute @foo');
+ assertFalse( xml1.hasOwnProperty("baz"), '<foo baz="true"/> should not have attribute baz');
+ assertTrue( xml1.toXMLString() == '<foo baz="true"/>', '<foo baz="true"/> toXMLString should be <foo baz="true"/>');
+
+ assertTrue( xml1.@baz.toString() == 'true', 'xml1.@baz.toString() should be "true"');
+
+ var baz:XMLList = xml1.@baz;
+ assertTrue( baz.toString() == 'true', 'baz.toString() should be "true"');
+ assertEquals( baz.length(),1, 'baz.length() should be 1');
+ var xml3:XML = <root/>;
+ xml3.bar.baz = "baz";
+ xml3.foo.@boo = "boo";
+
+ assertEquals( xml3.bar.baz,'baz', 'xml3.bar.baz should be "baz"');
+ assertEquals( xml3.foo.@boo,'boo', 'xml3.foo.@boo should be "boo"');
+
+ }
+
+
+
+ [Ignore]
+ [Test]
+ public function testSimpleXMLList():void
+ {
+ var xml1:XML = <foo baz="true"/>;
+
+ assertTrue( xml1.@baz.toString() == "true", 'toString value should be "true" ');
+ var xml3:XML = <root/>;
+ xml3.bar.baz = "baz";
+ xml3.foo.@boo = "boo";
+
+ assertEquals( xml3.bar.baz.toString(), "baz", 'toString value should be "baz" ');
+ assertEquals( xml3.foo.@boo.toString(), "boo", 'toString value should be "boo" ');
+
+ var newContent:XML = <Content/>;
+ newContent.Properties.Leading.@type = "string";
+ newContent.Properties.Leading = 36;
+
+ assertEquals( newContent.Properties.Leading.@type, "string", "Leading should be @type=string");
+ assertStrictlyEquals(newContent.Properties.Leading.toString(), "36", "Leading should be 36");
+ assertStrictlyEquals(
+ newContent.toXMLString(),
+ "<Content>\n" +
+ " <Properties>\n" +
+ " <Leading type=\"string\">36</Leading>\n" +
+ " </Properties>\n" +
+ "</Content>",
+ "unexpected toXMLString() value"
+ );
+
+ newContent.Properties.Leading = 72;
+ assertStrictlyEquals(newContent.Properties.Leading.toString(), "72", "Leading should be 72");
+
+ }
+
+
+ [Test]
+ public function testXMLMethods1():void
+ {
+ var xml1:XML = <foo baz="true"/>;
+ var child:XML = <pop><child name="Sam"/></pop>;
+ xml1.appendChild(child);
+ child = <pop><child name="George"/></pop>;
+ xml1.appendChild(child);
+
+ assertTrue( xml1.pop[0].child.@name.toString() == 'Sam', 'unexpected child result');
+ assertTrue( xml1.pop[1].child.@name.toString() == 'George', 'unexpected child result');
+
+ }
+
+
+ [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>;
+ xml1.appendChild(child);
+ child = <pop>
+ <child name="George"/>
+ </pop>;
+ xml1.appendChild(child);
+ assertEquals(
+ xml1.pop[0].toString(),
+ '<pop>\n' +
+ ' <child name="Sam"/>\n' +
+ '</pop>', 'unexpected output with xml1.pop[0].toString()');
+ assertEquals(
+ xml1.pop[1].toString(),
+ '<pop>\n' +
+ ' <child name="George"/>\n' +
+ '</pop>', 'unexpected output with xml1.pop[1].toString()');
+
+
+ var pop:XMLList = xml1.pop;
+ pop[pop.length()] = <pop>
+ <child name="Fred"/>
+ </pop>;
+
+ assertEquals(
+ 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>', 'unexpected output with pop.toString()');
+
+ assertEquals(
+ 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>', 'unexpected output with xml1.toString()');
+
+
+ pop[0] = <pop>
+ <child name="Fred"/>
+ </pop>;
+
+ assertEquals(
+ 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>', 'unexpected output with pop.toString()');
+
+ assertEquals(
+ 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>', 'unexpected output with xml1.toString()');
+
+ //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
+
+ assertEquals(
+ xml1.toLocaleString(),
+ expected, 'unexpected output with xml1.toLocaleString()');
+
+ 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
+
+ assertEquals(
+ xml1.pop.toLocaleString(),
+ expected, 'unexpected output with xml1.pop.toLocaleString()');
+
+
+ var parentXML:XML = <parent/>;
+ var childXML:XML = <child/>;
+ parentXML.appendChild(childXML);
+ assertTrue( (childXML.parent() == parentXML), 'child/parent relationship was unexpected');
+ assertEquals(
+ parentXML.toXMLString(),
+ '<parent>\n' +
+ ' <child/>\n' +
+ '</parent>', 'unexpected output following re-parenting');
+
+ var newParent:XML = <newparent/>;
+ newParent.appendChild(childXML);
+
+
+ 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/>';
+ }
+
+ assertEquals(
+ parentXML.toXMLString(),
+ expected, 'unexpected output following re-parenting');
+
+ assertEquals(
+ newParent.toXMLString(),
+ '<newparent>\n' +
+ ' <child/>\n' +
+ '</newparent>', 'unexpected output following re-parenting');
+
+ assertFalse( (childXML.parent() == parentXML), 'child/parent relationship was unexpected');
+
+ 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
+ assertTrue( (parentXML.children().length() == expectedLength), 'child/parent relationship was unexpected');
+ assertTrue( (childXML.parent() == newParent), 'child/parent relationship was unexpected');
+
+ childXML = <Content>• <?ACE 7?>Some amazing content</Content>;
+ var childXMLStr:String = childXML.text();
+
+ assertEquals( childXMLStr, '•Some amazing content', " (should be) •Some amazing content");
+ }
+ [Test]
+ public function testInvalidAppendChild():void{
+ var root:XML = new XML('test');
+ root.appendChild('test');
+
+ assertEquals(root.toString(), 'test', 'testInvalidAppendChild 1 result is bad');
+ assertEquals(root.toXMLString(), 'test', 'testInvalidAppendChild 2 result is bad');
+ }
+
+ [Test]
+ public function testAppendNonXMLChild():void{
+ var root:XML = <root/>;
+ root.appendChild('test');
+
+ assertEquals(root.toString(), 'test', 'testAppendNonXMLChild 1 result is bad');
+ assertEquals(root.toXMLString(), '<root>test</root>', 'testAppendNonXMLChild 2 result is bad');
+
+ root = <root><test><something/></test></root>;
+ root.appendChild('test');
+
+ assertEquals(
+ root.toString(),
+ '<root>\n' +
+ ' <test>\n' +
+ ' <something/>\n' +
+ ' </test>\n' +
+ ' <test>test</test>\n' +
+ '</root>', 'testAppendNonXMLChild 3 result is bad');
+
+ assertEquals(
+ root.toXMLString(),
+ '<root>\n' +
+ ' <test>\n' +
+ ' <something/>\n' +
+ ' </test>\n' +
+ ' <test>test</test>\n' +
+ '</root>', 'testAppendNonXMLChild 4 result is bad');
+
+ }
+
+
+ [Test]
+ public function testXMLNormalize():void{
+ var xml:XML = <root/>;
+ xml.appendChild("test1");
+ xml.appendChild("test2");
+ xml.appendChild(<element/>);
+ xml.appendChild("test3");
+ xml.appendChild("test4");
+
+
+ assertEquals(
+ xml.toString(),
+ '<root>\n' +
+ ' test1\n' +
+ ' test2\n' +
+ ' <element/>\n' +
+ ' <element>test3</element>\n' +
+ ' <element>test4</element>\n' +
+ '</root>', 'testXMLNormalize 1 result is bad');
+
+ assertEquals(
+ xml.toXMLString(),
+ '<root>\n' +
+ ' test1\n' +
+ ' test2\n' +
+ ' <element/>\n' +
+ ' <element>test3</element>\n' +
+ ' <element>test4</element>\n' +
+ '</root>', 'testXMLNormalize 2 result is bad');
+
+
+ xml.normalize();
+
+ assertEquals(
+ xml.toString(),
+ '<root>\n' +
+ ' test1test2\n' +
+ ' <element/>\n' +
+ ' <element>test3</element>\n' +
+ ' <element>test4</element>\n' +
+ '</root>', 'testXMLNormalize 3 result is bad');
+
+ assertEquals(
+ xml.toXMLString(),
+ '<root>\n' +
+ ' test1test2\n' +
+ ' <element/>\n' +
+ ' <element>test3</element>\n' +
+ ' <element>test4</element>\n' +
+ '</root>', 'testXMLNormalize 4 result is bad');
+
+
+ }
+
+ [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 rects:XMLList = svg..rect;
+ rects[1].@width = "100px";
+ rects.(@id == 3).@height = "100px";
+
+ var expected:String =
+ '<rect id="1"/>' + '\n'
+ + '<rect id="2" width="100px"/>' + '\n'
+ + '<rect id="3" height="100px"/>' + '\n'
+ + '<rect id="4"/>';
+
+ assertTrue( rects.toXMLString() == expected, 'string output was unexpected');
+ }
+
+
+ [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());
+ list = xml.element;
+ assertEquals( 1, list.length(), 'Error in list length');
+ //list = xml.child('element')
+
+ // trace(list.length())
+ list = xml.otherElement;
+ //list = xml.child('otherElement')
+ assertEquals( 1, list.length(), 'Error in 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();
+ assertEquals( namespace.prefix, 'x', 'Error in namespace prefix');
+ assertEquals( namespace.uri, 'adobe:ns:meta/', 'Error in namespace uri');
+
+ }
+
+
+ [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;
+ }
+ assertFalse( caughtError, 'Unexpected Error state with duplicate namespace declarations');
+
+ }
+
+ [Test]
+ public function testDuplicateAttributesError():void{
+ var caughtError:Boolean;
+ try {
+ var content:XML = <root myVal="something" myVal="somethingElse"/>;
+ } catch(e:Error) {
+ caughtError = true;
+ }
+
+ assertTrue( caughtError, 'Unexpected Error state with duplicate attribute declarations');
+
+ }
+
+ [Ignore]
+ [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>;
+
+ assertEquals(1, script.children().length(), 'unexpected children number after parsing');
+ assertEquals(
+ '<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 toString value after parsing');
+
+ 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>;
+ assertEquals(3, script.children().length(), 'unexpected children number after parsing');
+
+
+ assertEquals(
+ '<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(), 'unexpected toString value after parsing');
+ XML.ignoreWhitespace = originalSetting;
+ }
+ [Test]
+ public function testSingleProcessingInstructions():void{
+ var original:Boolean = XML.ignoreProcessingInstructions;
+ XML.ignoreProcessingInstructions = true;
+ var xml:XML = new XML('<?bar foo?>');
+ assertEquals( 'text', xml.nodeKind(), 'unexpected nodeKind with XML.ignoreProcessingInstructions = true');
+ assertEquals( '', xml.toXMLString(), 'unexpected toXMLString with XML.ignoreProcessingInstructions = true');
+ XML.ignoreProcessingInstructions = false;
+ xml = new XML('<?bar foo?>');
+ assertEquals( 'processing-instruction', xml.nodeKind(), 'unexpected nodeKind with XML.ignoreProcessingInstructions = false');
+ assertEquals( '<?bar foo?>', xml.toXMLString(), 'unexpected toXMLString with XML.ignoreProcessingInstructions = false');
+
+ XML.ignoreProcessingInstructions = original;
+ }
+
+
+ [Test]
+ public function testSingleCDATA():void{
+ var original:Boolean = XML.ignoreWhitespace;
+ XML.ignoreWhitespace = true;
+ var xml:XML = new XML(' <![CDATA[ my cdata ]]> ');
+ assertEquals( 'text', xml.nodeKind(), 'unexpected cdata result with XML.ignoreWhitespace = true');
+ assertEquals( '<![CDATA[ my cdata ]]>', xml.toXMLString(), 'unexpected toXMLString with XML.ignoreWhitespace = true');
+ assertNull( xml.name(), 'unexpected name value with CDATA');
+ XML.ignoreWhitespace = false;
+ var caughtError:Boolean = false;
+ try {
+ xml = new XML(' <![CDATA[ my cdata ]]> ');
+ } catch(e:Error) {
+ caughtError = true;
+ }
+
+ assertTrue( caughtError, 'unexpected error status for single cdata string parsing with XML.ignoreWhitespace = false');
+
+ XML.ignoreWhitespace = original;
+ }
+
+
+ [Test]
+ public function testSingleText():void{
+ var original:Boolean = XML.ignoreWhitespace;
+ XML.ignoreWhitespace = true;
+ var xml:XML = new XML(' my text ');
+ assertEquals( 'text', xml.nodeKind(), 'unexpected text result with XML.ignoreWhitespace = true');
+ assertEquals( 'my text', xml.toXMLString(), 'unexpected toXMLString with XML.ignoreWhitespace = true');
+ assertNull( xml.name(), 'unexpected name value with text');
+ XML.ignoreWhitespace = false;
+ var caughtError:Boolean = false;
+ try {
+ xml = new XML(' my text ');
+ } catch(e:Error) {
+ caughtError = true;
+ }
+
+ assertFalse( caughtError, 'unexpected error status for text string parsing with XML.ignoreWhitespace = false');
+ assertEquals( 'text', xml.nodeKind(), 'unexpected text result with XML.ignoreWhitespace = true');
+ assertEquals( ' my text ', xml.valueOf(), 'unexpected toXMLString with XML.ignoreWhitespace = true');
+ 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 --> ');
+ assertEquals( 'comment', xml.nodeKind(), 'unexpected comment result with XML.ignoreWhitespace = true');
+ assertEquals( '<!-- my test comment -->', xml.toXMLString(), 'unexpected toXMLString with XML.ignoreWhitespace = true');
+ assertNull( xml.name(), 'unexpected name value with text');
+ XML.ignoreWhitespace = false;
+ var caughtError:Boolean = false;
+ try {
+ xml = new XML(' <!-- my test comment --> ');
+ } catch(e:Error) {
+ caughtError = true;
+ }
+
+ assertTrue( caughtError, 'unexpected error status for comment parsing with XML.ignoreWhitespace = false');
+
+ xml = new XML('<!-- my test comment -->');
+ assertNull( xml.name(), 'unexpected name value with comment');
+
+ assertEquals( 'comment', xml.nodeKind(), 'unexpected comment result with XML.ignoreWhitespace = true');
+ assertEquals( '<!-- my test comment -->', xml.toXMLString(), 'unexpected toXMLString with XML.ignoreWhitespace = true');
+ XML.ignoreComments = true;
+ xml = new XML('<!-- my test comment -->');
+ assertNull( xml.name(), 'unexpected name value with text');
+
+ assertEquals( 'text', xml.nodeKind(), 'unexpected comment result with XML.ignoreComments = true');
+ assertEquals( '', xml.toXMLString(), 'unexpected toXMLString with XML.ignoreComments = true');
+
+
+ XML.ignoreWhitespace = original;
+ XML.ignoreComments = originalComments;
+ }
+
+ [Ignore]
+ [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>');
+ assertEquals( 1, xml.children().length(), 'unexpected comment result with XML.ignoreComments = false');
+
+ assertEquals(
+ '<root>\n' +
+ ' <!-- my test comment -->\n' +
+ '</root>',
+ xml.toXMLString(), 'unexpected toXMLString with XML.ignoreComments = false');
+ assertNull( xml.children()[0].name(), 'unexpected name value with comment');
+ XML.ignoreComments = true;
+ xml = new XML('<root><!-- my test comment --></root>');
+ assertEquals( 0, xml.children().length(), 'unexpected comment result with XML.ignoreComments = true');
+ assertEquals( '<root/>', xml.toXMLString(), 'unexpected toXMLString with XML.ignoreComments = true');
+
+ XML.ignoreWhitespace = original;
+ XML.ignoreComments = originalComments;
+ }
+
+ [Ignore]
+ [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)
+ assertTrue( xmlString.length == 2060, 'unexpected complex stringify results');
+ }
+
+
+ [Test]
+ public function testTopLevelProcessingInstructions():void{
+ var xmlSource:String = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n' +
+ '<?aid style="50" type="snippet" readerVersion="6.0" featureSet="257" product="14.0(209)" ?>\n' +
+ '<?aid SnippetType="PageItem"?>';
+
+ XML.ignoreProcessingInstructions = true;
+ var xml:XML = new XML(xmlSource);
+
+
+ assertTrue( xml.toString() == '', 'unexpected toSting result');
+ assertTrue( xml.nodeKind() == 'text', 'unexpected nodeKind result');
+
+
+ XML.ignoreProcessingInstructions = false;
+ var caughtError:Boolean;
+ try {
+ xml = new XML(xmlSource);
+ } catch (e:Error)
+ {
+ //RoyaleUnitTestRunner.consoleOut(e.message);
+ caughtError = true;
+ }
+ //RoyaleUnitTestRunner.consoleOut('testTopLevelProcessingInstructions '+xml.nodeKind());
+ assertTrue( caughtError, 'error was expected');
+ }
+
+
+ [Test]
+ public function testTopLevelWhitespace():void{
+ var original:Boolean = XML.ignoreWhitespace;
+ var xmlSource:String = '<?xml version="1.0" encoding="UTF-8"?>\n'
+ +' <?test ?> <a>test</a> ';
+
+ XML.ignoreWhitespace = true;
+ var xml:XML = new XML(xmlSource);
+
+
+ assertTrue( xml.toString() == 'test', 'unexpected toSting result');
+ assertTrue( xml.nodeKind() == 'element', 'unexpected nodeKind result');
+
+
+ XML.ignoreWhitespace = false;
+ xml = new XML(xmlSource);
+
+ assertTrue( xml.toString() == 'test', 'unexpected toSting result');
+ assertTrue( xml.nodeKind() == 'element', 'unexpected nodeKind result');
+
+ XML.ignoreWhitespace = original;
+ }
+
+
+ [Test]
+ public function testTopLevelMultipleTypes():void{
+ var original:Object = XML.settings();
+ var xmlSource:String = '<?xml version="1.0" encoding="UTF-8"?>\n'
+ +' <?test1 ?> <!-- my test comment1 --> <a>test</a> <?test2 ?> <!-- my test comment1 --> ';
+
+ XML.ignoreComments = false;
+ XML.ignoreProcessingInstructions = false;
+ XML.ignoreWhitespace = false;
+ var xml:XML = new XML(xmlSource);
+
+
+ assertTrue( xml.toString() == 'test', 'unexpected toSting result');
+ assertTrue( xml.nodeKind() == 'element', 'unexpected nodeKind result');
+
+ xmlSource = '<?xml version="1.0" encoding="UTF-8"?>\n'
+ +' <?test1 ?> <!-- my test comment1 --> <?test2 ?> <!-- my test comment2 --> ';
+
+ var caughtError:Boolean = false;
+ try {
+ xml =new XML(xmlSource);
+ } catch (e:Error)
+ {
+ caughtError = true;
+ }
+ assertTrue( caughtError, 'unexpected error status');
+ assertTrue( xml.toString() == 'test', 'unexpected toSting result');
+ assertTrue( xml.nodeKind() == 'element', 'unexpected nodeKind result');
+
+ XML.setSettings(original)
+ }
+
+
+ [Test]
+ public function testTopLevelVariants():void{
+ var original:Object = XML.settings();
+ //error 2 root tags
+ var xmlSource:String = ' <?test1 ?> <!-- my test comment1 --> <a>test</a> <?test2 ?> <a>test</a> <!-- my test comment2 --> ';
+
+ XML.ignoreComments = false;
+ XML.ignoreProcessingInstructions = false;
+ XML.ignoreWhitespace = false;
+ var xml:XML;
+
+ var caughtError:Boolean = false;
+
+ try {
+ xml = new XML(xmlSource);
+ } catch(e:Error) {
+ caughtError = true;
+ }
+
+ assertTrue( caughtError, 'unexpected error statust');
+ //repeat with all settings toggled (must remain an error)
+ XML.ignoreComments = true;
+ XML.ignoreProcessingInstructions = true;
+ XML.ignoreWhitespace = true;
+ try {
+ caughtError = false;
+ xml = new XML(xmlSource);
+ } catch(e:Error) {
+ caughtError = true;
+ }
+
+ assertTrue( caughtError, 'unexpected error statust');
+ //restore settings
+ XML.ignoreComments = false;
+ XML.ignoreProcessingInstructions = false;
+ XML.ignoreWhitespace = false;
+
+ //error multiple non-element nodes with whitespace
+ xmlSource = ' <?test1 ?> <!-- my test comment1 --> <?test2 ?> <!-- my test comment2 --> ';
+
+ try {
+ caughtError = false;
+ xml = new XML(xmlSource);
+ } catch(e:Error) {
+ caughtError = true;
+ }
+ assertTrue( caughtError, 'unexpected error status');
+
+ //repeat with whiteSpace toggled (must remain an error)
+ XML.ignoreWhitespace = true;
+ try {
+ caughtError = false;
+ xml = new XML(xmlSource);
+ } catch(e:Error) {
+ caughtError = true;
+ }
+ assertTrue( caughtError, 'unexpected error status');
+ XML.ignoreWhitespace = false;
+ //repeat with ignoreProcessingInstructions toggled
+ XML.ignoreProcessingInstructions = true;
+ try {
+ caughtError = false;
+ xml = new XML(xmlSource);
+ } catch(e:Error) {
+ caughtError = true;
+ }
+ assertTrue( caughtError, 'unexpected error status');
+ XML.ignoreProcessingInstructions = false;
+ //repeat with ignoreComments toggled
+ XML.ignoreComments = true;
+ try {
+ caughtError = false;
+ xml = new XML(xmlSource);
+ } catch(e:Error) {
+ caughtError = true;
+ }
+ assertTrue( caughtError, 'unexpected error status');
+ XML.ignoreComments = false;
+
+
+ //repeat with all settings toggled
+ XML.ignoreComments = true;
+ XML.ignoreProcessingInstructions = true;
+ XML.ignoreWhitespace = true;
+ try {
+ caughtError = false;
+ xml = new XML(xmlSource);
+ } catch(e:Error) {
+ caughtError = true;
+ }
+ assertFalse( caughtError, 'unexpected error status');
+ assertTrue( xml.toString() == '', 'unexpected toSting result');
+ XML.ignoreComments = false;
+ XML.ignoreProcessingInstructions = false;
+ XML.ignoreWhitespace = false;
+
+ //another one with top level cdata just to cover more:
+
+ xmlSource = ' <?test1 ?> <!-- my test comment1 --> <![CDATA[ -<something>- ]]> <?test2 ?> <!-- my test comment2 --> ';
+ try {
+ caughtError = false;
+ xml = new XML(xmlSource);
+ } catch(e:Error) {
+ caughtError = true;
+ }
+ assertTrue( caughtError, 'unexpected error status');
+ //repeat with all settings toggled
+ XML.ignoreComments = true;
+ XML.ignoreProcessingInstructions = true;
+ XML.ignoreWhitespace = true;
+ try {
+ caughtError = false;
+ xml = new XML(xmlSource);
+ } catch(e:Error) {
+ caughtError = true;
+ }
+ assertFalse( caughtError, 'unexpected error status');
+ assertTrue( xml.toString() == ' -<something>- ', 'unexpected toSting result');
+ assertTrue( xml.toXMLString() == '<![CDATA[ -<something>- ]]>', 'unexpected toXMLString result');
+ XML.ignoreComments = false;
+ XML.ignoreProcessingInstructions = false;
+ XML.ignoreWhitespace = false;
+
+
+ XML.setSettings(original)
+ }
+
+
+
+ [Test]
+ public function testTopLevelCoercionFunction():void{
+
+ var localXml:XML;
+
+ localXml = XML(true);
+ assertTrue( localXml.nodeKind() == 'text', 'XML content was unexpected');
+ assertTrue( localXml.toString() == 'true', 'XML content was unexpected');
+
+
+ localXml = XML(false);
+ assertTrue( localXml.nodeKind() == 'text', 'XML content was unexpected');
+ assertTrue( localXml.toString() == 'false', 'XML content was unexpected');
+
+
+ localXml = XML('string');
+ assertTrue( localXml.nodeKind() == 'text', 'XMLList content was unexpected');
+ assertTrue( localXml.toString() == 'string', 'XMLList content was unexpected');
+
+ localXml = XML(99.9);
+ assertTrue( localXml.nodeKind() == 'text', 'XML content was unexpected');
+ assertTrue( localXml.toString() == '99.9', 'XML content was unexpected');
+
+
+ //as3 docs say this is an error, but it is not (in AVM)
+ localXml = XML(null);
+ assertTrue( localXml.nodeKind() == 'text', 'XML content was unexpected');
+ assertTrue( localXml.toString() == '', 'XML content was unexpected');
+
+ //as3 docs say this is an error, but it is not (in AVM)
+ localXml = XML(undefined);
+ assertTrue( localXml.nodeKind() == 'text', 'XML content was unexpected');
+ assertTrue( localXml.toString() == '', 'XML content was unexpected');
+
+ //as3 docs say this is an error, but it is not (in AVM)
+ localXml = XML({});
+ assertTrue( localXml.nodeKind() == 'text', 'XML content was unexpected');
+ assertTrue( localXml.toString() == '[object Object]', 'XML content was unexpected');
+
+ var xmlContent:XML = xml;
+ localXml = XML(xmlContent);
+ assertTrue( localXml == xml, 'XML content was unexpected');
+
+ var sizes:XMLList = localXml..size.(@description == 'Small');
+ assertTrue( sizes.length() == 1, 'XML content was unexpected');
+ localXml = XML(sizes);
+ assertTrue( localXml == sizes[0], 'XML content was unexpected');
+
+ }
+ }
+}
diff --git a/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/XMLTesterStringifyTest.as b/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/XMLTesterStringifyTest.as
new file mode 100644
index 0000000..71b9a74
--- /dev/null
+++ b/frameworks/projects/XML/src/test/royale/flexUnitTests/xml/XMLTesterStringifyTest.as
@@ -0,0 +1,323 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 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]
+ public static function setUpBeforeClass():void
+ {
+ }
+
+ [AfterClass]
+ public static function tearDownAfterClass():void
+ {
+ }
+
+
+ [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>;
+
+ assertEquals( xml.toXMLString(), '<xml>\n <item/>\n</xml>', 'Error in pretty Printing');
+ XML.prettyIndent = 4;
+ assertEquals( xml.toXMLString(), '<xml>\n <item/>\n</xml>', 'Error in pretty Printing');
+ XML.prettyIndent = 0;
+ assertEquals( xml.toXMLString(), '<xml>\n<item/>\n</xml>', 'Error in pretty Printing');
+
+ 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 & Ball</Content>");
+ assertEquals( ampXML.toXMLString(),'<Content>Bat & Ball</Content>', 'ampersand entities are output with toXMLString');
+ assertEquals(amp2XML.toXMLString(),'<Content>Bat & Ball</Content>', 'ampersand entities are output with toXMLString');
+ assertEquals( ampXML.toString(),'Bat & Ball', 'ampersand entities are not output with toString');
+ assertEquals( amp2XML.toString(),'Bat & Ball', 'ampersand entities are not output with toString');
+
+ }
+
+
+ [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>';
+
+ assertEquals(correctStr, contentStr, 'testStringifyAdvanced 1:content.toXMLString() was incorrect');
+
+
+ assertEquals(correctStr, content.toXMLString(), 'testStringifyAdvanced 1:content.toXMLString() was incorrect');
+
+ 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 [...]
+
+ assertTrue(
+ (contentStr == expected) || (contentStr == alternate), 'testStringifyAdvanced 1:content.toXMLString() was incorrect');
+
+
+ }
+
+ [Test]
+ public function stringifyAdvanced2():void{
+ XML.ignoreProcessingInstructions = true;
+ var xmlSource:String = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n' +
+ '<?aid style="50" type="snippet" readerVersion="6.0" featureSet="257" product="14.0(209)" ?>\n' +
+ '<?aid SnippetType="PageItem"?>\n' +
+ '<Document LinkedSpreads="undefined" DOMVersion="14.0" Self="d">\n' +
+ '\t<Color Self="Color/Black" Model="Process" Space="CMYK" ColorValue="0 0 0 100" ColorOverride="Specialblack" AlternateSpace="NoAlternateColor" AlternateColorValue="" Name="Black" ColorEditable="false" ColorRemovable="false" Visible="true" SwatchCreatorID="7937" SwatchColorGroupReference="u223ColorGroupSwatch3" />\n' +
+ '\t<Swatch Self="Swatch/None" Name="None" ColorEditable="false" ColorRemovable="false" Visible="true" SwatchCreatorID="7937" SwatchColorGroupReference="u223ColorGroupSwatch0" />\n' +
+ '\t<Str Self="Str/$ID/Solid" Name="$ID/Solid" />\n' +
+ '\t<RCS Self="u77">\n' +
+ '\t\t<CharacterStyle Self="CharacterStyle/$ID/[No character style]" Imported="false" Spl="false" EmitCss="true" StyleUniqueId="$ID/" IncludeClass="true" Name="$ID/[No character style]" />\n' +
+ '\t</RCS>\n' +
+ '\t<Nu Self="Nu/$ID/[Default]" Name="$ID/[Default]" ContinueNumbersAcrossStories="false" ContinueNumbersAcrossDocuments="false" />\n' +
+ '\t<RootParagraphStyleGroup Self="u76">\n' +
+ '\t\t\n' +
+ '\t\t\n' +
+ '\t</RootParagraphStyleGroup>\n' +
+ '\t\n' +
+ '\t\n' +
+ '\t\n' +
+ '\t\n' +
+ '\t\n' +
+ '\t<Story Self="u180" UserText="true" IsEndnoteStory="false" AppliedTOCStyle="n" TrackChanges="false" StoryTitle="$ID/" AppliedNamedGrid="n">\n' +
+ '\t\t<StoryPreference OpticalMarginAlignment="false" OpticalMarginSize="12" FrameType="TextFrameType" StoryOrientation="Horizontal" StoryDirection="LeftToRightDirection" />\n' +
+ '\t\t<InCopyExportOption IncludeGraphicProxies="true" IncludeAllResources="false" />\n' +
+ '\t\t<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/$ID/NormalParagraphStyle">\n' +
+ '\t\t\t<CharacterStyleRange AppliedCharacterStyle="CharacterStyle/$ID/[No character style]" PointSize="20">\n' +
+ '\t\t\t\t<Content>a</Content>\n' +
+ '\t\t\t\t<Br />\n' +
+ '\t\t\t\t<Content>s who work on the tickes.</Content>\n' +
+ '\t\t\t</CharacterStyleRange>\n' +
+ '\t\t</ParagraphStyleRange>\n' +
+ '\t</Story>\n' +
+ '\t<ColorGroup Self="ColorGroup/[Root Color Group]" Name="[Root Color Group]" IsRootColorGroup="true">\n' +
+ '\t\t<ColorGroupSwatch Self="u223ColorGroupSwatch0" SwatchItemRef="Swatch/None" />\n' +
+ '\t\t<ColorGroupSwatch Self="u223ColorGroupSwatch3" SwatchItemRef="Color/Black" />\n' +
+ '\t</ColorGroup>\n' +
+ '</Document>';
+
+ var xml:XML = new XML(xmlSource);
+
+
+ var expected:String = '<Document LinkedSpreads="undefined" DOMVersion="14.0" Self="d">\n' +
+ ' <Color Self="Color/Black" Model="Process" Space="CMYK" ColorValue="0 0 0 100" ColorOverride="Specialblack" AlternateSpace="NoAlternateColor" AlternateColorValue="" Name="Black" ColorEditable="false" ColorRemovable="false" Visible="true" SwatchCreatorID="7937" SwatchColorGroupReference="u223ColorGroupSwatch3"/>\n' +
+ ' <Swatch Self="Swatch/None" Name="None" ColorEditable="false" ColorRemovable="false" Visible="true" SwatchCreatorID="7937" SwatchColorGroupReference="u223ColorGroupSwatch0"/>\n' +
+ ' <Str Self="Str/$ID/Solid" Name="$ID/Solid"/>\n' +
+ ' <RCS Self="u77">\n' +
+ ' <CharacterStyle Self="CharacterStyle/$ID/[No character style]" Imported="false" Spl="false" EmitCss="true" StyleUniqueId="$ID/" IncludeClass="true" Name="$ID/[No character style]"/>\n' +
+ ' </RCS>\n' +
+ ' <Nu Self="Nu/$ID/[Default]" Name="$ID/[Default]" ContinueNumbersAcrossStories="false" ContinueNumbersAcrossDocuments="false"/>\n' +
+ ' <RootParagraphStyleGroup Self="u76"/>\n' +
+ ' <Story Self="u180" UserText="true" IsEndnoteStory="false" AppliedTOCStyle="n" TrackChanges="false" StoryTitle="$ID/" AppliedNamedGrid="n">\n' +
+ ' <StoryPreference OpticalMarginAlignment="false" OpticalMarginSize="12" FrameType="TextFrameType" StoryOrientation="Horizontal" StoryDirection="LeftToRightDirection"/>\n' +
+ ' <InCopyExportOption IncludeGraphicProxies="true" IncludeAllResources="false"/>\n' +
+ ' <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/$ID/NormalParagraphStyle">\n' +
+ ' <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/$ID/[No character style]" PointSize="20">\n' +
+ ' <Content>a</Content>\n' +
+ ' <Br/>\n' +
+ ' <Content>s who work on the tickes.</Content>\n' +
+ ' </CharacterStyleRange>\n' +
+ ' </ParagraphStyleRange>\n' +
+ ' </Story>\n' +
+ ' <ColorGroup Self="ColorGroup/[Root Color Group]" Name="[Root Color Group]" IsRootColorGroup="true">\n' +
+ ' <ColorGroupSwatch Self="u223ColorGroupSwatch0" SwatchItemRef="Swatch/None"/>\n' +
+ ' <ColorGroupSwatch Self="u223ColorGroupSwatch3" SwatchItemRef="Color/Black"/>\n' +
+ ' </ColorGroup>\n' +
+ '</Document>';
+
+ var outString:String = xml.toString();
+
+ //RoyaleUnitTestRunner.consoleOut('stringifyAdvanced2:\n' + outString );
+
+ //the order of toString output can be quite different for some browsers, but the length should be identical
+ assertTrue( outString.length == expected.length, 'unexpected toString result');
+ }
+
+ [Test]
+ public function stringifyAdvanced3():void{
+ //AS3 XML ignores processing instructions outside the root tag, even when it is told not to
+ //This is (I think) because there is no concept of a 'Document' level XML that is different to a regular XML node
+ XML.ignoreProcessingInstructions = false;
+ var xmlSource:String = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n' +
+ '<?aid style="50" type="snippet" readerVersion="6.0" featureSet="257" product="14.0(209)" ?>\n' +
+ '<?aid SnippetType="PageItem"?>\n' +
+ '<Document LinkedSpreads="undefined" DOMVersion="14.0" Self="d">\n' +
+ '\t<Color Self="Color/Black" Model="Process" Space="CMYK" ColorValue="0 0 0 100" ColorOverride="Specialblack" AlternateSpace="NoAlternateColor" AlternateColorValue="" Name="Black" ColorEditable="false" ColorRemovable="false" Visible="true" SwatchCreatorID="7937" SwatchColorGroupReference="u223ColorGroupSwatch3" />\n' +
+ '\t<Swatch Self="Swatch/None" Name="None" ColorEditable="false" ColorRemovable="false" Visible="true" SwatchCreatorID="7937" SwatchColorGroupReference="u223ColorGroupSwatch0" />\n' +
+ '\t<Str Self="Str/$ID/Solid" Name="$ID/Solid" />\n' +
+ '\t<RCS Self="u77">\n' +
+ '\t\t<CharacterStyle Self="CharacterStyle/$ID/[No character style]" Imported="false" Spl="false" EmitCss="true" StyleUniqueId="$ID/" IncludeClass="true" Name="$ID/[No character style]" />\n' +
+ '\t</RCS>\n' +
+ '\t<Nu Self="Nu/$ID/[Default]" Name="$ID/[Default]" ContinueNumbersAcrossStories="false" ContinueNumbersAcrossDocuments="false" />\n' +
+ '\t<RootParagraphStyleGroup Self="u76">\n' +
+ '\t\t\n' +
+ '\t\t\n' +
+ '\t</RootParagraphStyleGroup>\n' +
+ '\t\n' +
+ '\t\n' +
+ '\t\n' +
+ '\t\n' +
+ '\t\n' +
+ '\t<Story Self="u180" UserText="true" IsEndnoteStory="false" AppliedTOCStyle="n" TrackChanges="false" StoryTitle="$ID/" AppliedNamedGrid="n">\n' +
+ '\t\t<StoryPreference OpticalMarginAlignment="false" OpticalMarginSize="12" FrameType="TextFrameType" StoryOrientation="Horizontal" StoryDirection="LeftToRightDirection" />\n' +
+ '\t\t<InCopyExportOption IncludeGraphicProxies="true" IncludeAllResources="false" />\n' +
+ '\t\t<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/$ID/NormalParagraphStyle">\n' +
+ '\t\t\t<CharacterStyleRange AppliedCharacterStyle="CharacterStyle/$ID/[No character style]" PointSize="20">\n' +
+ '\t\t\t\t<Content>a</Content>\n' +
+ '\t\t\t\t<Br />\n' +
+ '\t\t\t\t<Content>s who work on the tickes.</Content>\n' +
+ '\t\t\t</CharacterStyleRange>\n' +
+ '\t\t</ParagraphStyleRange>\n' +
+ '\t</Story>\n' +
+ '\t<ColorGroup Self="ColorGroup/[Root Color Group]" Name="[Root Color Group]" IsRootColorGroup="true">\n' +
+ '\t\t<ColorGroupSwatch Self="u223ColorGroupSwatch0" SwatchItemRef="Swatch/None" />\n' +
+ '\t\t<ColorGroupSwatch Self="u223ColorGroupSwatch3" SwatchItemRef="Color/Black" />\n' +
+ '\t</ColorGroup>\n' +
+ '</Document>';
+
+ var xml:XML = new XML(xmlSource);
+ XML.ignoreProcessingInstructions = true;
+
+ var outString:String = xml.toString();
+ var expected:String = '<Document LinkedSpreads="undefined" DOMVersion="14.0" Self="d">\n' +
+ ' <Color Self="Color/Black" Model="Process" Space="CMYK" ColorValue="0 0 0 100" ColorOverride="Specialblack" AlternateSpace="NoAlternateColor" AlternateColorValue="" Name="Black" ColorEditable="false" ColorRemovable="false" Visible="true" SwatchCreatorID="7937" SwatchColorGroupReference="u223ColorGroupSwatch3"/>\n' +
+ ' <Swatch Self="Swatch/None" Name="None" ColorEditable="false" ColorRemovable="false" Visible="true" SwatchCreatorID="7937" SwatchColorGroupReference="u223ColorGroupSwatch0"/>\n' +
+ ' <Str Self="Str/$ID/Solid" Name="$ID/Solid"/>\n' +
+ ' <RCS Self="u77">\n' +
+ ' <CharacterStyle Self="CharacterStyle/$ID/[No character style]" Imported="false" Spl="false" EmitCss="true" StyleUniqueId="$ID/" IncludeClass="true" Name="$ID/[No character style]"/>\n' +
+ ' </RCS>\n' +
+ ' <Nu Self="Nu/$ID/[Default]" Name="$ID/[Default]" ContinueNumbersAcrossStories="false" ContinueNumbersAcrossDocuments="false"/>\n' +
+ ' <RootParagraphStyleGroup Self="u76"/>\n' +
+ ' <Story Self="u180" UserText="true" IsEndnoteStory="false" AppliedTOCStyle="n" TrackChanges="false" StoryTitle="$ID/" AppliedNamedGrid="n">\n' +
+ ' <StoryPreference OpticalMarginAlignment="false" OpticalMarginSize="12" FrameType="TextFrameType" StoryOrientation="Horizontal" StoryDirection="LeftToRightDirection"/>\n' +
+ ' <InCopyExportOption IncludeGraphicProxies="true" IncludeAllResources="false"/>\n' +
+ ' <ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/$ID/NormalParagraphStyle">\n' +
+ ' <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/$ID/[No character style]" PointSize="20">\n' +
+ ' <Content>a</Content>\n' +
+ ' <Br/>\n' +
+ ' <Content>s who work on the tickes.</Content>\n' +
+ ' </CharacterStyleRange>\n' +
+ ' </ParagraphStyleRange>\n' +
+ ' </Story>\n' +
+ ' <ColorGroup Self="ColorGroup/[Root Color Group]" Name="[Root Color Group]" IsRootColorGroup="true">\n' +
+ ' <ColorGroupSwatch Self="u223ColorGroupSwatch0" SwatchItemRef="Swatch/None"/>\n' +
+ ' <ColorGroupSwatch Self="u223ColorGroupSwatch3" SwatchItemRef="Color/Black"/>\n' +
+ ' </ColorGroup>\n' +
+ '</Document>';
+ //RoyaleUnitTestRunner.consoleOut('stringifyAdvanced3:\n' + outString);
+
+ //the order of toString output can be quite different for some browsers, but the length should be identical
+ assertTrue( outString.length == expected.length, 'unexpected toString result');
+ }
+
+
+ [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>;
+
+ assertEquals(
+ '<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')
+ }
+
+
+
+ }
+}
[royale-asjs] 01/03: Porting remnants of manualtests/UnitTests to
RoyaleUnit-compatible assertions
Posted by gr...@apache.org.
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 26b15418ae17f80e4887477500f8c5d10219e02e
Author: greg-dove <gr...@gmail.com>
AuthorDate: Thu Aug 8 11:55:21 2019 +1200
Porting remnants of manualtests/UnitTests to RoyaleUnit-compatible assertions
---
.../royale/flexUnitTests/core/ArrayTesterTest.as | 38 +++++++++++-----------
.../src/main/royale/flexUnitTests/core/MD5Test.as | 8 ++---
.../flexUnitTests/github/GithubIssues2018.as | 6 ++--
.../flexUnitTests/github/GithubIssues2019.as | 4 +--
4 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/manualtests/UnitTests/src/main/royale/flexUnitTests/core/ArrayTesterTest.as b/manualtests/UnitTests/src/main/royale/flexUnitTests/core/ArrayTesterTest.as
index d038de6..ed70a54 100644
--- a/manualtests/UnitTests/src/main/royale/flexUnitTests/core/ArrayTesterTest.as
+++ b/manualtests/UnitTests/src/main/royale/flexUnitTests/core/ArrayTesterTest.as
@@ -20,7 +20,7 @@ package flexUnitTests.core
{
- import flexunit.framework.Assert;
+ import org.apache.royale.test.asserts.*;
import flexUnitTests.core.support.TestVO;
/**
@@ -90,43 +90,43 @@ package flexUnitTests.core
[Test]
public function testSort():void
{
- Assert.assertTrue("Parked, needs more work", true);
+ assertTrue(true, "Parked, needs more work");
/*import testshim.RoyaleUnitTestRunner;
- /!*Assert.assertEquals('unexpected starting state',
+ /!*assertEquals(
'23,-93,-59,-55,41,-29,69,11,33,-71,83,87,27,-39,70,-50,-56,-61,17,-35,-60,-86,-78,-83,-10',
- values.toString());*!/
- Assert.assertEquals('unexpected starting state',
+ values.toString(), 'unexpected starting state');*!/
+ assertEquals(
'aB,aA,aC,aa,ab,ac,zA,ZA,zA,ZA,zA,zA,AA,AA',
- field1s.toString());
+ field1s.toString(), 'unexpected starting state');
field1s.sort();
- Assert.assertEquals('unexpected starting state',
+ assertEquals(
'AA,AA,ZA,ZA,aA,aB,aC,aa,ab,ac,zA,zA,zA,zA',
- field1s.toString());
+ field1s.toString(), 'unexpected starting state');
RoyaleUnitTestRunner.consoleOut('field1s ' + field1s.toString());
_sort(field1s, [Array.CASEINSENSITIVE]);
- Assert.assertEquals('unexpected starting state',
+ assertEquals(
'aa,AA,aA,AA,ab,aB,ac,aC,ZA,ZA,zA,zA,zA,zA',
- field1s.toString());
+ field1s.toString(), 'unexpected starting state');
_sort(field1s, [Array.DESCENDING]);
- Assert.assertEquals('unexpected starting state',
+ assertEquals(
'zA,zA,zA,zA,ac,ab,aa,aC,aB,aA,ZA,ZA,AA,AA',
- field1s.toString());
+ field1s.toString(), 'unexpected starting state');
// field1s.sort(Array.CASEINSENSITIVE);
RoyaleUnitTestRunner.consoleOut('field1s ' + field1s.toString());
_sort(field1s, [Array.DESCENDING|Array.CASEINSENSITIVE]);
- Assert.assertEquals('unexpected starting state',
+ assertEquals(
'zA,zA,zA,zA,ZA,ZA,ac,aC,ab,aB,AA,aA,aa,AA',
- field1s.toString());
+ field1s.toString(), 'unexpected starting state');
RoyaleUnitTestRunner.consoleOut('field1s ' + field1s.toString());*/
}
@@ -135,11 +135,11 @@ package flexUnitTests.core
[Test]
public function testSortOn():void
{
- Assert.assertTrue("Parked, needs more work", true);
+ assertTrue(true, "Parked, needs more work");
- /* Assert.assertEquals('unexpected starting state',
+ /* assertEquals(
'TestVO [aB]#0 [zz],TestVO [aA]#0 [aa],TestVO [aC]#1 [zz],TestVO [aa]#1 [aa],TestVO [ab]#-1 [zz],TestVO [ac]#-1 [aa],TestVO [zA]#0 [bb],TestVO [ZA]#0 [aa],TestVO [zA]#1 [bb],TestVO [ZA]#1 [aa],TestVO [zA]#-1 [bb],TestVO [zA]#-1 [aa],TestVO [AA]#0 [aa],TestVO [AA]#0 [zz]',
- items.toString());
+ items.toString(), 'unexpected starting state');
import testshim.RoyaleUnitTestRunner;
@@ -148,9 +148,9 @@ package flexUnitTests.core
items.sortOn('field1',0);
- Assert.assertEquals('unexpected sortOn result',
+ assertEquals(
'TestVO [AA]#0 [aa],TestVO [AA]#0 [zz],TestVO [ZA]#0 [aa],TestVO [ZA]#-1 [aa],TestVO [ZA]#1 [aa],TestVO [aA]#0 [zz],TestVO [aA]#-1 [zz],TestVO [aA]#-1 [aa],TestVO [aA]#0 [aa],TestVO [aA]#1 [aa],TestVO [aA]#1 [zz],TestVO [zA]#-1 [bb],TestVO [zA]#0 [bb],TestVO [zA]#1 [bb]',
- items.toString());
+ items.toString(), 'unexpected sortOn result');
diff --git a/manualtests/UnitTests/src/main/royale/flexUnitTests/core/MD5Test.as b/manualtests/UnitTests/src/main/royale/flexUnitTests/core/MD5Test.as
index 0c154cf..4cc0581 100644
--- a/manualtests/UnitTests/src/main/royale/flexUnitTests/core/MD5Test.as
+++ b/manualtests/UnitTests/src/main/royale/flexUnitTests/core/MD5Test.as
@@ -18,7 +18,7 @@
////////////////////////////////////////////////////////////////////////////////
package flexUnitTests.core
{
- import flexunit.framework.Assert;
+ import org.apache.royale.test.asserts.*;
import org.apache.royale.utils.MD5;
@@ -47,9 +47,9 @@ package flexUnitTests.core
[Test]
public function testHash():void
{
- Assert.assertEquals("Error testing foobaz", "80338e79d2ca9b9c090ebaaa2ef293c7", MD5.hash("foobaz"));
- Assert.assertEquals("Error testing bazfoo", "b6a013d5e2c00f894584ad577249dbc7", MD5.hash("bazfoo"));
- Assert.assertEquals("Error testing password1234", "bdc87b9c894da5168059e00ebffb9077", MD5.hash("password1234"));
+ assertEquals( "80338e79d2ca9b9c090ebaaa2ef293c7", MD5.hash("foobaz"), "Error testing foobaz");
+ assertEquals("b6a013d5e2c00f894584ad577249dbc7", MD5.hash("bazfoo"), "Error testing bazfoo");
+ assertEquals("bdc87b9c894da5168059e00ebffb9077", MD5.hash("password1234"), "Error testing password1234");
}
}
}
diff --git a/manualtests/UnitTests/src/main/royale/flexUnitTests/github/GithubIssues2018.as b/manualtests/UnitTests/src/main/royale/flexUnitTests/github/GithubIssues2018.as
index f9cb7b3..7728d55 100644
--- a/manualtests/UnitTests/src/main/royale/flexUnitTests/github/GithubIssues2018.as
+++ b/manualtests/UnitTests/src/main/royale/flexUnitTests/github/GithubIssues2018.as
@@ -18,7 +18,7 @@
////////////////////////////////////////////////////////////////////////////////
package flexUnitTests.github
{
- import flexunit.framework.Assert;
+ import org.apache.royale.test.asserts.*;
/**
* @royalesuppresspublicvarwarning
@@ -60,10 +60,10 @@ package flexUnitTests.github
//int
var test:* = new (Class(a.a))(-21.5);
- Assert.assertEquals('unexpected coercion check', -21, test);
+ assertEquals(-21, test, 'unexpected coercion check');
//uint
test = new (a.b as Class)(-21.5);
- Assert.assertEquals('unexpected coercion check', 4294967275, test);
+ assertEquals(4294967275, test, 'unexpected coercion check');
}
}
diff --git a/manualtests/UnitTests/src/main/royale/flexUnitTests/github/GithubIssues2019.as b/manualtests/UnitTests/src/main/royale/flexUnitTests/github/GithubIssues2019.as
index 8ae9640..647d93d 100644
--- a/manualtests/UnitTests/src/main/royale/flexUnitTests/github/GithubIssues2019.as
+++ b/manualtests/UnitTests/src/main/royale/flexUnitTests/github/GithubIssues2019.as
@@ -18,7 +18,7 @@
////////////////////////////////////////////////////////////////////////////////
package flexUnitTests.github
{
- import flexunit.framework.Assert;
+ import org.apache.royale.test.asserts.*;
/**
* @royalesuppresspublicvarwarning
@@ -59,7 +59,7 @@ package flexUnitTests.github
public function placeholdertestIssue_999():void
{
//https://github.com/apache/royale-asjs/issues/#
- Assert.assertTrue('replace me with a real issue', true)
+ assertTrue( true, 'replace me with a real issue');
}
}
}