gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog testsuite/misc-ming.all/Makefil...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog testsuite/misc-ming.all/Makefil...
Date: Wed, 23 May 2007 17:46:12 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/05/23 17:46:12

Modified files:
        .              : ChangeLog 
        testsuite/misc-ming.all: Makefile.am replace_shapes1test.c 
Added files:
        testsuite/misc-ming.all: replace_shapes1test_runner.cpp 

Log message:
                * 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.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3320&r2=1.3321
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/Makefile.am?cvsroot=gnash&r1=1.125&r2=1.126
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/replace_shapes1test.c?cvsroot=gnash&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/replace_shapes1test_runner.cpp?cvsroot=gnash&rev=1.1

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.3320
retrieving revision 1.3321
diff -u -b -r1.3320 -r1.3321
--- ChangeLog   23 May 2007 17:27:04 -0000      1.3320
+++ ChangeLog   23 May 2007 17:46:11 -0000      1.3321
@@ -1,5 +1,9 @@
 2007-05-23 Sandro Santilli <address@hidden>
 
+       * 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.
        * 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.125
retrieving revision 1.126
diff -u -b -r1.125 -r1.126
--- testsuite/misc-ming.all/Makefile.am 23 May 2007 07:01:37 -0000      1.125
+++ testsuite/misc-ming.all/Makefile.am 23 May 2007 17:46:12 -0000      1.126
@@ -229,9 +229,11 @@
 
 if MING_SUPPORTS_REPLACE_TAG
 check_SCRIPTS += \
-       replace_shapes1test_runner \
        replace_sprites1test_runner \
        $(NULL)
+check_PROGRAMS += \
+       replace_shapes1test_runner \
+       $(NULL)
 endif
 
 
@@ -625,9 +627,19 @@
 replace_shapes1test.swf: replace_shapes1test
        ./replace_shapes1test $(top_srcdir)/testsuite/media
 
-replace_shapes1test_runner: $(srcdir)/../generic-testrunner.sh 
replace_shapes1test.swf
-       sh $< -f20 $(top_builddir) replace_shapes1test.swf > $@
-       chmod 755 $@
+replace_shapes1test_runner_SOURCES = \
+       replace_shapes1test_runner.cpp \
+       $(NULL)
+replace_shapes1test_runner_CXXFLAGS = \
+       -DTGTDIR='"$(abs_builddir)"' \
+       $(NULL)
+replace_shapes1test_runner_LDADD = \
+       $(top_builddir)/testsuite/libtestsuite.la \
+       $(NULL)
+replace_shapes1test_runner_DEPENDENCIES = \
+       $(top_builddir)/testsuite/libtestsuite.la \
+       replace_shapes1test.swf      \
+       $(NULL)
 
 replace_sprites1test_SOURCES = replace_sprites1test.c  
 replace_sprites1test_LDADD = libgnashmingutils.la

Index: testsuite/misc-ming.all/replace_shapes1test.c
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/replace_shapes1test.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- testsuite/misc-ming.all/replace_shapes1test.c       23 May 2007 15:54:31 
-0000      1.2
+++ testsuite/misc-ming.all/replace_shapes1test.c       23 May 2007 17:46:12 
-0000      1.3
@@ -36,15 +36,15 @@
  * 
  * Description:
  * 
- *  frame2: shape 1 placed at depth -16381 and position 100,100
- *  frame3: instance at depth -16381 replaced by character 2 at position 
110,110
+ *  frame2: shape 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 instances have been constructed in total.
- *  The instance contains a red shape at (100,100) initially, a green 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, a green shape
+ *  at (130,330) after the replace, a red shape at (100,300) again on 
loop-back.
  */
 
 #include "ming_utils.h"
@@ -65,7 +65,8 @@
 {
   SWFShape sh;
 
-  sh = make_fill_square (-(width/2), -(height/2), width, height, r, g, b, r, 
g, b);
+  /*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 +125,8 @@
   SWFMovie_setDimension(mo, 800, 600);
   SWFMovie_setRate (mo, 2);
 
-  static1 = get_shape(20, 20, 255, 0, 0);
-  static2 = get_shape(20, 20, 0, 255, 0);
+  static1 = get_shape(60, 60, 255, 0, 0);
+  static2 = get_shape(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 +135,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');"
@@ -161,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');"
@@ -189,7 +190,7 @@
   // We can't check the color or the _x in a self-contained testcase 
unfortunately,
   // we'll need a MovieTester-based runner for this.
   // It is expected the color of the current instane is GREEN, and the 
boundaries
-  // are from 110 to 130 for both X and Y.
+  // are from 130 to 190 for X and 330 to 390 for Y.
   // TODO: implement a MovieTester based runner !!
 
   SWFMovie_nextFrame(mo); 

Index: testsuite/misc-ming.all/replace_shapes1test_runner.cpp
===================================================================
RCS file: testsuite/misc-ming.all/replace_shapes1test_runner.cpp
diff -N testsuite/misc-ming.all/replace_shapes1test_runner.cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ testsuite/misc-ming.all/replace_shapes1test_runner.cpp      23 May 2007 
17:46:12 -0000      1.1
@@ -0,0 +1,146 @@
+/* 
+ *   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_shapes1test.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 green(0,255,0,255);
+       rgba white(255,255,255,255);
+
+       // Ranges we'll use during the test
+       Range2d<int> redRange(100,300,160,360);
+       Range2d<int> greenRange(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 char
+
+       // check invalidated bounds contain the red instance (100,300 - 160,360)
+       check( invalidated.contains(redRange) );
+       
+       // 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 + green char 
+
+       // check invalidated bounds to contain:
+       //      - the green square (added)
+       //      - the red square (removed)
+       //
+       check( invalidated.contains(redRange) );
+       check( invalidated.contains(greenRange) );
+       
+       // check that we have a green square at (130,330 - 190,390)
+       check_pixel(134, 334, 2, green, 2); // UL
+       check_pixel(186, 334, 2, green, 2); // UR
+       check_pixel(186, 386, 2, green, 2); // LL
+       check_pixel(134, 386, 2, green, 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 char 
+
+       // check invalidated bounds to contain:
+       //      - the green square (removed)
+       //      - the red square (added)
+       //
+       check( invalidated.contains(redRange) );
+       check( invalidated.contains(greenRange) );
+
+       // 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
+
+}
+




reply via email to

[Prev in Thread] Current Thread [Next in Thread]