add test for frames and bytes properties of empty movies
[swfdec.git] / test / trace / registerclass-previous.c
blob1ff084cd8d778cacd4471706cace4f1ddcbe2485
1 /* gcc `pkg-config --libs --cflags libming` registerclass-previous.c -o registerclass-previous && ./registerclass-previous
2 */
4 #include <ming.h>
6 int
7 main (int argc, char **argv)
9 SWFMovie movie;
10 SWFMovieClip clip;
11 SWFDisplayItem item;
13 if (Ming_init ())
14 return 1;
15 Ming_useSWFVersion (7);
17 movie = newSWFMovie();
18 SWFMovie_setRate (movie, 1);
19 SWFMovie_setDimension (movie, 200, 150);
21 clip = newSWFMovieClip ();
22 SWFMovie_addExport (movie, (SWFBlock) clip, "export");
23 item = SWFMovie_add (movie, (SWFBlock) clip);
24 SWFDisplayItem_setName (item, "m");
25 SWFMovie_add (movie, (SWFBlock) compileSWFActionCode (""
26 "trace (\"Check that registerClass does not influence previously created instances\");"
27 "fun = function () {"
28 " trace (this + \": Constructor\");"
29 "};"
30 "fun.prototype = new Object ();"
31 "fun.prototype.foo = function () {"
32 " trace (\"foo called on \" + this);"
33 "};"
34 "Object.registerClass (\"export\", fun);"
35 "m.foo ();"
36 ""));
37 SWFMovie_nextFrame (movie);
39 item = SWFMovie_add (movie, (SWFBlock) clip);
40 SWFDisplayItem_setName (item, "m2");
41 SWFMovie_add (movie, (SWFBlock) compileSWFActionCode (""
42 "m.foo ();"
43 "m2.foo ();"
44 "stop ();"
45 ""));
47 SWFMovie_save (movie, "registerclass-previous.swf");
48 return 0;