gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog testsuite/MovieTester.cpp tests...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog testsuite/MovieTester.cpp tests...
Date: Fri, 20 Apr 2007 16:42:43 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/04/20 16:42:43

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

Log message:
                * testsuite/MovieTester.{cpp,h}: reworked the
                  pixel checking interface to not force moving
                  the pointer (as moving the pointer might trigger
                  movie events, as was happening with the ButtonEvent
                  test).
                * testsuite/misc-ming.all/ButtonEventsTest-Runner.cpp:
                  All tests pass now.
                * testsuite/misc-ming.all/attachMovieTestRunner.cpp:
                  Updated to work with the correct interface.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2959&r2=1.2960
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/MovieTester.cpp?cvsroot=gnash&r1=1.28&r2=1.29
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/MovieTester.h?cvsroot=gnash&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/ButtonEventsTest-Runner.cpp?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.8&r2=1.9

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2959
retrieving revision 1.2960
diff -u -b -r1.2959 -r1.2960
--- ChangeLog   20 Apr 2007 15:41:06 -0000      1.2959
+++ ChangeLog   20 Apr 2007 16:42:43 -0000      1.2960
@@ -1,5 +1,17 @@
 2007-04-20 Sandro Santilli <address@hidden>
 
+       * testsuite/MovieTester.{cpp,h}: reworked the
+         pixel checking interface to not force moving
+         the pointer (as moving the pointer might trigger
+         movie events, as was happening with the ButtonEvent
+         test).
+       * testsuite/misc-ming.all/ButtonEventsTest-Runner.cpp:
+         All tests pass now.
+       * testsuite/misc-ming.all/attachMovieTestRunner.cpp:
+         Updated to work with the correct interface.
+
+2007-04-20 Sandro Santilli <address@hidden>
+
        * testsuite/MovieTester.{cpp,h} (advance): advance
          first, *then* render. Cache invalidated bound to
          avoid loosing them.

Index: testsuite/MovieTester.cpp
===================================================================
RCS file: /sources/gnash/gnash/testsuite/MovieTester.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- testsuite/MovieTester.cpp   20 Apr 2007 15:21:59 -0000      1.28
+++ testsuite/MovieTester.cpp   20 Apr 2007 16:42:43 -0000      1.29
@@ -136,7 +136,7 @@
        _movie_root->add_invalidated_bounds(_invalidatedBounds, false);
 
 #ifdef SHOW_INVALIDATED_BOUNDS_ON_ADVANCE
-       cout << "frame " << _movie->get_current_frame() << ") Invalidated 
bounds " << _invalidatedBounds;
+       cout << "frame " << _movie->get_current_frame() << ") Invalidated 
bounds " << _invalidatedBounds << endl;
 #endif
 
        // Force full redraw by using a WORLD invalidated ranges
@@ -201,11 +201,11 @@
 {
        _x = x;
        _y = y;
-       _movie_root->notify_mouse_moved(x, y);
+       if ( _movie_root->notify_mouse_moved(x, y) ) render();
 }
 
 void
