aboutsummaryrefslogtreecommitdiff
path: root/test/sound/timestamp.h
diff options
context:
space:
mode:
authorJohannes Schickel2010-01-06 15:33:54 +0000
committerJohannes Schickel2010-01-06 15:33:54 +0000
commite72707b04e2080c6f780fed54df3a57ce3c6d460 (patch)
tree0f100d439283fb5eb3f622f6e5548b11f2e6fc4d /test/sound/timestamp.h
parent84f30344060ef382efa7d86fa8f7e55859e82421 (diff)
downloadscummvm-rg350-e72707b04e2080c6f780fed54df3a57ce3c6d460.tar.gz
scummvm-rg350-e72707b04e2080c6f780fed54df3a57ce3c6d460.tar.bz2
scummvm-rg350-e72707b04e2080c6f780fed54df3a57ce3c6d460.zip
- Add some functionallity to query the seconds and number of frames stored in a Timestamp.
- Add tests for these svn-id: r47081
Diffstat (limited to 'test/sound/timestamp.h')
-rw-r--r--test/sound/timestamp.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/test/sound/timestamp.h b/test/sound/timestamp.h
index 7219bb54aa..39d095aa35 100644
--- a/test/sound/timestamp.h
+++ b/test/sound/timestamp.h
@@ -143,10 +143,27 @@ class TimestampTestSuite : public CxxTest::TestSuite
const Audio::Timestamp c = Audio::Timestamp(500, 100);
const Audio::Timestamp d = Audio::Timestamp(500, 44100);
-
TS_ASSERT_EQUALS(a.getFramerate(), 1000);
TS_ASSERT_EQUALS(b.getFramerate(), 67);
TS_ASSERT_EQUALS(c.getFramerate(), 100);
TS_ASSERT_EQUALS(d.getFramerate(), 44100);
}
+
+ void test_direct_query() {
+ const Audio::Timestamp a = Audio::Timestamp(0, 22050);
+ const Audio::Timestamp b = a.addFrames(11025);
+ const Audio::Timestamp c = Audio::Timestamp(1500, 22050);
+
+ TS_ASSERT_EQUALS(a.secs(), (uint32)0);
+ TS_ASSERT_EQUALS(a.msecs(), (uint32)0);
+ TS_ASSERT_EQUALS(a.getNumberOfFrames(), 0);
+
+ TS_ASSERT_EQUALS(b.secs(), (uint32)0);
+ TS_ASSERT_EQUALS(b.msecs(), (uint32)500);
+ TS_ASSERT_EQUALS(b.getNumberOfFrames(), 11025);
+
+ TS_ASSERT_EQUALS(c.secs(), (uint32)1);
+ TS_ASSERT_EQUALS(c.msecs(), (uint32)1500);
+ TS_ASSERT_EQUALS(c.getNumberOfFrames(), 11025);
+ }
};