2 * Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
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 2 of the License, or
7 * (at your option) any later version.
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
20 * Test that instance name are syntezed only if a name isn't given
21 * at all (empty name is still a name).
22 * TODO: we may test other name syntesis here, in particular for other
23 * kind of DisplayObjects..
31 #include "ming_utils.h"
33 #define OUTPUT_VERSION 6
34 #define OUTPUT_FILENAME "instanceNameTest.swf"
38 main(int argc
, char** argv
)
41 SWFDisplayItem it1
, it2
;
42 SWFMovieClip mc1
, mc2
, dejagnuclip
;
43 const char *srcdir
=".";
49 //fprintf(stderr, "Usage: %s <mediadir>\n", argv[0]);
54 Ming_useSWFVersion (OUTPUT_VERSION
);
57 SWFMovie_setDimension(mo
, 800, 600);
58 SWFMovie_setRate(mo
, 12);
60 dejagnuclip
= get_dejagnu_clip((SWFBlock
)get_default_font(srcdir
), 10, 0, 0, 800, 600);
61 SWFMovie_add(mo
, (SWFBlock
)dejagnuclip
);
62 add_actions(mo
, " haslooped1=false; haslooped2=false; haslooped3=false;"
63 " mc1Initialized=0; mc1Unloaded=0;"
64 " mc2Initialized=0; mc2Unloaded=0;"
65 " mc3Initialized=0; mc3Unloaded=0;"
67 SWFMovie_nextFrame(mo
); // frame1
70 mc1
= newSWFMovieClip();
71 SWFMovieClip_nextFrame(mc1
);
73 mc2
= newSWFMovieClip();
74 SWFMovieClip_nextFrame(mc2
);
76 /* An empty name ... */
77 it1
= SWFMovie_add(mo
, (SWFBlock
)mc1
);
78 SWFDisplayItem_setName(it1
, "");
79 SWFDisplayItem_addAction(it1
, newSWFAction(
80 "_root.check_equals(this._target, '/');"
83 /* ... is different then no name at all. */
84 it2
= SWFMovie_add(mo
, (SWFBlock
)mc2
);
85 SWFDisplayItem_addAction(it2
, newSWFAction(
86 "_root.check_equals(this._target, '/instance2');"
89 SWFMovie_nextFrame(mo
); // frame2
91 add_actions(mo
, "totals(2); stop();");
92 SWFMovie_nextFrame(mo
); // frame 15
94 puts("Saving " OUTPUT_FILENAME
);
95 SWFMovie_save(mo
, OUTPUT_FILENAME
);