gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog gui/gui.cpp server/sprite_insta...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog gui/gui.cpp server/sprite_insta...
Date: Tue, 23 Jan 2007 23:20:29 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/01/23 23:20:29

Modified files:
        .              : ChangeLog 
        gui            : gui.cpp 
        server         : sprite_instance.cpp 
        testsuite/misc-ming.all: Makefile.am 
Added files:
        testsuite/misc-ming.all: registerClassTest.c 
                                 registerClassTestRunner.cpp 

Log message:
                * server/sprite_instance.cpp (ctor): fix handlign of 
registerClass
                  (at least for the new testcase).
                * testsuite/misc-ming.all/: Makefile.am, registerClassTest.c,
                  registerClassTestRunner.cpp: new testcase for registerClass.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2164&r2=1.2165
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.cpp?cvsroot=gnash&r1=1.56&r2=1.57
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.131&r2=1.132
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/Makefile.am?cvsroot=gnash&r1=1.53&r2=1.54
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/registerClassTest.c?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/registerClassTestRunner.cpp?cvsroot=gnash&rev=1.1

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2164
retrieving revision 1.2165
diff -u -b -r1.2164 -r1.2165
--- ChangeLog   23 Jan 2007 22:44:32 -0000      1.2164
+++ ChangeLog   23 Jan 2007 23:20:28 -0000      1.2165
@@ -1,3 +1,10 @@
+2007-01-23 Sandro Santilli <address@hidden>
+
+       * server/sprite_instance.cpp (ctor): fix handlign of registerClass
+         (at least for the new testcase).
+       * testsuite/misc-ming.all/: Makefile.am, registerClassTest.c,
+         registerClassTestRunner.cpp: new testcase for registerClass.
+
 2007-01-23 Tomas Groth Christensen <address@hidden>
 
        * server/asobj/NetStream.{h,cpp}, server/asobj/NetStreamFfmpeg.{cpp.h}:

