[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog libgeometry/snappingrange.h tes...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog libgeometry/snappingrange.h tes... |
Date: |
Fri, 25 May 2007 15:18:05 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 07/05/25 15:18:05
Modified files:
. : ChangeLog
libgeometry : snappingrange.h
testsuite/misc-ming.all: Makefile.am loop_test2.c
Added files:
testsuite/misc-ming.all: loop_test2runner.cpp
Log message:
* libgeometry/snappingrange.h: add intersects(Range2d)
* testsuite/misc-ming.all/: Makefile.am,
loop_test2.c, loop_test2runner.cpp: Add a visual test
runner, showing that 2nd redesign attempt is really
bogus.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3355&r2=1.3356
http://cvs.savannah.gnu.org/viewcvs/gnash/libgeometry/snappingrange.h?cvsroot=gnash&r1=1.19&r2=1.20
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/Makefile.am?cvsroot=gnash&r1=1.130&r2=1.131
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/loop_test2.c?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/loop_test2runner.cpp?cvsroot=gnash&rev=1.1
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.3355
retrieving revision 1.3356
diff -u -b -r1.3355 -r1.3356
--- ChangeLog 25 May 2007 13:25:47 -0000 1.3355
+++ ChangeLog 25 May 2007 15:18:04 -0000 1.3356
@@ -1,5 +1,13 @@
2007-05-25 Sandro Santilli <address@hidden>
+ * libgeometry/snappingrange.h: add intersects(Range2d)
+ * testsuite/misc-ming.all/: Makefile.am,
+ loop_test2.c, loop_test2runner.cpp: Add a visual test
+ runner, showing that 2nd redesign attempt is really
+ bogus.
+
+2007-05-25 Sandro Santilli <address@hidden>
+
* server/as_environment.cpp: don't print a separate error
when call stack limit is exceeded, leave that to the
exception handler.
Index: libgeometry/snappingrange.h
===================================================================
RCS file: /sources/gnash/gnash/libgeometry/snappingrange.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- libgeometry/snappingrange.h 27 Apr 2007 12:42:31 -0000 1.19
+++ libgeometry/snappingrange.h 25 May 2007 15:18:04 -0000 1.20
@@ -15,7 +15,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-// $Id: snappingrange.h,v 1.19 2007/04/27 12:42:31 strk Exp $
+// $Id: snappingrange.h,v 1.20 2007/05/25 15:18:04 strk Exp $
#ifndef GNASH_SNAPPINGRANGE_H
#define GNASH_SNAPPINGRANGE_H
@@ -354,6 +354,23 @@
}
+ /// Returns true if any of the ranges intersect the given range
+ //
+ /// Note that a NULL range doesn't intersect anything
+ /// and a WORLD range intersects everything except a NULL Range.
+ ///
+ bool intersects(const RangeType& r) const {
+
+ finalize();
+
+ for (unsigned rno=0, rcount=_ranges.size(); rno<rcount; rno++)
+ if (_ranges[rno].intersects(r))
+ return true;
+
+ return false;
+
+ }
+
/// \brief
/// Returns true if all ranges in the given SnappingRanges2d
/// are contained in at least one of the ranges composing this
Index: testsuite/misc-ming.all/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/Makefile.am,v
retrieving revision 1.130
retrieving revision 1.131
diff -u -b -r1.130 -r1.131
--- testsuite/misc-ming.all/Makefile.am 24 May 2007 12:08:03 -0000 1.130
+++ testsuite/misc-ming.all/Makefile.am 25 May 2007 15:18:05 -0000 1.131
@@ -77,6 +77,7 @@
root_stop_testrunner \
loop_test \
loop_test2 \
+ loop_test2runner \
loop_test3 \
loop_test4 \
loop_test5 \
@@ -211,7 +212,6 @@
static_vs_dynamic1_testrunner \
static_vs_dynamic2_testrunner \
getTimer_testrunner \
- loop_test2runner \
loop_test3runner \
loop_test4runner \
loop_test5runner \
@@ -385,9 +385,19 @@
loop_test2.swf: loop_test2
./loop_test2 $(top_srcdir)/testsuite/media
-loop_test2runner: $(srcdir)/../generic-testrunner.sh loop_test2.swf
- sh $< -f20 $(top_builddir) loop_test2.swf > $@
- chmod 755 $@
+loop_test2runner_SOURCES = \
+ loop_test2runner.cpp \
+ $(NULL)
+loop_test2runner_CXXFLAGS = \
+ -DTGTDIR='"$(abs_builddir)"' \
+ $(NULL)
+loop_test2runner_LDADD = \
+ $(top_builddir)/testsuite/libtestsuite.la \
+ $(NULL)
+loop_test2runner_DEPENDENCIES = \
+ $(top_builddir)/testsuite/libtestsuite.la \
+ loop_test2.swf \
+ $(NULL)
loop_test3_SOURCES = loop_test3.c
loop_test3_LDADD = libgnashmingutils.la
Index: testsuite/misc-ming.all/loop_test2.c
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/loop_test2.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- testsuite/misc-ming.all/loop_test2.c 18 May 2007 21:16:33 -0000
1.4
+++ testsuite/misc-ming.all/loop_test2.c 25 May 2007 15:18:05 -0000
1.5
@@ -42,7 +42,7 @@
* First time in frame1 depths are the original ones,
* second time depths are swapped.
*
- * run as ./loop_test
+ * run as ./loop_test2
*/
@@ -79,7 +79,7 @@
mo = newSWFMovie();
SWFMovie_setDimension(mo, 800, 600);
- SWFMovie_setRate(mo, 6);
+ SWFMovie_setRate(mo, 2);
// Frame 1: Place dejagnu clip
Index: testsuite/misc-ming.all/loop_test2runner.cpp
===================================================================
RCS file: testsuite/misc-ming.all/loop_test2runner.cpp
diff -N testsuite/misc-ming.all/loop_test2runner.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ testsuite/misc-ming.all/loop_test2runner.cpp 25 May 2007 15:18:05
-0000 1.1
@@ -0,0 +1,138 @@
+/*
+ * 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 "loop_test2.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);
+ rgba black(0,0,0,255);
+
+ // Ranges we'll use during the test
+ Range2d<int> redRange(300,300,360,360);
+ Range2d<int> blackRange(330,270,450,390);
+
+ // Coordinates we'll use during testing
+ int x_left = 270; // on the left of any character
+ int x_red = 310; // on the red square
+ int x_int = 340; // on the intersection between the red and black
squares
+ int x_black = 370; // on black square
+ int x_right = 460; // on the right of any character
+ int y = 330;
+
+ 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 characters (black on top)
+ invalidated = tester.getInvalidatedRanges();
+
+ check_equals(root->get_play_state(), sprite_instance::PLAY);
+ check_equals(root->get_current_frame(), 1);
+ check_equals(root->getDisplayList().size(), 3); // dejagnu + red square
+ black square
+
+ // check invalidated bounds contain both the red and black square
+ check( invalidated.contains(redRange) );
+ check( invalidated.contains(blackRange) );
+
+ // Check that the black square is over the red square
+ check_pixel(x_left, y, 2, white, 2);
+ check_pixel(x_red, y, 2, red, 2);
+ check_pixel(x_int, y, 2, black, 2); // black is *over* red square
+ check_pixel(x_black, y, 2, black, 2);
+ check_pixel(x_right, y, 2, white, 2);
+
+ tester.advance(); // FRAME 3, depth-swap the two characters
+ invalidated = tester.getInvalidatedRanges();
+
+ check_equals(root->get_play_state(), sprite_instance::PLAY);
+ check_equals(root->get_current_frame(), 2);
+ check_equals(root->getDisplayList().size(), 3); // dejagnu + red square
+ black square
+
+ // check invalidated bounds to contain the intersection
+ // between the two characters.
+ //
+ check( invalidated.contains(Intersection(redRange,blackRange)) );
+
+ // Check that the black square is now behind the red square
+ check_pixel(x_left, y, 2, white, 2);
+ check_pixel(x_red, y, 2, red, 2);
+ check_pixel(x_int, y, 2, red, 2); // black is *behind* red square
+ check_pixel(x_black, y, 2, black, 2);
+ check_pixel(x_right, y, 2, white, 2);
+
+ 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(), 3); // dejagnu + red square
+ black square
+
+ // Invalidated bounds can't be Null because something is printed
+ // in the XTRACE window... Anyway, the squares should be far enoguh
+ // to assume the invalidated bounds won't contain their intersection
+ //
+ // Gnash has an huge invalidated bounds for the whole movie lifetime,
btw....
+ //
+ xcheck( ! invalidated.intersects(Intersection(redRange,blackRange)) );
+
+ // Check that the black square is still behind the red square
+ check_pixel(x_left, y, 2, white, 2);
+ check_pixel(x_red, y, 2, red, 2);
+ xcheck_pixel(x_int, y, 2, red, 2); // black is *behind* red square
+ check_pixel(x_black, y, 2, black, 2);
+ check_pixel(x_right, y, 2, white, 2);
+}
+
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog libgeometry/snappingrange.h tes...,
Sandro Santilli <=