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/SpriteB...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog testsuite/misc-ming.all/SpriteB...
Date: Wed, 16 Apr 2008 15:02:22 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  08/04/16 15:02:22

Modified files:
        .              : ChangeLog 
        testsuite/misc-ming.all: SpriteButtonEventsTest-Runner.cpp 
                                 SpriteButtonEventsTest.c 

Log message:
        Runner was running the wrong test, too the chance to
        cleanup both test and runner. Exposes a few interesting bugs.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6296&r2=1.6297
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/SpriteButtonEventsTest-Runner.cpp?cvsroot=gnash&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/SpriteButtonEventsTest.c?cvsroot=gnash&r1=1.2&r2=1.3

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6296
retrieving revision 1.6297
diff -u -b -r1.6296 -r1.6297
--- ChangeLog   16 Apr 2008 11:54:46 -0000      1.6296
+++ ChangeLog   16 Apr 2008 15:02:21 -0000      1.6297
@@ -1,3 +1,10 @@
+2008-04-16 Sandro Santilli <address@hidden>
+
+       * testsuite/misc-ming.all/: SpriteButtonEventsTest-Runner.cpp,
+         SpriteButtonEventsTest.c:
+         Runner was running the wrong test, too the chance to
+         cleanup both test and runner. Exposes a few interesting bugs.
+
 2008-04-16 Benjamin Wolsey <address@hidden>
 
        * server/asobj/Global.cpp: trace is ASnative(100, 4).

Index: testsuite/misc-ming.all/SpriteButtonEventsTest-Runner.cpp
===================================================================
RCS file: 
/sources/gnash/gnash/testsuite/misc-ming.all/SpriteButtonEventsTest-Runner.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- testsuite/misc-ming.all/SpriteButtonEventsTest-Runner.cpp   21 Jan 2008 
23:26:51 -0000      1.6
+++ testsuite/misc-ming.all/SpriteButtonEventsTest-Runner.cpp   16 Apr 2008 
15:02:22 -0000      1.7
@@ -18,7 +18,7 @@
  *
  */ 
 
-#define INPUT_FILENAME "ButtonEventsTest.swf"
+#define INPUT_FILENAME "SpriteButtonEventsTest.swf"
 
 #include "MovieTester.h"
 #include "sprite_instance.h"
@@ -42,20 +42,24 @@
        rgba covered_yellow(128,255,0,255); // yellow, covered by 50% black
        rgba green(0,255,0,255);
 
+       string tmp, tmp2; // to backup text and text2 values before changing 
them
+
        // roll over the middle of the square, this should change
        // the textfield value, if enabled
