CVSROOT: /sources/gnash Module name: gnash Changes by: Sandro Santilli <strk> 07/04/23 12:30:08
Modified files: . : ChangeLog testsuite/misc-ming.all: Makefile.am masks_test.c Added files: testsuite/misc-ming.all: masks_testrunner.cpp Log message: * testsuite/misc-ming.all/: Makefile.am, masks_test.c, masks_testrunner.cpp: Add a MovieTester based test runner for the masks_test movie. Shows a bug in either the renderer or in the core preventing rendering of dynamic clips. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2967&r2=1.2968 http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/Makefile.am?cvsroot=gnash&r1=1.96&r2=1.97 http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/masks_test.c?cvsroot=gnash&r1=1.1&r2=1.2 http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/masks_testrunner.cpp?cvsroot=gnash&rev=1.1 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.2967 retrieving revision 1.2968 diff -u -b -r1.2967 -r1.2968 --- ChangeLog 23 Apr 2007 11:20:00 -0000 1.2967 +++ ChangeLog 23 Apr 2007 12:30:07 -0000 1.2968 @@ -1,5 +1,9 @@ 2007-04-23 Sandro Santilli <[EMAIL PROTECTED]> + * testsuite/misc-ming.all/: Makefile.am, masks_test.c, + masks_testrunner.cpp: Add a MovieTester based test runner + for the masks_test movie. Shows a bug in either the renderer + or in the core preventing rendering of dynamic clips. * libgeometry/snappingrange.h: add unconditional visitor; add cast operator; add contains(Range2d); add scale(factor). * testsuite/MovieTester.{cpp,h}: add a getInvalidatedRanges function; Index: testsuite/misc-ming.all/Makefile.am =================================================================== RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/Makefile.am,v retrieving revision 1.96 retrieving revision 1.97 diff -u -b -r1.96 -r1.97 --- testsuite/misc-ming.all/Makefile.am 20 Apr 2007 07:21:26 -0000 1.96 +++ testsuite/misc-ming.all/Makefile.am 23 Apr 2007 12:30:08 -0000 1.97 @@ -109,6 +109,7 @@ frame_label_test \ path_format_test \ duplicate_movie_clip_test \ + masks_testrunner \ $(NULL) if MAKESWF_SUPPORTS_PREBUILT_CLIPS @@ -148,7 +149,6 @@ path_format_testrunner \ duplicate_movie_clip_testrunner \ matrix_testrunner \ - masks_testrunner \ $(NULL) if MAKESWF_SUPPORTS_PREBUILT_CLIPS @@ -391,9 +391,19 @@ masks_test.swf: masks_test ./masks_test $(top_srcdir)/testsuite/media -masks_testrunner: $(srcdir)/../generic-testrunner.sh masks_test.swf - sh $< -r5 $(top_builddir) masks_test.swf > $@ - chmod 755 $@ +masks_testrunner_SOURCES = \ + masks_testrunner.cpp \ + $(NULL) +masks_testrunner_CXXFLAGS = \ + -DTGTDIR='"$(abs_builddir)"' \ + $(NULL) +masks_testrunner_LDADD = \ + $(top_builddir)/testsuite/libtestsuite.la \ + $(NULL) +masks_testrunner_DEPENDENCIES = \ + $(top_builddir)/testsuite/libtestsuite.la \ + masks_test.swf \ + $(NULL) matrix_test_SOURCES = \ matrix_test.c \ Index: testsuite/misc-ming.all/masks_test.c =================================================================== RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/masks_test.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -b -r1.1 -r1.2 --- testsuite/misc-ming.all/masks_test.c 20 Apr 2007 08:57:34 -0000 1.1 +++ testsuite/misc-ming.all/masks_test.c 23 Apr 2007 12:30:08 -0000 1.2 @@ -33,68 +33,47 @@ #define OUTPUT_VERSION 6 #define OUTPUT_FILENAME "masks_test.swf" -void add_dynamic_mc(SWFMovie mo, const char* name, int depth, int x, int y, int width, int height); -void add_static_mc(SWFMovie mo, const char* name, int depth, int x, int y, int width, int height); +void add_dynamic_mc(SWFMovie mo, const char* name, int depth, int x, int y, int width, int height, int r, int g, int b); +void add_static_mc(SWFMovie mo, const char* name, int depth, int x, int y, int width, int height, int r, int g, int b); void add_static_mask(SWFMovie mo, const char* name, int depth, int x, int y, int width, int height, int masklevel); void -add_dynamic_mc(SWFMovie mo, const char* name, int depth, int x, int y, int width, int height) +add_dynamic_mc(SWFMovie mo, const char* name, int depth, int x, int y, int width, int height, int r, int g, int b) { SWFAction ac = compile_actions("createEmptyMovieClip('%s', %d);" "with (%s) {" - " lineStyle(1, 0x000000, 100);" - " beginFill(0x00FF00, 100);" + //" lineStyle(1, 0x000000, 100);" + " beginFill(0x%2.2X%2.2X%2.2X, 100);" " moveTo(%d, %d);" " lineTo(%d, %d);" " lineTo(%d, %d);" " lineTo(%d, %d);" " lineTo(%d, %d);" " endFill();" - "}" - "%s.createEmptyMovieClip('child', 1);" - "with (%s.child) {" - " lineStyle(3, 0x000000, 100);" - " moveTo(%d, %d);" - " lineTo(%d, %d);" - " lineTo(%d, %d);" - " lineTo(%d, %d);" - " lineTo(%d, %d);" "}", name, depth, name, + r,g,b, x, y, x, y+height, x+width, y+height, x+width, y, - x, y, - name, name, - x+5, y+5, - x+5, y+height-5, - x+width-5, y+height-5, - x+width-5, y+5, - x+5, y+5 + x, y ); SWFMovie_add(mo, (SWFBlock)ac); } void -add_static_mc(SWFMovie mo, const char* name, int depth, int x, int y, int width, int height) +add_static_mc(SWFMovie mo, const char* name, int depth, int x, int y, int width, int height, int r, int g, int b) { SWFShape sh; SWFMovieClip mc, mc2; SWFDisplayItem it; - sh = make_fill_square (-(width/2), -(height/2), width, height, 255, 0, 0, 255, 0, 0); + sh = make_fill_square (0, 0, width, height, r, g, b, r, g, b); mc = newSWFMovieClip(); SWFMovieClip_add(mc, (SWFBlock)sh); - sh = make_square (-(width/2)+5, -(height/2)+5, width-10, height-10, 0, 0, 0); - mc2 = newSWFMovieClip(); // child - SWFMovieClip_add(mc2, (SWFBlock)sh); - SWFMovieClip_nextFrame(mc2); - - it = SWFMovieClip_add(mc, (SWFBlock)mc2); - SWFDisplayItem_setName(it, "child"); SWFMovieClip_nextFrame(mc); it = SWFMovie_add(mo, (SWFBlock)mc); @@ -143,7 +122,7 @@ Ming_init(); mo = newSWFMovieWithVersion(OUTPUT_VERSION); SWFMovie_setDimension(mo, 800, 600); - SWFMovie_setRate (mo, 1); + SWFMovie_setRate (mo, 0.3); dejagnuclip = get_dejagnu_clip((SWFBlock)get_default_font(srcdir), 10, 0, 0, 800, 600); it = SWFMovie_add(mo, (SWFBlock)dejagnuclip); @@ -155,14 +134,14 @@ // this one seems to confuse the MM player //add_static_mask(mo, "mask1", 1, 0, 150, 200, 100, 20); - add_static_mc(mo, "staticmc2", 2, 0, 200, 60, 60); - add_static_mc(mo, "staticmc3", 3, 30, 200, 60, 60); - add_static_mc(mo, "staticmc4", 4, 200, 200, 60, 60); - add_static_mc(mo, "staticmc5", 5, 230, 200, 60, 60); - add_dynamic_mc(mo, "dynamicmc2", 12, 0, 300, 60, 60); - add_dynamic_mc(mo, "dynamicmc3", 13, 30, 300, 60, 60); - add_dynamic_mc(mo, "dynamicmc4", 14, 200, 300, 60, 60); - add_dynamic_mc(mo, "dynamicmc5", 15, 230, 300, 60, 60); + add_static_mc(mo, "staticmc2", 2, 0, 200, 60, 60, 255, 0, 0); + add_static_mc(mo, "staticmc3", 3, 30, 200, 60, 60, 255, 255, 0); + add_static_mc(mo, "staticmc4", 4, 200, 200, 60, 60, 0, 255, 0); + add_static_mc(mo, "staticmc5", 5, 230, 200, 60, 60, 0, 255, 255); + add_dynamic_mc(mo, "dynamicmc2", 12, 0, 300, 60, 60, 0, 0, 255); + add_dynamic_mc(mo, "dynamicmc3", 13, 30, 300, 60, 60, 255, 0, 255); + add_dynamic_mc(mo, "dynamicmc4", 14, 200, 300, 60, 60, 0, 128, 0); + add_dynamic_mc(mo, "dynamicmc5", 15, 230, 300, 60, 60, 0, 128, 255); check_equals(mo, "staticmc2.getDepth()", "-16382"); Index: testsuite/misc-ming.all/masks_testrunner.cpp =================================================================== RCS file: testsuite/misc-ming.all/masks_testrunner.cpp diff -N testsuite/misc-ming.all/masks_testrunner.cpp --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ testsuite/misc-ming.all/masks_testrunner.cpp 23 Apr 2007 12:30:08 -0000 1.1 @@ -0,0 +1,128 @@ +/* + * Copyright (C) 2005, 2006 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 + * + * + */ + +#define INPUT_FILENAME "masks_test.swf" + +#include "MovieTester.h" +#include "sprite_instance.h" +#include "character.h" +#include "dlist.h" +#include "container.h" +#include "log.h" + +#include "check.h" +#include <string> +#include <cassert> + +using namespace gnash; +using namespace std; + +int +main(int /*argc*/, char** /*argv*/) +{ + typedef gnash::geometry::SnappingRanges2d<int> Ranges; + typedef gnash::geometry::Range2d<int> Bounds; + + string filename = string(TGTDIR) + string("/") + string(INPUT_FILENAME); + MovieTester tester(filename); + + gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance(); + dbglogfile.setVerbosity(1); + + Ranges invalidated; + sprite_instance* root = tester.getRootMovie(); + assert(root); + + // FRAME 1 (start) + + check_equals(root->get_frame_count(), 4); + check_equals(root->get_play_state(), sprite_instance::PLAY); + check_equals(root->get_current_frame(), 0); + check_equals(root->getDisplayList().size(), 1); // dejagnu clip + invalidated = tester.getInvalidatedRanges(); + check( invalidated.contains(76, 4) ); // the "-xtrace enabled-" label... + + tester.advance(); // FRAME 2 + + check_equals(root->get_play_state(), sprite_instance::PLAY); + check_equals(root->get_current_frame(), 1); + check_equals(root->getDisplayList().size(), 9); + root->getDisplayList().dump(); + check( tester.findDisplayItemByName(*root, "staticmc2") ); + check( tester.findDisplayItemByName(*root, "staticmc3") ); + check( tester.findDisplayItemByName(*root, "staticmc4") ); + check( tester.findDisplayItemByName(*root, "staticmc5") ); + check( tester.findDisplayItemByName(*root, "dynamicmc2") ); + check( tester.findDisplayItemByName(*root, "dynamicmc3") ); + check( tester.findDisplayItemByName(*root, "dynamicmc4") ); + check( tester.findDisplayItemByName(*root, "dynamicmc5") ); + invalidated = tester.getInvalidatedRanges(); + + rgba red(255,0,0,255); + rgba green(0,255,0,255); + rgba blue(0,255,0,255); + rgba yellow(255,255,0,255); + rgba cyan(0,255,255,255); + rgba violet(255,0,255,255); + rgba dark_green(0,128,0,255); + rgba light_blue(0,0,128,255); + + // 14,232 = red + check( invalidated.contains(14, 232) ); + check_pixel(14,232, 2, red, 2); + // 48,232 = yellow (red behind) + check( invalidated.contains(48, 232) ); + check_pixel(48,232, 2, yellow, 2); + // 80,232 = yellow + check( invalidated.contains(80, 232) ); + check_pixel(80,232, 2, yellow, 2); + + // 214,232 = green + check( invalidated.contains(214, 232) ); + check_pixel(214,232, 2, green, 2); + // 248,232 = cyan (green behind) + check( invalidated.contains(248, 232) ); + check_pixel(248,232, 2, cyan, 2); + // 276,232 = cyan + check( invalidated.contains(276, 232) ); + check_pixel(276,232, 2, cyan, 2); + + // 14,331 = blue + check( invalidated.contains(14, 331) ); + xcheck_pixel(14,331, 2, blue, 2); + // 48,331 = violet (blue behind) + check( invalidated.contains(48, 331) ); + xcheck_pixel(48,331, 2, violet, 2); + // 80,331 = violet + check( invalidated.contains(80, 331) ); + xcheck_pixel(80,331, 2, violet, 2); + + // 214,331 = dark_green + check( invalidated.contains(214, 331) ); + xcheck_pixel(214,331, 2, dark_green, 2); + // 248,331 = light_blue (dark_green behind) + check( invalidated.contains(248, 331) ); + xcheck_pixel(248,331, 2, light_blue, 2); + // 276,331 = light_blue + check( invalidated.contains(276, 331) ); + xcheck_pixel(276,331, 2, light_blue, 2); + + +} + _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit