diff options
author | Max Horn | 2010-01-04 22:48:28 +0000 |
---|---|---|
committer | Max Horn | 2010-01-04 22:48:28 +0000 |
commit | 4ae9412a3aea75990008c3a32080c54533fdb389 (patch) | |
tree | 5f7910434efd0e25c9278fa75cc86628dab7a4ce /test | |
parent | a6aaeb70e6dfb3a9727e8861041601cf658aa5cd (diff) | |
download | scummvm-rg350-4ae9412a3aea75990008c3a32080c54533fdb389.tar.gz scummvm-rg350-4ae9412a3aea75990008c3a32080c54533fdb389.tar.bz2 scummvm-rg350-4ae9412a3aea75990008c3a32080c54533fdb389.zip |
Make some improvements for Audio::Timestamp.
* Add convertToFramerate() method
* Add framerate() method
* Add operator == and !=
* Improve frameDiff() to work for two timestamps with distinct framerates
* Improve Doxygen comments
svn-id: r46994
Diffstat (limited to 'test')
-rw-r--r-- | test/sound/timestamp.h | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/test/sound/timestamp.h b/test/sound/timestamp.h index 89fc851a80..dccf67399c 100644 --- a/test/sound/timestamp.h +++ b/test/sound/timestamp.h @@ -47,7 +47,6 @@ class TimestampTestSuite : public CxxTest::TestSuite TS_ASSERT_EQUALS(a.addFrames(-60).msecs(), (uint32)(1234 - 1000 * 60/60)); } - void test_more_add_diff() { const Audio::Timestamp c(10002, 1000); @@ -56,4 +55,33 @@ class TimestampTestSuite : public CxxTest::TestSuite TS_ASSERT_EQUALS(v, i); } } + + + void test_diff_with_conversion() { + const Audio::Timestamp a = Audio::Timestamp(10, 1000).addFrames(20); + const Audio::Timestamp b = Audio::Timestamp(10, 1000/5).addFrames(20/5); + const Audio::Timestamp c = Audio::Timestamp(10, 1000*2).addFrames(20*2); + + TS_ASSERT_EQUALS(a.frameDiff(a), 0); + TS_ASSERT_EQUALS(a.frameDiff(b), 0); + TS_ASSERT_EQUALS(a.frameDiff(c), 0); + + TS_ASSERT_EQUALS(b.frameDiff(a), 0); + TS_ASSERT_EQUALS(b.frameDiff(b), 0); + TS_ASSERT_EQUALS(b.frameDiff(c), 0); + + TS_ASSERT_EQUALS(c.frameDiff(a), 0); + TS_ASSERT_EQUALS(c.frameDiff(b), 0); + TS_ASSERT_EQUALS(c.frameDiff(c), 0); + } + + + void test_convert() { + const Audio::Timestamp a = Audio::Timestamp(10, 1000).addFrames(20); + const Audio::Timestamp b = Audio::Timestamp(10, 1000/5).addFrames(20/5); + const Audio::Timestamp c = Audio::Timestamp(10, 1000*2).addFrames(20*2); + + TS_ASSERT_EQUALS(a.convertToFramerate(1000/5), b); + TS_ASSERT_EQUALS(a.convertToFramerate(1000*2), c); + } }; |