gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r11061: Automate test for inPoint/ou


From: Sandro Santilli
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r11061: Automate test for inPoint/outPoint (and loop)
Date: Wed, 10 Jun 2009 16:09:21 +0200
User-agent: Bazaar (1.13.1)

------------------------------------------------------------
revno: 11061
committer: Sandro Santilli <address@hidden>
branch nick: trunk
timestamp: Wed 2009-06-10 16:09:21 +0200
message:
  Automate test for inPoint/outPoint (and loop)
modified:
  testsuite/misc-ming.all/eventSoundTest1-Runner.cpp
  testsuite/misc-ming.all/eventSoundTest1.c
=== modified file 'testsuite/misc-ming.all/eventSoundTest1-Runner.cpp'
--- a/testsuite/misc-ming.all/eventSoundTest1-Runner.cpp        2009-06-10 
11:08:18 +0000
+++ b/testsuite/misc-ming.all/eventSoundTest1-Runner.cpp        2009-06-10 
14:09:21 +0000
@@ -79,14 +79,15 @@
        const int totalFrames = root->get_frame_count();
 
        // Make sure you adjust this with the test!
-       cerr << "Total frames: " <<  totalFrames;
-       assert (totalFrames == 20);
+       cerr << "Total frames: " <<  totalFrames << endl;
+       assert (totalFrames == 24);
 
        int numSoundsStarted[] = {
-               0,
-               4,
-               6,
-        12
+               0, 
+               4, // Multiple   (+4 sounds started)
+               6, // NoMultiple (+2 sounds started)
+        9, // Trimmed    (+3 sounds started)
+        15 // Attached   (+6 sounds started)
        };
 
        /// Expected success for each test
@@ -94,6 +95,7 @@
                true,
                true,
                true,
+               true,
                true
        };
 
@@ -107,7 +109,6 @@
                        root->delProperty(st.find("testReady"));
                        
                        // When a test is ready, check the result of the 
previous test.
-                       check_equals(tester.soundsStarted(), 
numSoundsStarted[test]);
                        if (testPasses[test]) {
                                check_equals(tester.soundsStarted(), 
numSoundsStarted[test]);
                        }
@@ -124,6 +125,13 @@
                frame++;
        }
 
+    if (testPasses[test]) {
+        check_equals(tester.soundsStarted(), numSoundsStarted[test]);
+    }
+    else {
+        xcheck_equals(tester.soundsStarted(), numSoundsStarted[test]);
+    }
+
     // Consistency checking
     as_value eot;
     bool endOfTestFound = root->get_member(st.find("endoftest"), &eot);

=== modified file 'testsuite/misc-ming.all/eventSoundTest1.c'
--- a/testsuite/misc-ming.all/eventSoundTest1.c 2009-06-10 11:27:47 +0000
+++ b/testsuite/misc-ming.all/eventSoundTest1.c 2009-06-10 14:09:21 +0000
@@ -17,11 +17,7 @@
  */ 
 
 /*
- * Test for sounds being started and stopped
- * 
- * The _root movie has 20 frames. 
- *
- * In uneven frames a sound is started, and in even frames it is stopped.
+ * Test for event sounds, self-contained self-documented
  */
 
 
@@ -194,8 +190,8 @@
     add_actions(mo,
               "note('\nMultiple Sound Test.\n"
               "The notes should start exactly at the beginning of a frame "
-              "(to coincide with the appearance of the description text).\n"
-              "Test should start in two seconds.');");
+              "(to coincide with the appearance of the description text)"
+              "');\n");
 
     /* This is what is supposed to happen in each frame */
     frameDesc[0] = "Two notes (C, E)";
@@ -206,16 +202,15 @@
 
     for (i = 0; i < 4; i++)
     {
-        SWFMovie_nextFrame(mo);
-
-        (*frame)++;
 
         printFrameInfo(mo, i, frameDesc[i]);
 
         SWFMovie_startSound(mo, so);
+
+        SWFMovie_nextFrame(mo); (*frame)++;
     }
 
-    SWFMovie_nextFrame(mo);
+    //SWFMovie_nextFrame(mo);
 
     printFrameInfo(mo, i, frameDesc[i]);
     SWFMovie_stopSound(mo, so);
@@ -234,7 +229,7 @@
               "note('\nNon-multiple Sound Test\n"
               "The notes should start exactly at the beginning "
               "of a frame (to coincide with the appearance of the description "
-              "text). Test should start in two seconds.');");
+              "text)');");
             
 
   /* This is what is supposed to happen in each frame */
@@ -247,23 +242,62 @@
 
     for (i = 0; i < 4; i++)
     {
-        SWFMovie_nextFrame(mo);
-
-        (*frame)++;
 
         printFrameInfo(mo, i, frameDesc[i]);
 
         SWFSoundInstance so_in = SWFMovie_startSound(mo, so);
         SWFSoundInstance_setNoMultiple(so_in);
+
+        SWFMovie_nextFrame(mo); (*frame)++;
     }
 
-    SWFMovie_nextFrame(mo);
+    //SWFMovie_nextFrame(mo);
 
     printFrameInfo(mo, i, frameDesc[i]);
     SWFMovie_stopSound(mo, so);
 
 }
 
+void
+runTrimmedSoundsTest(SWFMovie mo, SWFSound so, int* frame)
+{
+    SWFSoundInstance so_in;
+    int i;
+
+    SWFMovie_nextFrame(mo);
+    add_actions(mo,
+              "note('\nTrimmed Sound Test.\n"
+              "The notes should start exactly at the beginning of a frame "
+              "(to coincide with the appearance of the description text');");
+
+    // outPoint
+    so_in = SWFMovie_startSound(mo, so);
+    SWFSoundInstance_setLoopOutPoint(so_in, 44100*2);
+    printFrameInfo(mo, 0, "Two notes (C, E)");
+    SWFMovie_nextFrame(mo); (*frame)++;
+
+    // inPoint
+    so_in = SWFMovie_startSound(mo, so);
+    SWFSoundInstance_setLoopInPoint(so_in, 44100);
+    printFrameInfo(mo, 1, "Two notes (E, G)");
+    SWFMovie_nextFrame(mo); (*frame)++;
+
+    // inPoint + outPoint + loop
+    so_in = SWFMovie_startSound(mo, so);
+    SWFSoundInstance_setLoopInPoint(so_in, 44100);
+    SWFSoundInstance_setLoopOutPoint(so_in, 44100*2);
+    SWFSoundInstance_setLoopCount(so_in, 2);
+    printFrameInfo(mo, 2, "One note (E)");
+    SWFMovie_nextFrame(mo); (*frame)++;
+
+    printFrameInfo(mo, 3, "One note (E)");
+    SWFMovie_nextFrame(mo); (*frame)++;
+
+    printFrameInfo(mo, 4, "Nothing");
+    SWFMovie_nextFrame(mo); (*frame)++;
+
+}
+
 
 int
 main(int argc, char** argv)
@@ -321,9 +355,11 @@
   runNoMultipleSoundsTest(mo, so, &frame);
 
   pauseForNextTest(mo);
+  runTrimmedSoundsTest(mo, so, &frame);
+
+  pauseForNextTest(mo);
   runAttachedSoundsTest(mo, so, &frame);
 
-  // TODO: test inPoint/outPoint (+ with loop ?)
   // TODO: test start(<sec_offset>) (+ with loop ?)
 
   endOfTests(mo);


reply via email to

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