added test case for bug #1295

This commit is contained in:
fgerlits 2005-07-27 20:23:24 +00:00
parent 6adb1f0faf
commit 43204f9cd3
4 changed files with 57 additions and 5 deletions

View file

@ -7,5 +7,5 @@
<!ATTLIST gstreamerPlayer audioDevice CDATA #IMPLIED > <!ATTLIST gstreamerPlayer audioDevice CDATA #IMPLIED >
]> ]>
<audioPlayer> <audioPlayer>
<gstreamerPlayer audioDevice = "plughw:0,0" /> <gstreamerPlayer audioDevice = "default" />
</audioPlayer> </audioPlayer>

View file

@ -4,5 +4,5 @@
<!ELEMENT gstreamerPlayer EMPTY > <!ELEMENT gstreamerPlayer EMPTY >
<!ATTLIST gstreamerPlayer audioDevice CDATA #IMPLIED > <!ATTLIST gstreamerPlayer audioDevice CDATA #IMPLIED >
]> ]>
<gstreamerPlayer audioDevice = "plughw:0,0" <gstreamerPlayer audioDevice = "default"
/> />

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.7 $ Version : $Revision: 1.8 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/playlistExecutor/src/GstreamerPlayerTest.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/playlistExecutor/src/GstreamerPlayerTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -639,3 +639,46 @@ GstreamerPlayerTest :: openTimeTest(void)
player->deInitialize(); player->deInitialize();
} }
/*------------------------------------------------------------------------------
* Test pausing and resuming.
*----------------------------------------------------------------------------*/
void
GstreamerPlayerTest :: pauseResumeTest(void)
throw (CPPUNIT_NS::Exception)
{
Ptr<time_duration>::Ref sleepT;
player->initialize();
try {
player->open("file:var/test10001.mp3");
} catch (std::invalid_argument &e) {
CPPUNIT_FAIL(e.what());
}
CPPUNIT_ASSERT(!player->isPlaying());
player->start();
CPPUNIT_ASSERT(player->isPlaying());
sleepT.reset(new time_duration(seconds(3)));
TimeConversion::sleep(sleepT);
player->pause();
CPPUNIT_ASSERT(!player->isPlaying());
sleepT.reset(new time_duration(seconds(10)));
TimeConversion::sleep(sleepT);
CPPUNIT_ASSERT(!player->isPlaying());
player->start();
CPPUNIT_ASSERT(player->isPlaying());
sleepT.reset(new time_duration(microseconds(10)));
while (player->isPlaying()) {
TimeConversion::sleep(sleepT);
}
CPPUNIT_ASSERT(!player->isPlaying());
player->close();
player->deInitialize();
}

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.8 $ Version : $Revision: 1.9 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/playlistExecutor/src/GstreamerPlayerTest.h,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/playlistExecutor/src/GstreamerPlayerTest.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -58,7 +58,7 @@ namespace PlaylistExecutor {
* Unit test for the GstreamerPlayer class. * Unit test for the GstreamerPlayer class.
* *
* @author $Author: fgerlits $ * @author $Author: fgerlits $
* @version $Revision: 1.8 $ * @version $Revision: 1.9 $
* @see GstreamerPlayer * @see GstreamerPlayer
*/ */
class GstreamerPlayerTest : public CPPUNIT_NS::TestFixture, class GstreamerPlayerTest : public CPPUNIT_NS::TestFixture,
@ -76,6 +76,7 @@ class GstreamerPlayerTest : public CPPUNIT_NS::TestFixture,
CPPUNIT_TEST(eventListenerTest); CPPUNIT_TEST(eventListenerTest);
CPPUNIT_TEST(eventListenerOnStopTest); CPPUNIT_TEST(eventListenerOnStopTest);
CPPUNIT_TEST(openTimeTest); CPPUNIT_TEST(openTimeTest);
CPPUNIT_TEST(pauseResumeTest);
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
private: private:
@ -191,6 +192,14 @@ class GstreamerPlayerTest : public CPPUNIT_NS::TestFixture,
void void
openTimeTest(void) throw (CPPUNIT_NS::Exception); openTimeTest(void) throw (CPPUNIT_NS::Exception);
/**
* Test pausing and resuming.
*
* @exception CPPUNIT_NS::Exception on test failures.
*/
void
pauseResumeTest(void) throw (CPPUNIT_NS::Exception);
public: public: