added ogg vorbis and embedded SMIL playlist test cases

This commit is contained in:
maroy 2005-06-29 15:09:40 +00:00
parent d7bf5ec50d
commit dcb053cacc
4 changed files with 105 additions and 13 deletions

View file

@ -22,7 +22,7 @@
Author : $Author: maroy $ 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 $ 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 = static const char * parallelClipBeginEndFile =
"var/parallel-clipBegin-clipEnd.smil"; "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 */ /* =============================================== local function prototypes */
@ -162,10 +172,12 @@ MinimalAudioSmilTest :: firstTest(void)
throw (CPPUNIT_NS::Exception) throw (CPPUNIT_NS::Exception)
{ {
gint64 timePlayed; gint64 timePlayed;
char str[256];
timePlayed = playSmilFile(simpleFile); timePlayed = playSmilFile(simpleFile);
CPPUNIT_ASSERT(timePlayed > 2.9 * GST_SECOND); g_snprintf(str, 256, "time played: %" G_GINT64_FORMAT, timePlayed);
CPPUNIT_ASSERT(timePlayed < 3.1 * GST_SECOND); 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) throw (CPPUNIT_NS::Exception)
{ {
gint64 timePlayed; gint64 timePlayed;
char str[256];
timePlayed = playSmilFile(simpleClipBeginFile); timePlayed = playSmilFile(simpleClipBeginFile);
CPPUNIT_ASSERT(timePlayed > 4.9 * GST_SECOND); g_snprintf(str, 256, "time played: %" G_GINT64_FORMAT, timePlayed);
CPPUNIT_ASSERT(timePlayed < 5.1 * GST_SECOND); 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) throw (CPPUNIT_NS::Exception)
{ {
gint64 timePlayed; gint64 timePlayed;
char str[256];
timePlayed = playSmilFile(simpleClipBeginEndFile); timePlayed = playSmilFile(simpleClipBeginEndFile);
CPPUNIT_ASSERT(timePlayed > 4.9 * GST_SECOND); g_snprintf(str, 256, "time played: %" G_GINT64_FORMAT, timePlayed);
CPPUNIT_ASSERT(timePlayed < 5.1 * GST_SECOND); 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) throw (CPPUNIT_NS::Exception)
{ {
gint64 timePlayed; gint64 timePlayed;
char str[256];
timePlayed = playSmilFile(parallelFile); timePlayed = playSmilFile(parallelFile);
CPPUNIT_ASSERT(timePlayed > 7.9 * GST_SECOND); g_snprintf(str, 256, "time played: %" G_GINT64_FORMAT, timePlayed);
CPPUNIT_ASSERT(timePlayed < 8.1 * GST_SECOND); 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) throw (CPPUNIT_NS::Exception)
{ {
gint64 timePlayed; gint64 timePlayed;
char str[256];
timePlayed = playSmilFile(parallelClipBeginEndFile); timePlayed = playSmilFile(parallelClipBeginEndFile);
CPPUNIT_ASSERT(timePlayed > 7.9 * GST_SECOND); g_snprintf(str, 256, "time played: %" G_GINT64_FORMAT, timePlayed);
CPPUNIT_ASSERT(timePlayed < 8.1 * GST_SECOND); 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);
} }

View file

@ -22,7 +22,7 @@
Author : $Author: maroy $ 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 $ 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. * Unit test for the partialplay gstreamer element.
* *
* @author $Author: maroy $ * @author $Author: maroy $
* @version $Revision: 1.4 $ * @version $Revision: 1.5 $
*/ */
class MinimalAudioSmilTest : public CPPUNIT_NS::TestFixture class MinimalAudioSmilTest : public CPPUNIT_NS::TestFixture
{ {
CPPUNIT_TEST_SUITE(MinimalAudioSmilTest); CPPUNIT_TEST_SUITE(MinimalAudioSmilTest);
#if 0
CPPUNIT_TEST(firstTest); CPPUNIT_TEST(firstTest);
CPPUNIT_TEST(simpleClipBeginTest); CPPUNIT_TEST(simpleClipBeginTest);
CPPUNIT_TEST(simpleClipBeginEndTest); CPPUNIT_TEST(simpleClipBeginEndTest);
CPPUNIT_TEST(parallelTest); CPPUNIT_TEST(parallelTest);
CPPUNIT_TEST(parallelClipBeginEndTest); CPPUNIT_TEST(parallelClipBeginEndTest);
#endif
CPPUNIT_TEST(oggVorbisTest);
CPPUNIT_TEST(embeddedTest);
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
private: private:
@ -127,6 +131,22 @@ class MinimalAudioSmilTest : public CPPUNIT_NS::TestFixture
void void
parallelClipBeginEndTest(void) throw (CPPUNIT_NS::Exception); 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: public:

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<smil xmlns="http://www.w3.org/2001/SMIL20/Language" >
<body>
<par>
<audio src = "file:var/simple.smil"
/>
</par>
</body>
</smil>

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<smil xmlns="http://www.w3.org/2001/SMIL20/Language" >
<body>
<par>
<audio src = "file:var/5seccounter.ogg"
/>
</par>
</body>
</smil>