2 * Copyright (C) 2007, 2009, 2010, 2011 Free Software Foundation, Inc.
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.
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.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * (1) different timelines still share the same vm stack
23 * (2) vm stack should be cleared before next advancement.
31 #include "ming_utils.h"
33 #define OUTPUT_VERSION 6
34 #define OUTPUT_FILENAME "runtime_vm_stack_test.swf"
39 main(int argc
, char** argv
)
42 SWFMovieClip mc1
, mc11
, mc2
, dejagnuclip
;
43 SWFDisplayItem it1
, it2
;
45 const char *srcdir
=".";
50 fprintf(stderr
, "Usage: %s <mediadir>\n", argv
[0]);
55 mo
= newSWFMovieWithVersion(OUTPUT_VERSION
);
56 SWFMovie_setDimension(mo
, 800, 600);
57 SWFMovie_setRate (mo
, 12.0);
59 dejagnuclip
= get_dejagnu_clip((SWFBlock
)get_default_font(srcdir
), 10, 0, 0, 800, 600);
60 SWFMovie_add(mo
, (SWFBlock
)dejagnuclip
);
61 add_actions(mo
, "testvar1 = 0; testvar2 = 0; testvar3 = 0; ");
62 SWFMovie_nextFrame(mo
); // frame1
67 " push '_root.testvar1'"
69 mc1
= newSWFMovieClip();
74 " push '_root.testvar2'"
78 mc11
= newSWFMovieClip();
79 add_clip_actions(mc11
,
82 " push '_root.testvar3'"
85 SWFMovieClip_nextFrame(mc11
);
86 SWFMovieClip_add(mc1
, (SWFBlock
)mc11
);
87 SWFMovieClip_nextFrame(mc1
);
89 mc2
= newSWFMovieClip();
94 SWFMovieClip_nextFrame(mc2
);
97 it1
= SWFMovie_add(mo
, (SWFBlock
)mc1
);
98 SWFDisplayItem_setDepth(it1
, 10);
99 it2
= SWFMovie_add(mo
, (SWFBlock
)mc2
);
100 SWFDisplayItem_setDepth(it2
, 20);
101 SWFMovie_nextFrame(mo
); // frame2
103 check_equals(mo
, "testvar1", "1");
104 check_equals(mo
, "testvar2", "2");
105 check_equals(mo
, "testvar3", "3");
115 SWFMovie_nextFrame(mo
); // frame2
123 check_equals(mo
, "testvar1", "1");
124 check_equals(mo
, "testvar2", "2");
125 check_equals(mo
, "testvar3", "3");
126 SWFMovie_nextFrame(mo
); // frame3
128 add_actions(mo
, " _root.totals(6); stop(); ");
129 SWFMovie_nextFrame(mo
); // frame4
132 puts("Saving " OUTPUT_FILENAME
);
133 SWFMovie_save(mo
, OUTPUT_FILENAME
);