gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r9627: Refine the test and make it a


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r9627: Refine the test and make it a bit more robust.
Date: Wed, 20 Aug 2008 14:47:44 +0200
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9627
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Wed 2008-08-20 14:47:44 +0200
message:
  Refine the test and make it a bit more robust.
modified:
  testsuite/XmlSocketServer.pl
  testsuite/misc-ming.all/XMLSocketTest.c
=== modified file 'testsuite/XmlSocketServer.pl'
--- a/testsuite/XmlSocketServer.pl      2008-08-20 11:35:33 +0000
+++ b/testsuite/XmlSocketServer.pl      2008-08-20 12:47:44 +0000
@@ -1,5 +1,6 @@
 use IO::Socket;
 use IO::Select;
+use Time::HiRes;
 
 $SIG{PIPE}='IGNORE';
 
@@ -28,7 +29,10 @@
                 }
             }
             else {
-
+            
+                # Sleep a bit before sending a reply to mimic web traffic
+                # (well, sort of).
+                Time::HiRes::sleep(0.5);
                 print "XmlSocketServer: sending \"$i\" \n";
               
                 $i =~ s/\*NEWLINE\*/\n/;

=== modified file 'testsuite/misc-ming.all/XMLSocketTest.c'
--- a/testsuite/misc-ming.all/XMLSocketTest.c   2008-08-20 11:35:33 +0000
+++ b/testsuite/misc-ming.all/XMLSocketTest.c   2008-08-20 12:47:44 +0000
@@ -54,7 +54,7 @@
 
     mo = newSWFMovieWithVersion(OUTPUT_VERSION);
     SWFMovie_setDimension(mo, 800, 600);
-    SWFMovie_setRate (mo, 12.0);
+    SWFMovie_setRate (mo, 4.0);
 
     dejagnuclip = get_dejagnu_clip((SWFBlock)get_default_font(srcdir), 10, 0, 
0, 800, 600);
     SWFMovie_add(mo, (SWFBlock)dejagnuclip);
@@ -78,9 +78,10 @@
        frame */
     add_actions(mo, 
         "function handleData(data) {                "
+        "    play();                                "
         "    trace('Data received: ' + data);       "
         "    receivedArray.push(data);              "
-        "    _root.gotoAndStop(4);                  "
+        "    trace ('Pushed data');"
         "};                                         "
     );
 
@@ -97,6 +98,7 @@
     add_actions(mo, "stop();");
 
     add_actions(mo,
+        "wait = 0;"
         "count = -1;"
         "connected = false;"
         "myXML = new XMLSocket;"
@@ -127,6 +129,7 @@
         "xmlArray[8] = undefined;"
         "xmlArray[9] = 9;"
         "xmlArray[10] = '';"
+        "xmlArray[11] = 'Last Item';"
     );
 
     /* The data we should get back */
@@ -147,6 +150,7 @@
         "expectedArray[12] = 'undefined';"
         "expectedArray[13] = 9;"
         "expectedArray[14] = '';"
+        "expectedArray[15] = 'Last Item';"
     );
 
 
@@ -171,34 +175,53 @@
 
     add_actions(mo,
         "count++;"
-        "if (count >= xmlArray.length) { _root.gotoAndStop(5); };"
-        "trace('Frame 3: sending ' + xmlArray[count]);"
+        "if (count >= xmlArray.length) { _root.gotoAndStop(4); };"
+        "trace('Frame 3 (iteration ' + count + '): sending ' + 
xmlArray[count]);"
         "myXML.send(xmlArray[count]);"
         "play();"
     );
     
 
     /* Frame 4 */
-    /* We arrive here when we have data and go back to  */
-    SWFMovie_nextFrame(mo);
-
-    add_actions(mo,
+    /* This is here to make a small pause between each send 
+       (a quarter of a second) */
+    SWFMovie_nextFrame(mo);
+
+    add_actions(mo,
+        "trace ('Frame 4');"
+        "play();"
+    );
+
+    /* Frame 5 */
+    /* If we have sent all the data, continue. Otherwise send the next item */
+    SWFMovie_nextFrame(mo);
+
+    add_actions(mo,
+        "trace ('Frame 5');"
         "if (count < xmlArray.length - 1 ) { _root.gotoAndStop(3); };"
         "play();"
     );
 
-    /* Frame 5 */
-    /* We wait here when we've sent all the data' */
-    SWFMovie_nextFrame(mo); 
-
-    add_actions(mo,
-        "play();"
-    );
-
-
-    /* Last frame (7) */
-    SWFMovie_nextFrame(mo);
-
+    /* Frame 6 */
+    /* This is a bit of a hackish loop to wait for data */
+    SWFMovie_nextFrame(mo);
+
+    add_actions(mo,
+        "play();"
+    );
+
+    /* Frame 7 */
+    SWFMovie_nextFrame(mo);
+
+    add_actions(mo,
+        "if (receivedArray[receivedArray.length -1] != 'Last Item' && wait++ < 
10)"
+        "{ _root.gotoAndStop(6); };"
+        "play();"
+    );
+
+
+    /* Last frame (8) */
+    SWFMovie_nextFrame(mo);
 
     check_equals(mo, "receivedArray.length", "expectedArray.length");
     


reply via email to

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