Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

cleanup of project test

added test ant tasks
added index.html for tests
  • Loading branch information...
commit d66bfe2e0a01eb85a5f3ade105c3d336f1b1e915 1 parent 183f6ce
@mstandio authored
Showing with 2,177 additions and 2,086 deletions.
  1. +4 −4 SaladoPlayer.as3proj
  2. +38 −1 ant/build.xml
  3. +18 −3 obj/SaladoPlayerConfig.old
  4. +14 −1 obj/SaladoPlayerConfig.xml
  5. 0  {testbin → test/bin}/assets/blue.png
  6. 0  {testbin → test/bin}/assets/green.bmp
  7. 0  {testbin → test/bin}/assets/red.jpg
  8. 0  {testbin → test/bin}/assets/yellow.gif
  9. +5 −0 test/bin/compiled_files.txt
  10. +25 −0 test/bin/index.html
  11. BIN  test/bin/tests/Configuration.swf
  12. BIN  test/bin/tests/Loading.swf
  13. 0  {testlib → test/lib}/flexunit-4.0.0.swc
  14. 0  {testlib → test/lib}/flexunit-uilistener-4.0.0.swc
  15. 0  {testlib → test/lib}/hamcrest-1.0.2.swc
  16. 0  {testsrc → test/src}/suite/configuration/Configuration.mxml
  17. 0  {testsrc → test/src}/suite/configuration/Parser.as
  18. +30 −30 {testsrc → test/src}/suite/configuration/Translator.as
  19. 0  {testsrc → test/src}/suite/configuration/Validator.as
  20. +10 −10 {testsrc → test/src}/suite/loading/Loader.as
  21. +32 −32 {testsrc → test/src}/suite/loading/Loading.mxml
  22. 0  {testsrc → test/src}/test/com/panozona/player/manager/utils/configuration/ManagerDataParserXMLActions.as
  23. 0  {testsrc → test/src}/test/com/panozona/player/manager/utils/configuration/ManagerDataParserXMLGlobal.as
  24. +338 −338 {testsrc → test/src}/test/com/panozona/player/manager/utils/configuration/ManagerDataParserXMLModules.as
  25. 0  ...tsrc → test/src}/test/com/panozona/player/manager/utils/configuration/ManagerDataParserXMLPanoramas.as
  26. 0  ...tsrc → test/src}/test/com/panozona/player/manager/utils/configuration/ManagerDataParserXMLRecognize.as
  27. 0  {testsrc → test/src}/test/com/panozona/player/manager/utils/configuration/ManagerDataValidatorActions.as
  28. +146 −146 {testsrc → test/src}/test/com/panozona/player/manager/utils/configuration/ManagerDataValidatorHotspots.as
  29. +100 −100 {testsrc → test/src}/test/com/panozona/player/manager/utils/configuration/ManagerDataValidatorModules.as
  30. 0  ...tsrc → test/src}/test/com/panozona/player/manager/utils/configuration/ManagerDataValidatorPanoramas.as
  31. +124 −124 {testsrc → test/src}/test/com/panozona/player/manager/utils/loading/LoadablesLoaderAsync.as
  32. +81 −81 {testsrc → test/src}/test/com/panozona/player/module/utils/DataNodeTranslatorBoolean.as
  33. +135 −135 {testsrc → test/src}/test/com/panozona/player/module/utils/DataNodeTranslatorFunction.as
  34. +133 −133 {testsrc → test/src}/test/com/panozona/player/module/utils/DataNodeTranslatorNumber.as
  35. +137 −137 {testsrc → test/src}/test/com/panozona/player/module/utils/DataNodeTranslatorObject.as
  36. +133 −133 {testsrc → test/src}/test/com/panozona/player/module/utils/DataNodeTranslatorString.as
  37. +80 −80 {testsrc → test/src}/test/com/panozona/player/module/utils/DataNodeTranslatorSubBoolean.as
  38. +109 −109 {testsrc → test/src}/test/com/panozona/player/module/utils/DataNodeTranslatorSubFunction.as
  39. +107 −107 {testsrc → test/src}/test/com/panozona/player/module/utils/DataNodeTranslatorSubNumber.as
  40. +107 −107 {testsrc → test/src}/test/com/panozona/player/module/utils/DataNodeTranslatorSubString.as
  41. +73 −73 {testsrc → test/src}/test/com/panozona/player/module/utils/DataNodeTranslatorSubattributes.as
  42. +198 −198 {testsrc → test/src}/test/com/panozona/player/module/utils/DataNodeTranslatorTranslate.as
  43. +0 −2  testbin/.gitignore
  44. +0 −2  testbin/compiled_files.txt
