Add automated tests on function-type FSCommand parameter passing.
[gnash.git] / testsuite / misc-ming.all / hostcmd.as
blob748124c7c03a6df7973cf95abbbb74386f83d81e
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 arrayarg;
37 var objectarg;
38 var object_customstringarg;
39 var functionarg;
41 trace("STARTOFTEST");
42 getURL("FSCommand:");
43 getURL("FSCommand:", "This is a string for empty call");
44 getURL("FSCommand:noarg");
45 getURL("FSCommand:stringarg", "This is a string");
46 getURL("FSCommand:weirdstringarg", "!@#$%^&*()_+-={}|[]\\:\";\'<>?,./~`");
47 getURL("FSCommand:integerarg", 9876);
48 getURL("FSCommand:floatarg", 9876.5432);
49 getURL("FSCommand:infinitearg", Infinity);
50 getURL("FSCommand:neginfinitearg", -Infinity);
51 getURL("FSCommand:nanarg", NaN);
52 getURL("FSCommand:booleanarg", true);
53 getURL("FSCommand:nullarg", null);
54 getURL("FSCommand:undefinedarg",undefined);
55 arrayarg = new Array("The", "quick", "brown", "fox", "jumps", "over", "the", "lazy", "dog");
56 getURL("FSCommand:arrayarg", arrayarg);
57 objectarg = new Object();
58 getURL("FSCommand:objectarg", objectarg);
59 object_customstringarg = new Object();
60 object_customstringarg.toString = function():String {
61 return "This is a custom Object.toString()";
63 getURL("FSCommand:object_customstringarg", object_customstringarg);
64 functionarg = function() {
65 trace("This code should not run!");
67 getURL("FSCommand:functionarg", functionarg);
69 this.getURL("FSCommand:");
70 this.getURL("FSCommand:", "This is a string for empty call");
71 this.getURL("FSCommand:m_noarg");
72 this.getURL("FSCommand:m_stringarg", "This is a string");
73 this.getURL("FSCommand:m_weirdstringarg", "!@#$%^&*()_+-={}|[]\\:\";\'<>?,./~`");
74 this.getURL("FSCommand:m_integerarg", 9876);
75 this.getURL("FSCommand:m_floatarg", 9876.5432);
76 this.getURL("FSCommand:m_infinitearg", Infinity);
77 this.getURL("FSCommand:m_neginfinitearg", -Infinity);
78 this.getURL("FSCommand:m_nanarg", NaN);
79 this.getURL("FSCommand:m_booleanarg", true);
80 this.getURL("FSCommand:m_nullarg", null);
81 this.getURL("FSCommand:m_undefinedarg", undefined);
82 this.getURL("FSCommand:m_arrayarg", arrayarg);
83 this.getURL("FSCommand:m_objectarg", objectarg);
84 this.getURL("FSCommand:m_object_customstringarg", object_customstringarg);
85 this.getURL("FSCommand:m_functionarg", functionarg);
86 trace("ENDOFTEST");