-MovieTester::checkPixel(unsigned radius, const rgba& color,
+MovieTester::checkPixel(int x, int y, unsigned radius, const rgba& color,
                short unsigned tolerance, const std::string& label, bool 
expectFailure) const
 {
        FuzzyPixel exp(color, tolerance);
@@ -221,12 +221,12 @@
 
                std::stringstream ss;
                ss << rend.getName() <<" ";
-               ss << "pix:" << _x << "," << _y <<" ";
+               ss << "pix:" << x << "," << y <<" ";
 
                rgba obt_col;
 
-               if ( ! rend.getRenderer().getAveragePixel(obt_col, _x, _y, 
radius) )
-               //if ( ! rend.getRenderer().getPixel(obt_col, _x, _y) )
+               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,
@@ -260,25 +260,47 @@
 void
 MovieTester::pressMouseButton()
 {
-       _movie_root->notify_mouse_clicked(true, 1);
+       if ( _movie_root->notify_mouse_clicked(true, 1) )
+       {
+               render();
+       }
 }
 
 void
 MovieTester::depressMouseButton()
 {
-       _movie_root->notify_mouse_clicked(false, 1);
+       if ( _movie_root->notify_mouse_clicked(false, 1) )
+       {
+               render();
+       }
+}
+
+void
+MovieTester::click()
+{
+       int wantRedraw = 0;
+       if ( _movie_root->notify_mouse_clicked(true, 1) ) ++wantRedraw;
+       if ( _movie_root->notify_mouse_clicked(false, 1) ) ++wantRedraw;
+
+       if ( wantRedraw ) render();
 }
 
 void
 MovieTester::pressKey(key::code code)
 {
-       _movie_root->notify_key_event(code, true);
+       if ( _movie_root->notify_key_event(code, true) )
+       {
+               render();
+       }
 }
 
 void
 MovieTester::releaseKey(key::code code)
 {
-       _movie_root->notify_key_event(code, false);
+       if ( _movie_root->notify_key_event(code, false) )
+       {
+               render();
+       }
 }
 
 bool

Index: testsuite/MovieTester.h
===================================================================
RCS file: /sources/gnash/gnash/testsuite/MovieTester.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- testsuite/MovieTester.h     20 Apr 2007 15:21:59 -0000      1.16
+++ testsuite/MovieTester.h     20 Apr 2007 16:42:43 -0000      1.17
@@ -30,18 +30,18 @@
 #include <string> 
 #include <boost/shared_ptr.hpp>
 
-#define check_pixel(radius, color, tolerance) \
+#define check_pixel(x, y, radius, color, tolerance) \
        {\
                std::stringstream ss; \
                ss << "[" << __FILE__ << ":" << __LINE__ << "]"; \
-               tester.checkPixel(radius, color, tolerance, ss.str(), false); \
+               tester.checkPixel(x, y, radius, color, tolerance, ss.str(), 
false); \
        }
 
-#define xcheck_pixel(radius, color, tolerance) \
+#define xcheck_pixel(x, y, radius, color, tolerance) \
        {\
                std::stringstream ss; \
                ss << "[" << __FILE__ << ":" << __LINE__ << "]"; \
-               tester.checkPixel(radius, color, tolerance, ss.str(), true); \
+               tester.checkPixel(x, y, radius, color, tolerance, ss.str(), 
true); \
        }
 
 // Forward declarations
@@ -143,6 +143,14 @@
        ///
        /// This method will test any built renderer.
        ///
+       /// @param x
+       ///     The x coordinate of the point being the center
+       ///     of the circle you want to compute the average color of.
+       ///
+       /// @param y
+       ///     The y coordinate of the point being the center
+       ///     of the circle you want to compute the average color of.
+       ///
        /// @param radius
        ///     Radius defining the average zone used.
        ///     1 means a single pixel.
@@ -160,7 +168,8 @@
        /// @param expectFailure
        ///     Set to true if a failure is expected. Defaults to false.
        ///
-       void checkPixel(unsigned radius, const rgba& color, short unsigned 
tolerance, const std::string& label, bool expectFailure=false) const;
+       void checkPixel(int x, int y, unsigned radius, const rgba& color,
+                       short unsigned tolerance, const std::string& label, 
bool expectFailure=false) const;
 
        /// Notify mouse button was pressed
        void pressMouseButton();
@@ -169,11 +178,7 @@
        void depressMouseButton();
 
        /// Simulate a mouse click (press and depress mouse button)
-       void click()
-       {
-               pressMouseButton();
-               depressMouseButton();
-       }
+       void click();
 
        /// Notify key press
        //

Index: testsuite/misc-ming.all/ButtonEventsTest-Runner.cpp
===================================================================
RCS file: 
/sources/gnash/gnash/testsuite/misc-ming.all/ButtonEventsTest-Runner.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- testsuite/misc-ming.all/ButtonEventsTest-Runner.cpp 20 Apr 2007 15:41:06 
-0000      1.15
+++ testsuite/misc-ming.all/ButtonEventsTest-Runner.cpp 20 Apr 2007 16:42:43 
-0000      1.16
@@ -39,6 +39,7 @@
        rgba red(255,0,0,255);
        rgba covered_red(127,126,0,255); // red, covered by 50% black
        rgba yellow(255,255,0,255);
+       rgba covered_yellow(128,255,0,255); // yellow, covered by 50% black
        rgba green(0,255,0,255);
 
        // roll over the middle of the square, this should change
@@ -48,7 +49,8 @@
        check_equals(string(text2->get_text_value()), string("RollOver"));
        check(tester.isMouseOverMouseEntity());
        // check that pixel @ 60,60 is yellow !
-       xcheck_pixel(2, yellow, 2);
+       if ( covered ) { check_pixel(60, 60, 2, covered_yellow, 2);  }
+       else { check_pixel(60, 60, 2, yellow, 2);  }
 
        // press the mouse button, this should change
        // the textfield value.
@@ -57,7 +59,7 @@
        check_equals(string(text2->get_text_value()), string("Press"));
        check(tester.isMouseOverMouseEntity());
        // check that pixel @ 60,60 is green !
-       xcheck_pixel(2, green, 2);
+       check_pixel(60, 60, 2, green, 2);
 
        // depress the mouse button, this should change
        // the textfield value.
@@ -66,7 +68,8 @@
        check_equals(string(text2->get_text_value()), string("Release"));
        check(tester.isMouseOverMouseEntity());
        // check that pixel @ 60,60 is yellow !
-       xcheck_pixel(2, yellow, 2);
+       if ( covered ) { check_pixel(60, 60, 2, covered_yellow, 2);  }
+       else { check_pixel(60, 60, 2, yellow, 2);  }
 
        // roll off the square, this should change
        // the textfield value.
@@ -75,13 +78,8 @@
        check_equals(string(text2->get_text_value()), string("RollOut"));
        check(!tester.isMouseOverMouseEntity());
        // check that pixel @ 60,60 is red !
-       tester.movePointerTo(60, 60);
-       if ( covered ) {
-               check_pixel(2, covered_red, 2);
-       } else {
-               check_pixel(2, red, 2);
-       }
-       tester.movePointerTo(39, 60); // get back
+       if ( covered ) { check_pixel(60, 60, 2, covered_red, 2); }
+       else { check_pixel(60, 60, 2, red, 2); }
 
        // press the mouse button, this should not change anything
        // as we're outside of the button.
@@ -90,13 +88,8 @@
        check_equals(string(text2->get_text_value()), string("RollOut"));
        check(!tester.isMouseOverMouseEntity());
        // check that pixel @ 60,60 is red !
-       tester.movePointerTo(60, 60);
-       if ( covered ) {
-               check_pixel(2, covered_red, 2);
-       } else {
-               check_pixel(2, red, 2);
-       }
-       tester.movePointerTo(39, 60); // get back
+       if ( covered ) { check_pixel(60, 60, 2, covered_red, 2); }
+       else { check_pixel(60, 60, 2, red, 2); }
 
        // depress the mouse button, this should not change anything
        // as we're outside of the button.
@@ -105,27 +98,24 @@
        check_equals(string(text2->get_text_value()), string("RollOut"));
        check(!tester.isMouseOverMouseEntity());
        // check that pixel @ 60,60 is red !
-       tester.movePointerTo(60, 60);
-       if ( covered ) {
-               check_pixel(2, covered_red, 2);
-       } else {
-               check_pixel(2, red, 2);
-       }
+       if ( covered ) { check_pixel(60, 60, 2, covered_red, 2); }
+       else { check_pixel(60, 60, 2, red, 2); }
 
        // Now press the mouse inside and release outside
-       tester.movePointerTo(60, 60); // should be there already
+       tester.movePointerTo(60, 60); 
        check_equals(string(text->get_text_value()), string("MouseOver"));
        check_equals(string(text2->get_text_value()), string("RollOver"));
        check(tester.isMouseOverMouseEntity());
        // check that pixel @ 60,60 is yellow !
-       xcheck_pixel(2, yellow, 2);
+       if ( covered ) { check_pixel(60, 60, 2, covered_yellow, 2);  }
+       else { check_pixel(60, 60, 2, yellow, 2);  }
        
        tester.pressMouseButton();
        check_equals(string(text->get_text_value()), string("MouseDown"));
        check_equals(string(text2->get_text_value()), string("Press"));
        check(tester.isMouseOverMouseEntity());
        // check that pixel @ 60,60 is green !
-       xcheck_pixel(2, rgba(0,255,0,255), 2);
+       check_pixel(60, 60, 2, rgba(0,255,0,255), 2);
        tester.movePointerTo(39, 60);
        // The following might be correct, as the character still catches 
releaseOutside events
        //check(tester.isMouseOverMouseEntity());

Index: testsuite/misc-ming.all/attachMovieTestRunner.cpp
===================================================================
RCS file: 
/sources/gnash/gnash/testsuite/misc-ming.all/attachMovieTestRunner.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- testsuite/misc-ming.all/attachMovieTestRunner.cpp   20 Apr 2007 15:21:59 
-0000      1.8
+++ testsuite/misc-ming.all/attachMovieTestRunner.cpp   20 Apr 2007 16:42:43 
-0000      1.9
@@ -59,7 +59,7 @@
        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);
+       check_pixel(30, 30, 2, rgba(255,255,255,255), 2);
 
        tester.advance();
 
@@ -71,12 +71,12 @@
        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);
+       check_pixel(30, 30, 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);
+       check_pixel(100, 30, 2, rgba(255,255,255,255), 2);
 
        root->get_member("mousedown", &tmp);
        check(tmp.is_undefined());
@@ -107,12 +107,12 @@
        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);
+       check_pixel(100, 30, 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);
+       check_pixel(170, 30, 2, rgba(255,255,255,255), 2);
 
        tester.advance();
 
@@ -124,12 +124,12 @@
        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);
+       check_pixel(170, 30, 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);
+       check_pixel(240, 30, 2, rgba(255,255,255,255), 2);
 
        tester.advance();
 
@@ -141,12 +141,12 @@
        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);
+       check_pixel(240, 30, 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);
+       check_pixel(340, 30, 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]