2
* Copyright (C) 2005, 2006, 2007 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 3 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
21
* Test DefineText tag.
23
* run as ./DefineTextTest <mediadir> to produce DefineTextTest.swf
30
#include "ming_utils.h"
32
#define OUTPUT_VERSION 7
33
#define OUTPUT_FILENAME "DefineTextTest.swf"
36
main(int argc, char** argv)
39
const char *srcdir=".";
41
SWFMovieClip dejagnuclip;
43
/*********************************************
47
*********************************************/
49
if ( argc>1 ) srcdir=argv[1];
52
fprintf(stderr, "Usage: %s <mediadir>\n", argv[0]);
56
sprintf(fdbfont, "%s/Bitstream-Vera-Sans.fdb", srcdir);
58
puts("Setting things up");
61
Ming_useSWFVersion (OUTPUT_VERSION);
62
//Ming_setScale(20.0); /* so we talk twips */
65
SWFMovie_setRate(mo, 1.0);
66
SWFMovie_setDimension(mo, 800, 600);
68
dejagnuclip = get_dejagnu_clip((SWFBlock)get_default_font(srcdir), 10, 0, 0, 800, 600);
69
SWFMovie_add(mo, (SWFBlock)dejagnuclip);
70
SWFMovie_nextFrame(mo); // 1st frame
72
/*********************************************
76
*********************************************/
78
SWFMovieClip mc; // to check sizes
82
FILE *font_file = fopen(fdbfont, "r");
83
if ( font_file == NULL )
88
SWFBrowserFont bfont = newSWFBrowserFont("_sans");
89
SWFFont efont = loadSWFFontFromFile(font_file);
93
SWFText_setFont(tf, efont);
94
SWFText_setHeight(tf, 200);
95
SWFText_setColor(tf, 0, 255, 0, 0xff);
96
SWFText_addString(tf, "O", NULL);
98
SWFText_setFont(tf, efont);
99
SWFText_setHeight(tf, 200);
100
SWFText_setColor(tf, 255, 0, 0, 0xff);
101
SWFText_addString(tf, "X", NULL);
103
mc = newSWFMovieClip();
104
it = SWFMovieClip_add(mc, tf);
105
SWFDisplayItem_setName(it, "stext1");
106
SWFMovieClip_nextFrame(mc);
108
it = SWFMovie_add(mo, mc);
109
SWFDisplayItem_setName(it, "mc");
110
SWFDisplayItem_moveTo(it, 0, 400);
112
SWFMovie_nextFrame(mo); // 2nd frame
114
// static text is not a referenceable char
115
check_equals(mo, "mc.stext1", "mc");
116
check_equals(mo, "typeof(mc.stext1)", "'movieclip'");
117
check_equals(mo, "mc.stext1._target", "'/mc'");
119
check_equals(mo, "mc._width", "288.05");
121
add_actions(mo, "endoftest=true; totals(); stop();");
122
SWFMovie_nextFrame(mo); // 3rd frame
124
/*****************************************************
128
*****************************************************/
129
puts("Saving " OUTPUT_FILENAME );
131
SWFMovie_save(mo, OUTPUT_FILENAME);