gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash server/sprite_instance.cpp testsuite/misc...


From: Sandro Santilli
Subject: [Gnash-commit] gnash server/sprite_instance.cpp testsuite/misc...
Date: Tue, 23 Jan 2007 11:23:49 +0000

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

Modified files:
        server         : sprite_instance.cpp 
        testsuite/misc-ming.all: attachMovieTest.c 
                                 attachMovieTestRunner.cpp 

Log message:
                * server/sprite_instance.cpp (sprite_attach_movie):
                  Copy properties from initialization object *after*
                  placement to ensure matrix is properly updated.
                * testsuite/misc-ming.all/: attachMovieTest.c,
                  attachMovieTestRunner.cpp:
                  Made dejagnu-enabled, test for actual position
                  of attached movieclips.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.129&r2=1.130
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/attachMovieTest.c?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/attachMovieTestRunner.cpp?cvsroot=gnash&r1=1.2&r2=1.3

Patches:
Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.129
retrieving revision 1.130
diff -u -b -r1.129 -r1.130
--- server/sprite_instance.cpp  22 Jan 2007 14:37:51 -0000      1.129
+++ server/sprite_instance.cpp  23 Jan 2007 11:23:49 -0000      1.130
@@ -193,13 +193,6 @@
        boost::intrusive_ptr<character> newch = 
exported_movie->create_character_instance(sprite, depth_val);
        assert( dynamic_cast<sprite_instance*>(newch.get()) );
 
-       if (fn.nargs > 3 ) {
-               as_object* initObject = fn.arg(3).to_object();
-               log_msg("Initializing properties from object");
-               newch->copyProperties(*initObject);
-       }
-
-
        if (sprite->attachCharacter(*newch, depth_val, newname) )
        {
                fn.result->set_as_object(newch.get()); 
@@ -209,6 +202,14 @@
                fn.result->set_undefined();
        }
 
+       /// Properties must be copied *after* the call to attachCharacter
+       /// because attachCharacter() will reset matrix !!
+       if (fn.nargs > 3 ) {
+               as_object* initObject = fn.arg(3).to_object();
+               log_msg("Initializing properties from object");
+               newch->copyProperties(*initObject);
+       }
+
        log_warning("MovieClip.attachMovie('%s', %d, '%s')",
                        id_name.c_str(), depth_val, newname.c_str());
 

Index: testsuite/misc-ming.all/attachMovieTest.c
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/attachMovieTest.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- testsuite/misc-ming.all/attachMovieTest.c   22 Jan 2007 14:01:13 -0000      
1.3
+++ testsuite/misc-ming.all/attachMovieTest.c   23 Jan 2007 11:23:49 -0000      
1.4
@@ -41,10 +41,12 @@
        SWFShape sh;
        SWFMovieClip mc;
 
-       sh = make_fill_square (0, 300, 60, 60, 255, 0, 0, 255, 0, 0);
+       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");
@@ -56,9 +58,8 @@
 main(int argc, char** argv)
 {
        SWFMovie mo;
-       SWFMovieClip exportedClip;
        const char *srcdir=".";
-       SWFFont bfont; 
+       SWFMovieClip dejagnuclip;
 
 
        /*********************************************
@@ -91,6 +92,9 @@
         *
         *********************************************/
 
+       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 ?) */
@@ -131,12 +135,16 @@
 
        add_actions(mo, "initObj = new Object();");
 
+       add_actions(mo, "counter=0;");
+
        add_actions(mo,
                "initObj._x = 70*counter;"
                "attachMovie('redsquare', 'square'+counter, 70+counter, 
initObj);"
                "counter++;"
                );
 
+       check_equals(mo, "square0._x", "0");
+
        SWFMovie_nextFrame(mo); /* showFrame */
 
        add_actions(mo,
@@ -145,6 +153,8 @@
                "counter++;"
                );
 
+       check_equals(mo, "square1._x", "70");
+
        SWFMovie_nextFrame(mo); /* showFrame */
 
        add_actions(mo,
@@ -153,6 +163,8 @@
                "counter++;"
                );
 
