Functions

ming_utils.c File Reference

#include "ming_utils.h"
#include <stdlib.h>
#include <stdio.h>
#include <ming.h>
#include <stdarg.h>

Functions

void add_xtrace_function_clip (SWFMovieClip mo, SWFBlock font, int depth, int x, int y, int width, int height)
void add_xtrace_function (SWFMovie mo, SWFBlock font, int depth, int x, int y, int width, int height)
SWFShape make_square (int x, int y, int width, int height, byte r, byte g, byte b)
 Create an outline square shape with given offset, size and colors.
SWFShape make_fill_square (int x, int y, int width, int height, byte or, byte og, byte ob, byte fr, byte fg, byte fb)
 Create a filled square shape with given offset, size and colors.
SWFMovieClip get_dejagnu_clip (SWFBlock font, int depth, int x, int y, int width, int height)
 Return a 'dejagnu' clip. This is like add_dejagnu_functions but embeds the functionalities in a movieclip, ready for export.
void add_dejagnu_functions (SWFMovie mo, SWFBlock font, int depth, int x, int y, int width, int height)
 Add 'check', 'xcheck', 'check_equals', 'xcheck_equals' ActionScript functions for use by embedded-swf tests, and a textfield to print results of the checks to (results will additionally be 'traced'). The textfield uses embedded fonts (only ascii chars loaded).
void add_clip_actions (SWFMovieClip mo, const char *code)
 Add an arbitrary ActionScript code in the given movieclip.
SWFAction compile_actions (const char *fmt,...)
 Compile ActionScript code using printf-like formatting.
void add_actions (SWFMovie mo, const char *code)
 Add an arbitrary ActionScript code in the given movie.
void print_tests_summary (SWFMovie mo)
 Print TestState total summary. (make sure you called add_dejagnu_functions before using this function).
SWFFont get_default_font (const char *mediadir)
 Get the default font for Gnash testcases.

Function Documentation

void add_actions ( SWFMovie  mo,
const char *  code 
)

Add an arbitrary ActionScript code in the given movie.

Parameters:
mo The SWFMovie to add the DO_ACTION block to.
code ActionScript code to be compiled in.

Referenced by add_xtrace_function(), endOfTests(), main(), pauseForNextTest(), print_tests_summary(), printFrameInfo(), runAttachedSoundsTest(), runMultipleSoundsTest(), runNoMultipleSoundsTest(), and runTrimmedSoundsTest().

void add_clip_actions ( SWFMovieClip  mc,
const char *  code 
)

Add an arbitrary ActionScript code in the given movieclip.

Parameters:
mc The SWFMovieClip to add the DO_ACTION block to.
code ActionScript code to be compiled in.

Referenced by add_static_mc(), add_xtrace_function_clip(), addRedSquareExport(), and main().

void add_dejagnu_functions ( SWFMovie  mo,
SWFBlock  font,
int  depth,
int  x,
int  y,
int  width,
int  height 
)

Add 'check', 'xcheck', 'check_equals', 'xcheck_equals' ActionScript functions for use by embedded-swf tests, and a textfield to print results of the checks to (results will additionally be 'traced'). The textfield uses embedded fonts (only ascii chars loaded).

Note that the x, y, width and height parameters will depend on the currently set Ming scale (see Ming_setScale). By default they are pixels (twips*20).

References add_xtrace_function().

Referenced by main().

void add_xtrace_function ( SWFMovie  mo,
SWFBlock  font,
int  depth,
int  x,
int  y,
int  width,
int  height 
)

References add_actions().

Referenced by add_dejagnu_functions().

void add_xtrace_function_clip ( SWFMovieClip  mo,
SWFBlock  font,
int  depth,
int  x,
int  y,
int  width,
int  height 
)

References add_clip_actions().

Referenced by get_dejagnu_clip().

SWFAction compile_actions ( const char *  fmt,
  ... 
)

Compile ActionScript code using printf-like formatting.

Referenced by add_dynamic_mc().

SWFFont get_default_font ( const char *  mediadir  ) 

Get the default font for Gnash testcases.

Parameters:
mediadir the 'media' directory under testsuite/ dir of Gnash source tree.
SWFMovieClip get_dejagnu_clip ( SWFBlock  font,
int  depth,
int  x,
int  y,
int  width,
int  height 
)

Return a 'dejagnu' clip. This is like add_dejagnu_functions but embeds the functionalities in a movieclip, ready for export.

The Dejagnu.c file uses this function to create a Dejagnu.swf file that exports a 'dejagnu' symbol. The architecture still needs a bit of tuning for general use (the goal is making it easy for flash coders to produce standard testcases), anyway

A quick test revealed that it is possible, with an SWF targeted at version 5, to 'import' the Dejagnu.swf file and use it's functionalities.

For importing it using the command-line actionscript compiler:

makeswf -o test.swf -v5 -iDejagnu.swf:dejagnu 0.as test.as

Note that the '0.as' is just a placeholder to have a first frame with no actions. This is needed because actions in the main movie (the "importer") are executed *before* actions in the loaded movie (the "exported": Dejagnu.swf). So, in order to use functions defined in the "imported" movie we have to wait the second frame.

References add_xtrace_function_clip().

Referenced by main(), and setupMovie().

SWFShape make_fill_square ( int  x,
int  y,
int  width,
int  height,
byte  or,
byte  og,
byte  ob,
byte  fr,
byte  fg,
byte  fb 
)

Create a filled square shape with given offset, size and colors.

Referenced by add_button(), add_square(), add_static_mask(), add_static_mc(), addRedSquareExport(), defineMovieclip(), get_button(), get_shape(), get_static_mc(), and main().

SWFShape make_square ( int  x,
int  y,
int  width,
int  height,
byte  r,
byte  g,
byte  b 
)

Create an outline square shape with given offset, size and colors.

Referenced by add_static_mc(), and main().

void print_tests_summary ( SWFMovie  mo  ) 

Print TestState total summary. (make sure you called add_dejagnu_functions before using this function).

Parameters:
mo The SWFMovie to add the DO_ACTION block to

References add_actions().

Referenced by main().