gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog testsuite/actionscript.all/Obje...


From: Zou Lunkai
Subject: [Gnash-commit] gnash ChangeLog testsuite/actionscript.all/Obje...
Date: Thu, 16 Aug 2007 06:09:15 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Zou Lunkai <zoulunkai>  07/08/16 06:09:15

Modified files:
        .              : ChangeLog 
        testsuite/actionscript.all: Object.as toString_valueOf.as 
        testsuite/misc-ming.all: Makefile.am registerClassTest.c 
Added files:
        testsuite/misc-ming.all: registerClassTest2.c 

Log message:
        * testsuite/misc-ming.all/registerClassTest2.c, Makefile.am: new 
testcase
          for Object.registerClass.
        * testsuite/misc-ming.all/registerClassTest.c, 
          testsuite/actionscript.all/Object.as, toString_valueOf.as: testcases 
review,
          minor comments or changes.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4008&r2=1.4009
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/Object.as?cvsroot=gnash&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/toString_valueOf.as?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/Makefile.am?cvsroot=gnash&r1=1.145&r2=1.146
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/registerClassTest.c?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/registerClassTest2.c?cvsroot=gnash&rev=1.1

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.4008
retrieving revision 1.4009
diff -u -b -r1.4008 -r1.4009
--- ChangeLog   15 Aug 2007 23:00:15 -0000      1.4008
+++ ChangeLog   16 Aug 2007 06:09:13 -0000      1.4009
@@ -1,4 +1,12 @@
-2007-08-13 Sandro Santilli <address@hidden>
+2007-08-16 Zou Lunkai <address@hidden>
+
+       * testsuite/misc-ming.all/registerClassTest2.c, Makefile.am: new 
testcase
+         for Object.registerClass.
+       * testsuite/misc-ming.all/registerClassTest.c, 
+         testsuite/actionscript.all/Object.as, toString_valueOf.as: testcases 
review,
+         minor comments or changes.
+       
+2007-08-15 Sandro Santilli <address@hidden>
 
        * testsuite/actionscript.all/TextField.as: a few more tests for
          interaction between _width, autoSize and wordWrap (more needed).

Index: testsuite/actionscript.all/Object.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/Object.as,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- testsuite/actionscript.all/Object.as        15 Aug 2007 06:52:19 -0000      
1.27
+++ testsuite/actionscript.all/Object.as        16 Aug 2007 06:09:14 -0000      
1.28
@@ -20,13 +20,14 @@
 // compile this test case with Ming makeswf, and then
 // execute it like this gnash -1 -r 0 -v out.swf
 
-rcsid="$Id: Object.as,v 1.27 2007/08/15 06:52:19 zoulunkai Exp $";
+rcsid="$Id: Object.as,v 1.28 2007/08/16 06:09:14 zoulunkai Exp $";
 
 #include "check.as"
 
 // Test existance of methods
 check_equals(typeof(Object), 'function');
 check_equals(typeof(Object.prototype), 'object');
+// registerClass is a public static function of Object
 check_equals(typeof(Object.registerClass), 'function');
 check_equals(typeof(Object.prototype.toString), 'function');
 check_equals(typeof(Object.prototype.valueOf), 'function');
@@ -119,15 +120,16 @@
 // Test instantiated Object methods
 check_equals(typeof(obj.toString), 'function');
 check_equals(typeof(obj.valueOf), 'function');
+
 #if OUTPUT_VERSION > 5
   check_equals(typeof(obj.addProperty), 'function');
   check(Object.hasOwnProperty('constructor')); 
-#if OUTPUT_VERSION == 6
+  #if OUTPUT_VERSION == 6
     // bug in swf6???
     check(obj.hasOwnProperty('constructor')); 
-#else
+  #else
     check(!obj.hasOwnProperty('constructor')); 
-#endif
+  #endif
   check(obj.hasOwnProperty('__constructor__')); 
 #else
   check_equals(typeof(obj.addProperty), 'undefined');

Index: testsuite/actionscript.all/toString_valueOf.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/toString_valueOf.as,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- testsuite/actionscript.all/toString_valueOf.as      6 Aug 2007 21:08:45 
-0000       1.4
+++ testsuite/actionscript.all/toString_valueOf.as      16 Aug 2007 06:09:14 
-0000      1.5
@@ -43,7 +43,7 @@
 check(typeof(y) == "object");
 check(x == "[object Object]"); 
 check(y == obj); //true
-//trace(obj); //output [object Object]
+//trace(obj); //invoke obj.toString(), output [object Object]
 #if OUTPUT_VERSION > 5
   check(obj.toString == Object.prototype.toString);
   check(obj.valueOf == Object.prototype.valueOf);
@@ -65,7 +65,7 @@
 check(x=="TO_STRING");
 check(y=="TO_VALUE");
 check(typeof(obj)=="object"); 
