EXPORT BOOL WINAPI mhsp_SWFFont(SWFFont *p1, char *name, int p3, int p4) { lstrcpy(funcname, "SWFFont"); FILE *font = fopen(name, "rb"); if (font) { if (fgetc(font) != 'f' || fgetc(font) != 'd' || fgetc(font) != 'b' || fgetc(font) != '0') { return -1; } fseek(font, 0, SEEK_SET); *p1 = loadSWFFontFromFile(font); fclose(font); } else { unsigned char *out; out = toutf8(name); *p1 = (SWFFont)newSWFBrowserFont((char *)out); /* 本当は違うけど */ free(out); } if (!mhsp_font) { mhsp_font = *p1; } return 0; }
SWFFont get_default_font(const char* mediadir) { FILE *font_file; char fdbfont[256]; sprintf(fdbfont, "%s/Bitstream-Vera-Sans.fdb", mediadir); font_file = fopen(fdbfont, "r"); if ( font_file == NULL ) { perror(fdbfont); exit(1); } return loadSWFFontFromFile(font_file); }
void setupMovie(SWFMovie mo, const char* srcdir) { SWFDisplayItem it; char fdbfont[256]; SWFFont font; SWFMovieClip dejagnuclip; FILE* font_file; sprintf(fdbfont, "%s/Bitstream-Vera-Sans.fdb", srcdir); font_file = fopen(fdbfont, "r"); if (font_file == NULL) { perror(fdbfont); exit(1); } font = loadSWFFontFromFile(font_file); /* Add output textfield and DejaGnu stuff */ dejagnuclip = get_dejagnu_clip((SWFBlock)font, 10, 0, 0, 800, 800); it = SWFMovie_add(mo, (SWFBlock)dejagnuclip); SWFDisplayItem_setDepth(it, 200); }
int main(int argc, char **argv) { SWFMovie mo; SWFDisplayItem it; const char *srcdir="."; char fdbfont[256]; SWFMovieClip dejagnuclip; SWFFont font; puts("Setting things up"); Ming_init(); Ming_useSWFVersion (OUTPUT_VERSION); Ming_setScale(20.0); mo = newSWFMovie(); SWFMovie_setDimension(mo, 800, 600); SWFMovie_setRate(mo, 1); if (argc > 1) srcdir=argv[1]; else { fprintf(stderr, "Usage: %s <mediadir>\n", argv[0]); return 1; } sprintf(fdbfont, "%s/Bitstream-Vera-Sans.fdb", srcdir); FILE* font_file = fopen(fdbfont, "r"); if (!font_file) { perror(fdbfont); exit(1); } font = loadSWFFontFromFile(font_file); /* Dejagnu equipment */ dejagnuclip = get_dejagnu_clip((SWFBlock)font, 10, 0, 0, 800, 600); it = SWFMovie_add(mo, (SWFBlock)dejagnuclip); SWFDisplayItem_setDepth(it, 200); SWFDisplayItem_move(it, 200, 0); SWFMovie_nextFrame(mo); add_actions(mo, "mc1 = _root.createEmptyMovieClip('mc1', 34);" "mc2 = mc1.createEmptyMovieClip('mc2', 35);" "with(mc2) {" " moveTo(100, 100);" " beginFill(0x20fff0);" " lineTo(100, 200);" " lineTo(200, 200);" " lineTo(200, 100);" "};" "_root.onMouseUp = function() { play(); };" ); // One has all the functions, one has __resolve. add_actions(mo, "resolveevents = [];" "events = [];" "mc1.__resolve = function(a) { resolveevents.push(a); };" "mc2.onEnterFrame = function() { events.push('onEnterFrame'); };" "mc2.onMouseDown = function() { events.push('onMouseDown'); };" "mc2.onMouseUp = function() { events.push('onMouseUp'); };" // Gnash sends a bogus event here, but we're not testing that! //"mc2.onLoad = function() { events.push('onLoad'); };" "mc2.onPress = function() { events.push('onPress'); };" "mc2.onRelease = function() { events.push('onRelease'); };" "mc2.onRollOver = function() { events.push('onRollOver'); };" "mc2.onRollOut = function() { events.push('onRollOut'); };" "mc2.onInitialize = function() { events.push('onInitialize'); };" "mc2.onConstruct = function() { events.push('onConstruct'); };" "mc2.onReleaseOutside = function() { events.push('onReleaseOutside'); };" "mc2.onDragOver = function() { events.push('onDragOver'); };" "mc2.func = function() { events.push('func'); };" ); add_actions(mo, "mc2.func();" "mc1.func();" "mc2.onEnterFrame();" "mc1.onEnterFrame();" "mc2.onRollOver();" "mc1.onRollOver();" ); add_actions(mo, "_root.note('Do not touch anything!');"); // The ones called manually should appear in both. check_equals(mo, "events.toString()", "'func,onEnterFrame,onRollOver'"); check_equals(mo, "resolveevents.toString()", "'func,onEnterFrame,onRollOver'"); SWFMovie_nextFrame(mo); check_equals(mo, "events.toString()", "'func,onEnterFrame,onRollOver,onEnterFrame'"); check_equals(mo, "resolveevents.toString()", "'func,onEnterFrame,onRollOver'"); // Otherwise the number is unpredictable. add_actions(mo, "mc2.onEnterFrame = function() {};"); add_actions(mo, "stop();"); add_actions(mo, "_root.note('Move over square, click and release!');"); SWFMovie_nextFrame(mo); // Expect rollover, onMouseDown, onMouseUp, onRelease check_equals(mo, "events.toString()", "'func,onEnterFrame,onRollOver,onEnterFrame," "onRollOver,onMouseDown,onPress,onMouseUp,onRelease'"); check_equals(mo, "resolveevents.toString()", "'func,onEnterFrame,onRollOver'"); add_actions(mo, "_root.note('Move out of square, click and release!');"); add_actions(mo, "stop();"); SWFMovie_nextFrame(mo); check_equals(mo, "events.toString()", "'func,onEnterFrame,onRollOver,onEnterFrame,onRollOver," "onMouseDown,onPress,onMouseUp,onRelease,onRollOut,onMouseDown," "onMouseUp'"); check_equals(mo, "resolveevents.toString()", "'func,onEnterFrame,onRollOver'"); add_actions(mo, "mevents = [];" "ressiz = resolveevents.length;" "mc2.onMouseMove = function() { mevents.push('onMouseMove'); };"); // Last test! add_actions(mo, "_root.note('Move the mouse about, then click');"); add_actions(mo, "stop();"); SWFMovie_nextFrame(mo); // Check that mouse events aren't carried to resolve. check_equals(mo, "mevents[0]", "'onMouseMove'"); check_equals(mo, "resolveevents.length", "ressiz"); add_actions(mo, "_root.note('End of test!');"); // Finish and save SWFMovie_nextFrame(mo); add_actions(mo, "stop();"); puts("Saving " OUTPUT_FILENAME ); SWFMovie_save(mo, OUTPUT_FILENAME); return 0; }
int main(int argc, char** argv) { SWFMovie mo; int frames; SWFVideoStream stream; SWFDisplayItem item; SWFMovieClip dejagnuclip; FILE *flv, *font_file; SWFFont font; char filename[256]; char fdbfont[1024]; if ( argc>1 ) mediadir=argv[1]; else { fprintf(stderr, "Usage: %s <mediadir>\n", argv[0]); return 1; } sprintf(filename, "%s/square.flv", mediadir); flv = fopen(filename, "rb"); if (flv == NULL) { perror(filename); return -1; } sprintf(fdbfont, "%s/Bitstream-Vera-Sans.fdb", mediadir); font_file = fopen(fdbfont, "r"); if ( font_file == NULL ) { perror(fdbfont); exit(1); } Ming_init(); Ming_useSWFVersion (OUTPUT_VERSION); font = loadSWFFontFromFile(font_file); mo = newSWFMovie(); SWFMovie_setDimension(mo, 320, 96); if (mo == NULL) return -1; SWFMovie_setRate(mo, 5); dejagnuclip = get_dejagnu_clip((SWFBlock)font, 10, 0, 0, 200, 200); item = SWFMovie_add(mo, (SWFBlock)dejagnuclip); SWFDisplayItem_setDepth(item, 200); SWFDisplayItem_move(item, 140, 0); stream = newSWFVideoStream_fromFile(flv); item = SWFMovie_add(mo, (SWFBlock)stream); SWFDisplayItem_setName(item, "vid"); // A bug in Ming prevents this from working the // way I liked it to. It was useful to try this // out as it exposed a bad bug in gnash eating up // all memory and a few other issues. // // In order to keep the test *runner* untouched // this will be commented out for now. When Ming // is fixed I'll like to have two instances of // the definition playing one near the other, // both playing all frames. // //item = SWFMovie_add(mo, (SWFBlock)stream); //SWFDisplayItem_move(item, 150, 0); // Mouse clicks toggle play/stop add_actions(mo, "_root.onMouseDown = function() {" " if (stopped) { play(); stopped=false; }" " else { stop(); stopped=true; }" "};"); // Pressing a number jumps to the specified frame add_actions(mo, "_root.onKeyDown = function() {" " var fnum = Key.getAscii() - 47;" //" trace('going to frame '+fnum);" " _root.gotoAndPlay(fnum);" "}; Key.addListener(_root);"); // TODO: dynamic frame rate adjust frames = SWFVideoStream_getNumFrames(stream); for(; frames > 0; frames--) { SWFMovie_nextFrame(mo); } /// Video.clear() should not work on embedded Videos. add_actions(mo, "stop(); vid.clear(); trace(vid);"); add_actions(mo, "note('You should still see the video frame." " Click to replay');" "o = {};" "o.onMouseDown = function() { _root.play(); };" "Mouse.addListener(o);" ); SWFMovie_nextFrame(mo); //Output movie puts("Saving " OUTPUT_FILENAME ); SWFMovie_save(mo, OUTPUT_FILENAME); return 0; }
int main(int argc, char **argv) { SWFMovie mo; SWFDisplayItem it; const char *srcdir="."; char fdbfont[256]; SWFMovieClip dejagnuclip; /********************************************* * * Initialization * *********************************************/ puts("Setting things up"); Ming_init(); Ming_useSWFVersion (OUTPUT_VERSION); Ming_setScale(20.0); mo = newSWFMovie(); SWFMovie_setDimension(mo, 800, 600); SWFMovie_setRate(mo, 1); if ( argc>1 ) srcdir=argv[1]; else { fprintf(stderr, "Usage: %s <mediadir>\n", argv[0]); return 1; } sprintf(fdbfont, "%s/Bitstream-Vera-Sans.fdb", srcdir); FILE *font_file = fopen(fdbfont, "r"); if ( font_file == NULL ) { perror(fdbfont); exit(1); } /*SWFBrowserFont bfont = newSWFBrowserFont("_sans");*/ font = loadSWFFontFromFile(font_file); /* Dejagnu equipment */ dejagnuclip = get_dejagnu_clip((SWFBlock)font, 10, 0, 0, 800, 600); it = SWFMovie_add(mo, (SWFBlock)dejagnuclip); SWFDisplayItem_setDepth(it, 200); SWFDisplayItem_move(it, 200, 0); add_text_field(mo, "textfield", "_root.msg", "Button events", 10, 0, 5); add_text_field(mo, "textfield2", "_root.msg2", "Mouse events", 11, 0, 100); add_text_field(mo, "textfield3", "_root.msg3", "Key events", 12, 0, 80); SWFMovie_nextFrame(mo); /***************************************************** * * Add button * *****************************************************/ it = add_button(mo); SWFDisplayItem_moveTo(it, 40, 30); SWFDisplayItem_setName(it, "square1"); SWFDisplayItem_setDepth(it, 2); // Mouse pointer events //add_actions(mo, "square1.button.onRollOver = function() { _root.msg2 = 'RollOver'; };"); //add_actions(mo, "square1.button.onRollOut = function() { _root.msg2 = 'RollOut'; };"); // Mouse buttons events //add_actions(mo, "square1.button.onPress = function() { _root.msg2 = 'Press'; };"); //add_actions(mo, "square1.button.onRelease = function() { _root.msg2 = 'Release'; gotoAndStop(1); };"); //add_actions(mo, "square1.button.onReleaseOutside = function() { _root.msg2 = 'ReleaseOutside'; };"); // Focus events add_actions(mo, "square1.button.onSetFocus = function() { _root.msg3 = 'SetFocus'; };"); // Key events - button needs focus for these to work add_actions(mo, "square1.button.onKeyDown = function() { _root.msg3 = 'KeyDown'; };"); add_actions(mo, "square1.button.onKeyUp = function() { _root.msg3 = 'KeyUp'; };"); SWFMovie_nextFrame(mo); /* showFrame */ /***************************************************** * * On second frame, add a shape at lower depth * *****************************************************/ { SWFShape sh = make_fill_square(0, 0, 120, 120, 0, 0, 0, 0, 255, 0); SWFDisplayItem itsh = SWFMovie_add(mo, (SWFBlock)sh); SWFDisplayItem_setDepth(itsh, 1); SWFMovie_nextFrame(mo); /* showFrame */ } /***************************************************** * * On third frame, add a shape at higher depth * *****************************************************/ { SWFShape sh = make_fill_square(0, 0, 120, 120, 0, 0, 0, 0, 255, 0); SWFDisplayItem itsh = SWFMovie_add(mo, (SWFBlock)sh); SWFDisplayItem_setDepth(itsh, 3); SWFDisplayItem_setColorAdd(itsh, 0, 0, 0, -128); SWFMovie_nextFrame(mo); /* showFrame */ } /***************************************************** * * On third frame, add a shape at higher depth * *****************************************************/ { add_actions(mo, "square1.button.enabled = false;" //"_root.msg = _root.msg2 = _root.msg3 = 'Idle';" "stop();" "totals();" ); SWFMovie_nextFrame(mo); /* showFrame */ } /***************************************************** * * Save it... * *****************************************************/ puts("Saving " OUTPUT_FILENAME ); SWFMovie_save(mo, OUTPUT_FILENAME); return 0; }
int main(int argc, char** argv) { SWFMovie mo; const char *srcdir="."; char fdbfont[256]; SWFMovieClip dejagnuclip; /********************************************* * * Initialization * *********************************************/ if ( argc>1 ) srcdir=argv[1]; else { fprintf(stderr, "Usage: %s <mediadir>\n", argv[0]); return 1; } sprintf(fdbfont, "%s/Bitstream-Vera-Sans.fdb", srcdir); puts("Setting things up"); Ming_init(); Ming_useSWFVersion (OUTPUT_VERSION); //Ming_setScale(20.0); /* so we talk twips */ mo = newSWFMovie(); SWFMovie_setRate(mo, 1.0); SWFMovie_setDimension(mo, 800, 600); dejagnuclip = get_dejagnu_clip((SWFBlock)get_default_font(srcdir), 10, 0, 0, 800, 600); SWFMovie_add(mo, (SWFBlock)dejagnuclip); SWFMovie_nextFrame(mo); // 1st frame /********************************************* * * Add some textfields * *********************************************/ { SWFDisplayItem it; FILE *font_file = fopen(fdbfont, "r"); if ( font_file == NULL ) { perror(fdbfont); exit(1); } SWFFont efont = loadSWFFontFromFile(font_file); it = add_text_field(mo, efont, "First text"); SWFDisplayItem_setName(it, "dtext1"); SWFDisplayItem_moveTo(it, 0, 200); it = add_text_field(mo, efont, "Zweites Textfeld"); SWFDisplayItem_setName(it, "etext1"); SWFDisplayItem_moveTo(it, 0, 300); it = add_text_field(mo, efont, "Some more static text here... abcdefgh"); SWFDisplayItem_setName(it, "dtext2"); SWFDisplayItem_moveTo(it, 0, 400); } SWFMovie_nextFrame(mo); add_actions(mo, "createTextField('dynamictext1', 99, 10, 10, 10, 10);" "this.dynamictext1.text = 'Dynamic Text';"); add_actions(mo, "ts = this.getTextSnapshot();"); check(mo, "ts instanceof TextSnapshot"); check_equals(mo, "ts.getCount()", "64"); check_equals(mo, "ts.getText(0, 1)", "'F'"); check_equals(mo, "ts.getText(3, 3)", "'s'"); check_equals(mo, "ts.getText(-5, 5)", "'First'"); check_equals(mo, "ts.getText(10, 6)", "'Z'"); check_equals(mo, "ts.getText(0, 100)", "'First textZweites TextfeldSome more " "static text here... abcdefgh'"); add_actions(mo, "ss = ts.getText(100, 110);"); check_equals(mo, "typeof(ss)", "'string'"); check_equals(mo, "ss", "'h'"); check_equals(mo, "ss.length", "1"); check_equals(mo, "ts.getText(0, 100, true)", "'First text\nZweites Textfeld\nSome more " "static text here... abcdefgh'"); check_equals(mo, "ts.getText(0, 14, true)", "'First text\nZwei'"); check_equals(mo, "ts.findText(0, '', false)", "-1"); check_equals(mo, "ts.findText(0, 'f', false)", "0"); check_equals(mo, "ts.findText(0, 'f', true)", "22"); check_equals(mo, "ts.findText(1, 'Rst', false)", "2"); check_equals(mo, "ts.findText(3, 'RSt', false)", "-1"); check_equals(mo, "ts.findText(100, 'h', false)", "-1"); check_equals(mo, "ts.findText(64, 'h', false)", "-1"); check_equals(mo, "ts.findText(-5, 'Zwei', true)", "-1"); check_equals(mo, "ts.findText(-5, 'gh', true)", "-1"); add_actions(mo, "ts.setSelected(5, 30, true);"); check_equals(mo, "ts.getSelectedText()", "' textZweites TextfeldSome'"); check_equals(mo, "ts.getSelectedText(true)", "' text\nZweites " "Textfeld\nSome'"); check_equals(mo, "ts.getSelectedText(false)", "' textZweites TextfeldSome'"); check_equals(mo, "ts.getSelected(0, 4)", "false"); check_equals(mo, "ts.getSelected(1, 9)", "true"); check_equals(mo, "ts.getSelected(-4, 10)", "true"); check_equals(mo, "ts.getSelected(-4, 6)", "true"); check_equals(mo, "ts.getSelected(28, 23)", "true"); check_equals(mo, "ts.getSelected(20, 20)", "true"); check_equals(mo, "ts.getSelected(20, 27)", "true"); check_equals(mo, "ts.getSelected(-3, -1)", "false"); check_equals(mo, "ts.getSelected(30, 31)", "false"); check_equals(mo, "ts.getSelected(0, 5)", "false"); check_equals(mo, "ts.getSelected(40, 45)", "false"); check_equals(mo, "ts.getSelected(31, 34)", "false"); check_equals(mo, "ts.getSelected(0)", "undefined"); check_equals(mo, "ts.getSelected(1)", "undefined"); check_equals(mo, "ts.getSelected(-4)", "undefined"); check_equals(mo, "ts.getSelected(-4)", "undefined"); check_equals(mo, "ts.getSelected(28)", "undefined"); check_equals(mo, "ts.getSelected(20)", "undefined"); // Selected text is stored in the textfield and reset when a new // snapshot is taken. add_actions(mo, "ts2 = new TextSnapshot(this);"); check_equals(mo, "ts.getSelectedText(false)", "''"); check_equals(mo, "ts2.getCount()", "64"); check_equals(mo, "ts2.getSelectedText()", "''"); add_actions(mo, "ts2 = this.getTextSnapshot();"); check_equals(mo, "ts2.getCount()", "64"); check_equals(mo, "ts2.getSelectedText()", "''"); add_actions(mo, "ts2.setSelected(3, 10, true);"); check_equals(mo, "ts2.getSelectedText(false).length", "7"); check_equals(mo, "ts.getSelectedText(false).length", "7"); add_actions(mo, "ts.setSelectedColor(0xffff00);"); add_actions(mo, "ts2.setSelectedColor(0x0000ff);"); check_equals(mo, "ts.getSelectedText(false)", "'st text'"); add_actions(mo, "ri = ts.getTextRunInfo(4, 10);"); check_equals(mo, "typeof(ri)", "'object'"); check(mo, "ri instanceof Array"); check_equals(mo, "ri.length", "7"); add_actions(mo, "el = ri[1];"); check_equals(mo, "typeof(el)", "'object'"); check(mo, "!el.hasOwnProperty('indexInRun')"); check_equals(mo, "el.indexInRun", "5"); check_equals(mo, "el.selected", "true"); check_equals(mo, "el.font", "'Bitstream Vera Sans'"); check_equals(mo, "el.color", "0"); check_equals(mo, "el.height", "12"); check_equals(mo, "el.matrix_a", "1"); check_equals(mo, "el.matrix_b", "0"); check_equals(mo, "el.matrix_c", "0"); check_equals(mo, "el.matrix_d", "1"); check_equals(mo, "el.matrix_tx", "25.95"); check_equals(mo, "el.matrix_ty", "200"); xcheck_equals(mo, "el.corner0x", "25.95"); xcheck_equals(mo, "el.corner0y", "202.8"); xcheck_equals(mo, "el.corner1x", "29.75"); xcheck_equals(mo, "el.corner1y", "202.8"); xcheck_equals(mo, "el.corner2x", "29.75"); xcheck_equals(mo, "el.corner2y", "188.85"); xcheck_equals(mo, "el.corner3x", "25.95"); xcheck_equals(mo, "el.corner3y", "188.85"); // Check properties individually check_equals(mo, "ri[2].height", "12"); check_equals(mo, "ri[3].height", "12"); check_equals(mo, "ri[4].height", "12"); check_equals(mo, "ri[5].height", "12"); check_equals(mo, "ri[6].height", "12"); check_equals(mo, "ri[2].selected", "true"); check_equals(mo, "ri[3].selected", "true"); check_equals(mo, "ri[4].selected", "true"); check_equals(mo, "ri[5].selected", "true"); check_equals(mo, "ri[6].selected", "false"); check_equals(mo, "ri[2].matrix_tx", "29.75"); check_equals(mo, "ri[2].matrix_ty", "200"); check_equals(mo, "ri[3].matrix_tx", "34.4"); check_equals(mo, "ri[3].matrix_ty", "200"); check_equals(mo, "ri[4].matrix_tx", "41.75"); check_equals(mo, "ri[4].matrix_ty", "200"); xcheck_equals(mo, "ri[2].corner0x", "29.75"); xcheck_equals(mo, "ri[2].corner0y", "202.8"); xcheck_equals(mo, "ri[3].corner0x", "34.4"); xcheck_equals(mo, "ri[3].corner0y", "202.8"); xcheck_equals(mo, "ri[4].corner0x", "41.75"); xcheck_equals(mo, "ri[4].corner0y", "202.8"); xcheck_equals(mo, "ri[2].corner2y", "188.85"); xcheck_equals(mo, "ri[3].corner2y", "188.85"); xcheck_equals(mo, "ri[4].corner2y", "188.85"); add_actions(mo, "ts.setSelected(0, 10, true);"); add_actions(mo, "ts.setSelected(15, 20, false);"); check_equals(mo, "ts2.getSelectedText().length", "10"); add_actions(mo, "ri2 = ts.getTextRunInfo(0, 100);"); check_equals(mo, "ri2[0].selected", "true"); check_equals(mo, "ri2[1].selected", "true"); check_equals(mo, "ri2[2].selected", "true"); check_equals(mo, "ri2[3].selected", "true"); check_equals(mo, "ri2[4].selected", "true"); check_equals(mo, "ri2[5].selected", "true"); check_equals(mo, "ri2[6].selected", "true"); check_equals(mo, "ri2[15].selected", "false"); check_equals(mo, "ri2[16].selected", "false"); check_equals(mo, "ri2[17].selected", "false"); check_equals(mo, "ri2[18].selected", "false"); xcheck_equals(mo, "ri2[50].corner2y", "388.85"); xcheck_equals(mo, "ri2[50].corner2x", "156.6"); xcheck_equals(mo, "ri2[51].corner2y", "388.85"); xcheck_equals(mo, "ri2[51].corner2x", "163.95"); check_equals(mo, "ri2[50].matrix_tx", "151.65"); check_equals(mo, "ri2[51].matrix_tx", "156.55"); add_actions(mo, "ts = this.getTextSnapshot();"); check_equals(mo, "typeof(ts)", "'object'"); add_actions(mo, "backup = TextSnapshot;"); add_actions(mo, "TextSnapshot = undefined;"); add_actions(mo, "t = new TextSnapshot();"); check_equals(mo, "typeof(t)", "'undefined'"); check_equals(mo, "typeof(TextSnapshot)", "'undefined'"); add_actions(mo, "ts = this.getTextSnapshot();"); xcheck_equals(mo, "typeof(ts)", "'undefined'"); add_actions(mo, "TextSnapshot = backup;"); add_actions(mo, "ts = this.getTextSnapshot();"); check_equals(mo, "typeof(ts)", "'object'"); add_actions(mo, "backup = TextSnapshot.prototype;"); add_actions(mo, "TextSnapshot.prototype = undefined;"); add_actions(mo, "ts = this.getTextSnapshot();"); check_equals(mo, "typeof(ts)", "'object'"); add_actions(mo, "TextSnapshot.prototype = backup;"); add_actions(mo, "ts = this.getTextSnapshot();"); check_equals(mo, "typeof(ts)", "'object'"); add_actions(mo, "totals(); stop();"); SWFMovie_nextFrame(mo); /***************************************************** * * Output movie * *****************************************************/ puts("Saving " OUTPUT_FILENAME ); SWFMovie_save(mo, OUTPUT_FILENAME); return 0; }
int main(int argc, char** argv) { SWFMovie mo; const char *srcdir="."; char fdbfont[256]; SWFMovieClip dejagnuclip; /********************************************* * * Initialization * *********************************************/ if ( argc>1 ) srcdir=argv[1]; else { fprintf(stderr, "Usage: %s <mediadir>\n", argv[0]); return 1; } sprintf(fdbfont, "%s/Bitstream-Vera-Sans.fdb", srcdir); puts("Setting things up"); Ming_init(); Ming_useSWFVersion (OUTPUT_VERSION); //Ming_setScale(20.0); /* so we talk twips */ mo = newSWFMovie(); SWFMovie_setRate(mo, 1.0); SWFMovie_setDimension(mo, 800, 600); dejagnuclip = get_dejagnu_clip((SWFBlock)get_default_font(srcdir), 10, 0, 0, 800, 600); SWFMovie_add(mo, (SWFBlock)dejagnuclip); SWFMovie_nextFrame(mo); // 1st frame // Check that the dejagnu clip is really a TextField. check_equals(mo, "_root.getInstanceAtDepth(-16383)", "_level0.instance1"); check(mo, "_level0.instance1._xtrace_win " "instanceof TextField"); // Note: the dejagnuclip already placed some texts, so the following // should be true. check(mo, "TextField.prototype.hasOwnProperty('background')"); check(mo, "TextField.prototype.hasOwnProperty('backgroundColor')"); check(mo, "TextField.prototype.hasOwnProperty('text')"); check(mo, "TextField.prototype.hasOwnProperty('textColor')"); /********************************************* * * Add some textfields * *********************************************/ { SWFDisplayItem it; FILE *font_file = fopen(fdbfont, "r"); if ( font_file == NULL ) { perror(fdbfont); exit(1); } SWFBrowserFont bfont = newSWFBrowserFont("_sans"); SWFFont efont = loadSWFFontFromFile(font_file); it = add_text_field(mo, (SWFBlock)bfont, "Hello", 1, 2, 3, SWFTEXTFIELD_ALIGN_LEFT, 10, 100, 101, 102, 50); SWFDisplayItem_setName(it, "dtext1"); SWFDisplayItem_moveTo(it, 0, 200); it = add_text_field(mo, (SWFBlock)efont, "Hello", 4, 5, 6, SWFTEXTFIELD_ALIGN_CENTER, 11, 110, 111, 112, 51); SWFDisplayItem_setName(it, "etext1"); SWFDisplayItem_moveTo(it, 0, 300); SWFBrowserFont bfont2 = newSWFBrowserFont("times"); it = add_text_field(mo, (SWFBlock)bfont2, "Hello", 7, 8, 9, SWFTEXTFIELD_ALIGN_RIGHT, 12, 120, 121, 122, 52); SWFDisplayItem_setName(it, "dtext2"); SWFDisplayItem_moveTo(it, 0, 400); } SWFMovie_nextFrame(mo); check_equals(mo, "dtext1.embedFonts", "false"); check_equals(mo, "etext1.embedFonts", "true"); check_equals(mo, "etext1.hasOwnProperty('embedFonts')", "false"); add_actions(mo, "ret = Selection.setFocus(dtext1);" "check_equals(ret, false);" "check_equals(Selection.getFocus(), '_level0.dtext1');"); add_actions(mo, "ret = Selection.setFocus(etext1);" "check_equals(ret, false);" "check_equals(Selection.getFocus(), '_level0.etext1');"); add_actions(mo, "createTextField('dynamictext1', 99, 10, 10, 10, 10);"); add_actions(mo, "ret = Selection.setFocus(dynamictext1);" "check_equals(ret, false);" "check_equals(Selection.getFocus(), '_level0.dynamictext1');"); check_equals(mo, "dtext1.__proto__", "TextField.prototype"); check_equals(mo, "etext1.__proto__", "TextField.prototype"); check_equals(mo, "etext1.__proto__", "dynamictext1.__proto__"); // checks after placing some swf defined TextField check(mo, "TextField.prototype.hasOwnProperty('background')"); check(mo, "TextField.prototype.hasOwnProperty('backgroundColor')"); check(mo, "TextField.prototype.hasOwnProperty('text')"); check(mo, "TextField.prototype.hasOwnProperty('textColor')"); check(mo, "!TextField.prototype.hasOwnProperty('_parent')"); check(mo, "!TextField.prototype.hasOwnProperty('_xmouse')"); check(mo, "!TextField.prototype.hasOwnProperty('_ymouse')"); check(mo, "!TextField.prototype.hasOwnProperty('_xscale')"); check(mo, "!TextField.prototype.hasOwnProperty('_yscale')"); check_equals(mo, "typeof(dtext1)", "'object'"); check_equals(mo, "typeof(dtext1.text)", "'string'"); check_equals(mo, "typeof(dtext1.background)", "'boolean'"); check_equals(mo, "typeof(dtext1.backgroundColor)", "'number'"); check_equals(mo, "typeof(dtext1.textColor)", "'number'"); check_equals(mo, "typeof(dtext1._alpha)", "'number'"); check_equals(mo, "typeof(dtext1.type)", "'string'"); check_equals(mo, "dtext1.type", "'input'"); check_equals(mo, "typeof(dtext1.__proto__.text)", "'undefined'"); check_equals(mo, "typeof(dtext1.__proto__.background)", "'undefined'"); check_equals(mo, "typeof(dtext1.__proto__.backgroundColor)", "'undefined'"); check_equals(mo, "typeof(dtext1.__proto__.textColor)", "'undefined'"); check_equals(mo, "typeof(dtext1.__proto__._alpha)", "'undefined'"); check_equals(mo, "dtext1.hasOwnProperty('text')", "false"); check_equals(mo, "dtext1.hasOwnProperty('background')", "false"); check_equals(mo, "dtext1.hasOwnProperty('backgroundColor')", "false"); check_equals(mo, "dtext1.hasOwnProperty('textColor')", "false"); check_equals(mo, "dtext1.hasOwnProperty('_alpha')", "false"); check(mo, "!dtext1.hasOwnProperty('_parent')"); check(mo, "!dtext1.hasOwnProperty('_xmouse')"); check(mo, "!dtext1.hasOwnProperty('_ymouse')"); check(mo, "!dtext1.hasOwnProperty('_xscale')"); check(mo, "!dtext1.hasOwnProperty('_yscale')"); check(mo, "!etext1.hasOwnProperty('_parent')"); check(mo, "!etext1.hasOwnProperty('_xmouse')"); check(mo, "!etext1.hasOwnProperty('_ymouse')"); check(mo, "!etext1.hasOwnProperty('_xscale')"); check(mo, "!etext1.hasOwnProperty('_yscale')"); check(mo, "dtext1.__proto__.hasOwnProperty('text')"); check_equals(mo, "dtext1.__proto__.hasOwnProperty('background')", "true"); check_equals(mo, "dtext1.__proto__.hasOwnProperty('backgroundColor')", "true"); check_equals(mo, "dtext1.__proto__.hasOwnProperty('textColor')", "true"); // Why _alpha is special??? check_equals(mo, "dtext1.__proto__.hasOwnProperty('_alpha')", "false"); check_equals(mo, "dtext1.text", "'Hello'"); check_equals(mo, "etext1.text", "'Hello'"); check_equals(mo, "dtext2.text", "'Hello'"); check_equals(mo, "dtext1.background", "false"); check_equals(mo, "etext1.background", "false"); check_equals(mo, "dtext2.background", "false"); check_equals(mo, "dtext1.backgroundColor", "0xffffff"); check_equals(mo, "etext1.backgroundColor", "0xffffff"); check_equals(mo, "dtext2.backgroundColor", "0xffffff"); check_equals(mo, "dtext1.textColor", "6579558"); check_equals(mo, "etext1.textColor", "7237488"); check_equals(mo, "dtext2.textColor", "7895418"); check_equals(mo, "dtext1._alpha", "100"); check_equals(mo, "etext1._alpha", "100"); check_equals(mo, "dtext2._alpha", "100"); check_equals(mo, "etext1._parent", "_root"); check_equals(mo, "dtext2._parent", "_root"); check_equals(mo, "etext1._xscale", "100"); check_equals(mo, "dtext2._xscale", "100"); check_equals(mo, "etext1._yscale", "100"); check_equals(mo, "dtext2._yscale", "100"); check_equals(mo, "typeof(etext1._xmouse)", "'number'"); check_equals(mo, "typeof(dtext2._xmouse)", "'number'"); check_equals(mo, "typeof(etext1._ymouse)", "'number'"); check_equals(mo, "typeof(dtext2._ymouse)", "'number'"); // TextFormat objects are created on the fly add_actions(mo, "etext1.tf = etext1.getTextFormat();" "dtext2.tf = dtext2.getTextFormat();" ); check_equals(mo, "typeof(etext1.tf)", "'object'"); check_equals(mo, "typeof(dtext2.tf)", "'object'"); check_equals(mo, "etext1.tf.size", "12"); check_equals(mo, "dtext2.tf.size", "12"); check_equals(mo, "etext1.tf.font", "'Bitstream Vera Sans'"); check_equals(mo, "dtext2.tf.font", "'times'"); check_equals(mo, "typeof(etext1.tf.bold)", "'boolean'"); check_equals(mo, "typeof(dtext2.tf.bold)", "'boolean'"); check_equals(mo, "etext1.tf.bold", "false"); check_equals(mo, "dtext2.tf.bold", "false"); check_equals(mo, "typeof(etext1.tf.italic)", "'boolean'"); check_equals(mo, "typeof(dtext2.tf.italic)", "'boolean'"); check_equals(mo, "etext1.tf.italic", "false"); check_equals(mo, "dtext2.tf.italic", "false"); check_equals(mo, "typeof(etext1.tf.indent)", "'number'"); check_equals(mo, "typeof(dtext2.tf.indent)", "'number'"); check_equals(mo, "etext1.tf.indent", "4"); check_equals(mo, "dtext2.tf.indent", "7"); check_equals(mo, "typeof(etext1.tf.leftMargin)", "'number'"); check_equals(mo, "typeof(dtext2.tf.leftMargin)", "'number'"); check_equals(mo, "etext1.tf.leftMargin", "5"); check_equals(mo, "dtext2.tf.leftMargin", "8"); check_equals(mo, "typeof(etext1.tf.rightMargin)", "'number'"); check_equals(mo, "typeof(dtext2.tf.rightMargin)", "'number'"); check_equals(mo, "etext1.tf.rightMargin", "6"); check_equals(mo, "dtext2.tf.rightMargin", "9"); check_equals(mo, "typeof(etext1.tf.align)", "'string'"); check_equals(mo, "typeof(dtext2.tf.align)", "'string'"); check_equals(mo, "etext1.tf.align", "'center'"); check_equals(mo, "dtext2.tf.align", "'right'"); check_equals(mo, "typeof(etext1.tf.leading)", "'number'"); check_equals(mo, "typeof(dtext2.tf.leading)", "'number'"); check_equals(mo, "etext1.tf.leading", "11"); check_equals(mo, "dtext2.tf.leading", "12"); check_equals(mo, "typeof(etext1.tf.color)", "'number'"); check_equals(mo, "typeof(dtext2.tf.color)", "'number'"); check_equals(mo, "etext1.tf.color", "7237488"); check_equals(mo, "dtext2.tf.color", "7895418"); check_equals(mo, "typeof(etext1.tf.blockIndent)", "'number'"); check_equals(mo, "typeof(dtext2.tf.blockIndent)", "'number'"); check_equals(mo, "etext1.tf.blockIndent", "0"); check_equals(mo, "dtext2.tf.blockIndent", "0"); check_equals(mo, "typeof(etext1.tf.underline)", "'boolean'"); check_equals(mo, "typeof(dtext2.tf.underline)", "'boolean'"); check_equals(mo, "etext1.tf.underline", "false"); check_equals(mo, "dtext2.tf.underline", "false"); add_actions(mo, "dtext1.background = true;" "etext1.background = true;" "dtext2.background = true;" "dtext1.backgroundColor = 0xff0000;" "etext1.backgroundColor = 0x00ff00;" "dtext2.backgroundColor = 0x0000ff;" "dtext1.textColor = 0x00ffff;" "etext1.textColor = 0xff00ff;" "dtext2.textColor = 0xffff00;" "dtext1.text += ' world';" "etext1.text += ' world';" "dtext2.text += ' world';" ); check_equals(mo, "etext1.getTextFormat().color", "0xff00ff"); check_equals(mo, "dtext2.getTextFormat().color", "0xffff00"); check_equals(mo, "dtext1.text", "'Hello world'"); check_equals(mo, "etext1.text", "'Hello world'"); check_equals(mo, "dtext2.text", "'Hello world'"); check_equals(mo, "dtext1.background", "true"); check_equals(mo, "etext1.background", "true"); check_equals(mo, "dtext2.background", "true"); check_equals(mo, "dtext1.backgroundColor", "0xff0000"); check_equals(mo, "etext1.backgroundColor", "0x00ff00"); check_equals(mo, "dtext2.backgroundColor", "0x0000ff"); check_equals(mo, "dtext1.textColor", "0x00ffff"); check_equals(mo, "etext1.textColor", "0xff00ff"); check_equals(mo, "dtext2.textColor", "0xffff00"); SWFMovie_nextFrame(mo); add_actions(mo, "dtext1._alpha = 0;" "etext1._alpha = 0;" "dtext2._alpha = 0;" ); check_equals(mo, "dtext1._alpha", "0"); check_equals(mo, "etext1._alpha", "0"); check_equals(mo, "dtext2._alpha", "0"); SWFMovie_nextFrame(mo); add_actions(mo, "dtext1._alpha = 100; dtext1.embedFonts=true; dtext1.text = 'embedFonts';" "etext1._alpha = 100; etext1.embedFonts=false; etext1.text = '!embedFonts';" "dtext2._alpha = 100;" ); check_equals(mo, "dtext1.embedFonts", "true"); check_equals(mo, "etext1.embedFonts", "false"); add_actions(mo, "totals(); stop();"); SWFMovie_nextFrame(mo); /***************************************************** * * Output movie * *****************************************************/ puts("Saving " OUTPUT_FILENAME ); SWFMovie_save(mo, OUTPUT_FILENAME); return 0; }
int main(int argc, char** argv) { SWFMovie mo; const char *srcdir="."; char fdefont[256]; SWFMovieClip dejagnuclip; SWFDisplayItem it; /********************************************* * * Initialization * *********************************************/ if ( argc>1 ) srcdir=argv[1]; else { fprintf(stderr, "Usage: %s <mediadir>\n", argv[0]); return 1; } sprintf(fdefont, "%s/Bitstream-Vera-Sans.fdb", srcdir); FILE *font_file = fopen(fdefont, "r"); if ( font_file == NULL ) { perror(fdefont); exit(1); } SWFFont efont = loadSWFFontFromFile(font_file); puts("Setting things up"); Ming_init(); Ming_useSWFVersion (OUTPUT_VERSION); mo = newSWFMovie(); SWFMovie_setRate(mo, 1.0); SWFMovie_setDimension(mo, 800, 600); dejagnuclip = get_dejagnu_clip((SWFBlock)get_default_font(srcdir), 10, 0, 0, 800, 600); SWFMovie_add(mo, (SWFBlock)dejagnuclip); SWFMovie_nextFrame(mo); // 1st frame /********************************************* * * Add some textfields * *********************************************/ int y = 30; int inc = 30; it = add_text_field(mo, (SWFBlock)efont, "Normal", 1, 2, 3, SWFTEXTFIELD_ALIGN_LEFT, 10, 0, 0, 0, 255); SWFDisplayItem_moveTo(it, 50, y); SWFDisplayItem_setName(it, "tf1"); y += inc; it = add_text_field(mo, (SWFBlock)efont, "Transparent", 1, 2, 3, SWFTEXTFIELD_ALIGN_LEFT, 10, 0, 0, 0, 0); SWFDisplayItem_moveTo(it, 50, y); SWFDisplayItem_setName(it, "tf2"); y += inc; it = add_text_field(mo, (SWFBlock)efont, "X scaled by 16, no indent or " "margin", 0, 0, 0, SWFTEXTFIELD_ALIGN_LEFT, 10, 0, 0, 0, 255); SWFDisplayItem_moveTo(it, 50, y); SWFDisplayItem_scale(it, 16, 1); SWFDisplayItem_setName(it, "tf3"); y += inc; it = add_text_field(mo, (SWFBlock)efont, "X scaled by 16, indent 4", 4, 0, 0, SWFTEXTFIELD_ALIGN_LEFT, 10, 0, 0, 0, 255); SWFDisplayItem_moveTo(it, 50, y); SWFDisplayItem_scale(it, 16, 1); SWFDisplayItem_setName(it, "tf4"); y += inc; it = add_text_field(mo, (SWFBlock)efont, "X scaled by 16, left margin 4", 0, 4, 0, SWFTEXTFIELD_ALIGN_LEFT, 10, 0, 0, 0, 255); SWFDisplayItem_moveTo(it, 50, y); SWFDisplayItem_scale(it, 16, 1); SWFDisplayItem_setName(it, "tf5"); y += inc; it = add_text_field(mo, (SWFBlock)efont, "X scaled by 16, right margin 4", 0, 0, 4, SWFTEXTFIELD_ALIGN_LEFT, 10, 0, 0, 0, 255); SWFDisplayItem_moveTo(it, 50, y); SWFDisplayItem_scale(it, 16, 1); SWFDisplayItem_setName(it, "tf6"); y += inc; it = add_text_field(mo, (SWFBlock)efont, "X scaled by 16, left margin 4, " "indent 4", 4, 4, 0, SWFTEXTFIELD_ALIGN_LEFT, 10, 0, 0, 0, 255); SWFDisplayItem_moveTo(it, 50, y); SWFDisplayItem_scale(it, 16, 1); SWFDisplayItem_setName(it, "tf7"); y += inc; it = add_text_field(mo, (SWFBlock)efont, "X scaled by 8, no indent or margin", 0, 0, 0, SWFTEXTFIELD_ALIGN_LEFT, 10, 0, 0, 0, 255); SWFDisplayItem_moveTo(it, 50, y); SWFDisplayItem_scale(it, 8, 1); SWFDisplayItem_setName(it, "tf8"); y += inc; it = add_text_field(mo, (SWFBlock)efont, "X scaled by 8, indent 4", 4, 0, 0, SWFTEXTFIELD_ALIGN_LEFT, 10, 0, 0, 0, 255); SWFDisplayItem_moveTo(it, 50, y); SWFDisplayItem_scale(it, 8, 1); SWFDisplayItem_setName(it, "tf9"); y += inc; it = add_text_field(mo, (SWFBlock)efont, "X scaled by 0.2", 8, 8, 8, SWFTEXTFIELD_ALIGN_LEFT, 10, 0, 0, 0, 255); SWFDisplayItem_moveTo(it, 50, y); SWFDisplayItem_scale(it, 0.2, 1); SWFDisplayItem_setName(it, "tf10"); y += inc; it = add_text_field(mo, (SWFBlock)efont, "Y scaled by 4", 4, 4, 0, SWFTEXTFIELD_ALIGN_LEFT, 10, 0, 0, 0, 255); SWFDisplayItem_moveTo(it, 50, y); SWFDisplayItem_scale(it, 1, 4); SWFDisplayItem_setName(it, "tf11"); y += inc * 3; it = add_text_field(mo, (SWFBlock)efont, "Y scaled by 8", 4, 4, 0, SWFTEXTFIELD_ALIGN_LEFT, 10, 0, 0, 0, 255); SWFDisplayItem_moveTo(it, 50, y); SWFDisplayItem_scale(it, 1, 8); SWFDisplayItem_setName(it, "tf12"); // It's not clear how consistent the textWidth or textHeight // values are. As they are embedded, it may be possible to reproduce // exactly, in which case the test can be made more precise. check_equals(mo, "tf1._width", "84"); check_equals(mo, "tf1._height", "20"); xcheck_equals(mo, "tf1._x", "48"); xcheck_equals(mo, "tf1._y", "28"); xcheck_equals(mo, "tf1.textHeight", "23"); // Approx 46 add_actions(mo, "trace(tf1.textWidth);"); xcheck(mo, "tf1.textWidth >= 44 && tf1.textWidth <= 48"); check_equals(mo, "tf2._width", "84"); check_equals(mo, "tf2._height", "20"); xcheck_equals(mo, "tf2._x", "48"); xcheck_equals(mo, "tf2._y", "58"); xcheck_equals(mo, "tf2.textHeight", "23"); // Approx 78 add_actions(mo, "trace(tf2.textWidth);"); xcheck(mo, "tf2.textWidth >= 76 && tf2.textWidth <= 80"); check_equals(mo, "tf3._width", "1344"); check_equals(mo, "tf3._height", "20"); xcheck_equals(mo, "tf3._x", "18"); xcheck_equals(mo, "tf3._y", "88"); xcheck_equals(mo, "tf3.textHeight", "23"); // Approx 230 add_actions(mo, "trace(tf3.textWidth);"); xcheck(mo, "tf3.textWidth >= 225 && tf3.textWidth <= 235"); check_equals(mo, "tf4._width", "1344"); check_equals(mo, "tf4._height", "20"); xcheck_equals(mo, "tf4._x", "18"); xcheck_equals(mo, "tf4._y", "118"); xcheck_equals(mo, "tf4.textHeight", "23"); // Approx 156 add_actions(mo, "trace(tf4.textWidth);"); xcheck(mo, "tf4.textWidth >= 153 && tf4.textWidth <= 159"); check_equals(mo, "tf5._width", "1344"); check_equals(mo, "tf5._height", "20"); xcheck_equals(mo, "tf5._x", "18"); xcheck_equals(mo, "tf5._y", "148"); xcheck_equals(mo, "tf5.textHeight", "23"); // Approx 186 add_actions(mo, "trace(tf5.textWidth);"); xcheck(mo, "tf5.textWidth >= 183 && tf5.textWidth <= 189"); check_equals(mo, "tf6._width", "1344"); check_equals(mo, "tf6._height", "20"); xcheck_equals(mo, "tf6._x", "18"); xcheck_equals(mo, "tf6._y", "178"); xcheck_equals(mo, "tf6.textHeight", "23"); // Approx 194 add_actions(mo, "trace(tf6.textWidth);"); xcheck(mo, "tf6.textWidth >= 189 && tf6.textWidth <= 199"); check_equals(mo, "tf7._width", "1344"); check_equals(mo, "tf7._height", "20"); xcheck_equals(mo, "tf7._x", "18"); xcheck_equals(mo, "tf7._y", "208"); xcheck_equals(mo, "tf7.textHeight", "23"); // Approx 247 add_actions(mo, "trace(tf7.textWidth);"); xcheck(mo, "tf7.textWidth >= 240 && tf7.textWidth <= 254"); check_equals(mo, "tf8._width", "672"); check_equals(mo, "tf8._height", "20"); xcheck_equals(mo, "tf8._x", "34"); xcheck_equals(mo, "tf8._y", "238"); xcheck_equals(mo, "tf8.textHeight", "23"); // Approx 222 add_actions(mo, "trace(tf8.textWidth);"); xcheck(mo, "tf8.textWidth >= 217 && tf8.textWidth <= 227"); check_equals(mo, "tf9._width", "672"); check_equals(mo, "tf9._height", "20"); xcheck_equals(mo, "tf9._x", "34"); xcheck_equals(mo, "tf9._y", "268"); xcheck_equals(mo, "tf9.textHeight", "23"); // Approx 148 add_actions(mo, "trace(tf9.textWidth);"); xcheck(mo, "tf9.textWidth >= 144 && tf9.textWidth <= 152"); check_equals(mo, "tf10._width", "16.8"); check_equals(mo, "tf10._height", "20"); xcheck_equals(mo, "tf10._x", "49.6"); xcheck_equals(mo, "tf10._y", "298"); xcheck_equals(mo, "tf10.textHeight", "23"); // Approx 99 add_actions(mo, "trace(tf10.textWidth);"); xcheck(mo, "tf10.textWidth >= 95 && tf10.textWidth <= 103"); // The textHeight for the following two fields varies. check_equals(mo, "tf11._width", "84"); check_equals(mo, "tf11._height", "80"); xcheck_equals(mo, "tf11._x", "48"); xcheck_equals(mo, "tf11._y", "322"); xcheck_equals(mo, "tf11.textHeight", "23"); // Approx 86 add_actions(mo, "trace(tf11.textWidth);"); xcheck(mo, "tf11.textWidth >= 84 && tf11.textWidth <= 88"); check_equals(mo, "tf12._width", "84"); check_equals(mo, "tf12._height", "160"); xcheck_equals(mo, "tf12._x", "48"); xcheck_equals(mo, "tf12._y", "404"); xcheck_equals(mo, "tf12.textHeight", "23"); // Approx 86 add_actions(mo, "trace(tf12.textWidth);"); xcheck(mo, "tf12.textWidth >= 84 && tf12.textWidth <= 88"); add_actions(mo, "totals(); stop();"); SWFMovie_nextFrame(mo); /***************************************************** * * Output movie * *****************************************************/ puts("Saving " OUTPUT_FILENAME ); SWFMovie_save(mo, OUTPUT_FILENAME); return 0; }