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/static_...


From: Zou Lunkai
Subject: [Gnash-commit] gnash ChangeLog testsuite/misc-ming.all/static_...
Date: Wed, 09 May 2007 06:33:41 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Zou Lunkai <zoulunkai>  07/05/09 06:33:41

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

Log message:
        testcase about static and dynamic things

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3132&r2=1.3133
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/static_vs_dynamic1.c?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/static_vs_dynamic2.c?cvsroot=gnash&rev=1.1

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.3132
retrieving revision 1.3133
diff -u -b -r1.3132 -r1.3133
--- ChangeLog   8 May 2007 22:13:47 -0000       1.3132
+++ ChangeLog   9 May 2007 06:33:41 -0000       1.3133
@@ -1,3 +1,8 @@
+2007-05-09 Zou Lunkai <address@hidden>
+
+       * testsuite/misc-ming.all/static_vs_dynamic1.c, static_vs_dynamic12.c:
+         test what we discussed yestoday.
+         
 2007-05-08 Sandro Santilli <address@hidden>
 
        * testsuite/misc-ming.all/DrawingApiTestRunner.cpp: tolerate

Index: testsuite/misc-ming.all/static_vs_dynamic1.c
===================================================================
RCS file: testsuite/misc-ming.all/static_vs_dynamic1.c
diff -N testsuite/misc-ming.all/static_vs_dynamic1.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ testsuite/misc-ming.all/static_vs_dynamic1.c        9 May 2007 06:33:41 
-0000       1.1
@@ -0,0 +1,128 @@
+/* 
+ *   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
+ *
+ */ 
+
+/*
+ * mc1 and mc2 are two movieClips created by PlaceObject2 tag;
+ * dup1 and dup2 are two movieClips created by AS;
+ * swap mc1 to the dynamic range depths;
+ * swap dup1 to the static range depths;
+ *
+ * expected behaviour after loopback:
+ *  mc1 keep alive;
+ *  mc2 get removed;
+ *  dup1 get removed;
+ *  dup2 keep alive;
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <ming.h>
+
+#include "ming_utils.h"
+
+#define OUTPUT_VERSION 6
+#define OUTPUT_FILENAME "static_vs_dynamic1.swf"
+
+
+
+
+int
+main(int argc, char** argv)
+{
+  SWFMovie mo;
+  SWFMovieClip  mc1, mc2, dejagnuclip;
+  SWFDisplayItem it1, it2;
+  SWFShape  sh1,sh2;
+
+  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);
+  SWFMovie_nextFrame(mo); 
+  
+  add_actions(mo, " if(loopback == undefined) {"  // first time play
+                  " check_equals(typeof(mc1), 'undefined'); "
+                  " check_equals(typeof(mc2), 'undefined'); "
+                  " check_equals(typeof(dup1), 'undefined'); "
+                  " check_equals(typeof(dup2), 'undefined'); "
+                  "} else {"                      // loopback
+                  " check_equals(typeof(mc1), 'movieclip');"
+                  " check_equals(typeof(mc2), 'undefined');"
+                  " xcheck_equals(typeof(dup1), 'undefined');"
+                  " check_equals(typeof(dup2), 'movieclip');"
+                  "}" );
+  SWFMovie_nextFrame(mo); 
+  
+  mc1 = newSWFMovieClip();
+  mc2 = newSWFMovieClip();
+  sh1 = make_fill_square (0, 300, 60, 60, 255, 0, 0, 255, 0, 0);
+  sh2 = make_fill_square (100, 300, 60, 60, 255, 0, 0, 0, 0, 0);
+  SWFMovieClip_add(mc1, (SWFBlock)sh1);  
+  SWFMovieClip_add(mc2, (SWFBlock)sh2);  
+  SWFMovieClip_nextFrame(mc1);
+  SWFMovieClip_nextFrame(mc2);
+    
+  it1 = SWFMovie_add(mo, (SWFBlock)mc1);  
+  SWFDisplayItem_setDepth(it1, 2); 
+  SWFDisplayItem_setName(it1, "mc1");
+  
+  it2 = SWFMovie_add(mo, (SWFBlock)mc2);  
+  SWFDisplayItem_setDepth(it2, 3); 
+  SWFDisplayItem_setName(it2, "mc2");
+  
+  add_actions(mo, " if(loopback == undefined) {"
+                  "   duplicateMovieClip('mc1', 'dup1', 1);"
+                  "   duplicateMovieClip('mc2', 'dup2', 2);"
+                  "   check_equals(mc1.getDepth(), -16382);"
+                  "   check_equals(mc2.getDepth(), -16381);"
+                  "   check_equals(dup1.getDepth(), 1);"
+                  "   check_equals(dup2.getDepth(), 2);"
+                  "   mc1.swapDepths(10);"
+                  "   check_equals(mc1.getDepth(), 10);"
+                  "   dup1.swapDepths(-10);"
+                  "   check_equals(dup1.getDepth(), -10);"
+                  "}");
+  SWFMovie_nextFrame(mo);        
+
+
+  add_actions(mo, "if(loopback == undefined) {"
+                  "  loopback = 1;"   
+                  "  gotoAndPlay(1);" //loopback
+                  "} else {"
+                  "   _root.totals(); stop();" 
+                  "}");
+  SWFMovie_nextFrame(mo);        
+  
+  //Output movie
+  puts("Saving " OUTPUT_FILENAME );
+  SWFMovie_save(mo, OUTPUT_FILENAME);
+
+  return 0;
+}

Index: testsuite/misc-ming.all/static_vs_dynamic2.c
===================================================================
RCS file: testsuite/misc-ming.all/static_vs_dynamic2.c
diff -N testsuite/misc-ming.all/static_vs_dynamic2.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ testsuite/misc-ming.all/static_vs_dynamic2.c        9 May 2007 06:33:41 
-0000       1.1
@@ -0,0 +1,135 @@
+/* 
+ *   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 "static_vs_dynamic2.swf"
+
+
+int
+main(int argc, char** argv)
+{
+  SWFMovie mo;
+  SWFMovieClip  mc1, mc2, dejagnuclip;
+  SWFDisplayItem it;
+  SWFShape  sh;
+
+  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);
+  SWFMovie_nextFrame(mo); 
+
+  /* create(by tag) "mc1" in static depth;
+   * create(by AS) "dup" in dynamic depth;
+   * swap them;
+   * try to move and remove the character in static depth;
+   *
+   * TODO: add test for REPLACE.
+   * Question: how to REPLACE a character?
+  */
+  
+  mc1 = newSWFMovieClip();
+  sh = make_fill_square (0, 300, 60, 60, 255, 0, 0, 255, 0, 0);
+  SWFMovieClip_add(mc1, (SWFBlock)sh);  
+  SWFMovieClip_nextFrame(mc1);
+    
+  it = SWFMovie_add(mo, (SWFBlock)mc1);  
+  SWFDisplayItem_setDepth(it, 2); 
+  SWFDisplayItem_setName(it, "mc1");
+  
+  add_actions(mo, "duplicateMovieClip('mc1', 'dup', 1);"
+                  "check_equals(mc1.getDepth(), -16382);"
+                  "check_equals(dup.getDepth(), 1);"
+                  "mc1.swapDepths(dup);"
+                  "check_equals(mc1.getDepth(), 1);"
+                  "check_equals(dup.getDepth(), -16382);"
+                  "check_equals(mc1._x, 0);"
+                  "check_equals(dup._x, 0);");
+  SWFMovie_nextFrame(mo);        
+
+  /* PlaceObject2 can not move an as-created movieClip */
+  SWFDisplayItem_move(it, 100, 100);
+  check_equals(mo, "mc1._x", "0");
+  check_equals(mo, "dup._x", "0");
+  SWFMovie_nextFrame(mo); 
+  
+  /* PlaceObject2 can not move an as-created movieClip */
+  SWFDisplayItem_moveTo(it, 300, 300);
+  check_equals(mo, "mc1._x", "0");
+  check_equals(mo, "dup._x", "0");
+  SWFMovie_nextFrame(mo); 
+  
+  /* RemoveObject2 */
+  SWFDisplayItem_remove(it);
+  /* "mc1" keeps alive as it has been swapped to a dynamic depth */
+  check_equals(mo, "typeof(mc1)", "'movieclip'");
+  /* "dup" got removed by the RemoveObject2 tag */
+  check_equals(mo, "typeof(dup)", "'undefined'");
+  SWFMovie_nextFrame(mo); 
+  
+  
+  /*
+   * some more tests about removing a movieClip
+  */
+  mc2 = newSWFMovieClip();
+  sh = make_fill_square (300, 300, 30, 30, 255, 0, 0, 255, 0, 0);
+  SWFMovieClip_add(mc2, (SWFBlock)sh);  
+  SWFMovieClip_nextFrame(mc2);
+    
+  it = SWFMovie_add(mo, (SWFBlock)mc2);  
+  SWFDisplayItem_setDepth(it, 3); 
+  SWFDisplayItem_setName(it, "mc2");
+  SWFMovie_nextFrame(mo); 
+  
+  check_equals(mo, "typeof(mc2)", "'movieclip'");
+  add_actions(mo, "removeMovieClip(mc2);");
+  /* can not remove a tag-created movieclip in static depth */
+  check_equals(mo, "typeof(mc2)", "'movieclip'");
+  add_actions(mo, "mc2.swapDepths(3);");
+  add_actions(mo, "removeMovieClip(mc2);");
+  /* tag-created movieclip can be removed in dynamic depth */
+  check_equals(mo, "typeof(mc2)", "'undefined'");
+  SWFMovie_nextFrame(mo); 
+  
+  add_actions(mo, " _root.totals(); stop();" );
+  SWFMovie_nextFrame(mo);        
+  
+  //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]