aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2010-02-03 15:44:43 +0000
committerJohannes Schickel2010-02-03 15:44:43 +0000
commit274f6e50337b3ec5d4e48eba9c3b03703491bc52 (patch)
tree98ae86b09288dacd9654b14c6315582456cd4209
parent6b2e9be345dd418a3e82254ab27394e0f95aad7d (diff)
downloadscummvm-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.h19
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;
+ }
};