big merge from master, fix rpm creation, drop fetching swfdec
[gnash.git] / testsuite / misc-ming.all / move_object_test.c
blobab2523032fa6a0c18842b748c541c28d6c822faf
1 /*
2 * Copyright (C) 2007, 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 * Test for tag PlaceObject2 used to move chars
22 * Moves an "unnamed" movieclip square.
23 * Expect the clip to get back to its original position
24 * on loop-back.
26 * It is important for the clip to be unnamed, as
27 * we're testing for a bug not occurring if a name
28 * is specified in PLACEOBJECT2 tag.
29 * Luckly, this won't prevent us from referencing it,
30 * as the player is expected to assign syntetized
31 * instance names to unnamed objects.
33 * run as ./move_object_test
36 #include <stdlib.h>
37 #include <stdio.h>
38 #include <ming.h>
40 #include "ming_utils.h"
42 #define OUTPUT_VERSION 6
43 #define OUTPUT_FILENAME "move_object_test.swf"
48 int
49 main(int argc, char** argv)
51 SWFMovie mo;
52 SWFMovieClip mc1, dejagnuclip;
53 SWFDisplayItem it1;
54 SWFShape sh1;
56 const char *srcdir=".";
57 if ( argc>1 )
58 srcdir=argv[1];
59 else
61 //fprintf(stderr, "Usage: %s <mediadir>\n", argv[0]);
62 //return 1;
65 Ming_init();
66 mo = newSWFMovie();
67 SWFMovie_setDimension(mo, 800, 600);
68 SWFMovie_setRate (mo, 1.0);
70 sh1 = make_fill_square (0, 0, 60, 60, 255, 0, 0, 255, 0, 0);
71 mc1 = newSWFMovieClip();
72 SWFMovieClip_add(mc1, (SWFBlock)sh1);
73 add_clip_actions(mc1, "onRollOver = function() {};");
74 SWFMovieClip_nextFrame(mc1);
76 dejagnuclip = get_dejagnu_clip((SWFBlock)get_default_font(srcdir), 10, 0, 70, 800, 500);
77 SWFMovie_add(mo, (SWFBlock)dejagnuclip);
78 it1 = SWFMovie_add(mo, (SWFBlock)mc1);
79 check_equals(mo, "typeof(instance2)", "'movieclip'");
80 check_equals(mo, "instance2._x", "0");
82 SWFMovie_nextFrame(mo); // frame 1
84 SWFDisplayItem_moveTo(it1, 700, 1);
86 // instance1 is automatically assigned to the dejagnu clip
87 check_equals(mo, "typeof(instance1)", "'movieclip'");
89 // instance2 is automatically assigned to the square clip
90 check_equals(mo, "typeof(instance2)", "'movieclip'");
91 check_equals(mo, "instance2._x", "700");
93 add_actions(mo, "if ( ++counter > 1 ) { totals(); stop(); }");
94 SWFMovie_nextFrame(mo); // frame 2
97 //Output movie
98 puts("Saving " OUTPUT_FILENAME );
99 SWFMovie_save(mo, OUTPUT_FILENAME);
101 return 0;