summaryrefslogtreecommitdiffstats
path: root/tests/auto/integration
diff options
context:
space:
mode:
authorLing Hu <ling.hu@nokia.com>2011-11-22 16:17:23 +1000
committerQt by Nokia <qt-info@nokia.com>2011-11-23 12:49:52 +0100
commitd2a4f632cd70e2ee9f1b59e8884e66bfe424edb6 (patch)
tree83079f898aa3f83851459bc967b58e425c51bb45 /tests/auto/integration
parent290523bc4c13b32e53f5aa359971c18c9e8fe3d5 (diff)
Add testDestroyWhileRestartPlaying for qsoundeffect
This covers the potential crash reported by qfeedbackmmk test. Change-Id: Ib533e80b25c4c7fb291527d62445aaa40960baa0 Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
Diffstat (limited to 'tests/auto/integration')
-rw-r--r--tests/auto/integration/qsoundeffect/tst_qsoundeffect.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/integration/qsoundeffect/tst_qsoundeffect.cpp b/tests/auto/integration/qsoundeffect/tst_qsoundeffect.cpp
index b3797625d..678d2be36 100644
--- a/tests/auto/integration/qsoundeffect/tst_qsoundeffect.cpp
+++ b/tests/auto/integration/qsoundeffect/tst_qsoundeffect.cpp
@@ -65,6 +65,9 @@ private slots:
void testPlaying();
void testStatus();
+ void testDestroyWhilePlaying();
+ void testDestroyWhileRestartPlaying();
+
private:
QSoundEffect* sound;
QUrl url;
@@ -189,6 +192,29 @@ void tst_QSoundEffect::testStatus()
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)