gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r9963: Test for onSoundComplete and


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r9963: Test for onSoundComplete and duration.
Date: Wed, 08 Oct 2008 13:58:12 +0200
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9963
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Wed 2008-10-08 13:58:12 +0200
message:
  Test for onSoundComplete and duration.
modified:
  testsuite/misc-ming.all/EmbeddedSoundTest-Runner.cpp
  testsuite/misc-ming.all/EmbeddedSoundTest.c
=== modified file 'testsuite/misc-ming.all/EmbeddedSoundTest-Runner.cpp'
--- a/testsuite/misc-ming.all/EmbeddedSoundTest-Runner.cpp      2008-10-08 
10:47:01 +0000
+++ b/testsuite/misc-ming.all/EmbeddedSoundTest-Runner.cpp      2008-10-08 
11:58:12 +0000
@@ -25,6 +25,8 @@
 #include "character.h"
 #include "DisplayList.h"
 #include "log.h"
+#include "GnashSleep.h"
+#include "VM.h"
 
 #include "check.h"
 #include <string>
@@ -45,14 +47,25 @@
        sprite_instance* root = tester.getRootMovie();
        assert(root);
 
+    VM& vm = root->getVM();
+    string_table& st = vm.getStringTable();
+
     const size_t framecount = root->get_frame_count();
 
-       while (true)
-       {
-        if (root->get_current_frame() + 1 == framecount) break;
-
-               tester.advance();
-       }
+    // 20 x 0.75 seconds = 15 in total. The sound should last
+    // 13.74 seconds.
+    for (size_t i = 0; i < 20; ++i)
+    {
+        while (true)
+        {
+            if (root->get_current_frame() + 1 == framecount) break;
+            tester.advance();
+       
+        }
+        gnashSleep(750000);
+    }
+    as_value eot;
+    check(root->get_member(st.find("finished"), &eot));
 
 }
 

=== modified file 'testsuite/misc-ming.all/EmbeddedSoundTest.c'
--- a/testsuite/misc-ming.all/EmbeddedSoundTest.c       2008-10-08 11:48:53 
+0000
+++ b/testsuite/misc-ming.all/EmbeddedSoundTest.c       2008-10-08 11:58:12 
+0000
@@ -72,10 +72,10 @@
             SWF_SOUND_16BITS |
             SWF_SOUND_STEREO);
 
-    SWFMovie_addExport(mo, (SWFSound)soundMP3a, "somp3a");
-    SWFMovie_addExport(mo, (SWFSound)soundMP3b, "somp3b");
-    SWFMovie_addExport(mo, (SWFSound)soundMP3c, "somp3c");
-    SWFMovie_addExport(mo, (SWFSound)soundMP3d, "somp3d");
+    SWFMovie_addExport(mo, (SWFSound)soundMP3a, "mono22_mp2");
+    SWFMovie_addExport(mo, (SWFSound)soundMP3b, "mono22_mp2b");
+    SWFMovie_addExport(mo, (SWFSound)soundMP3c, "stereo8_mp3");
+    SWFMovie_addExport(mo, (SWFSound)soundMP3d, "stereo8_mp3b");
 
     SWFMovie_writeExports(mo);
 }
@@ -108,7 +108,7 @@
        Ming_setScale(20.0); /* let's talk pixels */
  
        mo = newSWFMovie();
-       SWFMovie_setRate(mo, 12);
+       SWFMovie_setRate(mo, 1.33);
        SWFMovie_setDimension(mo, 640, 400);
 
        /*********************************************
@@ -123,33 +123,40 @@
 
        SWFMovie_nextFrame(mo);  /* end of frame1 */
 
-
-    add_actions(mo, "a = new Sound(); a.attachSound('somp3a');");
-    add_actions(mo, "b = new Sound(); b.attachSound('somp3b');");
-    add_actions(mo, "c = new Sound(); c.attachSound('somp3c');");
-    add_actions(mo, "d = new Sound(); d.attachSound('somp3d');");
+    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');");
+    add_actions(mo, "d = new Sound(); d.attachSound('stereo8_mp3b');");
 
     check_equals(mo, "a.duration", "13740");
     check_equals(mo, "a.position", "0");
-    add_actions(mo, "a.playSound();");
+    add_actions(mo, "a.start();");
     check_equals(mo, "a.position", "0");
 
     check_equals(mo, "b.duration", "13740");
     check_equals(mo, "b.position", "0");
-    add_actions(mo, "b.play();");
+    add_actions(mo, "b.start();");
     check_equals(mo, "b.position", "0");
 
     check_equals(mo, "c.duration", "5224");
     check_equals(mo, "c.position", "0");
-    add_actions(mo, "c.playSound();");
+    add_actions(mo, "c.start();");
     check_equals(mo, "c.position", "0");
 
     check_equals(mo, "d.duration", "5224");
     check_equals(mo, "d.position", "0");
-    add_actions(mo, "d.playSound();");
+    add_actions(mo, "d.start();");
     check_equals(mo, "d.position", "0");
     
-    add_actions(mo, "totals(12); stop();");
+    SWFMovie_nextFrame(mo);
+
+    add_actions(mo, "stop();");
+
+    add_actions(mo, "a.onSoundComplete = function() {"
+            "check_equals(a.position, 13740);"
+            "totals(13); "
+            "finished = true;"
+            "};");
 
        /*****************************************************
         *


reply via email to

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