gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/sprite_instance.cpp test...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/sprite_instance.cpp test...
Date: Fri, 06 Apr 2007 09:23:20 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/04/06 09:23:20

Modified files:
        .              : ChangeLog 
        server         : sprite_instance.cpp 
        testsuite/actionscript.all: MovieClip.as 

Log message:
                * server/sprite_instance.cpp (sprite_get_depth): only convert
                  depths to negative values for static clips.
                * testsuite/actionscript.all/MovieClip.as: add a couple of
                  tests for getDepth() invoked against dynamic and static
                  clips.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2795&r2=1.2796
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.223&r2=1.224
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/MovieClip.as?cvsroot=gnash&r1=1.43&r2=1.44

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2795
retrieving revision 1.2796
diff -u -b -r1.2795 -r1.2796
--- ChangeLog   6 Apr 2007 07:58:15 -0000       1.2795
+++ ChangeLog   6 Apr 2007 09:23:20 -0000       1.2796
@@ -1,3 +1,11 @@
+2007-04-06 Sandro Santilli <address@hidden>
+
+       * server/sprite_instance.cpp (sprite_get_depth): only convert
+         depths to negative values for static clips.
+       * testsuite/actionscript.all/MovieClip.as: add a couple of
+         tests for getDepth() invoked against dynamic and static
+         clips.
+
 2007-04-05  John Gilmore  <address@hidden>
 
        Internationalize gnash.  Phase 1: use gettextize, update config files.

Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.223
retrieving revision 1.224
diff -u -b -r1.223 -r1.224
--- server/sprite_instance.cpp  5 Apr 2007 11:16:11 -0000       1.223
+++ server/sprite_instance.cpp  6 Apr 2007 09:23:20 -0000       1.224
@@ -280,8 +280,14 @@
 
        int n = sprite->get_depth();
 
+       if ( ! sprite->isDynamic() )
+       {
        // Macromedia Flash help says: depth starts at -16383 (0x3FFF)
-       return as_value( - (n + 16383 - 1));
+               //n = - (n+16383-1);
+               n += -16384; 
+       }
+
+       return as_value(n);
 }
 
 //swapDepths(target:Object) : Void
@@ -1710,7 +1716,6 @@
 sprite_instance::get_frame_number(const as_value& frame_spec, size_t& frameno) 
const
 {
        //GNASH_REPORT_FUNCTION;
-       size_t frame_number;
 
        as_environment* env = const_cast<as_environment*>(&m_as_environment);
 
@@ -1726,7 +1731,7 @@
        // TODO: are we sure we shouldn't check for frames labeled with 
negative numbers ?
        if ( num < 1 ) return false;
 
-       frameno = iclamp(num, 1, m_def->get_frame_count())-1;
+       frameno = iclamp(int(num), 1, m_def->get_frame_count())-1;
        return true;
 }
 

Index: testsuite/actionscript.all/MovieClip.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/MovieClip.as,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -b -r1.43 -r1.44
--- testsuite/actionscript.all/MovieClip.as     5 Apr 2007 19:33:54 -0000       
1.43
+++ testsuite/actionscript.all/MovieClip.as     6 Apr 2007 09:23:20 -0000       
1.44
@@ -22,7 +22,7 @@
 // compile this test case with Ming makeswf, and then
 // execute it like this gnash -1 -r 0 -v out.swf
 
-rcsid="$Id: MovieClip.as,v 1.43 2007/04/05 19:33:54 strk Exp $";
+rcsid="$Id: MovieClip.as,v 1.44 2007/04/06 09:23:20 strk Exp $";
 
 #include "check.as"
 
@@ -86,36 +86,36 @@
 #endif
 
 #if OUTPUT_VERSION >= 6
-       check(mc.beginFill);
-       check(mc.beginGradientFill);
-        check(mc.clear);
-       check(mc.createEmptyMovieClip);
-       check(mc.createTextField);
-       check(mc.curveTo);
-       check(mc.lineStyle);
-       check(mc.lineTo);
-       check(mc.moveTo);
-       check(mc.attachAudio);
-       check(mc.endFill);
-       check(mc.getDepth);
-       check(mc.getURL);
-       check(mc.gotoAndPlay);
-       check(mc.gotoAndStop);
-       check(mc.hitTest);
-       check(mc.nextFrame != undefined);
-       check(mc.play != undefined);
-       check(mc.prevFrame != undefined);
-       check(mc.stop != undefined);
-       check(mc.swapDepths != undefined);
+       check_equals(typeof(mc.beginFill), 'function');
+       check_equals(typeof(mc.beginGradientFill), 'function');
+        check_equals(typeof(mc.clear), 'function');
+       check_equals(typeof(mc.createEmptyMovieClip), 'function');
+       check_equals(typeof(mc.createTextField), 'function');
+       check_equals(typeof(mc.curveTo), 'function');
+       check_equals(typeof(mc.lineStyle), 'function');
+       check_equals(typeof(mc.lineTo), 'function');
+       check_equals(typeof(mc.moveTo), 'function');
+       check_equals(typeof(mc.attachAudio), 'function');
+       check_equals(typeof(mc.endFill), 'function');
+       check_equals(typeof(mc.getDepth), 'function');
+       check_equals(typeof(mc.getURL), 'function');
+       check_equals(typeof(mc.gotoAndPlay), 'function');
+       check_equals(typeof(mc.gotoAndStop), 'function');
+       check_equals(typeof(mc.hitTest), 'function');
+       check_equals(typeof(mc.nextFrame), 'function');
+       check_equals(typeof(mc.play), 'function');
+       check_equals(typeof(mc.prevFrame), 'function');
+       check_equals(typeof(mc.stop), 'function');
+       check_equals(typeof(mc.swapDepths), 'function');
 
        // These two seem unavailable
        // when targetting SWF > 6
 #if OUTPUT_VERSION > 6
-       check_equals(mc.loadMovie, undefined);
-       check_equals(mc.removeMovieClip, undefined);
+       check_equals(typeof(mc.loadMovie), 'undefined');
+       check_equals(typeof(mc.removeMovieClip), 'undefined');
 #else
-       check(mc.loadMovie);
-       check(mc.removeMovieClip);
+       check_equals(typeof(mc.loadMovie), 'function');
+       check_equals(typeof(mc.removeMovieClip), 'function');
 #endif
 
 #endif // OUTPUT_VERSION >= 6
@@ -236,6 +236,7 @@
 
 var mc3 = createEmptyMovieClip("mc3_mc", 50);
 check(mc3 != undefined);
+check_equals(mc3.getDepth(), 50);
 
 // By default useHandCursor is false in SWF5 and true in later versions
 #if OUTPUT_VERSION < 6
@@ -427,3 +428,26 @@
 xcheck_equals(typeof(textfieldTest), 'movieclip');
 xcheck(textfieldTest instanceof MovieClip);
 #endif
+
+//----------------------------------------------
+// Test getDepth
+//----------------------------------------------
+
+// A getDepth call against a script-created clip
+// is already tested in the createEmptyMovieClip test
+// section. Here we try to test it against a statically
+// defined movie. We hope that the 'dejagnu' clip
+// is statically defined, if it's not we'll raise a 
+// warning about it.
+
+static_clip_name = "__shared_assets";
+static_clip = eval(static_clip_name);
+if ( typeof(static_clip) == 'movieclip' )
+{
+       check_equals(static_clip.getDepth(), -16383);
+}
+else
+{
+       note("There is not '"+static_clip_name+"' clip statically-defined, so 
we could not test getDepth() against it");
+
+}




reply via email to

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