From e72707b04e2080c6f780fed54df3a57ce3c6d460 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 6 Jan 2010 15:33:54 +0000 Subject: - Add some functionallity to query the seconds and number of frames stored in a Timestamp. - Add tests for these svn-id: r47081 --- test/sound/timestamp.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'test/sound/timestamp.h') 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); + } }; -- cgit v1.2.3