-//trace(obj); // output TO_STRING
+//trace(obj); //invoke obj.toString(), output TO_STRING
 check(typeof(y) == "string");
 check(obj == y); 
 
@@ -107,6 +107,7 @@
 check(typeof(y)=="string"); 
 check(x=="TO_STRING"); 
 check(y=="TO_VALUE");  
+//trace(num1); // invoke num1.toString(), output TO_STRING
 
 //
 //Testing toString and valueOf of String
@@ -149,7 +150,8 @@
 xcheck(typeof(str3) == "string");
 //valueOf called
 check(str3 == "TO_VALUETO_VALUE"); 
-//trace a string won't invoke the toString method
+// trace a string Object won't invoke the toString method.
+// I don't think it's a bug.
 //trace(str1); //output 10 !
 
 x = str1.toString();
@@ -189,8 +191,8 @@
   check(y == undefined); 
 #endif
 check(y == _level0.mc1);  
-//trace a movieclip doesn't invoke the toString method
-//trace(mc1); //_level0.mc
+//trace a movieclip doesn't invoke the toString method, either.
+//trace(mc1); //output _level0.mc
 
 MovieClip.prototype.toString = function () {return "TO_STRING";};
 MovieClip.prototype.valueOf = function () {return "TO_VALUE";};
@@ -284,7 +286,7 @@
 xcheck(typeof(y.valueOf()) == "object");  
 xcheck(typeof(btn1) == "object");
 check(y == btn1);
-//trace(btn1); //output [object Object]
+//trace(btn1); // invoke btn1.toString(), output [object Object]
 
 //
 //Testing toString and valueOf of Boolean
@@ -306,6 +308,7 @@
 check(typeof(y) == "boolean");  
 check(x == "false");
 check(y == false);
+//trace(b1); // invoke b1.toString(), output false 
 
 b2 = new Boolean(true);
 b3 = b1 + b2;
@@ -373,6 +376,7 @@
 check(typeof(y) == "object");   
 check(x == "1,2,3,4");  
 check(y == a1);        
+//trace(a1); // invoke a1.toString(), output 1,2,3,4     
 
 a2 = new Array(2,3,4,5);
 a3 = a1 + a2;

Index: testsuite/misc-ming.all/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/Makefile.am,v
retrieving revision 1.145
retrieving revision 1.146
diff -u -b -r1.145 -r1.146
--- testsuite/misc-ming.all/Makefile.am 31 Jul 2007 04:01:33 -0000      1.145
+++ testsuite/misc-ming.all/Makefile.am 16 Aug 2007 06:09:14 -0000      1.146
@@ -107,6 +107,7 @@
        attachMovieLoopingTestRunner \
        registerClassTest \
        registerClassTestRunner \
+       registerClassTest2 \
        goto_frame_test \
        consecutive_goto_frame_test \
        matrix_test \
@@ -232,6 +233,7 @@
        loop_test7runner \
        loop_test8runner \
        shape_testrunner \
+       registerClassTest2runner \
        $(NULL)
 
 if MAKESWF_SUPPORTS_PREBUILT_CLIPS
@@ -1277,6 +1279,18 @@
        $(top_builddir)/testsuite/libtestsuite.la \
        $(NULL)
 
+registerClassTest2_SOURCES =   \
+       registerClassTest2.c    \
+       $(NULL)
+registerClassTest2_LDADD = libgnashmingutils.la
+
+registerClassTest2.swf: registerClassTest2
+       ./registerClassTest2 $(top_srcdir)/testsuite/media
+
+registerClassTest2runner: $(srcdir)/../generic-testrunner.sh 
registerClassTest2.swf
+       sh $< $(top_builddir) registerClassTest2.swf > $@
+       chmod 755 $@
+
 spritehier.swf: spritehier
        ./spritehier
 
@@ -1652,6 +1666,7 @@
        loop_test8runner \
        shape_testrunner \
        morph_test1runner \
+       registerClassTest2runner \
        $(NULL)
 
 if MAKESWF_SUPPORTS_PREBUILT_CLIPS

Index: testsuite/misc-ming.all/registerClassTest.c
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/registerClassTest.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- testsuite/misc-ming.all/registerClassTest.c 1 Jul 2007 10:55:01 -0000       
1.4
+++ testsuite/misc-ming.all/registerClassTest.c 16 Aug 2007 06:09:14 -0000      
1.5
@@ -91,7 +91,6 @@
  
        mo = newSWFMovie();
        SWFMovie_setRate(mo, 12);
