big merge from master, fix rpm creation, drop fetching swfdec
[gnash.git] / testsuite / misc-ming.all / static_vs_dynamic1.c
blob4706286cc5214330b1b5823fd65be0db2b7f1c0a
1 /*
2 * Copyright (C) 2005, 2006, 2007, 2009, 2010,
3 * 2011 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.
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 */
21 * mc1 and mc2 are two movieClips created by PlaceObject2 tag;
22 * dup1 and dup2 are two movieClips created by AS;
23 * swap mc1 to the dynamic range depths;
24 * swap dup1 to the static range depths;
26 * expected behaviour after loopback:
27 * mc1 keep alive;
28 * mc2 get removed;
29 * dup1 get removed;
30 * dup2 keep alive;
33 #include <stdlib.h>
34 #include <stdio.h>
35 #include <ming.h>
37 #include "ming_utils.h"
39 #define OUTPUT_VERSION 6
40 #define OUTPUT_FILENAME "static_vs_dynamic1.swf"
45 int
46 main(int argc, char** argv)
48 SWFMovie mo;
49 SWFMovieClip mc1, mc2, dejagnuclip;
50 SWFDisplayItem it1, it2;
51 SWFShape sh1,sh2;
53 const char *srcdir=".";
54 if ( argc>1 )
55 srcdir=argv[1];
56 else
58 fprintf(stderr, "Usage: %s <mediadir>\n", argv[0]);
59 return 1;
62 Ming_init();
63 mo = newSWFMovieWithVersion(OUTPUT_VERSION);
64 SWFMovie_setDimension(mo, 800, 600);
65 SWFMovie_setRate (mo, 12.0);
67 dejagnuclip = get_dejagnu_clip((SWFBlock)get_default_font(srcdir), 10, 0, 0, 800, 600);
68 SWFMovie_add(mo, (SWFBlock)dejagnuclip);
69 SWFMovie_nextFrame(mo);
71 add_actions(mo, " if(loopback == undefined) {" // first time play
72 " check_equals(typeof(mc1), 'undefined'); "
73 " check_equals(typeof(mc2), 'undefined'); "
74 " check_equals(typeof(dup1), 'undefined'); "
75 " check_equals(typeof(dup2), 'undefined'); "
76 "} else {" // loopback
77 " check_equals(typeof(mc1), 'movieclip');"
78 " check_equals(typeof(mc2), 'undefined');"
79 " check_equals(typeof(dup1), 'undefined');"
80 " check_equals(typeof(dup2), 'movieclip');"
81 "}" );
82 SWFMovie_nextFrame(mo);
84 mc1 = newSWFMovieClip();
85 mc2 = newSWFMovieClip();
86 sh1 = make_fill_square (0, 300, 60, 60, 255, 0, 0, 255, 0, 0);
87 sh2 = make_fill_square (100, 300, 60, 60, 255, 0, 0, 0, 0, 0);
88 SWFMovieClip_add(mc1, (SWFBlock)sh1);
89 SWFMovieClip_add(mc2, (SWFBlock)sh2);
90 SWFMovieClip_nextFrame(mc1);
91 SWFMovieClip_nextFrame(mc2);
93 it1 = SWFMovie_add(mo, (SWFBlock)mc1);
94 SWFDisplayItem_setDepth(it1, 2);
95 SWFDisplayItem_setName(it1, "mc1");
97 it2 = SWFMovie_add(mo, (SWFBlock)mc2);
98 SWFDisplayItem_setDepth(it2, 3);
99 SWFDisplayItem_setName(it2, "mc2");
101 add_actions(mo, " if(loopback == undefined) {"
102 " duplicateMovieClip('mc1', 'dup1', 1);"
103 " duplicateMovieClip('mc2', 'dup2', 2);"
104 " check_equals(mc1.getDepth(), -16382);"
105 " check_equals(mc2.getDepth(), -16381);"
106 " check_equals(dup1.getDepth(), 1);"
107 " check_equals(dup2.getDepth(), 2);"
108 " mc1.swapDepths(10);"
109 " check_equals(mc1.getDepth(), 10);"
110 " dup1.swapDepths(-10);"
111 " check_equals(dup1.getDepth(), -10);"
112 "}");
113 SWFMovie_nextFrame(mo);
116 add_actions(mo, "if(loopback == undefined) {"
117 " loopback = 1;"
118 " gotoAndPlay(1);" //loopback
119 "} else {"
120 " _root.totals(); stop();"
121 "}");
122 SWFMovie_nextFrame(mo);
124 //Output movie
125 puts("Saving " OUTPUT_FILENAME );
126 SWFMovie_save(mo, OUTPUT_FILENAME);
128 return 0;