[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog testsuite/misc-ming.all/ming_ut...
From: |
Zou Lunkai |
Subject: |
[Gnash-commit] gnash ChangeLog testsuite/misc-ming.all/ming_ut... |
Date: |
Thu, 29 Mar 2007 02:45:22 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Zou Lunkai <zoulunkai> 07/03/29 02:45:22
Modified files:
. : ChangeLog
testsuite/misc-ming.all: ming_utils.c ming_utils.h
Added files:
testsuite/misc-ming.all: init_action_test.c
Log message:
new testcase for DoInitAction tag
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2708&r2=1.2709
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/ming_utils.c?cvsroot=gnash&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/ming_utils.h?cvsroot=gnash&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/init_action_test.c?cvsroot=gnash&rev=1.1
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2708
retrieving revision 1.2709
diff -u -b -r1.2708 -r1.2709
--- ChangeLog 28 Mar 2007 23:42:19 -0000 1.2708
+++ ChangeLog 29 Mar 2007 02:45:22 -0000 1.2709
@@ -1,3 +1,10 @@
+2007-03-22 Zou Lunkai <address@hidden>
+
+ * testsuite/misc-ming.all: init_action_test.c
+ add a new testcase for DoInitAction.
+ * testsuite/misc-ming.all/ming_utils.c, ming_utils.h
+ add a interface for adding init actions for sprites.
+
2007-03-28 Rob Savoye <address@hidden>
* autogen.sh: Make config-h.in atfer running libtoolize so
Index: testsuite/misc-ming.all/ming_utils.c
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/ming_utils.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- testsuite/misc-ming.all/ming_utils.c 1 Feb 2007 14:52:13 -0000
1.21
+++ testsuite/misc-ming.all/ming_utils.c 29 Mar 2007 02:45:22 -0000
1.22
@@ -289,6 +289,16 @@
SWFMovieClip_add(mo, (SWFBlock)ac);
}
+#if 0
+void
+add_clip_init_actions(SWFMovieClip mo, const char* code)
+{
+ SWFAction ac;
+ ac = compileSWFActionCode(code);
+ SWFMovieClip_addInitAction(mo, (SWFBlock)ac);
+}
+#endif
+
SWFAction
compile_actions(const char* fmt, ...)
{
Index: testsuite/misc-ming.all/ming_utils.h
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/ming_utils.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- testsuite/misc-ming.all/ming_utils.h 19 Mar 2007 14:10:22 -0000
1.14
+++ testsuite/misc-ming.all/ming_utils.h 29 Mar 2007 02:45:22 -0000
1.15
@@ -227,6 +227,17 @@
/** \brief
+ * Add an Init ActionScript code in the given movieclip
+ *
+ * @param mc
+ * The SWFMovieClip to add the DO_INITACTION block to.
+ *
+ * @param code
+ * Init ActionScript code to be compiled in.
+ */
+//void add_clip_init_actions(SWFMovieClip mo, 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);
Index: testsuite/misc-ming.all/init_action_test.c
===================================================================
RCS file: testsuite/misc-ming.all/init_action_test.c
diff -N testsuite/misc-ming.all/init_action_test.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ testsuite/misc-ming.all/init_action_test.c 29 Mar 2007 02:45:22 -0000
1.1
@@ -0,0 +1,143 @@
+/*
+ * Copyright (C) 2007 Free Software Foundation, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+/*
+ * Zou Lunkai, address@hidden
+ *
+ * Test for DoInitAction tag.
+ *
+ * Tests show that the actions order is like this:
+ * mc1.init_actions
+ * mc2.init_actions
+ * mc1.onClipConstruct
+ * mc2.onClipConstruct
+ * _root.actions
+ * mc1.onClipLoad
+ * mc1.actions
+ * mc2.onClipLoad
+ * mc2.actions
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <ming.h>
+
+#include "ming_utils.h"
+
+#define OUTPUT_VERSION 6
+#define OUTPUT_FILENAME "init_action_test.swf"
+
+
+int
+main(int argc, char** argv)
+{
+ SWFMovie mo;
+ SWFMovieClip mc1, mc2, dejagnuclip;
+ SWFShape sh1, sh2;
+
+ const char *srcdir=".";
+ if ( argc>1 )
+ srcdir=argv[1];
+ else
+ {
+ fprintf(stderr, "Usage: %s <mediadir>\n", argv[0]);
+ return 1;
+ }
+
+ Ming_init();
+ mo = newSWFMovieWithVersion(OUTPUT_VERSION);
+ SWFMovie_setDimension(mo, 800, 600);
+ SWFMovie_setRate (mo, 12.0);
+
+ dejagnuclip = get_dejagnu_clip((SWFBlock)get_default_font(srcdir), 10, 0, 0,
800, 600);
+ SWFMovie_add(mo, (SWFBlock)dejagnuclip);
+
+ add_actions(mo, " _root.x = ''; ");
+ SWFMovie_nextFrame(mo); /* 1st frame */
+
+
+ mc1 = newSWFMovieClip();
+ sh1 = make_fill_square (300, 300, 60, 60, 255, 0, 0, 255, 0, 0);
+ SWFMovieClip_add(mc1, (SWFBlock)sh1);
+ /* add init actions */
+ add_clip_init_actions(mc1, " _root.note('mc1.init_actions'); _root.x +=
'1+'; ");
+ /* add actions */
+ add_clip_actions(mc1, " _root.note('mc1.actions'); _root.x += '7+'; ");
+ SWFMovieClip_nextFrame(mc1);//1st frame
+
+ mc2 = newSWFMovieClip();
+ sh2 = make_fill_square (600, 600, 60, 60, 255, 0, 0, 255, 0, 0);
+ SWFMovieClip_add(mc2, (SWFBlock)sh2);
+ /* add init actions */
+ add_clip_init_actions(mc2, " _root.note('mc2.init_actions'); _root.x +=
'2+'; ");
+ /* add actions */
+ add_clip_actions(mc2, " _root.note('mc2.actions'); _root.x += '9+'; ");
+ SWFMovieClip_nextFrame(mc2);//1st frame
+
+
+ /* add mc1 to _root */
+ SWFDisplayItem it1;
+ it1 = SWFMovie_add(mo, (SWFBlock)mc1);
+ SWFDisplayItem_setDepth(it1, 10);
+ SWFDisplayItem_setName(it1, "mc1");
+
+ SWFDisplayItem_addAction(it1,
+ newSWFAction(" _root.note('mc1.onClipConstruct'); _root.x += '3+'; "),
+ SWFACTION_CONSTRUCT);
+
+ SWFDisplayItem_addAction(it1,
+ newSWFAction(" _root.note('mc1.onClipLoad'); _root.x += '6+'; "),
+ SWFACTION_ONLOAD);
+
+
+ /* add mc2 to _root */
+ SWFDisplayItem it2;
+ it2 = SWFMovie_add(mo, (SWFBlock)mc2);
+ SWFDisplayItem_setDepth(it2, 11);
+ SWFDisplayItem_setName(it2, "mc2");
+
+ SWFDisplayItem_addAction(it2,
+ newSWFAction(" _root.note('mc2.onClipConstruct'); _root.x += '4+'; "),
+ SWFACTION_CONSTRUCT);
+
+ SWFDisplayItem_addAction(it2,
+ newSWFAction(" _root.note('mc2.onClipLoad'); _root.x += '8+'; "),
+ SWFACTION_ONLOAD);
+
+
+ /* add main timeline actions */
+ add_actions(mo, "_root.note('_root.actions'); _root.x += '5+'; ");
+ SWFMovie_nextFrame(mo); /* 2nd frame */
+
+ check_equals(mo, "_root.x", "'1+2+3+4+5+6+7+8+9+'");
+ add_actions(mo, " _root.totals(); stop(); ");
+ SWFMovie_nextFrame(mo); /* 3rd frame */
+
+
+ //Output movie
+ puts("Saving " OUTPUT_FILENAME );
+ SWFMovie_save(mo, OUTPUT_FILENAME);
+
+ return 0;
+}
+
+
+
+
+
+
- [Gnash-commit] gnash ChangeLog testsuite/misc-ming.all/ming_ut...,
Zou Lunkai <=