added ogg vorbis and SMIL test cases

This commit is contained in:
maroy 2005-06-29 14:55:29 +00:00
parent 25637f9cef
commit d7bf5ec50d
2 changed files with 137 additions and 19 deletions

View file

@ -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/PartialPlayTest.cxx,v $
------------------------------------------------------------------------------*/
@ -51,9 +51,19 @@ using namespace LiveSupport::GstreamerElements;
CPPUNIT_TEST_SUITE_REGISTRATION(PartialPlayTest);
/**
* A test file.
* An mp3 test file.
*/
static const char * testFile = "var/5seccounter.mp3";
static const char * mp3File = "var/5seccounter.mp3";
/**
* An ogg vorbis test file.
*/
static const char * oggVorbisFile = "var/5seccounter.ogg";
/**
* A SMIL test file.
*/
static const char * smilFile = "var/simple.smil";
/* =============================================== local function prototypes */
@ -158,14 +168,16 @@ eos_signal_handler(GstElement * element,
* A simple smoke test.
*----------------------------------------------------------------------------*/
void
PartialPlayTest :: firstTest(void)
PartialPlayTest :: mp3Test(void)
throw (CPPUNIT_NS::Exception)
{
gint64 timePlayed;
char str[256];
timePlayed = playFile(testFile, "2s;1s-4s");
CPPUNIT_ASSERT(timePlayed > 4.9 * GST_SECOND);
CPPUNIT_ASSERT(timePlayed < 5.1 * GST_SECOND);
timePlayed = playFile(mp3File, "2s;1s-4s");
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);
}
@ -173,13 +185,83 @@ PartialPlayTest :: firstTest(void)
* Open ended test
*----------------------------------------------------------------------------*/
void
PartialPlayTest :: openEndedTest(void)
PartialPlayTest :: mp3OpenEndedTest(void)
throw (CPPUNIT_NS::Exception)
{
gint64 timePlayed;
char str[256];
timePlayed = playFile(testFile, "2s;2s-");
CPPUNIT_ASSERT(timePlayed > 4.9 * GST_SECOND);
CPPUNIT_ASSERT(timePlayed < 5.1 * GST_SECOND);
timePlayed = playFile(mp3File, "2s;2s-");
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);
}
/*------------------------------------------------------------------------------
* A simple smoke test.
*----------------------------------------------------------------------------*/
void
PartialPlayTest :: oggVorbisTest(void)
throw (CPPUNIT_NS::Exception)
{
gint64 timePlayed;
char str[256];
timePlayed = playFile(oggVorbisFile, "2s;1s-4s");
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);
}
/*------------------------------------------------------------------------------
* Open ended test
*----------------------------------------------------------------------------*/
void
PartialPlayTest :: oggVorbisOpenEndedTest(void)
throw (CPPUNIT_NS::Exception)
{
gint64 timePlayed;
char str[256];
timePlayed = playFile(oggVorbisFile, "2s;2s-");
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);
}
/*------------------------------------------------------------------------------
* A simple smoke test.
*----------------------------------------------------------------------------*/
void
PartialPlayTest :: smilTest(void)
throw (CPPUNIT_NS::Exception)
{
gint64 timePlayed;
char str[256];
timePlayed = playFile(smilFile, "2s;1s-4s");
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);
}
/*------------------------------------------------------------------------------
* Open ended test
*----------------------------------------------------------------------------*/
void
PartialPlayTest :: smilOpenEndedTest(void)
throw (CPPUNIT_NS::Exception)
{
gint64 timePlayed;
char str[256];
timePlayed = playFile(smilFile, "2s;2s-");
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 $
Version : $Revision: 1.3 $
Version : $Revision: 1.4 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/gstreamerElements/src/PartialPlayTest.h,v $
------------------------------------------------------------------------------*/
@ -58,13 +58,17 @@ namespace GstreamerElements {
* Unit test for the partialplay gstreamer element.
*
* @author $Author: maroy $
* @version $Revision: 1.3 $
* @version $Revision: 1.4 $
*/
class PartialPlayTest : public CPPUNIT_NS::TestFixture
{
CPPUNIT_TEST_SUITE(PartialPlayTest);
CPPUNIT_TEST(firstTest);
CPPUNIT_TEST(openEndedTest);
CPPUNIT_TEST(mp3Test);
CPPUNIT_TEST(mp3OpenEndedTest);
CPPUNIT_TEST(oggVorbisTest);
CPPUNIT_TEST(oggVorbisOpenEndedTest);
CPPUNIT_TEST(smilTest);
CPPUNIT_TEST(smilOpenEndedTest);
CPPUNIT_TEST_SUITE_END();
private:
@ -86,20 +90,52 @@ class PartialPlayTest : public CPPUNIT_NS::TestFixture
protected:
/**
* A simple smoke test.
* A simple mp3 smoke test.
*
* @exception CPPUNIT_NS::Exception on test failures.
*/
void
firstTest(void) throw (CPPUNIT_NS::Exception);
mp3Test(void) throw (CPPUNIT_NS::Exception);
/**
* An open ended play test.
* An open ended mp3 play test.
*
* @exception CPPUNIT_NS::Exception on test failures.
*/
void
openEndedTest(void) throw (CPPUNIT_NS::Exception);
mp3OpenEndedTest(void) throw (CPPUNIT_NS::Exception);
/**
* A simple ogg vorbis smoke test.
*
* @exception CPPUNIT_NS::Exception on test failures.
*/
void
oggVorbisTest(void) throw (CPPUNIT_NS::Exception);
/**
* An open ended ogg vorbis play test.
*
* @exception CPPUNIT_NS::Exception on test failures.
*/
void
oggVorbisOpenEndedTest(void) throw (CPPUNIT_NS::Exception);
/**
* A simple SMIL smoke test.
*
* @exception CPPUNIT_NS::Exception on test failures.
*/
void
smilTest(void) throw (CPPUNIT_NS::Exception);
/**
* An open ended SMIL play test.
*
* @exception CPPUNIT_NS::Exception on test failures.
*/
void
smilOpenEndedTest(void) throw (CPPUNIT_NS::Exception);
public: