CVSROOT: /sources/gnash Module name: gnash Changes by: Sandro Santilli <strk> 07/05/09 21:23:38
Modified files: . : ChangeLog testsuite/misc-ming.all: Makefile.am Added files: testsuite/misc-ming.all: displaylist_depths_test2.c Log message: * testsuite/misc-ming.all/: Makefile.am, displaylist_depths_test2.c: New test showing the effects of a swapDepth moving a static instance to the dynamic zone when jumping back to a frame in which the char is supposed to be at it's original depth. Incredibly, Gnash passes all tests, except a couple which are due to the way we implemented "soft references" and that makes it hard to test for actual existance of the old instance. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3145&r2=1.3146 http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/Makefile.am?cvsroot=gnash&r1=1.103&r2=1.104 http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/displaylist_depths_test2.c?cvsroot=gnash&rev=1.1 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.3145 retrieving revision 1.3146 diff -u -b -r1.3145 -r1.3146 --- ChangeLog 9 May 2007 16:02:19 -0000 1.3145 +++ ChangeLog 9 May 2007 21:23:38 -0000 1.3146 @@ -1,3 +1,13 @@ +2007-05-09 Sandro Santilli <[EMAIL PROTECTED]> + + * testsuite/misc-ming.all/: Makefile.am, displaylist_depths_test2.c: + New test showing the effects of a swapDepth moving a static + instance to the dynamic zone when jumping back to a frame in which + the char is supposed to be at it's original depth. + Incredibly, Gnash passes all tests, except a couple which are due + to the way we implemented "soft references" and that makes it + hard to test for actual existance of the old instance. + 2007-05-09 Udo Giacomozzi <[EMAIL PROTECTED]> * testsuite/misc-ming.all/DrawingApiTestRunner.cpp: fix ambiguous Index: testsuite/misc-ming.all/Makefile.am =================================================================== RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/Makefile.am,v retrieving revision 1.103 retrieving revision 1.104 diff -u -b -r1.103 -r1.104 --- testsuite/misc-ming.all/Makefile.am 9 May 2007 15:00:53 -0000 1.103 +++ testsuite/misc-ming.all/Makefile.am 9 May 2007 21:23:38 -0000 1.104 @@ -77,6 +77,7 @@ place_and_remove_object_test \ place_and_remove_object_insane_test \ displaylist_depths_test \ + displaylist_depths_test2 \ masks_test \ attachMovieTest \ attachMovieTestRunner \ @@ -153,6 +154,7 @@ reverse_execute_PlaceObject2_test1runner \ reverse_execute_PlaceObject2_test2runner \ displaylist_depths_testrunner \ + displaylist_depths_test2runner \ get_frame_number_testrunner \ frame_label_testrunner \ path_format_testrunner \ @@ -419,6 +421,20 @@ sh $< -r5 $(top_builddir) displaylist_depths_test.swf > $@ chmod 755 $@ +displaylist_depths_test2_SOURCES = \ + displaylist_depths_test2.c \ + ming_utils.h \ + ming_utils.c \ + $(NULL) +displaylist_depths_test2_LDADD = $(MING_LIBS) + +displaylist_depths_test2.swf: displaylist_depths_test2 + ./displaylist_depths_test2 $(top_srcdir)/testsuite/media + +displaylist_depths_test2runner: $(srcdir)/../generic-testrunner.sh displaylist_depths_test2.swf + sh $< -r5 $(top_builddir) displaylist_depths_test2.swf > $@ + chmod 755 $@ + masks_test_SOURCES = \ masks_test.c \ ming_utils.h \ @@ -1098,6 +1114,7 @@ reverse_execute_PlaceObject2_test1runner \ reverse_execute_PlaceObject2_test2runner \ displaylist_depths_testrunner \ + displaylist_depths_test2runner \ matrix_testrunner \ get_frame_number_testrunner \ frame_label_testrunner \ Index: testsuite/misc-ming.all/displaylist_depths_test2.c =================================================================== RCS file: testsuite/misc-ming.all/displaylist_depths_test2.c diff -N testsuite/misc-ming.all/displaylist_depths_test2.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ testsuite/misc-ming.all/displaylist_depths_test2.c 9 May 2007 21:23:38 -0000 1.1 @@ -0,0 +1,177 @@ +/* + * Copyright (C) 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 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 + * + */ + +/* + * Sandro Santilli, [EMAIL PROTECTED] + * + * Test how swapDepth affects DisplayList refresh on gotoAndPlay(current-X). + * A character is placed at depth 3 (-16381) and moved to the right for a couple of frames + * using PlaceObject2 tag. + * After that, the placed instance is moved from depth -16381 to depth 10 (dynamic zone) + * and a jump-back is issued to the frame containing the right-shift static transform. + * + * Expected behaviour is that the gotoFrame() reconstructs the DisplayList so that + * depth -16381 is taken by the character and transformed exactly as specified by + * PlaceObject2 tag. This is a *new* instance, altought it uses the same name as the + * old one. The old one (now at depth 10) is still there, visible, but can not be + * accessible by ActionScript anymore as it's name has been overridden by the + * reconstructed instance. + * + * run as ./displaylist_depths_test2 + */ + +#include "ming_utils.h" + +#include <stdlib.h> +#include <stdio.h> +#include <ming.h> + +#define OUTPUT_VERSION 6 +#define OUTPUT_FILENAME "displaylist_depths_test2.swf" + +SWFDisplayItem add_static_mc(SWFMovie mo, const char* name, int depth, int x, int y, int width, int height); + +SWFDisplayItem +add_static_mc(SWFMovie mo, const char* name, int depth, int x, int y, int width, int height) +{ + SWFShape sh; + SWFMovieClip mc, mc2; + SWFDisplayItem it; + + sh = make_fill_square (-(width/2), -(height/2), width, height, 255, 0, 0, 255, 0, 0); + mc = newSWFMovieClip(); + SWFMovieClip_add(mc, (SWFBlock)sh); + + SWFMovieClip_nextFrame(mc); + + it = SWFMovie_add(mo, (SWFBlock)mc); + SWFDisplayItem_setDepth(it, depth); + SWFDisplayItem_moveTo(it, x, y); + SWFDisplayItem_setName(it, name); + SWFDisplayItem_addAction(it, newSWFAction("_root.note(this+' onClipConstruct'); _root.depth3constructed++;"), SWFACTION_CONSTRUCT); + + return it; +} + + +int +main(int argc, char** argv) +{ + SWFMovie mo; + SWFMovieClip dejagnuclip; + int i; + SWFDisplayItem it1,it2,it3,it4; + + + const char *srcdir="."; + if ( argc>1 ) + srcdir=argv[1]; + else + { + //fprintf(stderr, "Usage: %s <mediadir>\n", argv[0]); + //return 1; + } + + Ming_init(); + mo = newSWFMovieWithVersion(OUTPUT_VERSION); + SWFMovie_setDimension(mo, 800, 600); + SWFMovie_setRate (mo, 2); + + dejagnuclip = get_dejagnu_clip((SWFBlock)get_default_font(srcdir), 10, 0, 0, 800, 600); + SWFMovie_add(mo, (SWFBlock)dejagnuclip); + SWFMovie_nextFrame(mo); + + // Frame 2: Add a static movieclip at depth 3 with origin at 10,200 + it1 = add_static_mc(mo, "static3", 3, 10, 200, 20, 20); + add_actions(mo, + "static3.myThing = 'guess';" + "check_equals(static3._x, 10);" + "check_equals(static3.myThing, 'guess');" + "check_equals(static3.getDepth(), -16381);" + ); + SWFMovie_nextFrame(mo); + + // Frame 3: nothing new + SWFMovie_nextFrame(mo); + + // Frame 4: move character at depth 3 to position 50,200 + SWFDisplayItem_moveTo(it1, 50, 200); + add_actions(mo, + "check_equals(static3._x, 50);" + "check_equals(static3.getDepth(), -16381);" + ); + SWFMovie_nextFrame(mo); + + // Frame 5: move character at depth 3 to position 100,200 + SWFDisplayItem_moveTo(it1, 200, 200); + add_actions(mo, + "check_equals(static3.myThing, 'guess');" + "check_equals(static3._x, 200);" + "check_equals(static3.getDepth(), -16381);" + ); + SWFMovie_nextFrame(mo); + + // Frame 6: change depth character at depth 3 to depth 10 (dynamic zone) + add_actions(mo, + "static3.swapDepths(10);" + "check_equals(static3.getDepth(), 10);" + "static3._rotation = 45;" + "check_equals(static3.myThing, 'guess');" + ); + SWFMovie_nextFrame(mo); + + // Frame 7: go to frame 3 and see if the PlaceObject2 in frame 4 + // is able to change the position back to 50,200 + // (it's at 100,200 now!) + add_actions(mo, + + "check_equals(static3.myThing, 'guess');" + + // Store a reference to the static3 instance + // before overriding its name + "dynRef = static3;" + + // this repopulates depth -16381 with a *new* instance + "gotoAndStop(4);" + + // static3 doesn't refer to the dynamic object anymore ! + "check_equals(typeof(static3.myThing), 'undefined');" + + // but the reference still does !! + // Gnash fails here due to it's implementation of "soft references" + // ... argh ... + // TODO: use a MovieTester based test runner to check for actual + // existance of the old (dynamicized) instance by looking + // at the real DisplayList and at the rendered buffer + // + "xcheck_equals(dynRef.myThing, 'guess');" + "xcheck_equals(dynRef.getDepth(), 10);" + + "check_equals(static3.getDepth(), -16381);" + "check_equals(static3._x, 50);" + "check_equals(depth3constructed, 2);" + "totals();" + ); + SWFMovie_nextFrame(mo); + + //Output movie + puts("Saving " OUTPUT_FILENAME ); + SWFMovie_save(mo, OUTPUT_FILENAME); + + return 0; +} _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit