gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/asobj/Selection.cpp test...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/asobj/Selection.cpp test...
Date: Fri, 12 Jan 2007 09:53:58 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/01/12 09:53:58

Modified files:
        .              : ChangeLog 
        server/asobj   : Selection.cpp 
        testsuite/actionscript.all: Selection.as 

Log message:
                * testsuite/actionscript.all/Selection.as: _global.Seleciton is
                  an object, not a class. Use typeof() for stricter checking.
                * server/asobj/Selection.cpp: fix case of methods, make 
Selection
                  an object, not a class.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2093&r2=1.2094
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Selection.cpp?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/Selection.as?cvsroot=gnash&r1=1.7&r2=1.8

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2093
retrieving revision 1.2094
diff -u -b -r1.2093 -r1.2094
--- ChangeLog   12 Jan 2007 09:35:58 -0000      1.2093
+++ ChangeLog   12 Jan 2007 09:53:58 -0000      1.2094
@@ -1,5 +1,9 @@
 2007-01-12 Sandro Santilli <address@hidden>
 
+       * testsuite/actionscript.all/Selection.as: _global.Seleciton is
+         an object, not a class. Use typeof() for stricter checking.
+       * server/asobj/Selection.cpp: fix case of methods, make Selection
+         an object, not a class.
        * testsuite/actionscript.all/NetStream.as: don't check unavailability
          of the class based on SWF version as the player is allowed to
          provide new classes reguardless of it. Use typeof to strictly check

Index: server/asobj/Selection.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Selection.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- server/asobj/Selection.cpp  20 Nov 2006 21:38:11 -0000      1.3
+++ server/asobj/Selection.cpp  12 Jan 2007 09:53:58 -0000      1.4
@@ -42,14 +42,14 @@
 static void
 attachSelectionInterface(as_object& o)
 {
-       o.set_member("addlistener", &selection_addlistener);
-       o.set_member("getbeginindex", &selection_getbeginindex);
-       o.set_member("getcaretindex", &selection_getcaretindex);
-       o.set_member("getendindex", &selection_getendindex);
-       o.set_member("getfocus", &selection_getfocus);
-       o.set_member("removelistener", &selection_removelistener);
-       o.set_member("setfocus", &selection_setfocus);
-       o.set_member("setselection", &selection_setselection);
+       o.set_member("addListener", &selection_addlistener);
+       o.set_member("getBeginIndex", &selection_getbeginindex);
+       o.set_member("getCaretIndex", &selection_getcaretindex);
+       o.set_member("getEndIndex", &selection_getendindex);
+       o.set_member("getFocus", &selection_getfocus);
+       o.set_member("removeListener", &selection_removelistener);
+       o.set_member("setFocus", &selection_setfocus);
+       o.set_member("setSelection", &selection_setselection);
 }
 
 static as_object*
@@ -115,22 +115,14 @@
 }
 
 // extern (used by Global.cpp)
-void selection_class_init(as_object& global)
+void
+selection_class_init(as_object& global)
 {
-       // This is going to be the global Selection "class"/"function"
-       static boost::intrusive_ptr<builtin_function> cl;
-
-       if ( cl == NULL )
-       {
-               cl=new builtin_function(&selection_ctor, 
getSelectionInterface());
-               // replicate all interface to class, to be able to access
-               // all methods as static functions
-               attachSelectionInterface(*cl);
-                    
-       }
+       // Selection is NOT a class, but a simple object, see Selection.as
 
-       // Register _global.Selection
-       global.set_member("Selection", cl.get());
+       static boost::intrusive_ptr<as_object> obj = new as_object();
+       attachSelectionInterface(*obj);
+       global.set_member("Selection", obj.get());
 
 }
 

Index: testsuite/actionscript.all/Selection.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/Selection.as,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- testsuite/actionscript.all/Selection.as     5 Nov 2006 00:45:27 -0000       
1.7
+++ testsuite/actionscript.all/Selection.as     12 Jan 2007 09:53:58 -0000      
1.8
@@ -20,28 +20,46 @@
 // compile this test case with Ming makeswf, and then
 // execute it like this gnash -1 -r 0 -v out.swf
 
-rcsid="$Id: Selection.as,v 1.7 2006/11/05 00:45:27 rsavoye Exp $";
+rcsid="$Id: Selection.as,v 1.8 2007/01/12 09:53:58 strk Exp $";
 
 #include "check.as"
 
-var selectionObj = new Selection;
+//-------------------------------
+// Selection was added in SWF5
+//-------------------------------
+
+check_equals (typeof(Selection), 'object');
 
-// test the Selection constuctor
-check (selectionObj != undefined);
+// Selection is an obect, not a class !
+var selectionObj = new Selection;
+check_equals (typeof(selectionObj), 'undefined');
 
-// test the Selection::addlistener method
-check (selectionObj.addlistener != undefined);
 // test the Selection::getbeginindex method
-check (selectionObj.getbeginindex != undefined);
+check_equals (typeof(Selection.getBeginIndex), 'function');
+
 // test the Selection::getcaretindex method
-check (selectionObj.getcaretindex != undefined);
+check_equals (typeof(Selection.getCaretIndex), 'function');
+
 // test the Selection::getendindex method
-check (selectionObj.getendindex != undefined);
+check_equals (typeof(Selection.getEndIndex), 'function');
+
 // test the Selection::getfocus method
-check (selectionObj.getfocus != undefined);
-// test the Selection::removelistener method
-check (selectionObj.removelistener != undefined);
+check_equals (typeof(Selection.getFocus), 'function');
+
 // test the Selection::setfocus method
-check (selectionObj.setfocus != undefined);
-// test the Selection::set method
-xcheck (selectionObj.set != undefined);
+check_equals (typeof(Selection.setFocus), 'function');
+
+// test the Selection::setSelection method
+check_equals (typeof(Selection.setSelection), 'function'); 
+
+// Methods added in version 6
+#if OUTPUT_VERSION >= 6
+
+// test the Selection::addListener method
+check_equals (typeof(Selection.addListener), 'function');
+
+// test the Selection::removeListener method
+check_equals (typeof(Selection.removeListener), 'function'); 
+
+#endif // OUTPUT_VERSION >= 6
+




reply via email to

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