View
8 SaladoPlayer.as3proj
@@ -16,7 +16,7 @@
<!-- Other classes to be compiled into your SWF -->
<classpaths>
<class path="src" />
- <class path="testsrc" />
+ <class path="test\src" />
</classpaths>
<!-- Build options -->
<build>
@@ -53,9 +53,9 @@
<libraryPaths>
<element path="lib\tweener.swc" />
<element path="lib\GIFPlayer-0.6.swc" />
- <element path="testlib\flexunit-4.0.0.swc" />
- <element path="testlib\flexunit-uilistener-4.0.0.swc" />
- <element path="testlib\hamcrest-1.0.2.swc" />
+ <element path="test\lib\flexunit-4.0.0.swc" />
+ <element path="test\lib\flexunit-uilistener-4.0.0.swc" />
+ <element path="test\lib\hamcrest-1.0.2.swc" />
</libraryPaths>
<!-- External Libraries -->
<externalLibraryPaths>
View
39 ant/build.xml
@@ -22,6 +22,7 @@
<property name="debuggableSwf" value="false"/>
<property file="bin/compiled_files.txt"/>
+ <property file="test/bin/compiled_files.txt"/>
<property environment="env"/>
<property name="FLEX_HOME" value="${env.FLEX_HOME}"/>
<taskdef name="mxmlc" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" classname="flex.ant.MxmlcTask"/>
@@ -59,7 +60,8 @@
GrowingSpot,
NadirSpot,
VideoSpot,
- ExamplesLoader"/>
+ ExamplesLoader,
+ Tests"/>
<target name="SaladoPlayer">
<propertyregex property="SaladoPlayer.swf.dir"
@@ -836,4 +838,39 @@
</mxmlc>
</target>
+ <target name="Tests">
+ <mxmlc
+ file="${Configuration.mxml}"
+ output="${Configuration.swf}"
+ fork="true" maxmemory="512m"
+ debug="${debuggableSwf}"
+ static-link-runtime-shared-libraries="true">
+ <load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
+ <source-path path-element="${basedir}/src"/>
+ <source-path path-element="${basedir}/test/src"/>
+ <compiler.include-libraries dir="${basedir}" append="true">
+ <include name="lib"/>
+ </compiler.include-libraries>
+ <compiler.include-libraries dir="${basedir}/test" append="true">
+ <include name="lib"/>
+ </compiler.include-libraries>
+ </mxmlc>
+ <mxmlc
+ file="${Loading.mxml}"
+ output="${Loading.swf}"
+ fork="true" maxmemory="512m"
+ debug="${debuggableSwf}"
+ static-link-runtime-shared-libraries="true">
+ <load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
+ <source-path path-element="${basedir}/src"/>
+ <source-path path-element="${basedir}/test/src"/>
+ <compiler.include-libraries dir="${basedir}" append="true">
+ <include name="lib"/>
+ </compiler.include-libraries>
+ <compiler.include-libraries dir="${basedir}/test" append="true">
+ <include name="lib"/>
+ </compiler.include-libraries>
+ </mxmlc>
+ </target>
+
</project>
View
21 obj/SaladoPlayerConfig.old
@@ -8,16 +8,30 @@
<compiler>
<define append="true">
<name>CONFIG::debug</name>
- <value>true</value>
+ <value>false</value>
</define>
<define append="true">
<name>CONFIG::release</name>
- <value>false</value>
+ <value>true</value>
</define>
<define append="true">
<name>CONFIG::timeStamp</name>
- <value>'2012-04-15'</value>
+ <value>'2012-12-29'</value>
+ </define>
+ <define append="true">
+ <name>CONFIG::air</name>
+ <value>false</value>
+ </define>
+ <define append="true">
+ <name>CONFIG::mobile</name>
+ <value>false</value>
+ </define>
+ <define append="true">
+ <name>CONFIG::desktop</name>
+ <value>false</value>
</define>
+ <optimize>true</optimize>
+ <omit-trace-statements>true</omit-trace-statements>
<verbose-stacktraces>true</verbose-stacktraces>
<source-path append="true">
<path-element>F:\happydev\saladoplayer\SaladoPlayer\src</path-element>
@@ -26,6 +40,7 @@
</source-path>
<library-path append="true">
<path-element>F:\happydev\saladoplayer\SaladoPlayer\lib\tweener.swc</path-element>
+ <path-element>F:\happydev\saladoplayer\SaladoPlayer\lib\GIFPlayer-0.6.swc</path-element>
<path-element>F:\happydev\saladoplayer\SaladoPlayer\testlib\flexunit-4.0.0.swc</path-element>
<path-element>F:\happydev\saladoplayer\SaladoPlayer\testlib\flexunit-uilistener-4.0.0.swc</path-element>
<path-element>F:\happydev\saladoplayer\SaladoPlayer\testlib\hamcrest-1.0.2.swc</path-element>
View
15 obj/SaladoPlayerConfig.xml
@@ -16,7 +16,19 @@
</define>
<define append="true">
<name>CONFIG::timeStamp</name>
- <value>'2012-04-15'</value>
+ <value>'2012-12-30'</value>
+ </define>
+ <define append="true">
+ <name>CONFIG::air</name>
+ <value>false</value>
+ </define>
+ <define append="true">
+ <name>CONFIG::mobile</name>
+ <value>false</value>
+ </define>
+ <define append="true">
+ <name>CONFIG::desktop</name>
+ <value>false</value>
</define>
<optimize>true</optimize>
<omit-trace-statements>true</omit-trace-statements>
@@ -28,6 +40,7 @@
</source-path>
<library-path append="true">
<path-element>F:\happydev\saladoplayer\SaladoPlayer\lib\tweener.swc</path-element>
+ <path-element>F:\happydev\saladoplayer\SaladoPlayer\lib\GIFPlayer-0.6.swc</path-element>
<path-element>F:\happydev\saladoplayer\SaladoPlayer\testlib\flexunit-4.0.0.swc</path-element>
<path-element>F:\happydev\saladoplayer\SaladoPlayer\testlib\flexunit-uilistener-4.0.0.swc</path-element>
<path-element>F:\happydev\saladoplayer\SaladoPlayer\testlib\hamcrest-1.0.2.swc</path-element>
View
0  testbin/assets/blue.png → test/bin/assets/blue.png
File renamed without changes
View
0  testbin/assets/green.bmp → test/bin/assets/green.bmp
File renamed without changes
View
0  testbin/assets/red.jpg → test/bin/assets/red.jpg
File renamed without changes
View
0  testbin/assets/yellow.gif → test/bin/assets/yellow.gif
File renamed without changes
View
5 test/bin/compiled_files.txt
@@ -0,0 +1,5 @@
+Configuration.mxml = test/src/suite/configuration/Configuration.mxml
+Configuration.swf = test/bin/tests/Configuration.swf
+
+Loading.mxml = test/src/suite/loading/Loading.mxml
+Loading.swf = test/bin/tests/Loading.swf
View
25 test/bin/index.html
@@ -0,0 +1,25 @@
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+ <head>
+ <title>Tests</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+ <script type="text/javascript" src="../../bin/viewer/embed/swfobject.js"></script>
+ <script type="text/javascript">
+ swfobject.embedSWF("tests/Configuration.swf", "Configuration", "100%", "100%", "10.1.0");
+ swfobject.embedSWF("tests/Loading.swf", "Loading", "100%", "100%", "10.1.0");
+ </script>
+ <style type="text/css">
+ .testSwf {
+ height:600,
+ position:fixed
+ }
+ </style>
+ </head>
+ <body bgcolor="#000000">
+ <div class="testSwf">
+ <div id="Configuration" />
+ </div>
+ <div class="testSwf">
+ <div id="Loading" />
+ </div>
+ </body>
+</html>
View
BIN  test/bin/tests/Configuration.swf
Binary file not shown
View
BIN  test/bin/tests/Loading.swf
Binary file not shown
View
0  testlib/flexunit-4.0.0.swc → test/lib/flexunit-4.0.0.swc
File renamed without changes
View
0  testlib/flexunit-uilistener-4.0.0.swc → test/lib/flexunit-uilistener-4.0.0.swc
File renamed without changes
View
0  testlib/hamcrest-1.0.2.swc → test/lib/hamcrest-1.0.2.swc
File renamed without changes
View
0  testsrc/suite/configuration/Configuration.mxml → test/src/suite/configuration/Configuration.mxml
File renamed without changes
View
0  testsrc/suite/configuration/Parser.as → test/src/suite/configuration/Parser.as
File renamed without changes
View
60 testsrc/suite/configuration/Translator.as → test/src/suite/configuration/Translator.as
@@ -1,31 +1,31 @@
-package suite.configuration{
-
- import test.com.panozona.player.module.utils.DataNodeTranslatorTranslate;
- import test.com.panozona.player.module.utils.DataNodeTranslatorBoolean;
- import test.com.panozona.player.module.utils.DataNodeTranslatorNumber;
- import test.com.panozona.player.module.utils.DataNodeTranslatorString;
- import test.com.panozona.player.module.utils.DataNodeTranslatorFunction;
- import test.com.panozona.player.module.utils.DataNodeTranslatorObject;
- import test.com.panozona.player.module.utils.DataNodeTranslatorSubattributes;
- import test.com.panozona.player.module.utils.DataNodeTranslatorSubBoolean;
- import test.com.panozona.player.module.utils.DataNodeTranslatorSubNumber;
- import test.com.panozona.player.module.utils.DataNodeTranslatorSubString;
- import test.com.panozona.player.module.utils.DataNodeTranslatorSubFunction;
-
- [Suite]
- [RunWith("org.flexunit.runners.Suite")]
- public class Translator{
-
- public var dataNodeTranslatorTranslate:DataNodeTranslatorTranslate;
- public var dataNodeTranslatorBoolean:DataNodeTranslatorBoolean;
- public var dataNodeTranslatorNumber:DataNodeTranslatorNumber;
- public var dataNodeTranslatorString:DataNodeTranslatorString;
- public var dataNodeTranslatorFunction:DataNodeTranslatorFunction;
- public var dataNodeTranslatorObject:DataNodeTranslatorObject;
- public var dataNodeTranslatorSubattributes:DataNodeTranslatorSubattributes;
- public var dataNodeTranslatorSubBoolean:DataNodeTranslatorSubBoolean;
- public var dataNodeTranslatorSubNumber:DataNodeTranslatorSubNumber;
- public var dataNodeTranslatorSubString:DataNodeTranslatorSubString;
- public var dataNodeTranslatorSubFunction:DataNodeTranslatorSubFunction;
- }
+package suite.configuration{
+
+ import test.com.panozona.player.module.utils.DataNodeTranslatorTranslate;
+ import test.com.panozona.player.module.utils.DataNodeTranslatorBoolean;
+ import test.com.panozona.player.module.utils.DataNodeTranslatorNumber;
+ import test.com.panozona.player.module.utils.DataNodeTranslatorString;
+ import test.com.panozona.player.module.utils.DataNodeTranslatorFunction;
+ import test.com.panozona.player.module.utils.DataNodeTranslatorObject;
+ import test.com.panozona.player.module.utils.DataNodeTranslatorSubattributes;
+ import test.com.panozona.player.module.utils.DataNodeTranslatorSubBoolean;
+ import test.com.panozona.player.module.utils.DataNodeTranslatorSubNumber;
+ import test.com.panozona.player.module.utils.DataNodeTranslatorSubString;
+ import test.com.panozona.player.module.utils.DataNodeTranslatorSubFunction;
+
+ [Suite]
+ [RunWith("org.flexunit.runners.Suite")]
+ public class Translator{
+
+ public var dataNodeTranslatorTranslate:DataNodeTranslatorTranslate;
+ public var dataNodeTranslatorBoolean:DataNodeTranslatorBoolean;
+ public var dataNodeTranslatorNumber:DataNodeTranslatorNumber;
+ public var dataNodeTranslatorString:DataNodeTranslatorString;
+ public var dataNodeTranslatorFunction:DataNodeTranslatorFunction;
+ public var dataNodeTranslatorObject:DataNodeTranslatorObject;
+ public var dataNodeTranslatorSubattributes:DataNodeTranslatorSubattributes;
+ public var dataNodeTranslatorSubBoolean:DataNodeTranslatorSubBoolean;
+ public var dataNodeTranslatorSubNumber:DataNodeTranslatorSubNumber;
+ public var dataNodeTranslatorSubString:DataNodeTranslatorSubString;
+ public var dataNodeTranslatorSubFunction:DataNodeTranslatorSubFunction;
+ }
}
View
0  testsrc/suite/configuration/Validator.as → test/src/suite/configuration/Validator.as
File renamed without changes
View
20 testsrc/suite/loading/Loader.as → test/src/suite/loading/Loader.as
@@ -1,11 +1,11 @@
-package suite.loading {
-
- import test.com.panozona.player.manager.utils.loading.LoadablesLoaderAsync;
-
- [Suite]
- [RunWith("org.flexunit.runners.Suite")]
- public class Loader {
-
- public var loadablesLoaderAsync:LoadablesLoaderAsync;
- }
+package suite.loading {
+
+ import test.com.panozona.player.manager.utils.loading.LoadablesLoaderAsync;
+
+ [Suite]
+ [RunWith("org.flexunit.runners.Suite")]
+ public class Loader {
+
+ public var loadablesLoaderAsync:LoadablesLoaderAsync;
+ }
}
View
64 testsrc/suite/loading/Loading.mxml → test/src/suite/loading/Loading.mxml
@@ -1,32 +1,32 @@
-<?xml version="1.0" encoding="utf-8"?>
-<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:s="library://ns.adobe.com/flex/spark"
- xmlns:mx="library://ns.adobe.com/flex/mx"
- xmlns:flexUnitUIRunner="http://www.adobe.com/2009/flexUnitUIRunner"
- creationComplete="runMe()">
- <fx:Script>
- <![CDATA[
-
- import org.flexunit.assertThat;
- import org.flexunit.asserts.*;
- import org.flexunit.listeners.UIListener;
- import org.flexunit.runner.FlexUnitCore;
- import org.flexunit.runner.Request;
- import org.flexunit.runner.notification.async.XMLListener;
-
- import suite.loading.Loader;
-
- private var core:FlexUnitCore;
-
- public function runMe():void {
- core = new FlexUnitCore();
- core.addListener( new UIListener( uiListener ));
-
- core.run(suite.loading.Loader);
- }
-
- ]]>
- </fx:Script>
- <flexUnitUIRunner:TestRunnerBase id="uiListener" width="100%" height="100%" />
-</s:Application>
-
+<?xml version="1.0" encoding="utf-8"?>
+<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:s="library://ns.adobe.com/flex/spark"
+ xmlns:mx="library://ns.adobe.com/flex/mx"
+ xmlns:flexUnitUIRunner="http://www.adobe.com/2009/flexUnitUIRunner"
+ creationComplete="runMe()">
+ <fx:Script>
+ <![CDATA[
+
+ import org.flexunit.assertThat;
+ import org.flexunit.asserts.*;
+ import org.flexunit.listeners.UIListener;
+ import org.flexunit.runner.FlexUnitCore;
+ import org.flexunit.runner.Request;
+ import org.flexunit.runner.notification.async.XMLListener;
+
+ import suite.loading.Loader;
+
+ private var core:FlexUnitCore;
+
+ public function runMe():void {
+ core = new FlexUnitCore();
+ core.addListener( new UIListener( uiListener ));
+
+ core.run(suite.loading.Loader);
+ }
+
+ ]]>
+ </fx:Script>
+ <flexUnitUIRunner:TestRunnerBase id="uiListener" width="100%" height="100%" />
+</s:Application>
+
View
0  ...tils/configuration/ManagerDataParserXMLActions.as → ...tils/configuration/ManagerDataParserXMLActions.as
File renamed without changes
View
0  ...utils/configuration/ManagerDataParserXMLGlobal.as → ...utils/configuration/ManagerDataParserXMLGlobal.as
File renamed without changes
View
676 ...tils/configuration/ManagerDataParserXMLModules.as → ...tils/configuration/ManagerDataParserXMLModules.as
@@ -1,339 +1,339 @@
-package test.com.panozona.player.manager.utils.configuration {
-
- import com.panozona.player.module.*;
- import com.panozona.player.module.data.*;
- import com.panozona.player.manager.events.*;
- import com.panozona.player.manager.utils.configuration.*;
- import com.robertpenner.easing.*;
- import flash.events.*;
- import flexunit.framework.*;
- import org.hamcrest.*;
-
- public class ManagerDataParserXMLModules extends com.panozona.player.manager.utils.configuration.ManagerDataParserXML{
-
- protected var infoCount:int;
- protected var warningCount:int;
- protected var errorCount:int;
-
- public function ManagerDataParserXMLModules():void {
- addEventListener(ConfigurationEvent.INFO, function(event:Event):void {infoCount++;});
- addEventListener(ConfigurationEvent.WARNING, function(event:Event):void{warningCount++;});
- addEventListener(ConfigurationEvent.ERROR, function(event:Event):void{errorCount++;});
- }
-
- [Before]
- public function beforeTest():void {
- infoCount = 0;
- warningCount = 0;
- errorCount = 0;
- }
-
- [Test]
- public function parseDataNodeRecursiveStructure():void {
- var dataNode:DataNode = new DataNode("a");
- var nodeXML:XML = new XML(
- "<root>" +
- "<b>" +
- "<f/>" +
- "<c>" +
- "<d/>" +
- "<e/>" +
- "</c>" +
- "</b>" +
- "</root>");
-
- parseDataNodeRecursive(dataNode, nodeXML);
-
- Assert.assertEquals(0, infoCount);
- Assert.assertEquals(0, warningCount);
- Assert.assertEquals(0, errorCount);
-
- Assert.assertStrictlyEquals("b", dataNode.childNodes[0].name);
- Assert.assertStrictlyEquals("f", dataNode.childNodes[0].childNodes[0].name);
- Assert.assertStrictlyEquals("c", dataNode.childNodes[0].childNodes[1].name);
- Assert.assertStrictlyEquals("d", dataNode.childNodes[0].childNodes[1].childNodes[0].name);
- Assert.assertStrictlyEquals("e", dataNode.childNodes[0].childNodes[1].childNodes[1].name);
- }
-
- [Test]
- public function parseDataNodeRecursiveStructureFails():void {
- var dataNode:DataNode = new DataNode("a");
- var nodeXML:XML = new XML(
- "<root>" +
- "<b>" +
- "<f/>" +
- "<c>" +
- "<d/>" +
- "<e/>" +
- "</c>" +
- "</b>" +
- "</root>");
-
- parseDataNodeRecursive(dataNode, nodeXML);
-
- Assert.assertEquals(0, infoCount);
- Assert.assertEquals(0, warningCount);
- Assert.assertEquals(0, errorCount);
-
- Assert.assertFalse("f" == dataNode.childNodes[0].childNodes[1].childNodes[0].name);
- }
-
- [Test]
- public function parseDataNodeRecursiveStructureBoolean():void {
- var dataNode:DataNode = new DataNode("a");
- var nodeXML:XML = new XML(
- "<root>" +
- "<b bool_t=\"true\" bool_f=\"false\">" +
- "<c bool_t=\"true\" bool_f=\"false\"/>" +
- "</b>" +
- "</root>");
-
- parseDataNodeRecursive(dataNode, nodeXML);
-
- Assert.assertEquals(0, infoCount);
- Assert.assertEquals(0, warningCount);
- Assert.assertEquals(0, errorCount);
-
- Assert.assertStrictlyEquals("b", dataNode.childNodes[0].name);
- Assert.assertStrictlyEquals(true, dataNode.childNodes[0].attributes.bool_t);
- Assert.assertStrictlyEquals(false, dataNode.childNodes[0].attributes.bool_f);
-
- Assert.assertStrictlyEquals("c", dataNode.childNodes[0].childNodes[0].name);
- Assert.assertStrictlyEquals(true, dataNode.childNodes[0].childNodes[0].attributes.bool_t);
- Assert.assertStrictlyEquals(false, dataNode.childNodes[0].childNodes[0].attributes.bool_f);
- }
-
- [Test]
- public function parseDataNodeRecursiveStructureNumber():void {
- var dataNode:DataNode = new DataNode("a");
- var nodeXML:XML = new XML(
- "<root>" +
- "<b num_n=\"-12.12\" num_c=\"#FF00FF\" num_nan=\"NaN\">" +
- "<c num_n=\"-12.12\" num_c=\"#FF00FF\" num_nan=\"NaN\"/>" +
- "</b>" +
- "</root>");
-
- parseDataNodeRecursive(dataNode, nodeXML);
-
- Assert.assertEquals(0, infoCount);
- Assert.assertEquals(0, warningCount);
- Assert.assertEquals(0, errorCount);
-
- Assert.assertStrictlyEquals("b", dataNode.childNodes[0].name);
- Assert.assertStrictlyEquals(-12.12, dataNode.childNodes[0].attributes.num_n);
- Assert.assertStrictlyEquals(0xff00ff, dataNode.childNodes[0].attributes.num_c);
- Assert.assertTrue(isNaN(dataNode.childNodes[0].attributes.num_nan));
-
- Assert.assertStrictlyEquals("c", dataNode.childNodes[0].childNodes[0].name);
- Assert.assertStrictlyEquals(-12.12, dataNode.childNodes[0].childNodes[0].attributes.num_n);
- Assert.assertStrictlyEquals(0xff00ff, dataNode.childNodes[0].childNodes[0].attributes.num_c);
- Assert.assertTrue(isNaN(dataNode.childNodes[0].childNodes[0].attributes.num_nan));
- }
-
- [Test]
- public function parseDataNodeRecursiveStructureString():void {
-
- var dataNode:DataNode = new DataNode("a");
- var nodeXML:XML = new XML(
- "<root>" +
- "<b str_1=\"\" str_2=\"foo\" str_3=\"[-12.12]\">" +
- "<c str_1=\"\" str_2=\"foo\" str_3=\"[-12.12]\"/>" +
- "</b>" +
- "</root>");
-
- parseDataNodeRecursive(dataNode, nodeXML);
-
- //Assert.assertEquals(0, infoCount);
- //Assert.assertEquals(0, warningCount);
- //Assert.assertEquals(0, errorCount);
-
- Assert.assertStrictlyEquals("b", dataNode.childNodes[0].name);
- Assert.assertNull(dataNode.childNodes[0].attributes.str_1);
- Assert.assertStrictlyEquals("foo", dataNode.childNodes[0].attributes.str_2);
- Assert.assertStrictlyEquals("-12.12", dataNode.childNodes[0].attributes.str_3);
-
- Assert.assertStrictlyEquals("c", dataNode.childNodes[0].childNodes[0].name);
- Assert.assertNull(dataNode.childNodes[0].childNodes[0].attributes.str_1);
- Assert.assertStrictlyEquals("foo", dataNode.childNodes[0].childNodes[0].attributes.str_2);
- Assert.assertStrictlyEquals("-12.12", dataNode.childNodes[0].childNodes[0].attributes.str_3);
- }
-
- [Test]
- public function parseDataNodeRecursiveStructureCdata():void {
- var dataNode:DataNode = new DataNode("a");
- var nodeXML:XML = new XML(
- "<root>" +
- "<b>" +
- "<![CDATA[:;.]]>" +
- "<c text=\"foo\"/>" +
- "</b>" +
- "</root>");
-
- parseDataNodeRecursive(dataNode, nodeXML);
-
- Assert.assertEquals(0, infoCount);
- Assert.assertEquals(0, warningCount);
- Assert.assertEquals(0, errorCount);
-
- Assert.assertStrictlyEquals("b", dataNode.childNodes[0].name);
- Assert.assertStrictlyEquals(":;.", dataNode.childNodes[0].attributes.text);
-
- Assert.assertStrictlyEquals("c", dataNode.childNodes[0].childNodes[0].name);
- Assert.assertStrictlyEquals("foo", dataNode.childNodes[0].childNodes[0].attributes.text);
- }
-
- [Test]
- public function parseDataNodeRecursiveStructureFunction():void {
- var dataNode:DataNode = new DataNode("a");
- var nodeXML:XML = new XML(
- "<root>" +
- "<b fun_1=\"Back.easeIn\">" +
- "<c fun_1=\"Bounce.easeIn\"/>" +
- "</b>" +
- "</root>");
-
- Assert.assertEquals(0, infoCount);
- Assert.assertEquals(0, warningCount);
- Assert.assertEquals(0, errorCount);
-
- parseDataNodeRecursive(dataNode, nodeXML);
-
- Assert.assertStrictlyEquals("b", dataNode.childNodes[0].name);
- Assert.assertStrictlyEquals(Back.easeIn, dataNode.childNodes[0].attributes.fun_1);
-
- Assert.assertStrictlyEquals("c", dataNode.childNodes[0].childNodes[0].name);
- Assert.assertStrictlyEquals(Bounce.easeIn, dataNode.childNodes[0].childNodes[0].attributes.fun_1);
- }
-
- [Test]
- public function parseDataNodeRecursiveStructureObject():void {
- var dataNode:DataNode = new DataNode("a");
- var nodeXML:XML = new XML(
- "<root>" +
- "<b obj1=\"str:foo,bool:true,num:-12.12,fun:Back.easeIn\">" +
- "<c obj1=\"str:foo,bool:true,num:-12.12,fun:Back.easeIn\"/>" +
- "</b>" +
- "</root>");
-
- parseDataNodeRecursive(dataNode, nodeXML);
-
- Assert.assertEquals(0, infoCount);
- Assert.assertEquals(0, warningCount);
- Assert.assertEquals(0, errorCount);
-
- Assert.assertStrictlyEquals("b", dataNode.childNodes[0].name);
- Assert.assertStrictlyEquals("foo", dataNode.childNodes[0].attributes.obj1.str);
- Assert.assertStrictlyEquals(true, dataNode.childNodes[0].attributes.obj1.bool);
- Assert.assertStrictlyEquals(-12.12, dataNode.childNodes[0].attributes.obj1.num);
- Assert.assertStrictlyEquals(Back.easeIn, dataNode.childNodes[0].attributes.obj1.fun);
-
- Assert.assertStrictlyEquals("c", dataNode.childNodes[0].childNodes[0].name);
- Assert.assertStrictlyEquals("foo", dataNode.childNodes[0].childNodes[0].attributes.obj1.str);
- Assert.assertStrictlyEquals(true, dataNode.childNodes[0].childNodes[0].attributes.obj1.bool);
- Assert.assertStrictlyEquals(-12.12, dataNode.childNodes[0].childNodes[0].attributes.obj1.num);
- Assert.assertStrictlyEquals(Back.easeIn, dataNode.childNodes[0].childNodes[0].attributes.obj1.fun);
- }
-
- [Test]
- public function parseDataNodeRecursiveWarning():void {
-
- var nodeXML_a:XML = new XML(
- "<root>" +
- "<a text=\"foo\">" +
- "<![CDATA[bar]]>" +
- "</a>" +
- "</root>");
-
- var nodeXML_b:XML = new XML(
- "<root>" +
- "<a>" +
- "<![CDATA[foo]]>" +
- "<![CDATA[bar]]>" +
- "</a>" +
- "</root>");
-
- var nodeXML_c:XML = new XML(
- "<root>" +
- "<a>" +
- "<b text=\"foo\">" +
- "<![CDATA[bar]]>" +
- "</b>" +
- "</a>" +
- "</root>");
-
- var nodeXML_d:XML = new XML(
- "<root>" +
- "<a>" +
- "<b>" +
- "<![CDATA[foo]]>" +
- "<![CDATA[bar]]>" +
- "</b>" +
- "</a>" +
- "</root>");
-
- parseDataNodeRecursive(new DataNode("a"), nodeXML_a);
- parseDataNodeRecursive(new DataNode("b"), nodeXML_b);
- parseDataNodeRecursive(new DataNode("c"), nodeXML_c);
- parseDataNodeRecursive(new DataNode("d"), nodeXML_c);
-
- Assert.assertEquals(0, infoCount);
- Assert.assertEquals(4, warningCount);
- Assert.assertEquals(0, errorCount);
- }
-
- [Test]
- public function parseModulesSmokeTest():void {
- var moduleDatas:Vector.<ModuleData> = new Vector.<ModuleData>();
- var nodeXML:XML = new XML(
- "<modules>" +
- "<name_a path=\"path_a\">" +
- "<a/>" +
- "<b/>" +
- "</name_a>" +
- "<name_b path=\"path_b\">" +
- "<c/>" +
- "<d/>" +
- "</name_b>" +
- "</modules>");
-
- parseModules(moduleDatas, nodeXML);
-
- Assert.assertEquals(0, infoCount);
- Assert.assertEquals(0, warningCount);
- Assert.assertEquals(0, errorCount);
-
- Assert.assertEquals(2, moduleDatas.length);
-
- Assert.assertEquals("name_a", moduleDatas[0].name);
- Assert.assertEquals("path_a", moduleDatas[0].path);
- Assert.assertEquals(2, moduleDatas[0].nodes.length);
-
- Assert.assertEquals("name_b", moduleDatas[1].name);
- Assert.assertEquals("path_b", moduleDatas[1].path);
- Assert.assertEquals(2, moduleDatas[1].nodes.length);
- }
-
- [Test]
- public function parseModulesNoPath():void {
- var moduleDatas:Vector.<ModuleData> = new Vector.<ModuleData>();
-
- var nodeXML_a:XML = new XML(
- "<modules>" +
- "<name_a>" +
- "<a/>" +
- "<b/>" +
- "</name_a>" +
- "<name_b path=\"path_b\">" +
- "<c/>" +
- "<d/>" +
- "</name_b>" +
- "</modules>");
-
- parseModules(moduleDatas, nodeXML_a);
-
- Assert.assertEquals(0, infoCount);
- Assert.assertEquals(0, warningCount);
- Assert.assertEquals(1, errorCount);
- }
- }
+package test.com.panozona.player.manager.utils.configuration {
+
+ import com.panozona.player.module.*;
+ import com.panozona.player.module.data.*;
+ import com.panozona.player.manager.events.*;
+ import com.panozona.player.manager.utils.configuration.*;
+ import com.robertpenner.easing.*;
+ import flash.events.*;
+ import flexunit.framework.*;
+ import org.hamcrest.*;
+
+ public class ManagerDataParserXMLModules extends com.panozona.player.manager.utils.configuration.ManagerDataParserXML{
+
+ protected var infoCount:int;
+ protected var warningCount:int;
+ protected var errorCount:int;
+
+ public function ManagerDataParserXMLModules():void {
+ addEventListener(ConfigurationEvent.INFO, function(event:Event):void {infoCount++;});
+ addEventListener(ConfigurationEvent.WARNING, function(event:Event):void{warningCount++;});
+ addEventListener(ConfigurationEvent.ERROR, function(event:Event):void{errorCount++;});
+ }
+
+ [Before]
+ public function beforeTest():void {
+ infoCount = 0;
+ warningCount = 0;
+ errorCount = 0;
+ }
+
+ [Test]
+ public function parseDataNodeRecursiveStructure():void {
+ var dataNode:DataNode = new DataNode("a");
+ var nodeXML:XML = new XML(
+ "<root>" +
+ "<b>" +
+ "<f/>" +
+ "<c>" +
+ "<d/>" +
+ "<e/>" +
+ "</c>" +
+ "</b>" +
+ "</root>");
+
+ parseDataNodeRecursive(dataNode, nodeXML);
+
+ Assert.assertEquals(0, infoCount);
+ Assert.assertEquals(0, warningCount);
+ Assert.assertEquals(0, errorCount);
+
+ Assert.assertStrictlyEquals("b", dataNode.childNodes[0].name);
+ Assert.assertStrictlyEquals("f", dataNode.childNodes[0].childNodes[0].name);
+ Assert.assertStrictlyEquals("c", dataNode.childNodes[0].childNodes[1].name);
+ Assert.assertStrictlyEquals("d", dataNode.childNodes[0].childNodes[1].childNodes[0].name);
+ Assert.assertStrictlyEquals("e", dataNode.childNodes[0].childNodes[1].childNodes[1].name);
+ }
+
+ [Test]
+ public function parseDataNodeRecursiveStructureFails():void {
+ var dataNode:DataNode = new DataNode("a");
+ var nodeXML:XML = new XML(
+ "<root>" +
+ "<b>" +
+ "<f/>" +
+ "<c>" +
+ "<d/>" +
+ "<e/>" +
+ "</c>" +
+ "</b>" +
+ "</root>");
+
+ parseDataNodeRecursive(dataNode, nodeXML);
+
+ Assert.assertEquals(0, infoCount);
+ Assert.assertEquals(0, warningCount);
+ Assert.assertEquals(0, errorCount);
+
+ Assert.assertFalse("f" == dataNode.childNodes[0].childNodes[1].childNodes[0].name);
+ }
+
+ [Test]
+ public function parseDataNodeRecursiveStructureBoolean():void {
+ var dataNode:DataNode = new DataNode("a");
+ var nodeXML:XML = new XML(
+ "<root>" +
+ "<b bool_t=\"true\" bool_f=\"false\">" +
+ "<c bool_t=\"true\" bool_f=\"false\"/>" +
+ "</b>" +
+ "</root>");
+
+ parseDataNodeRecursive(dataNode, nodeXML);
+
+ Assert.assertEquals(0, infoCount);
+ Assert.assertEquals(0, warningCount);
+ Assert.assertEquals(0, errorCount);
+
+ Assert.assertStrictlyEquals("b", dataNode.childNodes[0].name);
+ Assert.assertStrictlyEquals(true, dataNode.childNodes[0].attributes.bool_t);
+ Assert.assertStrictlyEquals(false, dataNode.childNodes[0].attributes.bool_f);
+
+ Assert.assertStrictlyEquals("c", dataNode.childNodes[0].childNodes[0].name);
+ Assert.assertStrictlyEquals(true, dataNode.childNodes[0].childNodes[0].attributes.bool_t);
+ Assert.assertStrictlyEquals(false, dataNode.childNodes[0].childNodes[0].attributes.bool_f);
+ }
+
+ [Test]
+ public function parseDataNodeRecursiveStructureNumber():void {
+ var dataNode:DataNode = new DataNode("a");
+ var nodeXML:XML = new XML(
+ "<root>" +
+ "<b num_n=\"-12.12\" num_c=\"#FF00FF\" num_nan=\"NaN\">" +
+ "<c num_n=\"-12.12\" num_c=\"#FF00FF\" num_nan=\"NaN\"/>" +
+ "</b>" +
+ "</root>");
+
+ parseDataNodeRecursive(dataNode, nodeXML);
+
+ Assert.assertEquals(0, infoCount);
+ Assert.assertEquals(0, warningCount);
+ Assert.assertEquals(0, errorCount);
+
+ Assert.assertStrictlyEquals("b", dataNode.childNodes[0].name);
+ Assert.assertStrictlyEquals(-12.12, dataNode.childNodes[0].attributes.num_n);
+ Assert.assertStrictlyEquals(0xff00ff, dataNode.childNodes[0].attributes.num_c);
+ Assert.assertTrue(isNaN(dataNode.childNodes[0].attributes.num_nan));
+
+ Assert.assertStrictlyEquals("c", dataNode.childNodes[0].childNodes[0].name);
+ Assert.assertStrictlyEquals(-12.12, dataNode.childNodes[0].childNodes[0].attributes.num_n);
+ Assert.assertStrictlyEquals(0xff00ff, dataNode.childNodes[0].childNodes[0].attributes.num_c);
+ Assert.assertTrue(isNaN(dataNode.childNodes[0].childNodes[0].attributes.num_nan));
+ }
+
+ [Test]
+ public function parseDataNodeRecursiveStructureString():void {
+
+ var dataNode:DataNode = new DataNode("a");
+ var nodeXML:XML = new XML(
+ "<root>" +
+ "<b str_1=\"\" str_2=\"foo\" str_3=\"[-12.12]\">" +
+ "<c str_1=\"\" str_2=\"foo\" str_3=\"[-12.12]\"/>" +
+ "</b>" +
+ "</root>");
+
+ parseDataNodeRecursive(dataNode, nodeXML);
+
+ //Assert.assertEquals(0, infoCount);
+ //Assert.assertEquals(0, warningCount);
+ //Assert.assertEquals(0, errorCount);
+
+ Assert.assertStrictlyEquals("b", dataNode.childNodes[0].name);
+ Assert.assertNull(dataNode.childNodes[0].attributes.str_1);
+ Assert.assertStrictlyEquals("foo", dataNode.childNodes[0].attributes.str_2);
+ Assert.assertStrictlyEquals("-12.12", dataNode.childNodes[0].attributes.str_3);
+
+ Assert.assertStrictlyEquals("c", dataNode.childNodes[0].childNodes[0].name);
+ Assert.assertNull(dataNode.childNodes[0].childNodes[0].attributes.str_1);
+ Assert.assertStrictlyEquals("foo", dataNode.childNodes[0].childNodes[0].attributes.str_2);
+ Assert.assertStrictlyEquals("-12.12", dataNode.childNodes[0].childNodes[0].attributes.str_3);
+ }
+
+ [Test]
+ public function parseDataNodeRecursiveStructureCdata():void {
+ var dataNode:DataNode = new DataNode("a");
+ var nodeXML:XML = new XML(
+ "<root>" +
+ "<b>" +
+ "<![CDATA[:;.]]>" +
+ "<c text=\"foo\"/>" +
+ "</b>" +
+ "</root>");
+
+ parseDataNodeRecursive(dataNode, nodeXML);
+
+ Assert.assertEquals(0, infoCount);
+ Assert.assertEquals(0, warningCount);
+ Assert.assertEquals(0, errorCount);
+
+ Assert.assertStrictlyEquals("b", dataNode.childNodes[0].name);
+ Assert.assertStrictlyEquals(":;.", dataNode.childNodes[0].attributes.text);
+
+ Assert.assertStrictlyEquals("c", dataNode.childNodes[0].childNodes[0].name);
+ Assert.assertStrictlyEquals("foo", dataNode.childNodes[0].childNodes[0].attributes.text);
+ }
+
+ [Test]
+ public function parseDataNodeRecursiveStructureFunction():void {
+ var dataNode:DataNode = new DataNode("a");
+ var nodeXML:XML = new XML(
+ "<root>" +
+ "<b fun_1=\"Back.easeIn\">" +
+ "<c fun_1=\"Bounce.easeIn\"/>" +
+ "</b>" +
+ "</root>");
+
+ Assert.assertEquals(0, infoCount);
+ Assert.assertEquals(0, warningCount);
+ Assert.assertEquals(0, errorCount);
+
+ parseDataNodeRecursive(dataNode, nodeXML);
+
+ Assert.assertStrictlyEquals("b", dataNode.childNodes[0].name);
+ Assert.assertStrictlyEquals(Back.easeIn, dataNode.childNodes[0].attributes.fun_1);
+
+ Assert.assertStrictlyEquals("c", dataNode.childNodes[0].childNodes[0].name);
+ Assert.assertStrictlyEquals(Bounce.easeIn, dataNode.childNodes[0].childNodes[0].attributes.fun_1);
+ }
+
+ [Test]
+ public function parseDataNodeRecursiveStructureObject():void {
+ var dataNode:DataNode = new DataNode("a");
+ var nodeXML:XML = new XML(
+ "<root>" +
+ "<b obj1=\"str:foo,bool:true,num:-12.12,fun:Back.easeIn\">" +
+ "<c obj1=\"str:foo,bool:true,num:-12.12,fun:Back.easeIn\"/>" +
+ "</b>" +
+ "</root>");
+
+ parseDataNodeRecursive(dataNode, nodeXML);
+
+ Assert.assertEquals(0, infoCount);
+ Assert.assertEquals(0, warningCount);
+ Assert.assertEquals(0, errorCount);
+
+ Assert.assertStrictlyEquals("b", dataNode.childNodes[0].name);
+ Assert.assertStrictlyEquals("foo", dataNode.childNodes[0].attributes.obj1.str);
+ Assert.assertStrictlyEquals(true, dataNode.childNodes[0].attributes.obj1.bool);
+ Assert.assertStrictlyEquals(-12.12, dataNode.childNodes[0].attributes.obj1.num);
+ Assert.assertStrictlyEquals(Back.easeIn, dataNode.childNodes[0].attributes.obj1.fun);
+
+ Assert.assertStrictlyEquals("c", dataNode.childNodes[0].childNodes[0].name);
+ Assert.assertStrictlyEquals("foo", dataNode.childNodes[0].childNodes[0].attributes.obj1.str);
+ Assert.assertStrictlyEquals(true, dataNode.childNodes[0].childNodes[0].attributes.obj1.bool);
+ Assert.assertStrictlyEquals(-12.12, dataNode.childNodes[0].childNodes[0].attributes.obj1.num);
+ Assert.assertStrictlyEquals(Back.easeIn, dataNode.childNodes[0].childNodes[0].attributes.obj1.fun);
+ }
+
+ [Test]
+ public function parseDataNodeRecursiveWarning():void {
+
+ var nodeXML_a:XML = new XML(
+ "<root>" +
+ "<a text=\"foo\">" +
+ "<![CDATA[bar]]>" +
+ "</a>" +
+ "</root>");
+
+ var nodeXML_b:XML = new XML(
+ "<root>" +
+ "<a>" +
+ "<![CDATA[foo]]>" +
+ "<![CDATA[bar]]>" +
+ "</a>" +
+ "</root>");
+
+ var nodeXML_c:XML = new XML(
+ "<root>" +
+ "<a>" +
+ "<b text=\"foo\">" +
+ "<![CDATA[bar]]>" +
+ "</b>" +
+ "</a>" +
+ "</root>");
+
+ var nodeXML_d:XML = new XML(
+ "<root>" +
+ "<a>" +
+ "<b>" +
+ "<![CDATA[foo]]>" +
+ "<![CDATA[bar]]>" +
+ "</b>" +
+ "</a>" +
+ "</root>");
+
+ parseDataNodeRecursive(new DataNode("a"), nodeXML_a);
+ parseDataNodeRecursive(new DataNode("b"), nodeXML_b);
+ parseDataNodeRecursive(new DataNode("c"), nodeXML_c);
+ parseDataNodeRecursive(new DataNode("d"), nodeXML_c);
+
+ Assert.assertEquals(0, infoCount);
+ Assert.assertEquals(4, warningCount);
+ Assert.assertEquals(0, errorCount);
+ }
+
+ [Test]
+ public function parseModulesSmokeTest():void {
+ var moduleDatas:Vector.<ModuleData> = new Vector.<ModuleData>();
+ var nodeXML:XML = new XML(
+ "<modules>" +
+ "<name_a path=\"path_a\">" +
+ "<a/>" +
+ "<b/>" +
+ "</name_a>" +
+ "<name_b path=\"path_b\">" +
+ "<c/>" +
+ "<d/>" +
+ "</name_b>" +
+ "</modules>");
+
+ parseModules(moduleDatas, nodeXML);
+
+ Assert.assertEquals(0, infoCount);
+ Assert.assertEquals(0, warningCount);
+ Assert.assertEquals(0, errorCount);
+
+ Assert.assertEquals(2, moduleDatas.length);
+
+ Assert.assertEquals("name_a", moduleDatas[0].name);
+ Assert.assertEquals("path_a", moduleDatas[0].path);
+ Assert.assertEquals(2, moduleDatas[0].nodes.length);
+
+ Assert.assertEquals("name_b", moduleDatas[1].name);
+ Assert.assertEquals("path_b", moduleDatas[1].path);
+ Assert.assertEquals(2, moduleDatas[1].nodes.length);
+ }
+
+ [Test]
+ public function parseModulesNoPath():void {
+ var moduleDatas:Vector.<ModuleData> = new Vector.<ModuleData>();
+
+ var nodeXML_a:XML = new XML(
+ "<modules>" +
+ "<name_a>" +
+ "<a/>" +
+ "<b/>" +
+ "</name_a>" +
+ "<name_b path=\"path_b\">" +
+ "<c/>" +
+ "<d/>" +
+ "</name_b>" +
+ "</modules>");
+
+ parseModules(moduleDatas, nodeXML_a);
+
+ Assert.assertEquals(0, infoCount);
+ Assert.assertEquals(0, warningCount);
+ Assert.assertEquals(1, errorCount);
+ }
+ }
}
View
0  ...ls/configuration/ManagerDataParserXMLPanoramas.as → ...ls/configuration/ManagerDataParserXMLPanoramas.as
File renamed without changes
View
0  ...ls/configuration/ManagerDataParserXMLRecognize.as → ...ls/configuration/ManagerDataParserXMLRecognize.as
File renamed without changes
View
0  ...tils/configuration/ManagerDataValidatorActions.as → ...tils/configuration/ManagerDataValidatorActions.as
File renamed without changes
View
292 ...ils/configuration/ManagerDataValidatorHotspots.as → ...ils/configuration/ManagerDataValidatorHotspots.as
@@ -1,147 +1,147 @@
-package test.com.panozona.player.manager.utils.configuration {
-
- import adobe.utils.CustomActions;
- import com.panosalado.view.Hotspot;
- import com.panozona.player.module.*;
- import com.panozona.player.module.data.*;
- import com.panozona.player.module.utils.*;
- import com.panozona.player.manager.data.*;
- import com.panozona.player.manager.data.panoramas.*;
- import com.panozona.player.manager.data.actions.*;
- import com.panozona.player.manager.events.*;
- import com.panozona.player.manager.utils.configuration.*;
- import com.robertpenner.easing.*;
- import flash.events.*;
- import flexunit.framework.*;
- import org.hamcrest.*;
-
- public class ManagerDataValidatorHotspots extends com.panozona.player.manager.utils.configuration.ManagerDataValidator{
-
- protected var infoCount:int;
- protected var warningCount:int;
- protected var errorCount:int;
-
- protected var managerData:ManagerData;
-
- public function ManagerDataValidatorHotspots():void {
- addEventListener(ConfigurationEvent.INFO, function(event:Event):void {infoCount++;});
- addEventListener(ConfigurationEvent.WARNING, function(event:Event):void{warningCount++;});
- addEventListener(ConfigurationEvent.ERROR, function(event:Event):void{errorCount++;});
- }
-
- [Before]
- public function beforeTest():void {
-
- managerData = new ManagerData();
- managerData.panoramasData.push(new PanoramaData("pano_a", "path_a"));
-
- infoCount = 0;
- warningCount = 0;
- errorCount = 0;
- }
-
- [Test]
- public function smokeTest():void {
-
- managerData.panoramasData[0].hotspotsData.push(new HotspotDataImage("hs_1", "path_1"));
- managerData.panoramasData[0].hotspotsData.push(new HotspotDataSwf("hs_2", "path_2"));
-
- checkHotspots(managerData);
-
- Assert.assertEquals(0, infoCount);
- Assert.assertEquals(0, warningCount);
- Assert.assertEquals(0, errorCount);
- }
-
- [Test]
- public function missingId():void {
- managerData.panoramasData[0].hotspotsData.push(new HotspotDataImage(null, "path_1"));
-
- checkHotspots(managerData);
-
- Assert.assertEquals(0, infoCount);
- Assert.assertEquals(0, warningCount);
- Assert.assertEquals(1, errorCount);
- }
-
- [Test]
- public function repeatingIdSamePanorama():void {
- managerData.panoramasData[0].hotspotsData.push(new HotspotDataImage("hs_1", "path_1"));
- managerData.panoramasData[0].hotspotsData.push(new HotspotDataImage("hs_1", "path_2"));
-
- checkHotspots(managerData);
-
- Assert.assertEquals(0, infoCount);
- Assert.assertEquals(1, warningCount);
- Assert.assertEquals(0, errorCount);
- }
-
- [Test]
- public function repeatingIdDifferentPanorama():void {
- managerData.panoramasData[0].hotspotsData.push(new HotspotDataImage("hs_1", "path_1"));
- managerData.panoramasData.push(new PanoramaData("pano_b", "path_b"));
- managerData.panoramasData[1].hotspotsData.push(new HotspotDataSwf("hs_1", "path_2"));
-
- checkHotspots(managerData);
-
- Assert.assertEquals(0, infoCount);
- Assert.assertEquals(1, warningCount);
- Assert.assertEquals(0, errorCount);
- }
-
- [Test]
- public function missingPathSwf():void {
- managerData.panoramasData[0].hotspotsData.push(new HotspotDataSwf("hs_1", null));
-
- checkHotspots(managerData);
-
- Assert.assertEquals(0, infoCount);
- Assert.assertEquals(0, warningCount);
- Assert.assertEquals(1, errorCount);
- }
-
- [Test]
- public function missingPathImage():void {
- managerData.panoramasData[0].hotspotsData.push(new HotspotDataImage("hs_1", null));
-
- checkHotspots(managerData);
-
- Assert.assertEquals(0, infoCount);
- Assert.assertEquals(0, warningCount);
- Assert.assertEquals(1, errorCount);
- }
-
- [Test]
- public function hotspotMousePass():void {
- managerData.panoramasData.push(new PanoramaData("a", "path_a"));
- managerData.panoramasData[0].hotspotsData.push(new HotspotDataImage("spot_1", "path_1"));
- managerData.panoramasData[0].hotspotsData[0].mouse.onClick = "act_1";
- managerData.panoramasData[0].hotspotsData[0].mouse.onOut = "act_2";
- managerData.panoramasData[0].hotspotsData[0].mouse.onOver = "act_3";
- managerData.panoramasData[0].hotspotsData[0].mouse.onPress = "act_4";
- managerData.actionsData.push(new ActionData("act_1"));
- managerData.actionsData.push(new ActionData("act_2"));
- managerData.actionsData.push(new ActionData("act_3"));
- managerData.actionsData.push(new ActionData("act_4"));
-
- checkHotspots(managerData);
-
- Assert.assertEquals(0, infoCount);
- Assert.assertEquals(0, warningCount);
- Assert.assertEquals(0, errorCount);
- }
-
- [Test]
- public function hotspotMouseWrongActionId():void {
- managerData.panoramasData.push(new PanoramaData("a", "path_a"));
- managerData.panoramasData[0].hotspotsData.push(new HotspotDataImage("spot_1", "path_1"));
- managerData.panoramasData[0].hotspotsData[0].mouse.onClick = "act_99";
-
- checkHotspots(managerData);
-
- Assert.assertEquals(0, infoCount);
- Assert.assertEquals(0, warningCount);
- Assert.assertEquals(1, errorCount);
- }
- }
+package test.com.panozona.player.manager.utils.configuration {
+
+ import adobe.utils.CustomActions;
+ import com.panosalado.view.Hotspot;
+ import com.panozona.player.module.*;
+ import com.panozona.player.module.data.*;
+ import com.panozona.player.module.utils.*;
+ import com.panozona.player.manager.data.*;
+ import com.panozona.player.manager.data.panoramas.*;
+ import com.panozona.player.manager.data.actions.*;
+ import com.panozona.player.manager.events.*;
+ import com.panozona.player.manager.utils.configuration.*;
+ import com.robertpenner.easing.*;
+ import flash.events.*;
+ import flexunit.framework.*;
+ import org.hamcrest.*;
+
+ public class ManagerDataValidatorHotspots extends com.panozona.player.manager.utils.configuration.ManagerDataValidator{
+
+ protected var infoCount:int;
+ protected var warningCount:int;
+ protected var errorCount:int;
+
+ protected var managerData:ManagerData;
+
+ public function ManagerDataValidatorHotspots():void {
+ addEventListener(ConfigurationEvent.INFO, function(event:Event):void {infoCount++;});
+ addEventListener(ConfigurationEvent.WARNING, function(event:Event):void{warningCount++;});
+ addEventListener(ConfigurationEvent.ERROR, function(event:Event):void{errorCount++;});
+ }
+
+ [Before]
+ public function beforeTest():void {
+
+ managerData = new ManagerData();
+ managerData.panoramasData.push(new PanoramaData("pano_a", "path_a"));
+
+ infoCount = 0;
+ warningCount = 0;
+ errorCount = 0;
+ }
+
+ [Test]
+ public function smokeTest():void {
+
+ managerData.panoramasData[0].hotspotsData.push(new HotspotDataImage("hs_1", "path_1"));
+ managerData.panoramasData[0].hotspotsData.push(new HotspotDataSwf("hs_2", "path_2"));
+
+ checkHotspots(managerData);
+
+ Assert.assertEquals(0, infoCount);
+ Assert.assertEquals(0, warningCount);
+ Assert.assertEquals(0, errorCount);
+ }
+
+ [Test]
+ public function missingId():void {
+ managerData.panoramasData[0].hotspotsData.push(new HotspotDataImage(null, "path_1"));
+
+ checkHotspots(managerData);
+
+ Assert.assertEquals(0, infoCount);
+ Assert.assertEquals(0, warningCount);
+ Assert.assertEquals(1, errorCount);
+ }
+
+ [Test]
+ public function repeatingIdSamePanorama():void {
+ managerData.panoramasData[0].hotspotsData.push(new HotspotDataImage("hs_1", "path_1"));
+ managerData.panoramasData[0].hotspotsData.push(new HotspotDataImage("hs_1", "path_2"));
+
+ checkHotspots(managerData);
+
+ Assert.assertEquals(0, infoCount);
+ Assert.assertEquals(1, warningCount);
+ Assert.assertEquals(0, errorCount);
+ }
+
+ [Test]
+ public function repeatingIdDifferentPanorama():void {
+ managerData.panoramasData[0].hotspotsData.push(new HotspotDataImage("hs_1", "path_1"));
+ managerData.panoramasData.push(new PanoramaData("pano_b", "path_b"));
+ managerData.panoramasData[1].hotspotsData.push(new HotspotDataSwf("hs_1", "path_2"));
+
+ checkHotspots(managerData);
+
+ Assert.assertEquals(0, infoCount);
+ Assert.assertEquals(1, warningCount);
+ Assert.assertEquals(0, errorCount);
+ }
+
+ [Test]
+ public function missingPathSwf():void {
+ managerData.panoramasData[0].hotspotsData.push(new HotspotDataSwf("hs_1", null));
+
+ checkHotspots(managerData);
+
+ Assert.assertEquals(0, infoCount);
+ Assert.assertEquals(0, warningCount);
+ Assert.assertEquals(1, errorCount);
+ }
+
+ [Test]
+ public function missingPathImage():void {
+ managerData.panoramasData[0].hotspotsData.push(new HotspotDataImage("hs_1", null));
+
+ checkHotspots(managerData);
+
+ Assert.assertEquals(0, infoCount);
+ Assert.assertEquals(0, warningCount);
+ Assert.assertEquals(1, errorCount);
+ }
+
+ [Test]
+ public function hotspotMousePass():void {
+ managerData.panoramasData.push(new PanoramaData("a", "path_a"));
+ managerData.panoramasData[0].hotspotsData.push(new HotspotDataImage("spot_1", "path_1"));
+ managerData.panoramasData[0].hotspotsData[0].mouse.onClick = "act_1";
+ managerData.panoramasData[0].hotspotsData[0].mouse.onOut = "act_2";
+ managerData.panoramasData[0].hotspotsData[0].mouse.onOver = "act_3";
+ managerData.panoramasData[0].hotspotsData[0].mouse.onPress = "act_4";
+ managerData.actionsData.push(new ActionData("act_1"));
+ managerData.actionsData.push(new ActionData("act_2"));
+ managerData.actionsData.push(new ActionData("act_3"));
+ managerData.actionsData.push(new ActionData("act_4"));
+
+ checkHotspots(managerData);
+
+ Assert.assertEquals(0, infoCount);
+ Assert.assertEquals(0, warningCount);
+ Assert.assertEquals(0, errorCount);
+ }
+
+ [Test]
+ public function hotspotMouseWrongActionId():void {
+ managerData.panoramasData.push(new PanoramaData("a", "path_a"));
+ managerData.panoramasData[0].hotspotsData.push(new HotspotDataImage("spot_1", "path_1"));
+ managerData.panoramasData[0].hotspotsData[0].mouse.onClick = "act_99";
+
+ checkHotspots(managerData);
+
+ Assert.assertEquals(0, infoCount);
+ Assert.assertEquals(0, warningCount);
+ Assert.assertEquals(1, errorCount);
+ }
+ }
}
View
200 ...tils/configuration/ManagerDataValidatorModules.as → ...tils/configuration/ManagerDataValidatorModules.as
@@ -1,101 +1,101 @@
-package test.com.panozona.player.manager.utils.configuration{
-
- import com.panozona.player.module.*;
- import com.panozona.player.module.data.*;
- import com.panozona.player.module.utils.*;
- import com.panozona.player.manager.data.*;
- import com.panozona.player.manager.data.panoramas.*;
- import com.panozona.player.manager.events.*;
- import com.panozona.player.manager.utils.configuration.*;
- import com.robertpenner.easing.*;
- import flash.events.*;
- import flexunit.framework.*;
- import org.hamcrest.*;
-
- public class ManagerDataValidatorModules extends com.panozona.player.manager.utils.configuration.ManagerDataValidator{
-
- protected var infoCount:int;
- protected var warningCount:int;
- protected var errorCount:int;
-
- protected var managerData:ManagerData;
-
- public function ManagerDataValidatorModules():void {
- addEventListener(ConfigurationEvent.INFO, function(event:Event):void {infoCount++;});
- addEventListener(ConfigurationEvent.WARNING, function(event:Event):void{warningCount++;});
- addEventListener(ConfigurationEvent.ERROR, function(event:Event):void { errorCount++; } );
- }
-
- [Before]
- public function beforeTest():void {
- managerData = new ManagerData();
-
- infoCount = 0;
- warningCount = 0;
- errorCount = 0;
- }
-
- [Test]
- public function checkModulesPass():void {
- managerData.modulesData.push(new ModuleData("name_a", "patha_a"));
- managerData.modulesData[0].descriptionReference = new ModuleDescription("name_a", "1.0", "http://panozona.com/");
- managerData.modulesData.push(new ModuleData("name_b", "patha_b"));
- managerData.modulesData[1].descriptionReference = new ModuleDescription("name_b", "1.0", "http://panozona.com/");
-
- checkModules(managerData);
-
- Assert.assertEquals(0, infoCount);
- Assert.assertEquals(0, warningCount);
- Assert.assertEquals(0, errorCount);
- }
-
- [Test]
- public function checkModulesNoName():void {
- managerData.modulesData.push(new ModuleData(null, "path_a"));
- managerData.modulesData[0].descriptionReference = new ModuleDescription("name_a", "1.0", "http://panozona.com/");
-
- checkModules(managerData);
-
- Assert.assertEquals(0, infoCount);
- Assert.assertEquals(0, warningCount);
- Assert.assertEquals(1, errorCount);
- }
-
- [Test]
- public function checkModulesNoPath():void {
- managerData.modulesData.push(new ModuleData("name_a", null));
- managerData.modulesData[0].descriptionReference = new ModuleDescription("name_a", "1.0", "http://panozona.com/");
-
- checkModules(managerData);
-
- Assert.assertEquals(0, infoCount);
- Assert.assertEquals(0, warningCount);
- Assert.assertEquals(1, errorCount);
- }
-
- [Test]
- public function checkModulesNoDescription():void {
- managerData.modulesData.push(new ModuleData("name_a", "path_a"));
-
- checkModules(managerData);
-
- Assert.assertEquals(0, infoCount);
- Assert.assertEquals(0, warningCount);
- Assert.assertEquals(1, errorCount);
- }
-
- [Test]
- public function checkModulesRepeatName():void {
- managerData.modulesData.push(new ModuleData("comp_a", "path_a"));
- managerData.modulesData[0].descriptionReference = new ModuleDescription("comp_a", "1.0", "http://panozona.com/");
- managerData.modulesData.push(new ModuleData("comp_a", "path_b"));
- managerData.modulesData[1].descriptionReference = new ModuleDescription("comp_b", "1.0", "http://panozona.com/");
-
- checkModules(managerData);
-
- Assert.assertEquals(0, infoCount);
- Assert.assertEquals(1, warningCount);
- Assert.assertEquals(0, errorCount);
- }
- }
+package test.com.panozona.player.manager.utils.configuration{
+
+ import com.panozona.player.module.*;
+ import com.panozona.player.module.data.*;
+ import com.panozona.player.module.utils.*;
+ import com.panozona.player.manager.data.*;
+ import com.panozona.player.manager.data.panoramas.*;
+ import com.panozona.player.manager.events.*;
+ import com.panozona.player.manager.utils.configuration.*;
+ import com.robertpenner.easing.*;
+ import flash.events.*;
+ import flexunit.framework.*;
+ import org.hamcrest.*;
+
+ public class ManagerDataValidatorModules extends com.panozona.player.manager.utils.configuration.ManagerDataValidator{
+
+ protected var infoCount:int;
+ protected var warningCount:int;
+ protected var errorCount:int;
+
+ protected var managerData:ManagerData;
+
+ public function ManagerDataValidatorModules():void {
+ addEventListener(ConfigurationEvent.INFO, function(event:Event):void {infoCount++;});
+ addEventListener(ConfigurationEvent.WARNING, function(event:Event):void{warningCount++;});
+ addEventListener(ConfigurationEvent.ERROR, function(event:Event):void { errorCount++; } );
+ }
+
+ [Before]
+ public function beforeTest():void {
+ managerData = new ManagerData();
+
+ infoCount = 0;
+ warningCount = 0;
+ errorCount = 0;
+ }
+
+ [Test]
+ public function checkModulesPass():void {
+ managerData.modulesData.push(new ModuleData("name_a", "patha_a"));
+ managerData.modulesData[0].descriptionReference = new ModuleDescription("name_a", "1.0", "http://panozona.com/");
+ managerData.modulesData.push(new ModuleData("name_b", "patha_b"));
+ managerData.modulesData[1].descriptionReference = new ModuleDescription("name_b", "1.0", "http://panozona.com/");
+
+ checkModules(managerData);
+
+ Assert.assertEquals(0, infoCount);
+ Assert.assertEquals(0, warningCount);
+ Assert.assertEquals(0, errorCount);
+ }
+
+ [Test]
+ public function checkModulesNoName():void {
+ managerData.modulesData.push(new ModuleData(null, "path_a"));
+ managerData.modulesData[0].descriptionReference = new ModuleDescription("name_a", "1.0", "http://panozona.com/");
+
+ checkModules(managerData);
+
+ Assert.assertEquals(0, infoCount);
+ Assert.assertEquals(0, warningCount);
+ Assert.assertEquals(1, errorCount);
+ }
+
+ [Test]
+ public function checkModulesNoPath():void {
+ managerData.modulesData.push(new ModuleData("name_a", null));
+ managerData.modulesData[0].descriptionReference = new ModuleDescription("name_a", "1.0", "http://panozona.com/");
+
+ checkModules(managerData);
+
+ Assert.assertEquals(0, infoCount);
+ Assert.assertEquals(0, warningCount);
+ Assert.assertEquals(1, errorCount);
+ }
+
+ [Test]
+ public function checkModulesNoDescription():void {
+ managerData.modulesData.push(new ModuleData("name_a", "path_a"));
+
+ checkModules(managerData);
+
+ Assert.assertEquals(0, infoCount);
+ Assert.assertEquals(0, warningCount);
+ Assert.assertEquals(1, errorCount);
+ }
+
+ [Test]
+ public function checkModulesRepeatName():void {
+ managerData.modulesData.push(new ModuleData("comp_a", "path_a"));
+ managerData.modulesData[0].descriptionReference = new ModuleDescription("comp_a", "1.0", "http://panozona.com/");
+ managerData.modulesData.push(new ModuleData("comp_a", "path_b"));
+ managerData.modulesData[1].descriptionReference = new ModuleDescription("comp_b", "1.0", "http://panozona.com/");
+
+ checkModules(managerData);
+
+ Assert.assertEquals(0, infoCount);
+ Assert.assertEquals(1, warningCount);
+ Assert.assertEquals(0, errorCount);
+ }
+ }
}
View
0  ...ls/configuration/ManagerDataValidatorPanoramas.as → ...ls/configuration/ManagerDataValidatorPanoramas.as
File renamed without changes
View
248 ...yer/manager/utils/loading/LoadablesLoaderAsync.as → ...yer/manager/utils/loading/LoadablesLoaderAsync.as
@@ -1,125 +1,125 @@
-package test.com.panozona.player.manager.utils.loading {
-
- import com.panozona.player.manager.events.*;
- import com.panozona.player.manager.utils.loading.*;
- import flexunit.framework.Assert;
- import org.flexunit.async.Async;
-
- public class LoadablesLoaderAsync{
-
- protected var loadablesLoader:LoadablesLoader;
- protected var loadables:Vector.<ILoadable>;
- protected var dummyLoadables:Vector.<DummyLoadable>;
-
- protected var loadedCounter:Number;
- protected var lostCounter:Number;
-
- [Before]
- public function setUp():void {
- loadablesLoader = new LoadablesLoader();
- loadables = new Vector.<ILoadable>();
- dummyLoadables = new Vector.<DummyLoadable>();
- loadedCounter = 0;
- lostCounter = 0;
- }
-
- [After]
- public function tearDown():void {
- loadablesLoader.abort();
- }
-
- [Test(async)]
- public function nothingToLoad():void {
- var asyncHandler:Function = Async.asyncHandler( this, handleFinishedNothing, 100, null, handleTimeoutNothing);
- loadablesLoader.addEventListener(LoadLoadableEvent.FINISHED, asyncHandler, false, 0, true);
- loadablesLoader.load(loadables);
- }
- protected function handleFinishedNothing(event:LoadLoadableEvent, passThroughData:Object):void {
- Assert.assertEquals(LoadLoadableEvent.FINISHED, event.type);
- Assert.assertEquals(0, lostCounter);
- Assert.assertEquals(0, loadedCounter);
- }
- protected function handleTimeoutNothing(passThroughData:Object):void {
- Assert.fail( "Timeout reached before event");
- }
-
- [Test(async)]
- public function allPathsCorrect():void {
- var asyncHandler:Function = Async.asyncHandler( this, handleFinishedCorrect, 500, null, handleTimeoutCorrect);
- loadablesLoader.addEventListener(LoadLoadableEvent.FINISHED, asyncHandler, false, 0, true);
- loadablesLoader.addEventListener(LoadLoadableEvent.LOADED, function(e:LoadLoadableEvent):void {loadedCounter ++ }, false, 0, true);
- loadablesLoader.addEventListener(LoadLoadableEvent.LOST, function(e:LoadLoadableEvent):void{lostCounter ++}, false, 0, true);
-
- loadables.push(new DummyLoadable("assets/blue.png"));
- loadables.push(new DummyLoadable("assets/red.jpg"));
- loadables.push(new DummyLoadable("assets/yellow.gif"));
- loadablesLoader.load(loadables);
- }
- protected function handleFinishedCorrect(event:LoadLoadableEvent, passThroughData:Object):void {
- Assert.assertEquals(LoadLoadableEvent.FINISHED, event.type);
- Assert.assertEquals(0, lostCounter);
- Assert.assertEquals(3, loadedCounter);
- }
- protected function handleTimeoutCorrect(passThroughData:Object):void {
- Assert.fail( "Timeout reached before event");
- }
-
- [Test(async)]
- public function allPathsCorrect2():void {
- var asyncHandler:Function = Async.asyncHandler( this, handleFinishedCorrect2, 500, null, handleTimeoutCorrect2);
- loadablesLoader.addEventListener(LoadLoadableEvent.FINISHED, asyncHandler, false, 0, true);
- loadablesLoader.addEventListener(LoadLoadableEvent.LOADED, function(e:LoadLoadableEvent):void {loadedCounter ++ }, false, 0, true);
- loadablesLoader.addEventListener(LoadLoadableEvent.LOST, function(e:LoadLoadableEvent):void{lostCounter ++}, false, 0, true);
-
- dummyLoadables.push(new DummyLoadable("assets/blue.png"));
- dummyLoadables.push(new DummyLoadable("assets/red.jpg"));
- dummyLoadables.push(new DummyLoadable("assets/yellow.gif"));
- loadablesLoader.load(Vector.<ILoadable>(dummyLoadables));
- }
- protected function handleFinishedCorrect2(event:LoadLoadableEvent, passThroughData:Object):void {
- Assert.assertEquals(LoadLoadableEvent.FINISHED, event.type);
- Assert.assertEquals(0, lostCounter);
- Assert.assertEquals(3, loadedCounter);
- }
- protected function handleTimeoutCorrect2(passThroughData:Object):void {
- Assert.fail( "Timeout reached before event");
- }
-
- [Test(async)]
- public function pathsInvalid():void {
- var asyncHandler:Function = Async.asyncHandler(this, handleFinishedPathsInvalid, 500, null, handleTimeoutPathsInvalid);
- loadablesLoader.addEventListener(LoadLoadableEvent.FINISHED, asyncHandler, false, 0, true);
- loadablesLoader.addEventListener(LoadLoadableEvent.LOADED, function(e:LoadLoadableEvent):void {loadedCounter ++ }, false, 0, true);
- loadablesLoader.addEventListener(LoadLoadableEvent.LOST, function(e:LoadLoadableEvent):void{lostCounter ++}, false, 0, true);
-
- loadables.push(new DummyLoadable("assets/invalid.png"));
- loadables.push(new DummyLoadable("assets/green.bmp")); // unsupported type
- loadables.push(new DummyLoadable("assets/red.jpg"));
- loadables.push(new DummyLoadable("assets/yellow.gif"));
- loadablesLoader.load(loadables);
- }
- protected function handleFinishedPathsInvalid(event:LoadLoadableEvent, passThroughData:Object):void {
- Assert.assertEquals(LoadLoadableEvent.FINISHED, event.type);
- Assert.assertEquals(2, lostCounter);
- Assert.assertEquals(2, loadedCounter);
- }
- protected function handleTimeoutPathsInvalid(passThroughData:Object):void {
- Assert.fail( "Timeout reached before event");
- }
- }
-}
-
-import com.panozona.player.manager.utils.loading.*;
-
-class DummyLoadable implements ILoadable {
-
- private var _path:String;
-
- public function DummyLoadable(path:String):void {
- _path = path;
- }
-
- public function get path():String {
- return _path;
- }
+package test.com.panozona.player.manager.utils.loading {
+
+ import com.panozona.player.manager.events.*;
+ import com.panozona.player.manager.utils.loading.*;
+ import flexunit.framework.Assert;
+ import org.flexunit.async.Async;
+
+ public class LoadablesLoaderAsync{
+
+ protected var loadablesLoader:LoadablesLoader;
+ protected var loadables:Vector.<ILoadable>;
+ protected var dummyLoadables:Vector.<DummyLoadable>;
+
+ protected var loadedCounter:Number;
+ protected var lostCounter:Number;
+
+ [Before]
+ public function setUp():void {
+ loadablesLoader = new LoadablesLoader();
+ loadables = new Vector.<ILoadable>();
+ dummyLoadables = new Vector.<DummyLoadable>();
+ loadedCounter = 0;
+ lostCounter = 0;
+ }
+
+ [After]
+ public function tearDown():void {
+ loadablesLoader.abort();
+ }
+
+ [Test(async)]
+ public function nothingToLoad():void {
+ var asyncHandler:Function = Async.asyncHandler( this, handleFinishedNothing, 100, null, handleTimeoutNothing);
+ loadablesLoader.addEventListener(LoadLoadableEvent.FINISHED, asyncHandler, false, 0, true);
+ loadablesLoader.load(loadables);
+ }
+ protected function handleFinishedNothing(event:LoadLoadableEvent, passThroughData:Object):void {
+ Assert.assertEquals(LoadLoadableEvent.FINISHED, event.type);
+ Assert.assertEquals(0, lostCounter);
+ Assert.assertEquals(0, loadedCounter);
+ }
+ protected function handleTimeoutNothing(passThroughData:Object):void {
+ Assert.fail( "Timeout reached before event");
+ }
+
+ [Test(async)]
+ public function allPathsCorrect():void {
+ var asyncHandler:Function = Async.asyncHandler( this, handleFinishedCorrect, 500, null, handleTimeoutCorrect);
+ loadablesLoader.addEventListener(LoadLoadableEvent.FINISHED, asyncHandler, false, 0, true);
+ loadablesLoader.addEventListener(LoadLoadableEvent.LOADED, function(e:LoadLoadableEvent):void {loadedCounter ++ }, false, 0, true);
+ loadablesLoader.addEventListener(LoadLoadableEvent.LOST, function(e:LoadLoadableEvent):void{lostCounter ++}, false, 0, true);
+
+ loadables.push(new DummyLoadable("../assets/blue.png"));
+ loadables.push(new DummyLoadable("../assets/red.jpg"));
+ loadables.push(new DummyLoadable("../assets/yellow.gif"));
+ loadablesLoader.load(loadables);
+ }
+ protected function handleFinishedCorrect(event:LoadLoadableEvent, passThroughData:Object):void {
+ Assert.assertEquals(LoadLoadableEvent.FINISHED, event.type);
+ Assert.assertEquals(0, lostCounter);
+ Assert.assertEquals(3, loadedCounter);
+ }
+ protected function handleTimeoutCorrect(passThroughData:Object):void {
+ Assert.fail( "Timeout reached before event");
+ }
+
+ [Test(async)]
+ public function allPathsCorrect2():void {
+ var asyncHandler:Function = Async.asyncHandler( this, handleFinishedCorrect2, 500, null, handleTimeoutCorrect2);
+ loadablesLoader.addEventListener(LoadLoadableEvent.FINISHED, asyncHandler, false, 0, true);
+ loadablesLoader.addEventListener(LoadLoadableEvent.LOADED, function(e:LoadLoadableEvent):void {loadedCounter ++ }, false, 0, true);
+ loadablesLoader.addEventListener(LoadLoadableEvent.LOST, function(e:LoadLoadableEvent):void{lostCounter ++}, false, 0, true);
+
+ dummyLoadables.push(new DummyLoadable("../assets/blue.png"));
+ dummyLoadables.push(new DummyLoadable("../assets/red.jpg"));
+ dummyLoadables.push(new DummyLoadable("../assets/yellow.gif"));
+ loadablesLoader.load(Vector.<ILoadable>(dummyLoadables));
+ }
+ protected function handleFinishedCorrect2(event:LoadLoadableEvent, passThroughData:Object):void {
+ Assert.assertEquals(LoadLoadableEvent.FINISHED, event.type);
+ Assert.assertEquals(0, lostCounter);
+ Assert.assertEquals(3, loadedCounter);
+ }
+ protected function handleTimeoutCorrect2(passThroughData:Object):void {
+ Assert.fail( "Timeout reached before event");
+ }
+
+ [Test(async)]
+ public function pathsInvalid():void {
+ var asyncHandler:Function = Async.asyncHandler(this, handleFinishedPathsInvalid, 500, null, handleTimeoutPathsInvalid);
+ loadablesLoader.addEventListener(LoadLoadableEvent.FINISHED, asyncHandler, false, 0, true);
+ loadablesLoader.addEventListener(LoadLoadableEvent.LOADED, function(e:LoadLoadableEvent):void {loadedCounter ++ }, false, 0, true);
+ loadablesLoader.addEventListener(LoadLoadableEvent.LOST, function(e:LoadLoadableEvent):void{lostCounter ++}, false, 0, true);
+
+ loadables.push(new DummyLoadable("../assets/invalid.png"));
+ loadables.push(new DummyLoadable("../assets/green.bmp")); // unsupported type
+ loadables.push(new DummyLoadable("../assets/red.jpg"));
+ loadables.push(new DummyLoadable("../assets/yellow.gif"));
+ loadablesLoader.load(loadables);
+ }
+ protected function handleFinishedPathsInvalid(event:LoadLoadableEvent, passThroughData:Object):void {
+ Assert.assertEquals(LoadLoadableEvent.FINISHED, event.type);
+ Assert.assertEquals(2, lostCounter);
+ Assert.assertEquals(2, loadedCounter);
+ }
+ protected function handleTimeoutPathsInvalid(passThroughData:Object):void {
+ Assert.fail( "Timeout reached before event");
+ }
+ }
+}
+
+import com.panozona.player.manager.utils.loading.*;
+
+class DummyLoadable implements ILoadable {
+
+ private var _path:String;
+
+ public function DummyLoadable(path:String):void {
+ _path = path;
+ }
+
+ public function get path():String {
+ return _path;
+ }
}
View
162 .../player/module/utils/DataNodeTranslatorBoolean.as → .../player/module/utils/DataNodeTranslatorBoolean.as
@@ -1,81 +1,81 @@
-package test.com.panozona.player.module.utils{
-
- import com.panozona.player.module.*;
- import com.panozona.player.module.data.*;
- import com.panozona.player.module.utils.*;
- import com.panozona.player.manager.data.actions.*;
- import com.robertpenner.easing.*;
- import flash.events.*;
- import flexunit.framework.*;
- import org.hamcrest.*;
-
- public class DataNodeTranslatorBoolean extends com.panozona.player.module.utils.DataNodeTranslator {
-
- protected var message:String;
-
- public function DataNodeTranslatorBoolean(){
- super(true);
- }
-
- [Before]
- public function beforeTest():void {
- message = "";
- }
-
- [Test]
- public function mismatchBooleanNumber():void {
- var moduleNode:DataNode = new DataNode("any");
- moduleNode.attributes["boolean"] = -21.21;
- var dummyObject:DummyObject = new DummyObject();
- try{
- dataNodeToObject(moduleNode, dummyObject);
- }catch(e:Error){
- message = e.message;
- }
- Assert.assertEquals("Invalid boolean type (Boolean expected): -21.21", message);
- }
-
- [Test]
- public function mismatchBooleanString():void {
- var moduleNode:DataNode = new DataNode("any");
- moduleNode.attributes["boolean"] = "foo";
- var dummyObject:DummyObject = new DummyObject();
- try{
- dataNodeToObject(moduleNode, dummyObject);
- }catch(e:Error){
- message = e.message;
- }
- Assert.assertEquals("Invalid boolean type (Boolean expected): foo", message);
- }
-
- [Test]
- public function mismatchBooleanFunction():void {
- var moduleNode:DataNode = new DataNode("any");
- moduleNode.attributes["boolean"] = Linear.easeOut;
- var dummyObject:DummyObject = new DummyObject();
- try{
- dataNodeToObject(moduleNode, dummyObject);
- }catch(e:Error){
- message = e.message;
- }
- Assert.assertEquals("Invalid boolean type (Boolean expected): function Function() {}", message);
- }
-
- [Test]
- public function mismatchBooleanObject():void {
- var moduleNode:DataNode = new DataNode("any");
- moduleNode.attributes["boolean"] = new Object();
- var dummyObject:DummyObject = new DummyObject();
- try{
- dataNodeToObject(moduleNode, dummyObject);
- }catch(e:Error){
- message = e.message;
- }
- Assert.assertEquals("Invalid boolean type (Boolean expected): [object Object]", message);
- }
- }
-}
-
-class DummyObject{
- public var boolean:Boolean;
-}
+package test.com.panozona.player.module.utils{
+
+ import com.panozona.player.module.*;
+ import com.panozona.player.module.data.*;
+ import com.panozona.player.module.utils.*;
+ import com.panozona.player.manager.data.actions.*;
+ import com.robertpenner.easing.*;
+ import flash.events.*;
+ import flexunit.framework.*;
+ import org.hamcrest.*;
+
+ public class DataNodeTranslatorBoolean extends com.panozona.player.module.utils.DataNodeTranslator {
+
+ protected var message:String;
+
+ public function DataNodeTranslatorBoolean(){
+ super(true);
+ }
+
+ [Before]
+ public function beforeTest():void {
+ message = "";
+ }
+
+ [Test]
+ public function mismatchBooleanNumber():void {
+ var moduleNode:DataNode = new DataNode("any");
+ moduleNode.attributes["boolean"] = -21.21;
+ var dummyObject:DummyObject = new DummyObject();
+ try{
+ dataNodeToObject(moduleNode, dummyObject);
+ }catch(e:Error){
+ message = e.message;
+ }
+ Assert.assertEquals("Invalid boolean type (Boolean expected): -21.21", message);
+ }
+
+ [Test]
+ public function mismatchBooleanString():void {
+ var moduleNode:DataNode = new DataNode("any");
+ moduleNode.attributes["boolean"] = "foo";
+ var dummyObject:DummyObject = new DummyObject();
+ try{
+ dataNodeToObject(moduleNode, dummyObject);
+ }catch(e:Error){
+ message = e.message;
+ }
+ Assert.assertEquals("Invalid boolean type (Boolean expected): foo", message);
+ }
+
+ [Test]
+ public function mismatchBooleanFunction():void {
+ var moduleNode:DataNode = new DataNode("any");
+ moduleNode.attributes["boolean"] = Linear.easeOut;
+ var dummyObject:DummyObject = new DummyObject();
+ try{
+ dataNodeToObject(moduleNode, dummyObject);
+ }catch(e:Error){
+ message = e.message;
+ }
+ Assert.assertEquals("Invalid boolean type (Boolean expected): function Function() {}", message);
+ }
+
+ [Test]
+ public function mismatchBooleanObject():void {
+ var moduleNode:DataNode = new DataNode("any");
+ moduleNode.attributes["boolean"] = new Object();
+ var dummyObject:DummyObject = new DummyObject();
+ try{
+ dataNodeToObject(moduleNode, dummyObject);
+ }catch(e:Error){
+ message = e.message;
+ }
+ Assert.assertEquals("Invalid boolean type (Boolean expected): [object Object]", message);
+ }
+ }
+}
+
+class DummyObject{
+ public var boolean:Boolean;
+}
View
270 ...player/module/utils/DataNodeTranslatorFunction.as → ...player/module/utils/DataNodeTranslatorFunction.as
@@ -1,136 +1,136 @@
-package test.com.panozona.player.module.utils {
-
- import com.panozona.player.module.*;
- import com.panozona.player.module.data.*;
- import com.panozona.player.module.utils.*;
- import com.panozona.player.manager.data.actions.*;
- import com.robertpenner.easing.*;
- import flash.events.*;
- import flexunit.framework.*;
- import org.hamcrest.*;
-
- public class DataNodeTranslatorFunction extends com.panozona.player.module.utils.DataNodeTranslator {
-
- protected var message:String;
-
- public function DataNodeTranslatorFunction(){
- super(true);
- }
-
- [Before]
- public function beforeTest():void {
- message = "";
- }
-
- [Test]
- public function mismatchFunctionInitBoolean():void {
- var moduleNode:DataNode = new DataNode("any");
- moduleNode.attributes["functionInit"] = true;
- var dummyObject:DummyObject = new DummyObject();
- try{
- dataNodeToObject(moduleNode, dummyObject);
- }catch(e:Error){
- message = e.message;
- }
- Assert.assertEquals("Invalid functionInit type (Function expected): true", message);
- }
-
- /*[Test]
- public function mismatchFunctionNonInitBoolean():void {
- var moduleNode:DataNode = new DataNode("any");
- moduleNode.attributes["functionNonInit"] = true;
- var dummyObject:DummyObject = new DummyObject();
- try{
- dataNodeToObject(moduleNode, dummyObject);
- }catch(e:Error){
- message = e.message;
- }
- Assert.assertEquals("Invalid attribute type (Function expected): true", message);
- }*/
-
- [Test]
- public function mismatchFunctionInitNumber():void {
- var moduleNode:DataNode = new DataNode("any");
- moduleNode.attributes["functionInit"] = -21.21
- var dummyObject:DummyObject = new DummyObject();
- try{
- dataNodeToObject(moduleNode, dummyObject);
- }catch(e:Error){
- message = e.message;
- }
- Assert.assertEquals("Invalid functionInit type (Function expected): -21.21", message);
- }
-
- /*[Test]
- public function mismatchFunctionNonInitNumber():void {
- var moduleNode:DataNode = new DataNode("any");
- moduleNode.attributes["functionNonInit"] = -21.21;
- var dummyObject:DummyObject = new DummyObject();
- try{
- dataNodeToObject(moduleNode, dummyObject);
- }catch(e:Error){
- message = e.message;
- }
- Assert.assertEquals("Invalid attribute type (Function expected): -21.21", message);
- }*/
-
- [Test]
- public function mismatchFunctionInitString():void {
- var moduleNode:DataNode = new DataNode("any");
- moduleNode.attributes["functionInit"] = "foo"
- var dummyObject:DummyObject = new DummyObject();
- try{
- dataNodeToObject(moduleNode, dummyObject);
- }catch(e:Error){
- message = e.message;
- }
- Assert.assertEquals("Invalid functionInit type (Function expected): foo", message);
- }
-
- /*[Test]
- public function mismatchFunctionNonInitSring():void {
- var moduleNode:DataNode = new DataNode("any");
- moduleNode.attributes["functionNonInit"] = "foo";
- var dummyObject:DummyObject = new DummyObject();
- try{
- dataNodeToObject(moduleNode, dummyObject);
- }catch(e:Error){
- message = e.message;
- }
- Assert.assertEquals("Invalid attribute type (Function expected): foo", message);
- }*/
-
- [Test]
- public function mismatchFunctionInitObject():void {
- var moduleNode:DataNode = new DataNode("any");
- moduleNode.attributes["functionInit"] = new Object();
- var dummyObject:DummyObject = new DummyObject();
- try{
- dataNodeToObject(moduleNode, dummyObject);
- }catch(e:Error){
- message = e.message;
- }
- Assert.assertEquals("Invalid functionInit type (Function expected): [object Object]", message);
- }
-
- /*[Test]
- public function mismatchFunctionNonInitObject():void {
- var moduleNode:DataNode = new DataNode("any");
- moduleNode.attributes["functionNonInit"] = new Object();
- var dummyObject:DummyObject = new DummyObject();
- try{
- dataNodeToObject(moduleNode, dummyObject);
- }catch(e:Error){
- message = e.message;
- }
- Assert.assertEquals("Invalid attribute type (Function expected): [object Object]", message);
- }*/
- }
-}
-
-import com.robertpenner.easing.*;
-
-class DummyObject{
- //public var functionNonInit:Function;
- public var functionInit:Function = Linear.easeNone;
+package test.com.panozona.player.module.utils {
+
+ import com.panozona.player.module.*;
+ import com.panozona.player.module.data.*;
+ import com.panozona.player.module.utils.*;
+ import com.panozona.player.manager.data.actions.*;
+ import com.robertpenner.easing.*;
+ import flash.events.*;
+ import flexunit.framework.*;
+ import org.hamcrest.*;
+
+ public class DataNodeTranslatorFunction extends com.panozona.player.module.utils.DataNodeTranslator {
+
+ protected var message:String;
+
+ public function DataNodeTranslatorFunction(){
+ super(true);
+ }
+
+ [Before]
+ public function beforeTest():void {
+ message = "";
+ }
+
+ [Test]
+ public function mismatchFunctionInitBoolean():void {
+ var moduleNode:DataNode = new DataNode("any");
+ moduleNode.attributes["functionInit"] = true;
+ var dummyObject:DummyObject = new DummyObject();
+ try{
+ dataNodeToObject(moduleNode, dummyObject);
+ }catch(e:Error){
+ message = e.message;
+ }
+ Assert.assertEquals("Invalid functionInit type (Function expected): true", message);
+ }
+
+ /*[Test]
+ public function mismatchFunctionNonInitBoolean():void {
+ var moduleNode:DataNode = new DataNode("any");
+ moduleNode.attributes["functionNonInit"] = true;
+ var dummyObject:DummyObject = new DummyObject();
+ try{
+ dataNodeToObject(moduleNode, dummyObject);
+ }catch(e:Error){
+ message = e.message;
+ }
+ Assert.assertEquals("Invalid attribute type (Function expected): true", message);
+ }*/
+
+ [Test]
+ public function mismatchFunctionInitNumber():void {
+ var moduleNode:DataNode = new DataNode("any");
+ moduleNode.attributes["functionInit"] = -21.21
+ var dummyObject:DummyObject = new DummyObject();
+ try{
+ dataNodeToObject(moduleNode, dummyObject);
+ }catch(e:Error){
+ message = e.message;
+ }
+ Assert.assertEquals("Invalid functionInit type (Function expected): -21.21", message);
+ }
+
+ /*[Test]
+ public function mismatchFunctionNonInitNumber():void {
+ var moduleNode:DataNode = new DataNode("any");
+ moduleNode.attributes["functionNonInit"] = -21.21;
+ var dummyObject:DummyObject = new DummyObject();
+ try{
+ dataNodeToObject(moduleNode, dummyObject);
+ }catch(e:Error){
+ message = e.message;
+ }
+ Assert.assertEquals("Invalid attribute type (Function expected): -21.21", message);
+ }*/
+
+ [Test]
+ public function mismatchFunctionInitString():void {
+ var moduleNode:DataNode = new DataNode("any");
+ moduleNode.attributes["functionInit"] = "foo"
+ var dummyObject:DummyObject = new DummyObject();
+ try{
+ dataNodeToObject(moduleNode, dummyObject);
+ }catch(e:Error){
+ message = e.message;
+ }
+ Assert.assertEquals("Invalid functionInit type (Function expected): foo", message);
+ }
+
+ /*[Test]
+ public function mismatchFunctionNonInitSring():void {
+ var moduleNode:DataNode = new DataNode("any");
+ moduleNode.attributes["functionNonInit"] = "foo";
+ var dummyObject:DummyObject = new DummyObject();
+ try{
+ dataNodeToObject(moduleNode, dummyObject);
+ }catch(e:Error){
+ message = e.message;
+ }
+ Assert.assertEquals("Invalid attribute type (Function expected): foo", message);
+ }*/
+
+ [Test]
+ public function mismatchFunctionInitObject():void {
+ var moduleNode:DataNode = new DataNode("any");
+ moduleNode.attributes["functionInit"] = new Object();
+ var dummyObject:DummyObject = new DummyObject();
+ try{
+ dataNodeToObject(moduleNode, dummyObject);
+ }catch(e:Error){
+ message = e.message;
+ }
+ Assert.assertEquals("Invalid functionInit type (Function expected): [object Object]", message);
+ }
+
+ /*[Test]
+ public function mismatchFunctionNonInitObject():void {
+ var moduleNode:DataNode = new DataNode("any");
+ moduleNode.attributes["functionNonInit"] = new Object();
+ var dummyObject:DummyObject = new DummyObject();
+ try{
+ dataNodeToObject(moduleNode, dummyObject);
+ }catch(e:Error){
+ message = e.message;
+ }
+ Assert.assertEquals("Invalid attribute type (Function expected): [object Object]", message);
+ }*/
+ }
+}
+
+import com.robertpenner.easing.*;
+
+class DummyObject{
+ //public var functionNonInit:Function;
+ public var functionInit:Function = Linear.easeNone;
}
View
266 ...a/player/module/utils/DataNodeTranslatorNumber.as → ...a/player/module/utils/DataNodeTranslatorNumber.as
@@ -1,134 +1,134 @@
-package test.com.panozona.player.module.utils{
-
- import com.panozona.player.module.*;
- import com.panozona.player.module.data.*;
- import com.panozona.player.module.utils.*;
- import com.panozona.player.manager.data.actions.*;
- import com.robertpenner.easing.*;
- import flash.events.*;
- import flexunit.framework.*;
- import org.hamcrest.*;
-
- public class DataNodeTranslatorNumber extends com.panozona.player.module.utils.DataNodeTranslator {
-
- protected var message:String;
-
- public function DataNodeTranslatorNumber(){
- super(true);
- }
-
- [Before]
- public function beforeTest():void {<