-       //SWFMovie_setDimension(mo, 6400, 4000);
        SWFMovie_setDimension(mo, 640, 400);
 
        /*********************************************

Index: testsuite/misc-ming.all/registerClassTest2.c
===================================================================
RCS file: testsuite/misc-ming.all/registerClassTest2.c
diff -N testsuite/misc-ming.all/registerClassTest2.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ testsuite/misc-ming.all/registerClassTest2.c        16 Aug 2007 06:09:15 
-0000      1.1
@@ -0,0 +1,137 @@
+/* 
+ *   Copyright (C) 2005, 2006 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
+ *
+ *
+ */ 
+
+/*
+ *     zou lunkai,  address@hidden
+ *  
+ *  Testcase for Object.registerClass().
+ *
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <ming.h>
+
+#include "ming_utils.h"
+
+#define OUTPUT_VERSION 6
+#define OUTPUT_FILENAME "registerClassTest2.swf"
+
+void addExport(SWFMovie mo, SWFMovieClip mc, const char * name);
+
+void
+addExport(SWFMovie mo, SWFMovieClip mc, const char * name)
+{
+  SWFMovie_addExport(mo, (SWFBlock)mc, name);
+  SWFMovie_writeExports(mo);
+}
+
+int
+main(int argc, char** argv)
+{
+  SWFMovie mo;
+  SWFMovieClip  mc1, mc2, dejagnuclip;
+  SWFShape  sh1, sh2;
+  SWFDisplayItem it1, it2;
+  const char *srcdir=".";
+
+  if ( argc>1 ) srcdir=argv[1];
+  else
+  {
+    fprintf(stderr, "Usage: %s\n", argv[0]);
+    return 1;
+  }
+
+  Ming_init();
+  Ming_useSWFVersion (OUTPUT_VERSION);
+  Ming_setScale(20.0); /* let's talk pixels */
+ 
+  mo = newSWFMovie();
+  SWFMovie_setRate(mo, 12);
+  SWFMovie_setDimension(mo, 640, 400);
+
+  // add the dejagnuclip for testing
+  dejagnuclip = get_dejagnu_clip((SWFBlock)get_default_font(srcdir), 10, 0, 
80, 800, 600);
+  SWFMovie_add(mo, (SWFBlock)dejagnuclip);
+  
+  // define two movieClips
+  
+  mc1 = newSWFMovieClip();
+  sh1 = make_fill_square (100, 100, 60, 60, 255, 0, 0, 255, 0, 0);
+  SWFMovieClip_add(mc1, (SWFBlock)sh1); 
+  SWFMovieClip_nextFrame(mc1);
+  
+  mc2 = newSWFMovieClip();
+  sh2 = make_fill_square (100, 100, 60, 60, 255, 255, 0, 255, 255, 0);
+  SWFMovieClip_add(mc2, (SWFBlock)sh2); 
+  SWFMovieClip_nextFrame(mc2);
+  
+  // export them
+  addExport(mo, mc1, "libItem1");
+  addExport(mo, mc2, "libItem2");  
+  SWFMovie_nextFrame(mo);  /* end of frame1 */
+  
+
+  add_actions(mo,
+    "theClass1 = function() { this.x = 60;};"
+    "theClass1.prototype = new MovieClip();"
+    "theClass2 = function() { this.x = 600; this._x = 200;}; "
+    "Object.registerClass('libItem1', theClass1);"
+    "Object.registerClass('libItem2', theClass2);"
+    "_root.attachMovie('libItem1', 'clip1', 10);"
+    "_root.attachMovie('libItem2', 'clip2', 20);"
+    );
+
+  check_equals(mo, "typeof(clip1)", "'movieclip'");
+  check_equals(mo, "typeof(clip2)", "'movieclip'");
+  check_equals(mo, "clip1.__proto__", "theClass1.prototype");
+  check_equals(mo, "clip2.__proto__", "theClass2.prototype");
+#if OUTPUT_VERSION > 6
+  // succeed in swf7 and swf8
+  check_equals(mo, "clip1.constructor", "MovieClip");
+#else if OUTPUT_VERSION == 6
+  xcheck_equals(mo, "clip1.constructor", "theClass1");
+#endif
+  xcheck_equals(mo, "clip1.__constructor__", "theClass1");
+  check_equals(mo, "clip2.constructor", "theClass2");
+  xcheck_equals(mo, "clip2.__constructor__", "theClass2");
+  check_equals(mo, "clip1.x", "60");
+  check_equals(mo, "clip2.x", "600");
+  check_equals(mo, "clip1._x", "0");
+  check_equals(mo, "clip2._x", "200");
+  check_equals(mo, "typeof(MovieClip.prototype.getDepth)", "'function'");
+  check_equals(mo, "clip1.getDepth()", "10");
+  // clip2 does not inherit MovieClip
+  check_equals(mo, "clip2.getDepth()", "undefined");
+
+  add_actions(mo, "totals(); stop();");
+  SWFMovie_nextFrame(mo); /* end of frame2 */
+
+ /*****************************************************
+  *
+  * 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]