gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] [SCM] Gnash branch, master, updated. 57f9bf4ab7f080870b9a


From: Benjamin Wolsey
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. 57f9bf4ab7f080870b9ad558423a89d699e26431
Date: Sat, 25 Sep 2010 17:06:38 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".

The branch, master has been updated
       via  57f9bf4ab7f080870b9ad558423a89d699e26431 (commit)
       via  0b146b73e6b9b18e4ab39f88faadfa52c7a31806 (commit)
       via  b7705eccfb4e2a26802fa4292b1872bf9ca002bc (commit)
       via  2ed442ecaf29412d789605651747969d135437e6 (commit)
       via  482939ae7a201601a665396c1e21996fc5c03a18 (commit)
       via  b2ba0aa691aca202ac04708a9c5c418ca7ca6f5d (commit)
       via  7b08ee8decdbc8cdba75c93311f9066a5e18b811 (commit)
      from  24e90eb9c913945315389c2999d728d02064849d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=57f9bf4ab7f080870b9ad558423a89d699e26431


commit 57f9bf4ab7f080870b9ad558423a89d699e26431
Author: Benjamin Wolsey <address@hidden>
Date:   Sat Sep 25 18:32:30 2010 +0200

    Documentation.

diff --git a/libcore/as_object.h b/libcore/as_object.h
index 154b255..54b416e 100644
--- a/libcore/as_object.h
+++ b/libcore/as_object.h
@@ -803,6 +803,13 @@ private:
 /// This is used for broadcasting system events. The prototype search is
 /// carried out, but there is no call to __resolve and triggers
 /// are not processed.
+//
+/// The function is called with no arguments.
+//
+/// @param o    The object to send the event to.
+/// @param env  The environment to use, generally provided by the calling
+///             DisplayObject
+/// @param name The name of the function to call.
 void sendEvent(as_object& o, const as_environment& env, const ObjectURI& name);
 
 /// Function objects for visiting properties.

http://git.savannah.gnu.org/cgit//commit/?id=0b146b73e6b9b18e4ab39f88faadfa52c7a31806


commit 0b146b73e6b9b18e4ab39f88faadfa52c7a31806
Author: Benjamin Wolsey <address@hidden>
Date:   Sat Sep 25 18:15:51 2010 +0200

    Don't lookup events in __resolve.

diff --git a/libcore/Button.cpp b/libcore/Button.cpp
index 6c3183f..f9aae43 100644
--- a/libcore/Button.cpp
+++ b/libcore/Button.cpp
@@ -562,12 +562,12 @@ Button::mouseEvent(const event_id& event)
     _def->forEachTrigger(event, xec);
 
     // check for built-in event handler.
-    std::auto_ptr<ExecutableCode> code ( get_event_handler(event) );
+    std::auto_ptr<ExecutableCode> code (get_event_handler(event));
     if (code.get()) {
         mr.pushAction(code, movie_root::PRIORITY_DOACTION);
     }
 
-    callMethod(getObject(this), event.functionURI());
+    sendEvent(*getObject(this), get_environment(), event.functionURI());
 }
 
 
diff --git a/libcore/MovieClip.cpp b/libcore/MovieClip.cpp
index aa927a6..96e7bf9 100644
--- a/libcore/MovieClip.cpp
+++ b/libcore/MovieClip.cpp
@@ -664,11 +664,11 @@ MovieClip::notifyEvent(const event_id& id)
             // must be a loaded movie (loadMovie doesn't mark it as 
             // "dynamic" - should it? no, or getBytesLoaded will always
             // return 0)  
-            if ( ! def ) break;
+            if (!def) break;
 
             // if it has a registered class it can have an onLoad 
             // in prototype...
-            if ( def->getRegisteredClass() ) break;
+            if (def->getRegisteredClass()) break;
 
 #ifdef GNASH_DEBUG
             log_debug(_("Sprite %s (depth %d) won't check for user-defined "
@@ -681,16 +681,11 @@ MovieClip::notifyEvent(const event_id& id)
             
     }
 
-    // Check for member function.
+    // Call the appropriate member function.
     if (!isKeyEvent(id)) {
-        callMethod(getObject(this), id.functionURI());
+        sendEvent(*getObject(this), get_environment(), id.functionURI());
     }
 
-    // TODO: if this was UNLOAD release as much memory as possible ?
-    // Verify if this is possible, in particular check order in
-    // which unload handlers of parent and childs is performed
-    // and whether unload of child can access members of parent.
-
 }
 
 as_object*
