Add testDestroyWhileRestartPlaying for qsoundeffect
This covers the potential crash reported by qfeedbackmmk test. Change-Id: Ib533e80b25c4c7fb291527d62445aaa40960baa0 Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
This commit is contained in:
@@ -65,6 +65,9 @@ private slots:
|
|||||||
void testPlaying();
|
void testPlaying();
|
||||||
void testStatus();
|
void testStatus();
|
||||||
|
|
||||||
|
void testDestroyWhilePlaying();
|
||||||
|
void testDestroyWhileRestartPlaying();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSoundEffect* sound;
|
QSoundEffect* sound;
|
||||||
QUrl url;
|
QUrl url;
|
||||||
@@ -189,6 +192,29 @@ void tst_QSoundEffect::testStatus()
|
|||||||
QCOMPARE(sound->status(), QSoundEffect::Error);
|
QCOMPARE(sound->status(), QSoundEffect::Error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tst_QSoundEffect::testDestroyWhilePlaying()
|
||||||
|
{
|
||||||
|
QSoundEffect *instance = new QSoundEffect();
|
||||||
|
instance->setSource(url);
|
||||||
|
QTestEventLoop::instance().enterLoop(1);
|
||||||
|
instance->play();
|
||||||
|
QTest::qWait(500);
|
||||||
|
delete instance;
|
||||||
|
QTestEventLoop::instance().enterLoop(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void tst_QSoundEffect::testDestroyWhileRestartPlaying()
|
||||||
|
{
|
||||||
|
QSoundEffect *instance = new QSoundEffect();
|
||||||
|
instance->setSource(url);
|
||||||
|
QTestEventLoop::instance().enterLoop(1);
|
||||||
|
instance->play();
|
||||||
|
QTest::qWait(1000);
|
||||||
|
//restart playing
|
||||||
|
instance->play();
|
||||||
|
delete instance;
|
||||||
|
QTestEventLoop::instance().enterLoop(1);
|
||||||
|
}
|
||||||
|
|
||||||
QTEST_MAIN(tst_QSoundEffect)
|
QTEST_MAIN(tst_QSoundEffect)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user