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


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog testsuite/misc-ming.all/loop_te...
Date: Fri, 18 May 2007 16:05:32 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/05/18 16:05:32

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

Log message:
                * testsuite/misc-ming.all/: loop_test-Runner.cpp, loop_test.c:
                  Make loop_test.swf self-contained. Use the runner for checking
                  invalidated bounds and rendering.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3274&r2=1.3275
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/loop_test-Runner.cpp?cvsroot=gnash&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/loop_test.c?cvsroot=gnash&r1=1.1&r2=1.2

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.3274
retrieving revision 1.3275
diff -u -b -r1.3274 -r1.3275
--- ChangeLog   18 May 2007 15:39:52 -0000      1.3274
+++ ChangeLog   18 May 2007 16:05:31 -0000      1.3275
@@ -1,3 +1,9 @@
+2007-05-18 Sandro Santilli <address@hidden>
+
+       * testsuite/misc-ming.all/: loop_test-Runner.cpp, loop_test.c:
+         Make loop_test.swf self-contained. Use the runner for checking
+         invalidated bounds and rendering.
+
 2007-05-18  Rob Savoye  <address@hidden>
 
        * backend/sound_handler.cpp: Include cstring so memcpy is

Index: testsuite/misc-ming.all/loop_test-Runner.cpp
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/loop_test-Runner.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- testsuite/misc-ming.all/loop_test-Runner.cpp        12 May 2007 06:50:37 
-0000      1.5
+++ testsuite/misc-ming.all/loop_test-Runner.cpp        18 May 2007 16:05:31 
-0000      1.6
@@ -57,7 +57,7 @@
 
        // TODO: check why we need this !!
        //       I wouldn't want the first advance to be needed
-       tester.advance();
+       //tester.advance();
 
        gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
        dbglogfile.setVerbosity(1);
@@ -66,66 +66,73 @@
        sprite_instance* root = tester.getRootMovie();
        assert(root);
 
-       check_equals(root->get_frame_count(), 30);
-
-       const character* movieClip1 = tester.findDisplayItemByName(*root, 
"movieClip1");
-       check(movieClip1);
-       check_equals(movieClip1->get_depth(), 1+character::staticDepthOffset);
-
-       const character* movieClip2 = tester.findDisplayItemByName(*root, 
"movieClip2");
-       check(movieClip2);
-       check_equals(movieClip2->get_depth(), 2+character::staticDepthOffset);
+       size_t framecount = root->get_frame_count();
+       check_equals(framecount, 3);
+       check_equals(root->get_current_frame(), 0);
 
