mirror of
https://github.com/libretro/scummvm.git
synced 2024-11-27 19:30:41 +00:00
Add test case for partial reads in LoopingAudioStream too.
svn-id: r47938
This commit is contained in:
parent
75b2b13f7f
commit
cf1b03f694
@ -74,9 +74,18 @@ private:
|
|||||||
TS_ASSERT_EQUALS(loop->getCompleteIterations(), (uint)6);
|
TS_ASSERT_EQUALS(loop->getCompleteIterations(), (uint)6);
|
||||||
TS_ASSERT_EQUALS(loop->endOfData(), false);
|
TS_ASSERT_EQUALS(loop->endOfData(), false);
|
||||||
|
|
||||||
// Read the last second
|
// Read the last second in two parts
|
||||||
TS_ASSERT_EQUALS(loop->readBuffer(buffer, secondLength), secondLength);
|
const int firstStep = secondLength / 2;
|
||||||
TS_ASSERT_EQUALS(memcmp(buffer, sine, secondLength * sizeof(int16)), 0);
|
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->getCompleteIterations(), (uint)7);
|
||||||
TS_ASSERT_EQUALS(loop->endOfData(), true);
|
TS_ASSERT_EQUALS(loop->endOfData(), true);
|
||||||
|
Loading…
Reference in New Issue
Block a user