Add automated tests on function-type FSCommand parameter passing.
[gnash.git] / testsuite / misc-ming.all / FlashVarsTest.as
blob860898f8e544d108c9aa33da9d0622d0bc943e1d
1 //
2 // Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
3 //
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation; either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 // Test case for passing parameters trough FlashVars (-P switch)
19 // and url querystring.
21 // Build with 'makeswf -o FlashVarsTest.swf Dejagnu.swf FlashVarsTest.as'
23 // execute the movie by passing:
24 // QueryString="?a=a_in_qstring&q=q_in_qstring&MixCaseQstr=mixQstr&dejagnu.nested=chFvars&_root.fqv=fqQstr"
25 // FlashVars="&a=a_in_fvars&v=v_in_fvars&MixCaseFvars=mixFvars&dejagnu.nested=chFVars&_root.fqv=fqFVars&complex={a:'1',b:2}"
27 // QueryString is what appears embedded in the url,
28 // FlashVars can be given as an attribute of the <embed> tag
29 // of (in Gnash) with the -P switch
31 // Example:
33 // gnash -P FlashVars="&a=a_in_fvars&v=v_in_fvars&MixCaseFvars=mixFvars&dejagnu.nested=chFVars&_root.fqv=fqFVars&complex={a:'1',b:2}"
34 // "FlashParamTest.swf?a=a_in_qstring&q=q_in_qstring&MixCaseQstr=mixQst&dejagnu.nested=chQstr&_root.fqv=fqFVars"
36 // See FlashVarsTest.html for a way to test with a plugin
39 note("a="+a);
40 note("_root.a="+_root.a);
41 check(_root.hasOwnProperty('a'));
42 check_equals(_root.a, "a_in_fvars");
43 _root.a="changed";
44 check_equals(_root.a, "changed");
45 check(delete _root.a);
47 note("q="+q);
48 note("_root.q="+_root.q);
49 check(_root.hasOwnProperty('q'));
50 check_equals(_root.q, "q_in_qstring");
52 note("v="+v);
53 note("_root.v="+_root.v);
54 check(_root.hasOwnProperty('v'));
55 check_equals(_root.v, "v_in_fvars");
57 note("_root.fqv="+_root.fqv);
58 note("_root['_root.fqv']="+_root['_root.fqv']);
59 check_equals(typeof(_root.fqv), "undefined");
60 check_equals(_root['_root.fqv'], "fqFVars");
62 check_equals(typeof(_root.dejagnu), "movieclip");
63 note("_root.dejagnu.nested="+_root.dejagnu.nested);
64 note("_root['dejagnu.nested']="+_root['dejagnu.nested']);
65 check_equals(typeof(_root.dejagnu.nested), "undefined");
66 check_equals(_root['dejagnu.nested'], "chFVars");
68 check_equals(typeof(_root['complex']), "string");
70 #if OUTPUT_VERSION < 7
71 // The following tests assume target SWF version is < 7
72 check_equals(_root.mixcaseqstr, "mixQstr");
73 check_equals(_root.mixcasefvars, "mixFvars");
74 #else // OUTPUT_VERSION >= 7
75 // This is currently not used, would need a bit of work
76 // in the Makefile.am to be used
77 // (build both v6 and v7 versions of this test)
78 check_equals(typeof(_root.mixcaseqstr), "undefined");
79 check_equals(typeof(_root.mixcasefvars), "undefined");
80 check_equals(_root.MixCaseQstr, "mixQstr");
81 check_equals(_root.MixCaseFvars, "mixFvars");
82 #endif // OUTPUT_VERSION >= 7
84 totals();
85 stop();