[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnash-commit] gnash/testsuite/actionscript.all Object.as
From: |
zou lunkai |
Subject: |
Re: [Gnash-commit] gnash/testsuite/actionscript.all Object.as |
Date: |
Tue, 8 Apr 2008 11:49:21 +0800 |
hmm, many of the 'getter setter' related tests in Object.as are a bit
insane, unless they are all aimed at testing recursion. (But we don't
need that much, that would make our 'make check' even slower:) )
> +simple_test_getter = function() { return this.test; };
> +o = {};
> +o.addProperty("test", simple_test_getter, noset_setter);
I bet this is not the general way to use a getter. It's easy to cause
recursions in swf7 and above. More general code would be:
(1)
simple_test_getter = function() { return test; };
obj = {};
obj .addProperty("test", simple_test_getter, noset_setter);
(2)
simple_test_getter = function() { return this.test_cache; };
simple_test_setter = function(v) { this.test_cache = v; }
obj = {};
obj .addProperty("test", simple_test_getter, simple_test_setter);
test = "what ever";
trace(test);
BTW, we know there is a global 'o' in _global, so not using 'o' as an
object name in our test should be safer.
--zou
On 4/8/08, Sandro Santilli <address@hidden> wrote:
> CVSROOT: /sources/gnash
> Module name: gnash
> Changes by: Sandro Santilli <strk> 08/04/07 17:09:40
>
> Modified files:
> testsuite/actionscript.all: Object.as
>
> Log message:
> More tests for user-defined getter-setter cache value
>
> CVSWeb URLs:
> http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/Object.as?cvsroot=gnash&r1=1.58&r2=1.59
>
> Patches:
> Index: Object.as
> ===================================================================
> RCS file: /sources/gnash/gnash/testsuite/actionscript.all/Object.as,v
> retrieving revision 1.58
> retrieving revision 1.59
> diff -u -b -r1.58 -r1.59
> --- Object.as 7 Apr 2008 16:31:18 -0000 1.58
> +++ Object.as 7 Apr 2008 17:09:40 -0000 1.59
> @@ -21,7 +21,7 @@
> // execute it like this gnash -1 -r 0 -v out.swf
>
>
> -rcsid="$Id: Object.as,v 1.58 2008/04/07 16:31:18 strk Exp $";
> +rcsid="$Id: Object.as,v 1.59 2008/04/07 17:09:40 strk Exp $";
> #include "check.as"
>
> // Test things in Class Object (swf5~swf8)
> @@ -498,6 +498,36 @@
> r = o.addProperty('lundef', null, setter);
> check(!r);
>
> +// not-setting setter
> +noset_setter = function(v) { noset_setter_calls++; }; // doesn't set cache
> +simple_test_getter = function() { return this.test; };
> +o = {};
> +o.addProperty("test", simple_test_getter, noset_setter);
> +noset_setter_calls=0;
> +o.test = 2;
> +check_equals(noset_setter_calls, 1);
> +v = o.test;
> +xcheck_equals(v, 2); // did still set the cache
> +o.test = 5;
> +check_equals(noset_setter_calls, 2);
> +v = o.test;
> +xcheck_equals(v, 5);
> +
> +// test setter visibility of value (multiplies * 2)
> +timetwo_test_setter = function(v) {
> + // note("timetwo_test_setter sees this.test as "+this.test);
> + this.test *= 2;
> +};
> +o = {};
> +o.test = 1;
> +o.addProperty("test", simple_test_getter, timetwo_test_setter);
> +o.test = 2;
> +v = o.test;
> +xcheck_equals(v, 2);
> +o.test = 5;
> +v = o.test;
> +xcheck_equals(v, 5);
> +
>
> // Object.addProperty wasn't in SWF5
> #endif // OUTPUT_VERSION > 5
> @@ -747,6 +777,6 @@
> #endif
>
> #if OUTPUT_VERSION >= 6
> -totals(240);
> +totals(246);
> #endif
>
>
>
> _______________________________________________
> Gnash-commit mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/gnash-commit
>
- [Gnash-commit] gnash/testsuite/actionscript.all Object.as, Zou Lunkai, 2008/04/01
- [Gnash-commit] gnash/testsuite/actionscript.all Object.as, Zou Lunkai, 2008/04/01
- [Gnash-commit] gnash/testsuite/actionscript.all Object.as, Sandro Santilli, 2008/04/03
- [Gnash-commit] gnash/testsuite/actionscript.all Object.as, Sandro Santilli, 2008/04/07
- Re: [Gnash-commit] gnash/testsuite/actionscript.all Object.as, zou lunkai, 2008/04/07
- Re: [Gnash-commit] gnash/testsuite/actionscript.all Object.as,
zou lunkai <=
- Re: [Gnash-commit] gnash/testsuite/actionscript.all Object.as, Sandro Santilli, 2008/04/08
- Re: [Gnash-commit] gnash/testsuite/actionscript.all Object.as, zou lunkai, 2008/04/08
- Re: [Gnash-commit] gnash/testsuite/actionscript.all Object.as, Sandro Santilli, 2008/04/08
- Re: [Gnash-commit] gnash/testsuite/actionscript.all Object.as, zou lunkai, 2008/04/08
- Re: [Gnash-commit] gnash/testsuite/actionscript.all Object.as, strk, 2008/04/08
- Re: [Gnash-commit] gnash/testsuite/actionscript.all Object.as, zou lunkai, 2008/04/08
- Re: [Gnash-commit] gnash/testsuite/actionscript.all Object.as, strk, 2008/04/08
[Gnash-commit] gnash/testsuite/actionscript.all Object.as, Zou Lunkai, 2008/04/09
[Gnash-commit] gnash/testsuite/actionscript.all Object.as, Benjamin Wolsey, 2008/04/28