+       tmp = text->get_text_value();
+       tmp2 = text2->get_text_value();
        tester.movePointerTo(60, 60);
        if ( enabled ) {
-               check_equals(string(text->get_text_value()), 
string("MouseOver"));
-               check_equals(string(text2->get_text_value()), 
string("RollOver"));
+               check_equals(string(text->get_text_value()), 
string("RollOver"));
+               check_equals(string(text2->get_text_value()), tmp2); // would 
retain last value
                check(tester.isMouseOverMouseEntity());
                // check that pixel @ 60,60 is yellow !
                if ( covered ) { check_pixel(60, 60, 2, covered_yellow, 2);  }
                else { check_pixel(60, 60, 2, yellow, 2);  }
        } else {
-               check_equals(string(text->get_text_value()), 
string("MouseOut"));
-               check_equals(string(text2->get_text_value()), 
string("RollOut"));
-               check(!tester.isMouseOverMouseEntity());
+               check_equals(string(text->get_text_value()), tmp); // not 
enabled...
+               check_equals(string(text2->get_text_value()), tmp2); // would 
retain last value
+               xcheck(!tester.isMouseOverMouseEntity()); // gnash still 
considers it active
                // check that pixel @ 60,60 is red !
                if ( covered ) { check_pixel(60, 60, 2, covered_red, 2);  }
                else { check_pixel(60, 60, 2, red, 2);  }
@@ -65,15 +69,15 @@
        // the textfield value, if enabled.
        tester.pressMouseButton();
        if ( enabled ) {
-               check_equals(string(text->get_text_value()), 
string("MouseDown"));
-               check_equals(string(text2->get_text_value()), string("Press"));
+               check_equals(string(text->get_text_value()), string("Press"));
+               check_equals(string(text2->get_text_value()), 
string("MouseDown"));
                check(tester.isMouseOverMouseEntity());
                // check that pixel @ 60,60 is green !
                check_pixel(60, 60, 2, green, 2);
        } else {
-               check_equals(string(text->get_text_value()), 
string("MouseOut"));
-               check_equals(string(text2->get_text_value()), 
string("RollOut"));
-               check(!tester.isMouseOverMouseEntity());
+               check_equals(string(text->get_text_value()), tmp); 
+               check_equals(string(text2->get_text_value()), 
string("MouseDown")); // no matter .enabled
+               xcheck(!tester.isMouseOverMouseEntity()); // Gnash should check 
.enabled
                // check that pixel @ 60,60 is red !
                if ( covered ) { check_pixel(60, 60, 2, covered_red, 2);  }
                else { check_pixel(60, 60, 2, red, 2);  }
@@ -83,36 +87,47 @@
        // the textfield value, if enabled
        tester.depressMouseButton();
        if ( enabled ) {
-               check_equals(string(text->get_text_value()), string("MouseUp"));
-               check_equals(string(text2->get_text_value()), 
string("Release"));
+               check_equals(string(text->get_text_value()), string("Release"));
+               check_equals(string(text2->get_text_value()), 
string("MouseUp"));
                check(tester.isMouseOverMouseEntity());
                // check that pixel @ 60,60 is yellow !
                if ( covered ) { check_pixel(60, 60, 2, covered_yellow, 2);  }
                else { check_pixel(60, 60, 2, yellow, 2);  }
        } else {
-               check_equals(string(text->get_text_value()), 
string("MouseOut"));
-               check_equals(string(text2->get_text_value()), 
string("RollOut"));
-               check(!tester.isMouseOverMouseEntity());
+               check_equals(string(text->get_text_value()), tmp);
+               check_equals(string(text2->get_text_value()), 
string("MouseUp")); // no matter .enabled
+               xcheck(!tester.isMouseOverMouseEntity()); // Gnash should check 
.enabled
                // check that pixel @ 60,60 is red !
                if ( covered ) { check_pixel(60, 60, 2, covered_red, 2);  }
                else { check_pixel(60, 60, 2, red, 2);  }
        }
 
+       tmp = text->get_text_value();
+       tmp2 = text2->get_text_value();
+
        // roll off the square, this should change
        // the textfield value, if enabled
        tester.movePointerTo(39, 60);
-       check_equals(string(text->get_text_value()), string("MouseOut"));
-       check_equals(string(text2->get_text_value()), string("RollOut"));
+       if ( enabled ) {
+               check_equals(string(text->get_text_value()), string("RollOut"));
+               check_equals(string(text2->get_text_value()), tmp2);
+       } else {
+               check_equals(string(text->get_text_value()), tmp);
+               check_equals(string(text2->get_text_value()), tmp2);
+       }
        check(!tester.isMouseOverMouseEntity());
        // check that pixel @ 60,60 is red !
        if ( covered ) { check_pixel(60, 60, 2, covered_red, 2); }
        else { check_pixel(60, 60, 2, red, 2); }
 
+       tmp = text->get_text_value();
+       tmp2 = text2->get_text_value();
+
        // press the mouse button, this should not change anything
        // as we're outside of the button.
        tester.pressMouseButton();
-       check_equals(string(text->get_text_value()), string("MouseOut"));
-       check_equals(string(text2->get_text_value()), string("RollOut"));
+       check_equals(string(text->get_text_value()), tmp);
+       check_equals(string(text2->get_text_value()), string("MouseDown"));
        check(!tester.isMouseOverMouseEntity());
        // check that pixel @ 60,60 is red !
        if ( covered ) { check_pixel(60, 60, 2, covered_red, 2); }
@@ -121,8 +136,8 @@
        // depress the mouse button, this should not change anything
        // as we're outside of the button.
        tester.depressMouseButton();
-       check_equals(string(text->get_text_value()), string("MouseOut"));
-       check_equals(string(text2->get_text_value()), string("RollOut"));
+       check_equals(string(text->get_text_value()), tmp);
+       check_equals(string(text2->get_text_value()), string("MouseUp"));
        check(!tester.isMouseOverMouseEntity());
        // check that pixel @ 60,60 is red !
        if ( covered ) { check_pixel(60, 60, 2, covered_red, 2); }
@@ -133,16 +148,16 @@
        tester.movePointerTo(60, 60); 
 
        if ( enabled ) {
-               check_equals(string(text->get_text_value()), 
string("MouseOver"));
-               check_equals(string(text2->get_text_value()), 
string("RollOver"));
+               check_equals(string(text->get_text_value()), 
string("RollOver"));
+               check_equals(string(text2->get_text_value()), tmp2);
                check(tester.isMouseOverMouseEntity());
                // check that pixel @ 60,60 is yellow !
                if ( covered ) { check_pixel(60, 60, 2, covered_yellow, 2);  }
                else { check_pixel(60, 60, 2, yellow, 2);  }
        } else {
-               check_equals(string(text->get_text_value()), 
string("MouseOut"));
-               check_equals(string(text2->get_text_value()), 
string("RollOut"));
-               check(!tester.isMouseOverMouseEntity());
+               check_equals(string(text->get_text_value()), tmp);
+               check_equals(string(text2->get_text_value()), tmp2);
+               xcheck(!tester.isMouseOverMouseEntity()); // Gnash should check 
.enabled
                // check that pixel @ 60,60 is red !
                if ( covered ) { check_pixel(60, 60, 2, covered_red, 2); }
                else { check_pixel(60, 60, 2, red, 2); }
@@ -151,15 +166,15 @@
        tester.pressMouseButton();
 
        if ( enabled ) {
-               check_equals(string(text->get_text_value()), 
string("MouseDown"));
-               check_equals(string(text2->get_text_value()), string("Press"));
+               check_equals(string(text->get_text_value()), string("Press"));
+               check_equals(string(text2->get_text_value()), 
string("MouseDown"));
                check(tester.isMouseOverMouseEntity());
                // check that pixel @ 60,60 is green !
                check_pixel(60, 60, 2, rgba(0,255,0,255), 2);
        } else {
-               check_equals(string(text->get_text_value()), 
string("MouseOut"));
-               check_equals(string(text2->get_text_value()), 
string("RollOut"));
-               check(!tester.isMouseOverMouseEntity());
+               check_equals(string(text->get_text_value()), tmp);
+               check_equals(string(text2->get_text_value()), 
string("MouseDown"));
+               xcheck(!tester.isMouseOverMouseEntity()); // Gnash should check 
.enabled
                // check that pixel @ 60,60 is red !
                if ( covered ) { check_pixel(60, 60, 2, covered_red, 2); }
                else { check_pixel(60, 60, 2, red, 2); }
@@ -172,11 +187,11 @@
        tester.depressMouseButton();
 
        if ( enabled ) {
-               xcheck_equals(string(text->get_text_value()), 
string("MouseUpOutside"));
-               xcheck_equals(string(text2->get_text_value()), 
string("ReleaseOutside"));
+               xcheck_equals(string(text->get_text_value()), 
string("ReleaseOutside")); // Gnash doesn't send this event !
+               check_equals(string(text2->get_text_value()), "MouseUp");
        } else {
-               check_equals(string(text->get_text_value()), 
string("MouseOut"));
-               check_equals(string(text2->get_text_value()), 
string("RollOut"));
+               xcheck_equals(string(text->get_text_value()), 
string("ReleaseOutside")); // Gnash doesn't send this event !
+               check_equals(string(text2->get_text_value()), "MouseUp");
        }
 }
 
@@ -192,14 +207,9 @@
        sprite_instance* root = tester.getRootMovie();
        assert(root);
 
-       check_equals(root->get_frame_count(), 4);
-
+       check_equals(root->get_frame_count(), 5);
        check_equals(root->get_current_frame(), 0);
 
-       const character* mc1 = tester.findDisplayItemByName(*root, "square1");
-       check(mc1);
-       check_equals(mc1->get_depth(), 2+character::staticDepthOffset);
-
        const character* text = tester.findDisplayItemByName(*root, 
"textfield");
        check(text);
 
@@ -209,6 +219,14 @@
        const character* text3 = tester.findDisplayItemByName(*root, 
"textfield3");
        check(text3);
 
+       tester.advance();
+       check_equals(root->get_current_frame(), 1);
+
+       const character* mc1 = tester.findDisplayItemByName(*root, "square1");
+       check(mc1);
+       check_equals(mc1->get_depth(), 2+character::staticDepthOffset);
+
+
        check_equals(string(text->get_text_value()), idleString);
        check_equals(string(text2->get_text_value()), idleString);
        check_equals(string(text3->get_text_value()), idleString);
@@ -217,22 +235,22 @@
        rgba red(255,0,0,255);
        check_pixel(60, 60, 2, red, 2);
 
-       for (size_t fno=0; fno<root->get_frame_count(); fno++)
+       for (size_t fno=1; fno<root->get_frame_count(); fno++)
        {
                const character* square_back = 
tester.findDisplayItemByDepth(*root, 1+character::staticDepthOffset);
                const character* square_front = 
tester.findDisplayItemByDepth(*root, 3+character::staticDepthOffset);
 
                switch (fno)
                {
-                       case 0:
+                       case 1:
                                check(!square_back);
                                check(!square_front);
                                break;
-                       case 1:
+                       case 2:
                                check(square_back);
                                check(!square_front);
                                break;
-                       case 2:
+                       case 3:
                                check(square_back);
                                check(square_front);
                                break;
@@ -250,8 +268,9 @@
 
        }
 
-       // last advance should restart the loop...
-       check_equals(root->get_current_frame(), 0);
+       // last advance should not restart the loop (it's in STOP mode)
+        check_equals(root->get_play_state(), sprite_instance::STOP);
+       check_equals(root->get_current_frame(), 4);
 
 }
 

Index: testsuite/misc-ming.all/SpriteButtonEventsTest.c
===================================================================
RCS file: 
/sources/gnash/gnash/testsuite/misc-ming.all/SpriteButtonEventsTest.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- testsuite/misc-ming.all/SpriteButtonEventsTest.c    1 Jul 2007 10:54:47 
-0000       1.2
+++ testsuite/misc-ming.all/SpriteButtonEventsTest.c    16 Apr 2008 15:02:22 
-0000      1.3
@@ -30,10 +30,10 @@
  * The following events print the event name in the text area
  * (called _root.textfield) and change the color of the button:
  *
- * MouseOut  : red button (initial state)
- * MouseOver : yellow button
- * MouseDown : green button
- * MouseUp   : yellow button (same as MouseOver, but the label on top changes)
+ * RollOut  : red button (initial state)
+ * RollOver : yellow button
+ * Press    : green button
+ * Release  : yellow button (same as MouseOver, but the label on top changes)
  *
  ***********************************************************************/
 
@@ -98,13 +98,49 @@
 
        SWFMovieClip_add(bu, (SWFBlock)sh2); // red when idle
        SWFMovieClip_add(bu, (SWFBlock)compileSWFActionCode(
-                               "onRollOut = function() { _root.msg='MouseOut'; 
_root.msg2='RollOver'; gotoAndStop(1); };"
-                               "onRollOver = function() { 
_root.msg='MouseOver'; _root.msg2='RollOut'; gotoAndStop(3); };"
-                               "onMouseDown = function() { 
_root.msg='MouseDown'; gotoAndStop(2); };"
-                               "onRelease = function() { _root.msg='MouseUp'; 
_root.msg2='Release'; gotoAndStop(1); };"
-                               "onReleaseOutside = function() { 
_root.msg='MouseUpOutside'; _root.msg2='ReleaseOutside'; gotoAndStop(1); };"
+               "onRollOut = function() {"
+               "       _root.note('onRollOut');"
+               "       updateAfterEvent();"
+               "       _root.msg='RollOut';"
+               "       gotoAndStop(1);"
+               "};"
+               "onRollOver = function() {"
+               "       _root.note('onRollOver');"
+               "       updateAfterEvent();"
+               "       _root.msg='RollOver';"
+               "       gotoAndStop(3);"
+               "};"
+               "onMouseDown = function() {"
+               "       _root.note('onMouseDown');"
+               "       updateAfterEvent();"
+               "       _root.msg2='MouseDown';"
+               "};"
+               "onMouseUp = function() {"
+               "       _root.note('onMouseUp');"
+               "       updateAfterEvent();"
+               "       _root.msg2='MouseUp';"
+               "};"
+               "onPress = function() {"
+               "       _root.note('onPress');"
+               "       updateAfterEvent();"
+               "       _root.msg='Press';"
+               "       gotoAndStop(2);"
+               "};"
+               "onRelease = function() {"
+               "       _root.note('onRelease');"
+               "       updateAfterEvent();"
+               "       _root.msg='Release';"
+               "       gotoAndStop(3);"
+               "};"
+               "onReleaseOutside = function() {"
+               "       _root.note('onReleaseOutside');"
+               "       updateAfterEvent();"
+               "       _root.msg='ReleaseOutside';"
+               "       gotoAndStop(1);"
+               "};"
                                "stop();"
                        ));
