summaryrefslogtreecommitdiffstats
path: root/tests/auto/mediaobject
diff options
context:
space:
mode:
authorGareth Stockwell <ext-gareth.stockwell@nokia.com>2010-04-14 15:37:21 (GMT)
committerGareth Stockwell <ext-gareth.stockwell@nokia.com>2010-04-15 05:39:48 (GMT)
commit151c2a2bd5e764555f32e6141024172e77788efd (patch)
tree9dce2f021ef50b30f152fb99a10e8013c6213e73 /tests/auto/mediaobject
parent240cf56a6490bc05339cc05457c8bab3b5cab66c (diff)
downloadQt-151c2a2bd5e764555f32e6141024172e77788efd.zip
Qt-151c2a2bd5e764555f32e6141024172e77788efd.tar.gz
Qt-151c2a2bd5e764555f32e6141024172e77788efd.tar.bz2
tst_mediaobject: ensure MediaObject is in StoppedState before each step
Many of the steps in the tst_mediaobject suite (a) check that the MediaObject is in StoppedState at the start of the step and (b) call stopPlayback() at the end. If, however, a QTest check fails during the test, stopPlayback may not be called. This patch adds a call to MediaObject::stop() in the suite's init() function. This is a symptom of a wider problem with this test suite, namely that it re-uses a single instance of Phonon::MediaObject for all steps. Given the highly stateful nature of MediaObject, this can lead to test steps failing due to some state which was erroneously carried forward from an earlier step. While this test suite design may more faithfully represent real-world usage of Phonon, it makes tracking down the root causes of test failures needlessly difficult. Reviewed-by: Frans Englich
Diffstat (limited to 'tests/auto/mediaobject')
-rw-r--r--tests/auto/mediaobject/tst_mediaobject.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/auto/mediaobject/tst_mediaobject.cpp b/tests/auto/mediaobject/tst_mediaobject.cpp
index 5328f63..127b775 100644
--- a/tests/auto/mediaobject/tst_mediaobject.cpp
+++ b/tests/auto/mediaobject/tst_mediaobject.cpp
@@ -251,6 +251,13 @@ void tst_MediaObject::init()
}
m_stateChangedSignalSpy->clear();
}
+
+ // Ensure that m_media is in StoppedState
+ if (m_media->state() != Phonon::StoppedState) {
+ m_media->stop();
+ QTest::waitForSignal(m_media, SIGNAL(stateChanged(Phonon::State, Phonon::State)));
+ QCOMPARE(m_media->state(), Phonon::StoppedState);
+ }
}
void tst_MediaObject::cleanup()