gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/asobj/flash/geom/Point_a...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/asobj/flash/geom/Point_a...
Date: Wed, 07 May 2008 08:03:40 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  08/05/07 08:03:40

Modified files:
        .              : ChangeLog 
        server/asobj/flash/geom: Point_as.cpp Point_as.h 
                                 Rectangle_as.cpp 
        testsuite/actionscript.all: Makefile.am Rectangle.as 
Added files:
        testsuite/actionscript.all: Point.as 

Log message:
        * server/asobj/flash/geom/Point_as.{cpp,h}: implement constructor,
          toString and length; load on demand; expose constructor for internal
          use.
        * server/asobj/flash/geom/Rectangle_as.cpp: implement topLeft,
          bottomRight, size and clone; load on demand.
        * testsuite/actionscript.all/: Makefile.am, Point.as: new stub
          for testing flash.geom.Point (only tests ctor, length and toString).
        * testsuite/actionscript.all/Rectangle.as: more tests, all successes.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6534&r2=1.6535
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/flash/geom/Point_as.cpp?cvsroot=gnash&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/flash/geom/Point_as.h?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/flash/geom/Rectangle_as.cpp?cvsroot=gnash&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/Makefile.am?cvsroot=gnash&r1=1.90&r2=1.91
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/Rectangle.as?cvsroot=gnash&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/Point.as?cvsroot=gnash&rev=1.1

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6534
retrieving revision 1.6535
diff -u -b -r1.6534 -r1.6535
--- ChangeLog   7 May 2008 03:40:43 -0000       1.6534
+++ ChangeLog   7 May 2008 08:03:39 -0000       1.6535
@@ -1,3 +1,14 @@
+2008-05-07 Sandro Santilli <address@hidden>
+
+       * server/asobj/flash/geom/Point_as.{cpp,h}: implement constructor,
+         toString and length; load on demand; expose constructor for internal
+         use.
+       * server/asobj/flash/geom/Rectangle_as.cpp: implement topLeft,
+         bottomRight, size and clone; load on demand.
+       * testsuite/actionscript.all/: Makefile.am, Point.as: new stub
+         for testing flash.geom.Point (only tests ctor, length and toString).
+       * testsuite/actionscript.all/Rectangle.as: more tests, all successes.
+
 2008-05-07 Zou Lunkai <address@hidden>
 
        * testsuite/media/empty_swf.swf: add a new binary empty swf file for 
testing

Index: server/asobj/flash/geom/Point_as.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/flash/geom/Point_as.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- server/asobj/flash/geom/Point_as.cpp        5 May 2008 18:53:32 -0000       
1.5
+++ server/asobj/flash/geom/Point_as.cpp        7 May 2008 08:03:40 -0000       
1.6
@@ -43,8 +43,6 @@
 static as_value Point_subtract(const fn_call& fn);
 static as_value Point_toString(const fn_call& fn);
 static as_value Point_length_getset(const fn_call& fn);
-static as_value Point_x_getset(const fn_call& fn);
-static as_value Point_y_getset(const fn_call& fn);
 
 static as_value Point_distance(const fn_call& fn);
 static as_value Point_interpolate(const fn_call& fn);
@@ -55,16 +53,16 @@
 static void
 attachPointInterface(as_object& o)
 {
-    o.init_member("add", new builtin_function(Point_add));
-    o.init_member("clone", new builtin_function(Point_clone));
-    o.init_member("equals", new builtin_function(Point_equals));
-    o.init_member("normalize", new builtin_function(Point_normalize));
-    o.init_member("offset", new builtin_function(Point_offset));
-    o.init_member("subtract", new builtin_function(Point_subtract));
-    o.init_member("toString", new builtin_function(Point_toString));
-    o.init_property("length", Point_length_getset, Point_length_getset);
-    o.init_property("x", Point_x_getset, Point_x_getset);
-    o.init_property("y", Point_y_getset, Point_y_getset);
+    int fl=0; // flags...
+
+    o.init_member("add", new builtin_function(Point_add), fl);
+    o.init_member("clone", new builtin_function(Point_clone), fl);
+    o.init_member("equals", new builtin_function(Point_equals), fl);
+    o.init_member("normalize", new builtin_function(Point_normalize), fl);
+    o.init_member("offset", new builtin_function(Point_offset), fl);
+    o.init_member("subtract", new builtin_function(Point_subtract), fl);
+    o.init_member("toString", new builtin_function(Point_toString), fl);
+    o.init_property("length", Point_length_getset, Point_length_getset, fl);
 }
 
 static void