+
        SWFMovieClip_nextFrame(bu);
 
        SWFMovieClip_add(bu, (SWFBlock)sh3); // green on button press
@@ -166,6 +202,7 @@
        SWFDisplayItem it;
        const char *srcdir=".";
        char fdbfont[256];
+       SWFMovieClip dejagnuclip;
 
        /*********************************************
         *
@@ -180,7 +217,7 @@
        Ming_setScale(20.0); 
  
        mo = newSWFMovie();
-       SWFMovie_setDimension(mo, 120, 120);
+       SWFMovie_setDimension(mo, 800, 600);
        SWFMovie_setRate(mo, 1);
 
        if ( argc>1 ) srcdir=argv[1];
@@ -200,10 +237,18 @@
        /*SWFBrowserFont bfont = newSWFBrowserFont("_sans");*/
        font = loadSWFFontFromFile(font_file);
 
+       /* Dejagnu equipment */
+       dejagnuclip = get_dejagnu_clip((SWFBlock)font, 10, 0, 0, 800, 600);
+       it = SWFMovie_add(mo, (SWFBlock)dejagnuclip);
+       SWFDisplayItem_setDepth(it, 200); 
+       SWFDisplayItem_move(it, 200, 0); 
+
        add_text_field(mo, "textfield", "_root.msg", "Button events", 10, 0, 5);
        add_text_field(mo, "textfield2", "_root.msg2", "Mouse events", 11, 0, 
100);
        add_text_field(mo, "textfield3", "_root.msg3", "Key events", 12, 0, 80);
 
+       SWFMovie_nextFrame(mo);
+
        /*****************************************************
         *
         * Add button
@@ -220,7 +265,7 @@
        //add_actions(mo, "square1.button.onRollOut = function() { _root.msg2 = 
'RollOut'; };");
 
        // Mouse buttons events
-       add_actions(mo, "square1.button.onPress = function() { _root.msg2 = 
'Press'; };");
+       //add_actions(mo, "square1.button.onPress = function() { _root.msg2 = 
'Press'; };");
        //add_actions(mo, "square1.button.onRelease = function() { _root.msg2 = 
'Release'; gotoAndStop(1); };");
        //add_actions(mo, "square1.button.onReleaseOutside = function() { 
_root.msg2 = 'ReleaseOutside'; };");
 
@@ -271,7 +316,12 @@
 
        {
 
-               add_actions(mo, "square1.button.enabled = false;");
+               add_actions(mo,
+                       "square1.button.enabled = false;"
+                       //"_root.msg = _root.msg2 = _root.msg3 = 'Idle';"
+                       "stop();"
+                       "totals();"
+               );
                SWFMovie_nextFrame(mo); /* showFrame */
        }
 




reply via email to

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