summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/integration/qsound/tst_qsound.cpp7
-rw-r--r--tests/auto/integration/qsoundeffect/tst_qsoundeffect.cpp5
2 files changed, 12 insertions, 0 deletions
diff --git a/tests/auto/integration/qsound/tst_qsound.cpp b/tests/auto/integration/qsound/tst_qsound.cpp
index 490a4fbfb..89579b93c 100644
--- a/tests/auto/integration/qsound/tst_qsound.cpp
+++ b/tests/auto/integration/qsound/tst_qsound.cpp
@@ -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));
diff --git a/tests/auto/integration/qsoundeffect/tst_qsoundeffect.cpp b/tests/auto/integration/qsoundeffect/tst_qsoundeffect.cpp
index adcb9cd85..b01bf1e87 100644
--- a/tests/auto/integration/qsoundeffect/tst_qsoundeffect.cpp
+++ b/tests/auto/integration/qsoundeffect/tst_qsoundeffect.cpp
@@ -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));