gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash/testsuite MovieTester.cpp MovieTester.h m...


From: Sandro Santilli
Subject: [Gnash-commit] gnash/testsuite MovieTester.cpp MovieTester.h m...
Date: Fri, 20 Apr 2007 15:22:00 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/04/20 15:22:00

Modified files:
        testsuite      : MovieTester.cpp MovieTester.h 
        testsuite/misc-ming.all: attachMovieTestRunner.cpp 

Log message:
                * testsuite/MovieTester.{cpp,h} (advance): advance
                  first, *then* render. Cache invalidated bound to
                  avoid loosing them.
                * testsuite/misc-ming.all/attachMovieTestRunner.cpp:
                  Add renderer tests.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/MovieTester.cpp?cvsroot=gnash&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/MovieTester.h?cvsroot=gnash&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/attachMovieTestRunner.cpp?cvsroot=gnash&r1=1.7&r2=1.8

Patches:
Index: MovieTester.cpp
===================================================================
RCS file: /sources/gnash/gnash/testsuite/MovieTester.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- MovieTester.cpp     20 Apr 2007 14:01:27 -0000      1.27
+++ MovieTester.cpp     20 Apr 2007 15:21:59 -0000      1.28
@@ -107,7 +107,6 @@
 {
        set_render_handler(&h);
 
-       invalidated_regions.setWorld(); // testing
        h.set_invalidated_regions(invalidated_regions);
 
        // We call display here to simulate effect of a real run.
@@ -131,9 +130,18 @@
 void
 MovieTester::render() 
 {
-       InvalidatedRanges ranges;
-       _movie_root->add_invalidated_bounds(ranges, false);
-       cout << "Invalidated ranges before any advance: " << ranges << endl;
+       // Get invalidated ranges and cache them
+       _invalidatedBounds.setNull();
+
+       _movie_root->add_invalidated_bounds(_invalidatedBounds, false);
+
+#ifdef SHOW_INVALIDATED_BOUNDS_ON_ADVANCE
+       cout << "frame " << _movie->get_current_frame() << ") Invalidated 
bounds " << _invalidatedBounds;
+#endif
+
+       // Force full redraw by using a WORLD invalidated ranges
+       InvalidatedRanges ranges = _invalidatedBounds; // copy the cache, so we 
don't accidentally modify it ...
+       ranges.setWorld(); // TESTING !! TODO: make this a parameter
 
        for (TRenderers::const_iterator it=_testingRenderers.begin(), 
itE=_testingRenderers.end();
                                it != itE; ++it)
@@ -141,21 +149,34 @@
                TestingRenderer& rend = *(*it);
                render(rend.getRenderer(), ranges);
        }
+       
+       if ( _testingRenderers.empty() )
+       {
+               // Make sure display is called in any case 
+               //
+               // What we're particularly interested about is 
+               // proper computation of invalidated bounds, which
+               // needs clear_invalidated() to be called.
+               // display() will call clear_invalidated() on characters
+               // actually modified so we're fine with that.
+               //
+               // Directly calling _movie->clear_invalidated() here
+               // also work currently, as invalidating the topmost
+               // movie will force recomputation of all invalidated
+               // bounds. Still, possible future changes might 
+               // introduce differences, so better to reproduce
+               // real runs as close as possible, by calling display().
+               //
+               _movie_root->display();
+       }
 }
 
 void
 MovieTester::advance() 
 {
-       render();
-
        _movie_root->advance(1.0);
-#ifdef SHOW_INVALIDATED_BOUNDS_ON_ADVANCE
-       geometry::Range2d<float> invalidatedbounds = getInvalidatedBounds();
-       std::stringstream ss;
-       ss << "frame " << _movie->get_current_frame() << ") Invalidated bounds 
" << invalidatedbounds;
-       gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
-       dbglogfile << ss.str().c_str() << std::endl;
-#endif
+
+       render();
 
 }
 
@@ -191,7 +212,7 @@
        const char* X="";
        if ( expectFailure ) X="X";
 
-       //cout <<"BINGO: X is '"<< X<<"'"<<endl;
+       cout <<"chekPixel(" << color << ") called" << endl;
 
        for (TRenderers::const_iterator it=_testingRenderers.begin(), 
itE=_testingRenderers.end();
                                it != itE; ++it)
