diff options
author | Michael Goddard <michael.goddard@nokia.com> | 2011-07-19 10:40:05 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-07-19 03:06:23 +0200 |
commit | eccb43d73c08b85bab89d8f632d423b63592e14f (patch) | |
tree | e16b44f1548a48f49b64c58263dd067b67232a8e /tests | |
parent | 1403a1c7be7892ad4d1c5d04c143a318055fb36b (diff) |
Remove a few more obsolete parts.
Change-Id: I3a001f01ab7fd8cf63452126037b98c1b01df80d
Reviewed-on: http://codereview.qt.nokia.com/1797
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Jonas Rabbe <jonas.rabbe@nokia.com>
Diffstat (limited to 'tests')
38 files changed, 9 insertions, 5579 deletions
diff --git a/tests/auto/qaudioinput/qaudioinput.pro b/tests/auto/qaudioinput/qaudioinput.pro index ab3527082..98a92606c 100644 --- a/tests/auto/qaudioinput/qaudioinput.pro +++ b/tests/auto/qaudioinput/qaudioinput.pro @@ -8,12 +8,7 @@ QT += core multimediakit-private # TARGET = tst_qaudioinput # CONFIG += testcase -wince*{ - DEFINES += SRCDIR=\\\"\\\" - QT += gui -} else { - !symbian:DEFINES += SRCDIR=\\\"$$PWD/\\\" -} +DEFINES += SRCDIR=\\\"$$PWD/\\\" HEADERS += wavheader.h SOURCES += wavheader.cpp tst_qaudioinput.cpp diff --git a/tests/auto/qaudioinput/tst_qaudioinput.cpp b/tests/auto/qaudioinput/tst_qaudioinput.cpp index fb5f2e229..9ab2512ca 100755 --- a/tests/auto/qaudioinput/tst_qaudioinput.cpp +++ b/tests/auto/qaudioinput/tst_qaudioinput.cpp @@ -53,10 +53,6 @@ #define AUDIO_BUFFER 192000 -#if defined(Q_OS_SYMBIAN) -#define SRCDIR "" -#endif - #ifndef QTRY_VERIFY2 #define QTRY_VERIFY2(__expr,__msg) \ do { \ diff --git a/tests/auto/qaudiooutput/qaudiooutput.pro b/tests/auto/qaudiooutput/qaudiooutput.pro index 2a3749e83..6a6804287 100644 --- a/tests/auto/qaudiooutput/qaudiooutput.pro +++ b/tests/auto/qaudiooutput/qaudiooutput.pro @@ -8,12 +8,7 @@ QT += core multimediakit-private # TARGET = tst_qaudiooutput # CONFIG += testcase -wince*: { - DEFINES += SRCDIR=\\\"\\\" - QT += gui -} else { - !symbian:DEFINES += SRCDIR=\\\"$$PWD/\\\" -} +DEFINES += SRCDIR=\\\"$$PWD/\\\" HEADERS += wavheader.h SOURCES += wavheader.cpp tst_qaudiooutput.cpp diff --git a/tests/auto/qaudiooutput/tst_qaudiooutput.cpp b/tests/auto/qaudiooutput/tst_qaudiooutput.cpp index 2590af39d..a1b44430c 100755 --- a/tests/auto/qaudiooutput/tst_qaudiooutput.cpp +++ b/tests/auto/qaudiooutput/tst_qaudiooutput.cpp @@ -53,10 +53,6 @@ #define AUDIO_BUFFER 192000 -#if defined(Q_OS_SYMBIAN) -#define SRCDIR "" -#endif - #ifndef QTRY_VERIFY2 #define QTRY_VERIFY2(__expr,__msg) \ do { \ diff --git a/tests/auto/qcamera/qcamera.pro b/tests/auto/qcamera/qcamera.pro index 6ebbe3182..1e6205ac4 100644 --- a/tests/auto/qcamera/qcamera.pro +++ b/tests/auto/qcamera/qcamera.pro @@ -7,9 +7,4 @@ QT += multimediakit-private SOURCES += tst_qcamera.cpp -symbian { - TARGET.CAPABILITY = ALL -TCB - TARGET.EPOCHEAPSIZE = 0x20000 0x3000000 -} - maemo*:CONFIG += insignificant_test diff --git a/tests/auto/qcamerabackend/qcamerabackend.pro b/tests/auto/qcamerabackend/qcamerabackend.pro index 80e853d8b..3162b5443 100644 --- a/tests/auto/qcamerabackend/qcamerabackend.pro +++ b/tests/auto/qcamerabackend/qcamerabackend.pro @@ -7,9 +7,4 @@ QT += multimediakit-private SOURCES += tst_qcamerabackend.cpp -symbian { - TARGET.CAPABILITY = ALL -TCB - TARGET.EPOCHEAPSIZE = 0x20000 0x3000000 -} - maemo*:CONFIG += insignificant_test diff --git a/tests/auto/qcamerabackend/tst_qcamerabackend.cpp b/tests/auto/qcamerabackend/tst_qcamerabackend.cpp index 5497edad0..ef900290c 100644 --- a/tests/auto/qcamerabackend/tst_qcamerabackend.cpp +++ b/tests/auto/qcamerabackend/tst_qcamerabackend.cpp @@ -538,7 +538,7 @@ void tst_QCameraBackend::testCameraCaptureMetadata() void tst_QCameraBackend::testExposureCompensation() { -#if !defined(Q_WS_MAEMO_6) && !defined(Q_WS_MAEMO_5) && !defined(Q_OS_SYMBIAN) +#if !defined(Q_WS_MAEMO_6) QSKIP("Capture exposure parameters are supported only on mobile platforms", SkipAll); #endif @@ -547,12 +547,6 @@ void tst_QCameraBackend::testExposureCompensation() QSignalSpy exposureCompensationSignal(exposure, SIGNAL(exposureCompensationChanged(qreal))); -#ifdef Q_OS_SYMBIAN - // Camera needs to be started, see: QTMOBILITY-1566 - camera.load(); - QTRY_COMPARE(camera.status(), QCamera::LoadedStatus); -#endif // Q_OS_SYMBIAN - //it should be possible to set exposure parameters in Unloaded state QCOMPARE(exposure->exposureCompensation()+1.0, 1.0); exposure->setExposureCompensation(1.0); @@ -591,7 +585,7 @@ void tst_QCameraBackend::testExposureCompensation() void tst_QCameraBackend::testExposureMode() { -#if !defined(Q_WS_MAEMO_6) && !defined(Q_WS_MAEMO_5) && !defined(Q_OS_SYMBIAN) +#if !defined(Q_WS_MAEMO_6) QSKIP("Capture exposure parameters are supported only on mobile platforms", SkipAll); #endif @@ -603,12 +597,6 @@ void tst_QCameraBackend::testExposureMode() #endif QCOMPARE(exposure->exposureMode(), QCameraExposure::ExposureAuto); -#ifdef Q_OS_SYMBIAN - // Camera needs to be started, see: QTMOBILITY-1566 - camera.load(); - QTRY_COMPARE(camera.status(), QCamera::LoadedStatus); -#endif // Q_OS_SYMBIAN - // Night exposure->setExposureMode(QCameraExposure::ExposureNight); QCOMPARE(exposure->exposureMode(), QCameraExposure::ExposureNight); @@ -619,12 +607,6 @@ void tst_QCameraBackend::testExposureMode() camera.unload(); QTRY_COMPARE(camera.status(), QCamera::UnloadedStatus); -#ifdef Q_OS_SYMBIAN - // Camera needs to be started, see: QTMOBILITY-1566 - camera.load(); - QTRY_COMPARE(camera.status(), QCamera::LoadedStatus); -#endif // Q_OS_SYMBIAN - #ifdef Q_WS_MAEMO_6 //resource policy doesn't work correctly when resource is released and immediately requested again. QTest::qWait(250); diff --git a/tests/auto/qgraphicsvideoitem/qgraphicsvideoitem.pro b/tests/auto/qgraphicsvideoitem/qgraphicsvideoitem.pro index 1d8735d42..2db21569f 100644 --- a/tests/auto/qgraphicsvideoitem/qgraphicsvideoitem.pro +++ b/tests/auto/qgraphicsvideoitem/qgraphicsvideoitem.pro @@ -7,6 +7,4 @@ QT += multimediakit-private SOURCES += tst_qgraphicsvideoitem.cpp -symbian: TARGET.CAPABILITY = ReadDeviceData WriteDeviceData - maemo*:CONFIG += insignificant_test diff --git a/tests/auto/qmediaobject/main.cpp b/tests/auto/qmediaobject/main.cpp index 4dc763f11..80cf970ec 100644 --- a/tests/auto/qmediaobject/main.cpp +++ b/tests/auto/qmediaobject/main.cpp @@ -42,10 +42,6 @@ #include <QtTest/QtTest> #include "tst_qmediaobject.h" -#ifdef Q_OS_SYMBIAN -#include "tst_qmediaobject_xa.h" -#include "tst_qmediaobject_mmf.h" -#endif int main(int argc, char**argv) { @@ -53,25 +49,5 @@ int main(int argc, char**argv) int ret; tst_QMediaObject test_api; ret = QTest::qExec(&test_api, argc, argv); -#ifdef Q_OS_SYMBIAN - char *new_argv[3]; - QString str = "C:\\data\\" + QFileInfo(QCoreApplication::applicationFilePath()).baseName() + "_xa.log"; - QByteArray bytes = str.toAscii(); - char arg1[] = "-o"; - new_argv[0] = argv[0]; - new_argv[1] = arg1; - new_argv[2] = bytes.data(); - tst_QMetadata_xa test_xa; - ret = QTest::qExec(&test_xa, 3, new_argv); - char *new_argv1[3]; - QString str1 = "C:\\data\\" + QFileInfo(QCoreApplication::applicationFilePath()).baseName() + "_s60.log"; - QByteArray bytes1 = str1.toAscii(); - char arg2[] = "-o"; - new_argv1[0] = argv[0]; - new_argv1[1] = arg2; - new_argv1[2] = bytes1.data(); - tst_QMediaObject_mmf test_mmf; - ret = QTest::qExec(&test_mmf, 3, new_argv1); -#endif return ret; } diff --git a/tests/auto/qmediaobject/qmediaobject.pro b/tests/auto/qmediaobject/qmediaobject.pro index 756603ad7..c48a679a2 100644 --- a/tests/auto/qmediaobject/qmediaobject.pro +++ b/tests/auto/qmediaobject/qmediaobject.pro @@ -5,23 +5,6 @@ QT += multimediakit-private # TARGET = tst_qmediaobject # CONFIG += testcase -symbian { - HEADERS += tst_qmediaobject_xa.h - SOURCES += tst_qmediaobject_xa.cpp - TARGET.CAPABILITY = ALL -TCB - - testFiles.sources = testfiles/* - testFiles.path = /Data/testfiles - DEPLOYMENT += testFiles - HEADERS += tst_qmediaobject_mmf.h - SOURCES += tst_qmediaobject_mmf.cpp - TARGET.CAPABILITY = ALL -TCB - - testFiles.sources = testfiles/* - testFiles.path = /Data/testfiles - DEPLOYMENT += testFiles -} - HEADERS+= tst_qmediaobject.h SOURCES += main.cpp tst_qmediaobject.cpp diff --git a/tests/auto/qmediaobject/tst_qmediaobject_mmf.cpp b/tests/auto/qmediaobject/tst_qmediaobject_mmf.cpp deleted file mode 100644 index 7cf5622a5..000000000 --- a/tests/auto/qmediaobject/tst_qmediaobject_mmf.cpp +++ /dev/null @@ -1,278 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Mobility Components. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include <tst_qmediaobject_mmf.h> - -QT_USE_NAMESPACE - -void tst_QMediaObject_mmf::initTestCase_data() -{ - QTest::addColumn<bool>("valid"); - QTest::addColumn<QMediaContent>("mediaContent"); - QTest::addColumn<bool>("metaDataAvailable"); - - QTest::newRow("TestDataNull") - << false // valid - << QMediaContent() // mediaContent - << false; // metaDataAvailable - - QTest::newRow("test_amr.amr") - << true // valid - << QMediaContent(QUrl("file:///C:/data/testfiles/test_amr.amr")) // mediaContent - << false; // metaDataAvailable - - QTest::newRow("test_flash_video.flv") - << true // valid - << QMediaContent(QUrl("file:///C:/data/testfiles/test_flash_video.flv")) // mediaContent - << false; // metaDataAvailable - - QTest::newRow("test_invalid_extension_mp4.xyz") - << true // valid - << QMediaContent(QUrl("file:///C:/data/testfiles/test_invalid_extension_mp4.xyz")) // mediaContent - << false; // metaDataAvailable - - QTest::newRow("test_invalid_extension_wav.xyz") - << true // valid - << QMediaContent(QUrl("file:///C:/data/testfiles/test_invalid_extension_wav.xyz")) // mediaContent - << false; // metaDataAvailable - - QTest::newRow("test_mp3.mp3") - << true // valid - << QMediaContent(QUrl("file:///C:/data/testfiles/test_mp3.mp3")) // mediaContent -#if !defined(__WINS__) || !defined(__WINSCW__) - << true; // metaDataAvailable -#else - << false; // metaDataAvailable -#endif // !defined(__WINS__) || defined(__WINSCW__) - - QTest::newRow("test_mp3_no_metadata.mp3") - << true // valid - << QMediaContent(QUrl("file:///C:/data/testfiles/test_mp3_no_metadata.mp3")) // mediaContent - << false; // metaDataAvailable - - QTest::newRow("test_mp4.mp4") - << true // valid - << QMediaContent(QUrl("file:///C:/data/testfiles/test_mp4.mp4")) // mediaContent -#if defined(__WINS__) || defined(__WINSCW__) - << true; // metaDataAvailable -#else - << false; // metaDataAvailable -#endif // !defined(__WINS__) || defined(__WINSCW__) - - QTest::newRow("test_wav.wav") - << true // valid - << QMediaContent(QUrl("file:///C:/data/testfiles/test_wav.wav")) // mediaContent - << false; // metaDataAvailable - - QTest::newRow("test_wmv9.wmv") - << true // valid - << QMediaContent(QUrl("file:///C:/data/testfiles/test_wmv9.wmv")) // mediaContent - << false; // metaDataAvailable - - QTest::newRow("test youtube stream") - << true // valid - << QMediaContent(QUrl("rtsp://v3.cache4.c.youtube.com/CkgLENy73wIaPwlU2rm7yu8PFhMYESARFEIJbXYtZ29vZ2xlSARSB3JlbGF0ZWRaDkNsaWNrVGh1bWJuYWlsYPi6_IXT2rvpSgw=/0/0/0/video.3gp")) // mediaContent - << false; // metaDataAvailable -} - -void tst_QMediaObject_mmf::initTestCase() -{ -} - -void tst_QMediaObject_mmf::cleanupTestCase() -{ -} - -void tst_QMediaObject_mmf::init() -{ - qRegisterMetaType<QMediaContent>("QMediaContent"); -} - -void tst_QMediaObject_mmf::cleanup() -{ -} - -void tst_QMediaObject_mmf::isMetaDataAvailable() -{ - QFETCH_GLOBAL(QMediaContent, mediaContent); - QFETCH_GLOBAL(bool, metaDataAvailable); - QMediaPlayer player; - - player.setMedia(mediaContent); - QTest::qWait(700); - QVERIFY(player.isMetaDataAvailable() == metaDataAvailable); -} - -void tst_QMediaObject_mmf::metaData() -{ - QFETCH_GLOBAL(QMediaContent, mediaContent); - QFETCH_GLOBAL(bool, metaDataAvailable); - QMediaPlayer player; - - player.setMedia(mediaContent); - QTest::qWait(700); - const QString artist(QLatin1String("Artist")); - const QString title(QLatin1String("Title")); - - if (player.isMetaDataAvailable()) { - QCOMPARE(player.metaData(QtMultimediaKit::AlbumArtist).toString(), artist); - QCOMPARE(player.metaData(QtMultimediaKit::Title).toString(), title); - } -} - -void tst_QMediaObject_mmf::availableMetaData() -{ - QFETCH_GLOBAL(QMediaContent, mediaContent); - QFETCH_GLOBAL(bool, metaDataAvailable); - QMediaPlayer player; - - player.setMedia(mediaContent); - QTest::qWait(700); - - if (player.isMetaDataAvailable()) { - QList<QtMultimediaKit::MetaData> metaDataKeys = player.availableMetaData(); - QVERIFY(metaDataKeys.count() > 0); - QVERIFY(metaDataKeys.contains(QtMultimediaKit::AlbumArtist)); - QVERIFY(metaDataKeys.contains(QtMultimediaKit::Title)); - } -} - -void tst_QMediaObject_mmf::extendedMetaData() -{ - QFETCH_GLOBAL(QMediaContent, mediaContent); - QMediaPlayer player; - - player.setMedia(mediaContent); - QTest::qWait(700); - const QString artist(QLatin1String("Artist")); - const QString title(QLatin1String("Title")); - - if (player.isMetaDataAvailable()) { - QCOMPARE(player.extendedMetaData(metaDataKeyAsString(QtMultimediaKit::AlbumArtist)).toString(), artist); - QCOMPARE(player.extendedMetaData(metaDataKeyAsString(QtMultimediaKit::Title)).toString(), title); - } -} - -void tst_QMediaObject_mmf::availableExtendedMetaData() -{ - QFETCH_GLOBAL(QMediaContent, mediaContent); - QMediaPlayer player; - - player.setMedia(mediaContent); - QTest::qWait(700); - const QString artist(QLatin1String("Artist")); - const QString title(QLatin1String("Title")); - - if (player.isMetaDataAvailable()) { - QStringList metaDataKeys = player.availableExtendedMetaData(); - QVERIFY(metaDataKeys.count() > 0); -/* qWarning() << "metaDataKeys.count: " << metaDataKeys.count(); - int count = metaDataKeys.count(); - count = count-1; - int i = 0; - while(count >= i) - { - qWarning() << "metaDataKeys "<<i<<"." << metaDataKeys.at(i); - i++; - }*/ - QVERIFY(metaDataKeys.contains(metaDataKeyAsString(QtMultimediaKit::AlbumArtist))); - QVERIFY(metaDataKeys.contains(metaDataKeyAsString(QtMultimediaKit::Title))); - } -} - -QString tst_QMediaObject_mmf::metaDataKeyAsString(QtMultimediaKit::MetaData key) const -{ - switch(key) { - case QtMultimediaKit::Title: return "title"; - case QtMultimediaKit::AlbumArtist: return "artist"; - case QtMultimediaKit::Comment: return "comment"; - case QtMultimediaKit::Genre: return "genre"; - case QtMultimediaKit::Year: return "year"; - case QtMultimediaKit::Copyright: return "copyright"; - case QtMultimediaKit::AlbumTitle: return "album"; - case QtMultimediaKit::Composer: return "composer"; - case QtMultimediaKit::TrackNumber: return "albumtrack"; - case QtMultimediaKit::AudioBitRate: return "audiobitrate"; - case QtMultimediaKit::VideoBitRate: return "videobitrate"; - case QtMultimediaKit::Duration: return "duration"; - case QtMultimediaKit::MediaType: return "contenttype"; - case QtMultimediaKit::SubTitle: - case QtMultimediaKit::Description: - case QtMultimediaKit::Category: - case QtMultimediaKit::Date: - case QtMultimediaKit::UserRating: - case QtMultimediaKit::Keywords: - case QtMultimediaKit::Language: - case QtMultimediaKit::Publisher: - case QtMultimediaKit::ParentalRating: - case QtMultimediaKit::RatingOrganisation: - case QtMultimediaKit::Size: - case QtMultimediaKit::AudioCodec: - case QtMultimediaKit::AverageLevel: - case QtMultimediaKit::ChannelCount: - case QtMultimediaKit::PeakValue: - case QtMultimediaKit::SampleRate: - case QtMultimediaKit::Author: - case QtMultimediaKit::ContributingArtist: - case QtMultimediaKit::Conductor: - case QtMultimediaKit::Lyrics: - case QtMultimediaKit::Mood: - case QtMultimediaKit::TrackCount: - case QtMultimediaKit::CoverArtUrlSmall: - case QtMultimediaKit::CoverArtUrlLarge: - case QtMultimediaKit::Resolution: - case QtMultimediaKit::PixelAspectRatio: - case QtMultimediaKit::VideoFrameRate: - case QtMultimediaKit::VideoCodec: - case QtMultimediaKit::PosterUrl: - case QtMultimediaKit::ChapterNumber: - case QtMultimediaKit::Director: - case QtMultimediaKit::LeadPerformer: - case QtMultimediaKit::Writer: - case QtMultimediaKit::CameraManufacturer: - case QtMultimediaKit::CameraModel: - case QtMultimediaKit::Event: - case QtMultimediaKit::Subject: - default: - break; - } - - return QString(); -} diff --git a/tests/auto/qmediaobject/tst_qmediaobject_mmf.h b/tests/auto/qmediaobject/tst_qmediaobject_mmf.h deleted file mode 100644 index 1a381dec8..000000000 --- a/tests/auto/qmediaobject/tst_qmediaobject_mmf.h +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Mobility Components. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef TST_QMEDIAOBJECT_MMF_H -#define TST_QMEDIAOBJECT_MMF_H - -#include <QtTest/QtTest> -#include <QtCore> -#include <QtGui> - -#include <qtmedianamespace.h> -#include <QMediaPlayer> -#include <QMediaPlayerControl> -#include <QMediaPlaylist> -#include <QMediaService> -#include <QMediaStreamsControl> -#include <QVideoWidget> - -QT_USE_NAMESPACE - -class tst_QMediaObject_mmf : public QObject -{ - Q_OBJECT - -public slots: - void initTestCase_data(); - void initTestCase(); - void cleanupTestCase(); - void init(); - void cleanup(); - -private slots: - void isMetaDataAvailable(); - void metaData(); - void availableMetaData(); - void extendedMetaData(); - void availableExtendedMetaData(); - -private: - QString metaDataKeyAsString(QtMultimediaKit::MetaData key) const; -}; - -#endif // TST_QMEDIAOBJECT_MMF_H diff --git a/tests/auto/qmediaobject/tst_qmediaobject_xa.cpp b/tests/auto/qmediaobject/tst_qmediaobject_xa.cpp deleted file mode 100644 index 810a414b8..000000000 --- a/tests/auto/qmediaobject/tst_qmediaobject_xa.cpp +++ /dev/null @@ -1,158 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Mobility Components. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "tst_qmediaobject_xa.h" - -QT_USE_NAMESPACE - -#define WAIT_FOR_CONDITION(a,e) \ - for (int _i = 0; _i < 500; _i += 1) { \ - if ((a) == (e)) break; \ - QTest::qWait(10);} - - -#define WAIT_LONG_FOR_CONDITION(a,e) \ - for (int _i = 0; _i < 1800; _i += 1) { \ - if ((a) == (e)) break; \ - QTest::qWait(100);} - -Q_DECLARE_METATYPE(QtMultimediaKit::MetaData) - -void tst_QMetadata_xa::initTestCase_data() -{ - QTest::addColumn<QMediaContent>("mediaContent"); - QTest::addColumn<int>("count"); - QTest::addColumn<QtMultimediaKit::MetaData>("key"); - QTest::addColumn<qint64>("intValue"); - QTest::addColumn<QString>("strValue"); - - QTest::newRow("testmp3.mp3 - No Metadata") - << QMediaContent(QUrl("file:///C:/data/testfiles/test.mp3")) // mediaContent - << 0 //count - << QtMultimediaKit::Title //key - irrelavant when count 0 - << qint64(-1) //intValue - << QString(); //strValue - - QTest::newRow("JapJap.mp3 - Title") - << QMediaContent(QUrl("file:///C:/data/testfiles/JapJap.mp3")) // mediaContent - << -1 //count - ignore - << QtMultimediaKit::Title //key - << qint64(-1) //intValue - << QString("JapJap");//strValue - - QTest::newRow("JapJap.mp3 - Artist") - << QMediaContent(QUrl("file:///C:/data/testfiles/JapJap.mp3")) // mediaContent - << -1 //count - ignore - << QtMultimediaKit::AlbumArtist //key - << qint64(-1) //intValue - << QString("Screaming trees");//strValue - - QTest::newRow("JapJap.mp3 - Album") - << QMediaContent(QUrl("file:///C:/data/testfiles/JapJap.mp3")) // mediaContent - << -1 //count - ignore - << QtMultimediaKit::AlbumTitle //key - << qint64(-1) //intValue - << QString("Sweet oblivion"); //strValue - - QTest::newRow("JapJap.mp3 - CoverArt") - << QMediaContent(QUrl("file:///C:/data/testfiles/JapJap.mp3")) // mediaContent - << -1 //count - ignore - << QtMultimediaKit::CoverArtImage //key - << qint64(28521) //intValue - << QString("C:/data/testfiles/JapJapCoverArt.jpeg"); //strValue -} - -void tst_QMetadata_xa::initTestCase() -{ - m_player = new QMediaPlayer(); - - // Symbian back end needs coecontrol for creation. - m_widget = new QVideoWidget(); - //m_widget->setMediaObject(m_player); - m_widget->show(); - runonce = false; -} - -void tst_QMetadata_xa::cleanupTestCase() -{ - delete m_player; - delete m_widget; -} - -void tst_QMetadata_xa::init() -{ - qRegisterMetaType<QMediaContent>("QMediaContent"); - qRegisterMetaType<QtMultimediaKit::MetaData>("QtMultimediaKit::MetaData"); -} - -void tst_QMetadata_xa::cleanup() -{ -} - -void tst_QMetadata_xa::testMetadata() -{ - QFETCH_GLOBAL(QMediaContent, mediaContent); - QFETCH_GLOBAL(int, count); - QFETCH_GLOBAL(QtMultimediaKit::MetaData, key); - QFETCH_GLOBAL(QString, strValue); - QFETCH_GLOBAL(qint64, intValue); - - QSignalSpy spy(m_player, SIGNAL(metaDataAvailableChanged(bool))); - m_player->setMedia(mediaContent); - - WAIT_FOR_CONDITION(spy.count(), 1); - //get metadata count - QList<QtMultimediaKit::MetaData> mdList = m_player->availableMetaData (); - QStringList amdList = m_player->availableExtendedMetaData(); - - int numMetadataItems = mdList.size() + amdList.size(); - if (count>=0) //-1 indicate ignore count - QVERIFY(count==numMetadataItems); - - if (numMetadataItems>0 && !strValue.isEmpty()) { - QVariant val = m_player->metaData(key); - - if(key == QtMultimediaKit::CoverArtImage) - val.value<QImage>().save(strValue); - else - QVERIFY(strValue == val.toString()); - } -} diff --git a/tests/auto/qmediaobject/tst_qmediaobject_xa.h b/tests/auto/qmediaobject/tst_qmediaobject_xa.h deleted file mode 100644 index 81dc85095..000000000 --- a/tests/auto/qmediaobject/tst_qmediaobject_xa.h +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Mobility Components. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef TST_QMEDIAOBJECT_XA_H -#define TST_QMEDIAOBJECT_XA_H - -#include <QtTest/QtTest> -#include <QtCore> -#include <QtGui> - -#include <QMediaPlayer> -#include <QMediaPlayerControl> -#include <QMediaPlaylist> -#include <QMediaService> -#include <QMediaStreamsControl> -#include <QVideoWidget> - -#include <QList> -#include <QStringList> - -QT_USE_NAMESPACE - -class tst_QMetadata_xa: public QObject -{ - Q_OBJECT - -public slots: - void initTestCase_data(); - void initTestCase(); - void cleanupTestCase(); - void init(); - void cleanup(); - -private slots: - void testMetadata(); - - -private: - void displayImage(QImage); - QMediaPlayer *m_player; - QVideoWidget *m_widget; - bool runonce; -}; - -#endif //TST_QMEDIAOBJECT_XA_H diff --git a/tests/auto/qmediaplayer/main.cpp b/tests/auto/qmediaplayer/main.cpp index 896782eb9..9d17b38e2 100755 --- a/tests/auto/qmediaplayer/main.cpp +++ b/tests/auto/qmediaplayer/main.cpp @@ -43,38 +43,11 @@ #include "tst_qmediaplayer.h" -#ifdef Q_OS_SYMBIAN -#include "tst_qmediaplayer_xa.h" -#include "tst_qmediaplayer_s60.h" -#endif - int main(int argc, char**argv) { QApplication app(argc,argv); int ret; tst_QMediaPlayer test_api; ret = QTest::qExec(&test_api, argc, argv); -#ifdef Q_OS_SYMBIAN -#ifdef HAS_OPENMAXAL_MEDIAPLAY_BACKEND - char *new_argv[3]; - QString str = "C:\\data\\" + QFileInfo(QCoreApplication::applicationFilePath()).baseName() + "_s60.log"; - QByteArray bytes = str.toAscii(); - char arg1[] = "-o"; - new_argv[0] = argv[0]; - new_argv[1] = arg1; - new_argv[2] = bytes.data(); - tst_QMediaPlayer_xa test_xa; - ret = QTest::qExec(&test_xa, 3, new_argv); -#endif - char *new_argv1[3]; - QString str1 = "C:\\data\\" + QFileInfo(QCoreApplication::applicationFilePath()).baseName() + "_s60.log"; - QByteArray bytes1 = str1.toAscii(); - char arg2[] = "-o"; - new_argv1[0] = argv[0]; - new_argv1[1] = arg2; - new_argv1[2] = bytes1.data(); - tst_QMediaPlayer_s60 test_s60; - ret = QTest::qExec(&test_s60, 3, new_argv1); -#endif return ret; } diff --git a/tests/auto/qmediaplayer/qmediaplayer.pro b/tests/auto/qmediaplayer/qmediaplayer.pro index b624afd91..0c2880e0d 100644 --- a/tests/auto/qmediaplayer/qmediaplayer.pro +++ b/tests/auto/qmediaplayer/qmediaplayer.pro @@ -5,21 +5,6 @@ QT += network multimediakit-private # TARGET = tst_qmediaplayer # CONFIG += testcase -symbian { - TARGET.CAPABILITY = NetworkServices - testFiles.sources = testfiles/* - testFiles.path = /Data/testfiles - DEPLOYMENT += testFiles - contains(openmaxal_symbian_enabled, no) { - DEFINES += HAS_OPENMAXAL_MEDIAPLAY_BACKEND - HEADERS += tst_qmediaplayer_xa.h - SOURCES += tst_qmediaplayer_xa.cpp - } else { - HEADERS += tst_qmediaplayer_s60.h - SOURCES += tst_qmediaplayer_s60.cpp - } -} - HEADERS += tst_qmediaplayer.h SOURCES += main.cpp tst_qmediaplayer.cpp diff --git a/tests/auto/qmediaplayer/tst_qmediaplayer_s60.cpp b/tests/auto/qmediaplayer/tst_qmediaplayer_s60.cpp deleted file mode 100755 index f30934a96..000000000 --- a/tests/auto/qmediaplayer/tst_qmediaplayer_s60.cpp +++ /dev/null @@ -1,1708 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Mobility Components. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//TESTED_COMPONENT=src/multimedia - -#include "tst_qmediaplayer_s60.h" -#include <qmediastreamscontrol.h> - -static const QString TestFilePath = QLatin1String("c:/data/testfiles/"); - -// Comment out the following line if the test device does not have network -// access. -#define TEST_DEVICE_HAS_NETWORK_ACCESS - -QT_USE_NAMESPACE - -void tst_QMediaPlayer_s60::initTestCase_data() -{ -#ifdef __WINSCW__ - initTestCase_data_default_winscw(); -#else - initTestCase_data_default_armv5(); -#endif -} - -void tst_QMediaPlayer_s60::initTestCase_data_default_armv5() -{ - QTest::addColumn<bool>("valid"); - QTest::addColumn<bool>("streamable"); - QTest::addColumn<QMediaPlayer::State>("state"); - QTest::addColumn<QMediaPlayer::MediaStatus>("status"); - QTest::addColumn<QMediaContent>("mediaContent"); - QTest::addColumn<qint64>("duration"); - QTest::addColumn<qint64>("position"); - QTest::addColumn<bool>("seekable"); - QTest::addColumn<bool>("seekableWhilePlaying"); - QTest::addColumn<int>("volume"); - QTest::addColumn<bool>("videoAvailable"); - QTest::addColumn<bool>("audioAvailable"); - QTest::addColumn<qreal>("playbackRate"); - QTest::addColumn<QMediaPlayer::Error>("error"); - QTest::addColumn<QString>("errorString"); - - QTest::newRow("TestDataNull") - << false //valid - << false //streamable - << QMediaPlayer::StoppedState // state - << QMediaPlayer::NoMedia // status - << QMediaContent() // mediaContent - << qint64(-1) // duration - << qint64(0) // position - << false // seekable - << false // seekableWhilePlaying - << 50 // volume - << false // videoAvailable - << false //audioAvailable - << qreal(0) // playbackRate - << QMediaPlayer::NoError // error - << QString(); // errorString - - QTest::newRow("test_3gp.3gp") - << true //valid - << false //streamable - << QMediaPlayer::StoppedState // state - << QMediaPlayer::LoadedMedia // status LoadedMedia - << QMediaContent(QUrl::fromLocalFile(TestFilePath + "test_3gp.3gp")) // mediaContent - << qint64(46860) // duration - << qint64(23430) // position (duration/2) - << true // seekable - << true // seekableWhilePlaying - << 50 // volume - << true // videoAvailable - << true //audioAvailable - << qreal(0) // playbackRate - << QMediaPlayer::NoError // error - << QString(); // errorString - - QTest::newRow("test_mp4.mp4") - << true //valid - << false //streamable - << QMediaPlayer::StoppedState // state - << QMediaPlayer::LoadedMedia // status - << QMediaContent(QUrl::fromLocalFile(TestFilePath + "test_mp4.mp4")) // mediaContent - << qint64(2701) // duration - << qint64(1351) // position (duration/2) - << true // seekable - << true // seekableWhilePlaying - << 50 // volume - << true // videoAvailable - << true //audioAvailable - << qreal(0) // playbackRate - << QMediaPlayer::NoError // error - << QString(); // errorString - - QTest::newRow("test_wmv9.wmv") - << true //valid - << false //streamable - << QMediaPlayer::StoppedState // state - << QMediaPlayer::LoadedMedia // status - << QMediaContent(QUrl::fromLocalFile(TestFilePath + "test_wmv9.wmv")) // mediaContent - << qint64(169389) // duration - << qint64(84695) // position (duration/2) - << true // seekable - << false // seekableWhilePlaying - << 50 // volume - << true // videoAvailable - << true //audioAvailable - << qreal(0) // playbackRate - << QMediaPlayer::NoError // error - << QString(); // errorString - - QTest::newRow("test_AAC.dat") - << false //valid - << false //streamable - << QMediaPlayer::StoppedState // state - << QMediaPlayer::InvalidMedia // status - << QMediaContent(QUrl::fromLocalFile(TestFilePath + "test_AAC.dat")) // mediaContent - << qint64(-1) // duration - << qint64(0) // position (duration/2) - << true // seekable - << true // seekableWhilePlaying - << 50 // volume - << false // videoAvailable - << false //audioAvailable - << qreal(0) // playbackRate - << QMediaPlayer::ResourceError // error - << QString(); // errorString - - QTest::newRow("test_amr.amr") - << true // valid - << false //streamable - << QMediaPlayer::StoppedState // state - << QMediaPlayer::LoadedMedia // status - << QMediaContent(QUrl::fromLocalFile(TestFilePath + "test_amr.amr")) // mediaContent - << qint64(14400) // duration - << qint64(7200) // position - << true // seekable - << false // seekableWhilePlaying - << 50 // volume - << false // videoAvailable - << true // audioAvailable - << qreal(0) // playbackRate - << QMediaPlayer::NoError // error - << QString(); // errorString - - QTest::newRow("test_mp3.mp3") - << true // valid - << false //streamable - << QMediaPlayer::StoppedState // state - << QMediaPlayer::LoadedMedia // status - << QMediaContent(QUrl::fromLocalFile(TestFilePath + "test_mp3.mp3")) // mediaContent - << qint64(102044) //qint64(102044) duration - << qint64(51022) // position - << true // seekable - << true // seekableWhilePlaying - << 50 // volume - << false // videoAvailable - << true // audioAvailable - << qreal(0) // playbackRate - << QMediaPlayer::NoError // error - << QString(); // errorString - -#ifdef TEST_DEVICE_HAS_NETWORK_ACCESS - QTest::newRow("test_stream 3gp") - << false // valid - << true //streamable - << QMediaPlayer::StoppedState // state - << QMediaPlayer::LoadedMedia // status - << QMediaContent(QUrl("rtsp://v3.cache4.c.youtube.com/CkgLENy73wIaPwlU2rm7yu8PFhMYESARFEIJbXYtZ29vZ2xlSARSB3JlbGF0ZWRaDkNsaWNrVGh1bWJuYWlsYPi6_IXT2rvpSgw=/0/0/0/video.3gp")) // mediaContent - << qint64(103000) // duration - << qint64(0) // position - << false // seekable - << false // seekableWhilePlaying - << 50 // volume - << true // videoAvailable - << true // audioAvailable - << qreal(0) // playbackRate - << QMediaPlayer::NoError // error - << QString(); // errorString - - QTest::newRow("RTSP link to H.263/AMR") - << false // valid - << true //streamable - << QMediaPlayer::StoppedState // state - << QMediaPlayer::LoadedMedia // status - << QMediaContent(QUrl("rtsp://v7.cache8.c.youtube.com/CiILENy73wIaGQnNUH6lxLd0MRMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp")) // mediaContent - << qint64(249000) // duration - << qint64(0) // position - << false // seekable - << false // seekableWhilePlaying - << 50 // volume - << true // videoAvailable - << true // audioAvailable - << qreal(0) // playbackRate - << QMediaPlayer::NoError // error - << QString(); // errorString - - QTest::newRow("RTSP link to MPEG-4/AAC") - << false // valid - << true //streamable - << QMediaPlayer::StoppedState // state - << QMediaPlayer::LoadedMedia // status - << QMediaContent(QUrl("rtsp://v8.cache1.c.youtube.com/CiILENy73wIaGQnNUH6lxLd0MRMYESARFEgGUgZ2aWRlb3MM/0/0/0/video.3gp")) // mediaContent - << qint64(249000) // duration - << qint64(0) // position - << false // seekable - << false // seekableWhilePlaying - << 50 // volume - << true // videoAvailable - << true // audioAvailable - << qreal(0) // playbackRate - << QMediaPlayer::NoError // error - << QString(); // errorString -#endif // TEST_DEVICE_HAS_NETWORK_ACCESS -} - -void tst_QMediaPlayer_s60::initTestCase_data_default_winscw() -{ - QTest::addColumn<bool>("valid"); - QTest::addColumn<bool>("streamable"); - QTest::addColumn<QMediaPlayer::State>("state"); - QTest::addColumn<QMediaPlayer::MediaStatus>("status"); - QTest::addColumn<QMediaContent>("mediaContent"); - QTest::addColumn<qint64>("duration"); - QTest::addColumn<qint64>("position"); - QTest::addColumn<bool>("seekable"); - QTest::addColumn<bool>("seekableWhilePlaying"); - QTest::addColumn<int>("volume"); - QTest::addColumn<bool>("videoAvailable"); - QTest::addColumn<bool>("audioAvailable"); - QTest::addColumn<qreal>("playbackRate"); - QTest::addColumn<QMediaPlayer::Error>("error"); - QTest::addColumn<QString>("errorString"); - - QTest::newRow("TestDataNull") - << false //valid - << false //streamable - << QMediaPlayer::StoppedState // state - << QMediaPlayer::NoMedia // status - << QMediaContent() // mediaContent - << qint64(-1) // duration - << qint64(0) // position - << false // seekable - << false // seekableWhilePlaying - << 50 // volume - << false // videoAvailable - << false //audioAvailable - << qreal(0) // playbackRate - << QMediaPlayer::NoError // error - << QString(); // errorString - - QTest::newRow("test_3GPP.dat") - << true //valid - << false //streamable - << QMediaPlayer::StoppedState // state - << QMediaPlayer::LoadedMedia // status - << QMediaContent(QUrl::fromLocalFile(TestFilePath + "test_3GPP.dat")) // mediaContent - << qint64(7200) // duration - << qint64(3600) // position (duration/2) - << true // seekable - << true // seekableWhilePlaying - << 50 // volume - << true // videoAvailable - << true //audioAvailable - << qreal(0) // playbackRate - << QMediaPlayer::NoError // error - << QString(); // errorString - - QTest::newRow("test_3gp.3gp") - << true //valid - << false //streamable - << QMediaPlayer::StoppedState // state - << QMediaPlayer::LoadedMedia // status - << QMediaContent(QUrl::fromLocalFile(TestFilePath + "test_3gp.3gp")) // mediaContent - << qint64(46860) // duration - << qint64(23430) // position (duration/2) - << true // seekable - << true // seekableWhilePlaying - << 50 // volume - << true // videoAvailable - << true //audioAvailable - << qreal(0) // playbackRate - << QMediaPlayer::NoError // error - << QString(); // errorString - - QTest::newRow("test_mp4.mp4") - << true //valid - << false //streamable - << QMediaPlayer::StoppedState // state - << QMediaPlayer::LoadedMedia // status - << QMediaContent(QUrl::fromLocalFile(TestFilePath + "test_mp4.mp4")) // mediaContent - << qint64(2701) // duration - << qint64(1351) // position (duration/2) - << true // seekable - << true // seekableWhilePlaying - << 50 // volume - << true // videoAvailable - << false //audioAvailable - << qreal(0) // playbackRate - << QMediaPlayer::FormatError // error - << QString(); // errorString - - QTest::newRow("test_MP4.dat") - << false //valid - << false //streamable - << QMediaPlayer::StoppedState // state - << QMediaPlayer::InvalidMedia // status - << QMediaContent(QUrl::fromLocalFile(TestFilePath + "test_MP4.dat")) // mediaContent - << qint64(-1) // duration - << qint64(0) // position (duration/2) - << true // seekable - << true // seekableWhilePlaying - << 50 // volume - << true // videoAvailable - << false //audioAvailable - << qreal(0) // playbackRate - << QMediaPlayer::AccessDeniedError// error - << QString(); // errorString - - QTest::newRow("test_wmv9.wmv") - << true //valid - << false //streamable - << QMediaPlayer::StoppedState // state - << QMediaPlayer::LoadedMedia // status - << QMediaContent(QUrl::fromLocalFile(TestFilePath + "test_wmv9.wmv")) // mediaContent - << qint64(169389) // duration - << qint64(84695) // position (duration/2) - << true // seekable - << true // seekableWhilePlaying - << 50 // volume - << true // videoAvailable - << false //audioAvailable - << qreal(0) // playbackRate - << QMediaPlayer::FormatError // error - << QString(); // errorString - - QTest::newRow("test_h264_qcif.264") - << false //valid - << false //streamable - << QMediaPlayer::StoppedState // state - << QMediaPlayer::InvalidMedia // status - << QMediaContent(QUrl::fromLocalFile(TestFilePath + "test_h264_qcif.264")) // mediaContent - << qint64(-1) // duration - << qint64(0) // position (duration/2) - << true // seekable - << true // seekableWhilePlaying - << 50 // volume - << false // videoAvailable - << false //audioAvailable - << qreal(0) // playbackRate - << QMediaPlayer::ResourceError // error - << QString(); // errorString - - QTest::newRow("test_RM.dat") - << true //valid - << false //streamable - << QMediaPlayer::StoppedState // state - << QMediaPlayer::LoadedMedia // status - << QMediaContent(QUrl::fromLocalFile(TestFilePath + "test_RM.dat")) // mediaContent - << qint64(20245) // duration - << qint64(10123) // position (duration/2) - << true // seekable - << true // seekableWhilePlaying - << 50 // volume - << true // videoAvailable - << true //audioAvailable - << qreal(0) // playbackRate - << QMediaPlayer::NoError // error - << QString(); // errorString - - QTest::newRow("test_SWF.dat") - << false //valid - << false //streamable - << QMediaPlayer::StoppedState // state - << QMediaPlayer::InvalidMedia // status - << QMediaContent(QUrl::fromLocalFile(TestFilePath + "test_SWF.dat")) // mediaContent - << qint64(-1) // duration - << qint64(0) // position (duration/2) - << true // seekable - << true // seekableWhilePlaying - << 50 // volume - << false // videoAvailable - << false //audioAvailable - << qreal(0) // playbackRate - << QMediaPlayer::ResourceError // error - << QString(); // errorString - - QTest::newRow("test_WMV.dat") - << true //valid - << false //streamable - << QMediaPlayer::StoppedState // state - << QMediaPlayer::LoadedMedia // status - << QMediaContent(QUrl::fromLocalFile(TestFilePath + "test_WMV.dat")) // mediaContent - << qint64(3098) // duration - << qint64(1549) // position (duration/2) - << true // seekable - << true // seekableWhilePlaying, on emulator codec leaks memory and causes alloc panic on dtor - << 50 // volume - << true // videoAvailable - << false //audioAvailable - << qreal(0) // playbackRate - << QMediaPlayer::FormatError // error - << QString(); // errorString - - QTest::newRow("test_WMA.dat") - << false //valid - << false //streamable - << QMediaPlayer::StoppedState // state - << QMediaPlayer::InvalidMedia // status - << QMediaContent(QUrl::fromLocalFile(TestFilePath + "test_WMA.dat")) // mediaContent - << qint64(-1) // duration - << qint64(0) // position (duration/2) - << true // seekable - << true // seekableWhilePlaying - << 50 // volume - << true // videoAvailable - << false //audioAvailable - << qreal(0) // playbackRate - << QMediaPlayer::AccessDeniedError // error - << QString(); // errorString - - QTest::newRow("test_flash_video.flv") - << false // valid - << false //streamable - << QMediaPlayer::StoppedState // state - << QMediaPlayer::InvalidMedia // status - << QMediaContent(QUrl::fromLocalFile(TestFilePath + "test_flash_video.flv")) // mediaContent - << qint64(-1) // duration - << qint64(0) // position - << true // seekable - << true // seekableWhilePlaying - << 50 // volume - << false // videoAvailable - << false //audioAvailable - << qreal(0) // playbackRate - << QMediaPlayer::ResourceError // error - << QString(); // errorString - - QTest::newRow("test_MXMF.dat") - << true //valid - << false //streamable - << QMediaPlayer::StoppedState // state - << QMediaPlayer::LoadedMedia // status - << QMediaContent(QUrl::fromLocalFile(TestFilePath + "test_MXMF.dat")) // mediaContent - << qint64(31980) // duration - << qint64(15990) // position (duration/2) - << true // seekable - << true // seekableWhilePlaying - << 50 // volume - << false // videoAvailable - << true //audioAvailable - << qreal(0) // playbackRate - << QMediaPlayer::NoError // error - << QString(); // errorString - - QTest::newRow("test_amr.amr") - << true // valid - << false //streamable - << QMediaPlayer::StoppedState // state - << QMediaPlayer::LoadedMedia // status - << QMediaContent(QUrl::fromLocalFile(TestFilePath + "test_amr.amr")) // mediaContent - << qint64(14402) // duration - << qint64(7200) // position - << true // seekable - << true // seekableWhilePlaying - << 50 // volume - << false // videoAvailable - << true // audioAvailable - << qreal(0) // playbackRate - << QMediaPlayer::NoError // error - << QString(); // errorString - - QTest::newRow("test_AMR.dat") - << true // valid - << false //streamable - << QMediaPlayer::StoppedState // state - << QMediaPlayer::LoadedMedia // status - << QMediaContent(QUrl::fromLocalFile(TestFilePath + "test_AMR.dat")) // mediaContent - << qint64(38509) // duration - << qint64(19255) // position - << true // seekable - << true // seekableWhilePlaying - << 50 // volume - << false // videoAvailable - << true // audioAvailable - << qreal(0) // playbackRate - << QMediaPlayer::NoError // error - << QString(); // errorString - - QTest::newRow("test_mp3.mp3") - << false // valid - << false //streamable - << QMediaPlayer::StoppedState // state - << QMediaPlayer::LoadedMedia // status - << QMediaContent(QUrl::fromLocalFile(TestFilePath + "test_mp3.mp3")) // mediaContent - << qint64(-1) //qint64(102044) duration - << qint64(0) // position - << true // seekable - << true // seekableWhilePlaying - << 50 // volume - << false // videoAvailable - << false // audioAvailable - << qreal(0) // playbackRate - << QMediaPlayer::ResourceError // error - << QString(); // errorString - - QTest::newRow("test_MP3.dat") - << false // valid - << false //streamable - << QMediaPlayer::StoppedState // state - << QMediaPlayer::InvalidMedia // status - << QMediaContent(QUrl::fromLocalFile(TestFilePath + "test_MP3.dat")) // mediaContent - << qint64(-1) //qint64(102044) duration - << qint64(0) // position - << true // seekable - << true // seekableWhilePlaying - << 50 // volume - << false // videoAvailable - << false // audioAvailable - << qreal(0) // playbackRate - << QMediaPlayer::ResourceError // error - << QString(); // errorString - - QTest::newRow("test_MIDI.dat") - << true // valid - << false //streamable - << QMediaPlayer::StoppedState // state - << QMediaPlayer::LoadedMedia // status - << QMediaContent(QUrl::fromLocalFile(TestFilePath + "test_MIDI.dat")) // mediaContent - << qint64(32782) // duration - << qint64(16391) // position - << true // seekable - << true // seekableWhilePlaying - << 50 // volume - << false // videoAvailable - << true // audioAvailable - << qreal(0) // playbackRate - << QMediaPlayer::NoError // error - << QString(); // errorString - - QTest::newRow("test_ACC.dat") - << false // valid - << false //streamable - << QMediaPlayer::StoppedState // state - << QMediaPlayer::InvalidMedia // status - << QMediaContent(QUrl::fromLocalFile(TestFilePath + "test_ACC.dat")) // mediaContent - << qint64(-1) // duration - << qint64(0) // position - << true // seekable - << true // seekableWhilePlaying - << 50 // volume - << false // videoAvailable - << false // audioAvailable - << qreal(0) // playbackRate - << QMediaPlayer::ResourceError // error - << QString(); // errorString - - QTest::newRow("test_WAV.dat") - << true // valid - << false //streamable - << QMediaPlayer::StoppedState // state - << QMediaPlayer::LoadedMedia // status - << QMediaContent(QUrl::fromLocalFile(TestFilePath + "test_WAV.dat")) // mediaContent - << qint64(2864) // duration - << qint64(1432) // position - << true // seekable - << true // seekableWhilePlaying - << 50 // volume - << false // videoAvailable - << true // audioAvailable - << qreal(0) // playbackRate - << QMediaPlayer::NoError // error - << QString(); // errorString - -#ifdef TEST_DEVICE_HAS_NETWORK_ACCESS - QTest::newRow("test_stream") - << false // valid - << true //streamable - << QMediaPlayer::StoppedState // state - << QMediaPlayer::LoadedMedia // status - << QMediaContent(QUrl("rtsp://v3.cache4.c.youtube.com/CkgLENy73wIaPwlU2rm7yu8PFhMYESARFEIJbXYtZ29vZ2xlSARSB3JlbGF0ZWRaDkNsaWNrVGh1bWJuYWlsYPi6_IXT2rvpSgw=/0/0/0/video.3gp")) // mediaContent - << qint64(-1) // duration - << qint64(0) // position - << false // seekable - << false // seekableWhilePlaying - << 50 // volume - << true // videoAvailable - << false // audioAvailable - << qreal(0) // playbackRate - << QMediaPlayer::AccessDeniedError // error - << QString(); // errorString -#endif -} - -void tst_QMediaPlayer_s60::initTestCase() -{ - m_player = new QMediaPlayer(); - - // Symbian back end needs coecontrol for creation. - m_widget = new QVideoWidget(); - m_player->setVideoOutput(m_widget); - m_widget->show(); - runonce = false; -} - -void tst_QMediaPlayer_s60::cleanupTestCase() -{ - delete m_player; - delete m_widget; -} - -void tst_QMediaPlayer_s60::init() -{ - qRegisterMetaType<QMediaPlayer::State>("QMediaPlayer::State"); - qRegisterMetaType<QMediaPlayer::Error>("QMediaPlayer::Error"); - qRegisterMetaType<QMediaPlayer::MediaStatus>("QMediaPlayer::MediaStatus"); - qRegisterMetaType<QMediaContent>("QMediaContent"); -} - -void tst_QMediaPlayer_s60::cleanup() -{ -} - -void tst_QMediaPlayer_s60::testNullService() -{ - if(runonce) - return; - MockProvider_s60 provider(0); - QMediaPlayer player(0, 0, &provider); - - const QIODevice *nullDevice = 0; - - QCOMPARE(player.media(), QMediaContent()); - QCOMPARE(player.mediaStream(), nullDevice); - QCOMPARE(player.state(), QMediaPlayer::StoppedState); - QCOMPARE(player.mediaStatus(), QMediaPlayer::UnknownMediaStatus); - QCOMPARE(player.duration(), qint64(-1)); - QCOMPARE(player.position(), qint64(0)); - QCOMPARE(player.volume(), 0); - QCOMPARE(player.isMuted(), false); - QCOMPARE(player.isVideoAvailable(), false); - QCOMPARE(player.bufferStatus(), 0); - QCOMPARE(player.isSeekable(), false); - QCOMPARE(player.playbackRate(), qreal(0)); - QCOMPARE(player.error(), QMediaPlayer::ServiceMissingError); - - { - QFETCH_GLOBAL(QMediaContent, mediaContent); - - QSignalSpy spy(&player, SIGNAL(mediaChanged(QMediaContent))); - QFile file; - - player.setMedia(mediaContent, &file); - QCOMPARE(player.media(), QMediaContent()); - QCOMPARE(player.mediaStream(), nullDevice); - QCOMPARE(spy.count(), 0); - } { - QSignalSpy stateSpy(&player, SIGNAL(stateChanged(QMediaPlayer::State))); - QSignalSpy statusSpy(&player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus))); - - player.play(); - QCOMPARE(player.state(), QMediaPlayer::StoppedState); - QCOMPARE(player.mediaStatus(), QMediaPlayer::UnknownMediaStatus); - QCOMPARE(stateSpy.count(), 0); - QCOMPARE(statusSpy.count(), 0); - - player.pause(); - QCOMPARE(player.state(), QMediaPlayer::StoppedState); - QCOMPARE(player.mediaStatus(), QMediaPlayer::UnknownMediaStatus); - QCOMPARE(stateSpy.count(), 0); - QCOMPARE(statusSpy.count(), 0); - - player.stop(); - QCOMPARE(player.state(), QMediaPlayer::StoppedState); - QCOMPARE(player.mediaStatus(), QMediaPlayer::UnknownMediaStatus); - QCOMPARE(stateSpy.count(), 0); - QCOMPARE(statusSpy.count(), 0); - } { - QFETCH_GLOBAL(int, volume); - - QSignalSpy volumeSpy(&player, SIGNAL(volumeChanged(int))); - QSignalSpy mutingSpy(&player, SIGNAL(mutedChanged(bool))); - - player.setVolume(volume); - QCOMPARE(player.volume(), 0); - QCOMPARE(volumeSpy.count(), 0); - - player.setMuted(false); - QCOMPARE(player.isMuted(), false); - QCOMPARE(mutingSpy.count(), 0); - } { - QFETCH_GLOBAL(qint64, position); - - QSignalSpy spy(&player, SIGNAL(positionChanged(qint64))); - - player.setPosition(position); - QCOMPARE(player.position(), qint64(0)); - QCOMPARE(spy.count(), 0); - } { - QFETCH_GLOBAL(qreal, playbackRate); - - QSignalSpy spy(&player, SIGNAL(playbackRateChanged(qreal))); - - player.setPlaybackRate(playbackRate); - QCOMPARE(player.playbackRate(), qreal(0)); - QCOMPARE(spy.count(), 0); - } { - QMediaPlaylist playlist; - player.setPlaylist(&playlist); - - QSignalSpy mediaSpy(&player, SIGNAL(mediaChanged(QMediaContent))); - QSignalSpy statusSpy(&player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus))); - - playlist.addMedia(QUrl("http://example.com/stream")); - playlist.addMedia(QUrl("file:///some.mp3")); - - playlist.setCurrentIndex(0); - QCOMPARE(playlist.currentIndex(), 0); - QCOMPARE(player.media(), QMediaContent()); - QCOMPARE(mediaSpy.count(), 0); - QCOMPARE(statusSpy.count(), 0); - - playlist.next(); - QCOMPARE(playlist.currentIndex(), 1); - QCOMPARE(player.media(), QMediaContent()); - QCOMPARE(mediaSpy.count(), 0); - QCOMPARE(statusSpy.count(), 0); - } - runonce = true; -} - -void tst_QMediaPlayer_s60::testMedia() -{ - QFETCH_GLOBAL(QMediaContent, mediaContent); - m_player->setMedia(mediaContent); - QTest::qWait(500); - QCOMPARE(m_player->media(), mediaContent); -} - - -void tst_QMediaPlayer_s60::testDuration() -{ - QFETCH_GLOBAL(QMediaContent, mediaContent); - QFETCH_GLOBAL(qint64, duration); - QFETCH_GLOBAL(bool, valid); - - QSignalSpy spy(m_player, SIGNAL(durationChanged(qint64))); - m_player->setMedia(mediaContent); - - if(valid) { - WAIT_FOR_CONDITION(spy.count(), 1); - } else { - WAIT_FOR_CONDITION(m_player->mediaStatus(), (QMediaPlayer::NoMedia || QMediaPlayer::InvalidMedia)); - } - - QVERIFY(m_player->duration() == duration); -} - -void tst_QMediaPlayer_s60::testPosition() -{ - QFETCH_GLOBAL(QMediaContent, mediaContent); - QFETCH_GLOBAL(qint64, duration); - QFETCH_GLOBAL(bool, valid); - QFETCH_GLOBAL(bool, seekable); - QFETCH_GLOBAL(qint64, position); - QFETCH_GLOBAL(QMediaPlayer::MediaStatus, status); - - m_player->setMedia(mediaContent); - - if (valid) { - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - - QCOMPARE(m_player->isSeekable(), seekable); - //QCOMPARE(m_player->mediaStatus(), status); - QVERIFY(m_player->mediaStatus() == status); - - // preset position - { QSignalSpy spy(m_player, SIGNAL(positionChanged(qint64))); - m_player->setPosition(position); - QCOMPARE(m_player->position(), position); - QCOMPARE(spy.count(), 1); - QCOMPARE(spy.at(0).at(0).toLongLong(), position);} - - // same pos second time - { QSignalSpy spy(m_player, SIGNAL(positionChanged(qint64))); - m_player->setPosition(position); - QCOMPARE(m_player->position(), position); - QCOMPARE(spy.count(), 0);} - - //zero pos - { QSignalSpy spy(m_player, SIGNAL(positionChanged(qint64))); - m_player->setPosition(0); - QCOMPARE(m_player->position(), qint64(0)); - QCOMPARE(spy.count(), 1); - QCOMPARE(spy.at(0).at(0).toLongLong(), qint64(0));} - - //end pos - { QSignalSpy spy(m_player, SIGNAL(positionChanged(qint64))); - m_player->setPosition(duration); - QCOMPARE(m_player->position(), duration); - QCOMPARE(spy.count(), 1); - QCOMPARE(spy.at(0).at(0).toLongLong(), duration);} - - //negative pos - { QSignalSpy spy(m_player, SIGNAL(positionChanged(qint64))); - m_player->setPosition(qint64(-1)); - QCOMPARE(m_player->position(), qint64(0)); - QCOMPARE(spy.count(), 1); - QCOMPARE(spy.at(0).at(0).toLongLong(), qint64(0));} - - //over duration - { QSignalSpy spy(m_player, SIGNAL(positionChanged(qint64))); - m_player->setPosition(duration+1); - QCOMPARE(m_player->position(), duration); - QCOMPARE(spy.count(), 1); - QCOMPARE(spy.at(0).at(0).toLongLong(), duration);} - - } else { - if (valid) - WAIT_LONG_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::LoadedMedia) - else - WAIT_FOR_CONDITION(m_player->mediaStatus(), (QMediaPlayer::NoMedia || QMediaPlayer::InvalidMedia)) - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - QCOMPARE(m_player->isSeekable(), seekable); - QCOMPARE(m_player->mediaStatus(), status); - } -} - -void tst_QMediaPlayer_s60::testPositionWhilePlaying() -{ - QFETCH_GLOBAL(QMediaContent, mediaContent); - QFETCH_GLOBAL(qint64, duration); - QFETCH_GLOBAL(bool, seekableWhilePlaying); - QFETCH_GLOBAL(bool, seekable); - QFETCH_GLOBAL(qint64, position); - QFETCH_GLOBAL(bool, valid); - QFETCH_GLOBAL(bool, streamable); - QFETCH_GLOBAL(QMediaPlayer::MediaStatus, status); - - m_player->setMedia(mediaContent); - - if (streamable) { - WAIT_LONG_FOR_CONDITION(m_player->mediaStatus(), (QMediaPlayer::NoMedia || QMediaPlayer::InvalidMedia || QMediaPlayer::LoadedMedia)); - } else { - WAIT_FOR_CONDITION(m_player->mediaStatus(), (QMediaPlayer::NoMedia || QMediaPlayer::InvalidMedia || QMediaPlayer::LoadedMedia)); - } - - //qDebug()<<""; - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - QCOMPARE(m_player->isSeekable(), seekable); - QCOMPARE(m_player->mediaStatus(), status); - - if (seekableWhilePlaying && valid) { - QCOMPARE(m_player->isSeekable(), seekableWhilePlaying); - - // preset position - //qDebug()<<"preset"; - { QSignalSpy spy(m_player, SIGNAL(positionChanged(qint64))); - m_player->play(); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::BufferedMedia); - QCOMPARE(m_player->state(), QMediaPlayer::PlayingState); - m_player->setPosition(position); - WAIT_FOR_CONDITION(spy.count(), 2); - QVERIFY(m_player->mediaStatus() == QMediaPlayer::BufferingMedia || - m_player->mediaStatus() == QMediaPlayer::BufferedMedia || - m_player->mediaStatus() == QMediaPlayer::EndOfMedia || - m_player->mediaStatus() == QMediaPlayer::LoadedMedia); - - QCOMPARE(m_player->state(), QMediaPlayer::PlayingState); - QVERIFY(m_player->position()>=position); - QVERIFY(spy.count()!=0);} - - //reset position - m_player->stop(); - m_player->setPosition(position); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - - //zero pos - //qDebug()<<"zero"; - { QSignalSpy spy(m_player, SIGNAL(positionChanged(qint64))); - m_player->play(); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::BufferedMedia); - QCOMPARE(m_player->state(), QMediaPlayer::PlayingState); - m_player->setPosition(0); - WAIT_FOR_CONDITION(spy.count(), 2); - QVERIFY(m_player->mediaStatus() == QMediaPlayer::BufferingMedia || - m_player->mediaStatus() == QMediaPlayer::BufferedMedia || - m_player->mediaStatus() == QMediaPlayer::EndOfMedia || - m_player->mediaStatus() == QMediaPlayer::LoadedMedia); - QCOMPARE(m_player->state(), QMediaPlayer::PlayingState); - QVERIFY(m_player->position() >= qint64(0)); - QVERIFY(spy.count()!=0);} - - //reset position - m_player->stop(); - m_player->setPosition(position); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - - //end pos - //qDebug()<<"dur"; - { QSignalSpy spy(m_player, SIGNAL(positionChanged(qint64))); - m_player->play(); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::BufferedMedia); - QCOMPARE(m_player->state(), QMediaPlayer::PlayingState); - m_player->setPosition(duration); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::EndOfMedia); - QCOMPARE(m_player->mediaStatus(), QMediaPlayer::EndOfMedia); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - QCOMPARE(m_player->position(), qint64(0)); - QVERIFY(spy.count()!=0);} - - //reset position - m_player->stop(); - m_player->setPosition(position); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - - //negative pos - //qDebug()<<"negavite"; - { QSignalSpy spy(m_player, SIGNAL(positionChanged(qint64))); - m_player->play(); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::BufferedMedia); - QCOMPARE(m_player->state(), QMediaPlayer::PlayingState); - m_player->setPosition(qint64(-1)); - WAIT_FOR_CONDITION(spy.count(), 2); - QVERIFY(m_player->mediaStatus() == QMediaPlayer::BufferingMedia || - m_player->mediaStatus() == QMediaPlayer::BufferedMedia || - m_player->mediaStatus() == QMediaPlayer::EndOfMedia || - m_player->mediaStatus() == QMediaPlayer::LoadedMedia); - QCOMPARE(m_player->state(), QMediaPlayer::PlayingState); - QVERIFY(m_player->position() >= qint64(0)); - QVERIFY(spy.count()!=0);} - - //reset position - m_player->stop(); - m_player->setPosition(position); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - - //over duration - //qDebug()<<"over"; - { QSignalSpy spy(m_player, SIGNAL(positionChanged(qint64))); - m_player->play(); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::BufferedMedia); - QCOMPARE(m_player->state(), QMediaPlayer::PlayingState); - m_player->setPosition(duration+1); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::EndOfMedia); - QCOMPARE(m_player->mediaStatus(), QMediaPlayer::EndOfMedia); - // s60 MP3 controller has a weard feature to reduce position by ~200 when position - // is set over the duration, therefore we skip it here - if (!mediaContent.canonicalUrl().path().endsWith("mp3")) { - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - QCOMPARE(m_player->position(), qint64(0)); - QVERIFY(spy.count()!=0);} - } - } else - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - - m_player->stop(); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - //qDebug()<<"end"; -} - - -void tst_QMediaPlayer_s60::testVolume() -{ - QFETCH_GLOBAL(int, volume); - - // preset volume - { QSignalSpy spy(m_player, SIGNAL(volumeChanged(int))); - m_player->setVolume(volume); - QCOMPARE(m_player->volume(), volume); - QCOMPARE(m_player->isMuted(), false); - QCOMPARE(spy.count(), 1);} - - // same volume - { QSignalSpy spy(m_player, SIGNAL(volumeChanged(int))); - int currentVolume = m_player->volume(); - m_player->setVolume(currentVolume); - QCOMPARE(m_player->volume(), currentVolume); - QCOMPARE(m_player->isMuted(), false); - QCOMPARE(spy.count(), 0);} - - // zero volume - { QSignalSpy spy(m_player, SIGNAL(volumeChanged(int))); - m_player->setVolume(0); - QCOMPARE(m_player->volume(), 0); - QCOMPARE(m_player->isMuted(), false); - QCOMPARE(spy.count(), 1);} - - // max volume - { QSignalSpy spy(m_player, SIGNAL(volumeChanged(int))); - m_player->setVolume(100); - QCOMPARE(m_player->volume(), 100); - QCOMPARE(m_player->isMuted(), false); - QCOMPARE(spy.count(), 1);} - - // negative volume - { QSignalSpy spy(m_player, SIGNAL(volumeChanged(int))); - m_player->setVolume(int(-1)); - QCOMPARE(m_player->volume(), 0); - QCOMPARE(m_player->isMuted(), false); - QCOMPARE(spy.count(), 1);} - - // over max volume - { QSignalSpy spy(m_player, SIGNAL(volumeChanged(int))); - m_player->setVolume(1000); - QCOMPARE(m_player->volume(), 100); - QCOMPARE(m_player->isMuted(), false); - QCOMPARE(spy.count(), 1);} -} - -void tst_QMediaPlayer_s60::testVolumeWhilePlaying() -{ - QFETCH_GLOBAL(QMediaContent, mediaContent); - QFETCH_GLOBAL(int, volume); - QFETCH_GLOBAL(bool, valid); - - if (valid) { - m_player->setMedia(mediaContent); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - - m_player->play(); - QCOMPARE(m_player->state(), QMediaPlayer::PlayingState); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::BufferedMedia); - - // preset volume - { QSignalSpy spy(m_player, SIGNAL(volumeChanged(int))); - m_player->setVolume(volume); - QCOMPARE(m_player->volume(), volume); - QCOMPARE(m_player->isMuted(), false); - QCOMPARE(spy.count(), 1);} - - // same volume - { QSignalSpy spy(m_player, SIGNAL(volumeChanged(int))); - int currentVolume = m_player->volume(); - m_player->setVolume(currentVolume); - QCOMPARE(m_player->volume(), currentVolume); - QCOMPARE(m_player->isMuted(), false); - QCOMPARE(spy.count(), 0);} - - // zero volume - { QSignalSpy spy(m_player, SIGNAL(volumeChanged(int))); - m_player->setVolume(0); - QCOMPARE(m_player->volume(), 0); - QCOMPARE(m_player->isMuted(), false); - QCOMPARE(spy.count(), 1);} - - // max volume - { QSignalSpy spy(m_player, SIGNAL(volumeChanged(int))); - m_player->setVolume(100); - QCOMPARE(m_player->volume(), 100); - QCOMPARE(m_player->isMuted(), false); - QCOMPARE(spy.count(), 1);} - - // negative volume - { QSignalSpy spy(m_player, SIGNAL(volumeChanged(int))); - m_player->setVolume(int(-1)); - QCOMPARE(m_player->volume(), 0); - QCOMPARE(m_player->isMuted(), false); - QCOMPARE(spy.count(), 1);} - - // over max volume - { QSignalSpy spy(m_player, SIGNAL(volumeChanged(int))); - m_player->setVolume(1000); - QCOMPARE(m_player->volume(), 100); - QCOMPARE(m_player->isMuted(), false); - QCOMPARE(spy.count(), 1);} - - m_player->stop(); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - } -} - - -void tst_QMediaPlayer_s60::testMuted() -{ - QFETCH_GLOBAL(int, volume); - - //reset mute & volume - m_player->setMuted(false); - m_player->setVolume(0); - QVERIFY(m_player->isMuted() == false); - QCOMPARE(m_player->volume(), 0); - - // set muted - {QSignalSpy spy(m_player, SIGNAL(mutedChanged(bool))); - m_player->setMuted(true); - QCOMPARE(spy.count(), 1); - QVERIFY(m_player->isMuted() == true);} - - // set muted again - {QSignalSpy spy(m_player, SIGNAL(mutedChanged(bool))); - m_player->setMuted(true); - QCOMPARE(spy.count(), 0); - QVERIFY(m_player->isMuted() == true);} - - // unmute - {QSignalSpy spy(m_player, SIGNAL(mutedChanged(bool))); - m_player->setMuted(false); - QCOMPARE(spy.count(), 1); - QVERIFY(m_player->isMuted() == false);} - - // set volume while muted - {QSignalSpy muteSpy(m_player, SIGNAL(mutedChanged(bool))); - QSignalSpy volumeSpy(m_player, SIGNAL(volumeChanged(int))); - m_player->setMuted(true); - m_player->setVolume(volume); - QCOMPARE(m_player->volume(), volume); - QCOMPARE(muteSpy.count(), 1); - QCOMPARE(volumeSpy.count(), 1); - QVERIFY(m_player->isMuted() == true);} -} - -void tst_QMediaPlayer_s60::testMutedWhilePlaying() -{ - QFETCH_GLOBAL(QMediaContent, mediaContent); - QFETCH_GLOBAL(int, volume); - QFETCH_GLOBAL(bool, valid); - - if (valid) { - m_player->setMedia(mediaContent); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - - //reset mute & volume - m_player->setMuted(false); - m_player->setVolume(65); - QVERIFY(m_player->isMuted() == false); - QCOMPARE(m_player->volume(), 65); - - m_player->play(); - QCOMPARE(m_player->state(), QMediaPlayer::PlayingState); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::BufferedMedia); - - // set muted - {QSignalSpy spy(m_player, SIGNAL(mutedChanged(bool))); - m_player->setMuted(true); - QCOMPARE(spy.count(), 1); - QVERIFY(m_player->isMuted() == true);} - - // set muted again - {QSignalSpy spy(m_player, SIGNAL(mutedChanged(bool))); - m_player->setMuted(true); - QCOMPARE(spy.count(), 0); - QVERIFY(m_player->isMuted() == true);} - - // unmute - {QSignalSpy spy(m_player, SIGNAL(mutedChanged(bool))); - m_player->setMuted(false); - QCOMPARE(spy.count(), 1); - QVERIFY(m_player->isMuted() == false);} - - // set volume while muted - {QSignalSpy muteSpy(m_player, SIGNAL(mutedChanged(bool))); - QSignalSpy volumeSpy(m_player, SIGNAL(volumeChanged(int))); - m_player->setMuted(true); - m_player->setVolume(volume); - QCOMPARE(m_player->volume(), volume); - QCOMPARE(muteSpy.count(), 1); - QCOMPARE(volumeSpy.count(), 1); - QVERIFY(m_player->isMuted() == true);} - - m_player->stop(); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - } -} - - -void tst_QMediaPlayer_s60::testVideoAndAudioAvailability() -{ - QFETCH_GLOBAL(bool, videoAvailable); - QFETCH_GLOBAL(bool, audioAvailable); - QFETCH_GLOBAL(bool, valid); - QFETCH_GLOBAL(QMediaContent, mediaContent); - - if(valid) { - QSignalSpy audioAvailableSpy(m_player, SIGNAL(audioAvailableChanged(bool))); - QSignalSpy videoAvailableSpy(m_player, SIGNAL(videoAvailableChanged(bool))); - - m_player->setMedia(mediaContent); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - - QVERIFY(m_player->isVideoAvailable() == videoAvailable); - QVERIFY(m_player->isAudioAvailable() == audioAvailable); - - QCOMPARE(audioAvailableSpy.count(), 1); - QCOMPARE(videoAvailableSpy.count(), 1); - } -} - -void tst_QMediaPlayer_s60::testError() -{ - QFETCH_GLOBAL(QMediaPlayer::Error, error); - QFETCH_GLOBAL(bool, videoAvailable); - QFETCH_GLOBAL(bool, audioAvailable); - QFETCH_GLOBAL(bool, valid); - QFETCH_GLOBAL(QMediaContent, mediaContent); - QFETCH_GLOBAL(QMediaPlayer::State, state); - QFETCH_GLOBAL(QMediaPlayer::MediaStatus, status); - - QSignalSpy errorSpy(m_player, SIGNAL(error(QMediaPlayer::Error))); - m_player->setMedia(mediaContent); - WAIT_FOR_CONDITION(m_player->mediaStatus(), (QMediaPlayer::NoMedia || QMediaPlayer::InvalidMedia || QMediaPlayer::LoadedMedia)); - QVERIFY(m_player->mediaStatus() == status); - QVERIFY(m_player->state() == state); - QVERIFY(m_player->error() == error); - if (error != QMediaPlayer::NoError) { - QVERIFY(errorSpy.count()!=0); - } -} - -void tst_QMediaPlayer_s60::testPlay() -{ - QFETCH_GLOBAL(bool, valid); - QFETCH_GLOBAL(bool, streamable); - QFETCH_GLOBAL(QMediaContent, mediaContent); - QFETCH_GLOBAL(QMediaPlayer::State, state); - - m_player->setMedia(mediaContent); - WAIT_FOR_CONDITION(m_player->mediaStatus(), (QMediaPlayer::NoMedia || QMediaPlayer::InvalidMedia || QMediaPlayer::LoadedMedia)); - QVERIFY(m_player->state() == state); - QVERIFY(m_player->media() == mediaContent); - QSignalSpy spy(m_player, SIGNAL(stateChanged(QMediaPlayer::State))); - m_player->play(); - - if(valid) { - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::BufferedMedia); - QCOMPARE(m_player->state(), QMediaPlayer::PlayingState); - QCOMPARE(spy.count(), state == QMediaPlayer::PlayingState ? 0 : 1); - - //Play->Play - {QCOMPARE(m_player->state(), QMediaPlayer::PlayingState); - QSignalSpy stateSpy(m_player, SIGNAL(stateChanged(QMediaPlayer::State))); - m_player->play(); - QCOMPARE(m_player->state(), QMediaPlayer::PlayingState); - QCOMPARE(stateSpy.count(), 0);} - - //Play->Pause - {QCOMPARE(m_player->state(), QMediaPlayer::PlayingState); - QSignalSpy stateSpy(m_player, SIGNAL(stateChanged(QMediaPlayer::State))); - m_player->pause(); - QCOMPARE(m_player->state(), QMediaPlayer::PausedState); - QCOMPARE(stateSpy.count(), 1);} - - //Play->Stop - {m_player->play(); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::BufferedMedia); - if (m_player->mediaStatus() != QMediaPlayer::EndOfMedia) { - QCOMPARE(m_player->state(), QMediaPlayer::PlayingState); - QSignalSpy stateSpy(m_player, SIGNAL(stateChanged(QMediaPlayer::State))); - m_player->stop(); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - QCOMPARE(stateSpy.count(), 1); - } else { - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - QCOMPARE(spy.count(), 4); - }} - } else if (streamable) { - m_player->stop(); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - QCOMPARE(spy.count(), 2); - } else { - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - QCOMPARE(spy.count(), 0); - } - - m_player->stop(); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); -} - -void tst_QMediaPlayer_s60::testPause() -{ - QFETCH_GLOBAL(bool, valid); - QFETCH_GLOBAL(bool, streamable); - QFETCH_GLOBAL(QMediaContent, mediaContent); - QFETCH_GLOBAL(QMediaPlayer::State, state); - - m_player->setMedia(mediaContent); - WAIT_FOR_CONDITION(m_player->mediaStatus(), (QMediaPlayer::NoMedia || QMediaPlayer::InvalidMedia || QMediaPlayer::LoadedMedia)); - QVERIFY(m_player->state() == state); - QVERIFY(m_player->media() == mediaContent); - QSignalSpy spy(m_player, SIGNAL(stateChanged(QMediaPlayer::State))); - m_player->pause(); - - if(valid) { - QCOMPARE(m_player->state(), QMediaPlayer::PausedState); - QCOMPARE(spy.count(), 1); - - //Pause->Play - {QCOMPARE(m_player->state(), QMediaPlayer::PausedState); - QSignalSpy stateSpy(m_player, SIGNAL(stateChanged(QMediaPlayer::State))); - m_player->play(); - QCOMPARE(m_player->state(), QMediaPlayer::PlayingState); - QCOMPARE(stateSpy.count(), 1);} - - //Pause->Pause - {m_player->pause(); - QCOMPARE(m_player->state(), QMediaPlayer::PausedState); - QSignalSpy stateSpy(m_player, SIGNAL(stateChanged(QMediaPlayer::State))); - m_player->pause(); - QCOMPARE(m_player->state(), QMediaPlayer::PausedState); - QCOMPARE(stateSpy.count(), 0);} - - //Pause->Stop - {QCOMPARE(m_player->state(), QMediaPlayer::PausedState); - QSignalSpy stateSpy(m_player, SIGNAL(stateChanged(QMediaPlayer::State))); - m_player->stop(); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - QCOMPARE(stateSpy.count(), 1);} - } else if (streamable) { - m_player->stop(); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - QCOMPARE(spy.count(), 2); - } else { - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - QCOMPARE(spy.count(), 0); - } -} - -void tst_QMediaPlayer_s60::testStop() -{ - QFETCH_GLOBAL(bool, valid); - QFETCH_GLOBAL(QMediaContent, mediaContent); - QFETCH_GLOBAL(QMediaPlayer::State, state); - - m_player->setMedia(mediaContent); - WAIT_FOR_CONDITION(m_player->mediaStatus(), (QMediaPlayer::NoMedia || QMediaPlayer::InvalidMedia || QMediaPlayer::LoadedMedia)); - QVERIFY(m_player->state() == state); - QVERIFY(m_player->media() == mediaContent); - - QSignalSpy spy(m_player, SIGNAL(stateChanged(QMediaPlayer::State))); - m_player->stop(); - - if(valid) { - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - QCOMPARE(spy.count(), 0); - - //Stop->Play - {QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - QSignalSpy stateSpy(m_player, SIGNAL(stateChanged(QMediaPlayer::State))); - m_player->play(); - QCOMPARE(m_player->state(), QMediaPlayer::PlayingState); - QCOMPARE(stateSpy.count(), 1);} - - //Stop->Pause - {m_player->stop(); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - QSignalSpy stateSpy(m_player, SIGNAL(stateChanged(QMediaPlayer::State))); - m_player->pause(); - QCOMPARE(m_player->state(), QMediaPlayer::PausedState); - QCOMPARE(stateSpy.count(), 1);} - - //Stop->Stop - {m_player->stop(); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - QSignalSpy stateSpy(m_player, SIGNAL(stateChanged(QMediaPlayer::State))); - m_player->stop(); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - QCOMPARE(stateSpy.count(), 0);} - } else { - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - QCOMPARE(spy.count(), 0); - } -} - -void tst_QMediaPlayer_s60::testMediaStatus() -{ - QFETCH_GLOBAL(bool, videoAvailable); - QFETCH_GLOBAL(bool, valid); - QFETCH_GLOBAL(bool, streamable); - QFETCH_GLOBAL(QMediaContent, mediaContent); - - QSignalSpy statusSpy(m_player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus))); - mediaStatusList list(m_player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus))); - m_player->setMedia(mediaContent); - WAIT_FOR_CONDITION(m_player->mediaStatus(), (QMediaPlayer::NoMedia || QMediaPlayer::InvalidMedia || QMediaPlayer::LoadedMedia)); - - if(valid) { - if (videoAvailable) { - QCOMPARE(statusSpy.count(), 3); - QCOMPARE(list.count(), 3); - QCOMPARE(list.at(0), QMediaPlayer::UnknownMediaStatus); - QCOMPARE(list.at(1), QMediaPlayer::LoadingMedia); - QCOMPARE(list.at(2), QMediaPlayer::LoadedMedia); - QCOMPARE(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - - m_player->play(); - {WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::BufferedMedia);} - QCOMPARE(statusSpy.count(), 5); - QCOMPARE(list.count(), 5); - QCOMPARE(list.at(3), QMediaPlayer::BufferingMedia); - QCOMPARE(list.at(4), QMediaPlayer::BufferedMedia); - QCOMPARE(m_player->mediaStatus(), QMediaPlayer::BufferedMedia); - - {WAIT_LONG_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::EndOfMedia);} - QVERIFY(statusSpy.count() == 6); - QVERIFY(list.count() == 6); - QCOMPARE(list.last(), QMediaPlayer::EndOfMedia); - QCOMPARE(m_player->mediaStatus(), QMediaPlayer::EndOfMedia); - }else { - QCOMPARE(statusSpy.count(), 3); - QCOMPARE(list.count(), 3); - QCOMPARE(list.at(0), QMediaPlayer::UnknownMediaStatus); - QCOMPARE(list.at(1), QMediaPlayer::LoadingMedia); - QCOMPARE(list.at(2), QMediaPlayer::LoadedMedia); - QCOMPARE(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - - m_player->play(); - {WAIT_LONG_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::EndOfMedia);} - QVERIFY(statusSpy.count() == 4); - QVERIFY(list.count() == 4); - QCOMPARE(list.last(), QMediaPlayer::EndOfMedia); - QCOMPARE(m_player->mediaStatus(), QMediaPlayer::EndOfMedia); - } - } else if (mediaContent.isNull()) { - QCOMPARE(statusSpy.count(), 2); - QCOMPARE(list.count(), 2); - QCOMPARE(list.at(0), QMediaPlayer::UnknownMediaStatus); - QCOMPARE(list.at(1), QMediaPlayer::NoMedia); - QCOMPARE(m_player->mediaStatus(), QMediaPlayer::NoMedia); - m_player->play(); - QCOMPARE(statusSpy.count(), 2); - QCOMPARE(list.count(), 2); - QCOMPARE(m_player->mediaStatus(), QMediaPlayer::NoMedia); - } else if (streamable) { - QCOMPARE(statusSpy.count(), 3); - QCOMPARE(list.count(), 3); - QCOMPARE(list.at(0), QMediaPlayer::UnknownMediaStatus); - QCOMPARE(list.at(1), QMediaPlayer::LoadingMedia); - QCOMPARE(list.at(2), QMediaPlayer::LoadedMedia); - QCOMPARE(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - m_player->play(); - QCOMPARE(statusSpy.count(), 3); - QCOMPARE(list.count(), 3); - QCOMPARE(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - } else { - QCOMPARE(statusSpy.count(), 3); - QCOMPARE(list.count(), 3); - QCOMPARE(list.at(0), QMediaPlayer::UnknownMediaStatus); - QCOMPARE(list.at(1), QMediaPlayer::LoadingMedia); - QCOMPARE(list.at(2), QMediaPlayer::InvalidMedia); - QCOMPARE(m_player->mediaStatus(), QMediaPlayer::InvalidMedia); - m_player->play(); - QCOMPARE(statusSpy.count(), 3); - QCOMPARE(list.count(), 3); - QCOMPARE(m_player->mediaStatus(), QMediaPlayer::InvalidMedia); - } - - m_player->stop(); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); -} - -void tst_QMediaPlayer_s60::testPlaylist() -{ - if(!runonce) { - QMediaContent content0(QUrl::fromLocalFile(TestFilePath + "test_mp4.mp4")); - QMediaContent content1(QUrl::fromLocalFile(TestFilePath + "test_WAV.dat")); - QMediaContent content2(QUrl::fromLocalFile(TestFilePath + "test_mp4.mp4")); - QMediaContent content3(QUrl::fromLocalFile(TestFilePath + "test_WAV.dat")); - QMediaContent content4(QUrl::fromLocalFile(TestFilePath + "test_MIDI.dat")); - - QMediaPlaylist *playlist = new QMediaPlaylist(m_player); - m_player->setPlaylist(playlist); - - QSignalSpy stateSpy(m_player, SIGNAL(stateChanged(QMediaPlayer::State))); - QSignalSpy mediaSpy(m_player, SIGNAL(mediaChanged(QMediaContent))); - - // Test the player does nothing with an empty playlist attached. - m_player->play(); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - QCOMPARE(m_player->media(), QMediaContent()); - QCOMPARE(stateSpy.count(), 0); - QCOMPARE(mediaSpy.count(), 0); - - playlist->addMedia(content0); - playlist->addMedia(content1); - playlist->addMedia(content2); - playlist->addMedia(content3); - - // Test changing the playlist position, changes the current media, but not the playing state. - playlist->setCurrentIndex(1); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - QCOMPARE(m_player->media(), content1); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - QCOMPARE(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - QCOMPARE(stateSpy.count(), 0); - QCOMPARE(mediaSpy.count(), 1); - - // Test playing starts with the current media. - m_player->play(); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::BufferedMedia); - QCOMPARE(m_player->media(), content1); - QCOMPARE(m_player->state(), QMediaPlayer::PlayingState); - QVERIFY(m_player->mediaStatus() == (QMediaPlayer::BufferedMedia||QMediaPlayer::BufferingMedia)); - QCOMPARE(stateSpy.count(), 1); - QCOMPARE(mediaSpy.count(), 1); - - // Test pausing doesn't change the current media. - m_player->pause(); - QCOMPARE(m_player->media(), content1); - QCOMPARE(m_player->state(), QMediaPlayer::PausedState); - QVERIFY(m_player->mediaStatus() == (QMediaPlayer::BufferedMedia||QMediaPlayer::BufferingMedia)); - QCOMPARE(stateSpy.count(), 2); - QCOMPARE(mediaSpy.count(), 1); - - // Test stopping doesn't change the current media. - m_player->stop(); - QCOMPARE(m_player->media(), content1); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - QCOMPARE(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - QCOMPARE(stateSpy.count(), 3); - QCOMPARE(mediaSpy.count(), 1); - - // Test when the player service reaches the end of the current media, the player moves onto - // the next item without stopping. - m_player->play(); - QCOMPARE(m_player->media(), content1); - QCOMPARE(m_player->state(), QMediaPlayer::PlayingState); - QCOMPARE(stateSpy.count(), 4); - QCOMPARE(mediaSpy.count(), 1); - - WAIT_FOR_CONDITION(mediaSpy.count(), 2); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::BufferedMedia); - QCOMPARE(m_player->media(), content2); - QCOMPARE(m_player->state(), QMediaPlayer::PlayingState); - QVERIFY(m_player->mediaStatus() == (QMediaPlayer::BufferedMedia||QMediaPlayer::BufferingMedia)); - QCOMPARE(stateSpy.count(), 6); - QCOMPARE(mediaSpy.count(), 2); - - // Test skipping the current media doesn't change the state. - playlist->next(); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::BufferedMedia); - QCOMPARE(m_player->media(), content3); - QCOMPARE(m_player->state(), QMediaPlayer::PlayingState); - QVERIFY(m_player->mediaStatus() == (QMediaPlayer::BufferedMedia||QMediaPlayer::BufferingMedia)); - QCOMPARE(stateSpy.count(), 6); - QCOMPARE(mediaSpy.count(), 3); - - // Test changing the current media while paused doesn't change the state. - m_player->pause(); - QCOMPARE(m_player->media(), content3); - QCOMPARE(m_player->state(), QMediaPlayer::PausedState); - QVERIFY(m_player->mediaStatus() == (QMediaPlayer::BufferedMedia||QMediaPlayer::BufferingMedia)); - QCOMPARE(stateSpy.count(), 7); - QCOMPARE(mediaSpy.count(), 3); - - playlist->previous(); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - QCOMPARE(m_player->media(), content2); - QCOMPARE(m_player->state(), QMediaPlayer::PausedState); - QVERIFY(m_player->mediaStatus() == (QMediaPlayer::BufferedMedia||QMediaPlayer::BufferingMedia)); - QCOMPARE(stateSpy.count(), 7); - QCOMPARE(mediaSpy.count(), 4); - - // Test changing the current media while stopped doesn't change the state. - m_player->stop(); - QCOMPARE(m_player->media(), content2); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - QCOMPARE(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - QCOMPARE(stateSpy.count(), 8); - QCOMPARE(mediaSpy.count(), 4); - - playlist->next(); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - QCOMPARE(m_player->media(), content3); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - QCOMPARE(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - QCOMPARE(stateSpy.count(), 8); - QCOMPARE(mediaSpy.count(), 5); - - // Test the player is stopped and the current media cleared when it reaches the end of the last - // item in the playlist. - m_player->play(); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::BufferedMedia); - QCOMPARE(m_player->media(), content3); - QCOMPARE(m_player->state(), QMediaPlayer::PlayingState); - QVERIFY(m_player->mediaStatus() == (QMediaPlayer::BufferedMedia||QMediaPlayer::BufferingMedia)); - QCOMPARE(stateSpy.count(), 9); - QCOMPARE(mediaSpy.count(), 5); - - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::EndOfMedia); - QCOMPARE(m_player->media(), QMediaContent()); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - QCOMPARE(m_player->mediaStatus(), QMediaPlayer::NoMedia); - QCOMPARE(stateSpy.count(), 10); - QCOMPARE(mediaSpy.count(), 6); - - // Test starts playing from the start of the playlist if there is no current media selected. - m_player->play(); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::BufferedMedia); - QCOMPARE(m_player->media(), content0); - QCOMPARE(m_player->state(), QMediaPlayer::PlayingState); - QVERIFY(m_player->mediaStatus() == (QMediaPlayer::BufferedMedia||QMediaPlayer::BufferingMedia)); - QCOMPARE(stateSpy.count(), 11); - QCOMPARE(mediaSpy.count(), 7); - - // Test deleting the playlist stops the player and clears the media it set. - delete playlist; - QCOMPARE(m_player->media(), QMediaContent()); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - QCOMPARE(m_player->mediaStatus(), QMediaPlayer::NoMedia); - QCOMPARE(stateSpy.count(), 12); - QCOMPARE(mediaSpy.count(), 8); - - // Test the player works as normal with the playlist removed. - m_player->play(); - QCOMPARE(m_player->media(), QMediaContent()); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - QCOMPARE(m_player->mediaStatus(), QMediaPlayer::NoMedia); - QCOMPARE(stateSpy.count(), 12); - QCOMPARE(mediaSpy.count(), 8); - - m_player->setMedia(content1); - m_player->play(); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::BufferedMedia) - QCOMPARE(m_player->media(), content1); - QCOMPARE(m_player->state(), QMediaPlayer::PlayingState); - QVERIFY(m_player->mediaStatus() == (QMediaPlayer::BufferedMedia||QMediaPlayer::BufferingMedia)); - QCOMPARE(stateSpy.count(), 13); - QCOMPARE(mediaSpy.count(), 9); - m_player->stop(); - runonce = true; - } -} - -void tst_QMediaPlayer_s60::testStreamControl() -{ - QFETCH_GLOBAL(bool, valid); - QFETCH_GLOBAL(bool, streamable); - QFETCH_GLOBAL(QMediaContent, mediaContent); - QFETCH_GLOBAL(QMediaPlayer::State, state); - QFETCH_GLOBAL(bool, videoAvailable); - QFETCH_GLOBAL(bool, audioAvailable); - - QMediaStreamsControl* m_streamControl = (QMediaStreamsControl*)(m_player->service()->requestControl(QMediaStreamsControl_iid)); - if(m_streamControl) { - if (valid || streamable) { - if (audioAvailable && !videoAvailable) { - QSignalSpy streamInfoSpy(m_streamControl, SIGNAL(streamsChanged())); - m_player->setMedia(mediaContent); - WAIT_FOR_CONDITION(m_player->mediaStatus(), (QMediaPlayer::NoMedia || QMediaPlayer::InvalidMedia || QMediaPlayer::LoadedMedia)); - QVERIFY(m_streamControl->streamCount() == 1); - QVERIFY(m_streamControl->streamType(1) == QMediaStreamsControl::AudioStream); - QVERIFY(m_streamControl->isActive(1) == true); - QCOMPARE(streamInfoSpy.count(), 1); - }else if (audioAvailable && videoAvailable){ - QSignalSpy streamInfoSpy(m_streamControl, SIGNAL(streamsChanged())); - m_player->setMedia(mediaContent); - WAIT_FOR_CONDITION(m_player->mediaStatus(), (QMediaPlayer::NoMedia || QMediaPlayer::InvalidMedia || QMediaPlayer::LoadedMedia)); - QVERIFY(m_streamControl->streamCount() == 2); - QVERIFY(m_streamControl->streamType(1) == QMediaStreamsControl::VideoStream); - QVERIFY(m_streamControl->isActive(2) == true); - QCOMPARE(streamInfoSpy.count(), 1); - }else if (!audioAvailable && videoAvailable) { - QSignalSpy streamInfoSpy(m_streamControl, SIGNAL(streamsChanged())); - m_player->setMedia(mediaContent); - WAIT_FOR_CONDITION(m_player->mediaStatus(), (QMediaPlayer::NoMedia || QMediaPlayer::InvalidMedia || QMediaPlayer::LoadedMedia)); - QVERIFY(m_streamControl->streamCount() == 1); - QVERIFY(m_streamControl->streamType(1) == QMediaStreamsControl::VideoStream); - QVERIFY(m_streamControl->isActive(2) == true); - QCOMPARE(streamInfoSpy.count(), 1); - } - - // Test that streamsChanged signal do not get emitted when adding same media - QSignalSpy streamInfoSpy(m_streamControl, SIGNAL(streamsChanged())); - m_player->setMedia(mediaContent); - WAIT_FOR_CONDITION(m_player->mediaStatus(), (QMediaPlayer::NoMedia || QMediaPlayer::InvalidMedia || QMediaPlayer::LoadedMedia)); - QCOMPARE(streamInfoSpy.count(), 0); - } - } -} diff --git a/tests/auto/qmediaplayer/tst_qmediaplayer_s60.h b/tests/auto/qmediaplayer/tst_qmediaplayer_s60.h deleted file mode 100755 index 1ebe42588..000000000 --- a/tests/auto/qmediaplayer/tst_qmediaplayer_s60.h +++ /dev/null @@ -1,137 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Mobility Components. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef TST_QMEDIAPLAYER_S60_H -#define TST_QMEDIAPLAYER_S60_H - -#include <QtTest/QtTest> -#include <QtCore> -#include <QtGui> -#include <QFile> - -#include <QMediaPlayer> -#include <QMediaPlayerControl> -#include <QMediaPlaylist> -#include <QMediaService> -#include <QMediaStreamsControl> -#include <QVideoWidget> - -QT_USE_NAMESPACE - -#define WAIT_FOR_CONDITION(a,e) \ - for (int _i = 0; _i < 500; _i += 1) { \ - if ((a) == (e)) break; \ - QTest::qWait(10);} - - -#define WAIT_LONG_FOR_CONDITION(a,e) \ - for (int _i = 0; _i < 1800; _i += 1) { \ - if ((a) == (e)) break; \ - QTest::qWait(100);} - -class mediaStatusList : public QObject, public QList<QMediaPlayer::MediaStatus> -{ - Q_OBJECT -public slots: - void mediaStatus(QMediaPlayer::MediaStatus status) { - append(status); - } - -public: - mediaStatusList(QObject *obj, const char *aSignal) - : QObject() - { - connect(obj, aSignal, this, SLOT(mediaStatus(QMediaPlayer::MediaStatus))); - } -}; - -class MockProvider_s60 : public QMediaServiceProvider -{ -public: - MockProvider_s60(QMediaService *service):mockService(service) {} - QMediaService *requestService(const QByteArray &, const QMediaServiceProviderHint &) - { - return mockService; - } - - void releaseService(QMediaService *service) { delete service; } - - QMediaService *mockService; -}; - -class tst_QMediaPlayer_s60: public QObject -{ - Q_OBJECT - -public slots: - void initTestCase_data(); - void initTestCase_data_default_winscw(); - void initTestCase_data_default_armv5(); - void initTestCase(); - void cleanupTestCase(); - void init(); - void cleanup(); - -private slots: - void testNullService(); - void testMedia(); - void testDuration(); - void testPosition(); - void testPositionWhilePlaying(); - void testVolume(); - void testVolumeWhilePlaying(); - void testMuted(); - void testMutedWhilePlaying(); - void testVideoAndAudioAvailability(); - void testError(); - void testPlay(); - void testPause(); - void testStop(); - void testMediaStatus(); - void testPlaylist(); - void testStreamControl(); - -private: - QMediaPlayer *m_player; - QVideoWidget *m_widget; - bool runonce; -}; - -#endif // TST_QMEDIAPLAYER_S60_H diff --git a/tests/auto/qmediaplayer/tst_qmediaplayer_xa.cpp b/tests/auto/qmediaplayer/tst_qmediaplayer_xa.cpp deleted file mode 100644 index 403fe5457..000000000 --- a/tests/auto/qmediaplayer/tst_qmediaplayer_xa.cpp +++ /dev/null @@ -1,1413 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Mobility Components. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "tst_QMediaPlayer_xa.h" - -QT_USE_NAMESPACE - -#define QTEST_MAIN_XA(TestObject) \ - int main(int argc, char *argv[]) { \ - char *new_argv[3]; \ - QApplication app(argc, argv); \ - \ - QString str = "C:\\data\\" + QFileInfo(QCoreApplication::applicationFilePath()).baseName() + ".log"; \ - QByteArray bytes = str.toAscii(); \ - \ - char arg1[] = "-o"; \ - \ - new_argv[0] = argv[0]; \ - new_argv[1] = arg1; \ - new_argv[2] = bytes.data(); \ - \ - TestObject tc; \ - return QTest::qExec(&tc, 3, new_argv); \ - } - -#define WAIT_FOR_CONDITION(a,e) \ - for (int _i = 0; _i < 500; _i += 1) { \ - if ((a) == (e)) break; \ - QTest::qWait(10);} - -#define WAIT_FOR_EITHER_CONDITION(a,e,f) \ - for (int _i = 0; _i < 500; _i += 1) { \ - if (((a) == (e)) || ((a) == (f))) break; \ - QTest::qWait(10);} - -#define WAIT_FOR_CONDITION1(a) \ - for (int _i = 0; _i < 500; _i += 1) { \ - if (a) break; \ - QTest::qWait(10);} - - -#define WAIT_LONG_FOR_CONDITION(a,e) \ - for (int _i = 0; _i < 1800; _i += 1) { \ - if ((a) == (e)) break; \ - QTest::qWait(10);} - -#define WAIT_LONG_FOR_CONDITION1(a) \ - for (int _i = 0; _i < 1800; _i += 1) { \ - if (a) break; \ - QTest::qWait(100);} - -tst_QMediaPlayer_xa::tst_QMediaPlayer_xa(): m_player(NULL), m_widget(NULL), m_windowWidget(NULL) -{ - audioOnlyContent = new QMediaContent(QUrl("file:///C:/data/testfiles/test.mp3")); - videoOnlyContent = new QMediaContent(QUrl("file:///C:/data/testfiles/test_video.3gp")); - audioVideoContent = new QMediaContent(QUrl("file:///C:/data/testfiles/test.3gp")); - audioVideoAltContent = new QMediaContent(QUrl("file:///C:/data/testfiles/test_alt.3gp")); - //streamingContent = new QMediaContent(QUrl("rtsp://10.48.2.51/Copyright_Free_Test_Content/Clips/Video/3GP/176x144/h263/h263_176x144_15fps_384kbps_AAC-LC_128kbps_mono_44.1kHz.3gp")); - streamingContent3gp = new QMediaContent(QUrl("http://www.mobileplayground.co.uk/video/Crazy Frog.3gp")); - audioStreamingContent = new QMediaContent(QUrl("http://myopusradio.com:8000/easy")); - mediaContent = audioVideoContent; -} - -tst_QMediaPlayer_xa::~tst_QMediaPlayer_xa() -{ - delete audioOnlyContent; - delete videoOnlyContent; - delete audioVideoContent; - delete audioVideoAltContent; -} - -void tst_QMediaPlayer_xa::initTestCase_data() -{ -} - -void tst_QMediaPlayer_xa::initTestCase() -{ - m_player = new QMediaPlayer(); - - // Symbian back end needs coecontrol for creation. - m_widget = new QVideoWidget(); - m_widget->setGeometry ( 0, 100, 350, 250 ); - m_player->setVideoOutput(m_widget); - m_widget->showNormal(); -} - -void tst_QMediaPlayer_xa::cleanupTestCase() -{ - delete m_player; - delete m_widget; - delete m_windowWidget; -} - -void tst_QMediaPlayer_xa::resetPlayer() -{ - delete m_player; - m_player = new QMediaPlayer(); - m_player->setVideoOutput(m_widget); -} - -void tst_QMediaPlayer_xa::resetPlayer_WindowControl() -{ - delete m_player; - m_player = new QMediaPlayer(); - - if(!m_windowWidget) { - m_windowWidget = new QWidget(); - m_windowWidget->showMaximized(); - } - - QVideoWindowControl* windowControl = (QVideoWindowControl*)(m_player->service()->requestControl(QVideoWindowControl_iid)); - if (windowControl) - windowControl->setWinId(m_windowWidget->winId()); -} - -void tst_QMediaPlayer_xa::init() -{ - qRegisterMetaType<QMediaPlayer::State>("QMediaPlayer::State"); - qRegisterMetaType<QMediaPlayer::Error>("QMediaPlayer::Error"); - qRegisterMetaType<QMediaPlayer::MediaStatus>("QMediaPlayer::MediaStatus"); - qRegisterMetaType<QMediaContent>("QMediaContent"); - updateLog("QT MediaPlayer Auto Test Cases", true); -} - -void tst_QMediaPlayer_xa::cleanup() -{ -} - - -void tst_QMediaPlayer_xa::testMedia() -{ - updateLog("*****testMedia"); - - setAudioVideoContent(); - - QTest::qWait(500); - QCOMPARE(m_player->media(), *mediaContent); - - updateLog("*****testMedia: PASSED"); -} - - -void tst_QMediaPlayer_xa::testDuration() -{ - updateLog("*****testDuration"); - - resetPlayer(); - - QSignalSpy spy(m_player, SIGNAL(durationChanged(qint64))); - setAudioVideoContent(); - - WAIT_FOR_CONDITION1(spy.count()>0); - - QVERIFY(m_player->duration() == duration); - - updateLog("*****testDuration: PASSED"); -} - -void tst_QMediaPlayer_xa::testPosition() -{ - updateLog("*****testPosition"); - resetPlayer(); - - qint64 position = 60000; - setAudioVideoContent(); - - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - - QCOMPARE(m_player->isSeekable(), true); - - // preset position - { - QSignalSpy spy(m_player, SIGNAL(positionChanged(qint64))); - m_player->setPosition(position); - WAIT_FOR_CONDITION(spy.count(), 1); - QCOMPARE(m_player->position(), position); - QCOMPARE(spy.count(), 1); - QCOMPARE(spy.at(0).at(0).toLongLong(), position); - } - - // same pos second time - { - QSignalSpy spy(m_player, SIGNAL(positionChanged(qint64))); - m_player->setPosition(position); - QCOMPARE(m_player->position(), position); - QCOMPARE(spy.count(), 0); - } - - //zero pos - { - QSignalSpy spy(m_player, SIGNAL(positionChanged(qint64))); - m_player->setPosition(0); - QCOMPARE(m_player->position(), qint64(0)); - QCOMPARE(spy.count(), 1); - QCOMPARE(spy.at(0).at(0).toLongLong(), qint64(0)); - } - - //end pos - { - QSignalSpy spy(m_player, SIGNAL(positionChanged(qint64))); - m_player->setPosition(duration); - QCOMPARE(m_player->position(), duration); - QCOMPARE(spy.count(), 1); - QCOMPARE(spy.at(0).at(0).toLongLong(), duration); - } - - //negative pos - { - QSignalSpy spy(m_player, SIGNAL(positionChanged(qint64))); - m_player->setPosition(qint64(-1)); - QCOMPARE(m_player->position(), qint64(0)); - QCOMPARE(spy.count(), 1); - QCOMPARE(spy.at(0).at(0).toLongLong(), qint64(0)); - } - - //over duration - { - QSignalSpy spy(m_player, SIGNAL(positionChanged(qint64))); - m_player->setPosition(duration+1); - QCOMPARE(m_player->position(), duration); - QCOMPARE(spy.count(), 1); - QCOMPARE(spy.at(0).at(0).toLongLong(), duration); - } - -} - - -void tst_QMediaPlayer_xa::testPositionWhilePlaying() -{ - updateLog("*****testPositionWhilePlaying"); - resetPlayer(); - - qint64 position = 60000; - - setAudioVideoContent(); - - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - - // preset position - { - QSignalSpy spy(m_player, SIGNAL(positionChanged(qint64))); - m_player->play(); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::BufferedMedia); - QCOMPARE(m_player->state(), QMediaPlayer::PlayingState); - m_player->setPosition(position); - WAIT_FOR_CONDITION1(spy.count()>0); - QVERIFY(m_player->mediaStatus() == QMediaPlayer::BufferingMedia || m_player->mediaStatus() == QMediaPlayer::BufferedMedia); - - QCOMPARE(m_player->state(), QMediaPlayer::PlayingState); - QVERIFY(m_player->position()>=position); - QVERIFY(spy.count()!=0); - } - - //reset position - m_player->stop(); - m_player->setPosition(position); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - - //zero pos - { QSignalSpy spy(m_player, SIGNAL(positionChanged(qint64))); - m_player->play(); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::BufferedMedia); - QCOMPARE(m_player->state(), QMediaPlayer::PlayingState); - m_player->setPosition(0); - WAIT_FOR_CONDITION1(spy.count()>0); - QVERIFY(m_player->mediaStatus() == QMediaPlayer::BufferingMedia || - m_player->mediaStatus() == QMediaPlayer::BufferedMedia); - QCOMPARE(m_player->state(), QMediaPlayer::PlayingState); - QVERIFY(m_player->position() >= qint64(0)); - QVERIFY(spy.count()!=0); - } - - //reset position - m_player->stop(); - m_player->setPosition(position); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - - updateLog("*****testPositionWhilePlaying: PASSED"); -} - - -void tst_QMediaPlayer_xa::testVolume() -{ - updateLog("*****testVolume"); - - int volume = 20; - - // preset volume - { - QSignalSpy spy(m_player, SIGNAL(volumeChanged(int))); - m_player->setVolume(volume); - QCOMPARE(m_player->volume(), volume); - QCOMPARE(m_player->isMuted(), false); - QCOMPARE(spy.count(), 1); - } - - // same volume - { - QSignalSpy spy(m_player, SIGNAL(volumeChanged(int))); - int currentVolume = m_player->volume(); - m_player->setVolume(currentVolume); - QCOMPARE(m_player->volume(), currentVolume); - QCOMPARE(m_player->isMuted(), false); - QCOMPARE(spy.count(), 0); - } - - // zero volume - { - QSignalSpy spy(m_player, SIGNAL(volumeChanged(int))); - m_player->setVolume(0); - QCOMPARE(m_player->volume(), 0); - QCOMPARE(m_player->isMuted(), false); - QCOMPARE(spy.count(), 1); - } - - // max volume - { - QSignalSpy spy(m_player, SIGNAL(volumeChanged(int))); - m_player->setVolume(100); - QCOMPARE(m_player->volume(), 100); - QCOMPARE(m_player->isMuted(), false); - QCOMPARE(spy.count(), 1); - } - - // negative volume - { - QSignalSpy spy(m_player, SIGNAL(volumeChanged(int))); - m_player->setVolume(int(-1)); - QCOMPARE(m_player->volume(), 0); - QCOMPARE(m_player->isMuted(), false); - QCOMPARE(spy.count(), 1); - } - - // over max volume - { - QSignalSpy spy(m_player, SIGNAL(volumeChanged(int))); - m_player->setVolume(1000); - QCOMPARE(m_player->volume(), 100); - QCOMPARE(m_player->isMuted(), false); - QCOMPARE(spy.count(), 1); - } - - updateLog("*****testVolume: PASSED"); -} - -void tst_QMediaPlayer_xa::testVolumeWhilePlaying() -{ - updateLog("*****testVideoAndAudioAvailability"); - resetPlayer(); - - int volume = 20; - - setAudioVideoContent(); - - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - - m_player->play(); - QCOMPARE(m_player->state(), QMediaPlayer::PlayingState); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::BufferedMedia); - - // preset volume - { - QSignalSpy spy(m_player, SIGNAL(volumeChanged(int))); - m_player->setVolume(volume); - QCOMPARE(m_player->volume(), volume); - QCOMPARE(m_player->isMuted(), false); - QCOMPARE(spy.count(), 1); - } - - // same volume - { - QSignalSpy spy(m_player, SIGNAL(volumeChanged(int))); - int currentVolume = m_player->volume(); - m_player->setVolume(currentVolume); - QCOMPARE(m_player->volume(), currentVolume); - QCOMPARE(m_player->isMuted(), false); - QCOMPARE(spy.count(), 0); - } - - // zero volume - { - QSignalSpy spy(m_player, SIGNAL(volumeChanged(int))); - m_player->setVolume(0); - QCOMPARE(m_player->volume(), 0); - QCOMPARE(m_player->isMuted(), false); - QCOMPARE(spy.count(), 1); - } - - // max volume - { - QSignalSpy spy(m_player, SIGNAL(volumeChanged(int))); - m_player->setVolume(100); - QCOMPARE(m_player->volume(), 100); - QCOMPARE(m_player->isMuted(), false); - QCOMPARE(spy.count(), 1); - } - - // negative volume - { - QSignalSpy spy(m_player, SIGNAL(volumeChanged(int))); - m_player->setVolume(int(-1)); - QCOMPARE(m_player->volume(), 0); - QCOMPARE(m_player->isMuted(), false); - QCOMPARE(spy.count(), 1); - } - - // over max volume - { - QSignalSpy spy(m_player, SIGNAL(volumeChanged(int))); - m_player->setVolume(1000); - QCOMPARE(m_player->volume(), 100); - QCOMPARE(m_player->isMuted(), false); - QCOMPARE(spy.count(), 1); - } - - m_player->stop(); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - - updateLog("*****testVideoAndAudioAvailability: PASSED"); -} - - -void tst_QMediaPlayer_xa::testMuted() -{ - updateLog("*****testMuted"); - - int volume = 20; - - //reset mute & volume - m_player->setMuted(false); - m_player->setVolume(0); - QVERIFY(m_player->isMuted() == false); - QCOMPARE(m_player->volume(), 0); - - // set muted - { - QSignalSpy spy(m_player, SIGNAL(mutedChanged(bool))); - m_player->setMuted(true); - QCOMPARE(spy.count(), 1); - QVERIFY(m_player->isMuted() == true); - } - - // set muted again - { - QSignalSpy spy(m_player, SIGNAL(mutedChanged(bool))); - m_player->setMuted(true); - QCOMPARE(spy.count(), 0); - QVERIFY(m_player->isMuted() == true); - } - - // unmute - { - QSignalSpy spy(m_player, SIGNAL(mutedChanged(bool))); - m_player->setMuted(false); - QCOMPARE(spy.count(), 1); - QVERIFY(m_player->isMuted() == false); - } - - // set volume while muted - { - QSignalSpy muteSpy(m_player, SIGNAL(mutedChanged(bool))); - QSignalSpy volumeSpy(m_player, SIGNAL(volumeChanged(int))); - m_player->setMuted(true); - m_player->setVolume(volume); - QCOMPARE(m_player->volume(), volume); - QCOMPARE(muteSpy.count(), 1); - QCOMPARE(volumeSpy.count(), 1); - QVERIFY(m_player->isMuted() == true); - } - - updateLog("*****testMuted: PASSED"); -} - -void tst_QMediaPlayer_xa::testMutedWhilePlaying() -{ - updateLog("*****testMutedWhilePlaying"); - resetPlayer(); - - int volume = 20; - - setAudioVideoContent(); - - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - - //reset mute & volume - m_player->setMuted(false); - m_player->setVolume(65); - QVERIFY(m_player->isMuted() == false); - QCOMPARE(m_player->volume(), 65); - - m_player->play(); - QCOMPARE(m_player->state(), QMediaPlayer::PlayingState); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::BufferedMedia); - - // set muted - { - QSignalSpy spy(m_player, SIGNAL(mutedChanged(bool))); - m_player->setMuted(true); - QCOMPARE(spy.count(), 1); - QVERIFY(m_player->isMuted() == true); - } - - // set muted again - { - QSignalSpy spy(m_player, SIGNAL(mutedChanged(bool))); - m_player->setMuted(true); - QCOMPARE(spy.count(), 0); - QVERIFY(m_player->isMuted() == true); - } - - // unmute - { - QSignalSpy spy(m_player, SIGNAL(mutedChanged(bool))); - m_player->setMuted(false); - QCOMPARE(spy.count(), 1); - QVERIFY(m_player->isMuted() == false); - } - - // set volume while muted - { - QSignalSpy muteSpy(m_player, SIGNAL(mutedChanged(bool))); - QSignalSpy volumeSpy(m_player, SIGNAL(volumeChanged(int))); - m_player->setMuted(true); - m_player->setVolume(volume); - QCOMPARE(m_player->volume(), volume); - QCOMPARE(muteSpy.count(), 1); - QCOMPARE(volumeSpy.count(), 1); - QVERIFY(m_player->isMuted() == true); - } - - m_player->stop(); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - - - updateLog("*****testMutedWhilePlaying: PASSED"); -} - -void tst_QMediaPlayer_xa::testVideoAndAudioAvailability() -{ - updateLog("*****testVideoAndAudioAvailability"); - resetPlayer(); - - QList<QVariant> arguments; - - - setVideoOnlyContent(); - - - QSignalSpy audioAvailableSpy(m_player, SIGNAL(audioAvailableChanged(bool))); - QSignalSpy videoAvailableSpy(m_player, SIGNAL(videoAvailableChanged(bool))); - - setAudioOnlyContent(); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - updateLog("SetMedia: audioOnlyContent"); - WAIT_FOR_CONDITION(m_player->isAudioAvailable(), true); - updateLog("\t isAudioAvailable() == true"); - QVERIFY(m_player->isVideoAvailable() == false); - updateLog("\t isVideoAvailable() == false"); - QCOMPARE(audioAvailableSpy.count(), 1); - arguments = audioAvailableSpy.takeFirst(); - QVERIFY(arguments.at(0).toBool() == true); - updateLog("\t audioAvailableChanged(true)"); - QCOMPARE(videoAvailableSpy.count(), 1); - arguments = videoAvailableSpy.takeFirst(); - QVERIFY(arguments.at(0).toBool() == false); - updateLog("\t videoAvailableChanged(false)"); - - setVideoOnlyContent(); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - updateLog("SetMedia: videoOnlyContent"); - WAIT_FOR_CONDITION(m_player->isVideoAvailable(), true); - updateLog("\t isVideoAvailable() == true"); - QVERIFY(m_player->isAudioAvailable() == false); - updateLog("\t isAudioAvailable() == false"); - QCOMPARE(audioAvailableSpy.count(), 1); - arguments = audioAvailableSpy.takeFirst(); - QVERIFY(arguments.at(0).toBool() == false); - updateLog("\t audioAvailableChanged(false)"); - QCOMPARE(videoAvailableSpy.count(), 1); - arguments = videoAvailableSpy.takeFirst(); - QVERIFY(arguments.at(0).toBool() == true); - updateLog("\t videoAvailableChanged(true)"); - - setAudioVideoContent(); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - updateLog("SetMedia: audioVideoContent"); - WAIT_FOR_CONDITION(m_player->isAudioAvailable(), true); - updateLog("\t isAudioAvailable() == true"); - QCOMPARE(audioAvailableSpy.count(), 1); - arguments = audioAvailableSpy.takeFirst(); - QVERIFY(arguments.at(0).toBool() == true); - updateLog("\t audioAvailableChanged(true)"); - QCOMPARE(videoAvailableSpy.count(), 0); - - updateLog("*****testVideoAndAudioAvailability: PASSED"); - -} - -void tst_QMediaPlayer_xa::testStreamInformation() -{ - updateLog("*****testStreamInformation"); - resetPlayer(); - QMediaStreamsControl* m_streamControl = (QMediaStreamsControl*)(m_player->service()->requestControl(QMediaStreamsControl_iid)); - setVideoOnlyContent(); - - if(m_streamControl) - { - { - QSignalSpy streamInfoSpy(m_streamControl, SIGNAL(streamsChanged())); - setAudioOnlyContent(); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - QVERIFY(m_streamControl->streamCount() == 1); - QCOMPARE(streamInfoSpy.count(), 1); - } - - { - QSignalSpy streamInfoSpy(m_streamControl, SIGNAL(streamsChanged())); - setAudioVideoContent(); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - QVERIFY(m_streamControl->streamCount() == 2); - QCOMPARE(streamInfoSpy.count(), 1); - } - - { - QSignalSpy streamInfoSpy(m_streamControl, SIGNAL(streamsChanged())); - setAudioVideoContent(); //set alternate content - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - QVERIFY(m_streamControl->streamCount() == 2); - QCOMPARE(streamInfoSpy.count(), 1); - } - - { - QSignalSpy streamInfoSpy(m_streamControl, SIGNAL(streamsChanged())); - setVideoOnlyContent(); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - QVERIFY(m_streamControl->streamCount() == 1); - QCOMPARE(streamInfoSpy.count(), 1); - } - - updateLog("*****testStreamInformation: PASSED"); - } -} - -void tst_QMediaPlayer_xa::testPlay() -{ - updateLog("*****testPlay"); - resetPlayer(); - - setAudioVideoContent(); - - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - QVERIFY(m_player->media() == *mediaContent); - QSignalSpy spy(m_player, SIGNAL(stateChanged(QMediaPlayer::State))); - m_player->play(); - - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::BufferedMedia); - - QCOMPARE(m_player->state(), QMediaPlayer::PlayingState); - - //Play->Play - { - QCOMPARE(m_player->state(), QMediaPlayer::PlayingState); - QSignalSpy stateSpy(m_player, SIGNAL(stateChanged(QMediaPlayer::State))); - m_player->play(); - QCOMPARE(m_player->state(), QMediaPlayer::PlayingState); - QCOMPARE(stateSpy.count(), 0); - } - - //Play->Pause - { - QCOMPARE(m_player->state(), QMediaPlayer::PlayingState); - QSignalSpy stateSpy(m_player, SIGNAL(stateChanged(QMediaPlayer::State))); - m_player->pause(); - QCOMPARE(m_player->state(), QMediaPlayer::PausedState); - QCOMPARE(stateSpy.count(), 1); - } - - //Play->Stop - { - m_player->play(); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::BufferedMedia); - QCOMPARE(m_player->state(), QMediaPlayer::PlayingState); - QSignalSpy stateSpy(m_player, SIGNAL(stateChanged(QMediaPlayer::State))); - m_player->stop(); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - QCOMPARE(stateSpy.count(), 1); - } - - m_player->stop(); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - - updateLog("*****testPlay: PASSED"); -} - -void tst_QMediaPlayer_xa::testPause() -{ - updateLog("*****testPause"); - resetPlayer(); - - setAudioVideoContent(); - - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - QVERIFY(m_player->media() == *mediaContent); - QSignalSpy spy(m_player, SIGNAL(stateChanged(QMediaPlayer::State))); - m_player->pause(); - // at present there is no support for stop->pause state transition. TODO: uncomment when support added - //QCOMPARE(m_player->state(), QMediaPlayer::PausedState); - //QCOMPARE(spy.count(), 1); - - //Pause->Play - { - //QCOMPARE(m_player->state(), QMediaPlayer::PausedState); - QSignalSpy stateSpy(m_player, SIGNAL(stateChanged(QMediaPlayer::State))); - m_player->play(); - QCOMPARE(m_player->state(), QMediaPlayer::PlayingState); - QCOMPARE(stateSpy.count(), 1); - } - - //Pause->Pause - { - m_player->pause(); - QCOMPARE(m_player->state(), QMediaPlayer::PausedState); - QSignalSpy stateSpy(m_player, SIGNAL(stateChanged(QMediaPlayer::State))); - m_player->pause(); - QCOMPARE(m_player->state(), QMediaPlayer::PausedState); - QCOMPARE(stateSpy.count(), 0); - } - - //Pause->Stop - { - QCOMPARE(m_player->state(), QMediaPlayer::PausedState); - QSignalSpy stateSpy(m_player, SIGNAL(stateChanged(QMediaPlayer::State))); - m_player->stop(); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - QCOMPARE(stateSpy.count(), 1); - } - - m_player->stop(); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - - updateLog("*****testPause: PASSED"); - -} - -void tst_QMediaPlayer_xa::testStop() -{ - updateLog("*****testStop"); - resetPlayer(); - setAudioVideoContent(); - - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - QVERIFY(m_player->media() == *mediaContent); - - QSignalSpy spy(m_player, SIGNAL(stateChanged(QMediaPlayer::State))); - m_player->stop(); - - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - QCOMPARE(spy.count(), 0); - - //Stop->Play - { - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - QSignalSpy stateSpy(m_player, SIGNAL(stateChanged(QMediaPlayer::State))); - m_player->play(); - QCOMPARE(m_player->state(), QMediaPlayer::PlayingState); - QCOMPARE(stateSpy.count(), 1); - } - // at present there is no support for stop->pause state transition. TODO: uncomment when support added - //Stop->Pause -/* { - m_player->stop(); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - QSignalSpy stateSpy(m_player, SIGNAL(stateChanged(QMediaPlayer::State))); - m_player->pause(); - QCOMPARE(m_player->state(), QMediaPlayer::PausedState); - QCOMPARE(stateSpy.count(), 1); - } -*/ - //Stop->Stop - { - m_player->stop(); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - QSignalSpy stateSpy(m_player, SIGNAL(stateChanged(QMediaPlayer::State))); - m_player->stop(); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - QCOMPARE(stateSpy.count(), 0); - } - - m_player->stop(); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - - updateLog("*****testStop: PASSED"); -} - -void tst_QMediaPlayer_xa::testMediaStatus() -{ - updateLog("*****testMediaStatus"); - resetPlayer(); - - QSignalSpy statusSpy(m_player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus))); - - setAudioVideoContent(); - - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - QVERIFY(statusSpy.count()>0); - - { - QSignalSpy statusSpy(m_player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus))); - m_player->play(); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::BufferedMedia); - QCOMPARE(m_player->mediaStatus(), QMediaPlayer::BufferedMedia); - QVERIFY(statusSpy.count()>0); - } - - { - QSignalSpy statusSpy(m_player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus))); - m_player->setPosition(duration - 10); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::EndOfMedia); - QCOMPARE(m_player->mediaStatus(), QMediaPlayer::EndOfMedia); - QVERIFY(statusSpy.count()>0); - } - - m_player->stop(); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - - updateLog("*****testMediaStatus: PASSED"); -} - -void tst_QMediaPlayer_xa::testBufferStatus() -{ - updateLog("*****testBufferStatus"); - resetPlayer(); - m_player->setNotifyInterval(50); //Since default interval is 1 sec,could not receive any bufferStatusChanged SIGNAL,hence checking for 50milliseconds - QSignalSpy spy(m_player, SIGNAL(bufferStatusChanged(int))); - // setStreamingContent(); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - QCOMPARE(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - m_player->play(); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::BufferedMedia); - QCOMPARE(m_player->mediaStatus(), QMediaPlayer::BufferedMedia); - WAIT_FOR_CONDITION(m_player->bufferStatus(), 100); - QVERIFY(spy.count()>0); - updateLog("*****testBufferStatus: PASSED"); -} - -void tst_QMediaPlayer_xa::testPlaybackRate() -{ - updateLog("*****testPlaybackRate"); - - resetPlayer(); - - qreal playbackRate = 1.5; - - setAudioVideoContent(); - - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - - m_player->setPlaybackRate(playbackRate); - QVERIFY(m_player->playbackRate() == playbackRate); - - QSignalSpy spy(m_player, SIGNAL(playbackRateChanged(qreal))); - m_player->setPlaybackRate(playbackRate + 0.5f); - QCOMPARE(m_player->playbackRate(), playbackRate + 0.5f); - QCOMPARE(spy.count(), 1); - - updateLog("*****testPlaybackRate: PASSED"); -} - -void tst_QMediaPlayer_xa::testPlaybackRateWhilePlaying() -{ - updateLog("*****testPlaybackRateWhilePlaying"); - resetPlayer(); - - qreal playbackRate = 1.5; - - setAudioVideoContent(); - - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - - m_player->play(); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::BufferedMedia); - - m_player->setPlaybackRate(playbackRate); - QVERIFY(m_player->playbackRate() == playbackRate); - - QSignalSpy spy(m_player, SIGNAL(playbackRateChanged(qreal))); - m_player->setPlaybackRate(playbackRate + 0.5f); - QCOMPARE(m_player->playbackRate(), playbackRate + 0.5f); - QCOMPARE(spy.count(), 1); - - updateLog("*****testPlaybackRateWhilePlaying: PASSED"); -} - -void tst_QMediaPlayer_xa::testSeekable() -{ - updateLog("*****testBufferStatus"); - resetPlayer(); - QSignalSpy spy(m_player, SIGNAL(seekableChanged(bool))); - setAudioVideoContent(); - qint64 position = 1000; - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - QVERIFY(m_player->isSeekable()==true); - m_player->setPosition(position); - QCOMPARE(spy.count(), 0); - QVERIFY(m_player->isSeekable()==true); - - updateLog("*****testBufferStatus: PASSED"); - -} - -void tst_QMediaPlayer_xa::testAspectRatioMode() -{ - updateLog("*****testBufferStatus"); - resetPlayer(); - setAudioVideoContent(); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - QVideoWidgetControl* m_videoWidgetControl = (QVideoWidgetControl*)(m_player->service()->requestControl(QVideoWidgetControl_iid)); - - m_player->play(); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::BufferedMedia); - - QCOMPARE(m_videoWidgetControl->aspectRatioMode(), Qt::KeepAspectRatio); //default - - QTest::qWait(5000); //wait for 5 seconds - - { - m_videoWidgetControl->setAspectRatioMode(Qt::IgnoreAspectRatio); - QCOMPARE(m_videoWidgetControl->aspectRatioMode(), Qt::IgnoreAspectRatio); - QTest::qWait(5000); //wait for 5 seconds - } - - { - m_videoWidgetControl->setAspectRatioMode(Qt::KeepAspectRatioByExpanding); - QCOMPARE(m_videoWidgetControl->aspectRatioMode(), Qt::KeepAspectRatioByExpanding); - QTest::qWait(5000); //wait for 5 seconds - } - { - m_videoWidgetControl->setAspectRatioMode(Qt::KeepAspectRatio); - QCOMPARE(m_videoWidgetControl->aspectRatioMode(), Qt::KeepAspectRatio); - QTest::qWait(5000); //wait for 5 seconds - } - - updateLog("*****testBufferStatus: PASSED"); - -} - -void tst_QMediaPlayer_xa::testFullScreen() -{ - updateLog("*****testFullScreen"); - resetPlayer(); - setAudioVideoContent(); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - QVideoWidgetControl* m_videoWidgetControl = (QVideoWidgetControl*)(m_player->service()->requestControl(QVideoWidgetControl_iid)); - - m_player->play(); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::BufferedMedia); - - //m_widget->resize(50, 50); - m_widget->showNormal(); - QTest::qWait(10000); //wait for 5 seconds - - - if(m_videoWidgetControl) - { - QSignalSpy spy(m_videoWidgetControl, SIGNAL(fullScreenChanged(bool))); - m_videoWidgetControl->setFullScreen(true); - QTest::qWait(10000); //wait for 5 seconds - QCOMPARE(m_videoWidgetControl->isFullScreen(), true); - QCOMPARE(spy.count(), 1); - } - - - if(m_videoWidgetControl) - { - QSignalSpy spy(m_videoWidgetControl, SIGNAL(fullScreenChanged(bool))); - m_videoWidgetControl->setFullScreen(false); - QCOMPARE(m_videoWidgetControl->isFullScreen(), false); - QTest::qWait(10000); //wait for 5 seconds - QCOMPARE(spy.count(), 1); - } - - updateLog("*****testFullScreen: PASSED"); -} - -void tst_QMediaPlayer_xa::testWindowControl_NativeSize() -{ - updateLog("*****testWindowControl_NativeSize"); - resetPlayer_WindowControl(); - setAudioVideoContent(); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - QVERIFY(m_player->media() == *mediaContent); - m_player->play(); - WAIT_LONG_FOR_CONDITION(m_player->state(), QMediaPlayer::PlayingState); - QVideoWindowControl* windowControl = (QVideoWindowControl*)(m_player->service()->requestControl(QVideoWindowControl_iid)); - if (windowControl) - { - QSize size = windowControl->nativeSize(); - } - - WAIT_LONG_FOR_CONDITION(m_player->state(), QMediaPlayer::StoppedState); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - - updateLog("*****testWindowControl_NativeSize: PASSED"); -} - -void tst_QMediaPlayer_xa::testWindowControl_AspectRatioMode() -{ - updateLog("*****testWindowControl_AspectRatioMode"); - resetPlayer_WindowControl(); - setAudioVideoContent(); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - QVideoWindowControl* windowControl = (QVideoWindowControl*)(m_player->service()->requestControl(QVideoWindowControl_iid)); - - m_player->play(); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::BufferedMedia); - - QCOMPARE(windowControl->aspectRatioMode(), Qt::KeepAspectRatio); //default - - QTest::qWait(5000); //wait for 5 seconds - - { - windowControl->setAspectRatioMode(Qt::IgnoreAspectRatio); - QCOMPARE(windowControl->aspectRatioMode(), Qt::IgnoreAspectRatio); - QTest::qWait(5000); //wait for 5 seconds - } - - { - windowControl->setAspectRatioMode(Qt::KeepAspectRatioByExpanding); - QCOMPARE(windowControl->aspectRatioMode(), Qt::KeepAspectRatioByExpanding); - QTest::qWait(5000); //wait for 5 seconds - } - { - windowControl->setAspectRatioMode(Qt::KeepAspectRatio); - QCOMPARE(windowControl->aspectRatioMode(), Qt::KeepAspectRatio); - QTest::qWait(5000); //wait for 5 seconds - } - - updateLog("*****testWindowControl_AspectRatioMode: PASSED"); - -} - -void tst_QMediaPlayer_xa::testWindowControl_FullScreen() -{ - updateLog("*****testWindowControl_FullScreen"); - resetPlayer_WindowControl(); - setAudioVideoContent(); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - QVideoWindowControl* windowControl = (QVideoWindowControl*)(m_player->service()->requestControl(QVideoWindowControl_iid)); - - m_player->play(); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::BufferedMedia); - - //m_windowWidget->resize(250, 350); - m_windowWidget->showNormal(); - QTest::qWait(10000); //wait for 5 seconds - - if(windowControl) - { - QSignalSpy spy(windowControl, SIGNAL(fullScreenChanged(bool))); - windowControl->setFullScreen(true); - QTest::qWait(10000); //wait for 5 seconds - QCOMPARE(windowControl->isFullScreen(), true); - QCOMPARE(spy.count(), 1); - } - - - if(windowControl) - { - QSignalSpy spy(windowControl, SIGNAL(fullScreenChanged(bool))); - windowControl->setFullScreen(false); - QCOMPARE(windowControl->isFullScreen(), false); - QTest::qWait(10000); //wait for 5 seconds - QCOMPARE(spy.count(), 1); - } - - updateLog("*****testWindowControl_FullScreen: PASSED"); -} - - -//adding access-point testcase - - -void tst_QMediaPlayer_xa::testSetconfigurationsAP() -{ - updateLog("*****testSetconfigurationsAP"); - resetPlayer(); - - //Passing only valid Accesspoint in QList - QList<QNetworkConfiguration> configs; - accesspointlist = manager.allConfigurations(); - for (int i=0; i<=accesspointlist.size()-1;i++) - qDebug()<<"accesspointlist"<< accesspointlist.at(i).name(); - configs<<accesspointlist.at(8); - QSignalSpy spy(m_player, SIGNAL(networkConfigurationChanged(const QNetworkConfiguration&))); - m_player->setNetworkConfigurations(configs); - setStreamingContent3gp(); - m_player->play(); - QTest::qWait(100000); - WAIT_LONG_FOR_CONDITION(m_player->state(), QMediaPlayer::PlayingState); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::BufferedMedia); - m_player->stop(); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - QCOMPARE((m_player->currentNetworkConfiguration().name()), accesspointlist.at(8).name()); - updateLog("*****testSetconfigurationsAP: PASSED"); - -} - - -void tst_QMediaPlayer_xa::testSetAccesspoint() -{ - updateLog("*****testSetAccesspoint"); - resetPlayer(); - QList<QNetworkConfiguration> configs; - accesspointlist = manager.allConfigurations(); - configs<<accesspointlist.at(0); - configs<<accesspointlist.at(3); - configs<<accesspointlist.at(10); - configs<<accesspointlist.at(8); - //Passing only valid Accesspoint in QList - QSignalSpy spy(m_player, SIGNAL(networkConfigurationChanged(const QNetworkConfiguration&))); - m_player->setNetworkConfigurations(configs); - - setStreamingContent3gp(); - QTest::qWait(200000); - m_player->play(); - QTest::qWait(10000); - WAIT_LONG_FOR_CONDITION(m_player->state(), QMediaPlayer::PlayingState); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::BufferedMedia); - m_player->stop(); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - QCOMPARE((m_player->currentNetworkConfiguration().name()), accesspointlist.at(8).name()); - - updateLog("*****testSetAccesspoint: PASSED"); -} - - -void tst_QMediaPlayer_xa::testGetAccesspoint() -{ - updateLog("*****testGetAccesspoint"); - resetPlayer(); - //getting information about the current configured accesspoint without setting any configurations - QNetworkConfiguration getaccespoint; - getaccespoint = m_player->currentNetworkConfiguration(); - QCOMPARE(getaccespoint.name(),QString("")); - updateLog("*****testGetAccesspoint: "); -} - - -void tst_QMediaPlayer_xa::testDiffmediacontentAP() -{ - updateLog("*****streaming Different mediacontent files via AP"); - resetPlayer(); - QList<QNetworkConfiguration> configs; - accesspointlist = manager.allConfigurations(); - configs<<accesspointlist.at(8); - QSignalSpy spy(m_player, SIGNAL(networkConfigurationChanged(const QNetworkConfiguration&))); - m_player->setNetworkConfigurations(configs); - //first mediacontent file - setAudioStreamingContent(); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - QCOMPARE(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - m_player->play(); - QTest::qWait(30000); - QCOMPARE(m_player->state(), QMediaPlayer::PlayingState); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::EndOfMedia); - m_player->stop(); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - - //second mediacontent file - setStreamingContent3gp(); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - QCOMPARE(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - m_player->play(); - QTest::qWait(20000); - QCOMPARE(m_player->state(), QMediaPlayer::PlayingState); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::EndOfMedia); - m_player->stop(); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - - QCOMPARE((m_player->currentNetworkConfiguration().name()), accesspointlist.at(8).name()); - QNetworkConfiguration getaccespoint; - getaccespoint = m_player->currentNetworkConfiguration(); - QCOMPARE(getaccespoint.name(), QString("MMMW")); - - updateLog("*****testDiffmediacontentAP: PASSED"); -} - - -void tst_QMediaPlayer_xa::testInvalidaddressAP() -{ - updateLog("*****testInvalidaddressAP"); - resetPlayer(); - //setting all invalid accesspoint - QList<QNetworkConfiguration> configs; - accesspointlist = manager.allConfigurations(); - configs<<accesspointlist.at(0); - configs<<accesspointlist.at(2); - configs<<accesspointlist.at(3); - QSignalSpy spy(m_player, SIGNAL(networkConfigurationChanged(const QNetworkConfiguration&))); - m_player->setNetworkConfigurations(configs); - QNetworkConfiguration getaccespoint; - getaccespoint = m_player->currentNetworkConfiguration(); - QCOMPARE(getaccespoint.name(), QString("")); - - updateLog("*****testInvalidaddressAP: PASSED"); -} - - - -void tst_QMediaPlayer_xa::testMultipleAccesspoints() -{ - updateLog("*****testMultipleAccesspoints"); - resetPlayer(); - QList<QNetworkConfiguration> configs; - accesspointlist = manager.allConfigurations(); - configs<<accesspointlist.at(8); - QSignalSpy spy(m_player, SIGNAL(networkConfigurationChanged(const QNetworkConfiguration&))); - m_player->setNetworkConfigurations(configs); - setStreamingContent3gp(); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - QCOMPARE(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - m_player->play(); - WAIT_LONG_FOR_CONDITION(m_player->state(), QMediaPlayer::PlayingState); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::BufferedMedia); - QTest::qWait(20000); - m_player->stop(); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - QCOMPARE((m_player->currentNetworkConfiguration().name()), accesspointlist.at(8).name()); - //Second configuration list - QList<QNetworkConfiguration> secconfigs; - secaccesspoint = manager.allConfigurations(); - secconfigs<<secaccesspoint.at(5); - QSignalSpy spy1(m_player, SIGNAL(networkConfigurationChanged(const QNetworkConfiguration&))); - m_player->setNetworkConfigurations(secconfigs); - setStreamingContent3gp(); - // setAudioStreamingContent(); - QTest::qWait(30000); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - QCOMPARE(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - m_player->play(); - WAIT_LONG_FOR_CONDITION(m_player->state(), QMediaPlayer::PlayingState); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::BufferedMedia); - QTest::qWait(10000); - updateLog("*****testSetAccesspoint: PASSED"); - QCOMPARE((m_player->currentNetworkConfiguration().name()), accesspointlist.at(5).name()); - QNetworkConfiguration getaccespoint; - getaccespoint = m_player->currentNetworkConfiguration(); - QCOMPARE(getaccespoint.name(), QString("Mobile Office")); - - updateLog("*****testMultipleAccesspoints: PASSED"); -} - - -void tst_QMediaPlayer_xa::testReconnectAPWhilestreaming() -{ - updateLog("*****testReconnectAPWhilestreaming"); - resetPlayer(); - QList<QNetworkConfiguration> configs; - accesspointlist = manager.allConfigurations(); - configs<<accesspointlist.at(15); - configs<<accesspointlist.at(12); - configs<<accesspointlist.at(0); - configs<<accesspointlist.at(8); - QSignalSpy spy(m_player, SIGNAL(networkConfigurationChanged(const QNetworkConfiguration&))); - m_player->setNetworkConfigurations(configs); - setAudioStreamingContent(); - m_player->play(); - QTest::qWait(200000); - configs<<accesspointlist.at(5); - m_player->setNetworkConfigurations(configs); - m_player->play(); - QTest::qWait(20000); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::EndOfMedia); - QCOMPARE((m_player->currentNetworkConfiguration().name()), accesspointlist.at(8).name()); - QNetworkConfiguration getaccespoint; - getaccespoint = m_player->currentNetworkConfiguration(); - QCOMPARE(getaccespoint.name(), QString("MMMW")); - updateLog("*****testReconnectAPWhilestreaming: PASSED"); -} - - -void tst_QMediaPlayer_xa::teststreampausestream() -{ - updateLog("*****teststreampausestream"); - resetPlayer(); - QList<QNetworkConfiguration> configs; - accesspointlist = manager.allConfigurations(); - configs<<accesspointlist.at(8); - QSignalSpy spy(m_player, SIGNAL(networkConfigurationChanged(const QNetworkConfiguration&))); - m_player->setNetworkConfigurations(configs); - setStreamingContent3gp(); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - m_player->play(); - WAIT_LONG_FOR_CONDITION(m_player->state(), QMediaPlayer::PlayingState); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::BufferedMedia); - QTest::qWait(10000); - m_player->pause(); - WAIT_LONG_FOR_CONDITION(m_player->state(), QMediaPlayer::PausedState); - - //Setting up the accesspoint when the player is in paused state - QList<QNetworkConfiguration> secconfigs; - secaccesspoint = manager.allConfigurations(); - secconfigs<<secaccesspoint.at(5); - m_player->setNetworkConfigurations(secconfigs); - m_player->play(); - QTest::qWait(20000); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::BufferedMedia); - QCOMPARE((m_player->currentNetworkConfiguration()).name(), accesspointlist.at(8).name()); - m_player->stop(); - WAIT_LONG_FOR_CONDITION(m_player->state(), QMediaPlayer::StoppedState); - setStreamingContent3gp(); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - QCOMPARE(m_player->mediaStatus(), QMediaPlayer::LoadedMedia); - m_player->play(); - QTest::qWait(20000); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::BufferedMedia); - m_player->stop(); - WAIT_LONG_FOR_CONDITION(m_player->state(), QMediaPlayer::StoppedState); - QCOMPARE((m_player->currentNetworkConfiguration().name()), accesspointlist.at(5).name()); - - updateLog("*****teststreampausestream: PASSED"); -} - - - -void tst_QMediaPlayer_xa::testStressAccessPoint() -{ - updateLog("*****testStressAccessPoint"); - resetPlayer(); - for (int i=0; i<=50; i++) { - QList<QNetworkConfiguration> configs; - accesspointlist = manager.allConfigurations(); - configs<<accesspointlist.at(8); - QSignalSpy spy(m_player, SIGNAL(networkConfigurationChanged(const QNetworkConfiguration&))); - m_player->setNetworkConfigurations(configs); - setStreamingContent3gp(); - m_player->play(); - QTest::qWait(20000); - WAIT_LONG_FOR_CONDITION(m_player->state(), QMediaPlayer::PlayingState); - WAIT_FOR_CONDITION(m_player->mediaStatus(), QMediaPlayer::BufferedMedia); - m_player->stop(); - QCOMPARE(m_player->state(), QMediaPlayer::StoppedState); - QCOMPARE((m_player->currentNetworkConfiguration().name()), accesspointlist.at(8).name()); - resetPlayer(); - } - - updateLog("*****testStressAccessPoint: PASSED"); -} - - - -void tst_QMediaPlayer_xa::updateLog(QString log, bool delFile) -{ - QString logFileName = "C:\\data\\" + QFileInfo(QCoreApplication::applicationFilePath()).baseName() + "_detailed.log"; - if(delFile) - { - QFile::remove(logFileName); - } - - QFile f(logFileName); - - if( !f.open( QIODevice::WriteOnly | QIODevice::Append ) ) - { - return; - } - - QTextStream ts( &f ); - - ts<<log<<"\n"; - - f.close(); -} diff --git a/tests/auto/qmediaplayer/tst_qmediaplayer_xa.h b/tests/auto/qmediaplayer/tst_qmediaplayer_xa.h deleted file mode 100644 index 732cbd4bf..000000000 --- a/tests/auto/qmediaplayer/tst_qmediaplayer_xa.h +++ /dev/null @@ -1,194 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Mobility Components. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef TST_QMEDIAPLAYER_XA_H -#define TST_QMEDIAPLAYER_XA_H - -#include <QtTest/QtTest> -#include <QtCore> -#include <QtGui> -#include <QFile> - -#include <QMediaPlayer> -#include <QMediaPlayerControl> -#include <QMediaService> -#include <QMediaStreamsControl> -#include <QVideoWidget> -#include <QVideoWidgetControl> -#include <QVideoWindowControl> -#include <QMetadataReaderControl> -#include <QtNetwork/qnetworkconfiguration.h> -#include <QtNetwork/qnetworkconfigmanager.h> -#include <qmedianetworkaccesscontrol.h> - -QT_USE_NAMESPACE -class mediaStatusList; -/* -class mediaStatusList : public QObject, public QList<QMediaPlayer::MediaStatus> -{ - Q_OBJECT -public slots: - void mediaStatus(QMediaPlayer::MediaStatus status) { - append(status); - } - -public: - mediaStatusList(QObject *obj, const char *aSignal) - : QObject() - { - connect(obj, aSignal, this, SLOT(mediaStatus(QMediaPlayer::MediaStatus))); - } -}; -*/ -class tst_QMediaPlayer_xa: public QObject -{ - Q_OBJECT - -public: - tst_QMediaPlayer_xa(); - ~tst_QMediaPlayer_xa(); - -private slots: - void initTestCase_data(); - void initTestCase(); - void cleanupTestCase(); - void init(); - void cleanup(); - - void testMediaStatus(); - void testBufferStatus(); - void testPositionWhilePlaying(); - void testFullScreen(); - void testWindowControl_FullScreen(); - void testSeekable(); - void testStreamInformation(); - void testAspectRatioMode(); - void testMedia(); - void testDuration(); - void testPosition(); - void testVolume(); - void testVolumeWhilePlaying(); - void testMuted(); - void testMutedWhilePlaying(); - void testVideoAndAudioAvailability(); - void testPlay(); - void testPause(); - void testStop(); - void testPlaybackRate(); - void testPlaybackRateWhilePlaying(); - void testWindowControl_NativeSize(); - void testWindowControl_AspectRatioMode(); - void testSetconfigurationsAP(); - void testSetAccesspoint(); - void testGetAccesspoint(); - void testDiffmediacontentAP(); - void testInvalidaddressAP(); - void testMultipleAccesspoints(); - void testReconnectAPWhilestreaming(); - void teststreampausestream(); - void testStressAccessPoint(); - -private: - - void resetPlayer(); - void resetPlayer_WindowControl(); - - void updateLog(QString str, bool delFile=false); - void setAudioOnlyContent() - { - mediaContent = audioOnlyContent; - - m_player->setMedia(*mediaContent); - } - - void setVideoOnlyContent() - { - mediaContent = videoOnlyContent; - duration = 60000; - - m_player->setMedia(*mediaContent); - } - - void setAudioVideoContent() - { - if (mediaContent == audioVideoContent) { - mediaContent = audioVideoAltContent; - duration = 101840; - } else { - mediaContent = audioVideoContent; - duration = 141000; - } - m_player->setMedia(*mediaContent); - } - - void setStreamingContent3gp() - { - mediaContent = streamingContent3gp; - - m_player->setMedia(*mediaContent); - } - - void setAudioStreamingContent() - { - mediaContent = audioStreamingContent; - - m_player->setMedia(*mediaContent); - } - - - QMediaContent* audioOnlyContent; - QMediaContent* videoOnlyContent; - QMediaContent* audioVideoContent; - QMediaContent* audioVideoAltContent; - QMediaContent* mediaContent; - QMediaContent* streamingContent3gp; - QMediaContent* audioStreamingContent; - //for access-point requirement - QList<QNetworkConfiguration> accesspointlist; - QList<QNetworkConfiguration> secaccesspoint; - QNetworkConfigurationManager manager; - - qint64 duration; - QMediaPlayer *m_player; - QVideoWidget *m_widget; - QWidget *m_windowWidget; -}; - -#endif // TST_QMEDIAPLAYER_XA_H diff --git a/tests/auto/qmediaplayerbackend/qmediaplayerbackend.pro b/tests/auto/qmediaplayerbackend/qmediaplayerbackend.pro index 023217013..178a9194a 100644 --- a/tests/auto/qmediaplayerbackend/qmediaplayerbackend.pro +++ b/tests/auto/qmediaplayerbackend/qmediaplayerbackend.pro @@ -8,17 +8,7 @@ QT += multimediakit-private # TARGET = tst_qmediaplayerbackend # CONFIG += testcase -symbian*: { - PLAYLIST_TESTDATA.sources = testdata/* - PLAYLIST_TESTDATA.path = testdata - DEPLOYMENT += PLAYLIST_TESTDATA -} - -wince* { - DEFINES+= TESTDATA_DIR=\\\"./\\\" -}else:!symbian { - DEFINES += TESTDATA_DIR=\\\"$$PWD/\\\" -} +DEFINES += TESTDATA_DIR=\\\"$$PWD/\\\" SOURCES += \ tst_qmediaplayerbackend.cpp diff --git a/tests/auto/qmediaplaylist/qmediaplaylist.pro b/tests/auto/qmediaplaylist/qmediaplaylist.pro index c7b9a5837..373129471 100644 --- a/tests/auto/qmediaplaylist/qmediaplaylist.pro +++ b/tests/auto/qmediaplaylist/qmediaplaylist.pro @@ -8,17 +8,7 @@ QT += multimediakit-private # TARGET = tst_qmediaplaylist # CONFIG += testcase -symbian*: { - PLAYLIST_TESTDATA.sources = testdata/* - PLAYLIST_TESTDATA.path = testdata - DEPLOYMENT += PLAYLIST_TESTDATA -} - -wince* { - DEFINES+= TESTDATA_DIR=\\\"./\\\" -}else:!symbian { - DEFINES += TESTDATA_DIR=\\\"$$PWD/\\\" -} +DEFINES += TESTDATA_DIR=\\\"$$PWD/\\\" HEADERS += \ $$QT.multimediakit.sources/../plugins/m3u/qm3uhandler.h diff --git a/tests/auto/qmediaplaylist/tst_qmediaplaylist.cpp b/tests/auto/qmediaplaylist/tst_qmediaplaylist.cpp index 1a0395a54..7fd78fcbb 100644 --- a/tests/auto/qmediaplaylist/tst_qmediaplaylist.cpp +++ b/tests/auto/qmediaplaylist/tst_qmediaplaylist.cpp @@ -454,20 +454,12 @@ void tst_QMediaPlaylist::saveAndLoad() QCOMPARE(playlist.media(0), playlist2.media(0)); QCOMPARE(playlist.media(1), playlist2.media(1)); QCOMPARE(playlist.media(3), playlist2.media(3)); -#ifdef Q_OS_SYMBIAN - res = playlist.save(QUrl(QLatin1String("file:///c:/data/test_m3u.m3u")), "m3u"); -#else res = playlist.save(QUrl(QLatin1String("tmp.m3u")), "m3u"); -#endif QVERIFY(res); playlist2.clear(); QVERIFY(playlist2.isEmpty()); -#ifdef Q_OS_SYMBIAN - playlist2.load(QUrl(QLatin1String("file:///c:/data/test_m3u.m3u")), "m3u"); -#else playlist2.load(QUrl(QLatin1String("tmp.m3u")), "m3u"); -#endif QCOMPARE(playlist.error(), QMediaPlaylist::NoError); QCOMPARE(playlist.mediaCount(), playlist2.mediaCount()); diff --git a/tests/auto/qmediarecorder/main.cpp b/tests/auto/qmediarecorder/main.cpp index 816a55ea7..2193b73d9 100755 --- a/tests/auto/qmediarecorder/main.cpp +++ b/tests/auto/qmediarecorder/main.cpp @@ -43,38 +43,11 @@ #include "tst_qmediarecorder.h" -#ifdef Q_OS_SYMBIAN -#include "s60common.h" -#include "tst_qmediarecorder_xa.h" -#include "tst_qmediarecorder_mmf.h" -#endif - int main(int argc, char**argv) { QApplication app(argc,argv); int ret; tst_QMediaRecorder test_api; ret = QTest::qExec(&test_api, argc, argv); -#ifdef Q_OS_SYMBIAN - char *new_argv[3]; - QString str = "C:\\data\\" + QFileInfo(QCoreApplication::applicationFilePath()).baseName() + ".log"; - QByteArray bytes = str.toAscii(); - char arg1[] = "-o"; - new_argv[0] = argv[0]; - new_argv[1] = arg1; - new_argv[2] = bytes.data(); - tst_QMediaRecorder_xa test_xa; - ret = QTest::qExec(&test_xa, 3, new_argv); - char *new_argv1[3]; - QString str1 = "C:\\data\\" + QFileInfo(QCoreApplication::applicationFilePath()).baseName() + "_s60.log"; - QByteArray bytes1 = str1.toAscii(); - char arg2[] = "-o"; - new_argv1[0] = argv[0]; - new_argv1[1] = arg2; - new_argv1[2] = bytes1.data(); - tst_QMediaRecorder_mmf test_mmf; - ret = QTest::qExec(&test_mmf, 3, new_argv1); - -#endif return ret; } diff --git a/tests/auto/qmediarecorder/qmediarecorder.pro b/tests/auto/qmediarecorder/qmediarecorder.pro index 41e708fe7..283231fcd 100644 --- a/tests/auto/qmediarecorder/qmediarecorder.pro +++ b/tests/auto/qmediarecorder/qmediarecorder.pro @@ -5,14 +5,6 @@ QT += multimediakit-private # TARGET = tst_qmediarecorder # CONFIG += testcase -symbian { - HEADERS += s60common.h - HEADERS += tst_qmediarecorder_xa.h - SOURCES += tst_qmediarecorder_xa.cpp - HEADERS += tst_qmediarecorder_mmf.h - SOURCES += tst_qmediarecorder_mmf.cpp - TARGET.CAPABILITY = UserEnvironment ReadDeviceData WriteDeviceData AllFiles -} HEADERS += tst_qmediarecorder.h SOURCES += main.cpp tst_qmediarecorder.cpp diff --git a/tests/auto/qmediarecorder/s60common.h b/tests/auto/qmediarecorder/s60common.h deleted file mode 100755 index 4e55004f8..000000000 --- a/tests/auto/qmediarecorder/s60common.h +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Mobility Components. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef S60COMMON_H -#define S60COMMON_H - -QT_USE_NAMESPACE - -#define QTRY_COMPARE(a,e) \ - for (int _i = 0; _i < 5000; _i += 100) { \ - if ((a) == (e)) break; \ - QTest::qWait(100); \ - } \ - QCOMPARE(a, e) - -#define QTRY_VERIFY(a) \ - for (int _i = 0; _i < 5000; _i += 100) { \ - if (a) break; \ - QTest::qWait(100); \ - } \ - QVERIFY(a) - -#endif //S60COMMON_H diff --git a/tests/auto/qmediarecorder/tst_qmediarecorder_mmf.cpp b/tests/auto/qmediarecorder/tst_qmediarecorder_mmf.cpp deleted file mode 100755 index 48327bdd0..000000000 --- a/tests/auto/qmediarecorder/tst_qmediarecorder_mmf.cpp +++ /dev/null @@ -1,180 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Mobility Components. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "tst_qmediarecorder_mmf.h" - -QT_USE_NAMESPACE - -void tst_QMediaRecorder_mmf::initTestCase() -{ - qRegisterMetaType<QMediaRecorder::State>("QMediaRecorder::State"); - qRegisterMetaType<QMediaRecorder::Error>("QMediaRecorder::Error"); - - captureSource = new QAudioCaptureSource; - audiocapture = new QMediaRecorder(captureSource); - - QVERIFY(captureSource->service()); - - audioEndpoint = qobject_cast<QAudioEndpointSelector*>(captureSource->service()->requestControl(QAudioEndpointSelector_iid)); - audioEncoder = qobject_cast<QAudioEncoderControl*>(captureSource->service()->requestControl(QAudioEncoderControl_iid)); -} - -void tst_QMediaRecorder_mmf::cleanupTestCase() -{ - delete audiocapture; - delete captureSource; -} - -QUrl tst_QMediaRecorder_mmf::recordPathAudio(QDir outputDir) -{ - int lastImage = 0; - int fileCount = 0; - foreach( QString fileName, outputDir.entryList(QStringList() << "testclip_*.amr") ) { - int imgNumber = fileName.mid(5, fileName.size()-9).toInt(); - lastImage = qMax(lastImage, imgNumber); - if (outputDir.exists(fileName)) - fileCount+=1; - } - lastImage+=fileCount; - - QUrl location(QDir::toNativeSeparators(outputDir.canonicalPath()+QString("/testclip_%1.amr").arg(lastImage+1,4,10,QLatin1Char('0')))); - return location; -} - -void tst_QMediaRecorder_mmf::testAudioSink() -{ - audiocapture->setOutputLocation(QUrl("test.tmp")); - QUrl s = audiocapture->outputLocation(); - QCOMPARE(s.toString(), QString("test.tmp")); -} - -void tst_QMediaRecorder_mmf::testAudioRecord() -{ - QSignalSpy stateSignal(audiocapture,SIGNAL(stateChanged(QMediaRecorder::State))); - QCOMPARE(audiocapture->state(), QMediaRecorder::StoppedState); - QTest::qWait(500); // wait for recorder to initialize itself - audiocapture->setOutputLocation(recordPathAudio(QDir::rootPath())); - audiocapture->record(); - QTRY_COMPARE(stateSignal.count(), 1); // wait for callbacks to complete in symbian API - QCOMPARE(audiocapture->state(), QMediaRecorder::RecordingState); - QCOMPARE(audiocapture->error(), QMediaRecorder::NoError); - QCOMPARE(audiocapture->errorString(), QString()); - QCOMPARE(stateSignal.count(), 1); - audiocapture->pause(); - QTRY_COMPARE(stateSignal.count(), 2); // wait for callbacks to complete in symbian API - QCOMPARE(audiocapture->state(), QMediaRecorder::PausedState); - QCOMPARE(stateSignal.count(), 2); - audiocapture->stop(); - QTRY_COMPARE(stateSignal.count(), 3); // wait for callbacks to complete in symbian API - QCOMPARE(audiocapture->state(), QMediaRecorder::StoppedState); - QCOMPARE(stateSignal.count(), 3); -} - -void tst_QMediaRecorder_mmf::testAudioRecordWithAMR() -{ - QSignalSpy stateSignal(audiocapture,SIGNAL(stateChanged(QMediaRecorder::State))); - QCOMPARE(audiocapture->state(), QMediaRecorder::StoppedState); - audiocapture->setOutputLocation(recordPathAudio(QDir::rootPath())); - QAudioEncoderSettings audioSettings; - QVideoEncoderSettings videoSettings; - audioSettings.setCodec("AMR"); - QString format = audiocapture->containerMimeType(); - format = QString("audio/amr"); - audiocapture->setEncodingSettings(audioSettings,videoSettings,format); - audiocapture->record(); - QTRY_COMPARE(stateSignal.count(), 1); // wait for callbacks to complete in symbian API - QCOMPARE(audiocapture->state(), QMediaRecorder::RecordingState); - QCOMPARE(audiocapture->error(), QMediaRecorder::NoError); - QCOMPARE(audiocapture->errorString(), QString()); - QCOMPARE(stateSignal.count(), 1); - audiocapture->pause(); - QTRY_COMPARE(stateSignal.count(), 2); // wait for callbacks to complete in symbian API - QCOMPARE(audiocapture->state(), QMediaRecorder::PausedState); - QCOMPARE(stateSignal.count(), 2); - audiocapture->stop(); - QTRY_COMPARE(stateSignal.count(), 3); // wait for callbacks to complete in symbian API - QCOMPARE(audiocapture->state(), QMediaRecorder::StoppedState); - QCOMPARE(stateSignal.count(), 3); -} - -void tst_QMediaRecorder_mmf::testAudioEndPointSelector() -{ - QSignalSpy audioSignal(audioEndpoint,SIGNAL(activeEndpointChanged(QString))); - QVERIFY(audioEndpoint->availableEndpoints().count() == 1); - QVERIFY(audioEndpoint->defaultEndpoint().compare("default") == 0); - audioEndpoint->setActiveEndpoint("device2"); - QVERIFY(audioEndpoint->activeEndpoint().compare("device2") == 0); - QVERIFY(audioSignal.count() == 1); - QVERIFY(audioEndpoint->endpointDescription("device2").compare("") == 0); -} - -void tst_QMediaRecorder_mmf::testAudioEncoderControl() -{ - QStringList codecs = audiocapture->supportedAudioCodecs(); - QVERIFY(codecs.count() == 2); - QVERIFY(audiocapture->audioCodecDescription("PCM") == "Pulse code modulation"); - QStringList options = audioEncoder->supportedEncodingOptions("PCM"); - QCOMPARE(options.count(), 3); - QCOMPARE(audiocapture->supportedAudioSampleRates().count(), 12); - audioEncoder->setEncodingOption("PCM", "channels", QVariant(2)); - QCOMPARE(audioEncoder->encodingOption("PCM","channels").toInt(), 2); - audioEncoder->setEncodingOption("PCM", "quality", QVariant(int(QtMultimediaKit::NormalQuality))); - QCOMPARE(audioEncoder->encodingOption("PCM","quality").toInt(), int(QtMultimediaKit::NormalQuality)); - audioEncoder->setEncodingOption("PCM", "samplerate", QVariant(44100)); - QCOMPARE(audioEncoder->encodingOption("PCM","samplerate").toInt(), 44100); -} - -void tst_QMediaRecorder_mmf::testMediaFormatsControl() -{ - //audioocontainer types - // Containers supported are dynamically queried from MMF. We cannot guarentee that 2 platforms - // will support the same set. - //QCOMPARE(audiocapture->supportedContainers(), QStringList() << "audio/wav" << "audio/amr"); - QCOMPARE(audiocapture->containerDescription("audio/wav"), QString("WAV Write Format")); - QCOMPARE(audiocapture->containerDescription("audio/amr"), QString("AMR Write Format")); -} - -void tst_QMediaRecorder_mmf::testDefaultAudioEncodingSettings() -{ - QAudioEncoderSettings audioSettings = audiocapture->audioSettings(); - QCOMPARE(audioSettings.codec(), QString("AMR")); - QString format = audiocapture->containerMimeType(); - QCOMPARE(format, QString("audio/amr")); -} diff --git a/tests/auto/qmediarecorder/tst_qmediarecorder_mmf.h b/tests/auto/qmediarecorder/tst_qmediarecorder_mmf.h deleted file mode 100755 index 83058a214..000000000 --- a/tests/auto/qmediarecorder/tst_qmediarecorder_mmf.h +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Mobility Components. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef TST_QMEDIARECORDER_MMF -#define TST_QMEDIARECORDER_MMF - -#include <QtTest/QtTest> -#include <QDebug> -#include <qmediaobject.h> -#include <qmediacontrol.h> -#include <qmediaservice.h> -#include <qmediarecordercontrol.h> -#include <qmediarecorder.h> -#include <qaudioendpointselector.h> -#include <qaudioencodercontrol.h> -#include <qmediacontainercontrol.h> -#include <qaudioformat.h> -#include <qaudiocapturesource.h> - -#include "s60common.h" - -QT_USE_NAMESPACE -class tst_QMediaRecorder_mmf: public QObject -{ - Q_OBJECT - -public slots: - void initTestCase(); - void cleanupTestCase(); - -private slots: - void testAudioSink(); - void testAudioRecord(); - void testAudioRecordWithAMR(); - void testAudioEndPointSelector(); - void testAudioEncoderControl(); - void testMediaFormatsControl(); - void testDefaultAudioEncodingSettings(); - -private: - QUrl recordPathAudio(QDir outputDir); - - QAudioEncoderControl *audioEncoder; - QAudioEndpointSelector *audioEndpoint; - QMediaRecorder *audiocapture; - QAudioCaptureSource *captureSource; -}; -#endif diff --git a/tests/auto/qmediarecorder/tst_qmediarecorder_xa.cpp b/tests/auto/qmediarecorder/tst_qmediarecorder_xa.cpp deleted file mode 100755 index b8777b4fc..000000000 --- a/tests/auto/qmediarecorder/tst_qmediarecorder_xa.cpp +++ /dev/null @@ -1,323 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Mobility Components. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "tst_qmediarecorder_xa.h" - -QT_USE_NAMESPACE - -void tst_QMediaRecorder_xa::initTestCase() -{ - audiosource = new QAudioCaptureSource; - audiocapture = new QMediaRecorder(audiosource); -} - -void tst_QMediaRecorder_xa::cleanupTestCase() -{ - delete audiocapture; - delete audiosource; -} - -void tst_QMediaRecorder_xa::testMediaRecorderObject() -{ - //audioocontainer types - QCOMPARE(audiocapture->audioCodecDescription("pcm"), QString("pcm")); - QCOMPARE(audiocapture->audioCodecDescription("amr"), QString("amr")); - QCOMPARE(audiocapture->audioCodecDescription("aac"), QString("aac")); - QCOMPARE(audiocapture->containerDescription("audio/wav"), QString("wav container")); - QCOMPARE(audiocapture->containerDescription("audio/amr"), QString("amr File format")); - QCOMPARE(audiocapture->containerDescription("audio/mpeg"), QString("mpeg container")); - QCOMPARE(audiocapture->containerMimeType(), QString("audio/wav")); - QCOMPARE(audiocapture->error(), QMediaRecorder::NoError); - QCOMPARE(audiocapture->errorString(), QString()); - QCOMPARE(audiocapture->outputLocation().toLocalFile(), QString()); - QCOMPARE(audiocapture->state(), QMediaRecorder::StoppedState); - QCOMPARE(audiocapture->supportedAudioCodecs().count(), 3); // "pcm", "amr", "aac" - QAudioEncoderSettings settings; - settings.setCodec("pcm"); - QCOMPARE(audiocapture->supportedAudioSampleRates(settings).count(), 5); - bool isContinuous; - audiocapture->supportedAudioSampleRates(settings, &isContinuous); - QCOMPARE(isContinuous, false); - QCOMPARE(audiocapture->supportedContainers().count(), 3); // "audio/wav", "audio/amr", "audio/mpeg" -} - -void tst_QMediaRecorder_xa::testDefaultAudioEncodingSettings() -{ - QAudioEncoderSettings audioSettings = audiocapture->audioSettings(); - QCOMPARE(audioSettings.codec(), QString("pcm")); - QCOMPARE(audiocapture->containerMimeType(), QString("audio/wav")); - QCOMPARE(audioSettings.bitRate(), 0); - QCOMPARE(audioSettings.channelCount(), -1); - QCOMPARE(audioSettings.encodingMode(), QtMultimediaKit::ConstantQualityEncoding); - QCOMPARE(audioSettings.quality(), QtMultimediaKit::NormalQuality); - QCOMPARE(audioSettings.sampleRate(), -1); -} - -void tst_QMediaRecorder_xa::testAudioRecordingLocationOnly() -{ - QSignalSpy stateSignal(audiocapture,SIGNAL(stateChanged(QMediaRecorder::State))); - QCOMPARE(audiocapture->state(), QMediaRecorder::StoppedState); - QTest::qWait(500); // wait for recorder to initialize itself - audiocapture->setOutputLocation(nextFileName(QDir::rootPath(), "locationonly", "wav")); - audiocapture->record(); - QTRY_COMPARE(stateSignal.count(), 1); // wait for callbacks to complete in symbian API - QCOMPARE(audiocapture->state(), QMediaRecorder::RecordingState); - QCOMPARE(audiocapture->error(), QMediaRecorder::NoError); - QCOMPARE(audiocapture->errorString(), QString()); - QCOMPARE(stateSignal.count(), 1); - QTest::qWait(5000); // wait for 5 seconds - audiocapture->pause(); - QTRY_COMPARE(stateSignal.count(), 2); // wait for callbacks to complete in symbian API - QCOMPARE(audiocapture->state(), QMediaRecorder::PausedState); - QCOMPARE(stateSignal.count(), 2); - audiocapture->stop(); - QTRY_COMPARE(stateSignal.count(), 3); // wait for callbacks to complete in symbian API - QCOMPARE(audiocapture->state(), QMediaRecorder::StoppedState); - QCOMPARE(stateSignal.count(), 3); -} - -void tst_QMediaRecorder_xa::testAudioRecording_data() -{ - QTest::addColumn<QString>("mime"); // "audio/wav", "audio/amr", "audio/mpeg" - QTest::addColumn<QString>("codec"); // "pcm", "amr", "aac" - QTest::addColumn<QString>("filename_desc"); - QTest::addColumn<QString>("filename_ext"); // "wav", "amr", "mp4" - QTest::addColumn<QString>("settings"); - QTest::addColumn<int>("bitrate"); - QTest::addColumn<int>("samplerate"); - QTest::addColumn<int>("channels"); - - QTest::newRow("wav default") << "audio/wav" << "pcm" << "default" << "wav" << "default" << 0 << 0 << 0; - QTest::newRow("amr default") << "audio/amr" << "amr" << "default" << "amr" << "default" << 4750 << 8000 << -1; - QTest::newRow("aac default") << "audio/mpeg" << "aac" << "default" << "mp4" << "default" << 0 << 48000 << -1; - QTest::newRow("wav 08kHz Mono") << "audio/wav" << "pcm" << "Sr08kHzMono" << "wav" << "user" << 0 << 8000 << 1; - QTest::newRow("wav 08kHz Stereo") << "audio/wav" << "pcm" << "Sr08kHzStereo" << "wav" << "user" << 0 << 8000 << 2; - QTest::newRow("wav 16kHz Mono") << "audio/wav" << "pcm" << "Sr16kHzMono" << "wav" << "user" << 0 << 16000 << 1; - QTest::newRow("wav 16kHz Stereo") << "audio/wav" << "pcm" << "Sr16kHzStereo" << "wav" << "user" << 0 << 16000 << 2; - QTest::newRow("wav 32kHz Mono") << "audio/wav" << "pcm" << "Sr32kHzMono" << "wav" << "user" << 0 << 32000 << 1; - QTest::newRow("wav 32kHz Stereo") << "audio/wav" << "pcm" << "Sr32kHzStereo" << "wav" << "user" << 0<< 32000 << 2; - QTest::newRow("wav 48kHz Mono") << "audio/wav" << "pcm" << "Sr48kHzMono" << "wav" << "user" << 0 << 48000 << 1; - QTest::newRow("wav 48kHz Stereo") << "audio/wav" << "pcm" << "Sr48kHzStereo" << "wav" << "user" << 0 << 48000 << 2; - QTest::newRow("amr Br04750bps") << "audio/amr" << "amr" << "Br04750bps" << "amr" << "user" << 4750 << 8000 << 1; - QTest::newRow("amr Br05150bps") << "audio/amr" << "amr" << "Br05150bps" << "amr" << "user" << 5150 << 8000 << 1; - QTest::newRow("amr Br05900bps") << "audio/amr" << "amr" << "Br05900bps" << "amr" << "user" << 5900 << 8000 << 1; - QTest::newRow("amr Br06700bps") << "audio/amr" << "amr" << "Br06700bps" << "amr" << "user" << 6700 << 8000 << 1; - QTest::newRow("amr Br07400bps") << "audio/amr" << "amr" << "Br07400bps" << "amr" << "user" << 7400 << 8000 << 1; - QTest::newRow("amr Br07950bps") << "audio/amr" << "amr" << "Br07950bps" << "amr" << "user" << 7950 << 8000 << 1; - QTest::newRow("amr Br10200bps") << "audio/amr" << "amr" << "Br10200bps" << "amr" << "user" << 10200 << 8000 << 1; - QTest::newRow("amr Br12200bps") << "audio/amr" << "amr" << "Br12200bps" << "amr" << "user" << 10200 << 8000 << 1; - QTest::newRow("amr verylowqual") << "audio/amr" << "amr" << "verylowqual" << "amr" << "preset" << -1 << 8000 << -1; - QTest::newRow("amr lowqual") << "audio/amr" << "amr" << "lowqual" << "amr" << "preset" << -2 << 8000 << -1; - QTest::newRow("amr normalqual") << "audio/amr" << "amr" << "normalqual" << "amr" << "preset" << -3 << 8000 << -1; - QTest::newRow("amr highqual") << "audio/amr" << "amr" << "highqual" << "amr" << "preset" << -4 << 8000 << -1; - QTest::newRow("amr veryhighqual") << "audio/amr" << "amr" << "veryhighqual" << "amr" << "preset" << -5 << 8000 << -1; - - // Combinations supported for sample rate 8kHz - QTest::newRow("aac Br32k Sr8kHz Mono") << "audio/mpeg" << "aac" << "Br32kSr8kHzMono" << "mp4" << "user" << 32000 << 8000 << 1; - QTest::newRow("aac Br32k Sr8kHz Stereo") << "audio/mpeg" << "aac" << "Br32kSr8kHzStereo" << "mp4" << "user" << 32000 << 8000 << 2; - QTest::newRow("aac Br64k Sr8kHz Stereo") << "audio/mpeg" << "aac" << "Br64kSr8kHzStereo" << "mp4" << "user" << 64000 << 8000 << 2; - // Combinations supported for sample rate 16kHz - QTest::newRow("aac Br32k Sr16kHz Mono") << "audio/mpeg" << "aac" << "Br32kSr16kHzMono" << "mp4" << "user" << 32000 << 16000 << 1; - QTest::newRow("aac Br64k Sr16kHz Mono") << "audio/mpeg" << "aac" << "Br64kSr16kHzMonoo" << "mp4" << "user" << 64000 << 16000 << 1; - QTest::newRow("aac Br32k Sr16kHz Stereo") << "audio/mpeg" << "aac" << "Br32kSr16kHzStereo" << "mp4" << "user" << 32000 << 16000 << 2; - QTest::newRow("aac Br64k Sr16kHz Stereo") << "audio/mpeg" << "aac" << "Br64kSr16kHzStereo" << "mp4" << "user" << 64000 << 16000 << 2; - QTest::newRow("aac Br96k Sr16kHz Stereo") << "audio/mpeg" << "aac" << "Br96kSr16kHzStereo" << "mp4" << "user" << 96000 << 16000 << 2; - QTest::newRow("aac Br128k Sr16kHz Stereo") << "audio/mpeg" << "aac" << "Br128kSr16kHzStereo" << "mp4" << "user" << 128000 << 16000 << 2; - QTest::newRow("aac Br160k Sr16kHz Stereo") << "audio/mpeg" << "aac" << "Br160kSr16kHzStereo" << "mp4" << "user" << 160000 << 16000 << 2; - // Combinations supported for sample rate 24kHz - QTest::newRow("aac Br32k Sr24kHz Mono") << "audio/mpeg" << "aac" << "Br32kSr24kHzMono" << "mp4" << "user" << 32000 << 24000 << 1; - QTest::newRow("aac Br64k Sr24kHz Mono") << "audio/mpeg" << "aac" << "Br64kSr24kHzMono" << "mp4" << "user" << 64000 << 24000 << 1; - QTest::newRow("aac Br96k Sr24kHz Mono") << "audio/mpeg" << "aac" << "Br96kSr24kHzMono" << "mp4" << "user" << 96000 << 24000 << 1; - QTest::newRow("aac Br32k Sr24kHz Stereo") << "audio/mpeg" << "aac" << "Br32kSr24kHzStereo" << "mp4" << "user" << 32000 << 24000 << 2; - QTest::newRow("aac Br64k Sr24kHz Stereo") << "audio/mpeg" << "aac" << "Br64kSr24kHzStereo" << "mp4" << "user" << 64000 << 24000 << 2; - QTest::newRow("aac Br96k Sr24kHz Stereo") << "audio/mpeg" << "aac" << "Br96kSr24kHzStereo" << "mp4" << "user" << 96000 << 24000 << 2; - QTest::newRow("aac Br128k Sr24kHz Stereo") << "audio/mpeg" << "aac" << "Br128kSr24kHzStereo" << "mp4" << "user" << 128000 << 24000 << 2; - QTest::newRow("aac Br160k Sr24kHz Stereo") << "audio/mpeg" << "aac" << "Br160kSr24kHzStereo" << "mp4" << "user" << 160000 << 24000 << 2; - QTest::newRow("aac Br192k Sr24kHz Stereo") << "audio/mpeg" << "aac" << "Br192kSr24kHzStereo" << "mp4" << "user" << 192000 << 24000 << 2; - // Combinations supported for sample rate 32kHz - QTest::newRow("aac Br32k Sr32kHz Mono") << "audio/mpeg" << "aac" << "Br32kSr32kHzMono" << "mp4" << "user" << 32000 << 32000 << 1; - QTest::newRow("aac Br64k Sr32kHz Mono") << "audio/mpeg" << "aac" << "Br64kSr32kHzMono" << "mp4" << "user" << 64000 << 32000 << 1; - QTest::newRow("aac Br96k Sr32kHz Mono") << "audio/mpeg" << "aac" << "Br96kSr32kHzMono" << "mp4" << "user" << 96000 << 32000 << 1; - QTest::newRow("aac Br128k Sr32kHz Mono") << "audio/mpeg" << "aac" << "Br128kSr32kHzMono" << "mp4" << "user" << 128000 << 32000 << 1; - QTest::newRow("aac Br160k Sr32kHz Mono") << "audio/mpeg" << "aac" << "Br160kSr32kHzMono" << "mp4" << "user" << 160000 << 32000 << 1; - QTest::newRow("aac Br32k Sr32kHz Stereo") << "audio/mpeg" << "aac" << "Br32kSr32kHzStereo" << "mp4" << "user" << 32000 << 32000 << 2; - QTest::newRow("aac Br64k Sr32kHz Stereo") << "audio/mpeg" << "aac" << "Br64kSr32kHzStereo" << "mp4" << "user" << 64000 << 32000 << 2; - QTest::newRow("aac Br96k Sr32kHz Stereo") << "audio/mpeg" << "aac" << "Br96kSr32kHzStereo" << "mp4" << "user" << 96000 << 32000 << 2; - QTest::newRow("aac Br128k Sr32kHz Stereo") << "audio/mpeg" << "aac" << "Br128kSr32kHzStereo" << "mp4" << "user" << 128000 << 32000 << 2; - QTest::newRow("aac Br160k Sr32kHz Stereo") << "audio/mpeg" << "aac" << "Br160kSr32kHzStereo" << "mp4" << "user" << 160000 << 32000 << 2; - QTest::newRow("aac Br192k Sr32kHz Stereo") << "audio/mpeg" << "aac" << "Br192kSr32kHzStereo" << "mp4" << "user" << 192000 << 32000 << 2; - QTest::newRow("aac Br224k Sr32kHz Stereo") << "audio/mpeg" << "aac" << "Br224kSr32kHzStereo" << "mp4" << "user" << 224000 << 32000 << 2; - QTest::newRow("aac Br256k Sr32kHz Stereo") << "audio/mpeg" << "aac" << "Br256kSr32kHzStereo" << "mp4" << "user" << 256000 << 32000 << 2; - // Combinations supported for sample rate 48kHz - QTest::newRow("aac Br32k Sr48kHz Mono") << "audio/mpeg" << "aac" << "Br32kSr48kHzMono" << "mp4" << "user" << 32000 << 48000 << 1; - QTest::newRow("aac Br64k Sr48kHz Mono") << "audio/mpeg" << "aac" << "Br64kSr48kHzMono" << "mp4" << "user" << 64000 << 48000 << 1; - QTest::newRow("aac Br96k Sr48kHz Mono") << "audio/mpeg" << "aac" << "Br96kSr48kHzMono" << "mp4" << "user" << 96000 << 48000 << 1; - QTest::newRow("aac Br128k Sr48kHz Mono") << "audio/mpeg" << "aac" << "Br128kSr48kHzMono" << "mp4" << "user" << 128000 << 48000 << 1; - QTest::newRow("aac Br160k Sr48kHz Mono") << "audio/mpeg" << "aac" << "Br160kSr48kHzMono" << "mp4" << "user" << 160000 << 48000 << 1; - QTest::newRow("aac Br192k Sr48kHz Mono") << "audio/mpeg" << "aac" << "Br192kSr48kHzMono" << "mp4" << "user" << 192000 << 48000 << 1; - QTest::newRow("aac Br224k Sr48kHz Mono") << "audio/mpeg" << "aac" << "Br224kSr48kHzMono" << "mp4" << "user" << 224000 << 48000 << 1; - QTest::newRow("aac Br32k Sr48kHz Stereo") << "audio/mpeg" << "aac" << "Br32kSr48kHzStereo" << "mp4" << "user" << 32000 << 48000 << 2; - QTest::newRow("aac Br64k Sr48kHz Stereo") << "audio/mpeg" << "aac" << "Br64kSr48kHzStereo" << "mp4" << "user" << 64000 << 48000 << 2; - QTest::newRow("aac Br96k Sr48kHz Stereo") << "audio/mpeg" << "aac" << "Br96kSr48kHzStereo" << "mp4" << "user" << 96000 << 48000 << 2; - QTest::newRow("aac Br128k Sr48kHz Stereo") << "audio/mpeg" << "aac" << "Br128kSr48kHzStereo" << "mp4" << "user" << 128000 << 48000 << 2; - QTest::newRow("aac Br160k Sr48kHz Stereo") << "audio/mpeg" << "aac" << "Br160kSr48kHzStereo" << "mp4" << "user" << 160000 << 48000 << 2; - QTest::newRow("aac Br192k Sr48kHz Stereo") << "audio/mpeg" << "aac" << "Br192kSr48kHzStereo" << "mp4" << "user" << 192000 << 48000 << 2; - QTest::newRow("aac Br224k Sr48kHz Stereo") << "audio/mpeg" << "aac" << "Br224kSr48kHzStereo" << "mp4" << "user" << 224000 << 48000 << 2; - QTest::newRow("aac Br256k Sr48kHz Stereo") << "audio/mpeg" << "aac" << "Br256kSr48kHzStereo" << "mp4" << "user" << 256000 << 48000 << 2; - QTest::newRow("aac verylowqual") << "audio/mpeg" << "aac" << "verylowqual" << "mp4" << "preset" << -1 << 8000 << -1; - QTest::newRow("aac lowqual") << "audio/mpeg" << "aac" << "lowqual" << "mp4" << "preset" << -2 << 24000 << -1; - QTest::newRow("aac normalqual") << "audio/mpeg" << "aac" << "normalqual" << "mp4" << "preset" << -3 << 32000 << -1; - QTest::newRow("aac highqual") << "audio/mpeg" << "aac" << "highqual" << "mp4" << "preset" << -4 << 48000 << -1; - QTest::newRow("aac veryhighqual") << "audio/mpeg" << "aac" << "veryhighqual" << "mp4" << "preset" << -5 << 48000 << -1; - } - -void tst_QMediaRecorder_xa::testAudioRecording() -{ - QFETCH(QString, mime); - QFETCH(QString, codec); - QFETCH(QString, filename_desc); - QFETCH(QString, filename_ext); - QFETCH(QString, settings); - - QSignalSpy stateSignal(audiocapture,SIGNAL(stateChanged(QMediaRecorder::State))); - audiocapture->setOutputLocation(nextFileName(QDir::rootPath(), filename_desc, filename_ext)); - QAudioEncoderSettings audioSettings; - audioSettings.setCodec(codec); - if (settings.compare("default") == 0) { - audioSettings.setSampleRate(-1); - } - else if (settings.compare("user") == 0) { - QFETCH(int, bitrate); - QFETCH(int, samplerate); - QFETCH(int, channels); - audioSettings.setEncodingMode(QtMultimediaKit::ConstantBitRateEncoding); - if (bitrate > 0) - audioSettings.setBitRate(bitrate); - if (samplerate > 0) - audioSettings.setSampleRate(samplerate); - if ((channels > 0) || (channels == -1)) - audioSettings.setChannelCount(channels); - } - else if (settings.compare("preset") == 0) { - QFETCH(int, bitrate); - QFETCH(int, samplerate); - QFETCH(int, channels); - audioSettings.setEncodingMode(QtMultimediaKit::ConstantQualityEncoding); - QtMultimediaKit::EncodingQuality quality = QtMultimediaKit::NormalQuality; - switch(bitrate) { - case -1: - quality = QtMultimediaKit::VeryLowQuality; - break; - case -2: - quality = QtMultimediaKit::LowQuality; - break; - default: - case -3: - quality = QtMultimediaKit::NormalQuality; - break; - case -4: - quality = QtMultimediaKit::HighQuality; - break; - case -5: - quality = QtMultimediaKit::VeryHighQuality; - break; - } - audioSettings.setQuality(quality); - if (samplerate > 0) - audioSettings.setSampleRate(samplerate); - if ((channels > 0) || (channels == -1)) - audioSettings.setChannelCount(channels); - } - QVideoEncoderSettings videoSettings; - audiocapture->setEncodingSettings(audioSettings, videoSettings, mime); - QCOMPARE(audiocapture->state(), QMediaRecorder::StoppedState); - QTest::qWait(500); // wait for recorder to initialize itself - int expectedSignalCount = 1; - audiocapture->record(); - QTRY_COMPARE(stateSignal.count(), expectedSignalCount); // wait for callbacks to complete in symbian API - QCOMPARE(audiocapture->state(), QMediaRecorder::RecordingState); - QCOMPARE(audiocapture->error(), QMediaRecorder::NoError); - QCOMPARE(audiocapture->errorString(), QString()); - QCOMPARE(stateSignal.count(), expectedSignalCount); - QTest::qWait(5000); // wait for 5 seconds - // If we are not testing aac recording to mp4 container - if (!((mime.compare("audio/mpeg") == 0) && (codec.compare("aac") == 0))) { - expectedSignalCount++; - audiocapture->pause(); - QTRY_COMPARE(stateSignal.count(), expectedSignalCount); // wait for callbacks to complete in symbian API - QCOMPARE(audiocapture->state(), QMediaRecorder::PausedState); - QCOMPARE(stateSignal.count(), expectedSignalCount); - } - expectedSignalCount++; - audiocapture->stop(); - QTRY_COMPARE(stateSignal.count(), expectedSignalCount); // wait for callbacks to complete in symbian API - QCOMPARE(audiocapture->state(), QMediaRecorder::StoppedState); - QCOMPARE(stateSignal.count(), expectedSignalCount); - /* testAudioRecording() function gets executed for each rown in the table. - * If and when all tests in the table passes, test log will just contain one - * entry 'PASS : tst_QMediaRecorder_xa::testAudioRecording()'. To figure out - * which test in the loop completed successfully, just print a debug message - * which also goes into the test log generated.*/ - qDebug() << "----> PASS"; -} - -void tst_QMediaRecorder_xa::testOutputLocation() -{ - audiocapture->setOutputLocation(QUrl("test.wav")); - QUrl s = audiocapture->outputLocation(); - QCOMPARE(s.toString(), QString("test.wav")); -} - -QUrl tst_QMediaRecorder_xa::nextFileName(QDir outputDir, QString appendName, QString ext) -{ - int lastImage = 0; - int fileCount = 0; - foreach( QString fileName, outputDir.entryList(QStringList() << "testclip_*." + ext) ) { - int imgNumber = fileName.mid(5, fileName.size()-9).toInt(); - lastImage = qMax(lastImage, imgNumber); - if (outputDir.exists(fileName)) - fileCount+=1; - } - lastImage+=fileCount; - - QUrl location(QDir::toNativeSeparators(outputDir.canonicalPath() + QString("/testclip_%1").arg(lastImage+1 , 4, 10, QLatin1Char('0')) + appendName + "." + ext)); - return location; -} diff --git a/tests/auto/qmediarecorder/tst_qmediarecorder_xa.h b/tests/auto/qmediarecorder/tst_qmediarecorder_xa.h deleted file mode 100755 index c7fe415e4..000000000 --- a/tests/auto/qmediarecorder/tst_qmediarecorder_xa.h +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Mobility Components. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef TST_QMEDIARECORDER_XA_H -#define TST_QMEDIARECORDER_XA_H - -#include <QtTest/QtTest> -#include <qmediarecorder.h> -#include <qaudiocapturesource.h> - -#include "s60common.h" - -QT_USE_NAMESPACE - -class tst_QMediaRecorder_xa: public QObject -{ - Q_OBJECT - -public slots: - void initTestCase(); - void cleanupTestCase(); - -private slots: - void testMediaRecorderObject(); //1 - void testDefaultAudioEncodingSettings(); //2 - void testOutputLocation(); //3 - void testAudioRecordingLocationOnly(); //4 - void testAudioRecording_data(); //5 - void testAudioRecording(); //6 - -private: - QUrl nextFileName(QDir outputDir, QString appendName, QString ext); - -private: - QAudioCaptureSource* audiosource; - QMediaRecorder* audiocapture; - -}; - -#endif /* TST_QMEDIARECORDER_XA_H */ diff --git a/tests/auto/qpaintervideosurface/qpaintervideosurface.pro b/tests/auto/qpaintervideosurface/qpaintervideosurface.pro index 0364c45b0..9d14c4aeb 100644 --- a/tests/auto/qpaintervideosurface/qpaintervideosurface.pro +++ b/tests/auto/qpaintervideosurface/qpaintervideosurface.pro @@ -1,7 +1,7 @@ load(qttest_p4) QT += multimediakit-private -contains(QT_CONFIG, opengl) | contains(QT_CONFIG, opengles2): !symbian { +contains(QT_CONFIG, opengl) | contains(QT_CONFIG, opengles2) { QT += opengl } else { DEFINES += QT_NO_OPENGL diff --git a/tests/auto/qradiotuner/main.cpp b/tests/auto/qradiotuner/main.cpp index f161c8fd6..ca44f1f74 100755 --- a/tests/auto/qradiotuner/main.cpp +++ b/tests/auto/qradiotuner/main.cpp @@ -43,37 +43,11 @@ #include "tst_qradiotuner.h" -#ifdef Q_OS_SYMBIAN -#include "tst_qradiotuner_xa.h" -#include "tst_qradiotuner_s60.h" -#endif - int main(int argc, char**argv) { QApplication app(argc,argv); int ret; tst_QRadioTuner test_api; ret = QTest::qExec(&test_api, argc, argv); -#ifdef Q_OS_SYMBIAN - char *new_argv[3]; - QString str = "C:\\data\\" + QFileInfo(QCoreApplication::applicationFilePath()).baseName() + "_xa.log"; - QByteArray bytes = str.toAscii(); - char arg1[] = "-o"; - new_argv[0] = argv[0]; - new_argv[1] = arg1; - new_argv[2] = bytes.data(); - tst_QXARadio_xa test_xa; - ret = QTest::qExec(&test_xa, 3, new_argv); - char *new_argv1[3]; - QString str1 = "C:\\data\\" + QFileInfo(QCoreApplication::applicationFilePath()).baseName() + "_s60.log"; - QByteArray bytes1 = str1.toAscii(); - char arg2[] = "-o"; - new_argv1[0] = argv[0]; - new_argv1[1] = arg2; - new_argv1[2] = bytes1.data(); - tst_QRadioTuner_s60 test_s60; - ret = QTest::qExec(&test_s60, 3, new_argv1); - -#endif return ret; } diff --git a/tests/auto/qradiotuner/qradiotuner.pro b/tests/auto/qradiotuner/qradiotuner.pro index b80043801..d8818d3db 100644 --- a/tests/auto/qradiotuner/qradiotuner.pro +++ b/tests/auto/qradiotuner/qradiotuner.pro @@ -5,15 +5,6 @@ QT += multimediakit-private # TARGET = tst_qradiotuner # CONFIG += testcase -symbian { - HEADERS += tst_qradiotuner_xa.h - SOURCES += tst_qradiotuner_xa.cpp - TARGET.CAPABILITY = ALL -TCB - HEADERS += tst_qradiotuner_s60.h - SOURCES += tst_qradiotuner_s60.cpp - -} - HEADERS += tst_qradiotuner.h SOURCES += main.cpp tst_qradiotuner.cpp diff --git a/tests/auto/qradiotuner/tst_qradiotuner_s60.cpp b/tests/auto/qradiotuner/tst_qradiotuner_s60.cpp deleted file mode 100644 index 3c3de22da..000000000 --- a/tests/auto/qradiotuner/tst_qradiotuner_s60.cpp +++ /dev/null @@ -1,170 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Mobility Components. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//TESTED_COMPONENT=src/multimedia - -#include "tst_qradiotuner_s60.h" - -#define QTRY_COMPARE_S60(a,e) \ - for (int _i = 0; _i < 5000; _i += 100) { \ - if ((a) == (e)) break; \ - QTest::qWait(100); \ - } - -void tst_QRadioTuner_s60::initTestCase() -{ - qRegisterMetaType<QRadioTuner::State>("QRadioTuner::State"); - qRegisterMetaType<QRadioTuner::Band>("QRadioTuner::Band"); - - radio = new QRadioTuner(0); - QVERIFY(radio->service() != 0); - - QSignalSpy stateSpy(radio, SIGNAL(stateChanged(QRadioTuner::State))); - - QCOMPARE(radio->state(), QRadioTuner::StoppedState); - radio->start(); - //QCOMPARE(radio->state(), QRadioTuner::ActiveState); - QTRY_COMPARE_S60(radio->state(), QRadioTuner::ActiveState); - - QCOMPARE(stateSpy.count(), 1); - QCOMPARE(stateSpy.first()[0].value<QRadioTuner::State>(), QRadioTuner::ActiveState); -} - -void tst_QRadioTuner_s60::cleanupTestCase() -{ - QVERIFY(radio->error() == QRadioTuner::NoError); - QVERIFY(radio->errorString().isEmpty()); - - QSignalSpy stateSpy(radio, SIGNAL(stateChanged(QRadioTuner::State))); - - radio->stop(); - QTRY_COMPARE_S60(radio->state(), QRadioTuner::StoppedState); - QCOMPARE(stateSpy.count(), 1); - - QCOMPARE(stateSpy.first()[0].value<QRadioTuner::State>(), QRadioTuner::StoppedState); - - delete radio; -} - -void tst_QRadioTuner_s60::testBand() -{ - QVERIFY(radio->isBandSupported(QRadioTuner::FM)); - QVERIFY(!radio->isBandSupported(QRadioTuner::SW)); - - if(radio->isBandSupported(QRadioTuner::AM)) { - QSignalSpy readSignal(radio, SIGNAL(bandChanged(QRadioTuner::Band))); - radio->setBand(QRadioTuner::AM); - QTestEventLoop::instance().enterLoop(1); - QVERIFY(radio->band() == QRadioTuner::AM); - QVERIFY(readSignal.count() == 1); - } -} - -void tst_QRadioTuner_s60::testFrequency() -{ - QSignalSpy readSignal(radio, SIGNAL(frequencyChanged(int))); - radio->setFrequency(104500000); - QTestEventLoop::instance().enterLoop(1); - QVERIFY(radio->frequency() == 104500000); - QVERIFY(readSignal.count() == 1); - - // frequencyStep for FM radio is 100kHz (100000Hz) - QVERIFY(radio->frequencyStep(QRadioTuner::FM) == 100000); - QPair<int,int> test = radio->frequencyRange(QRadioTuner::FM); - // frequency range for FM radio is 87,5MHz - 108MHz - QVERIFY(test.first == 87500000); - QVERIFY(test.second == 108000000); -} - -void tst_QRadioTuner_s60::testMute() -{ - QSignalSpy readSignal(radio, SIGNAL(mutedChanged(bool))); - radio->setMuted(true); - QTestEventLoop::instance().enterLoop(1); - QVERIFY(radio->isMuted()); - QVERIFY(readSignal.count() == 1); -} - -void tst_QRadioTuner_s60::testSearch() -{ - QSignalSpy readSignal(radio, SIGNAL(searchingChanged(bool))); - QVERIFY(!radio->isSearching()); - - radio->searchForward(); - QVERIFY(radio->isSearching()); - QVERIFY(readSignal.count() == 1); - - radio->cancelSearch(); - QTestEventLoop::instance().enterLoop(1); - QVERIFY(!radio->isSearching()); - QVERIFY(readSignal.count() == 2); - - radio->searchBackward(); - QVERIFY(radio->isSearching()); - QVERIFY(readSignal.count() == 3); - - radio->cancelSearch(); - QVERIFY(!radio->isSearching()); -} - -void tst_QRadioTuner_s60::testVolume() -{ - QVERIFY(radio->volume() == 50); - QSignalSpy readSignal(radio, SIGNAL(volumeChanged(int))); - radio->setVolume(70); - QTestEventLoop::instance().enterLoop(1); - QTRY_COMPARE_S60(radio->volume() , 70); - QTRY_COMPARE_S60(readSignal.count() ,1); -} - -void tst_QRadioTuner_s60::testSignal() -{ - int signalStrength = radio->signalStrength(); - QVERIFY(signalStrength == signalStrength); - // There is no set of this only a get, do nothing else. -} - -void tst_QRadioTuner_s60::testStereo() -{ - QVERIFY(radio->isStereo()); - radio->setStereoMode(QRadioTuner::ForceMono); - QVERIFY(radio->stereoMode() == QRadioTuner::ForceMono); -} diff --git a/tests/auto/qradiotuner/tst_qradiotuner_s60.h b/tests/auto/qradiotuner/tst_qradiotuner_s60.h deleted file mode 100644 index 2767fcb59..000000000 --- a/tests/auto/qradiotuner/tst_qradiotuner_s60.h +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Mobility Components. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef TST_QRADIOTUNER_S60_H -#define TST_QRADIOTUNER_S60_H - -#include <QtTest/QtTest> -#include <QDebug> -#include <QTimer> - -#include <qmediaobject.h> -#include <qmediacontrol.h> -#include <qmediaservice.h> -#include <qradiotunercontrol.h> -#include <qradiotuner.h> - -#include <QMessageBox> - -QT_USE_NAMESPACE - -class tst_QRadioTuner_s60: public QObject -{ - Q_OBJECT - -public slots: - void initTestCase(); - void cleanupTestCase(); - -private slots: - void testBand(); - void testFrequency(); - void testMute(); - void testSearch(); - void testVolume(); - void testSignal(); - void testStereo(); - -private: - QRadioTuner *radio; -}; - -#endif diff --git a/tests/auto/qradiotuner/tst_qradiotuner_xa.cpp b/tests/auto/qradiotuner/tst_qradiotuner_xa.cpp deleted file mode 100644 index dec65f839..000000000 --- a/tests/auto/qradiotuner/tst_qradiotuner_xa.cpp +++ /dev/null @@ -1,224 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Mobility Components. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "tst_qradiotuner_xa.h" - -QT_USE_NAMESPACE - -#define QTEST_MAIN_S60(TestObject) \ - int main(int argc, char *argv[]) { \ - char *new_argv[3]; \ - QApplication app(argc, argv); \ - \ - QString str = "C:\\data\\" + QFileInfo(QCoreApplication::applicationFilePath()).baseName() + ".log"; \ - QByteArray bytes = str.toAscii(); \ - \ - char arg1[] = "-o"; \ - \ - new_argv[0] = argv[0]; \ - new_argv[1] = arg1; \ - new_argv[2] = bytes.data(); \ - \ - TestObject tc; \ - return QTest::qExec(&tc, 3, new_argv); \ - } - -#define QTRY_COMPARE(a,e) \ - for (int _i = 0; _i < 5000; _i += 100) { \ - if ((a) == (e)) break; \ - QTest::qWait(100); \ - } \ -// QCOMPARE(a, e) - -void tst_QXARadio_xa::initTestCase() -{ - qRegisterMetaType<QRadioTuner::State>("QRadioTuner::State"); - radio = new QRadioTuner(0); -// QVERIFY(radio->service() != 0); -// QSignalSpy stateSpy(radio, SIGNAL(stateChanged(QRadioTuner::State))); - radio->start(); -// QTRY_COMPARE(stateSpy.count(), 1); // wait for callbacks to complete in symbian API -// QCOMPARE(radio->state(), QRadioTuner::ActiveState); - -} - -void tst_QXARadio_xa::cleanupTestCase() -{ - QVERIFY(radio->service() != 0); -} - -void tst_QXARadio_xa::testBand() -{ - qRegisterMetaType<QRadioTuner::Band>("QRadioTuner::Band"); - - QVERIFY(radio->isBandSupported(QRadioTuner::FM)); - QVERIFY(!radio->isBandSupported(QRadioTuner::SW)); - radio->setBand(QRadioTuner::FM); - QVERIFY(radio->band() == QRadioTuner::FM); - if(radio->isBandSupported(QRadioTuner::AM)) { - QSignalSpy readSignal(radio, SIGNAL(bandChanged(QRadioTuner::Band))); - radio->setBand(QRadioTuner::AM); - QTRY_COMPARE(readSignal.count(), 1); // wait for callbacks to complete in symbian API - QVERIFY(radio->band() == QRadioTuner::AM); - } -} - -void tst_QXARadio_xa::testFrequency() -{ - QSignalSpy readSignal(radio, SIGNAL(frequencyChanged(int))); - radio->setFrequency(90900000); - QTRY_COMPARE(readSignal.count(), 1); // wait for callbacks to complete in symbian API - QVERIFY(radio->frequency() == 90900000); - // frequencyStep for FM radio is 100kHz (100000Hz) - QVERIFY(radio->frequencyStep(QRadioTuner::FM) == 100000); - QPair<int,int> test = radio->frequencyRange(QRadioTuner::FM); - // frequency range for FM radio is 87,5MHz - 108MHz - QVERIFY(test.first == 87500000); - QVERIFY(test.second == 108000000); -} - -void tst_QXARadio_xa::testMute() -{ - QSignalSpy readSignal(radio, SIGNAL(mutedChanged(bool))); - radio->setMuted(true); - QTRY_COMPARE(readSignal.count(), 1); // wait for callbacks to complete in symbian API - QVERIFY(radio->isMuted()); - QVERIFY(readSignal.count() == 1); -} - -void tst_QXARadio_xa::testSearch() -{ - QSignalSpy readSignal(radio, SIGNAL(searchingChanged(bool))); - QVERIFY(!radio->isSearching()); - - radio->searchForward(); - // Note: DON'T wait for callback to complete in symbian API - QVERIFY(radio->isSearching()); - - radio->cancelSearch(); - QTRY_COMPARE(readSignal.count(), 1); // wait for callbacks to complete in symbian API - QVERIFY(!radio->isSearching()); - - radio->searchBackward(); - // Note: DON'T wait for callbacks to complete in symbian API - QVERIFY(radio->isSearching()); - - radio->cancelSearch(); - QTRY_COMPARE(readSignal.count(), 1); // wait for callbacks to complete in symbian API - QVERIFY(!radio->isSearching()); -} - -void tst_QXARadio_xa::testVolume() -{ - QSignalSpy readSignal(radio, SIGNAL(volumeChanged(int))); - radio->setVolume(50); - QTRY_COMPARE(readSignal.count(), 1); // wait for callbacks to complete in symbian API - QVERIFY(radio->volume() == 50); -} - -void tst_QXARadio_xa::testSignal() -{ - QVERIFY(radio->signalStrength() != 0); - // There is no set of this only a get, do nothing else. -} - -void tst_QXARadio_xa::testStereo() -{ - // Default = Auto. Testing transition from auto to mono: - QVERIFY(radio->isStereo()); - QSignalSpy readSignal(radio, SIGNAL(stereoStatusChanged(bool))); - radio->setStereoMode(QRadioTuner::ForceMono); - QTRY_COMPARE(readSignal.count(), 1); // wait for callbacks to complete in symbian API - QVERIFY(radio->stereoMode() == QRadioTuner::ForceMono); -// QVERIFY(readSignal.count() == 1); - - // testing transition from mono to stereo: - radio->setStereoMode(QRadioTuner::ForceStereo); - QTRY_COMPARE(readSignal.count(), 1); // wait for callbacks to complete in symbian API - QVERIFY(radio->stereoMode() == QRadioTuner::ForceStereo); -// QVERIFY(readSignal.count() == 1); - - // testing transition from stereo to auto: - radio->setStereoMode(QRadioTuner::Auto); - QTRY_COMPARE(readSignal.count(), 1); // wait for callbacks to complete in symbian API - QVERIFY(radio->stereoMode() == QRadioTuner::Auto); - // QVERIFY(readSignal.count() == 1); - - // testing transition from auto to stereo: - radio->setStereoMode(QRadioTuner::ForceStereo); - QTRY_COMPARE(readSignal.count(), 1); // wait for callbacks to complete in symbian API - QVERIFY(radio->stereoMode() == QRadioTuner::ForceStereo); - // QVERIFY(readSignal.count() == 1); - - // testing transition from stereo to mono: - radio->setStereoMode(QRadioTuner::ForceMono); - QTRY_COMPARE(readSignal.count(), 1); // wait for callbacks to complete in symbian API - QVERIFY(radio->stereoMode() == QRadioTuner::ForceMono); - // QVERIFY(readSignal.count() == 1); - - // testing transition from mono to auto: - radio->setStereoMode(QRadioTuner::Auto); - QTRY_COMPARE(readSignal.count(), 1); // wait for callbacks to complete in symbian API - QVERIFY(radio->stereoMode() == QRadioTuner::Auto); -// QVERIFY(readSignal.count() == 1); - -} - -void tst_QXARadio_xa::testAvailability() -{ - QVERIFY(radio->isAvailable()); - QVERIFY(radio->availabilityError() == QtMultimediaKit::NoError); -} - -void tst_QXARadio_xa::testStopRadio() -{ - QVERIFY(radio->service() != 0); - QVERIFY(radio->error() == QRadioTuner::NoError); - QVERIFY(radio->errorString().isEmpty()); - - QSignalSpy stateSpy(radio, SIGNAL(stateChanged(QRadioTuner::State))); - - radio->stop(); - QTRY_COMPARE(stateSpy.count(), 1); // wait for callbacks to complete in symbian API - QCOMPARE(radio->state(), QRadioTuner::StoppedState); - -// delete radio; -} diff --git a/tests/auto/qradiotuner/tst_qradiotuner_xa.h b/tests/auto/qradiotuner/tst_qradiotuner_xa.h deleted file mode 100644 index 6cb7c7802..000000000 --- a/tests/auto/qradiotuner/tst_qradiotuner_xa.h +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Mobility Components. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef TST_QRADIOTUNER_XA_H -#define TST_QRADIOTUNER_XA_H - -#include <QtTest/QtTest> -#include <QDebug> -#include <QTimer> -#include <qmediaobject.h> -#include <qmediacontrol.h> -#include <qmediaservice.h> -#include <qradiotunercontrol.h> -#include <qradiotuner.h> -#include <qtmedianamespace.h> - -#include <QMessageBox> - -QT_USE_NAMESPACE - -class tst_QXARadio_xa: public QObject -{ - Q_OBJECT - -public slots: - void initTestCase(); - void cleanupTestCase(); - -private slots: - void testBand(); - void testFrequency(); - void testMute(); - void testSearch(); - void testVolume(); - void testSignal(); - void testStereo(); - void testAvailability(); - void testStopRadio(); - -private: - QRadioTuner *radio; -}; - -#endif // TST_QRADIOTUNER_XA_H diff --git a/tests/auto/qsoundeffect/qsoundeffect.pro b/tests/auto/qsoundeffect/qsoundeffect.pro index c2efb1170..116aa30ab 100644 --- a/tests/auto/qsoundeffect/qsoundeffect.pro +++ b/tests/auto/qsoundeffect/qsoundeffect.pro @@ -6,17 +6,9 @@ QT += core declarative multimediakit-private SOURCES += tst_qsoundeffect.cpp -wince*|symbian { - deploy.files = test.wav - DEPLOYMENT = deploy - DEFINES += QT_QSOUNDEFFECT_USEAPPLICATIONPATH -} else:maemo* { - DEFINES += QT_QSOUNDEFFECT_USEAPPLICATIONPATH -} else { - DEFINES += SRCDIR=\\\"$$PWD/\\\" -} +DEFINES += SRCDIR=\\\"$$PWD/\\\" -unix:!mac:!symbian { +unix:!mac { !contains(QT_CONFIG, pulseaudio) { DEFINES += QT_MULTIMEDIA_QMEDIAPLAYER } |