gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog testsuite/misc-ming.all/event_h...


From: Zou Lunkai
Subject: [Gnash-commit] gnash ChangeLog testsuite/misc-ming.all/event_h...
Date: Mon, 23 Apr 2007 02:07:41 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Zou Lunkai <zoulunkai>  07/04/23 02:07:41

Modified files:
        .              : ChangeLog 
Added files:
        testsuite/misc-ming.all: event_handler_scope_test.c 

Log message:
        testcase for scope in event handlers

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2962&r2=1.2963
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/event_handler_scope_test.c?cvsroot=gnash&rev=1.1

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2962
retrieving revision 1.2963
diff -u -b -r1.2962 -r1.2963
--- ChangeLog   21 Apr 2007 21:07:39 -0000      1.2962
+++ ChangeLog   23 Apr 2007 02:07:40 -0000      1.2963
@@ -1,3 +1,8 @@
+2007-04-23 Zou Lunkai <address@hidden>
+
+       * testsuite/misc-ming.all/event_handler_scope_test.c
+         testcase for scope in event handlers
+         
 2007-04-21 Sandro Santilli <address@hidden>
 
        * server/: movie_root.{cpp,h}, sprite_instance.{cpp,h},

Index: testsuite/misc-ming.all/event_handler_scope_test.c
===================================================================
RCS file: testsuite/misc-ming.all/event_handler_scope_test.c
diff -N testsuite/misc-ming.all/event_handler_scope_test.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ testsuite/misc-ming.all/event_handler_scope_test.c  23 Apr 2007 02:07:41 
-0000      1.1
@@ -0,0 +1,106 @@
+/*
+ *   Copyright (C) 2005, 2006, 2007 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
+ *
+ */ 
+
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <ming.h>
+
+#include "ming_utils.h"
+
+#define OUTPUT_VERSION  6
+#define OUTPUT_FILENAME  "event_handler_scope_test.swf"
+
+
+int
+main(int argc, char** argv)
+{
+  SWFMovie mo;
+  SWFMovieClip  mc2, dejagnuclip;
+  SWFDisplayItem  it2;
+  SWFShape  sh_red;
+
+  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);
+
+  dejagnuclip = get_dejagnu_clip((SWFBlock)get_default_font(srcdir), 10, 0, 0, 
800, 600);
+  SWFMovie_add(mo, (SWFBlock)dejagnuclip);
+  add_actions(mo, "x1=0; x2=0; x3=0;");
+  SWFMovie_nextFrame(mo);  /* 1st frame */
+
+  
+  mc2 = newSWFMovieClip();
+  sh_red = make_fill_square (100, 200, 60, 60, 255, 0, 0, 255, 0, 0);
+  SWFMovieClip_add(mc2, (SWFBlock)sh_red);  
+  SWFMovieClip_nextFrame(mc2); //frame1
+  SWFMovieClip_nextFrame(mc2); //frame2
+  add_clip_actions(mc2, " if (scope_test == 1); scope_test = 2; stop();");
+  SWFMovieClip_nextFrame(mc2); //frame3
+
+  it2 = SWFMovie_add(mo, (SWFBlock)mc2); 
+  SWFDisplayItem_setDepth(it2, 20); 
+  SWFDisplayItem_setName(it2, "mc2"); 
+  /* Define onClipEnterFrame */
+  SWFDisplayItem_addAction(it2,
+    compileSWFActionCode(" _root.note('onClipEnterFrame triggered'); "
+                         " var scope_test = 1; "), // Define mc.scope_test
+    SWFACTION_ENTERFRAME);  
+  /* Define onEnterFrame */
+  add_actions(mo, " mc2.onEnterFrame = function () "
+                  " { _root.note('user defined onEnterFrame called'); "
+                  "   scope_test = 3; "          // Define _root.scope_test 
+                  " var scope_test = 4; }; " );  // Define a local var
+  
+  check_equals(mo, "_root.scope_test", "undefined");
+  check_equals(mo, "_root.mc2.scope_test", "undefined");
+  SWFMovie_nextFrame(mo); /* 2nd frame */
+  
+  check_equals(mo, "_root.mc2.scope_test", "1");
+  check_equals(mo, "_root.scope_test", "3");
+  SWFMovie_nextFrame(mo); /* 3rd frame */
+  
+  check_equals(mo, "_root.mc2.scope_test", "2");
+  SWFMovie_nextFrame(mo); /* 4th frame */
+  
+  check_equals(mo, "_root.scope_test", "3");
+  SWFMovie_nextFrame(mo); /* 5th frame */
+  
+  SWFDisplayItem_remove(it2);
+  check_equals(mo, "_root.mc2.scope_test", "undefined");
+  add_actions(mo, " _root.totals(); stop(); ");
+  SWFMovie_nextFrame(mo); /* 6th frame */
+  //Output movie
+  puts("Saving " OUTPUT_FILENAME );
+  SWFMovie_save(mo, OUTPUT_FILENAME);
+
+  return 0;
+}
+
+
+




reply via email to

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