diff options
author | Johannes Schickel | 2010-02-03 15:44:43 +0000 |
---|---|---|
committer | Johannes Schickel | 2010-02-03 15:44:43 +0000 |
commit | 274f6e50337b3ec5d4e48eba9c3b03703491bc52 (patch) | |
tree | 98ae86b09288dacd9654b14c6315582456cd4209 | |
parent | 6b2e9be345dd418a3e82254ab27394e0f95aad7d (diff) | |
download | scummvm-rg350-274f6e50337b3ec5d4e48eba9c3b03703491bc52.tar.gz scummvm-rg350-274f6e50337b3ec5d4e48eba9c3b03703491bc52.tar.bz2 scummvm-rg350-274f6e50337b3ec5d4e48eba9c3b03703491bc52.zip |
Add test for rewind functionality of RawStream.
svn-id: r47856
-rw-r--r-- | test/sound/raw.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/sound/raw.h b/test/sound/raw.h index 6a01959827..6a6a23de3e 100644 --- a/test/sound/raw.h +++ b/test/sound/raw.h @@ -164,4 +164,23 @@ public: delete[] buffer; delete s; } + + void test_rewind() { + const int sampleRate = 11025; + const int time = 2; + Audio::SeekableAudioStream *s = createSineStream<int8>(sampleRate, time, 0, false); + int16 *buffer = new int16[sampleRate * time]; + + TS_ASSERT_EQUALS(s->readBuffer(buffer, sampleRate * time), sampleRate * time); + TS_ASSERT_EQUALS(s->endOfData(), true); + + s->rewind(); + TS_ASSERT_EQUALS(s->endOfData(), false); + + TS_ASSERT_EQUALS(s->readBuffer(buffer, sampleRate * time), sampleRate * time); + TS_ASSERT_EQUALS(s->endOfData(), true); + + delete[] buffer; + delete s; + } }; |