+       check_equals(mo, "square2._x", "140");
+
        SWFMovie_nextFrame(mo); /* showFrame */
 
        add_actions(mo,
@@ -161,7 +173,9 @@
                "counter++;"
                );
 
-       add_actions(mo, "stop();");
+       check_equals(mo, "square3._x", "210");
+
+       add_actions(mo, "totals(); stop();");
 
        SWFMovie_nextFrame(mo); /* showFrame */
 

Index: testsuite/misc-ming.all/attachMovieTestRunner.cpp
===================================================================
RCS file: 
/sources/gnash/gnash/testsuite/misc-ming.all/attachMovieTestRunner.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- testsuite/misc-ming.all/attachMovieTestRunner.cpp   22 Jan 2007 14:01:13 
-0000      1.2
+++ testsuite/misc-ming.all/attachMovieTestRunner.cpp   23 Jan 2007 11:23:49 
-0000      1.3
@@ -54,48 +54,54 @@
        check(! tester.findDisplayItemByDepth(*root, 72) );
        check(! tester.findDisplayItemByDepth(*root, 73) );
 
+       tester.movePointerTo(30, 30);
+       check(!tester.isMouseOverMouseEntity());
+
        tester.advance();
 
-       character* ch70 = 
const_cast<character*>(tester.findDisplayItemByDepth(*root, 70));
-       check( ch70 );
-       as_value ch70_x;
-       check( ch70->get_member("_x", &ch70_x) );
-       check_equals( ch70_x, 0 );
+       check(tester.findDisplayItemByDepth(*root, 70) );
        check(! tester.findDisplayItemByDepth(*root, 71) );
        check(! tester.findDisplayItemByDepth(*root, 72) );
        check(! tester.findDisplayItemByDepth(*root, 73) );
 
+       tester.movePointerTo(30, 30);
+       check(tester.isMouseOverMouseEntity());
+       tester.movePointerTo(100, 30);
+       check(!tester.isMouseOverMouseEntity());
+
+
        tester.advance();
 
        check( tester.findDisplayItemByDepth(*root, 70) );
-       character* ch71 = 
const_cast<character*>(tester.findDisplayItemByDepth(*root, 71));
-       check( ch71 );
-       as_value ch71_x;
-       check( ch71->get_member("_x", &ch71_x) );
-       check_equals( ch71_x, 70 );
+       check( tester.findDisplayItemByDepth(*root, 71) );
        check(! tester.findDisplayItemByDepth(*root, 72) );
        check(! tester.findDisplayItemByDepth(*root, 73) );
 
+       tester.movePointerTo(100, 30);
+       check(tester.isMouseOverMouseEntity());
+       tester.movePointerTo(170, 30);
+       check(!tester.isMouseOverMouseEntity());
+
        tester.advance();
 
        check( tester.findDisplayItemByDepth(*root, 70) );
        check( tester.findDisplayItemByDepth(*root, 71) );
-       character* ch72 = 
const_cast<character*>(tester.findDisplayItemByDepth(*root, 72));
-       check( ch72 );
-       as_value ch72_x;
-       check( ch72->get_member("_x", &ch72_x) );
-       check_equals( ch72_x, 140 );
+       check( tester.findDisplayItemByDepth(*root, 72) );
        check(! tester.findDisplayItemByDepth(*root, 73) );
 
+       tester.movePointerTo(170, 30);
+       check(tester.isMouseOverMouseEntity());
+       tester.movePointerTo(240, 30);
+       check(!tester.isMouseOverMouseEntity());
+
        tester.advance();
 
        check( tester.findDisplayItemByDepth(*root, 70) );
        check( tester.findDisplayItemByDepth(*root, 71) );
        check( tester.findDisplayItemByDepth(*root, 72) );
-       character* ch73 = 
const_cast<character*>(tester.findDisplayItemByDepth(*root, 73));
-       check( ch73 );
-       as_value ch73_x;
-       check( ch73->get_member("_x", &ch73_x) );
-       check_equals( ch73_x, 210 );
+       check( tester.findDisplayItemByDepth(*root, 73) );
+
+       tester.movePointerTo(240, 30);
+       check(tester.isMouseOverMouseEntity());
 }
 




reply via email to

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