diff options
Diffstat (limited to 'includes/js/dojox/flash/tests')
-rw-r--r-- | includes/js/dojox/flash/tests/TestFlash.as | 36 | ||||
-rw-r--r-- | includes/js/dojox/flash/tests/TestFlash.swf | bin | 1863 -> 0 bytes | |||
-rw-r--r-- | includes/js/dojox/flash/tests/buildFlashTest.sh | 4 | ||||
-rw-r--r-- | includes/js/dojox/flash/tests/test_flash.html | 15 | ||||
-rw-r--r-- | includes/js/dojox/flash/tests/test_flash.js | 155 |
5 files changed, 0 insertions, 210 deletions
diff --git a/includes/js/dojox/flash/tests/TestFlash.as b/includes/js/dojox/flash/tests/TestFlash.as deleted file mode 100644 index d7be64f..0000000 --- a/includes/js/dojox/flash/tests/TestFlash.as +++ /dev/null @@ -1,36 +0,0 @@ -import DojoExternalInterface; -import ExpressInstall; - -class TestFlash{ - private var message:String; - - public function TestFlash(){ - } - - public static function main(){ - //getURL("javascript:alert('main')"); - trace("main"); - DojoExternalInterface.initialize(); - - var test = new TestFlash(); - DojoExternalInterface.addCallback("setMessage", test, test.setMessage); - DojoExternalInterface.addCallback("getMessage", test, test.getMessage); - DojoExternalInterface.addCallback("multipleValues", - test, test.multipleValues); - - DojoExternalInterface.done(); - } - - public function setMessage(message:String):Void{ - this.message = message; - } - - public function getMessage():String{ - return this.message; - } - - public function multipleValues(key:String, value:String, - namespace:String):String{ - return namespace + key + value; - } -}
\ No newline at end of file diff --git a/includes/js/dojox/flash/tests/TestFlash.swf b/includes/js/dojox/flash/tests/TestFlash.swf Binary files differdeleted file mode 100644 index cfd3f8d..0000000 --- a/includes/js/dojox/flash/tests/TestFlash.swf +++ /dev/null diff --git a/includes/js/dojox/flash/tests/buildFlashTest.sh b/includes/js/dojox/flash/tests/buildFlashTest.sh deleted file mode 100644 index a73d20c..0000000 --- a/includes/js/dojox/flash/tests/buildFlashTest.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -# TODO: FIXME: Get rid of this and hook it into Dojo's general build script -# You must have mtasc to run this -mtasc -trace DojoExternalInterface.trace -main -cp .. -swf TestFlash.swf -version 8 -header 215:138:10 TestFlash.as
\ No newline at end of file diff --git a/includes/js/dojox/flash/tests/test_flash.html b/includes/js/dojox/flash/tests/test_flash.html deleted file mode 100644 index 5e09f45..0000000 --- a/includes/js/dojox/flash/tests/test_flash.html +++ /dev/null @@ -1,15 +0,0 @@ -<html> - <head> - <script src="../../../dojo/dojo.js" djConfig="isDebug: true"></script> - - <script src="test_flash.js"></script> - </head> - - <body> - <h1>Test Dojox Flash</h1> - - <p>For detailed test output see Firebug console (if Firefox). - This test should be run on Firefox, Internet Explorer, and Safari - to confirm that Dojox Flash is working correctly.</p> - </body> -</html>
\ No newline at end of file diff --git a/includes/js/dojox/flash/tests/test_flash.js b/includes/js/dojox/flash/tests/test_flash.js deleted file mode 100644 index 1b26eb2..0000000 --- a/includes/js/dojox/flash/tests/test_flash.js +++ /dev/null @@ -1,155 +0,0 @@ -// TODO: FIXME: Refactor this to use D.O.H. instead of its own assertions - -dojo.require("dojox.flash"); - -var flashLoaded = false; -var pageLoaded = false; -var testXML = testBook = null; - -function flashReady(){ - console.debug("flashReady"); - flashLoaded = true; - - if(isReady()){ - run(); - } -} - -function pageReady(){ - console.debug("pageReady"); - pageLoaded = true; - - loadResources(); - - if(isReady()){ - run(); - } -} - -function isReady(){ - return testXML && testBook && pageLoaded && flashLoaded; -} - -function loadResources(){ - console.debug("Trying to load resources"); - - var d = dojo.xhrGet({ - url: "../../storage/tests/resources/testXML.xml", - handleAs: "text" - }); - - d.addCallback(function(results){ - console.debug("testXML loaded"); - testXML = results; - if(isReady()){ - run(); - } - }); - - d.addErrback(function(error){ - console.debug("Unable to load testXML.xml: " + error); - }); - - d = dojo.xhrGet({ - url: "../../storage/tests/resources/testBook.txt", - handleAs: "text" - }); - - d.addCallback(function(results){ - console.debug("testBook loaded"); - testBook = results; - if(isReady()){ - run(); - } - }); - - d.addErrback(function(error){ - console.debug("Unable to load testXML.xml: " + error); - }); -} - -function run(){ - console.debug("run"); - try{ - var correct, actual; - - console.debug("Setting simple message..."); - correct = "hello world"; - dojox.flash.comm.setMessage(correct); - actual = dojox.flash.comm.getMessage(); - assert(correct, actual, "Setting/getting simple message did not work"); - - console.debug("Setting message with evil characters..."); - // our correct and actual values get tricky when we have double back - // slashes; do a trick so that they can be compared easier - var doubleSlash = "\\"; - doubleSlash = doubleSlash.charAt(0); - correct = "hello world\n\n\nasdfasdf!@#$@#%^[]{}&<xml>" + doubleSlash - + "<div>$%^&%^&*^&()<><><>,./;\0\r\f\'][`~=\"+-]MORE!\n\rLESS"; - dojox.flash.comm.setMessage(correct); - actual = dojox.flash.comm.getMessage(); - assert(correct, actual, "Setting/getting message with evil characters did not work"); - - console.debug("Setting testXML..."); - correct = testXML; - dojox.flash.comm.setMessage(correct); - actual = dojox.flash.comm.getMessage(); - assert(correct, actual, "Setting/getting testXML did not work"); - - console.debug("Setting testBook(~300K)..."); - correct = testBook; - dojox.flash.comm.setMessage(correct); - actual = dojox.flash.comm.getMessage(); - assert(correct, actual, "Setting/getting testBook did not work"); - - console.debug("Setting testBook 3 times (~900K)..."); - correct = testBook + testBook + testBook; - dojox.flash.comm.setMessage(correct); - actual = dojox.flash.comm.getMessage(); - assert(correct, actual, "Setting/getting testBook X 3 did not work"); - - console.debug("Setting JSON..."); - var obj = {type: "car", color: "red", model: "Ford", year: "2008", - features: ["A/C", "automatic", "4-wheel drive"]}; - correct = dojo.toJson(obj, true); - dojox.flash.comm.setMessage(correct); - actual = dojox.flash.comm.getMessage(); - assert(correct, actual, "Setting/getting JSON did not work"); - - console.debug("Calling method that takes multiple values..."); - actual = dojox.flash.comm.multipleValues("key", "value", "namespace"); - assert("namespacekeyvalue", actual, "Setting/getting multiple values did not work"); - - var allPassed = document.createElement("p"); - allPassed.style.backgroundColor = "green"; - allPassed.style.color = "white"; - allPassed.style.fontSize = "24pt"; - allPassed.appendChild(document.createTextNode("All tests passed")); - var body = document.getElementsByTagName("body")[0]; - body.appendChild(allPassed); - }catch(e){ - console.debug(e.message || e); - } -} - -function assert(correct, actual, msg){ - //alert("correct="+correct+",\n\nactual="+actual); - if(correct != actual){ - var failed = document.createElement("p"); - failed.style.backgroundColor = "red"; - failed.style.color = "white"; - failed.style.fontSize = "24pt"; - failed.appendChild(document.createTextNode("Test failed: " + msg)); - var body = document.getElementsByTagName("body")[0]; - body.appendChild(failed); - - throw new Error("ASSERTION FAILED: " + msg); - }else{ - console.debug("Assertion passed"); - } -} - -console.debug("adding listeners..."); -dojox.flash.addLoadedListener(flashReady); -dojox.flash.setSwf("TestFlash.swf", true); -dojo.connect(dojo, "loaded", pageReady); |