[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog testsuite/misc-ming.all/Makefil...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog testsuite/misc-ming.all/Makefil... |
Date: |
Thu, 16 Nov 2006 00:35:33 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 06/11/16 00:35:32
Modified files:
. : ChangeLog
testsuite/misc-ming.all: Makefile.am ming_utils.c ming_utils.h
Log message:
* testsuite/misc-ming.all: ming_utils.{c.h}: add
a get_dejagnu_clip() function.
* testsuite/misc-ming.all: Makefile.am, Dejagnu.c:
initial version of a loadable Dejagnu module for SWF
(needs more work)
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1624&r2=1.1625
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/Makefile.am?cvsroot=gnash&r1=1.32&r2=1.33
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/ming_utils.c?cvsroot=gnash&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/ming_utils.h?cvsroot=gnash&r1=1.8&r2=1.9
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1624
retrieving revision 1.1625
diff -u -b -r1.1624 -r1.1625
--- ChangeLog 15 Nov 2006 15:30:01 -0000 1.1624
+++ ChangeLog 16 Nov 2006 00:35:32 -0000 1.1625
@@ -1,3 +1,11 @@
+2006-11-16 Sandro Santilli <address@hidden>
+
+ * testsuite/misc-ming.all: ming_utils.{c.h}: add
+ a get_dejagnu_clip() function.
+ * testsuite/misc-ming.all: Makefile.am, Dejagnu.c:
+ initial version of a loadable Dejagnu module for SWF
+ (needs more work)
+
2006-11-15 Sandro Santilli <address@hidden>
* testsuite/misc-ming.all/ming_utils.{c,h}:
Index: testsuite/misc-ming.all/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/Makefile.am,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- testsuite/misc-ming.all/Makefile.am 14 Nov 2006 09:38:57 -0000 1.32
+++ testsuite/misc-ming.all/Makefile.am 16 Nov 2006 00:35:32 -0000 1.33
@@ -47,6 +47,7 @@
DefineEditTextTest \
DefineEditTextVariableNameTest \
DefineEditTextVariableNameTest-Runner \
+ Dejagnu \
RollOverOutTest-Runner \
ButtonEventsTest-Runner \
spritehier \
@@ -159,6 +160,16 @@
ButtonEventsTest.swf \
$(NULL)
+Dejagnu_SOURCES = \
+ Dejagnu.c \
+ ming_utils.h \
+ ming_utils.c \
+ $(NULL)
+Dejagnu_LDADD = $(MING_LIBS)
+
+Dejagnu.swf: Dejagnu
+ ./Dejagnu $(top_srcdir)/testsuite/media
+
clean-local:
-rm *.swf media
Index: testsuite/misc-ming.all/ming_utils.c
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/ming_utils.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- testsuite/misc-ming.all/ming_utils.c 15 Nov 2006 15:30:01 -0000
1.10
+++ testsuite/misc-ming.all/ming_utils.c 16 Nov 2006 00:35:32 -0000
1.11
@@ -22,12 +22,63 @@
#include <ming.h>
#include <ming_utils.h>
+void add_xtrace_function_clip(SWFMovieClip mo, SWFBlock font, int depth, int
x, int y, int width, int height);
+
+void
+add_xtrace_function_clip(SWFMovieClip mc, SWFBlock font, int depth, int x, int
y, int width, int height)
+{
+ SWFTextField tf;
+ SWFDisplayItem it;
+ const char* asciichars = " address@hidden&*()-_=+[]{};:.>,</?'\"\\|`~";
+
+ tf = newSWFTextField();
+
+ SWFTextField_setFont(tf, font);
+
+ /* setting flags seem unneeded */
+ /*SWFTextField_setFlags(tf, SWFTEXTFIELD_USEFONT|SWFTEXTFIELD_NOEDIT);*/
+
+ /* Add all ascii chars */
+ SWFTextField_addChars(tf, asciichars);
+ SWFTextField_addString(tf, " - xtrace enabled -\n");
+
+ SWFTextField_setBounds(tf, width, height);
+
+ /*
+ * Hopefully we have a *single* _root.
+ */
+ SWFTextField_setVariableName(tf, "_root._trace_text");
+
+ /*SWFTextField_setHeight(tf, 240);*/
+ /*SWFTextField_setColor(tf, 0x00, 0x00, 0x00, 0xff);*/
+ /*SWFTextField_setAlignment(tf, SWFTEXTFIELD_ALIGN_LEFT);*/
+ /*SWFTextField_setLeftMargin(tf, 0);*/
+ /*SWFTextField_setRightMargin(tf, 0);*/
+ /*SWFTextField_setIndentation(tf, 0);*/
+ /*SWFTextField_setLineSpacing(tf, 40);*/
+ /*SWFTextField_setLineSpacing(tf, 40);*/
+
+ it = SWFMovieClip_add(mc, (SWFBlock)tf);
+ SWFDisplayItem_moveTo(it, x, y);
+ SWFDisplayItem_setDepth(it, depth);
+ SWFDisplayItem_setName(it, "_xtrace_win");
+
+ add_clip_actions(mc,
+ " _root.xtrace = function (msg) { "
+ " trace (msg); "
+ " _root._trace_text += msg + '\n'; "
+ "};");
+
+}
+
+void add_xtrace_function(SWFMovie 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)
{
SWFTextField tf;
SWFDisplayItem it;
- const char* asciichars = "address@hidden&*()-_=+[]{};:.>,</?'\"\\|`~";
+ const char* asciichars = " address@hidden&*()-_=+[]{};:.>,</?'\"\\|`~";
tf = newSWFTextField();
@@ -42,6 +93,11 @@
SWFTextField_setBounds(tf, width, height);
+ /*
+ * Hopefully we have a *single* _root.
+ */
+ SWFTextField_setVariableName(tf, "_root._trace_text");
+
/*SWFTextField_setHeight(tf, 240);*/
/*SWFTextField_setColor(tf, 0x00, 0x00, 0x00, 0xff);*/
/*SWFTextField_setAlignment(tf, SWFTEXTFIELD_ALIGN_LEFT);*/
@@ -56,11 +112,10 @@
SWFDisplayItem_setDepth(it, depth);
SWFDisplayItem_setName(it, "_xtrace_win");
- /* Where would we find the _xtrace_win ? */
add_actions(mo,
" _global.xtrace = function (msg) { "
" trace (msg); "
- " _level0._xtrace_win.text += msg + '\n'; "
+ " _root._trace_text += msg + '\n'; "
"};");
}
@@ -94,19 +149,16 @@
return sh;
}
-void
-add_dejagnu_functions(SWFMovie mo, SWFBlock font,
- int depth, int x, int y, int width, int height)
+SWFAction
+get_dejagnu_actions()
{
SWFAction ac;
- add_xtrace_function(mo, font, depth, x, y, width, height);
-
static const size_t BUFLEN = 2048;
char buf[BUFLEN];
snprintf(buf, BUFLEN,
- "function TestState() {\n"
+ "TestState = function() {\n"
" this.passed = 0;\n"
" this.failed = 0;\n"
" this.untest = 0;\n"
@@ -114,52 +166,74 @@
"};\n"
"TestState.prototype.fail = function (why) {\n"
" this.failed++;\n"
- " xtrace('FAILED: '+why);\n"
+ " _root.xtrace('FAILED: '+why);\n"
"};\n"
"TestState.prototype.xfail = function(why) {\n"
" this.failed++;\n"
- " xtrace('XFAILED: '+why);\n"
+ " _root.xtrace('XFAILED: '+why);\n"
"};\n"
"TestState.prototype.pass = function(why) {\n"
" this.passed++;\n"
- " xtrace('PASSED: '+why);\n"
+ " _root.xtrace('PASSED: '+why);\n"
"};\n"
"TestState.prototype.xpass = function(why) {\n"
" this.xpassed++;\n"
- " xtrace('XPASSED: '+why);\n"
+ " _root.xtrace('XPASSED: '+why);\n"
"};\n"
"TestState.prototype.totals = function() {\n"
- " xtrace('#passed: '+ this.passed);\n"
- " xtrace('#failed: '+ this.failed);\n"
+ " _root.xtrace('#passed: '+ this.passed);\n"
+ " _root.xtrace('#failed: '+ this.failed);\n"
" if ( this.xpassed ) {\n"
- " xtrace('#unexpected successes: '+ this.xpassed);\n"
+ " _root.xtrace('#unexpected successes: '+ this.xpassed);\n"
" }\n"
" if ( this.xfailed ) {\n"
- " xtrace('#expected failures: '+ this.xfailed);\n"
+ " _root.xtrace('#expected failures: '+ this.xfailed);\n"
" }\n"
"};\n"
- "_global.runtest = new TestState();\n"
- "function check_equals(obt, exp) {\n"
- " if ( obt == exp ) runtest.pass(obt+' == '+exp);\n"
- " else runtest.fail('expected: '+exp+' , obtained: '+obt);\n"
- "}\n"
- "function xcheck_equals(obt, exp) {\n"
- " if ( obt == exp ) runtest.xpass(obt+' == '+exp);\n"
- " else runtest.xfail('expected: '+exp+' , obtained: '+obt);\n"
- "}\n"
- "function check(a) {\n"
- " if ( a ) runtest.pass(a);\n"
- " else runtest.fail(a);\n"
- "}\n"
- "function xcheck(a) {\n"
- " if ( a ) runtest.xpass(a);\n"
- " else runtest.xfail(a);\n"
- "}\n"
+ "_root.runtest = new TestState();\n"
+ "_root.check_equals = function(obt, exp) {\n"
+ " if ( obt == exp ) _root.runtest.pass(obt+' == '+exp);\n"
+ " else _root.runtest.fail('expected: '+exp+' , obtained:
'+obt);\n"
+ "};\n"
+ "_root.xcheck_equals = function(obt, exp) {\n"
+ " if ( obt == exp ) _root.runtest.xpass(obt+' == '+exp);\n"
+ " else _root.runtest.xfail('expected: '+exp+' , obtained:
'+obt);\n"
+ "};\n"
+ "_root.check = function(a) {\n"
+ " if ( a ) _root.runtest.pass(a);\n"
+ " else _root.runtest.fail(a);\n"
+ "};\n"
+ "_root.xcheck = function(a) {\n"
+ " if ( a ) _root.runtest.xpass(a);\n"
+ " else _root.runtest.xfail(a);\n"
+ "};\n"
);
- /*printf("%s", buf);*/
+ return compileSWFActionCode(buf);
+}
- ac = compileSWFActionCode(buf);
+SWFMovieClip
+get_dejagnu_clip(SWFBlock font, int depth, int x, int y, int width, int height)
+{
+ SWFMovieClip mc = newSWFMovieClip();
+ SWFAction ac = get_dejagnu_actions();
+
+ add_xtrace_function_clip(mc, font, depth, x, y, width, height);
+
+ SWFMovieClip_add(mc, (SWFBlock)ac);
+
+ SWFMovieClip_nextFrame(mc);
+
+ return mc;
+}
+
+void
+add_dejagnu_functions(SWFMovie mo, SWFBlock font,
+ int depth, int x, int y, int width, int height)
+{
+ SWFAction ac = get_dejagnu_actions();
+
+ add_xtrace_function(mo, font, depth, x, y, width, height);
SWFMovie_add(mo, (SWFBlock)ac);
}
@@ -198,15 +272,18 @@
}
void
-add_actions(SWFMovie mo, const char* code)
+add_clip_actions(SWFMovieClip mo, const char* code)
{
- static const size_t BUFLEN = 1024;
+ SWFAction ac;
+ ac = compileSWFActionCode(code);
+ SWFMovieClip_add(mo, (SWFBlock)ac);
+}
- char buf[BUFLEN];
+void
+add_actions(SWFMovie mo, const char* code)
+{
SWFAction ac;
- snprintf(buf, BUFLEN, "%s", code);
- buf[BUFLEN-1] = '\0';
- ac = compileSWFActionCode(buf);
+ ac = compileSWFActionCode(code);
SWFMovie_add(mo, (SWFBlock)ac);
}
Index: testsuite/misc-ming.all/ming_utils.h
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/ming_utils.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- testsuite/misc-ming.all/ming_utils.h 15 Nov 2006 15:30:01 -0000
1.8
+++ testsuite/misc-ming.all/ming_utils.h 16 Nov 2006 00:35:32 -0000
1.9
@@ -44,6 +44,31 @@
void add_dejagnu_functions(SWFMovie mo, SWFBlock font, int depth, int x, int
y, int width, int height);
/** \brief
+ * 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.
+ *
+ */
+SWFMovieClip get_dejagnu_clip(SWFBlock font, int depth, int x, int y, int
width, int height);
+
+/** \brief
* Evaluate ActionScript 'expr' expression updating the global TestState
* (make sure you called add_dejagnu_functions before using this function)
*
@@ -98,6 +123,18 @@
void add_actions(SWFMovie mo, const char* code);
/** \brief
+ * Add an arbitrary ActionScript code in the given movieclip
+ *
+ * @param mc
+ * The SWFMovieClip to add the DO_ACTION block to.
+ *
+ * @param code
+ * ActionScript code to be compiled in.
+ */
+void add_clip_actions(SWFMovieClip mc, const char* code);
+
+
+/** \brief
* Create an outline square shape with given offset, size and colors
*/
SWFShape make_square(int x, int y, int width, int height, byte r, byte g, byte
b);