gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r12254: Add tests for action order.


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r12254: Add tests for action order. Minor cleanup to previous test. Remove debugging
Date: Thu, 17 Jun 2010 08:50:11 +0200
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 12254 [merge]
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Thu 2010-06-17 08:50:11 +0200
message:
  Add tests for action order. Minor cleanup to previous test. Remove debugging
  from MovieClip to make the code legible.
added:
  testsuite/misc-ming.all/ActionOrderTest3.c
  testsuite/misc-ming.all/ActionOrderTest4.c
  testsuite/misc-ming.all/ActionOrderTest5.c
modified:
  libcore/MovieClip.cpp
  testsuite/misc-ming.all/Makefile.am
  testsuite/misc-ming.all/RegisterClassTest4.c
=== modified file 'libcore/MovieClip.cpp'
--- a/libcore/MovieClip.cpp     2010-06-13 08:43:46 +0000
+++ b/libcore/MovieClip.cpp     2010-06-16 10:02:02 +0000
@@ -1784,33 +1784,16 @@
     // See misc-ming.all/action_execution_order_test4.{c,swf}
     //
     assert(!_callingFrameActions); // or will not be queuing actions
-    if (!get_parent())
-    {
-#ifdef GNASH_DEBUG
-        log_debug(_("Executing tags of frame0 in movieclip %s"), getTarget());
-#endif
+    if (!get_parent()) {
         executeFrameTags(0, _displayList, SWF::ControlTag::TAG_DLIST |
                 SWF::ControlTag::TAG_ACTION);
-
-        if (getSWFVersion(*getObject(this)) > 5)
-        {
-#ifdef GNASH_DEBUG
-            log_debug(_("Queuing ONLOAD event for movieclip %s"), getTarget());
-#endif
+        if (getSWFVersion(*getObject(this)) > 5) {
             queueEvent(event_id::LOAD, movie_root::PRIORITY_DOACTION);
         }
 
     }
-    else
-    {
-#ifdef GNASH_DEBUG
-        log_debug(_("Queuing ONLOAD event for movieclip %s"), getTarget());
-#endif
+    else {
         queueEvent(event_id::LOAD, movie_root::PRIORITY_DOACTION);
-
-#ifdef GNASH_DEBUG
-        log_debug(_("Executing tags of frame0 in movieclip %s"), getTarget());
-#endif
         executeFrameTags(0, _displayList, SWF::ControlTag::TAG_DLIST |
                 SWF::ControlTag::TAG_ACTION);
     }

=== added file 'testsuite/misc-ming.all/ActionOrderTest3.c'
--- a/testsuite/misc-ming.all/ActionOrderTest3.c        1970-01-01 00:00:00 
+0000
+++ b/testsuite/misc-ming.all/ActionOrderTest3.c        2010-06-17 06:08:49 
+0000
@@ -0,0 +1,181 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <ming.h>
+
+#include "ming_utils.h"
+
+#define OUTPUT_VERSION 8
+#define OUTPUT_FILENAME "ActionOrderTest3.swf"
+
+// A relatively simple looping test checking order of unload events.
+//
+// See InitActionsTest4 and InitActionsTest5 for similar tests. This test
+// has a static onUnload handler.
+
+int main(int argc, char* argv[])
+{
+
+    SWFMovie mo;
+    SWFMovieClip mc1, mc2, mc3, mc4, dejagnuclip;
+    SWFDisplayItem it;
+    SWFAction ac;
+    SWFInitAction initac;
+
+    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);
+
+    add_actions(mo,
+            "if (!_global.hasOwnProperty('arr')) { _global.arr = []; };");
+
+    SWFMovie_nextFrame(mo);
+
+    //  MovieClip 1 
+    mc1 = newSWFMovieClip(); // 1 frames 
+
+    // SWF_EXPORTASSETS 
+    SWFMovie_addExport(mo, (SWFBlock)mc1, "Segments_Name");
+    SWFMovie_writeExports(mo);
+
+    //  MovieClip mc3 has two frames. In each frame a different MovieClip
+    //  is placed with the name Segments.
+    mc3 = newSWFMovieClip(); // 2 frames 
+
+    //  MovieClip 2 
+    mc2 = newSWFMovieClip(); // 1 frames 
+
+    // Add mc2
+    it = SWFMovieClip_add(mc3, (SWFBlock)mc2);
+    SWFDisplayItem_setDepth(it, 1);
+    SWFDisplayItem_setName(it, "Segments");
+    // Set static unload handler
+    SWFDisplayItem_addAction(it,
+        newSWFAction("_global.arr.push('static unload: ' + this.c);"),
+        SWFACTION_UNLOAD);
+
+    // Frame 2
+    SWFMovieClip_nextFrame(mc3);
+
+    // Remove mc2
+    SWFDisplayItem_remove(it);
+
+    // Add mc1
+    it = SWFMovieClip_add(mc3, (SWFBlock)mc1);
+    SWFDisplayItem_setDepth(it, 1);
+    SWFDisplayItem_setName(it, "Segments");
+    // Set static unload handler
+    SWFDisplayItem_addAction(it,
+        newSWFAction("_global.arr.push('static unload: ' + this.c);"),
+        SWFACTION_UNLOAD);
+
+    SWFMovieClip_nextFrame(mc3);
+
+    // End mc3
+
+
+    // This is frame 1 of the main timeline
+
+    // Put our sprite mc3 on stage.
+    it = SWFMovie_add(mo, (SWFBlock)mc3);
+    SWFDisplayItem_setDepth(it, 1);
+    SWFDisplayItem_setName(it, "mc");
+
+    //  mc4 is just for executing init actions.
+    mc4 = newSWFMovieClip(); 
+    SWFMovie_addExport(mo, (SWFBlock)mc4, "__Packages.Bug");
+    SWFMovie_writeExports(mo);
+    
+    dejagnuclip = get_dejagnu_clip((SWFBlock)get_default_font(srcdir), 10,
+                0, 0, 800, 600);
+    SWFMovie_add(mo, (SWFBlock)dejagnuclip);
+
+    ac = newSWFAction(
+        "_global.loops = 0;"
+        "_global.c = 0;"
+        "if( !_global.Bug ) {"
+        "   _global.Bug = function () {"
+        "       this.onUnload = function() { "
+        "           _global.arr.push('dynamic unload: ' + this.c);"
+        "       }; "
+        "       this.onLoad = function() { "
+        "           _global.arr.push('dynamic load: ' + this.c);"
+        "       }; "
+        "       this.c = _global.c;"
+        "       _global.arr.push('ctor: ' + _global.c);"
+        "       _global.c++;"
+        "   };"
+        "};"
+    );
+
+    initac = newSWFInitAction_withId(ac, 4);
+    SWFMovie_add(mo, (SWFBlock)initac);
+    
+    ac = newSWFAction("Object.registerClass('Segments_Name',Bug);");
+    initac = newSWFInitAction_withId(ac, 1);
+    SWFMovie_add(mo, (SWFBlock)initac);
+    add_actions(mo, "_global.arr.push('Frame ' + "
+                            "_level0._currentframe + ' actions: ' "
+                            "+ _level0.mc.Segments.c);");
+
+    // Frame 2 of the main timeline
+    SWFMovie_nextFrame(mo);
+    add_actions(mo, "_global.arr.push('Frame ' + "
+                            "_level0._currentframe + ' actions: ' "
+                            "+ _level0.mc.Segments.c);");
+    
+    add_actions(mo,
+        "    if (_global.loops < 5) {"
+        "        _global.loops++;"
+        "        gotoAndPlay(2);"
+        "   }"
+        "   else {"
+        "      gotoAndPlay(4);"
+        "   };"
+        );
+    
+    SWFMovie_nextFrame(mo);
+    
+    check_equals(mo, "_global.arr.length", "23");
+    check_equals(mo, "_global.arr[0]", "'Frame 2 actions: undefined'");
+    check_equals(mo, "_global.arr[1]", "'ctor: 0'");
+    check_equals(mo, "_global.arr[2]", "'static unload: undefined'");
+    check_equals(mo, "_global.arr[3]", "'dynamic load: 0'");
+    check_equals(mo, "_global.arr[4]", "'Frame 3 actions: undefined'");
+    check_equals(mo, "_global.arr[5]", "'Frame 2 actions: undefined'");
+    xcheck_equals(mo, "_global.arr[6]", "'Frame 3 actions: 0'");
+    xcheck_equals(mo, "_global.arr[7]", "'Frame 2 actions: 0'");
+    check_equals(mo, "_global.arr[8]", "'ctor: 1'");
+    check_equals(mo, "_global.arr[9]", "'static unload: 0'");
+    check_equals(mo, "_global.arr[10]", "'dynamic unload: 0'");
+    check_equals(mo, "_global.arr[11]", "'dynamic load: 1'");
+    check_equals(mo, "_global.arr[12]", "'Frame 3 actions: 0'");
+    check_equals(mo, "_global.arr[13]", "'Frame 2 actions: 0'");
+    xcheck_equals(mo, "_global.arr[14]", "'Frame 3 actions: 1'");
+    xcheck_equals(mo, "_global.arr[15]", "'Frame 2 actions: 1'");
+    check_equals(mo, "_global.arr[16]", "'ctor: 2'");
+    check_equals(mo, "_global.arr[17]", "'static unload: 1'");
+    check_equals(mo, "_global.arr[18]", "'dynamic unload: 1'");
+    check_equals(mo, "_global.arr[19]", "'dynamic load: 2'");
+    check_equals(mo, "_global.arr[20]", "'Frame 3 actions: 1'");
+    check_equals(mo, "_global.arr[21]", "'Frame 2 actions: 1'");
+    xcheck_equals(mo, "_global.arr[22]", "'Frame 3 actions: 2'");
+    xcheck_equals(mo, "_global.arr.toString()",
+            "'Frame 2 actions: undefined,ctor: 0,static unload: 
undefined,dynamic load: 0,Frame 3 actions: undefined,Frame 2 actions: 
undefined,Frame 3 actions: 0,Frame 2 actions: 0,ctor: 1,static unload: 
0,dynamic unload: 0,dynamic load: 1,Frame 3 actions: 0,Frame 2 actions: 0,Frame 
3 actions: 1,Frame 2 actions: 1,ctor: 2,static unload: 1,dynamic unload: 
1,dynamic load: 2,Frame 3 actions: 1,Frame 2 actions: 1,Frame 3 actions: 2'");
+
+    SWFMovie_nextFrame(mo);
+    add_actions(mo, "totals(25); stop();");
+
+    // SWF_END 
+    SWFMovie_save(mo, OUTPUT_FILENAME);
+
+    return 0;
+}
+

=== added file 'testsuite/misc-ming.all/ActionOrderTest4.c'
--- a/testsuite/misc-ming.all/ActionOrderTest4.c        1970-01-01 00:00:00 
+0000
+++ b/testsuite/misc-ming.all/ActionOrderTest4.c        2010-06-17 06:10:02 
+0000
@@ -0,0 +1,181 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <ming.h>
+
+#include "ming_utils.h"
+
+#define OUTPUT_VERSION 8
+#define OUTPUT_FILENAME "ActionOrderTest4.swf"
+
+// A relatively simple looping test checking order of load and unload events.
+//
+// See InitActionsTest4 and InitActionsTest5 for similar tests. This test
+// has a static onLoad handler.
+
+int main(int argc, char* argv[])
+{
+
+    SWFMovie mo;
+    SWFMovieClip mc1, mc2, mc3, mc4, dejagnuclip;
+    SWFDisplayItem it;
+    SWFAction ac;
+    SWFInitAction initac;
+
+    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);
+
+    add_actions(mo,
+            "if (!_global.hasOwnProperty('arr')) { _global.arr = []; };");
+
+    SWFMovie_nextFrame(mo);
+
+    //  MovieClip 1 
+    mc1 = newSWFMovieClip(); // 1 frames 
+
+    // SWF_EXPORTASSETS 
+    SWFMovie_addExport(mo, (SWFBlock)mc1, "Segments_Name");
+    SWFMovie_writeExports(mo);
+
+    //  MovieClip mc3 has two frames. In each frame a different MovieClip
+    //  is placed with the name Segments.
+    mc3 = newSWFMovieClip(); // 2 frames 
+
+    //  MovieClip 2 
+    mc2 = newSWFMovieClip(); // 1 frames 
+
+    // Add mc2
+    it = SWFMovieClip_add(mc3, (SWFBlock)mc2);
+    SWFDisplayItem_setDepth(it, 1);
+    SWFDisplayItem_setName(it, "Segments");
+    // Set static load handler
+    SWFDisplayItem_addAction(it,
+        newSWFAction("_global.arr.push('static load: ' + this.c);"),
+        SWFACTION_ONLOAD);
+
+    // Frame 2
+    SWFMovieClip_nextFrame(mc3);
+
+    // Remove mc2
+    SWFDisplayItem_remove(it);
+
+    // Add mc1
+    it = SWFMovieClip_add(mc3, (SWFBlock)mc1);
+    SWFDisplayItem_setDepth(it, 1);
+    SWFDisplayItem_setName(it, "Segments");
+    // Set static load handler
+    SWFDisplayItem_addAction(it,
+        newSWFAction("_global.arr.push('static load: ' + this.c);"),
+        SWFACTION_ONLOAD);
+
+    SWFMovieClip_nextFrame(mc3);
+
+    // End mc3
+
+
+    // This is frame 1 of the main timeline
+
+    // Put our sprite mc3 on stage.
+    it = SWFMovie_add(mo, (SWFBlock)mc3);
+    SWFDisplayItem_setDepth(it, 1);
+    SWFDisplayItem_setName(it, "mc");
+
+    //  mc4 is just for executing init actions.
+    mc4 = newSWFMovieClip(); 
+    SWFMovie_addExport(mo, (SWFBlock)mc4, "__Packages.Bug");
+    SWFMovie_writeExports(mo);
+    
+    dejagnuclip = get_dejagnu_clip((SWFBlock)get_default_font(srcdir), 10,
+                0, 0, 800, 600);
+    SWFMovie_add(mo, (SWFBlock)dejagnuclip);
+
+    ac = newSWFAction(
+        "_global.loops = 0;"
+        "_global.c = 0;"
+        "if( !_global.Bug ) {"
+        "   _global.Bug = function () {"
+        "       this.onUnload = function() { "
+        "           _global.arr.push('dynamic unload: ' + this.c);"
+        "       }; "
+        "       this.onLoad = function() { "
+        "           _global.arr.push('dynamic load: ' + this.c);"
+        "       }; "
+        "       this.c = _global.c;"
+        "       _global.arr.push('ctor: ' + _global.c);"
+        "       _global.c++;"
+        "   };"
+        "};"
+    );
+
+    initac = newSWFInitAction_withId(ac, 4);
+    SWFMovie_add(mo, (SWFBlock)initac);
+    
+    ac = newSWFAction("Object.registerClass('Segments_Name',Bug);");
+    initac = newSWFInitAction_withId(ac, 1);
+    SWFMovie_add(mo, (SWFBlock)initac);
+    add_actions(mo, "_global.arr.push('Frame ' + "
+                            "_level0._currentframe + ' actions: ' "
+                            "+ _level0.mc.Segments.c);");
+
+    // Frame 2 of the main timeline
+    SWFMovie_nextFrame(mo);
+    add_actions(mo, "_global.arr.push('Frame ' + "
+                            "_level0._currentframe + ' actions: ' "
+                            "+ _level0.mc.Segments.c);");
+    
+    add_actions(mo,
+        "    if (_global.loops < 5) {"
+        "        _global.loops++;"
+        "        gotoAndPlay(2);"
+        "   }"
+        "   else {"
+        "      gotoAndPlay(4);"
+        "   };"
+        );
+    
+    SWFMovie_nextFrame(mo);
+    
+    xcheck_equals(mo, "_global.arr.length", "24");
+    check_equals(mo, "_global.arr[0]", "'Frame 2 actions: undefined'");
+    check_equals(mo, "_global.arr[1]", "'static load: undefined'");
+    check_equals(mo, "_global.arr[2]", "'ctor: 0'");
+    check_equals(mo, "_global.arr[3]", "'static load: 0'");
+    check_equals(mo, "_global.arr[4]", "'dynamic load: 0'");
+    check_equals(mo, "_global.arr[5]", "'Frame 3 actions: 0'");
+    check_equals(mo, "_global.arr[6]", "'Frame 2 actions: 0'");
+    xcheck_equals(mo, "_global.arr[7]", "'Frame 3 actions: 0'");
+    xcheck_equals(mo, "_global.arr[8]", "'Frame 2 actions: 0'");
+    xcheck_equals(mo, "_global.arr[9]", "'ctor: 1'");
+    xcheck_equals(mo, "_global.arr[10]", "'dynamic unload: 0'");
+    xcheck_equals(mo, "_global.arr[11]", "'static load: 1'");
+    xcheck_equals(mo, "_global.arr[12]", "'dynamic load: 1'");
+    xcheck_equals(mo, "_global.arr[13]", "'Frame 3 actions: 0'");
+    xcheck_equals(mo, "_global.arr[14]", "'Frame 2 actions: 0'");
+    xcheck_equals(mo, "_global.arr[15]", "'Frame 3 actions: 1'");
+    xcheck_equals(mo, "_global.arr[16]", "'Frame 2 actions: 1'");
+    xcheck_equals(mo, "_global.arr[17]", "'ctor: 2'");
+    xcheck_equals(mo, "_global.arr[18]", "'dynamic unload: 1'");
+    xcheck_equals(mo, "_global.arr[19]", "'static load: 2'");
+    xcheck_equals(mo, "_global.arr[20]", "'dynamic load: 2'");
+    xcheck_equals(mo, "_global.arr[21]", "'Frame 3 actions: 1'");
+    xcheck_equals(mo, "_global.arr[22]", "'Frame 2 actions: 1'");
+    xcheck_equals(mo, "_global.arr[23]", "'Frame 3 actions: 2'");
+    xcheck_equals(mo, "_global.arr.toString()", "'Frame 2 actions: 
undefined,static load: undefined,ctor: 0,static load: 0,dynamic load: 0,Frame 3 
actions: 0,Frame 2 actions: 0,Frame 3 actions: 0,Frame 2 actions: 0,ctor: 
1,dynamic unload: 0,static load: 1,dynamic load: 1,Frame 3 actions: 0,Frame 2 
actions: 0,Frame 3 actions: 1,Frame 2 actions: 1,ctor: 2,dynamic unload: 
1,static load: 2,dynamic load: 2,Frame 3 actions: 1,Frame 2 actions: 1,Frame 3 
actions: 2'");
+
+    SWFMovie_nextFrame(mo);
+    add_actions(mo, "totals(26); stop();");
+
+    // SWF_END 
+    SWFMovie_save(mo, OUTPUT_FILENAME);
+
+    return 0;
+}
+

=== added file 'testsuite/misc-ming.all/ActionOrderTest5.c'
--- a/testsuite/misc-ming.all/ActionOrderTest5.c        1970-01-01 00:00:00 
+0000
+++ b/testsuite/misc-ming.all/ActionOrderTest5.c        2010-06-17 06:11:04 
+0000
@@ -0,0 +1,169 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <ming.h>
+
+#include "ming_utils.h"
+
+#define OUTPUT_VERSION 8
+#define OUTPUT_FILENAME "ActionOrderTest5.swf"
+
+// A relatively simple looping test checking order of unload events.
+//
+// See InitActionTest3 and InitActionTest4. This is the same test but without
+// static event handlers.
+
+int main(int argc, char* argv[])
+{
+
+    SWFMovie mo;
+    SWFMovieClip mc1, mc2, mc3, mc4, dejagnuclip;
+    SWFDisplayItem it;
+    SWFAction ac;
+    SWFInitAction initac;
+
+    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);
+
+    add_actions(mo,
+            "if (!_global.hasOwnProperty('arr')) { _global.arr = []; };");
+
+    SWFMovie_nextFrame(mo);
+
+    //  MovieClip 1 
+    mc1 = newSWFMovieClip(); // 1 frames 
+
+    // SWF_EXPORTASSETS 
+    SWFMovie_addExport(mo, (SWFBlock)mc1, "Segments_Name");
+    SWFMovie_writeExports(mo);
+
+    //  MovieClip mc3 has two frames. In each frame a different MovieClip
+    //  is placed with the name Segments.
+    mc3 = newSWFMovieClip(); // 2 frames 
+
+    //  MovieClip 2 
+    mc2 = newSWFMovieClip(); // 1 frames 
+
+    // Add mc2
+    it = SWFMovieClip_add(mc3, (SWFBlock)mc2);
+    SWFDisplayItem_setDepth(it, 1);
+    SWFDisplayItem_setName(it, "Segments");
+
+    // Frame 2
+    SWFMovieClip_nextFrame(mc3);
+
+    // Remove mc2
+    SWFDisplayItem_remove(it);
+
+    // Add mc1
+    it = SWFMovieClip_add(mc3, (SWFBlock)mc1);
+    SWFDisplayItem_setDepth(it, 1);
+    SWFDisplayItem_setName(it, "Segments");
+
+    SWFMovieClip_nextFrame(mc3);
+
+    // End mc3
+
+
+    // This is frame 1 of the main timeline
+
+    // Put our sprite mc3 on stage.
+    it = SWFMovie_add(mo, (SWFBlock)mc3);
+    SWFDisplayItem_setDepth(it, 1);
+    SWFDisplayItem_setName(it, "mc");
+
+    //  mc4 is just for executing init actions.
+    mc4 = newSWFMovieClip(); 
+    SWFMovie_addExport(mo, (SWFBlock)mc4, "__Packages.Bug");
+    SWFMovie_writeExports(mo);
+    
+    dejagnuclip = get_dejagnu_clip((SWFBlock)get_default_font(srcdir), 10,
+                0, 0, 800, 600);
+    SWFMovie_add(mo, (SWFBlock)dejagnuclip);
+
+    ac = newSWFAction(
+        "_global.loops = 0;"
+        "_global.c = 0;"
+        "if( !_global.Bug ) {"
+        "   _global.Bug = function () {"
+        "       this.onUnload = function() { "
+        "           _global.arr.push('dynamic unload: ' + this.c);"
+        "       }; "
+        "       this.onLoad = function() { "
+        "           _global.arr.push('dynamic load: ' + this.c);"
+        "       }; "
+        "       this.c = _global.c;"
+        "       _global.arr.push('ctor: ' + _global.c);"
+        "       _global.c++;"
+        "   };"
+        "};"
+    );
+
+    initac = newSWFInitAction_withId(ac, 4);
+    SWFMovie_add(mo, (SWFBlock)initac);
+    
+    ac = newSWFAction("Object.registerClass('Segments_Name',Bug);");
+    initac = newSWFInitAction_withId(ac, 1);
+    SWFMovie_add(mo, (SWFBlock)initac);
+    add_actions(mo, "_global.arr.push('Frame ' + "
+                            "_level0._currentframe + ' actions: ' "
+                            "+ _level0.mc.Segments.c);");
+
+    // Frame 2 of the main timeline
+    SWFMovie_nextFrame(mo);
+    add_actions(mo, "_global.arr.push('Frame ' + "
+                            "_level0._currentframe + ' actions: ' "
+                            "+ _level0.mc.Segments.c);");
+    
+    add_actions(mo,
+        "    if (_global.loops < 5) {"
+        "        _global.loops++;"
+        "        gotoAndPlay(2);"
+        "   }"
+        "   else {"
+        "      gotoAndPlay(4);"
+        "   };"
+        );
+    
+    SWFMovie_nextFrame(mo);
+    
+    check_equals(mo, "_global.arr.length", "20");
+    check_equals(mo, "_global.arr[0]", "'Frame 2 actions: undefined'");
+    check_equals(mo, "_global.arr[1]", "'ctor: 0'");
+    xcheck_equals(mo, "_global.arr[2]", "'Frame 3 actions: 0'");
+    xcheck_equals(mo, "_global.arr[3]", "'dynamic load: 0'");
+    check_equals(mo, "_global.arr[4]", "'Frame 2 actions: 0'");
+    check_equals(mo, "_global.arr[5]", "'Frame 3 actions: 0'");
+    check_equals(mo, "_global.arr[6]", "'Frame 2 actions: 0'");
+    check_equals(mo, "_global.arr[7]", "'ctor: 1'");
+    check_equals(mo, "_global.arr[8]", "'dynamic unload: 0'");
+    xcheck_equals(mo, "_global.arr[9]", "'Frame 3 actions: 0'");
+    check_equals(mo, "_global.arr[11]", "'Frame 2 actions: 0'");
+    xcheck_equals(mo, "_global.arr[12]", "'Frame 3 actions: 1'");
+    xcheck_equals(mo, "_global.arr[13]", "'Frame 2 actions: 1'");
+    check_equals(mo, "_global.arr[14]", "'ctor: 2'");
+    check_equals(mo, "_global.arr[15]", "'dynamic unload: 1'");
+    xcheck_equals(mo, "_global.arr[16]", "'Frame 3 actions: 1'");
+    xcheck_equals(mo, "_global.arr[17]", "'dynamic load: 2'");
+    check_equals(mo, "_global.arr[18]", "'Frame 2 actions: 1'");
+    xcheck_equals(mo, "_global.arr[19]", "'Frame 3 actions: 2'");
+    xcheck_equals(mo, "_global.arr.toString()",
+                   "'Frame 2 actions: undefined,ctor: 0,Frame 3 actions: 
0,dynamic load: 0,Frame 2 actions: 0,Frame 3 actions: 0,Frame 2 actions: 
0,ctor: 1,dynamic unload: 0,Frame 3 actions: 0,dynamic load: 1,Frame 2 actions: 
0,Frame 3 actions: 1,Frame 2 actions: 1,ctor: 2,dynamic unload: 1,Frame 3 
actions: 1,dynamic load: 2,Frame 2 actions: 1,Frame 3 actions: 2'");
+
+    SWFMovie_nextFrame(mo);
+    add_actions(mo, "totals(21); stop();");
+
+    // SWF_END 
+    SWFMovie_save(mo, OUTPUT_FILENAME);
+
+    return 0;
+}
+

=== modified file 'testsuite/misc-ming.all/Makefile.am'
--- a/testsuite/misc-ming.all/Makefile.am       2010-06-14 09:21:17 +0000
+++ b/testsuite/misc-ming.all/Makefile.am       2010-06-17 06:08:49 +0000
@@ -222,6 +222,9 @@
 check_PROGRAMS += \
        init_action_test \
        InitActionTest2 \
+       ActionOrderTest3 \
+       ActionOrderTest4 \
+       ActionOrderTest5 \
        RegisterClassTest4 \
        RegisterClassTest3 \
        registerClassTest2 \
@@ -325,6 +328,9 @@
        instanceNameTestRunner \
        init_action_testrunner \
        InitActionTest2Runner \
+       ActionOrderTest3Runner \
+       ActionOrderTest4Runner \
+       ActionOrderTest5Runner \
        $(NULL)
 
 if MAKESWF_SUPPORTS_PREBUILT_CLIPS
@@ -354,6 +360,9 @@
 if MING_SUPPORTS_INIT_ACTIONS
 check_SCRIPTS += \
        InitActionTest2Runner \
+       ActionOrderTest3Runner \
+       ActionOrderTest4Runner \
+       ActionOrderTest5Runner \
        RegisterClassTest4Runner \
        RegisterClassTest3Runner \
        registerClassTest2runner \
@@ -1791,6 +1800,42 @@
        sh $< $(top_builddir) InitActionTest2.swf > $@
        chmod 755 $@
 
+ActionOrderTest3_SOURCES =     \
+       ActionOrderTest3.c      \
+       $(NULL)
+ActionOrderTest3_LDADD = libgnashmingutils.la
+
+ActionOrderTest3.swf: ActionOrderTest3
+       ./ActionOrderTest3 $(abs_mediadir)
+
+ActionOrderTest3Runner: $(srcdir)/../generic-testrunner.sh ActionOrderTest3.swf
+       sh $< $(top_builddir) ActionOrderTest3.swf > $@
+       chmod 755 $@
+
+ActionOrderTest4_SOURCES =     \
+       ActionOrderTest4.c      \
+       $(NULL)
+ActionOrderTest4_LDADD = libgnashmingutils.la
+
+ActionOrderTest4.swf: ActionOrderTest4
+       ./ActionOrderTest4 $(abs_mediadir)
+
+ActionOrderTest4Runner: $(srcdir)/../generic-testrunner.sh ActionOrderTest4.swf
+       sh $< $(top_builddir) ActionOrderTest4.swf > $@
+       chmod 755 $@
+
+ActionOrderTest5_SOURCES =     \
+       ActionOrderTest5.c      \
+       $(NULL)
+ActionOrderTest5_LDADD = libgnashmingutils.la
+
+ActionOrderTest5.swf: ActionOrderTest5
+       ./ActionOrderTest5 $(abs_mediadir)
+
+ActionOrderTest5Runner: $(srcdir)/../generic-testrunner.sh ActionOrderTest5.swf
+       sh $< $(top_builddir) ActionOrderTest5.swf > $@
+       chmod 755 $@
+
 RegisterClassTest3_SOURCES =   \
        RegisterClassTest3.c    \
        $(NULL)
@@ -2198,6 +2243,9 @@
        registerClassTest2runner \
        init_action_testrunner \
        InitActionTest2Runner \
+       ActionOrderTest3Runner \
+       ActionOrderTest4Runner \
+       ActionOrderTest5Runner \
        RegisterClassTest3Runner \
        RegisterClassTest4Runner \
        $(NULL)

=== modified file 'testsuite/misc-ming.all/RegisterClassTest4.c'
--- a/testsuite/misc-ming.all/RegisterClassTest4.c      2010-06-14 14:07:52 
+0000
+++ b/testsuite/misc-ming.all/RegisterClassTest4.c      2010-06-16 09:26:56 
+0000
@@ -88,8 +88,14 @@
         "if( !_global.Bug ) {"
            "   _global.Bug = function () {"
         "       _global.ctorcalls++;"
-           "       this.onUnload = function() {}; "
+           "       this.onUnload = function() { "
+        "           trace('unload ' + this + ' c: ' + this.c); "
+        "       }; "
+           "       this.onLoad = function() { "
+        "           trace('load ' + this + ' c: ' + this.c); "
+        "       }; "
         "       this.c = _global.c;"
+        "       trace('Bug ctor: ' + _global.c);"
         "       _global.c++;"
            "   };"
            "};"
@@ -104,12 +110,14 @@
     
     add_actions(mo, "_global.fns.push(typeof(_level0.mc.Segments.onUnload));");
     add_actions(mo, "_global.real.push(_level0.mc.Segments.c);");
+    add_actions(mo, "trace(_level0._currentframe + ' ' + 
_level0.mc.Segments.c);");
 
     // Frame 2 of the main timeline
     SWFMovie_nextFrame(mo);
     
     add_actions(mo, "_global.fns.push(typeof(_level0.mc.Segments.onUnload));");
     add_actions(mo, "_global.real.push(_level0.mc.Segments.c);");
+    add_actions(mo, "trace(_level0._currentframe + ' ' + 
_level0.mc.Segments.c);");
 
     add_actions(mo,
         "    if (_global.loops < 5) {"
@@ -117,7 +125,6 @@
         "        gotoAndPlay(1);"
         "   }"
         "   else {"
-        "      delete this.onEnterFrame;"
         "      gotoAndPlay(3);"
         "   };"
         );


reply via email to

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