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>
This commit is contained in:
Michael Goddard
2011-07-19 10:40:05 +10:00
committed by Qt by Nokia
parent 1403a1c7be
commit eccb43d73c
100 changed files with 50 additions and 8051 deletions

View File

@@ -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

View File

@@ -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 { \

View File

@@ -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

View File

@@ -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 { \

View File

@@ -7,9 +7,4 @@ QT += multimediakit-private
SOURCES += tst_qcamera.cpp
symbian {
TARGET.CAPABILITY = ALL -TCB
TARGET.EPOCHEAPSIZE = 0x20000 0x3000000
}
maemo*:CONFIG += insignificant_test

View File

@@ -7,9 +7,4 @@ QT += multimediakit-private
SOURCES += tst_qcamerabackend.cpp
symbian {
TARGET.CAPABILITY = ALL -TCB
TARGET.EPOCHEAPSIZE = 0x20000 0x3000000
}
maemo*:CONFIG += insignificant_test

View File

@@ -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);

View File

@@ -7,6 +7,4 @@ QT += multimediakit-private
SOURCES += tst_qgraphicsvideoitem.cpp
symbian: TARGET.CAPABILITY = ReadDeviceData WriteDeviceData
maemo*:CONFIG += insignificant_test

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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();
}

View File

@@ -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

View File

@@ -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());
}
}

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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

File diff suppressed because it is too large Load Diff

View File

@@ -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

File diff suppressed because it is too large Load Diff

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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());

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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

View File

@@ -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"));
}

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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 */

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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);
}

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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
}