Added check to qsound and qsoundeffect unit tests for audio support
- skip tests if QSoundEffect::supportedMimeTypes() returns empty list Change-Id: I0f8d6f854c46b74f8518c4d969bd31ea167d20b2 Reviewed-by: Ling Hu <ling.hu@nokia.com> Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
This commit is contained in:
committed by
Qt by Nokia
parent
86553ef811
commit
a6e88ea87f
@@ -43,6 +43,7 @@
|
||||
#include <QtTest/QtTest>
|
||||
#include <QtCore/QString>
|
||||
#include <QSound>
|
||||
#include <QSoundEffect>
|
||||
|
||||
class tst_QSound : public QObject
|
||||
{
|
||||
@@ -67,6 +68,12 @@ private:
|
||||
|
||||
void tst_QSound::initTestCase()
|
||||
{
|
||||
sound = 0;
|
||||
// Only perform tests if audio device exists
|
||||
QStringList mimeTypes = QSoundEffect::supportedMimeTypes();
|
||||
if (mimeTypes.empty())
|
||||
QSKIP("No audio devices available");
|
||||
|
||||
const QString testFileName = QStringLiteral("test.wav");
|
||||
const QString fullPath = QFINDTESTDATA(testFileName);
|
||||
QVERIFY2(!fullPath.isEmpty(), qPrintable(QStringLiteral("Unable to locate ") + testFileName));
|
||||
|
||||
@@ -98,6 +98,11 @@ void tst_QSoundEffect::cleanup()
|
||||
|
||||
void tst_QSoundEffect::initTestCase()
|
||||
{
|
||||
// Only perform tests if audio device exists
|
||||
QStringList mimeTypes = sound->supportedMimeTypes();
|
||||
if (mimeTypes.empty())
|
||||
QSKIP("No audio devices available");
|
||||
|
||||
QString testFileName = QStringLiteral("test.wav");
|
||||
QString fullPath = QFINDTESTDATA(testFileName);
|
||||
QVERIFY2(!fullPath.isEmpty(), qPrintable(QStringLiteral("Unable to locate ") + testFileName));
|
||||
|
||||
Reference in New Issue
Block a user