gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r9972: More tests for Sound.


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r9972: More tests for Sound.
Date: Wed, 08 Oct 2008 19:37:50 +0200
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9972
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Wed 2008-10-08 19:37:50 +0200
message:
  More tests for Sound.
modified:
  testsuite/misc-ming.all/EmbeddedSoundTest.c
=== modified file 'testsuite/misc-ming.all/EmbeddedSoundTest.c'
--- a/testsuite/misc-ming.all/EmbeddedSoundTest.c       2008-10-08 17:10:57 
+0000
+++ b/testsuite/misc-ming.all/EmbeddedSoundTest.c       2008-10-08 17:37:50 
+0000
@@ -123,12 +123,18 @@
 
        SWFMovie_nextFrame(mo);  /* end of frame1 */
 
+    // Tracker variables for calls to onSoundComplete
     add_actions(mo, "c_soundComplete = 0;");
+    add_actions(mo, "d_soundComplete = 0;");
+    add_actions(mo, "e_soundComplete = 0;");
 
     add_actions(mo, "a = new Sound(); a.attachSound('mono22_mp2');");
     add_actions(mo, "b = new Sound(); b.attachSound('mono22_mp2b');");
     add_actions(mo, "c = new Sound(); c.attachSound('stereo8_mp3');");
+
+    // Two different Sounds with the same exported sound.
     add_actions(mo, "d = new Sound(); d.attachSound('stereo8_mp3b');");
+    add_actions(mo, "e = new Sound(); e.attachSound('stereo8_mp3b');");
 
     check_equals(mo, "a.duration", "13740");
     add_actions(mo, "check_equals(a.getBytesTotal(), undefined);");
@@ -145,34 +151,62 @@
 
     check_equals(mo, "c.duration", "5224");
     check_equals(mo, "c.position", "0");
+    // Play twice (loop).
     add_actions(mo, "c.start(0, 2);");
     check_equals(mo, "c.position", "0");
 
     check_equals(mo, "d.duration", "5224");
     check_equals(mo, "d.position", "0");
+    // Start twice.
     add_actions(mo, "d.start();");
     add_actions(mo, "d.start(4);");
     check_equals(mo, "d.position", "0");
-    
+
+    add_actions(mo, "e.start();");
+
     SWFMovie_nextFrame(mo);
 
     add_actions(mo, "stop();"
             "note('will wait for onSoundComplete to finish the test (about "
             "13 seconds).');");
 
+    // This is the longest sound, so the test should end when this is called.
     add_actions(mo, "a.onSoundComplete = function() {"
             "check_equals(a.position, 13740);"
             "check_equals(c_soundComplete, 1);"
-            "totals(18); "
+            "check_equals(d_soundComplete, 1);"
+            "check_equals(e_soundComplete, 2);"
+            "totals(26); "
             "finished = true;"
             "};");
 
+    // Check position of b, c, d, and e after the first loop of c.
     add_actions(mo, "c.onSoundComplete = function() {"
+            // I'm not sure how reliable this is:
             "check_equals(b.position, 10472);"
+            "check_equals(c.position, 5224);"
+            "check_equals(d.position, 5224);"
+            "check_equals(e.position, 5224);"
             "c_soundComplete++;"
             "note('c.onSoundComplete() called '+c_soundComplete+' time(s).');"
             "};");
 
+    add_actions(mo, "d.onSoundComplete = function() {"
+            "check_equals(d.position, 5224);"
+            "d_soundComplete++;"
+            "note('d.onSoundComplete() called '+d_soundComplete+' time(s).');"
+            "};");
+
+    // This starts e again. It should run twice before the longest
+    // sound stops.
+    add_actions(mo, "e.onSoundComplete = function() {"
+            "check_equals(e.position, 5224);"
+            "e_soundComplete++;"
+            "note('e.onSoundComplete() called '+e_soundComplete+' time(s).');"
+            "e.start();"
+            "};");
+
+
        /*****************************************************
         *
         * Output movie


reply via email to

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