Index: gui/gui.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.cpp,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -b -r1.56 -r1.57
--- gui/gui.cpp 10 Jan 2007 19:21:14 -0000      1.56
+++ gui/gui.cpp 23 Jan 2007 23:20:28 -0000      1.57
@@ -229,6 +229,7 @@
 {
        movie_root* m = get_current_root();
 
+       log_msg("mouse @ %d,%d", x, y);
        if ( m->notify_mouse_moved(x, y) )
        {
                // any action triggered by the

Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.131
retrieving revision 1.132
diff -u -b -r1.131 -r1.132
--- server/sprite_instance.cpp  23 Jan 2007 17:17:14 -0000      1.131
+++ server/sprite_instance.cpp  23 Jan 2007 23:20:28 -0000      1.132
@@ -1712,10 +1712,11 @@
 
        if ( registerClass )
        {
-               // TODO: store in intrusive_ptr ?
+               attachMovieClipInterface(*this);
                // TODO: call the constructor ?
                as_object* proto = registerClass->getPrototype();
                log_msg("registerClass prototype : %p", proto);
+               copyProperties(*proto);
                set_prototype(proto);
        }
        else

Index: testsuite/misc-ming.all/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/Makefile.am,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -b -r1.53 -r1.54
--- testsuite/misc-ming.all/Makefile.am 22 Jan 2007 12:23:47 -0000      1.53
+++ testsuite/misc-ming.all/Makefile.am 23 Jan 2007 23:20:29 -0000      1.54
@@ -68,6 +68,8 @@
        place_and_remove_object_insane_test \
        attachMovieTest \
        attachMovieTestRunner \
+       registerClassTest \
+       registerClassTestRunner \
        goto_frame_test \
        $(NULL)
 
@@ -283,6 +285,30 @@
        sh $< $(top_builddir) goto_frame_test.swf > $@
        chmod 755 $@
 
+registerClassTest_SOURCES =    \
+       registerClassTest.c     \
+       ming_utils.h            \
+       ming_utils.c            \
+       $(NULL)
+registerClassTest_LDADD = $(MING_LIBS)
+
+registerClassTest.swf: registerClassTest
+       ./registerClassTest $(top_srcdir)/testsuite/media
+
+registerClassTestRunner_SOURCES = \
+       registerClassTestRunner.cpp \
+       $(NULL)
+registerClassTestRunner_LDADD = \
+       $(top_builddir)/testsuite/libtestsuite.la \
+       $(NULL)
+registerClassTestRunner_CXXFLAGS = \
+       -DSRCDIR='"$(srcdir)"' \
+       $(NULL)
+registerClassTestRunner_DEPENDENCIES = \
+       registerClassTest.swf \
+       $(top_builddir)/testsuite/libtestsuite.la \
+       $(NULL)
+
 spritehier.swf: spritehier
        ./spritehier
 
@@ -364,6 +390,7 @@
        place_and_remove_object_insane_testrunner \
        attachMovieTestRunner \
        goto_frame_testrunner \
+       registerClassTestRunner \
        $(NULL)
 
 

Index: testsuite/misc-ming.all/registerClassTest.c
===================================================================
RCS file: testsuite/misc-ming.all/registerClassTest.c
diff -N testsuite/misc-ming.all/registerClassTest.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ testsuite/misc-ming.all/registerClassTest.c 23 Jan 2007 23:20:29 -0000      
1.1
@@ -0,0 +1,168 @@
+/* 
+ *   Copyright (C) 2005, 2006 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
+ *
+ *
+ */ 
+
+/*
+ * Test Object.registerClass().
+ *
+ * 1) Exports a 'redsquare' symbol
+ * 2) attach it to main timeline 
+ * 3) register a custom class to it
+ * 4) attach it again (expected to have the custom class interface)
+ *
+ * run as ./registerClass
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <ming.h>
+
+#include "ming_utils.h"
+
+#define OUTPUT_VERSION 6
+#define OUTPUT_FILENAME "registerClassTest.swf"
+
+void addRedSquareExport(SWFMovie mo);
+
+void
+addRedSquareExport(SWFMovie mo)
+{
+       SWFShape sh;
+       SWFMovieClip mc;
+
+       sh = make_fill_square (0, 0, 60, 60, 255, 0, 0, 255, 0, 0);
+       mc = newSWFMovieClip();
+
+       SWFMovieClip_add(mc, (SWFBlock)sh);
+       /* This is here just to turn the clip into an active one */
+       add_clip_actions(mc, "onRollOver = function() {};");
+       SWFMovieClip_nextFrame(mc);
+
+       SWFMovie_addExport(mo, (SWFBlock)mc, "redsquare");
+
+       SWFMovie_writeExports(mo);
+}
+
+int
+main(int argc, char** argv)
+{
+       SWFMovie mo;
+       const char *srcdir=".";
+       SWFMovieClip  dejagnuclip;
+
+
+       /*********************************************
+        *
+        * Initialization
+        *
+        *********************************************/
+
+       if ( argc>1 ) srcdir=argv[1];
+       else
+       {
+               fprintf(stderr, "Usage: %s\n", argv[0]);
+               return 1;
+       }
+
+       puts("Setting things up");
+
+       Ming_init();
+        Ming_useSWFVersion (OUTPUT_VERSION);
+       Ming_setScale(20.0); /* let's talk pixels */
+ 
+       mo = newSWFMovie();
+       SWFMovie_setRate(mo, 12);
+       //SWFMovie_setDimension(mo, 6400, 4000);
+       SWFMovie_setDimension(mo, 640, 400);
+
+       /*********************************************
+        *
+        * Body
+        *
+        *********************************************/
+
+       dejagnuclip = get_dejagnu_clip((SWFBlock)get_default_font(srcdir), 10, 
0, 80, 800, 600);
+       SWFMovie_add(mo, (SWFBlock)dejagnuclip);
+       addRedSquareExport(mo);
+       /* it seems we need a SHOWFRAME for this to be effective */
+       /* (maybe it's related to loop-back handling ?) */
+       SWFMovie_nextFrame(mo);  /* end of frame1 */
+
+       add_actions(mo, "counter = 1;");
+
+       add_actions(mo,
+               "var name1 = 'square'+counter;"
+               "attachMovie('redsquare', name1, 70+counter);"
+               "var clip1 = this[name1];"
+               "counter++;"
+               );
+
+       SWFMovie_nextFrame(mo); /* end of frame2 */
+
+       add_actions(mo,
+               "function CustomClass() { "
+               "}"
+               "CustomClass.prototype.moveRight = function(pix) {"
+               "       this._x += pix;"
+               "};"
+               "CustomClass.prototype.sayHello = function() {"
+               "       note('Hello from CustomClass instance');"
+               "};"
+               "MovieClip.prototype.sayHello = function() {"
+               "       note('Hello from MovieClip instance');"
+               "};"
+               "Object.registerClass('redsquare', CustomClass);"
+               );
+
+       add_actions(mo,
+               "var name2 = 'square'+counter;"
+               "attachMovie('redsquare', name2, 70+counter);"
+               "var clip2 = this[name2];"
+               "clip2.moveRight(80);" // TODO:  test this!
+               "counter++;"
+               );
+
+
+       check_equals(mo, "typeof(clip1)", "'movieclip'");
+       check(mo, "clip1 instanceOf MovieClip");
+       check(mo, "! clip1 instanceOf CustomClass");
+
+       check_equals(mo, "typeof(clip2)", "'movieclip'");
+       /**/ check(mo, "clip2 instanceOf CustomClass");
+       /**/ check(mo, "! clip2 instanceOf MovieClip");
+
+       add_actions(mo,
+               "totals();"
+               "stop();"
+               );
+
+       SWFMovie_nextFrame(mo); /* end of frame3 */
+
+
+       /*****************************************************
+        *
+        * Output movie
+        *
+        *****************************************************/
+
+       puts("Saving " OUTPUT_FILENAME );
+
+       SWFMovie_save(mo, OUTPUT_FILENAME);
+
+       return 0;
+}

Index: testsuite/misc-ming.all/registerClassTestRunner.cpp
===================================================================
RCS file: testsuite/misc-ming.all/registerClassTestRunner.cpp
diff -N testsuite/misc-ming.all/registerClassTestRunner.cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ testsuite/misc-ming.all/registerClassTestRunner.cpp 23 Jan 2007 23:20:29 
-0000      1.1
@@ -0,0 +1,78 @@
+/* 
+ *   Copyright (C) 2005, 2006 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
+ *
+ *
+ */ 
+
+#define INPUT_FILENAME "registerClassTest.swf"
+
+#include "MovieTester.h"
+#include "sprite_instance.h"
+#include "character.h"
+#include "dlist.h"
+#include "container.h"
+#include "log.h"
+
+#include "check.h"
+#include <string>
+#include <cassert>
+
+using namespace gnash;
+using namespace std;
+
+int
+main(int /*argc*/, char** /*argv*/)
+{
+       string filename = INPUT_FILENAME;
+       MovieTester tester(filename);
+
+       gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
+       dbglogfile.setVerbosity(1);
+
+       sprite_instance* root = tester.getRootMovie();
+       assert(root);
+
+       check_equals(root->get_frame_count(), 3);
+       check_equals(root->get_play_state(), sprite_instance::PLAY);
+       check_equals(root->get_current_frame(), 0);
+
+       check(! tester.findDisplayItemByDepth(*root, 71) );
+       check(! tester.findDisplayItemByDepth(*root, 72) );
+
+       tester.movePointerTo(30, 30);
+       check(!tester.isMouseOverMouseEntity());
+
+       tester.advance();
+
+       check( tester.findDisplayItemByDepth(*root, 71) );
+       check(! tester.findDisplayItemByDepth(*root, 72) );
+
+       tester.movePointerTo(30, 30);
+       /**/ check(tester.isMouseOverMouseEntity());
+       tester.movePointerTo(100, 30);
+       check(!tester.isMouseOverMouseEntity());
+
+       tester.advance();
+
+       check(tester.findDisplayItemByDepth(*root, 71) );
+       check(tester.findDisplayItemByDepth(*root, 72) );
+
+       tester.movePointerTo(30, 30);
+       /**/ check(tester.isMouseOverMouseEntity());
+       tester.movePointerTo(100, 30);
+       /**/ check(tester.isMouseOverMouseEntity());
+}
+




reply via email to

[Prev in Thread] Current Thread [Next in Thread]