Update with current status
[gnash.git] / testsuite / misc-swfmill.all / afunc_dict.xml
blob0e39e8dc05ed6e45ebf430b6c3a508edb6d04b98
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 anonymous function, see func_dict.xml 
14  for a named 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 at time of function definition -->
27           <Dictionary>
28             <strings>
29               <String value="a"/>
30             </strings>
31           </Dictionary>
33         <!-- Name we'll assign to the function -->
34           <PushData>
35             <items>
36               <StackString value="f"/>
37             </items>
38           </PushData>
40         <!-- Function code -->
41           <DeclareFunction name="" argc="0" length="15">
42             <args/>
43           </DeclareFunction>
44           <PushData>
45             <items>
46               <StackString value="r"/>
47             </items>
48           </PushData>
49           <Duplicate/>
50           <GetVariable/>
51           <PushData>
52             <items>
53               <StackDictionaryLookup index="0"/>
54             </items>
55           </PushData>
56           <AddTyped/>
57           <SetVariable/>
59         <!-- Assigning the anonymous function to the variable `f' -->
60           <SetVariable/>
62         <!-- Dictionary after function definition -->
63           <Dictionary>
64             <strings>
65               <String value="b"/>
66             </strings>
67           </Dictionary>
70         <!-- Main code -->
72           // Append dict[0] to `r'
73           <PushData>
74             <items>
75               <StackString value="r"/>
76             </items>
77           </PushData>
78           <Duplicate/>
79           <GetVariable/>
80           <PushData>
81             <items>
82               <StackDictionaryLookup index="0"/>
83             </items>
84           </PushData>
85           <AddTyped/>
86           <SetVariable/>
88           // Call the function appending dict[0] to `r'
89           <PushData>
90             <items>
91               <StackInteger value="0"/>
92               <StackString value="f"/>
93             </items>
94           </PushData>
95           <CallFunction/>
96           <Pop/>
98           // Verify `r' equals 'ba'
99           <PushData>
100             <items>
101               <StackString value="ba"/>
102               <StackString value="r"/>
103             </items>
104           </PushData>
105           <GetVariable/>
106           <EqualTyped/>
108           // If true, jump to PASSED tracing
109           <BranchIfTrue byteOffset="51"/>
111           // Else, trace XFAILED
112           <PushData>
113             <items>
114               <StackString value="FAILED: func used overridden dictionary "/>
115             </items>
116           </PushData>
117           <Trace/>
118           <BranchAlways byteOffset="44"/> // get to end 
120           // PASSED tracing
121           <PushData>
122             <items>
123               <StackString value="PASSED: func used original dictionary "/>
124             </items>
125           </PushData>
126           <Trace/>
128           // END OF TEST tag
129           <PushData>
130             <items>
131               <StackString value="END OF TEST"/>
132             </items>
133           </PushData>
134           <Trace/>
136           <EndAction/>
137         </actions>
138       </DoAction>
139       <ShowFrame/>
140       <End/>
141     </tags>
142   </Header>
143 </swf>