@@ -171,39 +169,52 @@
 Point_toString(const fn_call& fn)
 {
        boost::intrusive_ptr<Point_as> ptr = ensureType<Point_as>(fn.this_ptr);
-       UNUSED(ptr);
-       LOG_ONCE( log_unimpl (__FUNCTION__) );
-       return as_value();
+
+       as_value x, y;
+       ptr->get_member(NSV::PROP_X, &x);
+       ptr->get_member(NSV::PROP_Y, &y);
+
+       std::stringstream ss;
+       ss << "(x=" << x.to_string()
+               << ", y=" << y.to_string()
+               << ")";
+
+       return as_value(ss.str());
 }
 
 static as_value
 Point_length_getset(const fn_call& fn)
 {
        boost::intrusive_ptr<Point_as> ptr = ensureType<Point_as>(fn.this_ptr);
-       UNUSED(ptr);
-       LOG_ONCE( log_unimpl (__FUNCTION__) );
-       return as_value();
-}
 
-static as_value
-Point_x_getset(const fn_call& fn)
-{
-       boost::intrusive_ptr<Point_as> ptr = ensureType<Point_as>(fn.this_ptr);
-       UNUSED(ptr);
-       LOG_ONCE( log_unimpl (__FUNCTION__) );
-       return as_value();
-}
+       if ( ! fn.nargs ) // getter
+       {
+               as_value xval, yval;
+               ptr->get_member(NSV::PROP_X, &xval);
+               ptr->get_member(NSV::PROP_Y, &yval);
+               double x = xval.to_number();
+               if ( ! isfinite(x) ) return as_value(NAN);
+               double y = yval.to_number();
+               if ( ! isfinite(y) ) return as_value(NAN);
 
-static as_value
-Point_y_getset(const fn_call& fn)
-{
-       boost::intrusive_ptr<Point_as> ptr = ensureType<Point_as>(fn.this_ptr);
-       UNUSED(ptr);
-       LOG_ONCE( log_unimpl (__FUNCTION__) );
-       return as_value();
+               double l = sqrt(x*x+y*y);
+               return as_value(l);
+       }
+       else // setter
+       {
+               IF_VERBOSE_ASCODING_ERRORS(
+               log_aserror(_("Attempt to set read-only property %s"), 
"Point.length");
+               );
+               return as_value();
+               as_value y;
+               ptr->get_member(NSV::PROP_Y, &y);
+
+               as_value bottom = fn.arg(0);
+               as_value newh = bottom.subtract(y);
+               ptr->set_member(NSV::PROP_HEIGHT, newh);
+       }
 }
 
