[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/edit_text_character.cpp ...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog server/edit_text_character.cpp ... |
Date: |
Wed, 19 Dec 2007 09:40:54 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 07/12/19 09:40:54
Modified files:
. : ChangeLog
server : edit_text_character.cpp sprite_instance.cpp
testsuite/actionscript.all: TextField.as
Log message:
Make createTextField calls more correct (tolerant) - fixed bug #21829.
Implement TextField.getDepth()
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5217&r2=1.5218
http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.cpp?cvsroot=gnash&r1=1.137&r2=1.138
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.415&r2=1.416
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/TextField.as?cvsroot=gnash&r1=1.35&r2=1.36
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5217
retrieving revision 1.5218
diff -u -b -r1.5217 -r1.5218
--- ChangeLog 19 Dec 2007 05:42:29 -0000 1.5217
+++ ChangeLog 19 Dec 2007 09:40:53 -0000 1.5218
@@ -1,3 +1,12 @@
+2007-12-18 Sandro Santilli <address@hidden>
+
+ * server/edit_text_character.cpp: implement getDepth()
+ * server/sprite_instance.cpp make createTextField more
+ tolerant and correct about parameters.
+ * testsuite/actionscript.all/TextField.as: add more
+ createTextField tests (uhm.. should be in MovieClip.as)
+ and a getDepth one.
+
2007-12-18 Rob Savoye <address@hidden>
* testsuite/actionscript.all/SharedObject.as: Test creating a .sol
Index: server/edit_text_character.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/edit_text_character.cpp,v
retrieving revision 1.137
retrieving revision 1.138
diff -u -b -r1.137 -r1.138
--- server/edit_text_character.cpp 18 Dec 2007 23:39:59 -0000 1.137
+++ server/edit_text_character.cpp 19 Dec 2007 09:40:54 -0000 1.138
@@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-/* $Id: edit_text_character.cpp,v 1.137 2007/12/18 23:39:59 strk Exp $ */
+/* $Id: edit_text_character.cpp,v 1.138 2007/12/19 09:40:54 strk Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -179,16 +179,13 @@
static as_value
textfield_getDepth(const fn_call& fn)
{
+ // TODO: make this a character::getDepth_method function...
boost::intrusive_ptr<edit_text_character> text =
ensureType<edit_text_character>(fn.this_ptr);
- UNUSED(text);
- static bool warned = false;
- if ( ! warned ) {
- log_unimpl("TextField.getDepth()");
- warned = true;
- }
+ int n = text->get_depth();
+
+ return as_value(n);
- return as_value();
}
static as_value
@@ -309,8 +306,11 @@
o.init_property("variable", *variable_getter, *variable_setter);
o.init_member("setTextFormat", new
builtin_function(textfield_setTextFormat));
o.init_member("getTextFormat", new
builtin_function(textfield_getTextFormat));
+
+ // TODO: make a normal AsBroadcaster ?
o.init_member("addListener", new
builtin_function(textfield_addListener));
o.init_member("removeListener", new
builtin_function(textfield_removeListener));
+
o.init_member("setNewTextFormat", new
builtin_function(textfield_setNewTextFormat));
o.init_member("getNewTextFormat", new
builtin_function(textfield_getNewTextFormat));
o.init_member("getNewTextFormat", new
builtin_function(textfield_getNewTextFormat));
Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.415
retrieving revision 1.416
diff -u -b -r1.415 -r1.416
--- server/sprite_instance.cpp 14 Dec 2007 22:01:24 -0000 1.415
+++ server/sprite_instance.cpp 19 Dec 2007 09:40:54 -0000 1.416
@@ -332,6 +332,7 @@
static as_value sprite_get_depth(const fn_call& fn)
{
+ // TODO: make this a character::getDepth_method function...
boost::intrusive_ptr<sprite_instance> sprite =
ensureType<sprite_instance>(fn.this_ptr);
int n = sprite->get_depth();
@@ -775,7 +776,7 @@
{
boost::intrusive_ptr<sprite_instance> sprite =
ensureType<sprite_instance>(fn.this_ptr);
- if (fn.nargs != 6) // name, depth, x, y, width, height
+ if (fn.nargs < 6) // name, depth, x, y, width, height
{
IF_VERBOSE_ASCODING_ERRORS(
log_aserror(_("createTextField called with %d args, "
@@ -784,55 +785,15 @@
return as_value();
}
- if ( ! fn.arg(0).is_string() )
- {
- IF_VERBOSE_ASCODING_ERRORS(
- log_aserror(_("First argument of createTextField is not a
string"
- " - returning undefined"));
- );
- return as_value();
- }
std::string txt_name = fn.arg(0).to_string();
- if ( ! fn.arg(1).is_number() )
- {
- IF_VERBOSE_ASCODING_ERRORS(
- log_aserror(_("Second argument of createTextField is not a
number"
- " - returning undefined"));
- );
- return as_value();
- }
- int txt_depth = int(fn.arg(1).to_number());
+ int txt_depth = fn.arg(1).to_int();
- if ( ! fn.arg(2).is_number() )
- {
- IF_VERBOSE_ASCODING_ERRORS(
- log_aserror(_("Third argument of createTextField is not a
number"
- " - returning undefined"));
- );
- return as_value();
- }
- float txt_x = fn.arg(2).to_number();
+ int txt_x = fn.arg(2).to_int();
- if ( ! fn.arg(3).is_number() )
- {
- IF_VERBOSE_ASCODING_ERRORS(
- log_aserror(_("Fourth argument of createTextField is not a
number"
- " - returning undefined"));
- );
- return as_value();
- }
- float txt_y = fn.arg(3).to_number();
+ int txt_y = fn.arg(3).to_int();
- if ( ! fn.arg(4).is_number() )
- {
- IF_VERBOSE_ASCODING_ERRORS(
- log_aserror(_("Fifth argument of createTextField is not a
number"
- " - returning undefined"));
- );
- return as_value();
- }
- float txt_width = fn.arg(4).to_number();
+ int txt_width = fn.arg(4).to_int();
if ( txt_width < 0 )
{
IF_VERBOSE_ASCODING_ERRORS(
@@ -842,15 +803,7 @@
txt_width = -txt_width;
}
- if ( ! fn.arg(5).is_number() )
- {
- IF_VERBOSE_ASCODING_ERRORS(
- log_aserror(_("Sixth argument of createTextField is not a
number"
- " - returning undefined"));
- );
- return as_value();
- }
- float txt_height = fn.arg(5).to_number();
+ int txt_height = fn.arg(5).to_int();
if ( txt_height < 0 )
{
IF_VERBOSE_ASCODING_ERRORS(
Index: testsuite/actionscript.all/TextField.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/TextField.as,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -b -r1.35 -r1.36
--- testsuite/actionscript.all/TextField.as 18 Dec 2007 23:39:59 -0000
1.35
+++ testsuite/actionscript.all/TextField.as 19 Dec 2007 09:40:54 -0000
1.36
@@ -19,7 +19,7 @@
// compile this test case with Ming makeswf, and then
// execute it like this gnash -1 -r 0 -v out.swf
-rcsid="$Id: TextField.as,v 1.35 2007/12/18 23:39:59 strk Exp $";
+rcsid="$Id: TextField.as,v 1.36 2007/12/19 09:40:54 strk Exp $";
#include "check.as"
@@ -585,8 +585,18 @@
tf.text = "and forever back";
check_equals(o.t, "and forever back"); // while updating textfield's text
updates o.t
+//-------------------------------------------------------------------------
+// TODO: check TextField.getDepth()
+//-------------------------------------------------------------------------
+
+//-------------------------------------------------------------------------
+// TODO: check TextField.removeTextField (and soft references?)
+//-------------------------------------------------------------------------
+
+//-------------------------------------------------------------------------
// Check TextField._visible
+//-------------------------------------------------------------------------
check_equals(typeof(tf._visible), 'boolean');
check( ! tf.hasOwnProperty('_visible') );
@@ -596,7 +606,9 @@
check_equals(tf._visible, false);
tf._visible = true;
+//-------------------------------------------------------------------------
// Check TextField._width (how is this different from textWidth ?)
+//-------------------------------------------------------------------------
check_equals(typeof(tf._width), 'number');
check( ! tf.hasOwnProperty('_width') );
@@ -606,14 +618,18 @@
check_equals(tf._width, 99999);
tf._width = 500;
+//-------------------------------------------------------------------------
// Check TextField.wordWrap (should text wrap when bbox limit is hit?)
+//-------------------------------------------------------------------------
check_equals(typeof(tf.wordWrap), 'boolean');
check( ! tf.hasOwnProperty('wordWrap') );
check_equals(tf.wordWrap, false);
// TODO: check what can be assigned to wordWrap and what not...
+//-------------------------------------------------------------------------
// Check TextField._x
+//-------------------------------------------------------------------------
check_equals(typeof(tf._x), 'number');
check( ! tf.hasOwnProperty('_x') );
@@ -622,7 +638,9 @@
tf._x = 20;
check_equals(tf._x, 20);
+//-------------------------------------------------------------------------
// Check TextField._xmouse
+//-------------------------------------------------------------------------
xcheck_equals(typeof(tf._xmouse), 'number');
check( ! tf.hasOwnProperty('_xmouse') );
@@ -632,7 +650,9 @@
xcheck_equals(typeof(tf._xmouse), 'number');
xcheck_equals(tf._xmouse, currXmouse); // possibly unsafe, if user moves the
mouse while running the test
+//-------------------------------------------------------------------------
// Check TextField._xscale
+//-------------------------------------------------------------------------
xcheck_equals(typeof(tf._xscale), 'number');
check( ! tf.hasOwnProperty('_xscale') );
@@ -647,7 +667,9 @@
xcheck_equals(tf._width, currWidth*2);
tf._xscale = 100;
+//-------------------------------------------------------------------------
// Check TextField._y
+//-------------------------------------------------------------------------
check_equals(typeof(tf._y), 'number');
check( ! tf.hasOwnProperty('_y') );
@@ -656,7 +678,9 @@
tf._y = 5;
check_equals(tf._y, 5);
+//-------------------------------------------------------------------------
// Check TextField._ymouse
+//-------------------------------------------------------------------------
xcheck_equals(typeof(tf._ymouse), 'number');
check( ! tf.hasOwnProperty('_ymouse') );
@@ -666,7 +690,9 @@
xcheck_equals(typeof(tf._ymouse), 'number');
xcheck_equals(tf._ymouse, currYmouse); // possibly unsafe, if user moves the
mouse while running the test
+//-------------------------------------------------------------------------
// Check TextField._yscale
+//-------------------------------------------------------------------------
xcheck_equals(typeof(tf._yscale), 'number');
check( ! tf.hasOwnProperty('_yscale') );
@@ -681,7 +707,10 @@
xcheck_equals(tf._height, currHeight*2);
tf._yscale = 100;
+//-------------------------------------------------------------------------
// Check interaction between autoSize and _width
+//-------------------------------------------------------------------------
+
tf._width = 10; // "hello world" text should overflow this
tf.text = "Hello world";
tf.autoSize = 'none';
@@ -715,11 +744,43 @@
check_equals(tf2._x, 5);
check_equals(tf2._y, 6);
+createTextField("tf3", 99, 10.87, 10.12, NAN, 50.74);
+check_equals(tf3._x, 10);
+check_equals(tf3._y, 10);
+check_equals(tf3._width, 0);
+check_equals(tf3._height, 50);
+
+createTextField("tf4", 99, 10, 50, NAN, "20");
+check_equals(tf4._width, 0);
+check_equals(tf4._height, 20);
+
+createTextField(3, "101", "10", '100', '32', '15');
+check_equals(_root[3].getDepth(), 101);
+check_equals(_root[3]._x, 10);
+check_equals(_root[3]._y, 100);
+check_equals(_root[3]._width, 32);
+check_equals(_root[3]._height, 15);
+
+// One argument more
+createTextField("tf5", 102, 10, 130, 3, 2, 12);
+check_equals(tf5._name, "tf5");
+check_equals(tf5._target, "/tf5");
+check_equals(tf5.getDepth(), 102);
+check_equals(tf5._x, 10);
+check_equals(tf5._y, 130);
+check_equals(tf5._width, 3);
+check_equals(tf5._height, 2);
+
+// One argument missing
+createTextField("tf6", 103, 10, 10, 160);
+check_equals(typeof(tf6), 'undefined');
+
+
#if OUTPUT_VERSION < 8
- check_totals(352);
+ check_totals(371);
#else
- check_totals(353);
+ check_totals(372);
#endif
#else // OUTPUT_VERSION <= 5