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


From: Zou Lunkai
Subject: [Gnash-commit] gnash ChangeLog testsuite/misc-ming.all/loop_te...
Date: Mon, 21 May 2007 08:30:11 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Zou Lunkai <zoulunkai>  07/05/21 08:30:11

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

Log message:
        new testcase for timeline control

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

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.3290
retrieving revision 1.3291
diff -u -b -r1.3290 -r1.3291
--- ChangeLog   21 May 2007 07:56:51 -0000      1.3290
+++ ChangeLog   21 May 2007 08:30:10 -0000      1.3291
@@ -1,3 +1,8 @@
+2007-05-21 Zou Lunkai <address@hidden>
+
+       * testsuite/misc-ming.all/loop_test5.c:
+               more for "Timeline control".
+               
 2007-05-21 Sandro Santilli <address@hidden>
 
        * testsuite/misc-ming.all/Makefile.am: build libgnashmingutils

Index: testsuite/misc-ming.all/loop_test5.c
===================================================================
RCS file: testsuite/misc-ming.all/loop_test5.c
diff -N testsuite/misc-ming.all/loop_test5.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ testsuite/misc-ming.all/loop_test5.c        21 May 2007 08:30:11 -0000      
1.1
@@ -0,0 +1,203 @@
+/* 
+ *   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
+ *
+ */ 
+
+/*
+ * Test "Jumping backward to the middle of a character's lifetime after 
removal and replacement(2)"
+ *
+ * Timeline:
+ * 
+ *   Frame  | 1 | 2 | 3 | 4 | 5 | 6 |
+ *  --------+---+---+---+---+---+---+
+ *   Event  |   |PP | * |RR |PP | J |
+ * 
+ *  P = place (by PlaceObject2)
+ *  M = move to another depth (by swapDepth)
+ *  R = remove ((by RemoveObject* tag)
+ *  J = jump
+ *  * = jump target
+ *
+ * Description:
+ *
+ *  frame2: 
+ *    a static characters is placed at depth 3 (-16381) [ a red square ]
+ *    a static character is placed at depth 4 (-16380) [ a black square ]
+ *  frame3: nothing new.
+ *  frame4: 
+ *    character at depth 3 is removed;
+ *    character at depth 4 is removed;
+ *  frame5:
+ *    a static character is placed at depth 3 (-16381) with ratio set to 2.0
+ *    a static character is placed at depth 4 (-16380) with ratio set to 0.0
+ *          
+ *  frame6: jump to frame 3 and stop.
+ *
+ * Expected behaviour:
+ *
+ *   After jump back, characters in depth 3 placed at frame5 get destroyed, 
+ *   characters in depth 4 placed in frame 5 keeps alive. Their ratio values 
are different.
+ *
+ * run as ./loop_test5
+ */
+
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <ming.h>
+
+#include "ming_utils.h"
+
+#define OUTPUT_VERSION 7
+#define OUTPUT_FILENAME "loop_test5.swf"
+
+
+int
+main(int argc, char** argv)
+{
+  SWFMovie mo;
+  SWFMovieClip mc1, mc2, dejagnuclip;
+  SWFDisplayItem it1, it2;
+  SWFShape  sh1,sh2;
+  SWFAction ac;
+  int i;
+
+  const char *srcdir=".";
+  if ( argc>1 ) 
+    srcdir=argv[1];
+  else
+  {
+      //fprintf(stderr, "Usage: %s <mediadir>\n", argv[0]);
+      //return 1;
+  }
+
+  Ming_init();
+  Ming_useSWFVersion (OUTPUT_VERSION);
+  
+  mo = newSWFMovie();
+  SWFMovie_setDimension(mo, 800, 600);
+  SWFMovie_setRate(mo, 6);
+
+  // Frame 1: Place dejagnu clip
+
+  dejagnuclip = get_dejagnu_clip((SWFBlock)get_default_font(srcdir), 10, 0, 0, 
800, 600);
+  SWFMovie_add(mo, (SWFBlock)dejagnuclip);
+  add_actions(mo, "mc1Constructed=0; mc2Constructed=0; mc3Constructed=0; 
mc4Constructed=0;");
+  SWFMovie_nextFrame(mo); 
+  
+  //
+  // Frame 2: 
+  //   Place red static movieClip1 character at depth 3 (-16381)
+  //   Place black static movieClip1 character at depth 4 (-16380)
+  //
+  sh1 = make_fill_square (300, 300, 60, 60, 255, 0, 0, 255, 0, 0);
+  mc1 = newSWFMovieClip();
+  SWFMovieClip_add(mc1, (SWFBlock)sh1); 
+  SWFMovieClip_nextFrame(mc1);
+  
+  it1 = SWFMovie_add(mo, (SWFBlock)mc1);  //add movieClip1 to the _root
+  SWFDisplayItem_setDepth(it1, 3);
+  SWFDisplayItem_setName(it1, "movieClip1"); //name movieClip1
+  SWFDisplayItem_addAction(it1, newSWFAction(
+    "_root.note(this+' constructed');"
+    "_root.mc1Constructed++;"
+    ), SWFACTION_CONSTRUCT);
+
+
+  sh2 = make_fill_square (330, 270, 120, 120, 0, 0, 0, 0, 0, 0);
+  mc2 = newSWFMovieClip();
+  SWFMovieClip_add(mc2, (SWFBlock)sh2);  
+  SWFMovieClip_nextFrame(mc2); 
+
+  it2 = SWFMovie_add(mo, (SWFBlock)mc2);  //add movieClip2 to the _root
+  SWFDisplayItem_setDepth(it2, 4);
+  SWFDisplayItem_setName(it2, "movieClip2"); //name movieClip2
+  SWFDisplayItem_addAction(it2, newSWFAction(
+    "_root.note(this+' constructed');"
+    "_root.mc2Constructed++;"),
+      SWFACTION_CONSTRUCT);
+  
+  SWFMovie_nextFrame(mo);  
+
+  // Frame3: nothing new
+  SWFMovie_nextFrame(mo);  
+  
+  // Frame4: remove "movieClip1" and "movieClip2"
+  
+  SWFDisplayItem_remove(it1);
+  SWFDisplayItem_remove(it2);
+  SWFMovie_nextFrame(mo); 
+  
+  //
+  // Frame5: 
+  //   Place red static movieClip3 character at depth 3 (-16381) with ratio 
set to 2.0
+  //   Place black static movieClip4 character at depth4 (-16380) with ratio 
set to 0.0
+  //
+
+  it1 = SWFMovie_add(mo, (SWFBlock)mc1);  //add movieClip3 to the _root
+  SWFDisplayItem_setDepth(it1, 3);
+  SWFDisplayItem_setName(it1, "movieClip3"); //name movieClip3
+  SWFDisplayItem_setRatio(it1, 2.0); // It's important to set this, don't why 
yet.
+  SWFDisplayItem_addAction(it1, newSWFAction(
+    "_root.note(this+' constructed');"
+    "_root.mc3Constructed++;"
+    ), SWFACTION_CONSTRUCT);
+  
+  it2 = SWFMovie_add(mo, (SWFBlock)mc2);  //add movieClip4 to the _root
+  SWFDisplayItem_setDepth(it2, 4);
+  SWFDisplayItem_setName(it2, "movieClip4"); //name movieClip4
+  SWFDisplayItem_setRatio(it2, 0.0); // It's important to set this, don't why 
yet.
+  SWFDisplayItem_addAction(it2, newSWFAction(
+    "_root.note(this+' constructed');"
+    "_root.mc4Constructed++;"
+    ), SWFACTION_CONSTRUCT);
+  
+  SWFMovie_nextFrame(mo); 
+  
+  //
+  // Frame4: check, gotoAndStop(3), check..
+  //
+  check_equals(mo, "typeof(movieClip1)", "'undefined'");
+  check_equals(mo, "typeof(movieClip2)", "'undefined'");
+  check_equals(mo, "typeof(movieClip3)", "'movieclip'");
+  check_equals(mo, "typeof(movieClip4)", "'movieclip'");
+  check_equals(mo, "_root.mc1Constructed", "1");
+  check_equals(mo, "_root.mc2Constructed", "1");
+  check_equals(mo, "_root.mc3Constructed", "1");
+  check_equals(mo, "_root.mc4Constructed", "1");
+  
+  SWFMovie_add(mo, (SWFBlock)newSWFAction( "gotoAndStop(3);"));
+  
+  check_equals(mo, "typeof(movieClip1)", "'movieclip'");
+  xcheck_equals(mo, "typeof(movieClip2)", "'undefined'");
+  // the difference of movieClip3 and movieClip4 was caused by the ratio value
+  check_equals(mo, "typeof(movieClip3)", "'undefined'");
+  xcheck_equals(mo, "typeof(movieClip4)", "'movieclip'");
+  check_equals(mo, "_root.mc1Constructed", "2");
+  xcheck_equals(mo, "_root.mc2Constructed", "1");
+  check_equals(mo, "_root.mc3Constructed", "1");
+  check_equals(mo, "_root.mc4Constructed", "1");
+  
+  SWFMovie_add(mo, (SWFBlock)newSWFAction( "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]