You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ha...@apache.org on 2016/09/27 09:50:10 UTC
[25/28] git commit: [flex-asjs] [refs/heads/refactor-sprite] - Setup
for side-by-side Unit test view of swf and js, with flexuint shim,
added Reflection tests
Setup for side-by-side Unit test view of swf and js, with flexuint shim, added Reflection tests
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/438cb014
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/438cb014
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/438cb014
Branch: refs/heads/refactor-sprite
Commit: 438cb01497695389f9f0fa661fa1f2f6c909b6c2
Parents: 92c0a8b
Author: greg-dove <gr...@gmail.com>
Authored: Tue Sep 27 19:15:26 2016 +1300
Committer: greg-dove <gr...@gmail.com>
Committed: Tue Sep 27 19:53:06 2016 +1300
----------------------------------------------------------------------
manualtests/GenericTests/build.xml | 74 +++
manualtests/GenericTests/src/GenericTests.mxml | 39 ++
manualtests/GenericTests/src/MyInitialView.mxml | 193 +++++++
manualtests/GenericTests/src/README.txt | 61 ++
manualtests/GenericTests/src/TestClasses.as | 37 ++
.../src/flexUnitTests/CoreTester.as | 30 +
.../src/flexUnitTests/JiraIssuesTester.as | 29 +
.../src/flexUnitTests/ObservedBugsTester.as | 29 +
.../src/flexUnitTests/ReflectionTester.as | 29 +
.../flexUnitTests/core/BinaryDataTesterTest.as | 567 +++++++++++++++++++
.../src/flexUnitTests/core/StrandTesterTest.as | 55 ++
.../src/flexUnitTests/jira/JiraTesterTest.as | 73 +++
.../observedbugs/ObservedBugTests.as | 86 +++
.../reflection/ReflectionTesterTest.as | 368 ++++++++++++
.../reflection/support/ITestInterface.as | 27 +
.../reflection/support/ITestInterface2.as | 29 +
.../reflection/support/ITestInterface3.as | 27 +
.../reflection/support/ITestInterface4.as | 29 +
.../reflection/support/TestClass1.as | 91 +++
.../reflection/support/TestClass2.as | 103 ++++
.../reflection/support/TestClass3.as | 39 ++
.../reflection/support/TestClass4.as | 95 ++++
.../src/flexunit/framework/Assert.as | 305 ++++++++++
.../flexunit/framework/AssertionFailedError.as | 39 ++
.../src/testshim/FlexJSUnitTestRunner.as | 186 ++++++
.../GenericTests/src/testshim/TestResult.as | 56 ++
.../GenericTests/testsview/image/Flex.png | Bin 0 -> 3526 bytes
manualtests/GenericTests/testsview/index.html | 112 ++++
.../testsview/src/GenericTestsContainer.mxml | 32 ++
.../testsview/src/MyInitialView.mxml | 96 ++++
.../testsview/src/controllers/MyController.as | 52 ++
.../testsview/src/models/MyModel.as | 125 ++++
.../testsview/src/models/TestResultsModel.as | 40 ++
33 files changed, 3153 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/438cb014/manualtests/GenericTests/build.xml
----------------------------------------------------------------------
diff --git a/manualtests/GenericTests/build.xml b/manualtests/GenericTests/build.xml
new file mode 100644
index 0000000..092bd36
--- /dev/null
+++ b/manualtests/GenericTests/build.xml
@@ -0,0 +1,74 @@
+<?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="GenericTests" default="main" basedir=".">
+ <property name="FLEXJS_HOME" location="../.."/>
+ <property name="example" value="GenericTests" />
+
+
+ <!-- adding flexuint style meta collection, and additional testing meta tags (Event,Bindable,TestMeta)-->
+ <property name="theme_arg" value="-keep-as3-metadata+=Test,BeforeClass,AfterClass,Before,After,TestVariance,Event,Bindable,TestMeta" />
+ <property file="${FLEXJS_HOME}/env.properties"/>
+ <property environment="env"/>
+ <property file="${FLEXJS_HOME}/build.properties"/>
+ <property name="FLEX_HOME" value="${FLEXJS_HOME}"/>
+ <available file="${env.FALCON_HOME}/lib/falcon-mxmlc.jar"
+ type="file"
+ property="FALCON_HOME"
+ value="${env.FALCON_HOME}"/>
+
+ <available file="${FLEXJS_HOME}/../flex-falcon/compiler/generated/dist/sdk/lib/falcon-mxmlc.jar"
+ type="file"
+ property="FALCON_HOME"
+ value="${FLEXJS_HOME}/../flex-falcon/compiler/generated/dist/sdk"/>
+
+ <available file="${env.FALCONJX_HOME}/lib/jsc.jar"
+ type="file"
+ property="FALCONJX_HOME"
+ value="${env.FALCONJX_HOME}"/>
+
+ <available file="${FLEXJS_HOME}/../flex-falcon/compiler-jx/lib/jsc.jar"
+ type="file"
+ property="FALCONJX_HOME"
+ value="${FLEXJS_HOME}/../flex-falcon/compiler-jx"/>
+
+ <available file="${env.GOOG_HOME}/closure/goog/base.js"
+ type="file"
+ property="GOOG_HOME"
+ value="${env.GOOG_HOME}"/>
+
+ <available file="${FLEXJS_HOME}/js/lib/google/closure-library/closure/goog/base.js"
+ type="file"
+ property="GOOG_HOME"
+ value="${FLEXJS_HOME}/js/lib/google/closure-library"/>
+
+ <include file="${basedir}/../build_example.xml" />
+
+ <target name="main" depends="clean,build_example.compile,build_example.compilejs" description="Clean build of GenericTests">
+ </target>
+
+ <target name="clean">
+ <delete dir="${basedir}/bin" failonerror="false" />
+ <delete dir="${basedir}/bin-debug" failonerror="false" />
+ <delete dir="${basedir}/bin-release" failonerror="false" />
+ </target>
+
+</project>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/438cb014/manualtests/GenericTests/src/GenericTests.mxml
----------------------------------------------------------------------
diff --git a/manualtests/GenericTests/src/GenericTests.mxml b/manualtests/GenericTests/src/GenericTests.mxml
new file mode 100644
index 0000000..0db0af9
--- /dev/null
+++ b/manualtests/GenericTests/src/GenericTests.mxml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!---
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+-->
+<js:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:local="*"
+ xmlns:models="models.*"
+ xmlns:controllers="controllers.*"
+ xmlns:js="library://ns.apache.org/flexjs/basic"
+ >
+ <fx:Style>
+ @namespace js "library://ns.apache.org/flexjs/basic";
+ js|Application {
+ background-color:#ffffff ;
+ }
+ </fx:Style>
+ <js:valuesImpl>
+ <js:SimpleCSSValuesImpl />
+ </js:valuesImpl>
+ <js:initialView>
+ <local:MyInitialView />
+ </js:initialView>
+</js:Application>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/438cb014/manualtests/GenericTests/src/MyInitialView.mxml
----------------------------------------------------------------------
diff --git a/manualtests/GenericTests/src/MyInitialView.mxml b/manualtests/GenericTests/src/MyInitialView.mxml
new file mode 100644
index 0000000..2c8c966
--- /dev/null
+++ b/manualtests/GenericTests/src/MyInitialView.mxml
@@ -0,0 +1,193 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+<js:View xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:js="library://ns.apache.org/flexjs/basic"
+ xmlns:local="*"
+ xmlns:acc="org.apache.flex.html.accessories.*"
+ initComplete="runTests()"
+>
+
+ <fx:Style>
+ .title {
+ font-size: 14pt;
+ font-weight: bold;
+ }
+ .body {
+ left:10px;
+ right:10px;
+ }
+ </fx:Style>
+
+ <fx:Script>
+ <![CDATA[
+ import org.apache.flex.html.Label;
+ import org.apache.flex.reflection.VariableDefinition;
+ import org.apache.flex.reflection.getDefinitionByName;
+ import org.apache.flex.reflection.describeType;
+ import org.apache.flex.reflection.TypeDefinition;
+
+ import testshim.FlexJSUnitTestRunner;
+ import testshim.TestResult;
+
+
+
+ private var _tests:Array;
+
+ public function runTests():void {
+ var label:Label;
+ var groups:Array = TestClasses.testClasses;
+ var spaces:String = PLATFORM == "JS" ? " " : " ";
+ while (groups.length) {
+ var testGroupClass:Class = groups.shift() as Class;
+ var td:TypeDefinition = describeType(testGroupClass);
+ label = new Label();
+ label.text = "Running " + td.name + " Tests";
+ output.addElement(label);
+ var testClasses:Array = td.variables;
+ testClasses.sortOn("name");
+ var i:uint = 0, l:uint = testClasses.length;
+ if (l == 0) {
+ label = new Label();
+ label.text = spaces+ "[Zero tests detected]";
+ output.addElement(label);
+ continue;
+ }
+ for (; i < l; i++) {
+ var varDef:VariableDefinition = testClasses[i];
+
+ var testClass:Class = getDefinitionByName(varDef.type.qualifiedName) as Class;
+ fails = [];
+ passes = [];
+ variances = [];
+ warnings = [];
+ var runner:FlexJSUnitTestRunner = new FlexJSUnitTestRunner(testClass, onTestResult);
+ runner.runTests();
+ label = new Label();
+
+ label.text = "TEST: " + runner.testingName + spaces + "Passed:" + runner.successCount + ", Failed:" + runner.failCount + ", assertions made:" + runner.successfulAssertions;
+ label.style = {color: runner.failCount == 0 ? "green" : "red"};
+ output.addElement(label);
+ if (runner.failCount > 0 || fails.length) {
+ //show any failing test details
+ appendTestResults(fails);
+ }
+ if (variances.length) {
+ appendTestResults(variances);
+ }
+ if (warnings.length) {
+ appendTestResults(warnings);
+ }
+ }
+ }
+
+ }
+
+
+ private var fails:Array;
+ private var passes:Array;
+ private var variances:Array;
+ private var warnings:Array;
+ public function onTestResult(result:TestResult):void {
+ if (result.pass) passes.push(result);
+ else fails.push(result);
+
+ if (result.hasVariance && result.pass) {
+ if (result.varianceTarget.indexOf(PLATFORM) != -1) {
+ //variance applies to this target
+ variances.push(result);
+ }
+ }
+
+ if (result.warning!=null && result.pass && !result.hasVariance) {
+ // a test result that would otherwise indicate a pass, but has a warning
+ warnings.push(result);
+ }
+ }
+
+ public function appendTestResults(array:Array):void {
+ array = array.slice();
+ var spaces:String = " ";
+ var newline:String = "\n" ;
+ while (array.length) {
+ var result:TestResult = array.shift();
+ var label:Label = new Label();
+ //label.x=10; <- fails in js, using 'spaces' below instead
+ var message:String = spaces + result.toString(newline +spaces);
+
+ if (result.hasVariance)
+ message = spaces + "VARIANCE:" + result.varianceDescription + newline + message ;
+ if (result.warning != null) {
+ message = spaces + result.warning +newline +message;
+ }
+ if (PLATFORM == "JS") {
+ message = escapeForHtml(message);
+ var jsSpaces:String = spaces.split(" ").join(" ");
+ message = message.split(spaces).join(jsSpaces);
+ }
+
+ label.text = message;
+
+ if (result.pass) {
+ var showOrange:Boolean = false;
+ if (result.hasVariance || result.warning!=null) showOrange = true;
+ label.style = {color: showOrange ? 0xFFA500 : "green"};
+ } else label.style = {color: "red"};
+ output.addElement(label);
+ }
+ }
+
+ private static function escapeForHtml( string : String ) : String {
+ return string.split("<").join("<").split(">").join(">").split("\n").join("<br/>");
+ }
+
+
+ private static function getPlatform():String {
+ try {
+ var check:* = getDefinitionByName("flash.system.Capabilities");
+ } catch (e:Error) {
+ return "JS";
+ }
+ //if this next reference to 'check' is not included, then the above try/catch code
+ // appears to be optimized away in js-release mode
+ //[this issue was added to ObservedBugs Tests]
+ if (check == null) {
+ return "JS";
+ }
+ return "SWF";
+ }
+
+ public static const PLATFORM:String = getPlatform();
+ ]]>
+ </fx:Script>
+ <js:beads>
+ <js:ViewDataBinding/>
+ </js:beads>
+ <js:Container id="cont" height="50" className="body">
+ <js:beads>
+ <js:VerticalLayout />
+ </js:beads>
+ <js:Label text="{PLATFORM} Cross-compiled Unit Tests" className="title" />
+ </js:Container>
+ <js:Container id="output" height="700" y="50" className="body">
+ <js:beads>
+ <js:VerticalLayout />
+ </js:beads>
+ </js:Container>
+</js:View>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/438cb014/manualtests/GenericTests/src/README.txt
----------------------------------------------------------------------
diff --git a/manualtests/GenericTests/src/README.txt b/manualtests/GenericTests/src/README.txt
new file mode 100644
index 0000000..4ef6e3f
--- /dev/null
+++ b/manualtests/GenericTests/src/README.txt
@@ -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.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+DESCRIPTION
+
+The GenericTests application is a very basic form of unit testing primarily
+intended for FlexJS framework developers. It is a 'lite' version of a small portion of
+Flexunit code to support basic assertion tests.
+
+This Flex application may be run as a Flash SWF or cross-compiled (using Falcon JX)
+into JavaScript and HTML and run without Flash.
+
+There is a convenience html page for hosting the tests side-by-side that permits developers
+to refresh the test builds simultaneously and compare results in the browser, including the
+ability to toggle between JS-Debug and JS-Release builds.
+While this is primarily intended for framework developers, it may be useful as a starting point
+for cross-compiled unit testing (during development only) in regular FlexJS projects.
+
+FRAMEWORK DEVELOPER NOTES
+To add new tests, follow the examples inside the flexUnitTests package, and add any new Test
+group or category level class (the classes directly inside flexUnitTests package) into the top
+level TestClasses.as file. This should be all that is necessary to add new tests.
+
+MetaData
+[BeforeClass] -same as flexunit (typical: 'setupBeforClass')- runs a static method before the test class is instantiated
+[AfterClass] -same as flexunit (typical: 'tearDownAfterClass')- runs a static method after the test class has been processed
+[Before] -same as flexunit (typical: 'setup') - runs an instance method before the test class' test methods are processed
+[After] -same as flexunit (typical: 'tearDown') - runs an instance method after the test class' test methods are processed
+[Test] -same as flexunit (typical: 'testXXXX') - denotes a test method. No assumption about order of test methods being called should be made
+
+[TestVariance(variance="JS",description="Reason for variation in JS expected results")]
+The above is specific to this test app, and permits annotation of test methods where the expected results are different between compiler targets.
+The variance key in the meta data should be either "SWF" or "JS". This is the compiler target with the result that is considered to be different
+to what it ideally 'should be', but correct as per the current implementation of the framework. Usually this will be "JS". It indicates a known
+but currently acceptable difference between compiler targets.
+
+
+GENERAL NOTES
+
+In its first working version this app only supports synchronous simple assertions and
+is intended to use test classes that are compatible with the flexunit tests that are
+used in the full framework build. Future versions may include more advanced features.
+
+The cross-compilation to JavaScript often results in non-fatal warnings. Some of these warnings
+should be addressed in future releases of the Falcon JX compiler.
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/438cb014/manualtests/GenericTests/src/TestClasses.as
----------------------------------------------------------------------
diff --git a/manualtests/GenericTests/src/TestClasses.as b/manualtests/GenericTests/src/TestClasses.as
new file mode 100644
index 0000000..f7273c0
--- /dev/null
+++ b/manualtests/GenericTests/src/TestClasses.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
+{
+ //test groups
+ import flexUnitTests.*;
+
+
+ public class TestClasses
+ {
+
+ public static function get testClasses():Array {
+ return [
+ CoreTester,
+ ReflectionTester,
+ ObservedBugsTester,
+ JiraIssuesTester
+ ];
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/438cb014/manualtests/GenericTests/src/flexUnitTests/CoreTester.as
----------------------------------------------------------------------
diff --git a/manualtests/GenericTests/src/flexUnitTests/CoreTester.as b/manualtests/GenericTests/src/flexUnitTests/CoreTester.as
new file mode 100644
index 0000000..56531d0
--- /dev/null
+++ b/manualtests/GenericTests/src/flexUnitTests/CoreTester.as
@@ -0,0 +1,30 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.core.*
+
+ [Suite]
+ [RunWith("org.flexunit.runners.Suite")]
+ public class CoreTester
+ {
+ public var strandTesterTest:StrandTesterTest;
+ public var binaryDataTesterTest:BinaryDataTesterTest;
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/438cb014/manualtests/GenericTests/src/flexUnitTests/JiraIssuesTester.as
----------------------------------------------------------------------
diff --git a/manualtests/GenericTests/src/flexUnitTests/JiraIssuesTester.as b/manualtests/GenericTests/src/flexUnitTests/JiraIssuesTester.as
new file mode 100644
index 0000000..fc37533
--- /dev/null
+++ b/manualtests/GenericTests/src/flexUnitTests/JiraIssuesTester.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
+{
+ import flexUnitTests.jira.*
+
+ [Suite]
+ [RunWith("org.flexunit.runners.Suite")]
+ public class JiraIssuesTester
+ {
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/438cb014/manualtests/GenericTests/src/flexUnitTests/ObservedBugsTester.as
----------------------------------------------------------------------
diff --git a/manualtests/GenericTests/src/flexUnitTests/ObservedBugsTester.as b/manualtests/GenericTests/src/flexUnitTests/ObservedBugsTester.as
new file mode 100644
index 0000000..e01b7c2
--- /dev/null
+++ b/manualtests/GenericTests/src/flexUnitTests/ObservedBugsTester.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
+{
+ import flexUnitTests.observedbugs.*
+
+ [Suite]
+ [RunWith("org.flexunit.runners.Suite")]
+ public class ObservedBugsTester
+ {
+ public var observedBugsTest1:ObservedBugTests;
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/438cb014/manualtests/GenericTests/src/flexUnitTests/ReflectionTester.as
----------------------------------------------------------------------
diff --git a/manualtests/GenericTests/src/flexUnitTests/ReflectionTester.as b/manualtests/GenericTests/src/flexUnitTests/ReflectionTester.as
new file mode 100644
index 0000000..2feaa14
--- /dev/null
+++ b/manualtests/GenericTests/src/flexUnitTests/ReflectionTester.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
+{
+ import flexUnitTests.reflection.*;
+
+ [Suite]
+ [RunWith("org.flexunit.runners.Suite")]
+ public class ReflectionTester
+ {
+ public var reflectionTesterTest:ReflectionTesterTest;
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/438cb014/manualtests/GenericTests/src/flexUnitTests/core/BinaryDataTesterTest.as
----------------------------------------------------------------------
diff --git a/manualtests/GenericTests/src/flexUnitTests/core/BinaryDataTesterTest.as b/manualtests/GenericTests/src/flexUnitTests/core/BinaryDataTesterTest.as
new file mode 100644
index 0000000..b10d18c
--- /dev/null
+++ b/manualtests/GenericTests/src/flexUnitTests/core/BinaryDataTesterTest.as
@@ -0,0 +1,567 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.core
+{
+
+
+ import org.apache.flex.utils.Endian;
+ import flexunit.framework.Assert;
+ import org.apache.flex.utils.BinaryData
+
+
+ public class BinaryDataTesterTest
+ {
+
+ [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:BinaryData,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 reversedBytesMatch(bd1:BinaryData,bd2:BinaryData,len:uint,offset:int=0):Boolean{
+ var end:uint=offset+len;
+ for (var i:int=offset;i<end;i++) {
+ if (bd1.readByteAt(i) != bd2.readByteAt(end-1-i)) return false;
+ }
+ return true;
+
+ }
+
+
+ [Test]
+ public function testBasicPositionAndLength():void
+ {
+ var ba:BinaryData = new BinaryData();
+
+ Assert.assertEquals("new Instance, position", 0, ba.position);
+ Assert.assertEquals("new Instance, length", 0, ba.length);
+
+ ba.position=100;
+ Assert.assertEquals("position change, position", 100, ba.position);
+ Assert.assertEquals("position change, length", 0, ba.length);
+ Assert.assertEquals("position change, length", 0, ba.bytesAvailable);
+
+ ba.length=100;
+ Assert.assertEquals("length change, position", 100, ba.position);
+ Assert.assertEquals("length change, length", 100, ba.length);
+
+ ba.length=50;
+ Assert.assertEquals("length change, position", 50, ba.position);
+ Assert.assertEquals("length change, length", 50, ba.length);
+
+
+ }
+
+ [Test]
+ public function testAdvancedPositionAndLength():void
+ {
+ var ba:BinaryData = new BinaryData();
+
+ ba.position=100;
+ ba.length=100;
+
+ ba.writeByteAt(49,255);
+ Assert.assertEquals("writeByteAt does not affect position",100, ba.position);
+ Assert.assertEquals("writeByteAt (internal) does not affect length",100, ba.length);
+
+ ba.readByteAt(48);
+ Assert.assertEquals("readByteAt does not affect position",100, ba.position);
+ Assert.assertEquals("readByteAt does not affect length",100, ba.length);
+
+ ba.writeByteAt(199,255);
+ Assert.assertEquals("writeByteAt (beyond length) does affect length",200, ba.length);
+ Assert.assertEquals("writeByteAt (beyond length) does not affect position",100, ba.position);
+
+ Assert.assertStrictlyEquals("out of range byte read request",0 ,ba.readByteAt(205));
+
+ }
+
+
+ [Test]
+ public function testUTFWritePosition():void
+ {
+ var ba:BinaryData = new BinaryData();
+ ba.writeUTF('This is a test');
+ //writeUTF
+ Assert.assertEquals("basic post-writeUTF position", 16, ba.position);
+ ba=new BinaryData();
+ ba.writeUTFBytes('This is a test');
+ //writeUTFBytes
+ Assert.assertEquals("basic post-writeUTFBytes position", 14, ba.position);
+
+ //overlapping
+ ba.position=5;
+ ba.writeUTFBytes('This is a test');
+ Assert.assertEquals("Advanced post-writeUTFBytes position (overlap)", 19, ba.position);
+
+ }
+
+ [Test]
+ public function testBooleanRoundTripping():void
+ {
+ var ba:BinaryData = new BinaryData();
+ ba.writeBoolean(true);
+ ba.writeBoolean(false);
+ ba.position = 0;
+ Assert.assertTrue(ba.readBoolean());
+ Assert.assertFalse(ba.readBoolean());
+ }
+
+ [Test]
+ public function testByteRoundTripping():void
+ {
+ var ba:BinaryData = new BinaryData();
+ ba.writeByte(255);
+ ba.writeByte(256);
+ ba.writeByte(-256);
+ ba.writeByte(-257);
+ ba.writeByte(-128);
+ ba.writeByte(128);
+ ba.writeByte(127);
+ ba.writeByte(-50);
+ ba.writeByte(50);
+ ba.position = 0;
+
+
+ Assert.assertEquals("Error testing post writeByte/readByte round-tripping", -1, ba.readByte());
+ Assert.assertEquals("Error testing post writeByte/readByte round-tripping", 0, ba.readByte());
+ Assert.assertEquals("Error testing post writeByte/readByte round-tripping", 0, ba.readByte());
+ Assert.assertEquals("Error testing post writeByte/readByte round-tripping", -1, ba.readByte());
+ Assert.assertEquals("Error testing post writeByte/readByte round-tripping", -128, ba.readByte());
+ Assert.assertEquals("Error testing post writeByte/readByte round-tripping", -128, ba.readByte());
+ Assert.assertEquals("Error testing post writeByte/readByte round-tripping", 127, ba.readByte());
+ Assert.assertEquals("Error testing post writeByte/readByte round-tripping", -50, ba.readByte());
+ Assert.assertEquals("Error testing post writeByte/readByte round-tripping", 50, ba.readByte());
+ }
+
+
+ [Test]
+ public function testUnsignedByteRoundTripping():void
+ {
+ var ba:BinaryData = new BinaryData();
+ ba.writeByte(255);
+ ba.writeByte(256);
+ ba.writeByte(-256);
+ ba.writeByte(-257);
+ ba.writeByte(-128);
+ ba.writeByte(128);
+ ba.writeByte(127);
+ ba.writeByte(-50);
+ ba.writeByte(50);
+ ba.position = 0;
+ //check read values
+
+ Assert.assertEquals("Error testing post writeByte/readUnsignedByte round-tripping", 255, ba.readUnsignedByte());
+ Assert.assertEquals("Error testing post writeByte/readUnsignedByte round-tripping", 0, ba.readUnsignedByte());
+ Assert.assertEquals("Error testing post writeByte/readUnsignedByte round-tripping", 0, ba.readUnsignedByte());
+ Assert.assertEquals("Error testing post writeByte/readUnsignedByte round-tripping", 255, ba.readUnsignedByte());
+ Assert.assertEquals("Error testing post writeByte/readUnsignedByte round-tripping", 128, ba.readUnsignedByte());
+ Assert.assertEquals("Error testing post writeByte/readUnsignedByte round-tripping", 128, ba.readUnsignedByte());
+ Assert.assertEquals("Error testing post writeByte/readUnsignedByte round-tripping", 127, ba.readUnsignedByte());
+ Assert.assertEquals("Error testing post writeByte/readUnsignedByte round-tripping", 206, ba.readUnsignedByte());
+ Assert.assertEquals("Error testing post writeByte/readUnsignedByte round-tripping", 50, ba.readUnsignedByte());
+ }
+
+
+ [Test]
+ public function testBasicEndian():void
+ {
+
+ var systemEndian:String = Endian.systemEndian;
+ //check we have a decisive systemEndian detection
+ Assert.assertNotNull(systemEndian );
+
+
+ var ba:BinaryData = new BinaryData();
+ var defaultEndian:String = ba.endian;
+
+ var alternateEndian:String = (defaultEndian == Endian.BIG_ENDIAN) ? Endian.LITTLE_ENDIAN : Endian.BIG_ENDIAN;
+ var expected:Object ={};
+ expected[Endian.BIG_ENDIAN] = 218038271;
+ expected[Endian.LITTLE_ENDIAN] = 4294966796;
+ var bytes:Array = [12, 254, 255, 255];
+ for each(var byte:uint in bytes) ba.writeByte(byte);
+ ba.position = 0;
+
+ Assert.assertEquals("testing endian:"+defaultEndian, expected[defaultEndian] , ba.readUnsignedInt());
+
+ ba.position = 0;
+ ba.endian = alternateEndian;
+ var result:uint = ba.readUnsignedInt();
+
+ Assert.assertEquals("testing endian:"+alternateEndian, expected[alternateEndian], result);
+
+ ba.position = 0;
+ ba.endian = defaultEndian;
+ Assert.assertEquals("testing endian:"+defaultEndian, int(expected[defaultEndian]), ba.readInt());
+
+ ba.position = 0;
+ ba.endian = alternateEndian;
+ Assert.assertEquals("testing endian:"+alternateEndian, int(expected[alternateEndian]), ba.readInt());
+
+ var leBA:BinaryData = new BinaryData();
+ leBA.endian = Endian.LITTLE_ENDIAN;
+ var beBA:BinaryData = new BinaryData();
+ beBA.endian = Endian.BIG_ENDIAN;
+ //int writing
+ beBA.writeInt(-500);
+ leBA.writeInt(-500);
+ //check they represent reversed byte sequence
+ Assert.assertTrue(reversedBytesMatch(beBA,leBA,4));
+ beBA.position=0;
+ leBA.position=0;
+ //check they each read back to the same uint value
+ Assert.assertEquals('big endian',4294966796,beBA.readUnsignedInt());
+ Assert.assertEquals('little endian',4294966796,leBA.readUnsignedInt());
+
+ beBA.position=0;
+ leBA.position=0;
+ //uint writing
+ beBA.writeUnsignedInt(4294966796);
+ leBA.writeUnsignedInt(4294966796);
+ //check they represent reversed byte sequence
+ Assert.assertTrue(reversedBytesMatch(beBA,leBA,4));
+ beBA.position=0;
+ leBA.position=0;
+ //check they each read back to the same uint value
+ Assert.assertEquals('big endian',4294966796,beBA.readUnsignedInt());
+ Assert.assertEquals('little endian',4294966796,leBA.readUnsignedInt());
+
+
+ beBA.position=0;
+ leBA.position=0;
+
+ //check they each read back to the same int value
+ Assert.assertEquals('big endian',-500,beBA.readInt());
+ Assert.assertEquals('little endian',-500,leBA.readInt());
+
+
+ beBA.position=0;
+ leBA.position=0;
+
+ //short writing
+ beBA.writeShort(-500);
+ leBA.writeShort(-500);
+ //check they represent reversed byte sequence
+ Assert.assertTrue(reversedBytesMatch(beBA,leBA,2));
+ beBA.position=0;
+ leBA.position=0;
+ //check they each read back to the same uint value
+ Assert.assertEquals('big endian',65036,beBA.readUnsignedShort());
+ Assert.assertEquals('little endian',65036,leBA.readUnsignedShort());
+
+
+ beBA.position=0;
+ leBA.position=0;
+
+ //check they each read back to the same int value
+ Assert.assertEquals('big endian',-500,beBA.readShort());
+ Assert.assertEquals('little endian',-500,leBA.readShort());
+
+ }
+
+
+ [Test]
+ public function testUTFRoundtripping():void
+ {
+
+ //test big-endian round-tripping
+ var ba:BinaryData = new BinaryData();
+ ba.endian = Endian.BIG_ENDIAN;
+ ba.writeUTF('This is a test');
+ //writeUTF
+ Assert.assertEquals("basic post-writeUTF position", 16, ba.position);
+ ba.position = 0;
+ Assert.assertEquals("utf big endian round-tripping", 'This is a test', ba.readUTF());
+
+ ba = new BinaryData();
+ //test little-endian round-tripping
+ ba.endian = Endian.LITTLE_ENDIAN;
+ ba.writeUTF('This is a test');
+ //writeUTF
+ Assert.assertEquals("basic post-writeUTF position", 16, ba.position);
+ ba.position = 0;
+ Assert.assertEquals("utf big endian round-tripping", 'This is a test', ba.readUTF());
+
+ }
+
+
+ [Test]
+ public function testShortRoundTripping():void
+ {
+ var ba:BinaryData = new BinaryData();
+ //test LITTLE_ENDIAN round-tripping
+ ba.endian = Endian.LITTLE_ENDIAN;
+ ba.writeShort(255);
+ ba.writeShort(-50);
+ ba.writeShort(50);
+ ba.position = 0;
+
+ Assert.assertEquals("Error testing post writeShort/readShort round-tripping", 6, ba.length);
+ Assert.assertEquals("Error testing post writeShort/readShort round-tripping", 255, ba.readShort());
+ Assert.assertEquals("Error testing post writeShort/readShort round-tripping", -50, ba.readShort());
+ Assert.assertEquals("Error testing post writeShort/readShort round-tripping", 50, ba.readShort());
+
+ //test BIG_ENDIAN round-tripping
+
+ ba.position = 0;
+ ba.endian = Endian.BIG_ENDIAN ;
+ ba.writeShort(255);
+ ba.writeShort(-50);
+ ba.writeShort(50);
+ ba.position = 0;
+
+ Assert.assertEquals("Error testing post writeShort/readShort round-tripping", 6, ba.length);
+ Assert.assertEquals("Error testing post writeShort/readShort round-tripping", 255, ba.readShort());
+ Assert.assertEquals("Error testing post writeShort/readShort round-tripping", -50, ba.readShort());
+ Assert.assertEquals("Error testing post writeShort/readShort round-tripping", 50, ba.readShort());
+ }
+
+
+ [Test]
+ public function testUnsignedShortRoundTripping():void
+ {
+ var ba:BinaryData = new BinaryData();
+ //test LITTLE_ENDIAN round-tripping
+ ba.endian = Endian.LITTLE_ENDIAN;
+ ba.writeShort(255);
+ ba.writeShort(-50);
+ ba.writeShort(50);
+ ba.position = 0;
+
+ Assert.assertEquals("Error testing post unsigned writeShort/readShort round-tripping", 6, ba.length);
+ Assert.assertEquals("Error testing post unsigned writeShort/readShort round-tripping", 255, ba.readUnsignedShort());
+ Assert.assertEquals("Error testing post unsigned writeShort/readShort round-tripping", 65486, ba.readUnsignedShort());
+ Assert.assertEquals("Error testing post unsigned writeShort/readShort round-tripping", 50, ba.readUnsignedShort());
+
+ //test BIG_ENDIAN round-tripping
+
+ ba.position = 0;
+ ba.endian = Endian.BIG_ENDIAN ;
+ ba.writeShort(255);
+ ba.writeShort(-50);
+ ba.writeShort(50);
+ ba.position = 0;
+
+ Assert.assertEquals("Error testing post unsigned writeShort/readShort round-tripping", 6, ba.length);
+ Assert.assertEquals("Error testing post unsigned writeShort/readShort round-tripping", 255, ba.readUnsignedShort());
+ Assert.assertEquals("Error testing post unsigned writeShort/readShort round-tripping", 65486, ba.readUnsignedShort());
+ Assert.assertEquals("Error testing post unsigned writeShort/readShort round-tripping", 50, ba.readUnsignedShort());
+ }
+
+ [Test]
+ public function testIntRoundTripping():void
+ {
+ var ba:BinaryData = new BinaryData();
+ //test LITTLE_ENDIAN round-tripping
+ ba.endian = Endian.LITTLE_ENDIAN;
+ ba.writeInt(65536);
+ ba.writeInt(-50);
+ ba.writeInt(50);
+ ba.position = 0;
+
+ Assert.assertEquals("Error testing post writeInt/readInt round-tripping", 12, ba.length);
+ Assert.assertEquals("Error testing post writeInt/readInt round-tripping", 65536, ba.readInt());
+ Assert.assertEquals("Error testing post writeInt/readInt round-tripping", -50, ba.readInt());
+ Assert.assertEquals("Error testing post writeInt/readInt round-tripping", 50, ba.readInt());
+
+ //test BIG_ENDIAN round-tripping
+
+ ba.position = 0;
+ ba.endian = Endian.BIG_ENDIAN ;
+ ba.writeInt(65536);
+ ba.writeInt(-50);
+ ba.writeInt(50);
+ ba.position = 0;
+
+ Assert.assertEquals("Error testing post writeInt/readInt round-tripping", 12, ba.length);
+ Assert.assertEquals("Error testing post writeInt/readInt round-tripping", 65536, ba.readInt());
+ Assert.assertEquals("Error testing post writeInt/readInt round-tripping", -50, ba.readInt());
+ Assert.assertEquals("Error testing post writeInt/readInt round-tripping", 50, ba.readInt());
+ }
+
+
+ [Test]
+ public function testUnsignedIntRoundTripping():void
+ {
+ var ba:BinaryData = new BinaryData();
+ //test LITTLE_ENDIAN round-tripping
+ ba.endian = Endian.LITTLE_ENDIAN;
+ ba.writeUnsignedInt(65536);
+ ba.writeUnsignedInt(-50);
+ ba.writeUnsignedInt(50);
+ ba.position = 0;
+
+ Assert.assertEquals("Error testing post writeInt/readInt round-tripping", 12, ba.length);
+ Assert.assertEquals("Error testing post writeInt/readInt round-tripping",65536, ba.readUnsignedInt());
+ Assert.assertEquals("Error testing post writeInt/readInt round-tripping", 4294967246, ba.readUnsignedInt());
+ Assert.assertEquals("Error testing post writeInt/readInt round-tripping", 50, ba.readUnsignedInt());
+
+ //test BIG_ENDIAN round-tripping
+
+ ba.position = 0;
+ ba.endian = Endian.BIG_ENDIAN ;
+ ba.writeUnsignedInt(65536);
+ ba.writeUnsignedInt(-50);
+ ba.writeUnsignedInt(50);
+ ba.position = 0;
+
+ Assert.assertEquals("Error testing post writeInt/readInt round-tripping", 12, ba.length);
+ Assert.assertEquals("Error testing post writeInt/readInt round-tripping",65536, ba.readUnsignedInt());
+ Assert.assertEquals("Error testing post writeInt/readInt round-tripping", 4294967246, ba.readUnsignedInt());
+ Assert.assertEquals("Error testing post writeInt/readInt round-tripping", 50, ba.readUnsignedInt());
+ }
+
+ [Test]
+ public function testFloatRoundTripping():void
+ {
+ var ble:BinaryData = new BinaryData();
+ //test LITTLE_ENDIAN round-tripping
+ ble.endian = Endian.LITTLE_ENDIAN;
+ ble.writeFloat(86.54);
+
+
+ Assert.assertEquals("Error testing post writeFloat/readFloat round-tripping", 4, ble.length);
+ Assert.assertEquals("Error testing post writeFloat/readFloat round-tripping", 4, ble.position);
+ //check bytes to account for precision loss between double and float comparisons
+ Assert.assertTrue("Error testing post writeFloat/readFloat round-tripping", bytesMatchExpectedData(ble,[123,20,173,66]));
+
+ var bbe:BinaryData = new BinaryData();
+ //test BIG_ENDIAN round-tripping
+ bbe.endian = Endian.BIG_ENDIAN;
+ bbe.writeFloat(86.54);
+
+
+ Assert.assertEquals("Error testing post writeFloat/readFloat round-tripping", 4, bbe.length);
+ Assert.assertEquals("Error testing post writeFloat/readFloat round-tripping", 4, bbe.position);
+ //check bytes to account for precision loss between double and float comparisons
+ Assert.assertTrue("Error testing post writeFloat/readFloat round-tripping", bytesMatchExpectedData(bbe,[66,173,20,123]));
+
+
+ }
+
+
+ [Test]
+ public function testDoubleRoundTripping():void
+ {
+
+ var ble:BinaryData = new BinaryData();
+ //test LITTLE_ENDIAN round-tripping
+ ble.endian = Endian.LITTLE_ENDIAN;
+ ble.writeDouble(86.54);
+
+
+ Assert.assertEquals("Error testing post writeDouble/readDouble round-tripping", 8, ble.length);
+ Assert.assertEquals("Error testing post writeDouble/readDouble round-tripping", 8, ble.position);
+
+ //check bytes
+ Assert.assertTrue("Error testing post writeDouble/readDouble round-tripping", bytesMatchExpectedData(ble,[195,245,40,92,143,162,85,64]));
+
+ var bbe:BinaryData = new BinaryData();
+ //test BIG_ENDIAN round-tripping
+ bbe.endian = Endian.BIG_ENDIAN;
+ bbe.writeDouble(86.54);
+
+
+ Assert.assertEquals("Error testing post writeDouble/readDouble round-tripping", 8, bbe.length);
+ Assert.assertEquals("Error testing post writeDouble/readDouble round-tripping", 8, bbe.position);
+ //check bytes
+
+ Assert.assertTrue("Error testing post writeDouble/readDouble round-tripping", bytesMatchExpectedData(bbe,[64,85,162,143,92,40,245,195]));
+
+
+ ble.position = 0;
+ bbe.position = 0;
+ Assert.assertEquals("Error testing post writeDouble/readDouble round-tripping", 86.54, bbe.readDouble());
+ Assert.assertEquals("Error testing post writeDouble/readDouble round-tripping", 86.54, ble.readDouble());
+
+ Assert.assertEquals("Error testing post writeDouble/readDouble round-tripping", 8, bbe.position);
+ Assert.assertEquals("Error testing post writeDouble/readDouble round-tripping", 8, ble.position);
+
+ }
+
+
+
+ [Test]
+ public function testWriteBytes():void
+ {
+ var ba:BinaryData = new BinaryData();
+ for (var i:int=0;i<50;i++) ba.writeByte(i);
+
+
+ var newBa:BinaryData = new BinaryData();
+ newBa.writeBytes(ba);
+
+ Assert.assertEquals("BinaryData writeBytes: length", 50, newBa.length);
+ Assert.assertEquals("BinaryData writeBytes: position", 50, newBa.position);
+
+ for (i=0;i<50;i++) {
+ Assert.assertEquals("BinaryData writeBytes: content check", i, newBa.array[i]);
+ }
+
+
+
+ }
+
+ [Test]
+ public function testReadBytes():void
+ {
+ var ba:BinaryData = new BinaryData();
+ for (var i:int=0;i<50;i++) ba.writeByte(i);
+ ba.position=0;
+ var newBa:BinaryData = new BinaryData();
+
+ ba.readBytes(newBa,5,10);
+ Assert.assertEquals("BinaryData readBytes: position", 10, ba.position);
+ Assert.assertEquals("BinaryData readBytes: length", 15, newBa.length);
+ Assert.assertEquals("BinaryData readBytes: position", 0, newBa.position);
+ var expected:Array = [0,0,0,0,0,0,1,2,3,4,5,6,7,8,9];
+ for (i=5;i<15;i++) {
+ Assert.assertEquals("BinaryData readBytes: content check", expected[i], newBa.array[i]);
+ }
+ }
+
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/438cb014/manualtests/GenericTests/src/flexUnitTests/core/StrandTesterTest.as
----------------------------------------------------------------------
diff --git a/manualtests/GenericTests/src/flexUnitTests/core/StrandTesterTest.as b/manualtests/GenericTests/src/flexUnitTests/core/StrandTesterTest.as
new file mode 100644
index 0000000..f6715bb
--- /dev/null
+++ b/manualtests/GenericTests/src/flexUnitTests/core/StrandTesterTest.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.core
+{
+ import flexunit.framework.Assert;
+
+ import org.apache.flex.core.Strand;
+
+ public class StrandTesterTest
+ {
+ [Before]
+ public function setUp():void
+ {
+ }
+
+ [After]
+ public function tearDown():void
+ {
+ }
+
+ [BeforeClass]
+ public static function setUpBeforeClass():void
+ {
+ }
+
+ [AfterClass]
+ public static function tearDownAfterClass():void
+ {
+ }
+
+ [Test]
+ public function testIdProperty():void
+ {
+ var strand:Strand = new Strand();
+ strand.id = "foo";
+ Assert.assertEquals("Error testing Srand.id", "foo",strand.id);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/438cb014/manualtests/GenericTests/src/flexUnitTests/jira/JiraTesterTest.as
----------------------------------------------------------------------
diff --git a/manualtests/GenericTests/src/flexUnitTests/jira/JiraTesterTest.as b/manualtests/GenericTests/src/flexUnitTests/jira/JiraTesterTest.as
new file mode 100644
index 0000000..c361f39
--- /dev/null
+++ b/manualtests/GenericTests/src/flexUnitTests/jira/JiraTesterTest.as
@@ -0,0 +1,73 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.jira
+{
+ import flexunit.framework.Assert;
+
+
+ public class JiraTesterTest
+ {
+ public static var isJS:Boolean;
+ [BeforeClass]
+ public static function setUpBeforeClass():void
+ {
+ var js:Boolean = false;
+ try {
+ var check:* = getDefinitionByName("flash.system.Capabilities");
+ } catch (e:Error) {
+ js = true;
+ }
+ //if this next reference to 'check' is not included, then the above try/catch code
+ // appears to be optimized away in js-release mode
+ //todo: this is inconsistent with swf, need to create simple test case for jx compiler/gcc
+ if (check == null) {
+ js = true;
+ }
+ isJS = js;
+ }
+
+ [AfterClass]
+ public static function tearDownAfterClass():void
+ {
+ }
+
+
+ [Before]
+ public function setUp():void
+ {
+ }
+
+ [After]
+ public function tearDown():void
+ {
+ }
+
+
+ /*
+ // TEST METHODS
+ */
+
+ //example, postfix the test method with JIRA issue reference:
+ /*[Test]
+ public function testJIRA_FLEX_9999():void
+ {
+
+ }*/
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/438cb014/manualtests/GenericTests/src/flexUnitTests/observedbugs/ObservedBugTests.as
----------------------------------------------------------------------
diff --git a/manualtests/GenericTests/src/flexUnitTests/observedbugs/ObservedBugTests.as b/manualtests/GenericTests/src/flexUnitTests/observedbugs/ObservedBugTests.as
new file mode 100644
index 0000000..0a805cc
--- /dev/null
+++ b/manualtests/GenericTests/src/flexUnitTests/observedbugs/ObservedBugTests.as
@@ -0,0 +1,86 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.observedbugs
+{
+ import flexunit.framework.Assert;
+ import org.apache.flex.reflection.*;
+
+ public class ObservedBugTests
+ {
+
+ public static var isJS:Boolean;
+ [BeforeClass]
+ public static function setUpBeforeClass():void
+ {
+ var js:Boolean = false;
+ try {
+ var check:* = getDefinitionByName("flash.system.Capabilities");
+ } catch (e:Error) {
+ js = true;
+ }
+ //if this next reference to 'check' is not included, then the above try/catch code
+ // appears to be optimized away in js-release mode
+ //todo: this is inconsistent with swf, need to create simple test case for jx compiler/gcc
+ if (check == null) {
+ js = true;
+ }
+ isJS = js;
+ }
+
+ [AfterClass]
+ public static function tearDownAfterClass():void
+ {
+ }
+
+ [Before]
+ public function setUp():void
+ {
+ }
+
+ [After]
+ public function tearDown():void
+ {
+ }
+
+
+ [TestVariance(variance="JS",description="Variance in test, this test fails in JS-Release mode only")]
+ [Test]
+ public function testTryCatchJSReleaseModeFail():void
+ {
+ var js:Boolean = false;
+ try {
+ var check:* = getDefinitionByName("flash.system.Capabilities");
+ } catch (e:Error) {
+ js = true;
+ }
+
+ //if this next reference to 'check' variable is not included, then the above try/catch code
+ // appears to be optimized away in js-release mode
+ //todo: this is inconsistent with swf
+ /* if (check == null) {
+ js = true;
+ }*/
+ Assert.assertTrue("Unexpected value following try/catch",(js==isJS));
+
+
+ }
+
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/438cb014/manualtests/GenericTests/src/flexUnitTests/reflection/ReflectionTesterTest.as
----------------------------------------------------------------------
diff --git a/manualtests/GenericTests/src/flexUnitTests/reflection/ReflectionTesterTest.as b/manualtests/GenericTests/src/flexUnitTests/reflection/ReflectionTesterTest.as
new file mode 100644
index 0000000..0ea5126
--- /dev/null
+++ b/manualtests/GenericTests/src/flexUnitTests/reflection/ReflectionTesterTest.as
@@ -0,0 +1,368 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 flexunit.framework.Assert;
+ import flexUnitTests.reflection.support.*;
+ import org.apache.flex.reflection.*;
+
+ public class ReflectionTesterTest
+ {
+
+ public static var isJS:Boolean;
+ [BeforeClass]
+ public static function setUpBeforeClass():void
+ {
+ var js:Boolean = false;
+ try {
+ var check:* = getDefinitionByName("flash.system.Capabilities");
+ } catch (e:Error) {
+ js = true;
+ }
+ //if this next reference to 'check' is not included, then the above try/catch code
+ //appears to be optimized away in js-release mode
+ //a separate test has been created for this
+ if (check == null) {
+ js = true;
+ }
+ isJS = js;
+ }
+
+ [AfterClass]
+ public static function tearDownAfterClass():void
+ {
+ }
+
+ [Before]
+ public function setUp():void
+ {
+ }
+
+ [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);
+
+ Assert.assertEquals("Unexpected package name",def.packageName,"flexUnitTests.reflection.support");
+ Assert.assertEquals("Unexpected type name",def.name,"TestClass2");
+
+ var variables:Array = def.variables;
+ Assert.assertEquals("unexpected variables length",1,variables.length);
+
+
+ var methods:Array = def.methods;
+ Assert.assertEquals("unexpected methods length",2,methods.length);
+
+ var accessors:Array = def.accessors;
+ Assert.assertEquals("unexpected accessors length",3,accessors.length);
+
+ var constructor:MethodDefinition = def.constructorMethod;
+ Assert.assertEquals("unexpected constructor declaredBy",
+ "flexUnitTests.reflection.support.TestClass2",
+ constructor.declaredBy.qualifiedName);
+
+ Assert.assertEquals("unexpected constructor params",
+ 1,
+ constructor.parameters.length);
+
+ var meta:Array = def.retrieveMetaDataByName("TestMeta");
+ Assert.assertEquals("unexpected class specific meta length",
+ 1,
+ meta.length);
+
+
+ def = describeType(TestClass4);
+ Assert.assertEquals("Unexpected package name",def.packageName,"flexUnitTests.reflection.support");
+ Assert.assertEquals("Unexpected type name",def.name,"TestClass4");
+
+ variables = def.variables;
+ Assert.assertEquals("unexpected variables length",2,variables.length);
+
+
+ methods = def.methods;
+ Assert.assertEquals("unexpected methods length",4,methods.length);
+
+ accessors = def.accessors;
+ Assert.assertEquals("unexpected accessors length",6,accessors.length);
+
+ constructor = def.constructorMethod;
+ Assert.assertEquals("unexpected constructor declaredBy",
+ "flexUnitTests.reflection.support.TestClass4",
+ constructor.declaredBy.qualifiedName);
+
+ Assert.assertEquals("unexpected constructor params",
+ 0,
+ constructor.parameters.length);
+
+
+
+ }
+
+
+
+
+ [TestVariance(variance="JS",description="Variance in test due to current inability for js target to reflect into non-FlexJS base classes or typedefs")]
+ [Test]
+ public function testDescribeTypeClass():void
+ {
+ var def:TypeDefinition = describeType(TestClass1);
+ var expected:*;
+ Assert.assertEquals("Unexpected package name","flexUnitTests.reflection.support",def.packageName);
+ Assert.assertEquals("Unexpected type name",def.name,"TestClass1");
+
+ var variables:Array = def.variables;
+ Assert.assertEquals("unexpected instance variables length",3,variables.length);
+
+ //there is a difference based on the EventDispatcher inheritance chain differences between js and swf:
+ expected = isJS ? 3 : 7;
+ var methods:Array = def.methods;
+ Assert.assertEquals("unexpected instance methods length",expected,methods.length);
+
+ var accessors:Array = def.accessors;
+ Assert.assertEquals("unexpected instance accessors length",4,accessors.length);
+
+ var staticVariables:Array =def.staticVariables;
+ Assert.assertEquals("unexpected static variables length",2,staticVariables.length);
+
+ var staticMethods:Array = def.staticMethods;
+ Assert.assertEquals("unexpected static methods length",1,staticMethods.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;
+ Assert.assertEquals("unexpected static accessors length",expected,staticAccessors.length);
+
+
+ }
+
+ [TestVariance(variance="JS",description="Variance in test due to current inability for js target to reflect into non-FlexJS base classes or typedefs")]
+ [Test]
+ public function testDescribeTypeInstance():void
+ {
+ var def:TypeDefinition = describeType(new TestClass1());
+ var expected:*;
+ Assert.assertEquals("Unexpected package name","flexUnitTests.reflection.support",def.packageName);
+ Assert.assertEquals("Unexpected type name",def.name,"TestClass1");
+
+ var variables:Array = def.variables;
+ Assert.assertEquals("unexpected instance variables length",3,variables.length);
+
+ //there is a difference based on the EventDispatcher inheritance chain differences between js and swf:
+ expected = isJS ? 3 : 7;
+ var methods:Array = def.methods;
+ Assert.assertEquals("unexpected instance methods length",expected,methods.length);
+
+ var accessors:Array = def.accessors;
+ Assert.assertEquals("unexpected instance accessors length",4,accessors.length);
+
+ var staticVariables:Array =def.staticVariables;
+ Assert.assertEquals("unexpected static variables length",2,staticVariables.length);
+
+ var staticMethods:Array = def.staticMethods;
+ Assert.assertEquals("unexpected static methods length",1,staticMethods.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;
+ Assert.assertEquals("unexpected static accessors length",expected,staticAccessors.length);
+
+
+ }
+
+ [TestVariance(variance="JS",description="Variance in baseClasses due to current inability for js target to reflect into non-FlexJS 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;
+ Assert.assertEquals("unexpected baseclasses length",expected,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];
+ Assert.assertEquals("unexpected variable name","testVar",variable.name);
+ var meta:MetaDataDefinition = variable.retrieveMetaDataByName("TestMeta")[0];
+ Assert.assertEquals("unexpected meta name","TestMeta",meta.name);
+
+ var metaArg:MetaDataArgDefinition = meta.getArgsByKey("foo")[0];
+ Assert.assertEquals("unexpected meta arg name","foo",metaArg.name);
+ Assert.assertEquals("unexpected meta arg value","instanceVariable",metaArg.value);
+
+ Assert.assertEquals("unexpected reflection initial variable value","testVar_val",inst[variable.name]);
+
+ var accessors:Array = def.accessors;
+ var testReadOnly:AccessorDefinition = retrieveItemWithName(accessors,"testReadOnly") as AccessorDefinition;
+ meta = testReadOnly.retrieveMetaDataByName("TestMeta")[0];
+ Assert.assertEquals("unexpected meta name","TestMeta",meta.name);
+
+ metaArg = meta.getArgsByKey("foo")[0];
+ Assert.assertEquals("unexpected meta arg name","foo",metaArg.name);
+ Assert.assertEquals("unexpected meta arg value","instanceAccessor",metaArg.value);
+
+ /** instance accessors **/
+ var testWriteOnly:AccessorDefinition = retrieveItemWithName(accessors,"testWriteOnly") as AccessorDefinition;
+ var testReadWrite:AccessorDefinition = retrieveItemWithName(accessors,"testReadWrite") as AccessorDefinition;
+ Assert.assertNotNull(testReadOnly);
+ Assert.assertNotNull(testWriteOnly);
+ Assert.assertNotNull(testReadWrite);
+
+ Assert.assertEquals("unexpected accessor initial value","instanceAccessor_initial_value",inst[testReadOnly.name]);
+ Assert.assertEquals("unexpected accessor initial value","instanceAccessor_initial_value",inst[testReadWrite.name]);
+
+ inst[testWriteOnly.name] = "test";
+ Assert.assertEquals("unexpected accessor initial value","test",inst[testReadOnly.name]);
+ Assert.assertEquals("unexpected accessor initial value","test",inst[testReadWrite.name]);
+
+ inst[testReadWrite.name] = "test2";
+ Assert.assertEquals("unexpected accessor initial value","test2",inst[testReadOnly.name]);
+ Assert.assertEquals("unexpected accessor initial value","test2",inst[testReadWrite.name]);
+
+ /** instance methods **/
+ var methods:Array = def.methods;
+ var testMethod:MethodDefinition = retrieveItemWithName(methods,"testMethod") as MethodDefinition;
+ meta = testMethod.retrieveMetaDataByName("TestMeta")[0];
+ Assert.assertEquals("unexpected meta name","TestMeta",meta.name);
+
+ metaArg = meta.getArgsByKey("foo")[0];
+ Assert.assertEquals("unexpected meta arg name","foo",metaArg.name);
+ Assert.assertEquals("unexpected meta arg value","instanceMethod",metaArg.value);
+ Assert.assertEquals("unexpected parameter count",0,testMethod.parameters.length);
+ inst[testMethod.name]();
+ Assert.assertEquals("unexpected method invocation result","testMethod was called",inst[testReadWrite.name]);
+
+ var testMethodWithArgs:MethodDefinition = retrieveItemWithName(methods,"testMethodWithArgs") as MethodDefinition;
+ Assert.assertEquals("unexpected parameter count",2,testMethodWithArgs.parameters.length);
+ Assert.assertTrue("unexpected method invocation result",inst[testMethodWithArgs.name]("test"));
+ Assert.assertFalse("unexpected method invocation result",inst[testMethodWithArgs.name]("test", false));
+ Assert.assertEquals("unexpected method invocation result","testMethodWithArgs was called",inst[testReadWrite.name]);
+
+
+
+ /** static vars **/
+ variables = def.staticVariables;
+
+ variable = variables[0];
+ Assert.assertEquals("unexpected variable name","testStaticVar",variable.name);
+ meta = variable.retrieveMetaDataByName("TestMeta")[0];
+ Assert.assertEquals("unexpected meta name","TestMeta",meta.name);
+
+ metaArg = meta.getArgsByKey("foo")[0];
+ Assert.assertEquals("unexpected meta arg name","foo",metaArg.name);
+ Assert.assertEquals("unexpected meta arg value","staticVariable",metaArg.value);
+
+ Assert.assertEquals("unexpected reflection initial variable value","testStaticVar_val",TestClass2[variable.name]);
+
+ /** static accessors **/
+
+ accessors = def.staticAccessors;
+ testReadOnly = retrieveItemWithName(accessors,"testStaticReadOnly") as AccessorDefinition;
+ meta = testReadOnly.retrieveMetaDataByName("TestMeta")[0];
+ Assert.assertEquals("unexpected meta name","TestMeta",meta.name);
+
+ metaArg = meta.getArgsByKey("foo")[0];
+ Assert.assertEquals("unexpected meta arg name","foo",metaArg.name);
+ Assert.assertEquals("unexpected meta arg value","staticAccessor",metaArg.value);
+
+
+ testWriteOnly = retrieveItemWithName(accessors,"testStaticWriteOnly") as AccessorDefinition;
+ testReadWrite = retrieveItemWithName(accessors,"testStaticReadWrite") as AccessorDefinition;
+ Assert.assertNotNull(testReadOnly);
+ Assert.assertNotNull(testWriteOnly);
+ Assert.assertNotNull(testReadWrite);
+
+ Assert.assertEquals("unexpected accessor initial value","staticAccessor_initial_value",TestClass2[testReadOnly.name]);
+ Assert.assertEquals("unexpected accessor initial value","staticAccessor_initial_value",TestClass2[testReadWrite.name]);
+
+ TestClass2[testWriteOnly.name] = "test";
+ Assert.assertEquals("unexpected accessor initial value","test",TestClass2[testReadOnly.name]);
+ Assert.assertEquals("unexpected accessor initial value","test",TestClass2[testReadWrite.name]);
+
+ TestClass2[testReadWrite.name] = "test2";
+ Assert.assertEquals("unexpected accessor initial value","test2",TestClass2[testReadOnly.name]);
+ Assert.assertEquals("unexpected accessor initial value","test2",TestClass2[testReadWrite.name]);
+
+
+ /** static methods **/
+ methods = def.staticMethods;
+ testMethod = retrieveItemWithName(methods,"testStaticMethod") as MethodDefinition;
+ meta = testMethod.retrieveMetaDataByName("TestMeta")[0];
+ Assert.assertEquals("unexpected meta name","TestMeta",meta.name);
+
+ metaArg = meta.getArgsByKey("foo")[0];
+ Assert.assertEquals("unexpected meta arg name","foo",metaArg.name);
+ Assert.assertEquals("unexpected meta arg value","staticMethod",metaArg.value);
+ Assert.assertEquals("unexpected parameter count",0,testMethod.parameters.length);
+ TestClass2[testMethod.name]();
+ Assert.assertEquals("unexpected method invocation result","testStaticMethod was called",TestClass2[testReadWrite.name]);
+
+ testMethodWithArgs = retrieveItemWithName(methods,"testStaticMethodWithArgs") as MethodDefinition;
+ Assert.assertEquals("unexpected parameter count",2,testMethodWithArgs.parameters.length);
+ Assert.assertTrue("unexpected method invocation result",TestClass2[testMethodWithArgs.name]("test"));
+ Assert.assertFalse("unexpected method invocation result",TestClass2[testMethodWithArgs.name]("test", false));
+ Assert.assertEquals("unexpected method invocation result","testStaticMethodWithArgs was called",TestClass2[testReadWrite.name]);
+
+ }
+
+
+ [Test]
+ public function testIntefaceReflection():void{
+ var def:TypeDefinition = describeType(ITestInterface4);
+ Assert.assertEquals("unexpected kind value","interface",def.kind);
+ Assert.assertEquals("unexpected interfaces length",3,def.interfaces.length);
+ Assert.assertEquals("unexpected accessors length",1,def.accessors.length);
+ Assert.assertEquals("unexpected methods length",1,def.methods.length);
+
+ Assert.assertEquals("unexpected variables length",0,def.variables.length);
+ Assert.assertEquals("unexpected staticVariables length",0,def.staticVariables.length);
+ Assert.assertEquals("unexpected variables length",0,def.staticMethods.length);
+ Assert.assertEquals("unexpected staticVariables length",0,def.staticAccessors.length);
+ Assert.assertNull("unexpected constructor Method definition",def.constructorMethod);
+ }
+
+
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/438cb014/manualtests/GenericTests/src/flexUnitTests/reflection/support/ITestInterface.as
----------------------------------------------------------------------
diff --git a/manualtests/GenericTests/src/flexUnitTests/reflection/support/ITestInterface.as b/manualtests/GenericTests/src/flexUnitTests/reflection/support/ITestInterface.as
new file mode 100644
index 0000000..b5a2249
--- /dev/null
+++ b/manualtests/GenericTests/src/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;
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/438cb014/manualtests/GenericTests/src/flexUnitTests/reflection/support/ITestInterface2.as
----------------------------------------------------------------------
diff --git a/manualtests/GenericTests/src/flexUnitTests/reflection/support/ITestInterface2.as b/manualtests/GenericTests/src/flexUnitTests/reflection/support/ITestInterface2.as
new file mode 100644
index 0000000..f69f9b7
--- /dev/null
+++ b/manualtests/GenericTests/src/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;
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/438cb014/manualtests/GenericTests/src/flexUnitTests/reflection/support/ITestInterface3.as
----------------------------------------------------------------------
diff --git a/manualtests/GenericTests/src/flexUnitTests/reflection/support/ITestInterface3.as b/manualtests/GenericTests/src/flexUnitTests/reflection/support/ITestInterface3.as
new file mode 100644
index 0000000..83d05ee
--- /dev/null
+++ b/manualtests/GenericTests/src/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
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/438cb014/manualtests/GenericTests/src/flexUnitTests/reflection/support/ITestInterface4.as
----------------------------------------------------------------------
diff --git a/manualtests/GenericTests/src/flexUnitTests/reflection/support/ITestInterface4.as b/manualtests/GenericTests/src/flexUnitTests/reflection/support/ITestInterface4.as
new file mode 100644
index 0000000..7a032f5
--- /dev/null
+++ b/manualtests/GenericTests/src/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;
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/438cb014/manualtests/GenericTests/src/flexUnitTests/reflection/support/TestClass1.as
----------------------------------------------------------------------
diff --git a/manualtests/GenericTests/src/flexUnitTests/reflection/support/TestClass1.as b/manualtests/GenericTests/src/flexUnitTests/reflection/support/TestClass1.as
new file mode 100644
index 0000000..76ac834
--- /dev/null
+++ b/manualtests/GenericTests/src/flexUnitTests/reflection/support/TestClass1.as
@@ -0,0 +1,91 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.flex.reflection.TypeDefinition;
+
+ [RemoteClass(alias="TestClass1_alias")]
+ public class TestClass1 implements ITestInterface
+ {
+ public function TestClass1()
+ {
+ var something:ITestInterface2;
+ }
+
+ [Bindable]
+ [Event(name="foo", type="org.apache.flex.events.Event")]
+ public var bindableVar:String;
+ [Event(name="foo", type="org.apache.flex.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";
+
+
+
+ }
+}
\ No newline at end of file