Add automated tests on function-type FSCommand parameter passing.
[gnash.git] / testsuite / misc-ming.all / RemoveObject2Test.c
blob564017d72dc426c55623dddabc0fe22a743c9f44
1 /***********************************************************************
3 * Copyright (C) 2005, 2006, 2009, 2010, 2011 Free Software Foundation, Inc.
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.
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.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 ***********************************************************************
22 * Test case for the RemoveObject2 tag
23 * It places and removes 3 squares every 5 frames.
25 ***********************************************************************/
27 #include <stdio.h>
28 #include <ming.h>
30 #define OUTPUT_VERSION 6
31 #define OUTPUT_FILENAME "RemoveObject2Test.swf"
33 static SWFShape
34 make_square(int x, int y, int width, int height, byte r, byte g, byte b)
36 SWFShape sh = newSWFShape();
37 SWFShape_setLineStyle(sh, 1, r, g, b, 255);
38 SWFShape_movePenTo(sh, x, y);
39 SWFShape_drawLineTo(sh, x, y+height);
40 SWFShape_drawLineTo(sh, x+width, y+height);
41 SWFShape_drawLineTo(sh, x+width, y);
42 SWFShape_drawLineTo(sh, x, y);
44 return sh;
47 int main(void)
49 SWFMovie mo;
50 SWFDisplayItem it1, it2, it3;
51 SWFShape sh1, sh2, sh3;
52 int framenum;
54 /*********************************************
56 * Initialization
58 *********************************************/
60 puts("Setting things up");
62 Ming_init();
63 Ming_useSWFVersion (OUTPUT_VERSION);
64 Ming_setScale(20.0);
66 mo = newSWFMovie();
68 /*****************************************************
70 * Add the square named
72 *****************************************************/
74 SWFMovie_setDimension(mo, 100, 100);
76 #define FRAMESGAP 5
78 sh1 = make_square(10, 10, 20, 20, 255, 0, 0);
79 it1 = SWFMovie_add(mo, (SWFBlock)sh1);
80 SWFDisplayItem_setDepth(it1, 1);
81 SWFDisplayItem_setName(it1, "Name1");
83 for (framenum=0; framenum<FRAMESGAP; framenum++) {
84 SWFMovie_nextFrame(mo);
87 sh2 = make_square(35, 10, 20, 20, 0, 255, 0);
88 it2 = SWFMovie_add(mo, (SWFBlock)sh2);
89 SWFDisplayItem_setDepth(it2, 2);
90 SWFDisplayItem_setName(it2, "Name2");
92 for (framenum=0; framenum<FRAMESGAP; framenum++) {
93 SWFMovie_nextFrame(mo);
96 sh3 = make_square(10, 35, 45, 20, 0, 0, 255);
97 it3 = SWFMovie_add(mo, (SWFBlock)sh3);
98 SWFDisplayItem_setDepth(it3, 3);
99 SWFDisplayItem_setName(it3, "Name3");
101 for (framenum=0; framenum<FRAMESGAP; framenum++) {
102 SWFMovie_nextFrame(mo);
105 SWFMovie_remove(mo, it1);
107 for (framenum=0; framenum<FRAMESGAP; framenum++) {
108 SWFMovie_nextFrame(mo);
111 SWFMovie_remove(mo, it2);
113 for (framenum=0; framenum<FRAMESGAP; framenum++) {
114 SWFMovie_nextFrame(mo);
117 SWFMovie_remove(mo, it3);
119 puts("Saving " OUTPUT_FILENAME );
121 SWFMovie_nextFrame(mo); /* showFrame */
123 SWFMovie_save(mo, OUTPUT_FILENAME);
125 return 0;