CVSROOT: /sources/gnash Module name: gnash Changes by: Sandro Santilli <strk> 07/05/23 18:00:53
Modified files: . : ChangeLog testsuite/misc-ming.all: Makefile.am replace_sprites1test.c Added files: testsuite/misc-ming.all: replace_sprites1test_runner.cpp Log message: MovieTester based runner for replace_sprites1test.swf CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3321&r2=1.3322 http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/Makefile.am?cvsroot=gnash&r1=1.126&r2=1.127 http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/replace_sprites1test.c?cvsroot=gnash&r1=1.3&r2=1.4 http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/replace_sprites1test_runner.cpp?cvsroot=gnash&rev=1.1 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.3321 retrieving revision 1.3322 diff -u -b -r1.3321 -r1.3322 --- ChangeLog 23 May 2007 17:46:11 -0000 1.3321 +++ ChangeLog 23 May 2007 18:00:52 -0000 1.3322 @@ -1,9 +1,10 @@ 2007-05-23 Sandro Santilli <[EMAIL PROTECTED]> * testsuite/misc-ming.all/: Makefile.am, replace_shapes1test.c, - replace_shapes1test_runner.cpp: Modified coordinates and size - of shapes to help writing a test runner. Wrote a real test - runner checking for rendering and bounds invalidation. + replace_sprites1test.c, replace_shapes1test_runner.cpp, + replace_sprites1test_runner.cpp: Modified coordinates and size + of shapes to help writing test runners. Wrote real test + runners checking for rendering and bounds invalidation. * testsuite/MovieTester.cpp (render): don't force redraw always (don't cheat) - do only when asked to do so.. Index: testsuite/misc-ming.all/Makefile.am =================================================================== RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/Makefile.am,v retrieving revision 1.126 retrieving revision 1.127 diff -u -b -r1.126 -r1.127 --- testsuite/misc-ming.all/Makefile.am 23 May 2007 17:46:12 -0000 1.126 +++ testsuite/misc-ming.all/Makefile.am 23 May 2007 18:00:52 -0000 1.127 @@ -229,10 +229,10 @@ if MING_SUPPORTS_REPLACE_TAG check_SCRIPTS += \ - replace_sprites1test_runner \ $(NULL) check_PROGRAMS += \ replace_shapes1test_runner \ + replace_sprites1test_runner \ $(NULL) endif @@ -647,9 +647,19 @@ replace_sprites1test.swf: replace_sprites1test ./replace_sprites1test $(top_srcdir)/testsuite/media -replace_sprites1test_runner: $(srcdir)/../generic-testrunner.sh replace_sprites1test.swf - sh $< -f20 $(top_builddir) replace_sprites1test.swf > $@ - chmod 755 $@ +replace_sprites1test_runner_SOURCES = \ + replace_sprites1test_runner.cpp \ + $(NULL) +replace_sprites1test_runner_CXXFLAGS = \ + -DTGTDIR='"$(abs_builddir)"' \ + $(NULL) +replace_sprites1test_runner_LDADD = \ + $(top_builddir)/testsuite/libtestsuite.la \ + $(NULL) +replace_sprites1test_runner_DEPENDENCIES = \ + $(top_builddir)/testsuite/libtestsuite.la \ + replace_sprites1test.swf \ + $(NULL) masks_test_SOURCES = \ masks_test.c \ Index: testsuite/misc-ming.all/replace_sprites1test.c =================================================================== RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/replace_sprites1test.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -b -r1.3 -r1.4 --- testsuite/misc-ming.all/replace_sprites1test.c 23 May 2007 15:54:31 -0000 1.3 +++ testsuite/misc-ming.all/replace_sprites1test.c 23 May 2007 18:00:52 -0000 1.4 @@ -36,15 +36,15 @@ * * Description: * - * frame2: movieclip 1 placed at depth -16381 and position 100,100 - * frame3: instance at depth -16381 replaced by character 2 at position 110,110 + * frame2: movieclip 1 placed at depth -16381 and position 100,300 + * frame3: instance at depth -16381 replaced by character 2 at position 130,330 * frame4: jump back to frame 2 and stop * * Expected behaviour: * * A single "movieclip" instances have been constructed in total. - * The instance contains a red shape at (100,100) initially, still a red shape - * at (110,110) after the replace, a red shape at (100,100) again on loop-back. + * The instance contains a red shape at (100,300) initially, still a red shape + * at (130,330) after the replace, a red shape at (100,300) again on loop-back. */ #include "ming_utils.h" @@ -65,7 +65,7 @@ { SWFShape sh; - sh = make_fill_square (-(width/2), -(height/2), width, height, r, g, b, r, g, b); + sh = make_fill_square (0, 0, width, height, r, g, b, r, g, b); return sh; } @@ -124,8 +124,8 @@ SWFMovie_setDimension(mo, 800, 600); SWFMovie_setRate (mo, 2); - static1 = get_static_mc(20, 20, 255, 0, 0); - static2 = get_static_mc(20, 20, 0, 255, 0); + static1 = get_static_mc(60, 60, 255, 0, 0); + static2 = get_static_mc(60, 60, 0, 255, 0); dejagnuclip = get_dejagnu_clip((SWFBlock)get_default_font(srcdir), 10, 0, 0, 800, 600); SWFMovie_add(mo, (SWFBlock)dejagnuclip); @@ -134,7 +134,7 @@ // Frame 2: place character at depth 3 (-16381) it1 = SWFMovie_add(mo, (SWFBlock)static1); SWFDisplayItem_setDepth(it1, 3); - SWFDisplayItem_moveTo(it1, 100, 100); + SWFDisplayItem_moveTo(it1, 100, 300); SWFDisplayItem_setName(it1, "static1"); SWFDisplayItem_addAction(it1, newSWFAction( "_root.note(this+' onClipConstruct');" @@ -162,7 +162,7 @@ { abort(); // grace and beauty... } - SWFDisplayItem_moveTo(it1, 110, 110); + SWFDisplayItem_moveTo(it1, 130, 330); SWFDisplayItem_setName(it1, "static2"); SWFDisplayItem_addAction(it1, newSWFAction( "_root.note(this+' onClipConstruct');" @@ -187,8 +187,8 @@ // Everything suggests that a new instance is NOT created on replace !!! // Gnash here fails because it creates a NEW instance - // Anyway, the old character matrix changed to 110,110 ! - xcheck_equals(mo, "static1._x", "110"); + // Anyway, the old character matrix changed to 130,330 ! + xcheck_equals(mo, "static1._x", "130"); // We can't check the color in a self-contained testcase unfortunately, // we'll need a MovieTester-based runner for this. @@ -212,7 +212,7 @@ // And it still has it's user-provided property "xcheck_equals(static1.name, 'static1');" - // The instance have been moved back to its original position (100,100) + // The instance have been moved back to its original position (100,300) "check_equals(static1._x, 100);" // We can't check the color in a self-contained testcase unfortunately, Index: testsuite/misc-ming.all/replace_sprites1test_runner.cpp =================================================================== RCS file: testsuite/misc-ming.all/replace_sprites1test_runner.cpp diff -N testsuite/misc-ming.all/replace_sprites1test_runner.cpp --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ testsuite/misc-ming.all/replace_sprites1test_runner.cpp 23 May 2007 18:00:52 -0000 1.1 @@ -0,0 +1,147 @@ +/* + * 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 + * + * + */ + +#define INPUT_FILENAME "replace_sprites1test.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; +using namespace gnash::geometry; + +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); + + // Colors we'll use during the test + rgba red(255,0,0,255); + rgba white(255,255,255,255); + + // Ranges we'll use during the test + Range2d<int> redRange1(100,300,160,360); + Range2d<int> redRange2(130,330,190,390); + + 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, place character + invalidated = tester.getInvalidatedRanges(); + + check_equals(root->get_play_state(), sprite_instance::PLAY); + check_equals(root->get_current_frame(), 1); + check_equals(root->getDisplayList().size(), 2); // dejagnu + red square + + // check invalidated bounds contain the red square at (100,300 - 160,360) + check( invalidated.contains(redRange1) ); + + // check that we have a red square at (100,300 - 160,360) + check_pixel(104, 304, 2, red, 2); // UL + check_pixel(156, 304, 2, red, 2); // UR + check_pixel(156, 356, 2, red, 2); // LL + check_pixel(104, 356, 2, red, 2); // LR + + // and nothing around it... + check_pixel( 96, 330, 2, white, 2); // Left + check_pixel(164, 330, 2, white, 2); // Right + check_pixel(130, 296, 2, white, 2); // Top + check_pixel(130, 364, 2, white, 2); // Bottom + + tester.advance(); // FRAME 3, replace character + invalidated = tester.getInvalidatedRanges(); + + check_equals(root->get_play_state(), sprite_instance::PLAY); + check_equals(root->get_current_frame(), 2); + check_equals(root->getDisplayList().size(), 2); // dejagnu + red square + + // check invalidated bounds to contain: + // - the red square (moved) + // - the red square (original) + // + check( invalidated.contains(redRange1) ); + check( invalidated.contains(redRange2) ); + + // check that we have a red square at (130,330 - 190,390) + // Gnash fails here becase it does a *real* replace, while it + // seems we're not supposed to replace, just to move (who knows why?!) + xcheck_pixel(134, 334, 2, red, 2); // UL + xcheck_pixel(186, 334, 2, red, 2); // UR + xcheck_pixel(186, 386, 2, red, 2); // LL + xcheck_pixel(134, 386, 2, red, 2); // LR + + // and nothing around it... + check_pixel(126, 360, 2, white, 2); // Left + check_pixel(194, 360, 2, white, 2); // Right + check_pixel(160, 326, 2, white, 2); // Top + check_pixel(160, 394, 2, white, 2); // Bottom + + tester.advance(); // FRAME 4, jump to frame 2 and stop + invalidated = tester.getInvalidatedRanges(); + + check_equals(root->get_play_state(), sprite_instance::STOP); + check_equals(root->get_current_frame(), 1); + check_equals(root->getDisplayList().size(), 2); // dejagnu + red square + + // check invalidated bounds to contain: + // - the red square (moved) + // - the red square (original) + // + check( invalidated.contains(redRange1) ); + check( invalidated.contains(redRange2) ); + + // check that we have a red square at (100,300 - 160,360) + check_pixel(104, 304, 2, red, 2); // UL + check_pixel(156, 304, 2, red, 2); // UR + check_pixel(156, 356, 2, red, 2); // LL + check_pixel(104, 356, 2, red, 2); // LR + + // and nothing around it... + check_pixel( 96, 330, 2, white, 2); // Left + check_pixel(164, 330, 2, white, 2); // Right + check_pixel(130, 296, 2, white, 2); // Top + check_pixel(130, 364, 2, white, 2); // Bottom + +} + _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit