[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r10807: Tests for onSoundComplete wi
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r10807: Tests for onSoundComplete with embedded sounds. |
Date: |
Mon, 20 Apr 2009 09:21:44 +0200 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 10807
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Mon 2009-04-20 09:21:44 +0200
message:
Tests for onSoundComplete with embedded sounds.
modified:
libmedia/FLVParser.cpp
testsuite/misc-ming.all/eventSoundTest1-Runner.cpp
testsuite/misc-ming.all/eventSoundTest1.c
------------------------------------------------------------
revno: 10806.1.1
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Mon 2009-04-20 08:46:58 +0200
message:
Test onSoundComplete for embedded sounds.
modified:
testsuite/misc-ming.all/eventSoundTest1-Runner.cpp
testsuite/misc-ming.all/eventSoundTest1.c
------------------------------------------------------------
revno: 10806.1.2
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Mon 2009-04-20 08:52:17 +0200
message:
Make text output field larger, update comments.
modified:
testsuite/misc-ming.all/eventSoundTest1.c
------------------------------------------------------------
revno: 10806.1.3
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Mon 2009-04-20 08:57:19 +0200
message:
Minor alterations to parseHeader().
modified:
libmedia/FLVParser.cpp
=== modified file 'libmedia/FLVParser.cpp'
--- a/libmedia/FLVParser.cpp 2009-03-13 22:11:38 +0000
+++ b/libmedia/FLVParser.cpp 2009-04-20 06:57:19 +0000
@@ -469,12 +469,13 @@
}
// would be called by MAIN thread
-bool FLVParser::parseHeader()
+bool
+FLVParser::parseHeader()
{
assert(_stream->tell() == static_cast<std::streampos>(0));
// We only use 5 bytes of the header, because the last 4 bytes represent
- // an integer which is always 1.
+ // an integer which is always 1.
boost::uint8_t header[9];
if ( _stream->read(header, 9) != 9 )
{
@@ -488,7 +489,7 @@
return false;
}
- const boost::uint8_t& version = header[3];
+ const boost::uint8_t version = header[3];
// Parse the audio+video bitmask
_audio = header[4]&(1<<2);
=== modified file 'testsuite/misc-ming.all/eventSoundTest1-Runner.cpp'
--- a/testsuite/misc-ming.all/eventSoundTest1-Runner.cpp 2009-04-03
09:29:19 +0000
+++ b/testsuite/misc-ming.all/eventSoundTest1-Runner.cpp 2009-04-20
06:46:58 +0000
@@ -80,19 +80,21 @@
// Make sure you adjust this with the test!
cerr << "Total frames: " << totalFrames;
- assert (totalFrames == 14);
+ assert (totalFrames == 20);
int numSoundsStarted[] = {
0,
4,
- 6
+ 6,
+ 12
};
/// Expected success for each test
bool testPasses[] = {
true,
true,
- true
+ true,
+ true
};
// Advance and check...
=== modified file 'testsuite/misc-ming.all/eventSoundTest1.c'
--- a/testsuite/misc-ming.all/eventSoundTest1.c 2009-02-25 22:33:03 +0000
+++ b/testsuite/misc-ming.all/eventSoundTest1.c 2009-04-20 06:52:17 +0000
@@ -70,12 +70,10 @@
font = loadSWFFontFromFile(font_file);
-
/* Add output textfield and DejaGnu stuff */
- dejagnuclip = get_dejagnu_clip((SWFBlock)font, 10, 0, 0, 800, 400);
+ dejagnuclip = get_dejagnu_clip((SWFBlock)font, 10, 0, 0, 800, 800);
it = SWFMovie_add(mo, (SWFBlock)dejagnuclip);
SWFDisplayItem_setDepth(it, 200);
- //SWFDisplayItem_move(it, 0, 0);
}
@@ -98,7 +96,7 @@
SWF_SOUND_22KHZ |
SWF_SOUND_16BITS |
SWF_SOUND_STEREO);
-
+
return so;
}
@@ -119,6 +117,71 @@
}
void
+runAttachedSoundsTest(SWFMovie mo, SWFSound so, int* frame)
+{
+ const char* frameDesc[5];
+ int i;
+
+ SWFMovie_nextFrame(mo);
+ add_actions(mo,
+ "note('Attached Embedded 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.');");
+
+ /* This is what is supposed to happen in each frame */
+ frameDesc[0] = "Two notes (C, E)";
+ frameDesc[1] = "Two notes (G-C, E)";
+ frameDesc[2] = "Two notes (G-C, E)";
+ frameDesc[3] = "Two notes (G-C, E)";
+ frameDesc[4] = "Nothing";
+
+ add_actions(mo, "t = _root.createEmptyMovieClip('mc', 9);"
+ "cs = 0; cs2 = 0;"
+ "s = new Sound(mc);"
+ "s2 = new Sound(mc);"
+ "s.attachSound('es');"
+ "s2.attachSound('es');"
+ "s.onSoundComplete = function() { cs++; };"
+ "s2.onSoundComplete = function() { cs2++; };"
+ );
+
+ /// Start an embedded sound using a tag to make sure onSoundComplete
+ /// isn't called for Sound s.
+ SWFMovie_startSound(mo, so);
+
+ /// Start the same embedded sound from another Sound object also to
+ /// make sure the correct object is notified.
+ add_actions(mo, "s2.start(); delete s2;");
+
+ for (i = 0; i < 4; i++)
+ {
+ SWFMovie_nextFrame(mo);
+
+ (*frame)++;
+
+ printFrameInfo(mo, i, frameDesc[i]);
+ add_actions(mo, "s.start();");
+ }
+
+ add_actions(mo, "xcheck_equals(cs, 2);");
+
+ SWFMovie_nextFrame(mo);
+
+ add_actions(mo, "xcheck_equals(cs, 3);");
+
+ // Check that Sound.onSoundComplete isn't executed if the Sound is
+ // deleted. This only passes currently because onSoundComplete is never
+ // called under any circumstances for embedded sounds.
+ add_actions(mo, "check_equals(cs2, 0);");
+ add_actions(mo, "s.stop();");
+
+ printFrameInfo(mo, i, frameDesc[i]);
+
+}
+
+
+void
runMultipleSoundsTest(SWFMovie mo, SWFSound so, int* frame)
{
const char* frameDesc[5];
@@ -230,16 +293,20 @@
setupMovie(mo, srcdir);
so = setupSounds(soundFile);
+
+ /// Add as an export so we can attach it.
+ SWFMovie_addExport(mo, (SWFBlock)so, "es");
+ SWFMovie_writeExports(mo);
add_actions(mo, "c = 0;");
SWFMovie_nextFrame(mo);
add_actions(mo,
- "note('You will hear several short tests with a succession of
sounds.\n"
- "Each frame is two seconds long.\n"
- "The movie will describe what you should hear at the beginning of
the frame.');"
- );
+ "note('You will hear several short tests with a succession of sounds. "
+ "Each frame is two seconds long.\n"
+ "The movie will describe what you should hear at the beginning of "
+ "the frame.');");
frame = 0;
@@ -250,6 +317,9 @@
runNoMultipleSoundsTest(mo, so, &frame);
pauseForNextTest(mo);
+ runAttachedSoundsTest(mo, so, &frame);
+
+ pauseForNextTest(mo);
//Output movie
puts("Saving " OUTPUT_FILENAME );
SWFMovie_save(mo, OUTPUT_FILENAME);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r10807: Tests for onSoundComplete with embedded sounds.,
Benjamin Wolsey <=