-       // Advance to frame 27
-       for (int i=root->get_current_frame(); i<28; ++i) {
-               tester.advance();
+       rgba black(0,0,0,255);
+       rgba red(255,0,0,255);
+       rgba white(255,255,255,255);
+
+       // Advance till the movie is stopped (or 10 loops are performed)
+       bool blackOverRed=true;
+       for (size_t i=0; i<=framecount*10; ++i)
+       {
+               check_equals(root->get_current_frame(), i%framecount);
+
+               // Out of any character
+               check_pixel(317, 430, 2, white, 2);
+
+               // Fully on the red square: 317,330
+               check_pixel(317, 330, 2, red, 2);
+
+               // Fully on the black square: 400,330
+               check_pixel(400, 330, 2, black, 2);
+
+               // Intersection of the two squares: 343,330
+               // This is black or red depending on loop count
+               if ( blackOverRed )
+               {
+                       check_pixel(343, 330, 2, black, 2);
        }
-
-       // In frame 29, a swapDepth() action will
-       // change the characters depth
-       tester.advance();
-       check_equals(root->get_current_frame(), 29);
-       check_equals(movieClip1->get_depth(), 2+character::staticDepthOffset);
-       check_equals(movieClip2->get_depth(), 1+character::staticDepthOffset);
-
-       // Now keep advancing until last frame is reached
-       // (29, as framecount is 0-based)
-       for (int i=root->get_current_frame(); i<29; ++i) {
-               tester.advance();
+               else
+               {
+                       check_pixel(343, 330, 2, red, 2);
        }
 
-       check_equals(root->get_current_frame(), 29);
-       check_equals(movieClip1->get_depth(), 2+character::staticDepthOffset);
-       check_equals(movieClip2->get_depth(), 1+character::staticDepthOffset);
-
-
-       // Next advance will make the movie restart
        tester.advance();
-       check_equals(root->get_current_frame(), 0);
 
-       // We expect the depth to be kept on restart
-       check_equals(movieClip1->get_depth(), 2+character::staticDepthOffset);
-       check_equals(movieClip2->get_depth(), 1+character::staticDepthOffset);
-
-       // ... until next SwapDepth ...
-
-       for (int i=root->get_current_frame(); i<28; ++i) {
-               tester.advance();
+               // Let's break if we stopped, as we'll print totals() thus
+               // enlarging invalidated bounds too ...
+               if (root->get_play_state() == sprite_instance::STOP) break;
+
+               // Compute 1-based currentFrame
+               size_t currentFrame = root->get_current_frame()+1;
+
+               if ( currentFrame == 3 ) // We swap depths here !
+               {
+                       blackOverRed = !blackOverRed;
+                       
+                       // Check the intersection of the two characters to
+                       // be invalidated
+                       check( tester.getInvalidatedRanges().contains(343, 330) 
);
+               }
+               else if ( currentFrame == 1 ) // We restarted here !
+               {
+                       assert(i > 1); // to ensure we looped back
+
+                       // Not sure if invalidated ranges should be null here.. 
+                       // visuall, it seems so, but loop-back is too complex
+                       // to be sure (ie: xtrace window text might be reset or 
something)
+                       // I checked that it's not resetDisplayList 
invalidating it...
+                       xcheck( tester.getInvalidatedRanges().isNull() );
+               }
+               else // we did nothing here...
+               {
+                       check( tester.getInvalidatedRanges().isNull() );
        }
 
-       check_equals(movieClip1->get_depth(), 2+character::staticDepthOffset);
-       check_equals(movieClip2->get_depth(), 1+character::staticDepthOffset);
-
-       // we expect depths to be swapped again 
-       tester.advance();
-       check_equals(root->get_current_frame(), 29);
-       check_equals(movieClip1->get_depth(), 1+character::staticDepthOffset);
-       check_equals(movieClip2->get_depth(), 2+character::staticDepthOffset);
+       }
 
-       // .. and the new deptsh to be kept at restart
-       tester.advance();
-       check_equals(root->get_current_frame(), 0);
-       check_equals(movieClip1->get_depth(), 1+character::staticDepthOffset);
-       check_equals(movieClip2->get_depth(), 2+character::staticDepthOffset);
 }
 

Index: testsuite/misc-ming.all/loop_test.c
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/loop_test.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- testsuite/misc-ming.all/loop_test.c 26 Dec 2006 14:30:03 -0000      1.1
+++ testsuite/misc-ming.all/loop_test.c 18 May 2007 16:05:31 -0000      1.2
@@ -21,10 +21,25 @@
  *
  * Test for movie loop.
  * 
- * The _root movie has 30 frames. 
+ * Timeline:
+ * 
+ *   Frame  | 1 | 2 | 3 | 
+ *  --------+---+---+---+
+ *   Event  |PP |   | M |
+ * 
+ *  P = place (by PlaceObject2)
+ *  M = move to another depth (by swapDepth)
+ *
+ * Description:
+ *
+ *  frame1: two static characters are placed
+ *  frame3: the two characters are depth-swapped
+ *
+ * Expected behaviour:
  *
  * Normally, you can see both the red and black squares overlap each
  *  other with equal time.
+ *  A single instance of the two characters is created.
  *
  * run as ./loop_test
  */
@@ -44,14 +59,19 @@
 SWFAction  action_in_root()
 {
   SWFAction ac;
-  ac = compileSWFActionCode(" \
-      var mc1_depth = movieClip1.getDepth(); \
-      var mc2_depth = movieClip2.getDepth(); \
-      movieClip1.swapDepths(movieClip2); \
-  ");
-  // we're not loading dejagnu clip !
-  //_root.check_equals(movieClip1.getDepth(), mc2_depth); 
-  //_root.check_equals(movieClip2.getDepth(), mc1_depth);
+  ac = compileSWFActionCode(
+      "var mc1_depth = movieClip1.getDepth();"
+      "var mc2_depth = movieClip2.getDepth();"
+      "movieClip1.swapDepths(movieClip2);"
+      "_root.check_equals(movieClip1.getDepth(), mc2_depth);" 
+      "_root.check_equals(movieClip2.getDepth(), mc1_depth);"
+      "if ( ++runs > 5 )  {"
+      "  _root.check_equals(mc1Constructed, 1);"
+      "  _root.check_equals(mc2Constructed, 1);"
+      "  totals();"
+      "  stop();"
+      "}"
+  );
   return ac;
 }
 
@@ -79,9 +99,10 @@
   
   mo = newSWFMovie();
   SWFMovie_setDimension(mo, 800, 600);
+  SWFMovie_setRate(mo, 6);
 
-  //dejagnuclip = get_dejagnu_clip((SWFBlock)get_default_font(srcdir), 10, 0, 
0, 800, 600);
-  //SWFMovie_add(mo, (SWFBlock)dejagnuclip);
+  dejagnuclip = get_dejagnu_clip((SWFBlock)get_default_font(srcdir), 10, 0, 0, 
800, 600);
+  SWFMovie_add(mo, (SWFBlock)dejagnuclip);
   //SWFMovie_nextFrame(mo); 
 
 
@@ -97,14 +118,17 @@
 
   SWFDisplayItem it1, it2;
   it1 = SWFMovie_add(mo, (SWFBlock)mc1);  //add movieClip1 to the _root
-  it2 = SWFMovie_add(mo, (SWFBlock)mc2);  //add movieClip2 to the _root
   SWFDisplayItem_setName(it1, "movieClip1"); //name movieClip1
+  SWFDisplayItem_addAction(it1, newSWFAction("_root.mc1Constructed++;"),
+                 SWFACTION_CONSTRUCT);
+
+  it2 = SWFMovie_add(mo, (SWFBlock)mc2);  //add movieClip2 to the _root
   SWFDisplayItem_setName(it2, "movieClip2"); //name movieClip2
+  SWFDisplayItem_addAction(it2, newSWFAction("_root.mc2Constructed++;"),
+                 SWFACTION_CONSTRUCT);
   
-  for(i=0; i<29; i++)
-  {
     SWFMovie_nextFrame(mo); 
-  }
+  SWFMovie_nextFrame(mo); 
 
   ac =  action_in_root();
   SWFMovie_add(mo, (SWFBlock)ac);




reply via email to

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