Add automated tests for MovieClip.getURL()-based FSCommand usage.
[gnash.git] / testsuite / misc-ming.all / hostcmd.as
blob1e4689b1a2744fb1c369a4b931f5a70f0ceb8773
1 // hostcmd.as - Non-predefined FSCommand invocation tests
2 //
3 // Copyright (C) 2017 Free Software Foundation, Inc.
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
19 // Note:
20 // This SWF file does not run any test by itself as this is a test on
21 // plugin's host interface.
23 // To run this test against proprietary player, use HTML-based
24 // test runners "hostcmd_htmltest_v*.html".
26 // Original author: Nutchanon Wetchasit <Nutchanon.Wetchasit@gmail.com>
29 // Once this Flash movie is run, it will issue non-predefined FSCommand
30 // via MovieClip.getURL() in mulitple combination of command and arguments;
31 // which will be forwarded to a handling function in host container-side
32 // scripting language; most likely `*_DoFSCommand(cmd,arg)` function
33 // in JavaScript (where "*" is the value of `name` attribute on `<object>`
34 // or `<embed>` tag which the SWF is playing).
36 var object_customstringarg;
38 trace("STARTOFTEST");
39 this.getURL("FSCommand:");
40 this.getURL("FSCommand:", "This is a string for empty call");
41 this.getURL("FSCommand:noarg");
42 this.getURL("FSCommand:stringarg", "This is a string");
43 this.getURL("FSCommand:weirdstringarg", "!@#$%^&*()_+-={}|[]\\:\";\'<>?,./~`");
44 this.getURL("FSCommand:integerarg", 9876);
45 this.getURL("FSCommand:floatarg", 9876.5432);
46 this.getURL("FSCommand:infinitearg", Infinity);
47 this.getURL("FSCommand:neginfinitearg", -Infinity);
48 this.getURL("FSCommand:nanarg", NaN);
49 this.getURL("FSCommand:booleanarg", true);
50 this.getURL("FSCommand:nullarg", null);
51 this.getURL("FSCommand:undefinedarg", undefined);
52 this.getURL("FSCommand:arrayarg", new Array("The", "quick", "brown", "fox", "jumps", "over", "the", "lazy", "dog"));
53 this.getURL("FSCommand:objectarg", new Object());
54 object_customstringarg = new Object();
55 object_customstringarg.toString = function():String {
56 return "This is a custom Object.toString()";
58 this.getURL("FSCommand:object_customstringarg", object_customstringarg);
59 trace("ENDOFTEST");