summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSami Nurmenniemi <sami.nurmenniemi@qt.io>2017-06-08 11:39:06 +0300
committerSami Nurmenniemi <sami.nurmenniemi@qt.io>2017-08-22 12:51:40 +0000
commitc341b2b25697f937280fe3620629ac3d32c19613 (patch)
tree79d08e0061ca341e5f5f23dccba8804e395a28a6 /tests
parentba79c575860231548b8fd8309c5f6d2b715860ca (diff)
Enable tests for boot2qt
The tests for boot2qt were disabled with commit b9bfe241cc3c3466ad250da80b2a7ccf087706a4. The tests can be enabled since qtdeclarative now fallbacks to software renderer if OpenGL is not supported. Two changes were needed to pass tests on boot2qt 1. Add option to disable tests requiring WAV format and use that in the boot2qt environment 2. Skip some tst_QPainterVideoSurface tests if GLContext is not supported by the platform Task-number: QTBUG-60268 Change-Id: I236207fedb505124a2c7edf0caccd85011ab1416 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/integration/multimedia.pro3
-rw-r--r--tests/auto/integration/qaudiodecoderbackend/BLACKLIST8
-rw-r--r--tests/auto/integration/qaudiodecoderbackend/qaudiodecoderbackend.pro8
-rw-r--r--tests/auto/integration/qaudiodecoderbackend/tst_qaudiodecoderbackend.cpp22
-rw-r--r--tests/auto/integration/qmediaplayerbackend/BLACKLIST14
-rw-r--r--tests/auto/integration/qmediaplayerbackend/qmediaplayerbackend.pro10
-rw-r--r--tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp80
-rw-r--r--tests/auto/integration/shared/mediafileselector.h71
-rw-r--r--tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp30
9 files changed, 179 insertions, 67 deletions
diff --git a/tests/auto/integration/multimedia.pro b/tests/auto/integration/multimedia.pro
index de152d942..88960ec03 100644
--- a/tests/auto/integration/multimedia.pro
+++ b/tests/auto/integration/multimedia.pro
@@ -17,6 +17,3 @@ qtHaveModule(quick) {
}
!qtHaveModule(widgets): SUBDIRS -= qcamerabackend
-
-# QTBUG-60268
-boot2qt: SUBDIRS -= qdeclarativevideooutput_window
diff --git a/tests/auto/integration/qaudiodecoderbackend/BLACKLIST b/tests/auto/integration/qaudiodecoderbackend/BLACKLIST
index 8b6712728..316c5a083 100644
--- a/tests/auto/integration/qaudiodecoderbackend/BLACKLIST
+++ b/tests/auto/integration/qaudiodecoderbackend/BLACKLIST
@@ -1,10 +1,2 @@
# QTBUG-56796
windows
-
-[fileTest]
-# QTBUG-60268
-b2qt
-
-[deviceTest]
-# QTBUG-60268
-b2qt
diff --git a/tests/auto/integration/qaudiodecoderbackend/qaudiodecoderbackend.pro b/tests/auto/integration/qaudiodecoderbackend/qaudiodecoderbackend.pro
index 7464a8aa2..672bcfa6a 100644
--- a/tests/auto/integration/qaudiodecoderbackend/qaudiodecoderbackend.pro
+++ b/tests/auto/integration/qaudiodecoderbackend/qaudiodecoderbackend.pro
@@ -9,5 +9,13 @@ TESTDATA += testdata/*
INCLUDEPATH += \
../../../../src/multimedia/audio
+HEADERS += \
+ ../shared/mediafileselector.h
+
SOURCES += \
tst_qaudiodecoderbackend.cpp
+
+boot2qt: {
+ # Yocto sysroot does not have gstreamer/wav
+ QMAKE_CXXFLAGS += -DWAV_SUPPORT_NOT_FORCED
+}
diff --git a/tests/auto/integration/qaudiodecoderbackend/tst_qaudiodecoderbackend.cpp b/tests/auto/integration/qaudiodecoderbackend/tst_qaudiodecoderbackend.cpp
index 2af06b46c..1e582d14b 100644
--- a/tests/auto/integration/qaudiodecoderbackend/tst_qaudiodecoderbackend.cpp
+++ b/tests/auto/integration/qaudiodecoderbackend/tst_qaudiodecoderbackend.cpp
@@ -30,6 +30,8 @@
#include <QDebug>
#include "qaudiodecoder.h"
+#include "../shared/mediafileselector.h"
+
#define TEST_FILE_NAME "testdata/test.wav"
#define TEST_UNSUPPORTED_FILE_NAME "testdata/test-unsupported.avi"
#define TEST_CORRUPTED_FILE_NAME "testdata/test-corrupted.wav"
@@ -56,6 +58,9 @@ private slots:
void unsupportedFileTest();
void corruptedFileTest();
void deviceTest();
+
+private:
+ bool isWavSupported();
};
void tst_QAudioDecoderBackend::init()
@@ -67,14 +72,28 @@ void tst_QAudioDecoderBackend::initTestCase()
QAudioDecoder d;
if (!d.isAvailable())
QSKIP("Audio decoder service is not available");
+
+ qRegisterMetaType<QMediaContent>();
}
void tst_QAudioDecoderBackend::cleanup()
{
}
+bool tst_QAudioDecoderBackend::isWavSupported()
+{
+#ifdef WAV_SUPPORT_NOT_FORCED
+ return !MediaFileSelector::selectMediaFile(QStringList() << QFINDTESTDATA(TEST_FILE_NAME)).isNull();
+#else
+ return true;
+#endif
+}
+
void tst_QAudioDecoderBackend::fileTest()
{
+ if (!isWavSupported())
+ QSKIP("Sound format is not supported");
+
QAudioDecoder d;
if (d.error() == QAudioDecoder::ServiceMissingError)
QSKIP("There is no audio decoding support on this platform.");
@@ -411,6 +430,9 @@ void tst_QAudioDecoderBackend::corruptedFileTest()
void tst_QAudioDecoderBackend::deviceTest()
{
+ if (!isWavSupported())
+ QSKIP("Sound format is not supported");
+
QAudioDecoder d;
if (d.error() == QAudioDecoder::ServiceMissingError)
QSKIP("There is no audio decoding support on this platform.");
diff --git a/tests/auto/integration/qmediaplayerbackend/BLACKLIST b/tests/auto/integration/qmediaplayerbackend/BLACKLIST
index 4f8656e0a..8aa622881 100644
--- a/tests/auto/integration/qmediaplayerbackend/BLACKLIST
+++ b/tests/auto/integration/qmediaplayerbackend/BLACKLIST
@@ -9,13 +9,9 @@ opensuse-13.1 64bit
[loadMedia]
windows 64bit developer-build
-# QTBUG-60268
-b2qt
[unloadMedia]
windows 64bit developer-build
-# QTBUG-60268
-b2qt
[playPauseStop]
linux
@@ -23,18 +19,12 @@ windows 64bit developer-build
[processEOS]
windows 64bit developer-build
-# QTBUG-60268
-b2qt
[deleteLaterAtEOS]
windows 64bit developer-build
-# QTBUG-60268
-b2qt
[initialVolume]
windows 64bit developer-build
-# QTBUG-60268
-b2qt
[playlist]
redhatenterpriselinuxworkstation-6.6
@@ -53,7 +43,3 @@ redhatenterpriselinuxworkstation-6.6
[surfaceTest]
redhatenterpriselinuxworkstation-6.6
-
-[playlistObject]
-# QTBUG-60268
-b2qt
diff --git a/tests/auto/integration/qmediaplayerbackend/qmediaplayerbackend.pro b/tests/auto/integration/qmediaplayerbackend/qmediaplayerbackend.pro
index 87637fadc..b9417f7c2 100644
--- a/tests/auto/integration/qmediaplayerbackend/qmediaplayerbackend.pro
+++ b/tests/auto/integration/qmediaplayerbackend/qmediaplayerbackend.pro
@@ -9,4 +9,14 @@ CONFIG += testcase
SOURCES += \
tst_qmediaplayerbackend.cpp
+HEADERS += \
+ ../shared/mediafileselector.h
+
TESTDATA += testdata/*
+
+boot2qt: {
+ # Yocto sysroot does not have gstreamer/wav
+ QMAKE_CXXFLAGS += -DWAV_SUPPORT_NOT_FORCED
+ # OGV testing is unstable with qemu
+ QMAKE_CXXFLAGS += -DSKIP_OGV_TEST
+}
diff --git a/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp b/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp
index fb72a239c..8e45a2ccb 100644
--- a/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp
+++ b/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp
@@ -36,6 +36,7 @@
#include <qmediaplaylist.h>
#include <qmediametadata.h>
+#include "../shared/mediafileselector.h"
//TESTED_COMPONENT=src/multimedia
QT_USE_NAMESPACE
@@ -78,7 +79,7 @@ private slots:
private:
QMediaContent selectVideoFile(const QStringList& mediaCandidates);
- QMediaContent selectMediaFile(const QStringList& mediaCandidates);
+ bool isWavSupported();
//one second local wav file
QMediaContent localWavFile;
@@ -170,31 +171,13 @@ QMediaContent tst_QMediaPlayerBackend::selectVideoFile(const QStringList& mediaC
return QMediaContent();
}
-QMediaContent tst_QMediaPlayerBackend::selectMediaFile(const QStringList& mediaCandidates)
+bool tst_QMediaPlayerBackend::isWavSupported()
{
- QMediaPlayer player;
-
- QSignalSpy errorSpy(&player, SIGNAL(error(QMediaPlayer::Error)));
-
- foreach (QString s, mediaCandidates) {
- QFileInfo mediaFile(s);
- if (!mediaFile.exists())
- continue;
- QMediaContent media = QMediaContent(QUrl::fromLocalFile(mediaFile.absoluteFilePath()));
- player.setMedia(media);
- player.play();
-
- for (int i = 0; i < 2000 && player.mediaStatus() != QMediaPlayer::BufferedMedia && errorSpy.isEmpty(); i+=50) {
- QTest::qWait(50);
- }
-
- if (player.mediaStatus() == QMediaPlayer::BufferedMedia && errorSpy.isEmpty()) {
- return media;
- }
- errorSpy.clear();
- }
-
- return QMediaContent();
+#ifdef WAV_SUPPORT_NOT_FORCED
+ return !localWavFile.isNull();
+#else
+ return true;
+#endif
}
void tst_QMediaPlayerBackend::initTestCase()
@@ -203,33 +186,24 @@ void tst_QMediaPlayerBackend::initTestCase()
if (!player.isAvailable())
QSKIP("Media player service is not available");
- const QString testFileName = QFINDTESTDATA("testdata/test.wav");
- QFileInfo wavFile(testFileName);
-
- QVERIFY(wavFile.exists());
-
- localWavFile = QMediaContent(QUrl::fromLocalFile(wavFile.absoluteFilePath()));
-
- const QString testFileName2 = QFINDTESTDATA("testdata/_test.wav");
- QFileInfo wavFile2(testFileName2);
-
- QVERIFY(wavFile2.exists());
-
- localWavFile2 = QMediaContent(QUrl::fromLocalFile(wavFile2.absoluteFilePath()));
-
qRegisterMetaType<QMediaContent>();
+ localWavFile = MediaFileSelector::selectMediaFile(QStringList() << QFINDTESTDATA("testdata/test.wav"));
+ localWavFile2 = MediaFileSelector::selectMediaFile(QStringList() << QFINDTESTDATA("testdata/_test.wav"));;
+
QStringList mediaCandidates;
mediaCandidates << QFINDTESTDATA("testdata/colors.mp4");
+#ifndef SKIP_OGV_TEST
mediaCandidates << QFINDTESTDATA("testdata/colors.ogv");
- localVideoFile = selectMediaFile(mediaCandidates);
+#endif
+ localVideoFile = MediaFileSelector::selectMediaFile(mediaCandidates);
mediaCandidates.clear();
mediaCandidates << QFINDTESTDATA("testdata/nokia-tune.mp3");
mediaCandidates << QFINDTESTDATA("testdata/nokia-tune.mkv");
- localCompressedSoundFile = selectMediaFile(mediaCandidates);
+ localCompressedSoundFile = MediaFileSelector::selectMediaFile(mediaCandidates);
- localFileWithMetadata = selectMediaFile(QStringList() << QFINDTESTDATA("testdata/nokia-tune.mp3"));
+ localFileWithMetadata = MediaFileSelector::selectMediaFile(QStringList() << QFINDTESTDATA("testdata/nokia-tune.mp3"));
qgetenv("QT_TEST_CI").toInt(&m_inCISystem,10);
}
@@ -246,7 +220,11 @@ void tst_QMediaPlayerBackend::construction()
void tst_QMediaPlayerBackend::loadMedia()
{
+ if (!isWavSupported())
+ QSKIP("Sound format is not supported");
+
QMediaPlayer player;
+
QCOMPARE(player.state(), QMediaPlayer::StoppedState);
QCOMPARE(player.mediaStatus(), QMediaPlayer::NoMedia);
@@ -278,6 +256,9 @@ void tst_QMediaPlayerBackend::loadMedia()
void tst_QMediaPlayerBackend::unloadMedia()
{
+ if (!isWavSupported())
+ QSKIP("Sound format is not supported");
+
QMediaPlayer player;
player.setNotifyInterval(50);
@@ -326,6 +307,9 @@ void tst_QMediaPlayerBackend::unloadMedia()
void tst_QMediaPlayerBackend::playPauseStop()
{
+ if (!isWavSupported())
+ QSKIP("Sound format is not supported");
+
QMediaPlayer player;
player.setNotifyInterval(50);
@@ -478,6 +462,9 @@ void tst_QMediaPlayerBackend::playPauseStop()
void tst_QMediaPlayerBackend::processEOS()
{
+ if (!isWavSupported())
+ QSKIP("Sound format is not supported");
+
QMediaPlayer player;
player.setNotifyInterval(50);
@@ -610,6 +597,9 @@ private:
// QTBUG-24927 - deleteLater() called to QMediaPlayer from its signal handler does not work as expected
void tst_QMediaPlayerBackend::deleteLaterAtEOS()
{
+ if (!isWavSupported())
+ QSKIP("Sound format is not supported");
+
QPointer<QMediaPlayer> player(new QMediaPlayer);
DeleteLaterAtEos deleter(player);
player->setMedia(localWavFile);
@@ -734,6 +724,9 @@ void tst_QMediaPlayerBackend::volumeAcrossFiles()
void tst_QMediaPlayerBackend::initialVolume()
{
+ if (!isWavSupported())
+ QSKIP("Sound format is not supported");
+
{
QMediaPlayer player;
player.setVolume(1);
@@ -1193,6 +1186,9 @@ void tst_QMediaPlayerBackend::playlist()
void tst_QMediaPlayerBackend::playlistObject()
{
+ if (!isWavSupported())
+ QSKIP("Sound format is not supported");
+
QMediaPlayer player;
QSignalSpy mediaSpy(&player, SIGNAL(mediaChanged(QMediaContent)));
diff --git a/tests/auto/integration/shared/mediafileselector.h b/tests/auto/integration/shared/mediafileselector.h
new file mode 100644
index 000000000..8b88d14a4
--- /dev/null
+++ b/tests/auto/integration/shared/mediafileselector.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MEDIAFILESELECTOR_H
+#define MEDIAFILESELECTOR_H
+
+#include <QMediaContent>
+#include <QMediaPlayer>
+
+QT_BEGIN_NAMESPACE
+
+namespace MediaFileSelector {
+
+static QMediaContent selectMediaFile(const QStringList& mediaCandidates)
+{
+ QMediaPlayer player;
+
+ QSignalSpy errorSpy(&player, SIGNAL(error(QMediaPlayer::Error)));
+
+ foreach (QString s, mediaCandidates) {
+ QFileInfo mediaFile(s);
+ if (!mediaFile.exists())
+ continue;
+ QMediaContent media = QMediaContent(QUrl::fromLocalFile(mediaFile.absoluteFilePath()));
+ player.setMedia(media);
+ player.play();
+
+ for (int i = 0; i < 2000 && player.mediaStatus() != QMediaPlayer::BufferedMedia && errorSpy.isEmpty(); i+=50) {
+ QTest::qWait(50);
+ }
+
+ if (player.mediaStatus() == QMediaPlayer::BufferedMedia && errorSpy.isEmpty()) {
+ return media;
+ }
+ errorSpy.clear();
+ }
+
+ return QMediaContent();
+}
+
+} // MediaFileSelector namespace
+
+QT_END_NAMESPACE
+
+#endif
+
diff --git a/tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp b/tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp
index 4b2136a5c..c2f18d2a4 100644
--- a/tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp
+++ b/tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp
@@ -557,6 +557,11 @@ void tst_QPainterVideoSurface::shaderType()
{
QPainterVideoSurface surface;
QGLWidget widget;
+ if (!widget.context()
+ || !widget.context()->isValid()) {
+ QSKIP("Platform does not support GLContext");
+ }
+
widget.show();
QTest::qWaitForWindowExposed(&widget);
widget.makeCurrent();
@@ -649,6 +654,11 @@ void tst_QPainterVideoSurface::shaderTypeStarted()
QFETCH(QPainterVideoSurface::ShaderType, shaderType);
QGLWidget widget;
+ if (!widget.context()
+ || !widget.context()->isValid()) {
+ QSKIP("Platform does not support GLContext");
+ }
+
widget.show();
QTest::qWaitForWindowExposed(&widget);
widget.makeCurrent();
@@ -894,6 +904,11 @@ void tst_QPainterVideoSurface::shaderSupportedFormat()
QFETCH(bool, supportedFormat);
QGLWidget widget;
+ if (!widget.context()
+ || !widget.context()->isValid()) {
+ QSKIP("Platform does not support GLContext");
+ }
+
widget.show();
QTest::qWaitForWindowExposed(&widget);
widget.makeCurrent();
@@ -1011,6 +1026,11 @@ void tst_QPainterVideoSurface::shaderPresent()
QFETCH(int, bytesPerLineB);
QGLWidget widget;
+ if (!widget.context()
+ || !widget.context()->isValid()) {
+ QSKIP("Platform does not support GLContext");
+ }
+
widget.show();
QTest::qWaitForWindowExposed(&widget);
widget.makeCurrent();
@@ -1142,6 +1162,11 @@ void tst_QPainterVideoSurface::shaderPresentOpaqueFrame()
QFETCH(QPainterVideoSurface::ShaderType, shaderType);
QGLWidget widget;
+ if (!widget.context()
+ || !widget.context()->isValid()) {
+ QSKIP("Platform does not support GLContext");
+ }
+
widget.show();
QTest::qWaitForWindowExposed(&widget);
widget.makeCurrent();
@@ -1191,6 +1216,11 @@ void tst_QPainterVideoSurface::shaderPresentGLFrame()
QFETCH(QPainterVideoSurface::ShaderType, shaderType);
QGLWidget widget;
+ if (!widget.context()
+ || !widget.context()->isValid()) {
+ QSKIP("Platform does not support GLContext");
+ }
+
widget.show();
QTest::qWaitForWindowExposed(&widget);
widget.makeCurrent();