CVSROOT: /sources/gnash Module name: gnash Changes by: Zou Lunkai <zoulunkai> 07/08/31 05:50:24
Modified files: . : ChangeLog testsuite/misc-swfc.all: Makefile.am Added files: testsuite/misc-swfc.all: movieclip_destruction_test2.sc Log message: * testsuite/misc-swfc.all/movieclip_destruction_test2.sc: testcase about movieclip destruction and soft references, more failures. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4167&r2=1.4168 http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-swfc.all/Makefile.am?cvsroot=gnash&r1=1.6&r2=1.7 http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-swfc.all/movieclip_destruction_test2.sc?cvsroot=gnash&rev=1.1 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.4167 retrieving revision 1.4168 diff -u -b -r1.4167 -r1.4168 --- ChangeLog 31 Aug 2007 00:49:15 -0000 1.4167 +++ ChangeLog 31 Aug 2007 05:50:24 -0000 1.4168 @@ -1,5 +1,11 @@ 2007-08-31 Zou Lunkai <[EMAIL PROTECTED]> + * testsuite/misc-swfc.all/movieclip_destruction_test2.sc: testcase about + movieclip destruction and soft references, more failures. + * testsuite/misc-swfc.all/Makefile.am: enable testcase. + +2007-08-31 Zou Lunkai <[EMAIL PROTECTED]> + * libbase/image.cpp: don't ommit the default parameter, should fix the building, please check. Index: testsuite/misc-swfc.all/Makefile.am =================================================================== RCS file: /sources/gnash/gnash/testsuite/misc-swfc.all/Makefile.am,v retrieving revision 1.6 retrieving revision 1.7 diff -u -b -r1.6 -r1.7 --- testsuite/misc-swfc.all/Makefile.am 30 Aug 2007 05:03:37 -0000 1.6 +++ testsuite/misc-swfc.all/Makefile.am 31 Aug 2007 05:50:24 -0000 1.7 @@ -24,6 +24,7 @@ sound.sc \ soft_reference_test1.sc \ movieclip_destruction_test1.sc \ + movieclip_destruction_test2.sc \ $(NULL) # These will get compiled to SWFs just as above, but will not be executed as a test Index: testsuite/misc-swfc.all/movieclip_destruction_test2.sc =================================================================== RCS file: testsuite/misc-swfc.all/movieclip_destruction_test2.sc diff -N testsuite/misc-swfc.all/movieclip_destruction_test2.sc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ testsuite/misc-swfc.all/movieclip_destruction_test2.sc 31 Aug 2007 05:50:24 -0000 1.1 @@ -0,0 +1,179 @@ +/* + * Copyright (C) 2005, 2006, 2007 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, [EMAIL PROTECTED] + * + * Test destruction of static movieclips and soft references + * + * Description: + * + * frame2: Place mc1, mc2, mc3 by PlaceObject2 tag. + * Create a soft reference mc1Ref for mc1, mc2Ref for mc2, mc3Ref for mc3. + * Define onUnload for mc2, define onUnload for mc3. + * Define mc2.testvar = 100, define mc3.testvar = new Number(100); + * + * frame3: Remove mc1, mc2, mc3 by RemovieObject2 tag + * + * + * Expected behaviour: + * (1) mc1Ref in frame3 is dangling. + * (2) mc2Ref, mc3Ref, mc2 and mc3 are still accessible in frame3. + * (3) Movieclip.swapDepths() does not work for mc2 and mc3 in frame3. + * (4) mc2.testvar keeps alive after onUnload, mc3.testvar gets destroyed before entering onUnload handler. + * (5) mc2Ref, mc3Ref are dangling at frame4. + * + */ + + +.flash bbox=800x600 filename="movieclip_destruction_test2.swf" background=white version=7 fps=1 + +.frame 1 + .action: + #include "Dejagnu.sc" + .end + + // Define 3 shapes(b1, b2, b3) + .box b1 fill=green width=100 height=100 + .box b2 fill=red width=100 height=100 + .box b3 fill=yellow width=100 height=100 + +.frame 2 + + .sprite mc1 // Define a sprite mc1 + .frame 1 + .put b1 x = 0 y = 0 + .end //end of sprite + + .sprite mc2 // Define a sprite mc2 + .frame 1 + .put b2 x = 0 y = 0 + .end + + .sprite mc3 // Define a sprite mc3 + .frame 1 + .put b2 x = 0 y = 0 + .end + + .put mc1 x = 100 y = 300 // Place mc1 + .put mc2 x = 200 y = 300 // Place mc2 + .put mc3 x = 300 y = 300 // Place mc3 + + .action: + + _root.mc2UnlaodedCount = 0; + _root.mc3UnlaodedCount = 0; + check_equals(typeof(mc1), 'movieclip'); + check_equals(mc1.getDepth(), -16383); + check_equals(mc2.getDepth(), -16382); + check_equals(mc3.getDepth(), -16381); + // Define a onUnload for mc2 and mc3 + mc2.onUnload = function () + { + _root.mc2UnlaodedCount++; + // mc2.testvar keeps alive as long as mc2 is alive + _root.xcheck_equals(mc2.testvar, 100); + }; + mc3.onUnload = function () + { + _root.mc3UnlaodedCount++; + // mc3.testvar get destroyed before entering onUnload + _root.check_equals(mc3.testvar, undefined); + }; + + mc2.testvar = 100; + mc2.testvar = new Number(100); + + // Create soft references for mc1 and mc2 and mc3 + mc1Ref = mc1; + mc2Ref = mc2; + mc3Ref = mc3; + .end + + +.frame 3 + .del mc1 // Remove mc1 + .del mc2 // Remove mc1 + .del mc3 // Remove mc1 + + .action: + xcheck_equals(mc2UnlaodedCount, 1); //mc2.onUnload triggered + xcheck_equals(mc2UnlaodedCount, 1); //mc3.onUnload triggered + check_equals(mc1Ref.valueOf(), null); + xcheck_equals(mc2Ref, mc2); + xcheck_equals(mc3Ref, mc3); + + check_equals(typeof(mc1), 'undefined'); //cann't access the hard reference + xcheck_equals(typeof(mc2), 'movieclip'); // mc2 is still accessable + xcheck_equals(typeof(mc3), 'movieclip'); // mc3 is still accessable + xcheck_equals(mc2.getDepth(), -16387); // mc2's depths changed + xcheck_equals(mc3.getDepth(), -16388); // mc3's depths changed + + mc2.swapDepths(mc3); + xcheck_equals(mc2.getDepth(), -16387); // Depths not change after swapDepths + xcheck_equals(mc3.getDepth(), -16388); // Depths not change after swapDepths + + mc2.swapDephts(-10); + mc2.swapDephts(10); + xcheck_equals(mc2.getDepth(), -16387); // Depths not change after swapDepths + xcheck_equals(mc3.getDepth(), -16388); // Depths not change after swapDepths + + xcheck_equals(mc2.testvar, 100); + check_equals(mc3.testvar, undefined); + check_equals(typeof(mc3.testvar), 'undefined'); + mc2.removMovieClip(); + mc3.removMovieClip(); + xcheck_equals(mc2UnlaodedCount, 1); //mc2.onUnload not triggered again + xcheck_equals(mc2UnlaodedCount, 1); //mc3.onUnload not triggered again + xcheck_equals(typeof(mc2), 'movieclip'); // mc2 is still accessible + xcheck_equals(typeof(mc3), 'movieclip'); // mc3 is still accessible + xcheck_equals(mc2.getDepth(), -16387); + xcheck_equals(mc3.getDepth(), -16388); + xcheck_equals(mc2._x, 200); + xcheck_equals(mc3._y, 300); + xcheck_equals(mc2.testvar, 100); + check_equals(mc3.testvar, undefined); + check_equals(typeof(mc3.testvar), 'undefined'); + + mc2.onUnload(); + mc3.onUnload(); + xcheck_equals(mc2UnlaodedCount, 2); // we can still invoke onUnload + xcheck_equals(mc2UnlaodedCount, 2); // we can still invoke onUnload + .end + + +.frame 4 + .action: + check_equals(typeof(mc1), 'undefined'); + check_equals(typeof(mc2), 'undefined'); + check_equals(typeof(mc3), 'undefined'); + check_equals(mc1Ref.valueOf(), null); + check_equals(mc2Ref.valueOf(), null); + check_equals(mc3Ref.valueOf(), null); + .end + + +.frame 5 + .action: + totals(); + stop(); + .end + + +.end // end of the file + _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit