Add automated tests on function-type FSCommand parameter passing.
[gnash.git] / testsuite / misc-swfmill.all / func_dict.xml
blobdd00fc056856dce848afcdfaab3c83ac3534d372
1 <?xml version="1.0"?>
2 <swf version="6" compressed="0">
4 <!--
6  Test file for https://savannah.gnu.org/bugs/?33521
8  Shows that functions keep a reference on the constant
9  pool in place at time of their definition, even if
10  the pool in the action buffer is overridden at time
11  of function call.
13  This file uses named function, see afunc_dict.xml 
14  for an anonymous function.
16 -->
18   <Header framerate="12" frames="1">
19     <size>
20       <Rectangle left="0" right="12800" top="0" bottom="9600"/>
21     </size>
22     <tags>
23       <DoAction>
24         <actions>
26         <!-- Dictionary 1 -->
27           <Dictionary>
28             <strings>
29               <String value="a"/>
30             </strings>
31           </Dictionary>
33         <!-- Function code -->
34           <DeclareFunction name="f" argc="0" length="17">
35             <args/>
36           </DeclareFunction>
38           <PushData>
39             <items>
40               <StackDictionaryLookup index="0"/>
41             </items>
42           </PushData>
44         <!-- Dictionary 2 (in-function) -->
45           <Dictionary>
46             <strings>
47               <String value="c"/>
48             </strings>
49           </Dictionary>
51           <PushData>
52             <items>
53               <StackDictionaryLookup index="0"/>
54             </items>
55           </PushData>
57         <!-- END OF FUNCTION BODY -->
59         <!-- Dictionary 3 (after function) -->
60           <Dictionary>
61             <strings>
62               <String value="b"/>
63             </strings>
64           </Dictionary>
67           // Push "r" (to assign later)
68           <PushData>
69             <items>
70               <StackString value="r"/>
71             </items>
72           </PushData>
74           // Push dict[0] (expect 'b')
75           <PushData>
76             <items>
77               <StackDictionaryLookup index="0"/>
78             </items>
79           </PushData>
81           // Call the function  (pushes 'a' and 'c')
82           <PushData>
83             <items>
84               <StackInteger value="0"/>
85               <StackString value="f"/>
86             </items>
87           </PushData>
88           <CallFunction/>
89           <Pop/>
91         
92           // Push dict[0] (expect 'b')
93           <PushData>
94             <items>
95               <StackDictionaryLookup index="0"/>
96             </items>
97           </PushData>
99           <AddTyped/>
100           <AddTyped/>
101           <AddTyped/>
102           <Duplicate/>
103           <Trace/>
105           // Verify we got 'bacb'
106           <PushData>
107             <items>
108               <StackString value="bacb"/>
109             </items>
110           </PushData>
111           <EqualTyped/>
113           // If true, jump to PASSED tracing
114           <BranchIfTrue byteOffset="51"/>
116           // Else, trace XFAILED
117           <PushData>
118             <items>
119               <StackString value="FAILED: func used overridden dictionary "/>
120             </items>
121           </PushData>
122           <Trace/>
123           <BranchAlways byteOffset="44"/> // get to end 
125           // PASSED tracing
126           <PushData>
127             <items>
128               <StackString value="PASSED: func used original dictionary "/>
129             </items>
130           </PushData>
131           <Trace/>
133           // END OF TEST tag
134           <PushData>
135             <items>
136               <StackString value="END OF TEST"/>
137             </items>
138           </PushData>
139           <Trace/>
141           <EndAction/>
142         </actions>
143       </DoAction>
144       <ShowFrame/>
145       <End/>
146     </tags>
147   </Header>
148 </swf>