@@ -205,6 +226,7 @@
                rgba obt_col;
 
                if ( ! rend.getRenderer().getAveragePixel(obt_col, _x, _y, 
radius) )
+               //if ( ! rend.getRenderer().getPixel(obt_col, _x, _y) )
                {
                        ss << " is out of rendering buffer";
                        log_msg("%sFAILED: %s (%s)", X,
@@ -274,11 +296,11 @@
        assert(ret.is_null());
        
        // TODO: Support multiple bounds in testsuite
-       //_movie_root->get_invalidated_bounds(&ret, false);
-       InvalidatedRanges ranges;
-       _movie_root->add_invalidated_bounds(ranges, false);
+       ////_movie_root->get_invalidated_bounds(&ret, false);
+       //InvalidatedRanges ranges;
+       //_movie_root->add_invalidated_bounds(ranges, false);
 
-       Range2d<float> range = ranges.getFullArea();
+       Range2d<float> range = _invalidatedBounds.getFullArea();
 
        // scale by 1/20 (twips to pixels)
        range.scale(1.0/20);

Index: MovieTester.h
===================================================================
RCS file: /sources/gnash/gnash/testsuite/MovieTester.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- MovieTester.h       20 Apr 2007 14:01:27 -0000      1.15
+++ MovieTester.h       20 Apr 2007 15:21:59 -0000      1.16
@@ -34,14 +34,14 @@
        {\
                std::stringstream ss; \
                ss << "[" << __FILE__ << ":" << __LINE__ << "]"; \
-               tester.checkPixel(2, rgba(0,0,0,255), 1, ss.str(), false); \
+               tester.checkPixel(radius, color, tolerance, ss.str(), false); \
        }
 
 #define xcheck_pixel(radius, color, tolerance) \
        {\
                std::stringstream ss; \
                ss << "[" << __FILE__ << ":" << __LINE__ << "]"; \
-               tester.checkPixel(2, rgba(0,0,0,255), 1, ss.str(), true); \
+               tester.checkPixel(radius, color, tolerance, ss.str(), true); \
        }
 
 // Forward declarations
@@ -243,6 +243,12 @@
        /// Current viewport height
        unsigned _height;
 
+       /// Invalidated bounds of the movie after last
+       /// advance call. They are cached here so we
+       /// can safely call ::display w/out wiping this
+       /// information out.
+       InvalidatedRanges _invalidatedBounds;
+
        /// I'd use ptr_list here, but trying not to spread
        /// boost 1.33 requirement for the moment.
        /// Still, I'd like to simplify things...

Index: misc-ming.all/attachMovieTestRunner.cpp
===================================================================
RCS file: 
/sources/gnash/gnash/testsuite/misc-ming.all/attachMovieTestRunner.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- misc-ming.all/attachMovieTestRunner.cpp     20 Feb 2007 10:26:06 -0000      
1.7
+++ misc-ming.all/attachMovieTestRunner.cpp     20 Apr 2007 15:21:59 -0000      
1.8
@@ -58,6 +58,8 @@
 
        tester.movePointerTo(30, 30);
        check(!tester.isMouseOverMouseEntity());
+       // check that the pixel under the mouse is white
+       check_pixel(2, rgba(255,255,255,255), 2);
 
        tester.advance();
 
@@ -68,8 +70,13 @@
 
        tester.movePointerTo(30, 30);
        check(tester.isMouseOverMouseEntity());
+       // check that the pixel under the mouse is red
+       check_pixel(2, rgba(255,0,0,255), 2);
+
        tester.movePointerTo(100, 30);
        check(!tester.isMouseOverMouseEntity());
+       // check that the pixel under the mouse is white
+       check_pixel(2, rgba(255,255,255,255), 2);
 
        root->get_member("mousedown", &tmp);
        check(tmp.is_undefined());
@@ -99,8 +106,13 @@
 
        tester.movePointerTo(100, 30);
        check(tester.isMouseOverMouseEntity());
+       // check that the pixel under the mouse is red
+       check_pixel(2, rgba(255,0,0,255), 2);
+
        tester.movePointerTo(170, 30);
        check(!tester.isMouseOverMouseEntity());
+       // check that the pixel under the mouse is white
+       check_pixel(2, rgba(255,255,255,255), 2);
 
        tester.advance();
 
@@ -111,8 +123,13 @@
 
        tester.movePointerTo(170, 30);
        check(tester.isMouseOverMouseEntity());
+       // check that the pixel under the mouse is red
+       check_pixel(2, rgba(255,0,0,255), 2);
+
        tester.movePointerTo(240, 30);
        check(!tester.isMouseOverMouseEntity());
+       // check that the pixel under the mouse is white
+       check_pixel(2, rgba(255,255,255,255), 2);
 
        tester.advance();
 
@@ -123,9 +140,13 @@
 
        tester.movePointerTo(240, 30);
        check(tester.isMouseOverMouseEntity());
+       // check that the pixel under the mouse is red
+       check_pixel(2, rgba(255,0,0,255), 2);
 
        tester.movePointerTo(340, 30);
        check(! tester.isMouseOverMouseEntity());
+       // check that the pixel under the mouse is white
+       check_pixel(2, rgba(255,255,255,255), 2);
 
        // Note that we are *not* on an active entity !
        tester.pressMouseButton();




reply via email to

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