add another test proing that init actions are queued
[swfdec.git] / test / trace / initaction-queue.c
blob2c06d3fb41ad07bc2a801986e45dae9a29d71b01
1 /* gcc `pkg-config --libs --cflags libming glib-2.0` initaction-queue.c -o initaction-queue && ./initaction-queue
2 */
4 #include <ming.h>
5 #include <glib.h>
7 static void
8 do_movie (int version)
10 SWFMovie movie;
11 SWFMovieClip clip;
12 SWFDisplayItem item;
13 char *real_name;
15 movie = newSWFMovieWithVersion (version);
16 movie = newSWFMovie();
17 SWFMovie_setRate (movie, 1);
18 SWFMovie_setDimension (movie, 200, 150);
20 clip = newSWFMovieClip ();
21 item = SWFMovie_add (movie, (SWFBlock) clip);
22 SWFMovieClip_addInitAction (clip, newSWFAction ("_root.x = 42;"));
23 SWFDisplayItem_addAction (item, newSWFAction ("trace (_root.x);"), SWFACTION_INIT);
24 SWFDisplayItem_addAction (item, newSWFAction ("trace (_root.x);"), SWFACTION_CONSTRUCT);
25 SWFDisplayItem_flush (item);
26 SWFMovie_nextFrame (movie);
28 SWFMovie_add (movie, (SWFBlock) newSWFAction (""
29 "loadMovie (\"fscommand:quit\", \"\");"
30 ));
31 SWFMovie_nextFrame (movie);
33 real_name = g_strdup_printf ("initaction-queue-%d.swf", version);
34 /* remove this after having understood that the generated code was modified to have
35 * the DoInitAction tag placed _after_ the PlaceObject tag */
36 g_assert (FALSE);
37 SWFMovie_save (movie, real_name);
38 g_free (real_name);
41 int
42 main (int argc, char **argv)
44 int i;
46 if (Ming_init ())
47 return 1;
49 for (i = 8; i > 4; i--)
50 do_movie (i);
52 return 0;