~ubuntu-branches/ubuntu/jaunty/swfdec0.8/jaunty

« back to all changes in this revision

Viewing changes to test/trace/initaction-queue.c

  • Committer: Package Import Robot
  • Author(s): Didier Roche
  • Date: 2008-10-10 19:15:24 UTC
  • Revision ID: package-import@ubuntu.com-20081010191524-5z85qiky1d4bvgfa
Tags: upstream-0.8.0
ImportĀ upstreamĀ versionĀ 0.8.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* gcc `pkg-config --libs --cflags libming glib-2.0` initaction-queue.c -o initaction-queue && ./initaction-queue
 
2
 */
 
3
 
 
4
#include <ming.h>
 
5
#include <glib.h>
 
6
 
 
7
static void
 
8
do_movie (int version)
 
9
{
 
10
  SWFMovie movie;
 
11
  SWFMovieClip clip;
 
12
  SWFDisplayItem item;
 
13
  char *real_name;
 
14
 
 
15
  movie = newSWFMovieWithVersion (version);
 
16
  movie = newSWFMovie();
 
17
  SWFMovie_setRate (movie, 1);
 
18
  SWFMovie_setDimension (movie, 200, 150);
 
19
 
 
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);
 
27
  
 
28
  SWFMovie_add (movie, (SWFBlock) newSWFAction (""
 
29
        "loadMovie (\"fscommand:quit\", \"\");"
 
30
        ));
 
31
  SWFMovie_nextFrame (movie);
 
32
 
 
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);
 
39
}
 
40
 
 
41
int
 
42
main (int argc, char **argv)
 
43
{
 
44
  int i;
 
45
 
 
46
  if (Ming_init ())
 
47
    return 1;
 
48
 
 
49
  for (i = 8; i > 4; i--)
 
50
    do_movie (i);
 
51
 
 
52
  return 0;
 
53
}