-
 static as_value
 Point_distance(const fn_call& fn)
 {
@@ -237,27 +248,61 @@
 {
        boost::intrusive_ptr<as_object> obj = new Point_as;
 
-       if ( fn.nargs )
+       as_value x;
+       as_value y;
+
+       if ( ! fn.nargs )
        {
+               x.set_double(0);
+               y.set_double(0);
+       }
+       else
+       {
+               do {
+                       x = fn.arg(0);
+                       if ( fn.nargs < 2 ) break;
+                       y = fn.arg(1);
+                       if ( fn.nargs < 3 ) break;
+                       IF_VERBOSE_ASCODING_ERRORS(
                std::stringstream ss;
                fn.dump_args(ss);
-               LOG_ONCE( log_unimpl("Point(%s): %s", ss.str(), _("arguments 
discarded")) );
+                               log_aserror("flash.geom.Point(%s): %s", 
ss.str(), _("arguments after the first two discarded"));
+                       );
+               } while(0);
        }
 
+       obj->set_member(NSV::PROP_X, x);
+       obj->set_member(NSV::PROP_Y, y);
+
        return as_value(obj.get()); // will keep alive
 }
 
 // extern 
-void Point_class_init(as_object& where)
+as_function* getFlashGeomPointConstructor()
 {
-       // This is going to be the Point "class"/"function"
-       // in the 'where' package
-       boost::intrusive_ptr<builtin_function> cl;
+       static builtin_function* cl=NULL;
+       if ( ! cl )
+       {
        cl=new builtin_function(&Point_ctor, getPointInterface());
+               VM::get().addStatic(cl);
        attachPointStaticProperties(*cl);
+       }
+       return cl;
+}
+
+static as_value get_flash_geom_point_constructor(const fn_call& /*fn*/)
+{
+       log_debug("Loading flash.geom.Point class");
 
+       return getFlashGeomPointConstructor();
+}
+
+// extern 
+void Point_class_init(as_object& where)
+{
        // Register _global.Point
-       where.init_member("Point", cl.get());
+       string_table& st = where.getVM().getStringTable();
+       where.init_destructive_property(st.find("Point"), 
get_flash_geom_point_constructor);
 }
 
 } // end of gnash namespace

Index: server/asobj/flash/geom/Point_as.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/flash/geom/Point_as.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- server/asobj/flash/geom/Point_as.h  5 May 2008 08:57:32 -0000       1.1
+++ server/asobj/flash/geom/Point_as.h  7 May 2008 08:03:40 -0000       1.2
@@ -29,6 +29,7 @@
 namespace gnash {
 
 class as_object;
+class as_function;
 
 /// Initialize the global Point class
 void Point_class_init(as_object& global);
@@ -36,6 +37,9 @@
 /// Return a Point instance (in case the core lib needs it)
 //std::auto_ptr<as_object> init_Point_instance();
 
+/// Return the Point constructor, for use by Rectangle 
+as_function* getFlashGeomPointConstructor();
+
 } // end of gnash namespace
 
 // __GNASH_ASOBJ_POINT_H__

Index: server/asobj/flash/geom/Rectangle_as.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/flash/geom/Rectangle_as.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- server/asobj/flash/geom/Rectangle_as.cpp    5 May 2008 21:02:01 -0000       
1.6
+++ server/asobj/flash/geom/Rectangle_as.cpp    7 May 2008 08:03:40 -0000       
1.7
@@ -22,6 +22,7 @@
 #endif
 
 #include "Rectangle_as.h"
+#include "Point_as.h"
 #include "as_object.h" // for inheritance
 #include "log.h"
 #include "fn_call.h"
@@ -136,9 +137,22 @@
 Rectangle_clone(const fn_call& fn)
 {
        boost::intrusive_ptr<Rectangle_as> ptr = 
ensureType<Rectangle_as>(fn.this_ptr);
-       UNUSED(ptr);
-       LOG_ONCE( log_unimpl (__FUNCTION__) );
-       return as_value();
+
+       as_value x, y, w, h;
+
+       ptr->get_member(NSV::PROP_X, &x);
+       ptr->get_member(NSV::PROP_Y, &y);
+       ptr->get_member(NSV::PROP_WIDTH, &w);
+       ptr->get_member(NSV::PROP_HEIGHT, &h);
+
+       boost::intrusive_ptr<as_object> obj = new Rectangle_as;
+
+       obj->set_member(NSV::PROP_X, x);
+       obj->set_member(NSV::PROP_Y, y);
+       obj->set_member(NSV::PROP_WIDTH, w);
+       obj->set_member(NSV::PROP_HEIGHT, h);
+
+       return as_value(obj.get()); // will keep alive
 }
 
 static as_value
@@ -326,9 +340,38 @@
 Rectangle_bottomRight_getset(const fn_call& fn)
 {
        boost::intrusive_ptr<Rectangle_as> ptr = 
ensureType<Rectangle_as>(fn.this_ptr);
-       UNUSED(ptr);
-       LOG_ONCE( log_unimpl (__FUNCTION__) );
-       return as_value();
+
+       as_value ret;
+
+       if ( ! fn.nargs ) // getter
+       {
+               as_value x,y,w,h;
+               ptr->get_member(NSV::PROP_X, &x);
+               ptr->get_member(NSV::PROP_Y, &y);
+               ptr->get_member(NSV::PROP_WIDTH, &w);
+               ptr->get_member(NSV::PROP_HEIGHT, &h);
+
+               as_value right = x.newAdd(w);
+               as_value bottom = y.newAdd(h);
+
+               as_function* pointCtor = getFlashGeomPointConstructor();
+
+               as_environment& env = fn.env();
+               env.push(bottom);
+               env.push(right);
+
+               ret = pointCtor->constructInstance(env, 2, env.stack_size()-1);
+
+               env.drop(2);
+       }
+       else // setter
+       {
+               IF_VERBOSE_ASCODING_ERRORS(
+               log_aserror(_("Attempt to set read-only property %s"), 
"Rectangle.bottomRight");
+               );
+       }
+
+       return ret;
 }
 
 static as_value
@@ -391,9 +434,33 @@
 Rectangle_size_getset(const fn_call& fn)
 {
        boost::intrusive_ptr<Rectangle_as> ptr = 
ensureType<Rectangle_as>(fn.this_ptr);
-       UNUSED(ptr);
-       LOG_ONCE( log_unimpl (__FUNCTION__) );
-       return as_value();
+
+       as_value ret;
+
+       if ( ! fn.nargs ) // getter
+       {
+               as_value w,h;
+               ptr->get_member(NSV::PROP_WIDTH, &w);
+               ptr->get_member(NSV::PROP_HEIGHT, &h);
+
+               as_function* pointCtor = getFlashGeomPointConstructor();
+
+               as_environment& env = fn.env();
+               env.push(h);
+               env.push(w);
+
+               ret = pointCtor->constructInstance(env, 2, env.stack_size()-1);
+
+               env.drop(2);
+       }
+       else // setter
+       {
+               IF_VERBOSE_ASCODING_ERRORS(
+               log_aserror(_("Attempt to set read-only property %s"), 
"Rectangle.size");
+               );
+       }
+
+       return ret;
 }
 
 static as_value
@@ -429,9 +496,33 @@
 Rectangle_topLeft_getset(const fn_call& fn)
 {
        boost::intrusive_ptr<Rectangle_as> ptr = 
ensureType<Rectangle_as>(fn.this_ptr);
-       UNUSED(ptr);
-       LOG_ONCE( log_unimpl (__FUNCTION__) );
-       return as_value();
+
+       as_value ret;
+
+       if ( ! fn.nargs ) // getter
+       {
+               as_value x,y;
+               ptr->get_member(NSV::PROP_X, &x);
+               ptr->get_member(NSV::PROP_Y, &y);
+
+               as_function* pointCtor = getFlashGeomPointConstructor();
+
+               as_environment& env = fn.env();
+               env.push(y);
+               env.push(x);
+
+               ret = pointCtor->constructInstance(env, 2, env.stack_size()-1);
+
+               env.drop(2);
+       }
+       else // setter
+       {
+               IF_VERBOSE_ASCODING_ERRORS(
+               log_aserror(_("Attempt to set read-only property %s"), 
"Rectangle.topLeft");
+               );
+       }
+
+       return ret;
 }
 
 
@@ -480,17 +571,21 @@
        return as_value(obj.get()); // will keep alive
 }
 
-// extern 
-void Rectangle_class_init(as_object& where)
+static as_value get_flash_geom_rectangle_constructor(const fn_call& /*fn*/)
 {
-       // This is going to be the Rectangle "class"/"function"
-       // in the 'where' package
-       boost::intrusive_ptr<builtin_function> cl;
-       cl=new builtin_function(&Rectangle_ctor, getRectangleInterface());
+       log_debug("Loading flash.geom.Rectangle class");
+
+       builtin_function* cl=new builtin_function(&Rectangle_ctor, 
getRectangleInterface());
        attachRectangleStaticProperties(*cl);
+       return cl;
+}
 
+// extern 
+void Rectangle_class_init(as_object& where)
+{
        // Register _global.Rectangle
-       where.init_member("Rectangle", cl.get());
+       string_table& st = where.getVM().getStringTable();
+       where.init_destructive_property(st.find("Rectangle"), 
get_flash_geom_rectangle_constructor);
 }
 
 } // end of gnash namespace

Index: testsuite/actionscript.all/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/Makefile.am,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -b -r1.90 -r1.91
--- testsuite/actionscript.all/Makefile.am      5 May 2008 21:02:02 -0000       
1.90
+++ testsuite/actionscript.all/Makefile.am      7 May 2008 08:03:40 -0000       
1.91
@@ -121,6 +121,7 @@
        ops.as                  \
        toString_valueOf.as     \
        Rectangle.as            \
+       Point.as                \
        $(NULL)
 
 ASTESTS_OUT = $(ASTESTS:.as=.swf)

Index: testsuite/actionscript.all/Rectangle.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/Rectangle.as,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- testsuite/actionscript.all/Rectangle.as     5 May 2008 21:02:02 -0000       
1.1
+++ testsuite/actionscript.all/Rectangle.as     7 May 2008 08:03:40 -0000       
1.2
@@ -20,7 +20,7 @@
 // compile this test case with Ming makeswf, and then
 // execute it like this gnash -1 -r 0 -v out.swf
 
-rcsid="$Id: Rectangle.as,v 1.1 2008/05/05 21:02:02 strk Exp $";
+rcsid="$Id: Rectangle.as,v 1.2 2008/05/07 08:03:40 strk Exp $";
 
 #include "check.as"
 
@@ -166,26 +166,39 @@
 //-------------------------------------------------------------
 
 r0 = new Rectangle('x', 'y', 'w', 'h');
-xcheck(r0.bottomRight instanceof flash.geom.Point);
-xcheck(r0.topLeft instanceof flash.geom.Point);
-xcheck_equals(''+r0.bottomRight, '(x=xw, y=yh)');
-xcheck_equals(''+r0.topLeft, '(x=x, y=y)');
+check(r0.bottomRight instanceof flash.geom.Point);
+check(r0.topLeft instanceof flash.geom.Point);
+check_equals(''+r0.bottomRight, '(x=xw, y=yh)');
+check_equals(''+r0.topLeft, '(x=x, y=y)');
+
+ASSetPropFlags(r0, "bottomRight", 0, 4); // clear read-only (if any)
+r0.bottomRight = 4;
+check_equals(typeof(r0.bottomRight), 'object');
+
+ASSetPropFlags(r0, "topLeft", 0, 4); // clear read-only (if any)
+r0.topLeft = 4;
+check_equals(typeof(r0.topLeft), 'object');
 
 //-------------------------------------------------------------
 // Test size
 //-------------------------------------------------------------
 
 r0 = new Rectangle('x', 'y', 'w', 'h');
-xcheck(r0.size instanceof flash.geom.Point);
-xcheck_equals(''+r0.size, '(x=w, y=h)');
+check(r0.size instanceof flash.geom.Point);
+check_equals(''+r0.size, '(x=w, y=h)');
+ASSetPropFlags(r0, "size", 0, 4); // clear read-only (if any)
+r0.size = 4;
+check_equals(typeof(r0.topLeft), 'object');
 
 //-------------------------------------------------------------
 // Test clone
 //-------------------------------------------------------------
 
 r0 = new Rectangle('x', 'y', 'w', 'h');
+r0.custom = 4;
 r2 = r0.clone();
-xcheck_equals(r2.toString(), '(x=x, y=y, w=w, h=h)');
+check_equals(r2.toString(), '(x=x, y=y, w=w, h=h)');
+check_equals(r2.custom, undefined);
 
 //-------------------------------------------------------------
 // Test contains
@@ -263,6 +276,6 @@
 // END OF TEST
 //-------------------------------------------------------------
 
-check_totals(92);
+check_totals(96);
 
 #endif // OUTPUT_VERSION >= 8

Index: testsuite/actionscript.all/Point.as
===================================================================
RCS file: testsuite/actionscript.all/Point.as
diff -N testsuite/actionscript.all/Point.as
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ testsuite/actionscript.all/Point.as 7 May 2008 08:03:40 -0000       1.1
@@ -0,0 +1,151 @@
+// 
+//   Copyright (C) 2008 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 case for TextFormat ActionScript class
+// compile this test case with Ming makeswf, and then
+// execute it like this gnash -1 -r 0 -v out.swf
+
+rcsid="$Id: Point.as,v 1.1 2008/05/07 08:03:40 strk Exp $";
+
+#include "check.as"
+
+#if OUTPUT_VERSION < 8
+
+check_equals(typeof(flash), 'undefined');
+
+check_totals(1);
+
+#else
+
+Point = flash.geom.Point;
+check_equals(typeof(Point), 'function');
+check_equals(typeof(Point.prototype), 'object');
+check(Point.prototype.hasOwnProperty('length'));
+check(!Point.prototype.hasOwnProperty('x'));
+check(!Point.prototype.hasOwnProperty('y'));
+check(Point.prototype.hasOwnProperty('add'));
+check(Point.prototype.hasOwnProperty('clone'));
+check(!Point.prototype.hasOwnProperty('distance'));
+check(Point.hasOwnProperty('distance'));
+check(Point.prototype.hasOwnProperty('equals'));
+check(!Point.prototype.hasOwnProperty('interpolate'));
+check(Point.hasOwnProperty('interpolate'));
+check(Point.prototype.hasOwnProperty('normalize'));
+check(Point.prototype.hasOwnProperty('offset'));
+check(!Point.prototype.hasOwnProperty('polar'));
+check(Point.hasOwnProperty('polar'));
+check(Point.prototype.hasOwnProperty('subtract'));
+check(Point.prototype.hasOwnProperty('toString'));
+
+//-------------------------------------------------------------
+// Test constructor (and x, y, length)
+//-------------------------------------------------------------
+
+p0 = new Point();
+check_equals(typeof(p0), 'object');
+check(p0 instanceof Point);
+check(p0.hasOwnProperty('x'));
+check(p0.hasOwnProperty('y'));
+check_equals(''+p0, '(x=0, y=0)');
+check_equals(typeof(p0.x), 'number');
+check_equals(typeof(p0.y), 'number');
+check_equals(typeof(p0.length), 'number');
+check_equals(p0.length, 0);
+
+a = []; for (var i in p0) a.push(i);
+check_equals(a.length, 10); // most of them...
+
+p0 = new Point('x', 'y');
+check_equals(''+p0, '(x=x, y=y)');
+check_equals(typeof(p0.x), 'string');
+check_equals(typeof(p0.y), 'string');
+check_equals(typeof(p0.length), 'number');
+check(isNaN(p0.length));
+p0.x = 1;
+check(isNaN(p0.length));
+p0.y = 0;
+check_equals(p0.length, 1);
+
+p0 = new Point(3, 4);
+check_equals(p0.length, 5);
+
+ASSetPropFlags(p0, "length", 0, 4); // clear read-only (if any)
+p0.length = 10;
+check_equals(p0.length, 5);
+
+//-------------------------------------------------------------
+// Test Point.add
+//-------------------------------------------------------------
+
+// TODO
+
+//-------------------------------------------------------------
+// Test Point.clone
+//-------------------------------------------------------------
+
+// TODO
+
+//-------------------------------------------------------------
+// Test Point.distance (static)
+//-------------------------------------------------------------
+
+// TODO
+
+//-------------------------------------------------------------
+// Test Point.equals
+//-------------------------------------------------------------
+
+// TODO
+
+//-------------------------------------------------------------
+// Test Point.interpolate (static)
+//-------------------------------------------------------------
+
+// TODO
+
+//-------------------------------------------------------------
+// Test Point.normalize
+//-------------------------------------------------------------
+
+// TODO
+
+//-------------------------------------------------------------
+// Test Point.offset
+//-------------------------------------------------------------
+
+// TODO
+
+//-------------------------------------------------------------
+// Test Point.polar (static)
+//-------------------------------------------------------------
+
+// TODO
+
+//-------------------------------------------------------------
+// Test Point.subtract
+//-------------------------------------------------------------
+
+// TODO
+
+//-------------------------------------------------------------
+// END OF TEST
+//-------------------------------------------------------------
+
+check_totals(37);
+
+#endif // OUTPUT_VERSION >= 8




reply via email to

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