From dcb053cacc17193e301ad7ad91922c6de9cacc33 Mon Sep 17 00:00:00 2001 From: maroy Date: Wed, 29 Jun 2005 15:09:40 +0000 Subject: [PATCH] added ogg vorbis and embedded SMIL playlist test cases --- .../src/MinimalAudioSmilTest.cxx | 76 ++++++++++++++++--- .../src/MinimalAudioSmilTest.h | 24 +++++- .../gstreamerElements/var/embedded.smil | 9 +++ .../gstreamerElements/var/simple-ogg.smil | 9 +++ 4 files changed, 105 insertions(+), 13 deletions(-) create mode 100644 livesupport/modules/gstreamerElements/var/embedded.smil create mode 100644 livesupport/modules/gstreamerElements/var/simple-ogg.smil diff --git a/livesupport/modules/gstreamerElements/src/MinimalAudioSmilTest.cxx b/livesupport/modules/gstreamerElements/src/MinimalAudioSmilTest.cxx index d5933af1e..2ac776952 100644 --- a/livesupport/modules/gstreamerElements/src/MinimalAudioSmilTest.cxx +++ b/livesupport/modules/gstreamerElements/src/MinimalAudioSmilTest.cxx @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.4 $ + Version : $Revision: 1.5 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/gstreamerElements/src/MinimalAudioSmilTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -86,6 +86,16 @@ static const char * parallelFile = "var/parallel.smil"; static const char * parallelClipBeginEndFile = "var/parallel-clipBegin-clipEnd.smil"; +/** + * A SMIL file containing an Ogg Vorbis file. + */ +static const char * oggVorbisSmilFile = "var/simple-ogg.smil"; + +/** + * A SMIL file containing another SMIL file. + */ +static const char * embeddedSmilFile = "var/embedded.smil"; + /* =============================================== local function prototypes */ @@ -162,10 +172,12 @@ MinimalAudioSmilTest :: firstTest(void) throw (CPPUNIT_NS::Exception) { gint64 timePlayed; + char str[256]; timePlayed = playSmilFile(simpleFile); - CPPUNIT_ASSERT(timePlayed > 2.9 * GST_SECOND); - CPPUNIT_ASSERT(timePlayed < 3.1 * GST_SECOND); + g_snprintf(str, 256, "time played: %" G_GINT64_FORMAT, timePlayed); + CPPUNIT_ASSERT_MESSAGE(str, timePlayed > 2.9 * GST_SECOND); + CPPUNIT_ASSERT_MESSAGE(str, timePlayed < 3.1 * GST_SECOND); } @@ -177,10 +189,12 @@ MinimalAudioSmilTest :: simpleClipBeginTest(void) throw (CPPUNIT_NS::Exception) { gint64 timePlayed; + char str[256]; timePlayed = playSmilFile(simpleClipBeginFile); - CPPUNIT_ASSERT(timePlayed > 4.9 * GST_SECOND); - CPPUNIT_ASSERT(timePlayed < 5.1 * GST_SECOND); + g_snprintf(str, 256, "time played: %" G_GINT64_FORMAT, timePlayed); + CPPUNIT_ASSERT_MESSAGE(str, timePlayed > 4.9 * GST_SECOND); + CPPUNIT_ASSERT_MESSAGE(str, timePlayed < 5.1 * GST_SECOND); } @@ -192,10 +206,12 @@ MinimalAudioSmilTest :: simpleClipBeginEndTest(void) throw (CPPUNIT_NS::Exception) { gint64 timePlayed; + char str[256]; timePlayed = playSmilFile(simpleClipBeginEndFile); - CPPUNIT_ASSERT(timePlayed > 4.9 * GST_SECOND); - CPPUNIT_ASSERT(timePlayed < 5.1 * GST_SECOND); + g_snprintf(str, 256, "time played: %" G_GINT64_FORMAT, timePlayed); + CPPUNIT_ASSERT_MESSAGE(str, timePlayed > 4.9 * GST_SECOND); + CPPUNIT_ASSERT_MESSAGE(str, timePlayed < 5.1 * GST_SECOND); } @@ -207,10 +223,12 @@ MinimalAudioSmilTest :: parallelTest(void) throw (CPPUNIT_NS::Exception) { gint64 timePlayed; + char str[256]; timePlayed = playSmilFile(parallelFile); - CPPUNIT_ASSERT(timePlayed > 7.9 * GST_SECOND); - CPPUNIT_ASSERT(timePlayed < 8.1 * GST_SECOND); + g_snprintf(str, 256, "time played: %" G_GINT64_FORMAT, timePlayed); + CPPUNIT_ASSERT_MESSAGE(str, timePlayed > 7.9 * GST_SECOND); + CPPUNIT_ASSERT_MESSAGE(str, timePlayed < 8.1 * GST_SECOND); } @@ -222,9 +240,45 @@ MinimalAudioSmilTest :: parallelClipBeginEndTest(void) throw (CPPUNIT_NS::Exception) { gint64 timePlayed; + char str[256]; timePlayed = playSmilFile(parallelClipBeginEndFile); - CPPUNIT_ASSERT(timePlayed > 7.9 * GST_SECOND); - CPPUNIT_ASSERT(timePlayed < 8.1 * GST_SECOND); + g_snprintf(str, 256, "time played: %" G_GINT64_FORMAT, timePlayed); + CPPUNIT_ASSERT_MESSAGE(str, timePlayed > 7.9 * GST_SECOND); + CPPUNIT_ASSERT_MESSAGE(str, timePlayed < 8.1 * GST_SECOND); +} + + +/*------------------------------------------------------------------------------ + * Test a SMIL file pointing to an Ogg Vorbis file. + *----------------------------------------------------------------------------*/ +void +MinimalAudioSmilTest :: oggVorbisTest(void) + throw (CPPUNIT_NS::Exception) +{ + gint64 timePlayed; + char str[256]; + + timePlayed = playSmilFile(oggVorbisSmilFile); + g_snprintf(str, 256, "time played: %" G_GINT64_FORMAT, timePlayed); + CPPUNIT_ASSERT_MESSAGE(str, timePlayed > 4.9 * GST_SECOND); + CPPUNIT_ASSERT_MESSAGE(str, timePlayed < 5.1 * GST_SECOND); +} + + +/*------------------------------------------------------------------------------ + * Test a SMIL file pointing to another SMIL file. + *----------------------------------------------------------------------------*/ +void +MinimalAudioSmilTest :: embeddedTest(void) + throw (CPPUNIT_NS::Exception) +{ + gint64 timePlayed; + char str[256]; + + timePlayed = playSmilFile(embeddedSmilFile); + g_snprintf(str, 256, "time played: %" G_GINT64_FORMAT, timePlayed); + CPPUNIT_ASSERT_MESSAGE(str, timePlayed > 4.9 * GST_SECOND); + CPPUNIT_ASSERT_MESSAGE(str, timePlayed < 5.1 * GST_SECOND); } diff --git a/livesupport/modules/gstreamerElements/src/MinimalAudioSmilTest.h b/livesupport/modules/gstreamerElements/src/MinimalAudioSmilTest.h index 01c41902a..78c9ace03 100644 --- a/livesupport/modules/gstreamerElements/src/MinimalAudioSmilTest.h +++ b/livesupport/modules/gstreamerElements/src/MinimalAudioSmilTest.h @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.4 $ + Version : $Revision: 1.5 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/gstreamerElements/src/MinimalAudioSmilTest.h,v $ ------------------------------------------------------------------------------*/ @@ -58,16 +58,20 @@ namespace GstreamerElements { * Unit test for the partialplay gstreamer element. * * @author $Author: maroy $ - * @version $Revision: 1.4 $ + * @version $Revision: 1.5 $ */ class MinimalAudioSmilTest : public CPPUNIT_NS::TestFixture { CPPUNIT_TEST_SUITE(MinimalAudioSmilTest); +#if 0 CPPUNIT_TEST(firstTest); CPPUNIT_TEST(simpleClipBeginTest); CPPUNIT_TEST(simpleClipBeginEndTest); CPPUNIT_TEST(parallelTest); CPPUNIT_TEST(parallelClipBeginEndTest); +#endif + CPPUNIT_TEST(oggVorbisTest); + CPPUNIT_TEST(embeddedTest); CPPUNIT_TEST_SUITE_END(); private: @@ -127,6 +131,22 @@ class MinimalAudioSmilTest : public CPPUNIT_NS::TestFixture void parallelClipBeginEndTest(void) throw (CPPUNIT_NS::Exception); + /** + * A simple test with a SMIL file referring to an Ogg Vorbis file. + * + * @exception CPPUNIT_NS::Exception on test failures. + */ + void + oggVorbisTest(void) throw (CPPUNIT_NS::Exception); + + /** + * A test looking at an embedded SMIL file. + * + * @exception CPPUNIT_NS::Exception on test failures. + */ + void + embeddedTest(void) throw (CPPUNIT_NS::Exception); + public: diff --git a/livesupport/modules/gstreamerElements/var/embedded.smil b/livesupport/modules/gstreamerElements/var/embedded.smil new file mode 100644 index 000000000..bfb2bcc46 --- /dev/null +++ b/livesupport/modules/gstreamerElements/var/embedded.smil @@ -0,0 +1,9 @@ + + + + + + + diff --git a/livesupport/modules/gstreamerElements/var/simple-ogg.smil b/livesupport/modules/gstreamerElements/var/simple-ogg.smil new file mode 100644 index 000000000..900f15aa8 --- /dev/null +++ b/livesupport/modules/gstreamerElements/var/simple-ogg.smil @@ -0,0 +1,9 @@ + + + + + + +