Add automated tests on function-type FSCommand parameter passing.
[gnash.git] / testsuite / misc-ming.all / place_and_remove_object_test.c
blob5bba59963ca2fe0b9ae29f9c0ddaf794006ddc44
1 /*
2 * Copyright (C) 2005, 2006, 2009, 2010, 2011 Free Software Foundation, Inc.
3 *
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.
8 *
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
17 */
20 * Zou Lunkai, zoulunkai@gmail.com
22 * Test for tag PlaceObject2 and also sprite_instance::advance_sprite(float delta_time)
24 * Normally, you will see the both the red square and black square
25 * again and again while looping back
27 * run as ./place_and_remove_object_test
30 #include <stdlib.h>
31 #include <stdio.h>
32 #include <ming.h>
34 #include "ming_utils.h"
36 #define OUTPUT_VERSION 6
37 #define OUTPUT_FILENAME "place_and_remove_object_test.swf"
42 int
43 main(int argc, char** argv)
45 SWFMovie mo;
46 SWFMovieClip dejagnuclip;
47 SWFShape sh1,sh2;
49 const char *srcdir=".";
50 if ( argc>1 )
51 srcdir=argv[1];
52 else
54 //fprintf(stderr, "Usage: %s <mediadir>\n", argv[0]);
55 //return 1;
58 Ming_init();
59 mo = newSWFMovieWithVersion(OUTPUT_VERSION);
60 SWFMovie_setDimension(mo, 800, 600);
61 SWFMovie_setRate (mo, 1.0);
63 dejagnuclip = get_dejagnu_clip((SWFBlock)get_default_font(srcdir), 10, 0, 0, 800, 600);
64 SWFMovie_add(mo, (SWFBlock)dejagnuclip);
65 //SWFMovie_nextFrame(mo);
68 sh1 = make_fill_square (0, 300, 60, 60, 255, 0, 0, 255, 0, 0);
69 sh2 = make_fill_square (330, 300, 60, 60, 255, 0, 0, 0, 0, 0);
72 SWFDisplayItem it;
73 it = SWFMovie_add(mo, (SWFBlock)sh1); //add a red square to the 1st frame at depth 3
74 SWFDisplayItem_setDepth(it, 3);
75 SWFDisplayItem_setName(it, "sh1");
76 check(mo, "_root.sh1 != undefined");
77 check_equals(mo, "_root.sh2", "undefined");
78 SWFMovie_nextFrame(mo);
80 SWFMovie_remove(mo, it); //remove the red square at the 2nd frame
81 check_equals(mo, "_root.sh1", "undefined");
82 check_equals(mo, "_root.sh2", "undefined");
83 SWFMovie_nextFrame(mo);
85 it = SWFMovie_add(mo, (SWFBlock)sh2); //add a black square to the 3rd frame at depth 3
86 SWFDisplayItem_setDepth(it, 3);
87 SWFDisplayItem_setName(it, "sh2");
88 check_equals(mo, "_root.sh1", "undefined");
89 check(mo, "_root.sh2 != undefined");
90 add_actions(mo, "if ( ++counter > 1 ) { _root.totals(); stop(); }");
91 SWFMovie_nextFrame(mo);
93 //Output movie
94 puts("Saving " OUTPUT_FILENAME );
95 SWFMovie_save(mo, OUTPUT_FILENAME);
97 return 0;