diff --git a/libcore/as_object.cpp b/libcore/as_object.cpp
index 570c519..5d583d0 100644
--- a/libcore/as_object.cpp
+++ b/libcore/as_object.cpp
@@ -478,7 +478,6 @@ as_object::get_super()
     return super;
 }
 
-/*private*/
 Property*
 as_object::findProperty(const ObjectURI& uri, as_object **owner)
 {
@@ -1123,15 +1122,14 @@ Trigger::call(const as_value& oldval, const as_value& 
newval,
     _executing = true;
     
     try {
-        as_environment env(getVM(this_obj));
+
+        const as_environment env(getVM(this_obj));
         
         fn_call::Args args;
         args += _propname, oldval, newval, _customArg;
         
         fn_call fn(&this_obj, env, args);
-        
         as_value ret = _func->call(fn);
-        
         _executing = false;
         
         return ret;
@@ -1143,6 +1141,16 @@ Trigger::call(const as_value& oldval, const as_value& 
newval,
     }
 }
 
+void
+sendEvent(as_object& o, const as_environment& env, const ObjectURI& name)
+{
+    Property* prop = o.findProperty(name);
+    if (prop) {
+        fn_call::Args args;
+        invoke(prop->getValue(o), env, &o, args);
+    }
+}
+
 as_object*
 getObjectWithPrototype(Global_as& gl, string_table::key c)
 {
diff --git a/libcore/as_object.h b/libcore/as_object.h
index 92e3875..154b255 100644
--- a/libcore/as_object.h
+++ b/libcore/as_object.h
@@ -798,6 +798,13 @@ private:
     boost::scoped_ptr<TriggerContainer> _trigs;
 };
 
+/// Send a system event
+//
+/// This is used for broadcasting system events. The prototype search is
+/// carried out, but there is no call to __resolve and triggers
+/// are not processed.
+void sendEvent(as_object& o, const as_environment& env, const ObjectURI& name);
+
 /// Function objects for visiting properties.
 class IsVisible
 {

http://git.savannah.gnu.org/cgit//commit/?id=b7705eccfb4e2a26802fa4292b1872bf9ca002bc


commit b7705eccfb4e2a26802fa4292b1872bf9ca002bc
Author: Benjamin Wolsey <address@hidden>
Date:   Sat Sep 25 18:15:44 2010 +0200

    Header order.

diff --git a/libcore/asobj/Global_as.h b/libcore/asobj/Global_as.h
index 6972bf3..b7464ae 100644
--- a/libcore/asobj/Global_as.h
+++ b/libcore/asobj/Global_as.h
@@ -20,10 +20,6 @@
 #ifndef GNASH_GLOBAL_H
 #define GNASH_GLOBAL_H
 
-#include "as_object.h" // for inheritance
-#include "fn_call.h"
-#include "log.h"
-
 #include <string>
 #include <boost/preprocessor/arithmetic/inc.hpp>
 #include <boost/preprocessor/repetition/enum_params.hpp>
@@ -31,6 +27,10 @@
 #include <boost/preprocessor/repetition/repeat_from_to.hpp>
 #include <boost/preprocessor/seq/for_each.hpp>
 
+#include "as_object.h" 
+#include "fn_call.h"
+#include "log.h"
+
 // Forward declarations
 namespace gnash {
        class builtin_function;

http://git.savannah.gnu.org/cgit//commit/?id=2ed442ecaf29412d789605651747969d135437e6


commit 2ed442ecaf29412d789605651747969d135437e6
Author: Benjamin Wolsey <address@hidden>
Date:   Sat Sep 25 18:07:42 2010 +0200

    Style.

diff --git a/libcore/movie_root.cpp b/libcore/movie_root.cpp
index ee73c62..17c1dc7 100644
--- a/libcore/movie_root.cpp
+++ b/libcore/movie_root.cpp
@@ -784,10 +784,9 @@ void
 movie_root::doMouseDrag()
 {
     DisplayObject* dragChar = getDraggingCharacter(); 
-    if ( ! dragChar ) return; // nothing to do
+    if (!dragChar) return; // nothing to do
 
-    if ( dragChar->unloaded() )
-    {
+    if (dragChar->unloaded()) {
         // Reset drag state if dragging char was unloaded
         m_drag_state.reset();
         return; 
@@ -801,17 +800,16 @@ movie_root::doMouseDrag()
         parent_world_mat = getWorldMatrix(*p);
     }
 
-    if (! m_drag_state.isLockCentered())
-    {
+    if (!m_drag_state.isLockCentered()) {
         world_mouse.x -= m_drag_state.xOffset();
         world_mouse.y -= m_drag_state.yOffset();
     }
 
-    if ( m_drag_state.hasBounds() )
-    {
+    if (m_drag_state.hasBounds()) {
         SWFRect bounds;
         // bounds are in local coordinate space
-        bounds.enclose_transformed_rect(parent_world_mat, 
m_drag_state.getBounds());
+        bounds.enclose_transformed_rect(parent_world_mat,
+                m_drag_state.getBounds());
         // Clamp mouse coords within a defined SWFRect.
         bounds.clamp(world_mouse);
     }
@@ -827,7 +825,6 @@ movie_root::doMouseDrag()
     dragChar->setMatrix(local);
 }
 
-
 unsigned int
 movie_root::add_interval_timer(std::auto_ptr<Timer> timer)
 {

http://git.savannah.gnu.org/cgit//commit/?id=482939ae7a201601a665396c1e21996fc5c03a18


commit 482939ae7a201601a665396c1e21996fc5c03a18
Author: Benjamin Wolsey <address@hidden>
Date:   Sat Sep 25 18:06:27 2010 +0200

    Don't call resolve when looking for handlers.

diff --git a/libcore/DisplayObject.cpp b/libcore/DisplayObject.cpp
index 8d4c6d2..6a396de 100644
--- a/libcore/DisplayObject.cpp
+++ b/libcore/DisplayObject.cpp
@@ -506,9 +506,9 @@ DisplayObject::hasEventHandler(const event_id& id) const
 
     if (!_object) return false;
 
-    as_value tmp;
-       if (_object->get_member(id.functionURI(), &tmp)) {
-               return tmp.to_function();
+    // Don't check resolve!
+       if (Property* prop = _object->findProperty(id.functionURI())) {
+               return prop->getValue(*_object).to_function();
        }
        return false;
 

http://git.savannah.gnu.org/cgit//commit/?id=b2ba0aa691aca202ac04708a9c5c418ca7ca6f5d


commit b2ba0aa691aca202ac04708a9c5c418ca7ca6f5d
Author: Benjamin Wolsey <address@hidden>
Date:   Sat Sep 25 18:05:57 2010 +0200

    Drop unneeded members.

diff --git a/libcore/asobj/AsBroadcaster.cpp b/libcore/asobj/AsBroadcaster.cpp
index 0339289..6dc36f2 100644
--- a/libcore/asobj/AsBroadcaster.cpp
+++ b/libcore/asobj/AsBroadcaster.cpp
@@ -81,22 +81,6 @@ struct BroadcasterStats {
 
 class BroadcasterVisitor
 {
-    
-    /// Name of the event being broadcasted
-    /// appropriately cased based on SWF version
-    /// of the current VM
-    std::string _eventName;
-    const ObjectURI& _eventURI;
-
-    // These two will be needed for consistency checking
-    //size_t _origEnvStackSize;
-    //size_t _origEnvCallStackSize;
-
-    /// Number of event dispatches
-    unsigned int _dispatched;
-
-    fn_call _fn;
-
 public:
 
     /// @param eName name of event, will be converted to lowercase if needed
@@ -105,8 +89,7 @@ public:
     ///
     BroadcasterVisitor(const fn_call& fn)
         :
-        _eventName(fn.arg(0).to_string()),
-        _eventURI(getStringTable(fn).find(_eventName)),
+        _eventURI(getStringTable(fn).find(fn.arg(0).to_string())),
         _dispatched(0),
         _fn(fn)
     {
@@ -118,14 +101,13 @@ public:
     {
 
         boost::intrusive_ptr<as_object> o = v.to_object(getGlobal(_fn));
-        if ( ! o ) return;
+        if (!o) return;
 
 #ifdef GNASH_DEBUG_BROADCASTER
         static stats::KeyLookup stats("BroadcasterVisitor call operator",
             getStringTable(_fn), 1);
         stats.check(_eventURI.name);
 #endif
-
         as_value method;
         o->get_member(_eventURI, &method);
 
@@ -138,11 +120,21 @@ public:
         ++_dispatched;
     }
 
-    /// Return number of events dispached since last reset()
-    unsigned int eventsDispatched() const { return _dispatched; }
+    /// Return number of events dispatched.
+    size_t eventsDispatched() const { return _dispatched; }
+
+private:
+    
+    /// Name of the event being broadcasted
+    /// appropriately cased based on SWF version
+    /// of the current VM
+    const ObjectURI& _eventURI;
+
+    /// Number of event dispatches
+    size_t _dispatched;
+
+    fn_call _fn;
 
-    /// Reset count od dispatched events
-    void reset() { _dispatched=0; }
 };
 
 }

http://git.savannah.gnu.org/cgit//commit/?id=7b08ee8decdbc8cdba75c93311f9066a5e18b811


commit 7b08ee8decdbc8cdba75c93311f9066a5e18b811
Author: Benjamin Wolsey <address@hidden>
Date:   Sat Sep 25 18:02:37 2010 +0200

    Add tests for events and resolve.

diff --git a/testsuite/misc-ming.all/Makefile.am 
b/testsuite/misc-ming.all/Makefile.am
index 3dd4045..f6a972d 100644
--- a/testsuite/misc-ming.all/Makefile.am
+++ b/testsuite/misc-ming.all/Makefile.am
@@ -84,6 +84,8 @@ AM_LDFLAGS += $(top_builddir)/libbase/libltdlc.la
 endif
 
 check_PROGRAMS = \
+       ResolveEventsTest \
+       ResolveEventsTest-Runner \
        SpriteButtonEventsTest \
        SpriteButtonEventsTest-Runner \
        DefineTextTest \
@@ -1823,6 +1825,27 @@ SpriteButtonEventsTest_Runner_CXXFLAGS = \
        -DTGTDIR='"$(abs_builddir)"' \
        $(NULL)
 
+ResolveEventsTest_SOURCES =    \
+       ResolveEventsTest.c     \
+       $(NULL)
+ResolveEventsTest_LDADD = libgnashmingutils.la
+ResolveEventsTest.swf: ResolveEventsTest
+       ./ResolveEventsTest $(abs_mediadir)
+ResolveEventsTest_Runner_SOURCES = \
+       ResolveEventsTest-Runner.cpp \
+       $(NULL)
+ResolveEventsTest_Runner_LDADD = \
+       $(top_builddir)/testsuite/libtestsuite.la \
+       $(AM_LDFLAGS) \
+       $(NULL)
+ResolveEventsTest_Runner_DEPENDENCIES = \
+       $(top_builddir)/testsuite/libtestsuite.la \
+       ResolveEventsTest.swf   \
+       $(NULL)
+ResolveEventsTest_Runner_CXXFLAGS = \
+       -DTGTDIR='"$(abs_builddir)"' \
+       $(NULL)
+
 loadImageTest_SOURCES =        \
        loadImageTest.c \
        $(NULL)
@@ -2268,6 +2291,7 @@ TEST_CASES = \
        DefineEditTextTest-Runner \
        RollOverOutTest-Runner \
        SpriteButtonEventsTest-Runner \
+       ResolveEventsTest-Runner \
        timeline_var_test-Runner \
        root_stop_testrunner \
        loop_test-Runner \
diff --git a/testsuite/misc-ming.all/ResolveEventsTest-Runner.cpp 
b/testsuite/misc-ming.all/ResolveEventsTest-Runner.cpp
new file mode 100644
index 0000000..49d7784
--- /dev/null
+++ b/testsuite/misc-ming.all/ResolveEventsTest-Runner.cpp
@@ -0,0 +1,82 @@
+/* 
+ *   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 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 3 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 "ResolveEventsTest.swf"
+
+#include "MovieTester.h"
+#include "MovieClip.h"
+#include "DisplayObject.h"
+#include "DisplayList.h"
+#include "TextField.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;
+       string filename = string(TGTDIR) + string("/") + string(INPUT_FILENAME);
+       MovieTester tester(filename);
+
+       MovieClip* root = tester.getRootMovie();
+       assert(root);
+
+       check_equals(root->get_frame_count(), 7);
+       check_equals(root->get_current_frame(), 0);
+
+    tester.advance();
+       
+    check_equals(root->get_current_frame(), 1);
+    
+    tester.advance();
+    check_equals(root->get_current_frame(), 2);
+
+    tester.movePointerTo(150, 150);
+    tester.click();
+
+    tester.advance();
+    check_equals(root->get_current_frame(), 3);
+    
+    tester.movePointerTo(250, 250);
+    tester.click();
+    tester.advance();
+    check_equals(root->get_current_frame(), 4);
+    
+    tester.movePointerTo(251, 251);
+    tester.movePointerTo(252, 251);
+    tester.movePointerTo(251, 252);
+    tester.click();
+    tester.advance();
+    check_equals(root->get_current_frame(), 5);
+    
+    tester.advance();
+
+       // last advance should not restart the loop (it's in STOP mode)
+    check_equals(root->getPlayState(), MovieClip::PLAYSTATE_STOP);
+       check_equals(root->get_current_frame(), 6);
+
+}
+
diff --git a/testsuite/misc-ming.all/ResolveEventsTest.c 
b/testsuite/misc-ming.all/ResolveEventsTest.c
new file mode 100644
index 0000000..d6ff4df
--- /dev/null
+++ b/testsuite/misc-ming.all/ResolveEventsTest.c
@@ -0,0 +1,200 @@
+/***********************************************************************
+ *
+ *   Copyright (C) 2005, 2006, 2009, 2010 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 3 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 case for mouse events.
+ *
+ * In a movie of 120x120 pixels, it places a movieclip containing a squared
+ * sprite-button in the middle of the stage, and a text area on top.
+ *
+ * The movie has 3 frames, with the second adding a shape at a lower depth
+ * and the third one at an higher depth respect to the button.
+ *
+ * The following events print the event name in the text area
+ * (called _root.textfield) and change the color of the button:
+ *
+ * RollOut  : red button (initial state)
+ * RollOver : yellow button
+ * Press    : green button
+ * Release  : yellow button (same as MouseOver, but the label on top changes)
+ *
+ ***********************************************************************/
+
+#include "ming_utils.h"
+
+#include <ming.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#define OUTPUT_VERSION 6
+#define OUTPUT_FILENAME "ResolveEventsTest.swf"
+
+int
+main(int argc, char **argv)
+{
+    SWFMovie mo;
+    SWFDisplayItem it;
+    const char *srcdir=".";
+    char fdbfont[256];
+    SWFMovieClip dejagnuclip;
+    SWFFont font;
+
+    puts("Setting things up");
+
+    Ming_init();
+    Ming_useSWFVersion (OUTPUT_VERSION);
+    Ming_setScale(20.0); 
+ 
+    mo = newSWFMovie();
+    SWFMovie_setDimension(mo, 800, 600);
+    SWFMovie_setRate(mo, 1);
+
+    if (argc > 1) srcdir=argv[1];
+    else {
+        fprintf(stderr, "Usage: %s <mediadir>\n", argv[0]);
+        return 1;
+    }
+
+    sprintf(fdbfont, "%s/Bitstream-Vera-Sans.fdb", srcdir);
+    FILE* font_file = fopen(fdbfont, "r");
+    if (!font_file) {
+        perror(fdbfont);
+        exit(1);
+    }
+
+    font = loadSWFFontFromFile(font_file);
+
+    /* Dejagnu equipment */
+    dejagnuclip = get_dejagnu_clip((SWFBlock)font, 10, 0, 0, 800, 600);
+    it = SWFMovie_add(mo, (SWFBlock)dejagnuclip);
+     
+    SWFDisplayItem_setDepth(it, 200); 
+    SWFDisplayItem_move(it, 200, 0); 
+
+    SWFMovie_nextFrame(mo);
+
+    add_actions(mo,
+            "mc1 = _root.createEmptyMovieClip('mc1', 34);"
+            "mc2 = mc1.createEmptyMovieClip('mc2', 35);"
+            "with(mc2) {"
+            "   moveTo(100, 100);"
+            "   beginFill(0x20fff0);"
+            "   lineTo(100, 200);"
+            "   lineTo(200, 200);"
+            "   lineTo(200, 100);"
+            "};"
+            "_root.onMouseUp = function() { play(); };"
+            );
+    
+    // One has all the functions, one has __resolve.
+    add_actions(mo,
+            "resolveevents = [];"
+            "events = [];"
+            "mc1.__resolve = function(a) { resolveevents.push(a); };"
+            "mc2.onEnterFrame = function() { events.push('onEnterFrame'); };"
+            "mc2.onMouseDown = function() { events.push('onMouseDown'); };"
+            "mc2.onMouseUp = function() { events.push('onMouseUp'); };"
+            // Gnash sends a bogus event here, but we're not testing that!
+            //"mc2.onLoad = function() { events.push('onLoad'); };"
+            "mc2.onPress = function() { events.push('onPress'); };"
+            "mc2.onRelease = function() { events.push('onRelease'); };"
+            "mc2.onRollOver = function() { events.push('onRollOver'); };"
+            "mc2.onRollOut = function() { events.push('onRollOut'); };"
+            "mc2.onInitialize = function() { events.push('onInitialize'); };"
+            "mc2.onConstruct = function() { events.push('onConstruct'); };"
+            "mc2.onReleaseOutside = function() { 
events.push('onReleaseOutside'); };"
+            "mc2.onDragOver = function() { events.push('onDragOver'); };"
+            "mc2.func = function() { events.push('func'); };"
+    );
+
+    add_actions(mo,
+            "mc2.func();"
+            "mc1.func();"
+            "mc2.onEnterFrame();"
+            "mc1.onEnterFrame();"
+            "mc2.onRollOver();"
+            "mc1.onRollOver();"
+            );
+    
+    add_actions(mo, "_root.note('Do not touch anything!');");
+
+    // The ones called manually should appear in both.
+    check_equals(mo, "events.toString()", "'func,onEnterFrame,onRollOver'");
+    check_equals(mo, "resolveevents.toString()",
+            "'func,onEnterFrame,onRollOver'");
+
+    SWFMovie_nextFrame(mo);
+    
+    check_equals(mo, "events.toString()",
+            "'func,onEnterFrame,onRollOver,onEnterFrame'");
+    check_equals(mo, "resolveevents.toString()",
+            "'func,onEnterFrame,onRollOver'");
+    
+    // Otherwise the number is unpredictable.
+    add_actions(mo, "mc2.onEnterFrame = function() {};");
+
+    add_actions(mo, "stop();");
+    add_actions(mo, "_root.note('Move over square, click and release!');");
+
+    SWFMovie_nextFrame(mo);
+
+    // Expect rollover, onMouseDown, onMouseUp, onRelease
+    check_equals(mo, "events.toString()",
+            "'func,onEnterFrame,onRollOver,onEnterFrame,"
+            "onRollOver,onMouseDown,onPress,onMouseUp,onRelease'");
+    check_equals(mo, "resolveevents.toString()",
+            "'func,onEnterFrame,onRollOver'");
+
+    add_actions(mo, "_root.note('Move out of square, click and release!');");
+    add_actions(mo, "stop();");
+    
+    SWFMovie_nextFrame(mo);
+    check_equals(mo, "events.toString()",
+            "'func,onEnterFrame,onRollOver,onEnterFrame,onRollOver,"
+            "onMouseDown,onPress,onMouseUp,onRelease,onRollOut,onMouseDown,"
+            "onMouseUp'");
+    check_equals(mo, "resolveevents.toString()",
+            "'func,onEnterFrame,onRollOver'");
+    
+    add_actions(mo,
+            "mevents = [];"
+            "ressiz = resolveevents.length;"
+            "mc2.onMouseMove = function() { mevents.push('onMouseMove'); };");
+    // Last test!
+    add_actions(mo, "_root.note('Move the mouse about, then click');");
+
+    add_actions(mo, "stop();");
+    
+    SWFMovie_nextFrame(mo);
+    // Check that mouse events aren't carried to resolve.
+    check_equals(mo, "mevents[0]", "'onMouseMove'");
+    check_equals(mo, "resolveevents.length", "ressiz");
+
+    add_actions(mo, "_root.note('End of test!');");
+
+    // Finish and save
+    SWFMovie_nextFrame(mo);
+    add_actions(mo, "stop();");
+
+    puts("Saving " OUTPUT_FILENAME );
+    SWFMovie_save(mo, OUTPUT_FILENAME);
+     
+    return 0;
+}

-----------------------------------------------------------------------

Summary of changes:
 libcore/Button.cpp                                 |    4 +-
 libcore/DisplayObject.cpp                          |    6 +-
 libcore/MovieClip.cpp                              |   13 +-
 libcore/as_object.cpp                              |   16 ++-
 libcore/as_object.h                                |   14 ++
 libcore/asobj/AsBroadcaster.cpp                    |   40 ++---
 libcore/asobj/Global_as.h                          |    8 +-
 libcore/movie_root.cpp                             |   15 +-
 testsuite/misc-ming.all/Makefile.am                |   24 +++
 ...TestRunner.cpp => ResolveEventsTest-Runner.cpp} |   48 +++--
 testsuite/misc-ming.all/ResolveEventsTest.c        |  200 ++++++++++++++++++++
 11 files changed, 317 insertions(+), 71 deletions(-)
 copy testsuite/misc-ming.all/{ButtonPropertiesTestRunner.cpp => 
ResolveEventsTest-Runner.cpp} (58%)
 create mode 100644 testsuite/misc-ming.all/ResolveEventsTest.c


hooks/post-receive
-- 
Gnash



reply via email to

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