From cf1b03f694740203901924ea66d004d26e461e0b Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 6 Feb 2010 18:25:57 +0000 Subject: Add test case for partial reads in LoopingAudioStream too. svn-id: r47938 --- test/sound/audiostream.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/sound/audiostream.h b/test/sound/audiostream.h index 141244a82d..4d609e0458 100644 --- a/test/sound/audiostream.h +++ b/test/sound/audiostream.h @@ -74,9 +74,18 @@ private: TS_ASSERT_EQUALS(loop->getCompleteIterations(), (uint)6); TS_ASSERT_EQUALS(loop->endOfData(), false); - // Read the last second - TS_ASSERT_EQUALS(loop->readBuffer(buffer, secondLength), secondLength); - TS_ASSERT_EQUALS(memcmp(buffer, sine, secondLength * sizeof(int16)), 0); + // Read the last second in two parts + const int firstStep = secondLength / 2; + const int secondStep = secondLength - firstStep; + + TS_ASSERT_EQUALS(loop->readBuffer(buffer, firstStep), firstStep); + TS_ASSERT_EQUALS(memcmp(buffer, sine, firstStep * sizeof(int16)), 0); + + TS_ASSERT_EQUALS(loop->getCompleteIterations(), (uint)6); + TS_ASSERT_EQUALS(loop->endOfData(), false); + + TS_ASSERT_EQUALS(loop->readBuffer(buffer, secondLength), secondStep); + TS_ASSERT_EQUALS(memcmp(buffer, sine + firstStep, secondStep * sizeof(int16)), 0); TS_ASSERT_EQUALS(loop->getCompleteIterations(), (uint)7); TS_ASSERT_EQUALS(loop->endOfData(), true); -- cgit v1.2.3