Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Build v2.2.0 (See prv commits for changelog)

Fixed: Param#USER_DATA formal comment.
Added: Unit tests for StatsMonitor errors.
  • Loading branch information...
commit 4d3fd63acc145837e9ce6aba5f3ec16df1bcc864 1 parent 3a6f360
Matan authored
View
BIN  bin/testing/FlexTestSuite.swf
Binary file not shown
View
2  build.properties
@@ -2,7 +2,7 @@
project.name = AssetLoader
#Version number for current AssetLoader and AS3Singals releases
-assetloader.ver.num = v2.1.0
+assetloader.ver.num = v2.2.0
as3.signals.version = v0.8
project.name.versioned = ${project.name}-${assetloader.ver.num}
as3.signals.name.versioned = as3-signals-${as3.signals.version}
View
2  src/org/assetloader/base/Param.as
@@ -203,7 +203,7 @@ package org.assetloader.base
public static const CLIENT : String = "CLIENT";
/**
- * Allows you to attach any object/instance to an ILoader.
+ * Allows you to attach any object/instance to an ILoader.
*
* <p>Use: All asset types.</p>
* <p>Type: <code>Any Type</code></p>
View
63 src_unit/org/assetloader/base/AssetLoaderErrorTest.as
@@ -3,6 +3,7 @@ package org.assetloader.base
import org.assetloader.AssetLoader;
import org.assetloader.core.IAssetLoader;
import org.assetloader.core.ILoader;
+ import org.assetloader.loaders.ImageLoader;
import org.assetloader.loaders.TextLoader;
import org.flexunit.asserts.assertEquals;
import org.flexunit.asserts.assertTrue;
@@ -137,7 +138,7 @@ package org.assetloader.base
}
fail("Error was NOT catched.");
}
-
+
[Test]
public function circularReferenceFound_00() : void
{
@@ -163,7 +164,7 @@ package org.assetloader.base
var g2 : IAssetLoader = new AssetLoader("g2");
g1.addLoader(g2);
-
+
try
{
g2.addLoader(g1);
@@ -176,15 +177,17 @@ package org.assetloader.base
}
fail("Error was NOT catched.");
}
-
+
[Test]
public function circularReferenceFound_02() : void
{
var g1 : IAssetLoader = new AssetLoader("g1");
- var g2 : IAssetLoader = new AssetLoader("g2");
+ var g2 : IAssetLoader = new AssetLoader("g2");
+ var g3 : IAssetLoader = new AssetLoader("g3");
+
+ g1.addLoader(g2);
+ g2.addLoader(g3);
-
- g1.addLoader(g2);
try
{
g3.addLoader(g1);
@@ -197,7 +200,7 @@ package org.assetloader.base
}
fail("Error was NOT catched.");
}
- fail("Error was NOT catched.");
+
[Test]
public function alreadyContainedByOther() : void
{
@@ -206,7 +209,7 @@ package org.assetloader.base
var l1 : ILoader = new TextLoader(new URLRequest("sampleTXT.txt"));
g1.addLoader(l1);
-
+
try
{
g2.addLoader(l1);
@@ -219,5 +222,49 @@ package org.assetloader.base
}
fail("Error was NOT catched.");
}
+
+ [Test]
+ public function alreadyContainsLoader() : void
+ {
+ var monitor : StatsMonitor = new StatsMonitor();
+ var l1 : ILoader = new TextLoader(new URLRequest("assets/test/testTXT.txt"));
+ var l2 : ILoader = new ImageLoader(new URLRequest("assets/test/testIMAGE.png"));
+ try
+ {
+ monitor.add(l1);
+ monitor.add(l2);
+ // Adding l2 twice to produce error.
+ monitor.add(l2);
+ }
+ catch(error : AssetLoaderError)
+ {
+ assertTrue("error is AssetLoaderError", (error is AssetLoaderError));
+ assertEquals("error message", new AssetLoaderError(AssetLoaderError.ALREADY_CONTAINS_LOADER).message, error.message);
+ return;
+ }
+ fail("Error was NOT catched.");
+ }
+
+ [Test]
+ public function doesNotContainLoader() : void
+ {
+ var monitor : StatsMonitor = new StatsMonitor();
+ var l1 : ILoader = new TextLoader(new URLRequest("assets/test/testTXT.txt"));
+ var l2 : ILoader = new ImageLoader(new URLRequest("assets/test/testIMAGE.png"));
+
+ monitor.add(l1);
+ try
+ {
+ //Remove l2 which was never added.
+ monitor.remove(l2);
+ }
+ catch(error : AssetLoaderError)
+ {
+ assertTrue("error is AssetLoaderError", (error is AssetLoaderError));
+ assertEquals("error message", new AssetLoaderError(AssetLoaderError.DOESNT_CONTAIN_LOADER).message, error.message);
+ return;
+ }
+ fail("Error was NOT catched.");
+ }
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.