Add test case for partial reads in LoopingAudioStream too.

svn-id: r47938
This commit is contained in:
Johannes Schickel 2010-02-06 18:25:57 +00:00
parent 75b2b13f7f
commit cf1b03f694

View File

@ -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);