diff options
Diffstat (limited to 'tests/auto/unit/qmultimedia_common')
51 files changed, 0 insertions, 4336 deletions
diff --git a/tests/auto/unit/qmultimedia_common/mock.pri b/tests/auto/unit/qmultimedia_common/mock.pri deleted file mode 100644 index 94a17a615..000000000 --- a/tests/auto/unit/qmultimedia_common/mock.pri +++ /dev/null @@ -1,8 +0,0 @@ -INCLUDEPATH += $$PWD \ - ../../../../src/multimedia \ - -HEADERS *= \ - ../qmultimedia_common/mockmediaserviceprovider.h \ - ../qmultimedia_common/mockmediaservice.h \ - ../qmultimedia_common/mockmediaobject.h \ - ../qmultimedia_common/mockavailabilitycontrol.h diff --git a/tests/auto/unit/qmultimedia_common/mockaudiodecodercontrol.h b/tests/auto/unit/qmultimedia_common/mockaudiodecodercontrol.h deleted file mode 100644 index 82eeedc15..000000000 --- a/tests/auto/unit/qmultimedia_common/mockaudiodecodercontrol.h +++ /dev/null @@ -1,206 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part 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 MOCKAUDIODECODERCONTROL_H -#define MOCKAUDIODECODERCONTROL_H - -#include "qmediacontrol.h" -#include "qaudiodecodercontrol.h" - -#include <QtCore/qpair.h> - -#include "qaudiobuffer.h" -#include <QTimer> -#include <QIODevice> - -#define MOCK_DECODER_MAX_BUFFERS 10 - -QT_BEGIN_NAMESPACE - -class MockAudioDecoderControl : public QAudioDecoderControl -{ - Q_OBJECT - -public: - MockAudioDecoderControl(QObject *parent = 0) - : QAudioDecoderControl(parent) - , mState(QAudioDecoder::StoppedState) - , mDevice(0) - , mPosition(-1) - , mSerial(0) - { - mFormat.setChannelCount(1); - mFormat.setSampleSize(8); - mFormat.setSampleRate(1000); - mFormat.setCodec("audio/x-raw"); - mFormat.setSampleType(QAudioFormat::UnSignedInt); - } - - QAudioDecoder::State state() const - { - return mState; - } - - QString sourceFilename() const - { - return mSource; - } - - QAudioFormat audioFormat() const - { - return mFormat; - } - - void setAudioFormat(const QAudioFormat &format) - { - if (mFormat != format) { - mFormat = format; - emit formatChanged(mFormat); - } - } - - void setSourceFilename(const QString &fileName) - { - mSource = fileName; - mDevice = 0; - stop(); - } - - QIODevice* sourceDevice() const - { - return mDevice; - } - - void setSourceDevice(QIODevice *device) - { - mDevice = device; - mSource.clear(); - stop(); - } - - // When decoding we decode to first buffer, then second buffer - // we then stop until the first is read again and so on, for - // 5 buffers - void start() - { - if (mState == QAudioDecoder::StoppedState) { - if (!mSource.isEmpty()) { - mState = QAudioDecoder::DecodingState; - emit stateChanged(mState); - emit durationChanged(duration()); - - QTimer::singleShot(50, this, SLOT(pretendDecode())); - } else { - emit error(QAudioDecoder::ResourceError, "No source set"); - } - } - } - - void stop() - { - if (mState != QAudioDecoder::StoppedState) { - mState = QAudioDecoder::StoppedState; - mSerial = 0; - mPosition = 0; - mBuffers.clear(); - emit stateChanged(mState); - emit bufferAvailableChanged(false); - } - } - - QAudioBuffer read() - { - QAudioBuffer a; - if (mBuffers.length() > 0) { - a = mBuffers.takeFirst(); - mPosition = a.startTime() / 1000; - emit positionChanged(mPosition); - - if (mBuffers.isEmpty()) - emit bufferAvailableChanged(false); - - if (mBuffers.isEmpty() && mSerial >= MOCK_DECODER_MAX_BUFFERS) { - mState = QAudioDecoder::StoppedState; - emit finished(); - emit stateChanged(mState); - } else - QTimer::singleShot(50, this, SLOT(pretendDecode())); - } - - return a; - } - - bool bufferAvailable() const - { - return mBuffers.length() > 0; - } - - qint64 position() const - { - return mPosition; - } - - qint64 duration() const - { - return (sizeof(mSerial) * MOCK_DECODER_MAX_BUFFERS * qint64(1000)) / (mFormat.sampleRate() * mFormat.channelCount()); - } - -private slots: - void pretendDecode() - { - // Check if we've reached end of stream - if (mSerial >= MOCK_DECODER_MAX_BUFFERS) - return; - - // We just keep the length of mBuffers to 3 or less. - if (mBuffers.length() < 3) { - QByteArray b(sizeof(mSerial), 0); - memcpy(b.data(), &mSerial, sizeof(mSerial)); - qint64 position = (sizeof(mSerial) * mSerial * qint64(1000000)) / (mFormat.sampleRate() * mFormat.channelCount()); - mSerial++; - mBuffers.push_back(QAudioBuffer(b, mFormat, position)); - emit bufferReady(); - if (mBuffers.count() == 1) - emit bufferAvailableChanged(true); - } - } - -public: - QAudioDecoder::State mState; - QString mSource; - QIODevice *mDevice; - QAudioFormat mFormat; - qint64 mPosition; - - int mSerial; - QList<QAudioBuffer> mBuffers; -}; - -QT_END_NAMESPACE - -#endif // QAUDIODECODERCONTROL_H diff --git a/tests/auto/unit/qmultimedia_common/mockaudiodecoderservice.h b/tests/auto/unit/qmultimedia_common/mockaudiodecoderservice.h deleted file mode 100644 index 11c1dff95..000000000 --- a/tests/auto/unit/qmultimedia_common/mockaudiodecoderservice.h +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 MOCKAUDIODECODERSERVICE_H -#define MOCKAUDIODECODERSERVICE_H - -#include "qmediaservice.h" - -#include "mockaudiodecodercontrol.h" - -class MockAudioDecoderService : public QMediaService -{ - Q_OBJECT - -public: - MockAudioDecoderService(QObject *parent = 0) - : QMediaService(parent) - { - mockControl = new MockAudioDecoderControl(this); - validControl = mockControl; - } - - ~MockAudioDecoderService() - { - delete mockControl; - } - - QMediaControl* requestControl(const char *iid) - { - if (qstrcmp(iid, QAudioDecoderControl_iid) == 0) - return mockControl; - return 0; - } - - void releaseControl(QMediaControl *control) - { - Q_UNUSED(control); - } - - void setControlNull() - { - mockControl = 0; - } - - void setControlValid() - { - mockControl = validControl; - } - - MockAudioDecoderControl *mockControl; - MockAudioDecoderControl *validControl; -}; - - - -#endif // MOCKAUDIODECODERSERVICE_H diff --git a/tests/auto/unit/qmultimedia_common/mockaudioencodercontrol.h b/tests/auto/unit/qmultimedia_common/mockaudioencodercontrol.h deleted file mode 100644 index 0b3de29e7..000000000 --- a/tests/auto/unit/qmultimedia_common/mockaudioencodercontrol.h +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 MOCKAUDIOENCODERCONTROL_H -#define MOCKAUDIOENCODERCONTROL_H - -#include "qaudioencodersettingscontrol.h" - -class MockAudioEncoderControl : public QAudioEncoderSettingsControl -{ - Q_OBJECT -public: - MockAudioEncoderControl(QObject *parent): - QAudioEncoderSettingsControl(parent) - { - m_codecs << "audio/pcm" << "audio/mpeg"; - m_descriptions << "Pulse Code Modulation" << "mp3 format"; - m_audioSettings.setCodec("audio/pcm"); - m_audioSettings.setBitRate(128*1024); - m_audioSettings.setSampleRate(8000); - m_freqs << 8000 << 11025 << 22050 << 44100; - } - - ~MockAudioEncoderControl() {} - - QAudioEncoderSettings audioSettings() const - { - return m_audioSettings; - } - - void setAudioSettings(const QAudioEncoderSettings &settings) - { - m_audioSettings = settings; - } - - QList<int> supportedChannelCounts(const QAudioEncoderSettings & = QAudioEncoderSettings()) const - { - QList<int> list; list << 1 << 2; return list; - } - - QList<int> supportedSampleRates(const QAudioEncoderSettings & = QAudioEncoderSettings(), bool *continuous = 0) const - { - if (continuous) - *continuous = false; - - return m_freqs; - } - - QStringList supportedAudioCodecs() const - { - return m_codecs; - } - - QString codecDescription(const QString &codecName) const - { - return m_descriptions.value(m_codecs.indexOf(codecName)); - } - -private: - QAudioEncoderSettings m_audioSettings; - - QStringList m_codecs; - QStringList m_descriptions; - - QList<int> m_freqs; - -}; - -#endif // MOCKAUDIOENCODERCONTROL_H diff --git a/tests/auto/unit/qmultimedia_common/mockaudioinputselector.h b/tests/auto/unit/qmultimedia_common/mockaudioinputselector.h deleted file mode 100644 index 216fb54d3..000000000 --- a/tests/auto/unit/qmultimedia_common/mockaudioinputselector.h +++ /dev/null @@ -1,104 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 MOCKAUDIOINPUTSELECTOR_H -#define MOCKAUDIOINPUTSELECTOR_H - -#include "qaudioinputselectorcontrol.h" - -class MockAudioInputSelector : public QAudioInputSelectorControl -{ - Q_OBJECT -public: - MockAudioInputSelector(QObject *parent): - QAudioInputSelectorControl(parent) - { - m_names << "device1" << "device2" << "device3"; - m_descriptions << "dev1 comment" << "dev2 comment" << "dev3 comment"; - m_audioInput = "device1"; - emit availableInputsChanged(); - } - ~MockAudioInputSelector() {} - - QList<QString> availableInputs() const - { - return m_names; - } - - QString inputDescription(const QString& name) const - { - QString desc; - - for (int i = 0; i < m_names.count(); i++) { - if (m_names.at(i).compare(name) == 0) { - desc = m_descriptions.at(i); - break; - } - } - return desc; - } - - QString defaultInput() const - { - return m_names.at(0); - } - - QString activeInput() const - { - return m_audioInput; - } - -public Q_SLOTS: - - void setActiveInput(const QString& name) - { - m_audioInput = name; - emit activeInputChanged(name); - } - - void addInputs() - { - m_names << "device4"; - emit availableInputsChanged(); - } - - void removeInputs() - { - m_names.clear(); - emit availableInputsChanged(); - } - -private: - QString m_audioInput; - QList<QString> m_names; - QList<QString> m_descriptions; -}; - - - -#endif // MOCKAUDIOINPUTSELECTOR_H diff --git a/tests/auto/unit/qmultimedia_common/mockaudioprobecontrol.h b/tests/auto/unit/qmultimedia_common/mockaudioprobecontrol.h deleted file mode 100644 index bb5279db9..000000000 --- a/tests/auto/unit/qmultimedia_common/mockaudioprobecontrol.h +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 MOCKAUDIOPROBECONTROL_H -#define MOCKAUDIOPROBECONTROL_H - -#include "qmediaaudioprobecontrol.h" - -class MockAudioProbeControl : public QMediaAudioProbeControl -{ - Q_OBJECT -public: - MockAudioProbeControl(QObject *parent): - QMediaAudioProbeControl(parent) - { - } - - ~MockAudioProbeControl() {} - -private: -}; - -#endif // MOCKAUDIOPROBECONTROL_H diff --git a/tests/auto/unit/qmultimedia_common/mockaudiorolecontrol.h b/tests/auto/unit/qmultimedia_common/mockaudiorolecontrol.h deleted file mode 100644 index 06e914ba1..000000000 --- a/tests/auto/unit/qmultimedia_common/mockaudiorolecontrol.h +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 MOCKAUDIOROLECONTROL_H -#define MOCKAUDIOROLECONTROL_H - -#include <qaudiorolecontrol.h> - -class MockAudioRoleControl : public QAudioRoleControl -{ - friend class MockMediaPlayerService; - -public: - MockAudioRoleControl() - : QAudioRoleControl() - , m_audioRole(QAudio::UnknownRole) - { - } - - QAudio::Role audioRole() const - { - return m_audioRole; - } - - void setAudioRole(QAudio::Role role) - { - if (role != m_audioRole) - emit audioRoleChanged(m_audioRole = role); - } - - QList<QAudio::Role> supportedAudioRoles() const - { - return QList<QAudio::Role>() << QAudio::MusicRole - << QAudio::AlarmRole - << QAudio::NotificationRole; - } - - QAudio::Role m_audioRole; -}; - -#endif // MOCKAUDIOROLECONTROL_H diff --git a/tests/auto/unit/qmultimedia_common/mockavailabilitycontrol.h b/tests/auto/unit/qmultimedia_common/mockavailabilitycontrol.h deleted file mode 100644 index 11e89abb6..000000000 --- a/tests/auto/unit/qmultimedia_common/mockavailabilitycontrol.h +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 MOCKAVAILABILITYCONTROL_H -#define MOCKAVAILABILITYCONTROL_H - -#include <qmediaavailabilitycontrol.h> - -class MockAvailabilityControl : public QMediaAvailabilityControl -{ - Q_OBJECT - -public: - MockAvailabilityControl(QMultimedia::AvailabilityStatus available) - : m_availability(available) - { - - } - - QMultimedia::AvailabilityStatus availability() const - { - return m_availability; - } - - void setAvailability(QMultimedia::AvailabilityStatus availability) - { - if (m_availability != availability) { - m_availability = availability; - emit availabilityChanged(availability); - } - } - - QMultimedia::AvailabilityStatus m_availability; -}; - -#endif // MOCKAVAILABILITYCONTROL_H diff --git a/tests/auto/unit/qmultimedia_common/mockcamera.pri b/tests/auto/unit/qmultimedia_common/mockcamera.pri deleted file mode 100644 index f6f97de1e..000000000 --- a/tests/auto/unit/qmultimedia_common/mockcamera.pri +++ /dev/null @@ -1,26 +0,0 @@ -# Camera related mock backend files -INCLUDEPATH += $$PWD \ - ../../../../src/multimedia \ - ../../../../src/multimedia/video \ - ../../../../src/multimedia/camera - -HEADERS *= \ - ../qmultimedia_common/mockcameraservice.h \ - ../qmultimedia_common/mockcameraflashcontrol.h \ - ../qmultimedia_common/mockcameralockscontrol.h \ - ../qmultimedia_common/mockcamerafocuscontrol.h \ - ../qmultimedia_common/mockcamerazoomcontrol.h \ - ../qmultimedia_common/mockcameraimageprocessingcontrol.h \ - ../qmultimedia_common/mockcameraimagecapturecontrol.h \ - ../qmultimedia_common/mockcameraexposurecontrol.h \ - ../qmultimedia_common/mockcameracapturedestinationcontrol.h \ - ../qmultimedia_common/mockcameracapturebuffercontrol.h \ - ../qmultimedia_common/mockimageencodercontrol.h \ - ../qmultimedia_common/mockcameracontrol.h \ - ../qmultimedia_common/mockvideodeviceselectorcontrol.h \ - ../qmultimedia_common/mockcamerainfocontrol.h \ - ../qmultimedia_common/mockcameraviewfindersettingscontrol.h - - -include(mockvideo.pri) - diff --git a/tests/auto/unit/qmultimedia_common/mockcameracapturebuffercontrol.h b/tests/auto/unit/qmultimedia_common/mockcameracapturebuffercontrol.h deleted file mode 100644 index 77a758285..000000000 --- a/tests/auto/unit/qmultimedia_common/mockcameracapturebuffercontrol.h +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 MOCKCAMERACAPTUREBUFFERCONTROL_H -#define MOCKCAMERACAPTUREBUFFERCONTROL_H - -#include "qcameracapturebufferformatcontrol.h" - -class MockCaptureBufferFormatControl : public QCameraCaptureBufferFormatControl -{ - Q_OBJECT -public: - MockCaptureBufferFormatControl(QObject *parent = 0): - QCameraCaptureBufferFormatControl(parent), - m_format(QVideoFrame::Format_Jpeg) - { - } - - QList<QVideoFrame::PixelFormat> supportedBufferFormats() const - { - return QList<QVideoFrame::PixelFormat>() - << QVideoFrame::Format_Jpeg - << QVideoFrame::Format_RGB32 - << QVideoFrame::Format_AdobeDng; - } - - QVideoFrame::PixelFormat bufferFormat() const - { - return m_format; - } - - void setBufferFormat(QVideoFrame::PixelFormat format) - { - if (format != m_format && supportedBufferFormats().contains(format)) { - m_format = format; - emit bufferFormatChanged(m_format); - } - } - -private: - QVideoFrame::PixelFormat m_format; -}; - - -#endif // MOCKCAMERACAPTUREBUFFERCONTROL_H diff --git a/tests/auto/unit/qmultimedia_common/mockcameracapturedestinationcontrol.h b/tests/auto/unit/qmultimedia_common/mockcameracapturedestinationcontrol.h deleted file mode 100644 index adec9ea81..000000000 --- a/tests/auto/unit/qmultimedia_common/mockcameracapturedestinationcontrol.h +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 MOCKCAMERACAPTUREDESTINATIONCONTROL_H -#define MOCKCAMERACAPTUREDESTINATIONCONTROL_H - -#include <QtMultimedia/qcameracapturedestinationcontrol.h> - -class MockCaptureDestinationControl : public QCameraCaptureDestinationControl -{ - Q_OBJECT -public: - MockCaptureDestinationControl(QObject *parent = 0): - QCameraCaptureDestinationControl(parent), - m_destination(QCameraImageCapture::CaptureToFile) - { - } - - bool isCaptureDestinationSupported(QCameraImageCapture::CaptureDestinations destination) const - { - return destination == QCameraImageCapture::CaptureToBuffer || - destination == QCameraImageCapture::CaptureToFile; - } - - QCameraImageCapture::CaptureDestinations captureDestination() const - { - return m_destination; - } - - void setCaptureDestination(QCameraImageCapture::CaptureDestinations destination) - { - if (isCaptureDestinationSupported(destination) && destination != m_destination) { - m_destination = destination; - emit captureDestinationChanged(m_destination); - } - } - -private: - QCameraImageCapture::CaptureDestinations m_destination; -}; - -#endif // MOCKCAMERACAPTUREDESTINATIONCONTROL_H diff --git a/tests/auto/unit/qmultimedia_common/mockcameracontrol.h b/tests/auto/unit/qmultimedia_common/mockcameracontrol.h deleted file mode 100644 index 95e9be7b3..000000000 --- a/tests/auto/unit/qmultimedia_common/mockcameracontrol.h +++ /dev/null @@ -1,132 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 MOCKCAMERACONTROL_H -#define MOCKCAMERACONTROL_H - -#include "qcameracontrol.h" - -class MockCameraControl : public QCameraControl -{ - friend class MockCaptureControl; - Q_OBJECT -public: - MockCameraControl(QObject *parent = 0): - QCameraControl(parent), - m_state(QCamera::UnloadedState), - m_captureMode(QCamera::CaptureStillImage), - m_status(QCamera::UnloadedStatus), - m_propertyChangesSupported(false) - { - } - - ~MockCameraControl() {} - - void start() { m_state = QCamera::ActiveState; } - virtual void stop() { m_state = QCamera::UnloadedState; } - QCamera::State state() const { return m_state; } - void setState(QCamera::State state) { - if (m_state != state) { - m_state = state; - - switch (state) { - case QCamera::UnloadedState: - m_status = QCamera::UnloadedStatus; - break; - case QCamera::LoadedState: - m_status = QCamera::LoadedStatus; - break; - case QCamera::ActiveState: - m_status = QCamera::ActiveStatus; - break; - default: - emit error(QCamera::NotSupportedFeatureError, "State not supported."); - return; - } - - emit stateChanged(m_state); - emit statusChanged(m_status); - } - } - - QCamera::Status status() const { return m_status; } - - QCamera::CaptureModes captureMode() const { return m_captureMode; } - void setCaptureMode(QCamera::CaptureModes mode) - { - if (m_captureMode != mode) { - if (m_state == QCamera::ActiveState && !m_propertyChangesSupported) - return; - m_captureMode = mode; - emit captureModeChanged(mode); - } - } - - bool isCaptureModeSupported(QCamera::CaptureModes mode) const - { - return mode == QCamera::CaptureStillImage || mode == QCamera::CaptureVideo; - } - - QCamera::LockTypes supportedLocks() const - { - return QCamera::LockExposure | QCamera::LockFocus | QCamera::LockWhiteBalance; - } - - bool canChangeProperty(PropertyChangeType changeType, QCamera::Status status) const - { - Q_UNUSED(status); - if (changeType == QCameraControl::ImageEncodingSettings && m_captureMode == QCamera::CaptureVideo) - return true; - else if (changeType== QCameraControl::VideoEncodingSettings) - return true; - else - return m_propertyChangesSupported; - } - - /* helper method to emit the signal error */ - void setError(QCamera::Error err, QString errorString) - { - emit error(err, errorString); - } - - /* helper method to emit the signal statusChaged */ - void setStatus(QCamera::Status newStatus) - { - m_status = newStatus; - emit statusChanged(newStatus); - } - - QCamera::State m_state; - QCamera::CaptureModes m_captureMode; - QCamera::Status m_status; - bool m_propertyChangesSupported; -}; - - - -#endif // MOCKCAMERACONTROL_H diff --git a/tests/auto/unit/qmultimedia_common/mockcameraexposurecontrol.h b/tests/auto/unit/qmultimedia_common/mockcameraexposurecontrol.h deleted file mode 100644 index 1b2372cf5..000000000 --- a/tests/auto/unit/qmultimedia_common/mockcameraexposurecontrol.h +++ /dev/null @@ -1,280 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 MOCKCAMERAEXPOSURECONTROL_H -#define MOCKCAMERAEXPOSURECONTROL_H - -#include "qcameraexposurecontrol.h" - -class MockCameraExposureControl : public QCameraExposureControl -{ - Q_OBJECT -public: - MockCameraExposureControl(QObject *parent = 0): - QCameraExposureControl(parent), - m_aperture(2.8), - m_shutterSpeed(0.01), - m_isoSensitivity(100), - m_meteringMode(QCameraExposure::MeteringMatrix), - m_exposureCompensation(0), - m_exposureMode(QCameraExposure::ExposureAuto), - m_flashMode(QCameraExposure::FlashAuto), - m_spot(0.5, 0.5) - { - m_isoRanges << 100 << 200 << 400 << 800; - m_apertureRanges << 2.8 << 4.0 << 5.6 << 8.0 << 11.0 << 16.0; - m_shutterRanges << 0.001 << 0.01 << 0.1 << 1.0; - m_exposureRanges << -2.0 << 2.0; - - const QCameraExposure::ExposureMode exposureModes[] = { - QCameraExposure::ExposureAuto, - QCameraExposure::ExposureManual, - QCameraExposure::ExposureBacklight, - QCameraExposure::ExposureNight, - QCameraExposure::ExposureSpotlight, - QCameraExposure::ExposureSports, - QCameraExposure::ExposureSnow, - QCameraExposure:: ExposureLargeAperture, - QCameraExposure::ExposureSmallAperture, - QCameraExposure::ExposurePortrait, - QCameraExposure::ExposureModeVendor, - QCameraExposure::ExposureBeach, - }; - - for (QCameraExposure::ExposureMode mode : exposureModes) - m_exposureModes << QVariant::fromValue<QCameraExposure::ExposureMode>(mode); - - m_meteringModes << QVariant::fromValue<QCameraExposure::MeteringMode>(QCameraExposure::MeteringMatrix) - << QVariant::fromValue<QCameraExposure::MeteringMode>(QCameraExposure::MeteringSpot); - } - - ~MockCameraExposureControl() {} - - bool isParameterSupported(ExposureParameter parameter) const - { - switch (parameter) { - case QCameraExposureControl::ExposureMode: - case QCameraExposureControl::MeteringMode: - case QCameraExposureControl::ExposureCompensation: - case QCameraExposureControl::ISO: - case QCameraExposureControl::Aperture: - case QCameraExposureControl::ShutterSpeed: - case QCameraExposureControl::SpotMeteringPoint: - return true; - default: - return false; - } - } - - QVariant requestedValue(ExposureParameter param) const - { - return m_requestedParameters.value(param); - } - - QVariant actualValue(ExposureParameter param) const - { - switch (param) { - case QCameraExposureControl::ExposureMode: - return QVariant::fromValue<QCameraExposure::ExposureMode>(m_exposureMode); - case QCameraExposureControl::MeteringMode: - return QVariant::fromValue<QCameraExposure::MeteringMode>(m_meteringMode); - case QCameraExposureControl::ExposureCompensation: - return QVariant(m_exposureCompensation); - case QCameraExposureControl::ISO: - return QVariant(m_isoSensitivity); - case QCameraExposureControl::Aperture: - return QVariant(m_aperture); - case QCameraExposureControl::ShutterSpeed: - return QVariant(m_shutterSpeed); - case QCameraExposureControl::SpotMeteringPoint: - return QVariant(m_spot); - default: - return QVariant(); - } - } - - QVariantList supportedParameterRange(ExposureParameter parameter, bool *continuous) const - { - *continuous = false; - - QVariantList res; - switch (parameter) { - case QCameraExposureControl::ExposureCompensation: - *continuous = true; - return m_exposureRanges; - case QCameraExposureControl::ISO: - return m_isoRanges; - case QCameraExposureControl::Aperture: - *continuous = true; - return m_apertureRanges; - case QCameraExposureControl::ShutterSpeed: - *continuous = true; - return m_shutterRanges; - case QCameraExposureControl::ExposureMode: - return m_exposureModes; - case QCameraExposureControl::MeteringMode: - return m_meteringModes; - default: - break; - } - - return res; - } - - // Added valueChanged and parameterRangeChanged signal - bool setValue(ExposureParameter param, const QVariant& value) - { - if (!isParameterSupported(param)) - return false; - - if (m_requestedParameters.value(param) != value) { - m_requestedParameters.insert(param, value); - emit requestedValueChanged(param); - } - - switch (param) { - case QCameraExposureControl::ExposureMode: - { - QCameraExposure::ExposureMode mode = value.value<QCameraExposure::ExposureMode>(); - if (mode != m_exposureMode && m_exposureModes.contains(value)) { - m_exposureMode = mode; - emit actualValueChanged(param); - } - } - break; - case QCameraExposureControl::MeteringMode: - { - QCameraExposure::MeteringMode mode = value.value<QCameraExposure::MeteringMode>(); - if (mode != m_meteringMode && m_meteringModes.contains(value)) { - m_meteringMode = mode; - emit actualValueChanged(param); - } - } - break; - case QCameraExposureControl::ExposureCompensation: - { - m_res.clear(); - m_res << -4.0 << 4.0; - qreal exposureCompensationlocal = qBound<qreal>(-2.0, value.toReal(), 2.0); - if (actualValue(param).toReal() != exposureCompensationlocal) { - m_exposureCompensation = exposureCompensationlocal; - emit actualValueChanged(param); - } - - if (m_exposureRanges.last().toReal() != m_res.last().toReal()) { - m_exposureRanges.clear(); - m_exposureRanges = m_res; - emit parameterRangeChanged(param); - } - } - break; - case QCameraExposureControl::ISO: - { - m_res.clear(); - m_res << 20 << 50; - qreal exposureCompensationlocal = 100*qRound(qBound(100, value.toInt(), 800)/100.0); - if (actualValue(param).toReal() != exposureCompensationlocal) { - m_isoSensitivity = exposureCompensationlocal; - emit actualValueChanged(param); - } - - if (m_isoRanges.last().toInt() != m_res.last().toInt()) { - m_isoRanges.clear(); - m_isoRanges = m_res; - emit parameterRangeChanged(param); - } - } - break; - case QCameraExposureControl::Aperture: - { - m_res.clear(); - m_res << 12.0 << 18.0 << 20.0; - qreal exposureCompensationlocal = qBound<qreal>(2.8, value.toReal(), 16.0); - if (actualValue(param).toReal() != exposureCompensationlocal) { - m_aperture = exposureCompensationlocal; - emit actualValueChanged(param); - } - - if (m_apertureRanges.last().toReal() != m_res.last().toReal()) { - m_apertureRanges.clear(); - m_apertureRanges = m_res; - emit parameterRangeChanged(param); - } - } - break; - case QCameraExposureControl::ShutterSpeed: - { - m_res.clear(); - m_res << 0.12 << 1.0 << 2.0; - qreal exposureCompensationlocal = qBound<qreal>(0.001, value.toReal(), 1.0); - if (actualValue(param).toReal() != exposureCompensationlocal) { - m_shutterSpeed = exposureCompensationlocal; - emit actualValueChanged(param); - } - - if (m_shutterRanges.last().toReal() != m_res.last().toReal()) { - m_shutterRanges.clear(); - m_shutterRanges = m_res; - emit parameterRangeChanged(param); - } - } - break; - - case QCameraExposureControl::SpotMeteringPoint: - { - static QRectF valid(0, 0, 1, 1); - if (valid.contains(value.toPointF())) { - m_spot = value.toPointF(); - emit actualValueChanged(param); - return true; - } - return false; - } - - default: - return false; - } - - return true; - } - -private: - qreal m_aperture; - qreal m_shutterSpeed; - int m_isoSensitivity; - QCameraExposure::MeteringMode m_meteringMode; - qreal m_exposureCompensation; - QCameraExposure::ExposureMode m_exposureMode; - QCameraExposure::FlashModes m_flashMode; - QVariantList m_isoRanges,m_apertureRanges, m_shutterRanges, m_exposureRanges, m_res, m_exposureModes, m_meteringModes; - QPointF m_spot; - - QMap<QCameraExposureControl::ExposureParameter, QVariant> m_requestedParameters; -}; - -#endif // MOCKCAMERAEXPOSURECONTROL_H diff --git a/tests/auto/unit/qmultimedia_common/mockcameraflashcontrol.h b/tests/auto/unit/qmultimedia_common/mockcameraflashcontrol.h deleted file mode 100644 index 96e2ebc52..000000000 --- a/tests/auto/unit/qmultimedia_common/mockcameraflashcontrol.h +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 MOCKCAMERAFLASHCONTROL_H -#define MOCKCAMERAFLASHCONTROL_H - -#include "qcameraflashcontrol.h" - -class MockCameraFlashControl : public QCameraFlashControl -{ - Q_OBJECT -public: - MockCameraFlashControl(QObject *parent = 0): - QCameraFlashControl(parent), - m_flashMode(QCameraExposure::FlashAuto) - { - } - - ~MockCameraFlashControl() {} - - QCameraExposure::FlashModes flashMode() const - { - return m_flashMode; - } - - void setFlashMode(QCameraExposure::FlashModes mode) - { - if (isFlashModeSupported(mode)) { - m_flashMode = mode; - } - emit flashReady(true); - } - //Setting the values for Flash mode - - bool isFlashModeSupported(QCameraExposure::FlashModes mode) const - { - return (mode & (QCameraExposure::FlashAuto | QCameraExposure::FlashOff | QCameraExposure::FlashOn | - QCameraExposure::FlashFill |QCameraExposure::FlashTorch |QCameraExposure::FlashSlowSyncFrontCurtain | - QCameraExposure::FlashRedEyeReduction)); - } - - bool isFlashReady() const - { - return true; - } - -private: - QCameraExposure::FlashModes m_flashMode; -}; - -#endif // MOCKCAMERAFLASHCONTROL_H diff --git a/tests/auto/unit/qmultimedia_common/mockcamerafocuscontrol.h b/tests/auto/unit/qmultimedia_common/mockcamerafocuscontrol.h deleted file mode 100644 index 579f70f20..000000000 --- a/tests/auto/unit/qmultimedia_common/mockcamerafocuscontrol.h +++ /dev/null @@ -1,124 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 MOCKCAMERAFOCUSCONTROL_H -#define MOCKCAMERAFOCUSCONTROL_H - -#include "qcamerafocuscontrol.h" -#include "qcamerafocus.h" - -class MockCameraFocusControl : public QCameraFocusControl -{ - Q_OBJECT -public: - MockCameraFocusControl(QObject *parent = 0): - QCameraFocusControl(parent), - m_focusMode(QCameraFocus::AutoFocus), - m_focusPointMode(QCameraFocus::FocusPointAuto), - m_focusPoint(0.5, 0.5) - { - m_zones << QCameraFocusZone(QRectF(0.45, 0.45, 0.1, 0.1)); - } - - ~MockCameraFocusControl() {} - - QCameraFocus::FocusModes focusMode() const - { - return m_focusMode; - } - - void setFocusMode(QCameraFocus::FocusModes mode) - { - if (isFocusModeSupported(mode)) - m_focusMode = mode; - } - - bool isFocusModeSupported(QCameraFocus::FocusModes mode) const - { - return mode == QCameraFocus::AutoFocus || mode == QCameraFocus::ContinuousFocus; - } - - QCameraFocus::FocusPointMode focusPointMode() const - { - return m_focusPointMode; - } - - void setFocusPointMode(QCameraFocus::FocusPointMode mode) - { - if (isFocusPointModeSupported(mode)) - m_focusPointMode = mode; - } - - bool isFocusPointModeSupported(QCameraFocus::FocusPointMode mode) const - { - switch (mode) { - case QCameraFocus::FocusPointAuto: - case QCameraFocus::FocusPointCenter: - case QCameraFocus::FocusPointCustom: - return true; - default: - return false; - } - } - - QPointF customFocusPoint() const - { - return m_focusPoint; - } - - void setCustomFocusPoint(const QPointF &point) - { - m_focusPoint = point; - focusZonesChange(0.50, 0.50, 0.3, 0.3); - } - - QCameraFocusZoneList focusZones() const - { - return m_zones; - } - - // helper function to emit Focus Zones Changed signals - void focusZonesChange(qreal left, qreal top, qreal width, qreal height) - { - QCameraFocusZone myZone(QRectF(left, top, width, height)); - if (m_zones.last().area() != myZone.area()) { - m_zones.clear(); - m_zones << myZone; - emit focusZonesChanged(); - } - } - -private: - QCameraFocus::FocusModes m_focusMode; - QCameraFocus::FocusPointMode m_focusPointMode; - QPointF m_focusPoint; - // to emit focus zone changed signal - QCameraFocusZoneList m_zones; -}; - -#endif // MOCKCAMERAFOCUSCONTROL_H diff --git a/tests/auto/unit/qmultimedia_common/mockcameraimagecapturecontrol.h b/tests/auto/unit/qmultimedia_common/mockcameraimagecapturecontrol.h deleted file mode 100644 index 6aa793a24..000000000 --- a/tests/auto/unit/qmultimedia_common/mockcameraimagecapturecontrol.h +++ /dev/null @@ -1,118 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 MOCKCAMERACAPTURECONTROL_H -#define MOCKCAMERACAPTURECONTROL_H - -#include <QDateTime> -#include <QTimer> -#include <QtMultimedia/qmediametadata.h> - -#include "qcameraimagecapturecontrol.h" -#include "qcameracontrol.h" -#include "mockcameracontrol.h" - -class MockCaptureControl : public QCameraImageCaptureControl -{ - Q_OBJECT -public: - MockCaptureControl(MockCameraControl *cameraControl, QObject *parent = 0) - : QCameraImageCaptureControl(parent), m_cameraControl(cameraControl), m_captureRequest(0), m_ready(true), m_captureCanceled(false) - { - } - - ~MockCaptureControl() - { - } - - QCameraImageCapture::DriveMode driveMode() const { return QCameraImageCapture::SingleImageCapture; } - void setDriveMode(QCameraImageCapture::DriveMode) {} - - bool isReadyForCapture() const { return m_ready && m_cameraControl->state() == QCamera::ActiveState; } - - int capture(const QString &fileName) - { - if (isReadyForCapture()) { - m_fileName = fileName; - m_captureRequest++; - emit readyForCaptureChanged(m_ready = false); - QTimer::singleShot(5, this, SLOT(captured())); - return m_captureRequest; - } else { - emit error(-1, QCameraImageCapture::NotReadyError, - QLatin1String("Could not capture in stopped state")); - } - - return -1; - } - - void cancelCapture() - { - m_captureCanceled = true; - } - -private Q_SLOTS: - void captured() - { - if (!m_captureCanceled) { - emit imageCaptured(m_captureRequest, QImage()); - - emit imageMetadataAvailable(m_captureRequest, - QMediaMetaData::FocalLengthIn35mmFilm, - QVariant(50)); - - emit imageMetadataAvailable(m_captureRequest, - QMediaMetaData::DateTimeOriginal, - QVariant(QDateTime::currentDateTime())); - - emit imageMetadataAvailable(m_captureRequest, - QLatin1String("Answer to the Ultimate Question of Life, the Universe, and Everything"), - QVariant(42)); - } - - if (!m_ready) - { - emit readyForCaptureChanged(m_ready = true); - emit imageExposed(m_captureRequest); - } - - if (!m_captureCanceled) - emit imageSaved(m_captureRequest, m_fileName); - - m_captureCanceled = false; - } - -private: - MockCameraControl *m_cameraControl; - QString m_fileName; - int m_captureRequest; - bool m_ready; - bool m_captureCanceled; -}; - -#endif // MOCKCAMERACAPTURECONTROL_H diff --git a/tests/auto/unit/qmultimedia_common/mockcameraimageprocessingcontrol.h b/tests/auto/unit/qmultimedia_common/mockcameraimageprocessingcontrol.h deleted file mode 100644 index 6f315c69e..000000000 --- a/tests/auto/unit/qmultimedia_common/mockcameraimageprocessingcontrol.h +++ /dev/null @@ -1,150 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 MOCKCAMERAIMAGEPROCESSINGCONTROL_H -#define MOCKCAMERAIMAGEPROCESSINGCONTROL_H - -#include "qcameraimageprocessingcontrol.h" - -class MockImageProcessingControl : public QCameraImageProcessingControl -{ - Q_OBJECT -public: - MockImageProcessingControl(QObject *parent = 0) - : QCameraImageProcessingControl(parent) - { - m_supportedWhiteBalance.insert(QCameraImageProcessing::WhiteBalanceAuto); - } - - QCameraImageProcessing::WhiteBalanceMode whiteBalanceMode() const - { - return m_whiteBalanceMode; - } - void setWhiteBalanceMode(QCameraImageProcessing::WhiteBalanceMode mode) - { - m_whiteBalanceMode = mode; - } - - bool isWhiteBalanceModeSupported(QCameraImageProcessing::WhiteBalanceMode mode) const - { - return m_supportedWhiteBalance.contains(mode); - } - - void setSupportedWhiteBalanceModes(QSet<QCameraImageProcessing::WhiteBalanceMode> modes) - { - m_supportedWhiteBalance = modes; - } - - bool isParameterSupported(ProcessingParameter parameter) const - { - switch (parameter) - { - case ContrastAdjustment: - case BrightnessAdjustment: - case SharpeningAdjustment: - case SaturationAdjustment: - case DenoisingAdjustment: - case ColorTemperature: - case WhiteBalancePreset: - return true; - default : - return false; - } - } - - bool isParameterValueSupported(ProcessingParameter parameter, const QVariant &value) const - { - if (parameter != WhiteBalancePreset) - return false; - - return m_supportedWhiteBalance.contains(value.value<QCameraImageProcessing::WhiteBalanceMode>()); - } - - QVariant parameter(ProcessingParameter parameter) const - { - switch (parameter) { - case ContrastAdjustment: - return m_contrast; - case SaturationAdjustment: - return m_saturation; - case BrightnessAdjustment: - return m_brightness; - case SharpeningAdjustment: - return m_sharpeningLevel; - case DenoisingAdjustment: - return m_denoising; - case ColorTemperature: - return m_manualWhiteBalance; - case WhiteBalancePreset: - return QVariant::fromValue<QCameraImageProcessing::WhiteBalanceMode>(m_whiteBalanceMode); - default: - return QVariant(); - } - } - void setParameter(ProcessingParameter parameter, const QVariant &value) - { - switch (parameter) { - case ContrastAdjustment: - m_contrast = value; - break; - case SaturationAdjustment: - m_saturation = value; - break; - case BrightnessAdjustment: - m_brightness = value; - break; - case SharpeningAdjustment: - m_sharpeningLevel = value; - break; - case DenoisingAdjustment: - m_denoising = value; - break; - case ColorTemperature: - m_manualWhiteBalance = value; - break; - case WhiteBalancePreset: - m_whiteBalanceMode = value.value<QCameraImageProcessing::WhiteBalanceMode>(); - break; - default: - break; - } - } - - -private: - QCameraImageProcessing::WhiteBalanceMode m_whiteBalanceMode; - QSet<QCameraImageProcessing::WhiteBalanceMode> m_supportedWhiteBalance; - QVariant m_manualWhiteBalance; - QVariant m_contrast; - QVariant m_sharpeningLevel; - QVariant m_saturation; - QVariant m_brightness; - QVariant m_denoising; -}; - -#endif // MOCKCAMERAIMAGEPROCESSINGCONTROL_H diff --git a/tests/auto/unit/qmultimedia_common/mockcamerainfocontrol.h b/tests/auto/unit/qmultimedia_common/mockcamerainfocontrol.h deleted file mode 100644 index 359bb7a5c..000000000 --- a/tests/auto/unit/qmultimedia_common/mockcamerainfocontrol.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 MOCKCAMERAINFOCONTROL_H -#define MOCKCAMERAINFOCONTROL_H - -#include <qcamerainfocontrol.h> - -class MockCameraInfoControl : public QCameraInfoControl -{ - Q_OBJECT -public: - MockCameraInfoControl(QObject *parent) - : QCameraInfoControl(parent) - { - } - - ~MockCameraInfoControl() { } - - QCamera::Position cameraPosition(const QString &deviceName) const - { - return position(deviceName.toLatin1()); - } - - int cameraOrientation(const QString &deviceName) const - { - return orientation(deviceName.toLatin1()); - } - - static QCamera::Position position(const QByteArray &camera) - { - if (camera == "backcamera") - return QCamera::BackFace; - else - return QCamera::UnspecifiedPosition; - } - - static int orientation(const QByteArray &camera) - { - if (camera == "backcamera") - return 90; - else - return 0; - } -}; - -#endif // MOCKCAMERAINFOCONTROL_H diff --git a/tests/auto/unit/qmultimedia_common/mockcameralockscontrol.h b/tests/auto/unit/qmultimedia_common/mockcameralockscontrol.h deleted file mode 100644 index a520ad055..000000000 --- a/tests/auto/unit/qmultimedia_common/mockcameralockscontrol.h +++ /dev/null @@ -1,131 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 MOCKCAMERALOCKCONTROL_H -#define MOCKCAMERALOCKCONTROL_H - -#include <QTimer> -#include "qcameralockscontrol.h" - -class MockCameraLocksControl : public QCameraLocksControl -{ - Q_OBJECT -public: - MockCameraLocksControl(QObject *parent = 0): - QCameraLocksControl(parent), - m_focusLock(QCamera::Unlocked), - m_exposureLock(QCamera::Unlocked) - { - } - - ~MockCameraLocksControl() {} - - QCamera::LockTypes supportedLocks() const - { - return QCamera::LockExposure | QCamera::LockFocus; - } - - QCamera::LockStatus lockStatus(QCamera::LockType lock) const - { - switch (lock) { - case QCamera::LockExposure: - return m_exposureLock; - case QCamera::LockFocus: - return m_focusLock; - default: - return QCamera::Unlocked; - } - } - - void searchAndLock(QCamera::LockTypes locks) - { - if (locks & QCamera::LockExposure) { - QCamera::LockStatus newStatus = locks & QCamera::LockFocus ? QCamera::Searching : QCamera::Locked; - - if (newStatus != m_exposureLock) - emit lockStatusChanged(QCamera::LockExposure, - m_exposureLock = newStatus, - QCamera::UserRequest); - } - - if (locks & QCamera::LockFocus) { - emit lockStatusChanged(QCamera::LockFocus, - m_focusLock = QCamera::Searching, - QCamera::UserRequest); - - QTimer::singleShot(5, this, SLOT(focused())); - } - } - - void unlock(QCamera::LockTypes locks) { - if (locks & QCamera::LockFocus && m_focusLock != QCamera::Unlocked) { - emit lockStatusChanged(QCamera::LockFocus, - m_focusLock = QCamera::Unlocked, - QCamera::UserRequest); - } - - if (locks & QCamera::LockExposure && m_exposureLock != QCamera::Unlocked) { - emit lockStatusChanged(QCamera::LockExposure, - m_exposureLock = QCamera::Unlocked, - QCamera::UserRequest); - } - } - - /* helper method to emit the signal with LockChangeReason */ - void setLockChangeReason (QCamera::LockChangeReason lockChangeReason) - { - emit lockStatusChanged(QCamera::NoLock, - QCamera::Unlocked, - lockChangeReason); - - } - -private slots: - void focused() - { - if (m_focusLock == QCamera::Searching) { - emit lockStatusChanged(QCamera::LockFocus, - m_focusLock = QCamera::Locked, - QCamera::UserRequest); - } - - if (m_exposureLock == QCamera::Searching) { - emit lockStatusChanged(QCamera::LockExposure, - m_exposureLock = QCamera::Locked, - QCamera::UserRequest); - } - } - - -private: - QCamera::LockStatus m_focusLock; - QCamera::LockStatus m_exposureLock; -}; - - -#endif // MOCKCAMERALOCKCONTROL_H diff --git a/tests/auto/unit/qmultimedia_common/mockcameraservice.h b/tests/auto/unit/qmultimedia_common/mockcameraservice.h deleted file mode 100644 index d6612ddc3..000000000 --- a/tests/auto/unit/qmultimedia_common/mockcameraservice.h +++ /dev/null @@ -1,198 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 MOCKCAMERASERVICE_H -#define MOCKCAMERASERVICE_H - -#include "qmediaservice.h" -#include "../qmultimedia_common/mockcameraflashcontrol.h" -#include "../qmultimedia_common/mockcameralockscontrol.h" -#include "../qmultimedia_common/mockcamerafocuscontrol.h" -#include "../qmultimedia_common/mockcamerazoomcontrol.h" -#include "../qmultimedia_common/mockcameraimageprocessingcontrol.h" -#include "../qmultimedia_common/mockcameraimagecapturecontrol.h" -#include "../qmultimedia_common/mockcameraexposurecontrol.h" -#include "../qmultimedia_common/mockcameracapturedestinationcontrol.h" -#include "../qmultimedia_common/mockcameracapturebuffercontrol.h" -#include "../qmultimedia_common/mockimageencodercontrol.h" -#include "../qmultimedia_common/mockcameracontrol.h" -#include "../qmultimedia_common/mockvideosurface.h" -#include "../qmultimedia_common/mockvideorenderercontrol.h" -#include "../qmultimedia_common/mockvideowindowcontrol.h" -#include "../qmultimedia_common/mockvideodeviceselectorcontrol.h" -#include "../qmultimedia_common/mockcamerainfocontrol.h" -#include "../qmultimedia_common/mockcameraviewfindersettingscontrol.h" - -class MockSimpleCameraService : public QMediaService -{ - Q_OBJECT - -public: - MockSimpleCameraService(): QMediaService(0) - { - mockControl = new MockCameraControl(this); - } - - ~MockSimpleCameraService() - { - } - - QMediaControl* requestControl(const char *iid) - { - if (qstrcmp(iid, QCameraControl_iid) == 0) - return mockControl; - return 0; - } - - void releaseControl(QMediaControl*) {} - - MockCameraControl *mockControl; -}; - - -class MockCameraService : public QMediaService -{ - Q_OBJECT - -public: - MockCameraService(): QMediaService(0) - { - mockControl = new MockCameraControl(this); - mockLocksControl = new MockCameraLocksControl(this); - mockExposureControl = new MockCameraExposureControl(this); - mockFlashControl = new MockCameraFlashControl(this); - mockFocusControl = new MockCameraFocusControl(this); - mockZoomControl = new MockCameraZoomControl(this); - mockCaptureControl = new MockCaptureControl(mockControl, this); - mockCaptureBufferControl = new MockCaptureBufferFormatControl(this); - mockCaptureDestinationControl = new MockCaptureDestinationControl(this); - mockImageProcessingControl = new MockImageProcessingControl(this); - mockImageEncoderControl = new MockImageEncoderControl(this); - rendererControl = new MockVideoRendererControl(this); - windowControl = new MockVideoWindowControl(this); - mockVideoDeviceSelectorControl = new MockVideoDeviceSelectorControl(this); - mockCameraInfoControl = new MockCameraInfoControl(this); - mockViewfinderSettingsControl = new MockCameraViewfinderSettingsControl(this); - rendererRef = 0; - windowRef = 0; - } - - ~MockCameraService() - { - } - - QMediaControl* requestControl(const char *iid) - { - if (qstrcmp(iid, QCameraControl_iid) == 0) - return mockControl; - - if (qstrcmp(iid, QCameraLocksControl_iid) == 0) - return mockLocksControl; - - if (qstrcmp(iid, QCameraExposureControl_iid) == 0) - return mockExposureControl; - - if (qstrcmp(iid, QCameraFlashControl_iid) == 0) - return mockFlashControl; - - if (qstrcmp(iid, QCameraFocusControl_iid) == 0) - return mockFocusControl; - - if (qstrcmp(iid, QCameraZoomControl_iid) == 0) - return mockZoomControl; - - if (qstrcmp(iid, QCameraImageCaptureControl_iid) == 0) - return mockCaptureControl; - - if (qstrcmp(iid, QCameraCaptureBufferFormatControl_iid) == 0) - return mockCaptureBufferControl; - - if (qstrcmp(iid, QCameraCaptureDestinationControl_iid) == 0) - return mockCaptureDestinationControl; - - if (qstrcmp(iid, QCameraImageProcessingControl_iid) == 0) - return mockImageProcessingControl; - - if (qstrcmp(iid, QImageEncoderControl_iid) == 0) - return mockImageEncoderControl; - - if (qstrcmp(iid, QVideoDeviceSelectorControl_iid) == 0) - return mockVideoDeviceSelectorControl; - - if (qstrcmp(iid, QCameraInfoControl_iid) == 0) - return mockCameraInfoControl; - - if (qstrcmp(iid, QVideoRendererControl_iid) == 0) { - if (rendererRef == 0) { - rendererRef += 1; - return rendererControl; - } - } - if (qstrcmp(iid, QVideoWindowControl_iid) == 0) { - if (windowRef == 0) { - windowRef += 1; - return windowControl; - } - } - - if (qstrcmp(iid, QCameraViewfinderSettingsControl2_iid) == 0) { - return mockViewfinderSettingsControl; - } - - return 0; - } - - void releaseControl(QMediaControl *control) - { - if (control == rendererControl) - rendererRef -= 1; - if (control == windowControl) - windowRef -= 1; - } - - MockCameraControl *mockControl; - MockCameraLocksControl *mockLocksControl; - MockCaptureControl *mockCaptureControl; - MockCaptureBufferFormatControl *mockCaptureBufferControl; - MockCaptureDestinationControl *mockCaptureDestinationControl; - MockCameraExposureControl *mockExposureControl; - MockCameraFlashControl *mockFlashControl; - MockCameraFocusControl *mockFocusControl; - MockCameraZoomControl *mockZoomControl; - MockImageProcessingControl *mockImageProcessingControl; - MockImageEncoderControl *mockImageEncoderControl; - MockVideoRendererControl *rendererControl; - MockVideoWindowControl *windowControl; - MockVideoDeviceSelectorControl *mockVideoDeviceSelectorControl; - MockCameraInfoControl *mockCameraInfoControl; - MockCameraViewfinderSettingsControl *mockViewfinderSettingsControl; - int rendererRef; - int windowRef; -}; - -#endif // MOCKCAMERASERVICE_H diff --git a/tests/auto/unit/qmultimedia_common/mockcameraviewfindersettingscontrol.h b/tests/auto/unit/qmultimedia_common/mockcameraviewfindersettingscontrol.h deleted file mode 100644 index 88b717ed1..000000000 --- a/tests/auto/unit/qmultimedia_common/mockcameraviewfindersettingscontrol.h +++ /dev/null @@ -1,106 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 MOCKCAMERAVIEWFINDERSETTINGSCONTROL_H -#define MOCKCAMERAVIEWFINDERSETTINGSCONTROL_H - -#include "qcameraviewfindersettingscontrol.h" - -class MockCameraViewfinderSettingsControl : public QCameraViewfinderSettingsControl2 -{ - Q_OBJECT -public: - MockCameraViewfinderSettingsControl(QObject *parent = 0): - QCameraViewfinderSettingsControl2(parent) - { - QCameraViewfinderSettings s; - s.setResolution(640, 480); - s.setMinimumFrameRate(30); - s.setMaximumFrameRate(30); - s.setPixelFormat(QVideoFrame::Format_NV12); - s.setPixelAspectRatio(1, 1); - supportedSettings.append(s); - - s.setResolution(1280, 720); - s.setMinimumFrameRate(10); - s.setMaximumFrameRate(10); - s.setPixelFormat(QVideoFrame::Format_NV12); - s.setPixelAspectRatio(1, 1); - supportedSettings.append(s); - - s.setResolution(1920, 1080); - s.setMinimumFrameRate(5); - s.setMaximumFrameRate(10); - s.setPixelFormat(QVideoFrame::Format_BGR32); - s.setPixelAspectRatio(2, 1); - supportedSettings.append(s); - - s.setResolution(1280, 720); - s.setMinimumFrameRate(10); - s.setMaximumFrameRate(10); - s.setPixelFormat(QVideoFrame::Format_YV12); - s.setPixelAspectRatio(1, 1); - supportedSettings.append(s); - - s.setResolution(1280, 720); - s.setMinimumFrameRate(30); - s.setMaximumFrameRate(30); - s.setPixelFormat(QVideoFrame::Format_YV12); - s.setPixelAspectRatio(1, 1); - supportedSettings.append(s); - - s.setResolution(320, 240); - s.setMinimumFrameRate(30); - s.setMaximumFrameRate(30); - s.setPixelFormat(QVideoFrame::Format_NV12); - s.setPixelAspectRatio(1, 1); - supportedSettings.append(s); - } - - ~MockCameraViewfinderSettingsControl() {} - - QCameraViewfinderSettings viewfinderSettings() const - { - return settings; - } - - void setViewfinderSettings(const QCameraViewfinderSettings &s) - { - settings = s; - } - - QList<QCameraViewfinderSettings> supportedViewfinderSettings() const - { - return supportedSettings; - } - - QCameraViewfinderSettings settings; - QList<QCameraViewfinderSettings> supportedSettings; -}; - -#endif // MOCKCAMERAVIEWFINDERSETTINGSCONTROL_H diff --git a/tests/auto/unit/qmultimedia_common/mockcamerazoomcontrol.h b/tests/auto/unit/qmultimedia_common/mockcamerazoomcontrol.h deleted file mode 100644 index 9a56fd2cd..000000000 --- a/tests/auto/unit/qmultimedia_common/mockcamerazoomcontrol.h +++ /dev/null @@ -1,121 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 MOCKCAMERAZOOMCONTROL_H -#define MOCKCAMERAZOOMCONTROL_H - -#include "qcamerazoomcontrol.h" - -class MockCameraZoomControl : public QCameraZoomControl -{ - Q_OBJECT -public: - MockCameraZoomControl(QObject *parent = 0): - QCameraZoomControl(parent), - m_opticalZoom(1.0), - m_digitalZoom(1.0), - m_maxOpticalZoom(3.0), - m_maxDigitalZoom(4.0) - - { - } - - ~MockCameraZoomControl() {} - - qreal maximumOpticalZoom() const - { - return m_maxOpticalZoom; - } - - qreal maximumDigitalZoom() const - { - return m_maxDigitalZoom; - } - - qreal currentOpticalZoom() const - { - return m_opticalZoom; - } - - qreal currentDigitalZoom() const - { - return m_digitalZoom; - } - - qreal requestedOpticalZoom() const - { - return m_opticalZoom; - } - - qreal requestedDigitalZoom() const - { - return m_digitalZoom; - } - - void zoomTo(qreal optical, qreal digital) - { - optical = qBound<qreal>(1.0, optical, maximumOpticalZoom()); - digital = qBound<qreal>(1.0, digital, maximumDigitalZoom()); - - if (!qFuzzyCompare(digital, m_digitalZoom)) { - m_digitalZoom = digital; - emit requestedDigitalZoomChanged(m_digitalZoom); - emit currentDigitalZoomChanged(m_digitalZoom); - } - - if (!qFuzzyCompare(optical, m_opticalZoom)) { - m_opticalZoom = optical; - emit requestedOpticalZoomChanged(m_opticalZoom); - emit currentOpticalZoomChanged(m_opticalZoom); - } - - maxOpticalDigitalZoomChange(4.0, 5.0); - } - - // helper function to emit maximum Optical and Digital Zoom Changed signals - void maxOpticalDigitalZoomChange(qreal maxOptical, qreal maxDigital) - { - if (maxOptical != m_maxOpticalZoom) { - m_maxOpticalZoom = maxOptical; - emit maximumOpticalZoomChanged(m_maxOpticalZoom); - } - - if (maxDigital != m_maxDigitalZoom) { - m_maxDigitalZoom = maxDigital; - emit maximumDigitalZoomChanged(m_maxDigitalZoom); - } - } - -private: - qreal m_opticalZoom; - qreal m_digitalZoom; - qreal m_maxOpticalZoom; - qreal m_maxDigitalZoom; -}; - -#endif // MOCKCAMERAZOOMCONTROL_H diff --git a/tests/auto/unit/qmultimedia_common/mockcontainer.pri b/tests/auto/unit/qmultimedia_common/mockcontainer.pri deleted file mode 100644 index e4a345adb..000000000 --- a/tests/auto/unit/qmultimedia_common/mockcontainer.pri +++ /dev/null @@ -1,7 +0,0 @@ -INCLUDEPATH *= $$PWD \ - ../../../src/multimedia \ - -HEADERS *= \ - ../qmultimedia_common/mockmediacontainercontrol.h \ - ../qmultimedia_common/mockmetadatawritercontrol.h \ - ../qmultimedia_common/mockmetadatareadercontrol.h diff --git a/tests/auto/unit/qmultimedia_common/mockcustomaudiorolecontrol.h b/tests/auto/unit/qmultimedia_common/mockcustomaudiorolecontrol.h deleted file mode 100644 index f4031bb04..000000000 --- a/tests/auto/unit/qmultimedia_common/mockcustomaudiorolecontrol.h +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 QNX Software Systems. All rights reserved. -** 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 MOCKCUSTOMAUDIOROLECONTROL_H -#define MOCKCUSTOMAUDIOROLECONTROL_H - -#include <qcustomaudiorolecontrol.h> - -class MockCustomAudioRoleControl : public QCustomAudioRoleControl -{ - friend class MockMediaPlayerService; - -public: - MockCustomAudioRoleControl() - : QCustomAudioRoleControl() - , m_customAudioRole(QAudio::UnknownRole) - { - } - - QString customAudioRole() const - { - return m_customAudioRole; - } - - void setCustomAudioRole(const QString &role) - { - if (role != m_customAudioRole) - emit customAudioRoleChanged(m_customAudioRole = role); - } - - QStringList supportedCustomAudioRoles() const - { - return QStringList() << QStringLiteral("customRole") - << QStringLiteral("customRole2"); - } - - QString m_customAudioRole; -}; - -#endif // MOCKCUSTOMAUDIOROLECONTROL_H diff --git a/tests/auto/unit/qmultimedia_common/mockdecoder.pri b/tests/auto/unit/qmultimedia_common/mockdecoder.pri deleted file mode 100644 index 8b486e475..000000000 --- a/tests/auto/unit/qmultimedia_common/mockdecoder.pri +++ /dev/null @@ -1,9 +0,0 @@ -# Audio decoder related mock backend files -INCLUDEPATH += $$PWD \ - ../../../src/multimedia \ - ../../../src/multimedia/audio \ - ../../../src/multimedia/controls - -HEADERS *= \ - ../qmultimedia_common/mockaudiodecoderservice.h \ - ../qmultimedia_common/mockaudiodecodercontrol.h diff --git a/tests/auto/unit/qmultimedia_common/mockimageencodercontrol.h b/tests/auto/unit/qmultimedia_common/mockimageencodercontrol.h deleted file mode 100644 index f03e15959..000000000 --- a/tests/auto/unit/qmultimedia_common/mockimageencodercontrol.h +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 MOCKIMAGEENCODERCONTROL_H -#define MOCKIMAGEENCODERCONTROL_H - -#include "qimageencodercontrol.h" - -class MockImageEncoderControl : public QImageEncoderControl -{ -public: - MockImageEncoderControl(QObject *parent = 0) - : QImageEncoderControl(parent) - { - m_settings = QImageEncoderSettings(); - } - - QList<QSize> supportedResolutions(const QImageEncoderSettings & settings = QImageEncoderSettings(), - bool *continuous = 0) const - { - if (continuous) - *continuous = true; - - QList<QSize> resolutions; - if (settings.resolution().isValid()) { - if (settings.resolution() == QSize(160,160) || - settings.resolution() == QSize(320,240)) - resolutions << settings.resolution(); - - if (settings.quality() == QMultimedia::HighQuality && settings.resolution() == QSize(640,480)) - resolutions << settings.resolution(); - } else { - resolutions << QSize(160, 120); - resolutions << QSize(320, 240); - if (settings.quality() == QMultimedia::HighQuality) - resolutions << QSize(640, 480); - } - - return resolutions; - } - - QStringList supportedImageCodecs() const - { - QStringList codecs; - codecs << "PNG" << "JPEG"; - return codecs; - } - - QString imageCodecDescription(const QString &codecName) const { - if (codecName == "PNG") - return QString("Portable Network Graphic"); - if (codecName == "JPEG") - return QString("Joint Photographic Expert Group"); - return QString(); - } - - QImageEncoderSettings imageSettings() const { return m_settings; } - void setImageSettings(const QImageEncoderSettings &settings) { m_settings = settings; } - -private: - QImageEncoderSettings m_settings; -}; - - -#endif // MOCKIMAGEENCODERCONTROL_H diff --git a/tests/auto/unit/qmultimedia_common/mockmediacontainercontrol.h b/tests/auto/unit/qmultimedia_common/mockmediacontainercontrol.h deleted file mode 100644 index 08562a469..000000000 --- a/tests/auto/unit/qmultimedia_common/mockmediacontainercontrol.h +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 MOCKMEDIACONTAINERCONTROL_H -#define MOCKMEDIACONTAINERCONTROL_H - -#include <QObject> -#include "qmediacontainercontrol.h" -#include <QMap> -#include <QString> -#include <QStringList> - -QT_USE_NAMESPACE -class MockMediaContainerControl : public QMediaContainerControl -{ - Q_OBJECT -public: - MockMediaContainerControl(QObject *parent): - QMediaContainerControl(parent) - { - m_supportedContainers.append("wav"); - m_supportedContainers.append("mp3"); - m_supportedContainers.append("mov"); - - m_descriptions.insert("wav", "WAV format"); - m_descriptions.insert("mp3", "MP3 format"); - m_descriptions.insert("mov", "MOV format"); - } - - virtual ~MockMediaContainerControl() {}; - - QStringList supportedContainers() const - { - return m_supportedContainers; - } - - QString containerFormat() const - { - return m_format; - } - - void setContainerFormat(const QString &formatMimeType) - { - if (m_supportedContainers.contains(formatMimeType)) - m_format = formatMimeType; - } - - QString containerDescription(const QString &formatMimeType) const - { - return m_descriptions.value(formatMimeType); - } - -private: - QStringList m_supportedContainers; - QMap<QString, QString> m_descriptions; - QString m_format; -}; - -#endif // MOCKMEDIACONTAINERCONTROL_H diff --git a/tests/auto/unit/qmultimedia_common/mockmediaobject.h b/tests/auto/unit/qmultimedia_common/mockmediaobject.h deleted file mode 100644 index 021cf9be8..000000000 --- a/tests/auto/unit/qmultimedia_common/mockmediaobject.h +++ /dev/null @@ -1,44 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 MOCKMEDIAOBJECT_H -#define MOCKMEDIAOBJECT_H - -#include "qmediaobject.h" - -class MockMediaObject : public QMediaObject -{ - Q_OBJECT -public: - MockMediaObject(QObject *parent, QMediaService *service): - QMediaObject(parent, service) - { - } -}; - -#endif // MOCKMEDIAOBJECT_H diff --git a/tests/auto/unit/qmultimedia_common/mockmediaplayercontrol.h b/tests/auto/unit/qmultimedia_common/mockmediaplayercontrol.h deleted file mode 100644 index 1c93bbbbf..000000000 --- a/tests/auto/unit/qmultimedia_common/mockmediaplayercontrol.h +++ /dev/null @@ -1,120 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 MOCKMEDIAPLAYERCONTROL_H -#define MOCKMEDIAPLAYERCONTROL_H - -#include "qmediaplayercontrol.h" - -class MockMediaPlayerControl : public QMediaPlayerControl -{ - friend class MockMediaPlayerService; - -public: - MockMediaPlayerControl() - : QMediaPlayerControl(0) - , _state(QMediaPlayer::StoppedState) - , _mediaStatus(QMediaPlayer::NoMedia) - , _error(QMediaPlayer::NoError) - , _duration(0) - , _position(0) - , _volume(100) - , _muted(false) - , _bufferStatus(0) - , _audioAvailable(false) - , _videoAvailable(false) - , _isSeekable(true) - , _playbackRate(qreal(1.0)) - , _stream(0) - , _isValid(false) - {} - - QMediaPlayer::State state() const { return _state; } - QMediaPlayer::MediaStatus mediaStatus() const { return _mediaStatus; } - - qint64 duration() const { return _duration; } - - qint64 position() const { return _position; } - - void setPosition(qint64 position) { if (position != _position) emit positionChanged(_position = position); } - - int volume() const { return _volume; } - void setVolume(int volume) { emit volumeChanged(_volume = volume); } - - bool isMuted() const { return _muted; } - void setMuted(bool muted) { if (muted != _muted) emit mutedChanged(_muted = muted); } - - int bufferStatus() const { return _bufferStatus; } - - bool isAudioAvailable() const { return _audioAvailable; } - bool isVideoAvailable() const { return _videoAvailable; } - - bool isSeekable() const { return _isSeekable; } - QMediaTimeRange availablePlaybackRanges() const { return QMediaTimeRange(_seekRange.first, _seekRange.second); } - void setSeekRange(qint64 minimum, qint64 maximum) { _seekRange = qMakePair(minimum, maximum); } - - qreal playbackRate() const { return _playbackRate; } - void setPlaybackRate(qreal rate) { if (rate != _playbackRate) emit playbackRateChanged(_playbackRate = rate); } - - QMediaContent media() const { return _media; } - void setMedia(const QMediaContent &content, QIODevice *stream) - { - _stream = stream; - _media = content; - _mediaStatus = _media.isNull() ? QMediaPlayer::NoMedia : QMediaPlayer::LoadingMedia; - if (_state != QMediaPlayer::StoppedState) - emit stateChanged(_state = QMediaPlayer::StoppedState); - emit mediaStatusChanged(_mediaStatus); - emit mediaChanged(_media = content); - } - QIODevice *mediaStream() const { return _stream; } - - void play() { if (_isValid && !_media.isNull() && _state != QMediaPlayer::PlayingState) emit stateChanged(_state = QMediaPlayer::PlayingState); } - void pause() { if (_isValid && !_media.isNull() && _state != QMediaPlayer::PausedState) emit stateChanged(_state = QMediaPlayer::PausedState); } - void stop() { if (_state != QMediaPlayer::StoppedState) emit stateChanged(_state = QMediaPlayer::StoppedState); } - - QMediaPlayer::State _state; - QMediaPlayer::MediaStatus _mediaStatus; - QMediaPlayer::Error _error; - qint64 _duration; - qint64 _position; - int _volume; - bool _muted; - int _bufferStatus; - bool _audioAvailable; - bool _videoAvailable; - bool _isSeekable; - QPair<qint64, qint64> _seekRange; - qreal _playbackRate; - QMediaContent _media; - QIODevice *_stream; - bool _isValid; - QString _errorString; -}; - -#endif // MOCKMEDIAPLAYERCONTROL_H diff --git a/tests/auto/unit/qmultimedia_common/mockmediaplayerservice.h b/tests/auto/unit/qmultimedia_common/mockmediaplayerservice.h deleted file mode 100644 index 62f9c542e..000000000 --- a/tests/auto/unit/qmultimedia_common/mockmediaplayerservice.h +++ /dev/null @@ -1,170 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 MOCKPLAYERSERVICE_H -#define MOCKPLAYERSERVICE_H - -#include "qmediaservice.h" - -#include "mockmediaplayercontrol.h" -#include "mockmediastreamscontrol.h" -#include "mockvideorenderercontrol.h" -#include "mockvideoprobecontrol.h" -#include "mockvideowindowcontrol.h" -#include "mockaudiorolecontrol.h" -#include "mockcustomaudiorolecontrol.h" - -class MockMediaPlayerService : public QMediaService -{ - Q_OBJECT - -public: - MockMediaPlayerService():QMediaService(0) - { - mockControl = new MockMediaPlayerControl; - mockAudioRoleControl = new MockAudioRoleControl; - mockCustomAudioRoleControl = new MockCustomAudioRoleControl; - mockStreamsControl = new MockStreamsControl; - rendererControl = new MockVideoRendererControl; - rendererRef = 0; - mockVideoProbeControl = new MockVideoProbeControl; - windowControl = new MockVideoWindowControl; - windowRef = 0; - enableAudioRole = true; - enableCustomAudioRole = true; - } - - ~MockMediaPlayerService() - { - delete mockControl; - delete mockAudioRoleControl; - delete mockCustomAudioRoleControl; - delete mockStreamsControl; - delete rendererControl; - delete mockVideoProbeControl; - delete windowControl; - } - - QMediaControl* requestControl(const char *iid) - { - if (qstrcmp(iid, QMediaPlayerControl_iid) == 0) { - return mockControl; - } else if (qstrcmp(iid, QVideoRendererControl_iid) == 0) { - if (rendererRef == 0) { - rendererRef += 1; - return rendererControl; - } - } else if (qstrcmp(iid, QMediaVideoProbeControl_iid) == 0) { - return mockVideoProbeControl; - } - if (qstrcmp(iid, QVideoWindowControl_iid) == 0) { - if (windowRef == 0) { - windowRef += 1; - return windowControl; - } - } else if (enableAudioRole && qstrcmp(iid, QAudioRoleControl_iid) == 0) { - return mockAudioRoleControl; - } else if (enableCustomAudioRole && qstrcmp(iid, QCustomAudioRoleControl_iid) == 0) { - return mockCustomAudioRoleControl; - } - - return 0; - } - - void releaseControl(QMediaControl *control) - { - if (control == rendererControl) - rendererRef -= 1; - if (control == windowControl) - windowRef -= 1; - } - - void setState(QMediaPlayer::State state) { emit mockControl->stateChanged(mockControl->_state = state); } - void setState(QMediaPlayer::State state, QMediaPlayer::MediaStatus status) { - mockControl->_state = state; - mockControl->_mediaStatus = status; - emit mockControl->mediaStatusChanged(status); - emit mockControl->stateChanged(state); - } - void setMediaStatus(QMediaPlayer::MediaStatus status) { emit mockControl->mediaStatusChanged(mockControl->_mediaStatus = status); } - void setIsValid(bool isValid) { mockControl->_isValid = isValid; } - void setMedia(QMediaContent media) { mockControl->_media = media; } - void setDuration(qint64 duration) { mockControl->_duration = duration; } - void setPosition(qint64 position) { mockControl->_position = position; } - void setSeekable(bool seekable) { mockControl->_isSeekable = seekable; } - void setVolume(int volume) { mockControl->_volume = volume; } - void setMuted(bool muted) { mockControl->_muted = muted; } - void setVideoAvailable(bool videoAvailable) { mockControl->_videoAvailable = videoAvailable; } - void setBufferStatus(int bufferStatus) { mockControl->_bufferStatus = bufferStatus; } - void setPlaybackRate(qreal playbackRate) { mockControl->_playbackRate = playbackRate; } - void setError(QMediaPlayer::Error error) { mockControl->_error = error; emit mockControl->error(mockControl->_error, mockControl->_errorString); } - void setErrorString(QString errorString) { mockControl->_errorString = errorString; emit mockControl->error(mockControl->_error, mockControl->_errorString); } - - void setHasAudioRole(bool enable) { enableAudioRole = enable; } - void setHasCustomAudioRole(bool enable) { enableCustomAudioRole = enable; } - - void reset() - { - mockControl->_state = QMediaPlayer::StoppedState; - mockControl->_mediaStatus = QMediaPlayer::UnknownMediaStatus; - mockControl->_error = QMediaPlayer::NoError; - mockControl->_duration = 0; - mockControl->_position = 0; - mockControl->_volume = 0; - mockControl->_muted = false; - mockControl->_bufferStatus = 0; - mockControl->_videoAvailable = false; - mockControl->_isSeekable = false; - mockControl->_playbackRate = 0.0; - mockControl->_media = QMediaContent(); - mockControl->_stream = 0; - mockControl->_isValid = false; - mockControl->_errorString = QString(); - - enableAudioRole = true; - mockAudioRoleControl->m_audioRole = QAudio::UnknownRole; - enableCustomAudioRole = true; - mockCustomAudioRoleControl->m_customAudioRole.clear(); - } - - MockMediaPlayerControl *mockControl; - MockAudioRoleControl *mockAudioRoleControl; - MockCustomAudioRoleControl *mockCustomAudioRoleControl; - MockStreamsControl *mockStreamsControl; - MockVideoRendererControl *rendererControl; - MockVideoProbeControl *mockVideoProbeControl; - MockVideoWindowControl *windowControl; - int windowRef; - int rendererRef; - bool enableAudioRole; - bool enableCustomAudioRole; -}; - - - -#endif // MOCKPLAYERSERVICE_H diff --git a/tests/auto/unit/qmultimedia_common/mockmediaplaylistcontrol.h b/tests/auto/unit/qmultimedia_common/mockmediaplaylistcontrol.h deleted file mode 100644 index cc56e9adb..000000000 --- a/tests/auto/unit/qmultimedia_common/mockmediaplaylistcontrol.h +++ /dev/null @@ -1,136 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 MOCKMEDIAPLAYLISTCONTROL_H -#define MOCKMEDIAPLAYLISTCONTROL_H - -#include <private/qmediaplaylistcontrol_p.h> -#include <private/qmediaplaylistnavigator_p.h> -#include <private/qmedianetworkplaylistprovider_p.h> - -#include "mockreadonlyplaylistprovider.h" - -class MockMediaPlaylistControl : public QMediaPlaylistControl -{ -public: - MockMediaPlaylistControl(bool readonly = false, QObject *parent = 0) - : QMediaPlaylistControl(parent) - , m_navigator(0) - , m_playlist(0) - , m_ownsProvider(false) - , m_readOnly(readonly) - { - reset(); - } - - ~MockMediaPlaylistControl() - { - } - - void reset() - { - delete m_navigator; - if (m_ownsProvider) - delete m_playlist; - - if (m_readOnly) - m_playlist = new MockReadOnlyPlaylistProvider(this); - else - m_playlist = new QMediaNetworkPlaylistProvider(this); - - m_ownsProvider = true; - m_navigator = new QMediaPlaylistNavigator(m_playlist, this); - } - - void setReadOnly(bool ro) - { - if (m_readOnly == ro) - return; - - m_readOnly = ro; - reset(); - } - - QMediaPlaylistProvider* playlistProvider() const { return m_playlist; } - bool setPlaylistProvider(QMediaPlaylistProvider *newProvider) - { - bool bMediaContentChanged = false; - int i = 0; - for (; i < playlistProvider()->mediaCount(); i++) { - if (playlistProvider()->media(i).request().url().toString() - != newProvider->media(i).request().url().toString()) { - bMediaContentChanged = true; - break; - } - } - - if (playlistProvider()->mediaCount() != newProvider->mediaCount() || bMediaContentChanged ) { - emit playlistProviderChanged(); - emit currentMediaChanged(newProvider->media(i)); - } - - if (m_ownsProvider) - delete m_playlist; - m_playlist = newProvider; - m_ownsProvider = false; - - m_navigator->setPlaylist(newProvider); - return true; - } - - int currentIndex() const { return m_navigator->currentIndex(); } - void setCurrentIndex(int position) - { - if (position != currentIndex()) - emit currentIndexChanged(position); - m_navigator->jump(position); - } - - int nextIndex(int steps) const { return m_navigator->nextIndex(steps); } - int previousIndex(int steps) const { return m_navigator->previousIndex(steps); } - - void next() { m_navigator->next(); } - void previous() { m_navigator->previous(); } - - QMediaPlaylist::PlaybackMode playbackMode() const { return m_navigator->playbackMode(); } - void setPlaybackMode(QMediaPlaylist::PlaybackMode mode) - { - if (playbackMode() != mode) - emit playbackModeChanged(mode); - - m_navigator->setPlaybackMode(mode); - } - -private: - QMediaPlaylistNavigator *m_navigator; - QMediaPlaylistProvider *m_playlist; - bool m_ownsProvider; - bool m_readOnly; -}; - -#endif // MOCKMEDIAPLAYLISTCONTROL_H diff --git a/tests/auto/unit/qmultimedia_common/mockmediaplaylistsourcecontrol.h b/tests/auto/unit/qmultimedia_common/mockmediaplaylistsourcecontrol.h deleted file mode 100644 index fb30e3c79..000000000 --- a/tests/auto/unit/qmultimedia_common/mockmediaplaylistsourcecontrol.h +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 MOCKMEDIAPLAYLISTSOURCECONTROL_H -#define MOCKMEDIAPLAYLISTSOURCECONTROL_H - -#include <private/qmediaplaylistsourcecontrol_p.h> - -class MockPlaylistSourceControl : public QMediaPlaylistSourceControl -{ - Q_OBJECT -public: - MockPlaylistSourceControl(QObject *parent) - : QMediaPlaylistSourceControl(parent), - m_playlist(0) - { - } - - ~MockPlaylistSourceControl() - { - } - - void setPlaylist(QMediaPlaylist *playlist) - { - m_playlist = playlist; - } - - QMediaPlaylist *playlist() const - { - return m_playlist; - } -private: - QMediaPlaylist *m_playlist; -}; - -#endif // MOCKMEDIAPLAYLISTSOURCECONTROL_H diff --git a/tests/auto/unit/qmultimedia_common/mockmediarecordercontrol.h b/tests/auto/unit/qmultimedia_common/mockmediarecordercontrol.h deleted file mode 100644 index 14fd313b6..000000000 --- a/tests/auto/unit/qmultimedia_common/mockmediarecordercontrol.h +++ /dev/null @@ -1,164 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 MOCKRECORDERCONTROL_H -#define MOCKRECORDERCONTROL_H - -#include <QUrl> - -#include "qmediarecordercontrol.h" - -class MockMediaRecorderControl : public QMediaRecorderControl -{ - Q_OBJECT - -public: - MockMediaRecorderControl(QObject *parent = 0): - QMediaRecorderControl(parent), - m_state(QMediaRecorder::StoppedState), - m_status(QMediaRecorder::LoadedStatus), - m_position(0), - m_muted(false), - m_volume(1.0), - m_settingAppliedCount(0) - { - } - - QUrl outputLocation() const - { - return m_sink; - } - - bool setOutputLocation(const QUrl &sink) - { - m_sink = sink; - return true; - } - - QMediaRecorder::State state() const - { - return m_state; - } - - QMediaRecorder::Status status() const - { - return m_status; - } - - qint64 duration() const - { - return m_position; - } - - bool isMuted() const - { - return m_muted; - } - - qreal volume() const - { - return m_volume; - } - - void applySettings() - { - m_settingAppliedCount++; - } - - using QMediaRecorderControl::error; - -public slots: - void record() - { - m_state = QMediaRecorder::RecordingState; - m_status = QMediaRecorder::RecordingStatus; - m_position=1; - emit stateChanged(m_state); - emit statusChanged(m_status); - emit durationChanged(m_position); - - QUrl actualLocation = m_sink.isEmpty() ? QUrl::fromLocalFile("default_name.mp4") : m_sink; - emit actualLocationChanged(actualLocation); - } - - void pause() - { - m_state = QMediaRecorder::PausedState; - m_status = QMediaRecorder::PausedStatus; - emit stateChanged(m_state); - emit statusChanged(m_status); - } - - void stop() - { - m_position=0; - m_state = QMediaRecorder::StoppedState; - m_status = QMediaRecorder::LoadedStatus; - emit stateChanged(m_state); - emit statusChanged(m_status); - } - - void setState(QMediaRecorder::State state) - { - switch (state) { - case QMediaRecorder::StoppedState: - stop(); - break; - case QMediaRecorder::PausedState: - pause(); - break; - case QMediaRecorder::RecordingState: - record(); - break; - } - } - - - void setMuted(bool muted) - { - if (m_muted != muted) - emit mutedChanged(m_muted = muted); - } - - void setVolume(qreal volume) - { - if (!qFuzzyCompare(m_volume, volume)) - emit volumeChanged(m_volume = volume); - } - -public: - QUrl m_sink; - QMediaRecorder::State m_state; - QMediaRecorder::Status m_status; - qint64 m_position; - bool m_muted; - qreal m_volume; - int m_settingAppliedCount; -}; - -#endif // MOCKRECORDERCONTROL_H diff --git a/tests/auto/unit/qmultimedia_common/mockmediarecorderservice.h b/tests/auto/unit/qmultimedia_common/mockmediarecorderservice.h deleted file mode 100644 index 2e02ce286..000000000 --- a/tests/auto/unit/qmultimedia_common/mockmediarecorderservice.h +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 MOCKSERVICE_H -#define MOCKSERVICE_H - -#include "qmediaservice.h" - -#include "mockaudioencodercontrol.h" -#include "mockmediarecordercontrol.h" -#include "mockvideoencodercontrol.h" -#include "mockaudioinputselector.h" -#include "mockmediacontainercontrol.h" -#include "mockmetadatawritercontrol.h" -#include "mockavailabilitycontrol.h" -#include "mockaudioprobecontrol.h" - -class MockMediaRecorderService : public QMediaService -{ - Q_OBJECT -public: - MockMediaRecorderService(QObject *parent = 0, QMediaControl *control = 0, MockAvailabilityControl *availability = 0): - QMediaService(parent), - mockControl(control), - mockAvailabilityControl(availability), - hasControls(true) - { - mockAudioInputSelector = new MockAudioInputSelector(this); - mockAudioEncoderControl = new MockAudioEncoderControl(this); - mockFormatControl = new MockMediaContainerControl(this); - mockVideoEncoderControl = new MockVideoEncoderControl(this); - mockMetaDataControl = new MockMetaDataWriterControl(this); - mockAudioProbeControl = new MockAudioProbeControl(this); - } - - QMediaControl* requestControl(const char *name) - { - if (hasControls && qstrcmp(name,QAudioEncoderSettingsControl_iid) == 0) - return mockAudioEncoderControl; - if (hasControls && qstrcmp(name,QAudioInputSelectorControl_iid) == 0) - return mockAudioInputSelector; - if (hasControls && qstrcmp(name,QMediaRecorderControl_iid) == 0) - return mockControl; - if (hasControls && qstrcmp(name,QMediaContainerControl_iid) == 0) - return mockFormatControl; - if (hasControls && qstrcmp(name,QVideoEncoderSettingsControl_iid) == 0) - return mockVideoEncoderControl; - if (hasControls && qstrcmp(name, QMetaDataWriterControl_iid) == 0) - return mockMetaDataControl; - if (hasControls && qstrcmp(name, QMediaAvailabilityControl_iid) == 0) - return mockAvailabilityControl; - if (hasControls && qstrcmp(name, QMediaAudioProbeControl_iid) == 0) - return mockAudioProbeControl; - - return 0; - } - - void releaseControl(QMediaControl*) - { - } - - QMediaControl *mockControl; - QAudioInputSelectorControl *mockAudioInputSelector; - QAudioEncoderSettingsControl *mockAudioEncoderControl; - QMediaContainerControl *mockFormatControl; - QVideoEncoderSettingsControl *mockVideoEncoderControl; - MockMetaDataWriterControl *mockMetaDataControl; - MockAvailabilityControl *mockAvailabilityControl; - MockAudioProbeControl *mockAudioProbeControl; - - bool hasControls; -}; - -#endif // MOCKSERVICE_H diff --git a/tests/auto/unit/qmultimedia_common/mockmediaservice.h b/tests/auto/unit/qmultimedia_common/mockmediaservice.h deleted file mode 100644 index 3896437ce..000000000 --- a/tests/auto/unit/qmultimedia_common/mockmediaservice.h +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 MOCKMEDIASERVICE_H -#define MOCKMEDIASERVICE_H - -#include "qmediaservice.h" -#include <QtCore/QMap> - -Q_DECLARE_METATYPE(QMediaControl *) - -class MockMediaService : public QMediaService -{ - Q_OBJECT -public: - MockMediaService(QObject *parent, QMediaControl *control): - QMediaService(parent), - mockControl(control) {} - - MockMediaService(QObject *parent, QMap<QString, QMediaControl *> controls): - QMediaService(parent), - mockControl(0), - mockControls(controls) {} - - QMediaControl* requestControl(const char *key) - { - if (mockControl) - return mockControl; - else - return mockControls.value(key); - } - - void releaseControl(QMediaControl*) {} - - QMediaControl *mockControl; - QMap<QString, QMediaControl *> mockControls; -}; - - -#endif // MOCKMEDIASERVICE_H diff --git a/tests/auto/unit/qmultimedia_common/mockmediaserviceprovider.h b/tests/auto/unit/qmultimedia_common/mockmediaserviceprovider.h deleted file mode 100644 index 49f945cd6..000000000 --- a/tests/auto/unit/qmultimedia_common/mockmediaserviceprovider.h +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 MOCKMEDIASERVICEPROVIDER_H -#define MOCKMEDIASERVICEPROVIDER_H - -#include "qmediaserviceprovider_p.h" -#include "qmediaservice.h" -#include "mockvideodeviceselectorcontrol.h" -#include "mockcamerainfocontrol.h" - -// Simple provider that lets you set the service -class MockMediaServiceProvider : public QMediaServiceProvider -{ -public: - MockMediaServiceProvider(QMediaService* s = 0, bool del=false) - : service(s), deleteServiceOnRelease(del) - { - } - - QMediaService *requestService(const QByteArray &, const QMediaServiceProviderHint &) - { - return service; - } - - void releaseService(QMediaService *service) - { - if (deleteServiceOnRelease) { - delete service; - this->service = 0; - } - } - - QMediaServiceProviderHint::Features supportedFeatures(const QMediaService *) const - { - return features; - } - - void setSupportedFeatures(QMediaServiceProviderHint::Features f) - { - features = f; - } - - QByteArray defaultDevice(const QByteArray &serviceType) const - { - if (serviceType == Q_MEDIASERVICE_CAMERA) - return MockVideoDeviceSelectorControl::defaultCamera(); - - return QByteArray(); - } - - QList<QByteArray> devices(const QByteArray &serviceType) const - { - if (serviceType == Q_MEDIASERVICE_CAMERA) - return MockVideoDeviceSelectorControl::availableCameras(); - - return QList<QByteArray>(); - } - - QString deviceDescription(const QByteArray &serviceType, const QByteArray &device) - { - if (serviceType == Q_MEDIASERVICE_CAMERA) - return MockVideoDeviceSelectorControl::cameraDescription(device); - - return QString(); - } - - QCamera::Position cameraPosition(const QByteArray &device) const - { - return MockCameraInfoControl::position(device); - } - - int cameraOrientation(const QByteArray &device) const - { - return MockCameraInfoControl::orientation(device); - } - - QMediaService *service; - bool deleteServiceOnRelease; - QMediaServiceProviderHint::Features features; -}; - -#endif // MOCKMEDIASERVICEPROVIDER_H diff --git a/tests/auto/unit/qmultimedia_common/mockmediastreamscontrol.h b/tests/auto/unit/qmultimedia_common/mockmediastreamscontrol.h deleted file mode 100644 index 9242dae06..000000000 --- a/tests/auto/unit/qmultimedia_common/mockmediastreamscontrol.h +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 MOCKMEDIASTREAMSCONTROL_H -#define MOCKMEDIASTREAMSCONTROL_H - -#include "qmediastreamscontrol.h" - -class MockStreamsControl : public QMediaStreamsControl -{ -public: - MockStreamsControl(QObject *parent = 0) : QMediaStreamsControl(parent) {} - - int streamCount() { return _streams.count(); } - void setStreamCount(int count) { _streams.resize(count); } - - StreamType streamType(int index) { return _streams.at(index).type; } - void setStreamType(int index, StreamType type) { _streams[index].type = type; } - - QVariant metaData(int index, const QString &key) { - return _streams.at(index).metaData.value(key); } - void setMetaData(int index, const QString &key, const QVariant &value) { - _streams[index].metaData.insert(key, value); } - - bool isActive(int index) { return _streams.at(index).active; } - void setActive(int index, bool state) { _streams[index].active = state; } - -private: - struct Stream - { - Stream() : type(UnknownStream), active(false) {} - StreamType type; - QMap<QString, QVariant> metaData; - bool active; - }; - - QList<Stream> _streams; -}; - -#endif // MOCKMEDIASTREAMSCONTROL_H diff --git a/tests/auto/unit/qmultimedia_common/mockmetadatareadercontrol.h b/tests/auto/unit/qmultimedia_common/mockmetadatareadercontrol.h deleted file mode 100644 index ac5aaa9e8..000000000 --- a/tests/auto/unit/qmultimedia_common/mockmetadatareadercontrol.h +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 MOCKMETADATAREADERCONTROL_H -#define MOCKMETADATAREADERCONTROL_H - -#include "qmetadatareadercontrol.h" - -class MockMetaDataReaderControl : public QMetaDataReaderControl -{ - Q_OBJECT -public: - MockMetaDataReaderControl(QObject *parent = 0) - : QMetaDataReaderControl(parent) - , m_available(false) - { - } - - bool isMetaDataAvailable() const - { - return m_available; - } - void setMetaDataAvailable(bool available) - { - if (m_available != available) - emit metaDataAvailableChanged(m_available = available); - } - QStringList availableMetaData() const - { - return m_data.keys(); - } - - QVariant metaData(const QString &key) const - { - return m_data.value(key); - } - - void setMetaData(const QString &key, const QVariant &value) - { - if (m_data[key] != value) { - if (value.isNull()) - m_data.remove(key); - else - m_data[key] = value; - - emit metaDataChanged(key, value); - emit metaDataChanged(); - } - } - - using QMetaDataReaderControl::metaDataChanged; - - void populateMetaData() - { - m_available = true; - } - - bool m_available; - QMap<QString, QVariant> m_data; -}; - -#endif // MOCKMETADATAREADERCONTROL_H diff --git a/tests/auto/unit/qmultimedia_common/mockmetadatawritercontrol.h b/tests/auto/unit/qmultimedia_common/mockmetadatawritercontrol.h deleted file mode 100644 index b3b0924e1..000000000 --- a/tests/auto/unit/qmultimedia_common/mockmetadatawritercontrol.h +++ /dev/null @@ -1,93 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 MOCKMETADATAWRITERCONTROL_H -#define MOCKMETADATAWRITERCONTROL_H - -#include <QObject> -#include <QMap> - -#include "qmetadatawritercontrol.h" - -class MockMetaDataWriterControl : public QMetaDataWriterControl -{ - Q_OBJECT -public: - MockMetaDataWriterControl(QObject *parent = 0) - : QMetaDataWriterControl(parent) - , m_available(false) - , m_writable(false) - { - } - - bool isMetaDataAvailable() const { return m_available; } - void setMetaDataAvailable(bool available) - { - if (m_available != available) - emit metaDataAvailableChanged(m_available = available); - } - QStringList availableMetaData() const { return m_data.keys(); } - - bool isWritable() const { return m_writable; } - void setWritable(bool writable) { emit writableChanged(m_writable = writable); } - - QVariant metaData(const QString &key) const { return m_data.value(key); }//Getting the metadata from Multimediakit - void setMetaData(const QString &key, const QVariant &value) - { - if (m_data[key] != value) { - if (value.isNull()) - m_data.remove(key); - else - m_data[key] = value; - - emit metaDataChanged(key, value); - emit metaDataChanged(); - } - } - - using QMetaDataWriterControl::metaDataChanged; - - void populateMetaData() - { - m_available = true; - } - void setWritable() - { - emit writableChanged(true); - } - void setMetaDataAvailable() - { - emit metaDataAvailableChanged(true); - } - - bool m_available; - bool m_writable; - QMap<QString, QVariant> m_data; -}; - -#endif // MOCKMETADATAWRITERCONTROL_H diff --git a/tests/auto/unit/qmultimedia_common/mockplayer.pri b/tests/auto/unit/qmultimedia_common/mockplayer.pri deleted file mode 100644 index 93cdbf3d8..000000000 --- a/tests/auto/unit/qmultimedia_common/mockplayer.pri +++ /dev/null @@ -1,15 +0,0 @@ -INCLUDEPATH *= $$PWD \ - ../../../src/multimedia \ - ../../../src/multimedia/audio \ - ../../../src/multimedia/video \ - -HEADERS *= \ - ../qmultimedia_common/mockmediaplayerservice.h \ - ../qmultimedia_common/mockmediaplayercontrol.h \ - ../qmultimedia_common/mockmediastreamscontrol.h \ - ../qmultimedia_common/mockmedianetworkaccesscontrol.h \ - ../qmultimedia_common/mockvideoprobecontrol.h \ - ../qmultimedia_common/mockaudiorolecontrol.h \ - ../qmultimedia_common/mockcustomaudiorolecontrol.h - -include(mockvideo.pri) diff --git a/tests/auto/unit/qmultimedia_common/mockplaylist.pri b/tests/auto/unit/qmultimedia_common/mockplaylist.pri deleted file mode 100644 index c27c839c5..000000000 --- a/tests/auto/unit/qmultimedia_common/mockplaylist.pri +++ /dev/null @@ -1,8 +0,0 @@ -INCLUDEPATH *= $$PWD \ - ../../../src/multimedia \ - -HEADERS *= \ - ../qmultimedia_common/mockmediaplaylistsourcecontrol.h \ - ../qmultimedia_common/mockmediaplaylistcontrol.h \ - ../qmultimedia_common/mockreadonlyplaylistprovider.h \ - ../qmultimedia_common/mockplaylistservice.h diff --git a/tests/auto/unit/qmultimedia_common/mockplaylistservice.h b/tests/auto/unit/qmultimedia_common/mockplaylistservice.h deleted file mode 100644 index cb1971a44..000000000 --- a/tests/auto/unit/qmultimedia_common/mockplaylistservice.h +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 MOCKPLAYLISTSERVICE_H -#define MOCKPLAYLISTSERVICE_H - -#include "qmediaservice.h" -#include "mockmediaplaylistcontrol.h" - -class MockPlaylistService : public QMediaService -{ - Q_OBJECT - -public: - MockPlaylistService():QMediaService(0) - { - mockControl = new MockMediaPlaylistControl(false, this); - } - - ~MockPlaylistService() - { - } - - QMediaControl* requestControl(const char *iid) - { - if (qstrcmp(iid, QMediaPlaylistControl_iid) == 0) - return mockControl; - return 0; - } - - void releaseControl(QMediaControl *) - { - } - - MockMediaPlaylistControl *mockControl; -}; - - -#endif // MOCKPLAYLISTSERVICE_H diff --git a/tests/auto/unit/qmultimedia_common/mockreadonlyplaylistprovider.h b/tests/auto/unit/qmultimedia_common/mockreadonlyplaylistprovider.h deleted file mode 100644 index f0117d653..000000000 --- a/tests/auto/unit/qmultimedia_common/mockreadonlyplaylistprovider.h +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 MOCKREADONLYPLAYLISTPROVIDER_H -#define MOCKREADONLYPLAYLISTPROVIDER_H - -#include <private/qmediaplaylistprovider_p.h> - -class MockReadOnlyPlaylistProvider : public QMediaPlaylistProvider -{ -public: - MockReadOnlyPlaylistProvider(QObject *parent) - :QMediaPlaylistProvider(parent) - { - m_items.append(QMediaContent(QUrl(QLatin1String("file:///1")))); - m_items.append(QMediaContent(QUrl(QLatin1String("file:///2")))); - m_items.append(QMediaContent(QUrl(QLatin1String("file:///3")))); - } - - int mediaCount() const { return m_items.size(); } - QMediaContent media(int index) const - { - return index >=0 && index < mediaCount() ? m_items.at(index) : QMediaContent(); - } - -private: - QList<QMediaContent> m_items; -}; - -#endif // MOCKREADONLYPLAYLISTPROVIDER_H diff --git a/tests/auto/unit/qmultimedia_common/mockrecorder.pri b/tests/auto/unit/qmultimedia_common/mockrecorder.pri deleted file mode 100644 index bdbcba0b8..000000000 --- a/tests/auto/unit/qmultimedia_common/mockrecorder.pri +++ /dev/null @@ -1,15 +0,0 @@ -INCLUDEPATH *= $$PWD \ - ../../../src/multimedia \ - ../../../src/multimedia/audio \ - ../../../src/multimedia/video \ - -HEADERS *= \ - ../qmultimedia_common/mockmediarecorderservice.h \ - ../qmultimedia_common/mockmediarecordercontrol.h \ - ../qmultimedia_common/mockvideoencodercontrol.h \ - ../qmultimedia_common/mockaudioencodercontrol.h \ - ../qmultimedia_common/mockaudioinputselector.h \ - ../qmultimedia_common/mockaudioprobecontrol.h \ - -# We also need all the container/metadata bits -include(mockcontainer.pri) diff --git a/tests/auto/unit/qmultimedia_common/mockvideo.pri b/tests/auto/unit/qmultimedia_common/mockvideo.pri deleted file mode 100644 index a2492298c..000000000 --- a/tests/auto/unit/qmultimedia_common/mockvideo.pri +++ /dev/null @@ -1,10 +0,0 @@ -# video related mock backend files -INCLUDEPATH += $$PWD \ - ../../../src/multimedia \ - ../../../src/multimedia/video - -HEADERS *= \ - ../qmultimedia_common/mockvideosurface.h \ - ../qmultimedia_common/mockvideorenderercontrol.h \ - ../qmultimedia_common/mockvideowindowcontrol.h - diff --git a/tests/auto/unit/qmultimedia_common/mockvideodeviceselectorcontrol.h b/tests/auto/unit/qmultimedia_common/mockvideodeviceselectorcontrol.h deleted file mode 100644 index b391a282d..000000000 --- a/tests/auto/unit/qmultimedia_common/mockvideodeviceselectorcontrol.h +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 MOCKVIDEODEVICESELECTORCONTROL_H -#define MOCKVIDEODEVICESELECTORCONTROL_H - -#include <qvideodeviceselectorcontrol.h> - -class MockVideoDeviceSelectorControl : public QVideoDeviceSelectorControl -{ - Q_OBJECT -public: - MockVideoDeviceSelectorControl(QObject *parent) - : QVideoDeviceSelectorControl(parent) - , m_selectedDevice(1) - { - } - - ~MockVideoDeviceSelectorControl() { } - - int deviceCount() const { return availableCameras().count(); } - - QString deviceName(int index) const { return QString::fromLatin1(availableCameras().at(index)); } - QString deviceDescription(int index) const { return cameraDescription(availableCameras().at(index)); } - - int defaultDevice() const { return availableCameras().indexOf(defaultCamera()); } - int selectedDevice() const { return m_selectedDevice; } - void setSelectedDevice(int index) - { - m_selectedDevice = index; - emit selectedDeviceChanged(m_selectedDevice); - emit selectedDeviceChanged(deviceName(m_selectedDevice)); - } - - static QByteArray defaultCamera() - { - return "othercamera"; - } - - static QList<QByteArray> availableCameras() - { - return QList<QByteArray>() << "backcamera" << "othercamera"; - } - - static QString cameraDescription(const QByteArray &camera) - { - if (camera == "backcamera") - return QStringLiteral("backcamera desc"); - else if (camera == "othercamera") - return QStringLiteral("othercamera desc"); - else - return QString(); - } - -private: - int m_selectedDevice; - QStringList m_devices; - QStringList m_descriptions; -}; - -#endif // MOCKVIDEODEVICESELECTORCONTROL_H diff --git a/tests/auto/unit/qmultimedia_common/mockvideoencodercontrol.h b/tests/auto/unit/qmultimedia_common/mockvideoencodercontrol.h deleted file mode 100644 index a1ee8ff9f..000000000 --- a/tests/auto/unit/qmultimedia_common/mockvideoencodercontrol.h +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 MOCKVIDEOENCODERCONTROL_H -#define MOCKVIDEOENCODERCONTROL_H - -#include "qvideoencodersettingscontrol.h" - -class MockVideoEncoderControl : public QVideoEncoderSettingsControl -{ - Q_OBJECT -public: - MockVideoEncoderControl(QObject *parent): - QVideoEncoderSettingsControl(parent) - { - m_videoCodecs << "video/3gpp" << "video/H264"; - m_sizes << QSize(320,240) << QSize(640,480); - m_framerates << 30 << 15 << 1; - } - ~MockVideoEncoderControl() {} - - QVideoEncoderSettings videoSettings() const { return m_videoSettings; } - void setVideoSettings(const QVideoEncoderSettings &settings) { m_videoSettings = settings; }; - - QList<QSize> supportedResolutions(const QVideoEncoderSettings & = QVideoEncoderSettings(), - bool *continuous = 0) const - { - if (continuous) - *continuous = true; - - return m_sizes; - } - - QList<qreal> supportedFrameRates(const QVideoEncoderSettings & = QVideoEncoderSettings(), - bool *continuous = 0) const - { - if (continuous) - *continuous = false; - - return m_framerates; - } - - QStringList supportedVideoCodecs() const { return m_videoCodecs; } - QString videoCodecDescription(const QString &codecName) const { return codecName; } - -private: - QVideoEncoderSettings m_videoSettings; - - QStringList m_videoCodecs; - QList<QSize> m_sizes; - QList<qreal> m_framerates; -}; - -#endif // MOCKVIDEOENCODERCONTROL_H diff --git a/tests/auto/unit/qmultimedia_common/mockvideoprobecontrol.h b/tests/auto/unit/qmultimedia_common/mockvideoprobecontrol.h deleted file mode 100644 index 6d953c2a7..000000000 --- a/tests/auto/unit/qmultimedia_common/mockvideoprobecontrol.h +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 MOCKVIDEOPROBECONTROL_H -#define MOCKVIDEOPROBECONTROL_H - -#include "qmediavideoprobecontrol.h" - -class MockVideoProbeControl : public QMediaVideoProbeControl -{ - Q_OBJECT -public: - MockVideoProbeControl(QObject *parent = 0): - QMediaVideoProbeControl(parent) - { - } - - ~MockVideoProbeControl() {} - -private: -}; - -#endif // MOCKVIDEOPROBECONTROL_H diff --git a/tests/auto/unit/qmultimedia_common/mockvideorenderercontrol.h b/tests/auto/unit/qmultimedia_common/mockvideorenderercontrol.h deleted file mode 100644 index 9c2265426..000000000 --- a/tests/auto/unit/qmultimedia_common/mockvideorenderercontrol.h +++ /dev/null @@ -1,45 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 MOCKVIDEORENDERERCONTROL_H -#define MOCKVIDEORENDERERCONTROL_H - -#include "qvideorenderercontrol.h" - -class MockVideoRendererControl : public QVideoRendererControl -{ -public: - MockVideoRendererControl(QObject *parent = 0) : QVideoRendererControl(parent), m_surface(0) {} - - QAbstractVideoSurface *surface() const { return m_surface; } - void setSurface(QAbstractVideoSurface *surface) { m_surface = surface; } - - QAbstractVideoSurface *m_surface; -}; - -#endif // MOCKVIDEORENDERERCONTROL_H diff --git a/tests/auto/unit/qmultimedia_common/mockvideosurface.h b/tests/auto/unit/qmultimedia_common/mockvideosurface.h deleted file mode 100644 index d9cd4aec9..000000000 --- a/tests/auto/unit/qmultimedia_common/mockvideosurface.h +++ /dev/null @@ -1,46 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 MOCKVIDEOSURFACE_H -#define MOCKVIDEOSURFACE_H - -#include "qabstractvideosurface.h" - -class MockVideoSurface : public QAbstractVideoSurface -{ -public: - QList<QVideoFrame::PixelFormat> supportedPixelFormats( - QAbstractVideoBuffer::HandleType = QAbstractVideoBuffer::NoHandle) const - { - return QList<QVideoFrame::PixelFormat>(); - } - - bool present(const QVideoFrame &) { return false; } -}; - -#endif // MOCKVIDEOSURFACE_H diff --git a/tests/auto/unit/qmultimedia_common/mockvideowindowcontrol.h b/tests/auto/unit/qmultimedia_common/mockvideowindowcontrol.h deleted file mode 100644 index 13dad3b20..000000000 --- a/tests/auto/unit/qmultimedia_common/mockvideowindowcontrol.h +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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 MOCKVIDEOWINDOWCONTROL_H -#define MOCKVIDEOWINDOWCONTROL_H - -#include "qvideowindowcontrol.h" - -class MockVideoWindowControl : public QVideoWindowControl -{ -public: - MockVideoWindowControl(QObject *parent = 0) : QVideoWindowControl(parent) {} - WId winId() const { return 0; } - void setWinId(WId) {} - QRect displayRect() const { return QRect(); } - void setDisplayRect(const QRect &) {} - bool isFullScreen() const { return false; } - void setFullScreen(bool) {} - void repaint() {} - QSize nativeSize() const { return QSize(); } - Qt::AspectRatioMode aspectRatioMode() const { return Qt::KeepAspectRatio; } - void setAspectRatioMode(Qt::AspectRatioMode) {} - int brightness() const { return 0; } - void setBrightness(int) {} - int contrast() const { return 0; } - void setContrast(int) {} - int hue() const { return 0; } - void setHue(int) {} - int saturation() const { return 0; } - void setSaturation(int) {} -}; - -#endif // MOCKVIDEOWINDOWCONTROL_H |