summaryrefslogtreecommitdiffstats
path: root/tests/auto/qmediaresource/tst_qmediaresource.cpp
diff options
context:
space:
mode:
authorNicholas Young <nicholas.young@nokia.com>2010-02-04 00:45:43 (GMT)
committerNicholas Young <nicholas.young@nokia.com>2010-02-04 00:45:43 (GMT)
commit1d48062f758ae82129583b0e95b18d06faf57547 (patch)
treeb9037132db7e725b0f9997a0258a8cb0c4fdc414 /tests/auto/qmediaresource/tst_qmediaresource.cpp
parent5588657ba3b2a060e60bf8d83fd5ba60bbdc9c64 (diff)
downloadQt-1d48062f758ae82129583b0e95b18d06faf57547.zip
Qt-1d48062f758ae82129583b0e95b18d06faf57547.tar.gz
Qt-1d48062f758ae82129583b0e95b18d06faf57547.tar.bz2
Added QNetworkRequest constructor to QMediaResource.
Diffstat (limited to 'tests/auto/qmediaresource/tst_qmediaresource.cpp')
-rw-r--r--tests/auto/qmediaresource/tst_qmediaresource.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/auto/qmediaresource/tst_qmediaresource.cpp b/tests/auto/qmediaresource/tst_qmediaresource.cpp
index 55ddcab..127144d 100644
--- a/tests/auto/qmediaresource/tst_qmediaresource.cpp
+++ b/tests/auto/qmediaresource/tst_qmediaresource.cpp
@@ -63,6 +63,7 @@ void tst_QMediaResource::constructNull()
QCOMPARE(resource.isNull(), true);
QCOMPARE(resource.url(), QUrl());
+ QCOMPARE(resource.request(), QNetworkRequest());
QCOMPARE(resource.mimeType(), QString());
QCOMPARE(resource.language(), QString());
QCOMPARE(resource.audioCodec(), QString());
@@ -78,6 +79,7 @@ void tst_QMediaResource::constructNull()
void tst_QMediaResource::construct_data()
{
QTest::addColumn<QUrl>("url");
+ QTest::addColumn<QNetworkRequest>("request");
QTest::addColumn<QString>("mimeType");
QTest::addColumn<QString>("language");
QTest::addColumn<QString>("audioCodec");
@@ -91,6 +93,7 @@ void tst_QMediaResource::construct_data()
QTest::newRow("audio content")
<< QUrl(QString::fromLatin1("http:://test.com/test.mp3"))
+ << QNetworkRequest(QUrl(QString::fromLatin1("http:://test.com/test.mp3")))
<< QString::fromLatin1("audio/mpeg")
<< QString::fromLatin1("eng")
<< QString::fromLatin1("mp3")
@@ -103,6 +106,7 @@ void tst_QMediaResource::construct_data()
<< QSize();
QTest::newRow("image content")
<< QUrl(QString::fromLatin1("http:://test.com/test.jpg"))
+ << QNetworkRequest(QUrl(QString::fromLatin1("http:://test.com/test.jpg")))
<< QString::fromLatin1("image/jpeg")
<< QString()
<< QString()
@@ -115,6 +119,7 @@ void tst_QMediaResource::construct_data()
<< QSize(640, 480);
QTest::newRow("video content")
<< QUrl(QString::fromLatin1("http:://test.com/test.mp4"))
+ << QNetworkRequest(QUrl(QString::fromLatin1("http:://test.com/test.mp4")))
<< QString::fromLatin1("video/mp4")
<< QString()
<< QString::fromLatin1("aac")
@@ -127,6 +132,7 @@ void tst_QMediaResource::construct_data()
<< QSize(720, 576);
QTest::newRow("thumbnail")
<< QUrl(QString::fromLatin1("file::///thumbs/test.png"))
+ << QNetworkRequest(QUrl(QString::fromLatin1("file::///thumbs/test.png")))
<< QString::fromLatin1("image/png")
<< QString()
<< QString()
@@ -142,6 +148,7 @@ void tst_QMediaResource::construct_data()
void tst_QMediaResource::construct()
{
QFETCH(QUrl, url);
+ QFETCH(QNetworkRequest, request);
QFETCH(QString, mimeType);
QFETCH(QString, language);
QFETCH(QString, audioCodec);
@@ -174,6 +181,44 @@ void tst_QMediaResource::construct()
QCOMPARE(resource.isNull(), false);
QCOMPARE(resource.url(), url);
+ QCOMPARE(resource.request(), request);
+ QCOMPARE(resource.mimeType(), mimeType);
+ QCOMPARE(resource.language(), QString());
+ QCOMPARE(resource.audioCodec(), QString());
+ QCOMPARE(resource.videoCodec(), QString());
+ QCOMPARE(resource.dataSize(), qint64(0));
+ QCOMPARE(resource.audioBitRate(), 0);
+ QCOMPARE(resource.sampleRate(), 0);
+ QCOMPARE(resource.channelCount(), 0);
+ QCOMPARE(resource.videoBitRate(), 0);
+ QCOMPARE(resource.resolution(), QSize());
+
+ resource.setLanguage(language);
+ resource.setAudioCodec(audioCodec);
+ resource.setVideoCodec(videoCodec);
+ resource.setDataSize(dataSize);
+ resource.setAudioBitRate(audioBitRate);
+ resource.setSampleRate(sampleRate);
+ resource.setChannelCount(channelCount);
+ resource.setVideoBitRate(videoBitRate);
+ resource.setResolution(resolution);
+
+ QCOMPARE(resource.language(), language);
+ QCOMPARE(resource.audioCodec(), audioCodec);
+ QCOMPARE(resource.videoCodec(), videoCodec);
+ QCOMPARE(resource.dataSize(), dataSize);
+ QCOMPARE(resource.audioBitRate(), audioBitRate);
+ QCOMPARE(resource.sampleRate(), sampleRate);
+ QCOMPARE(resource.channelCount(), channelCount);
+ QCOMPARE(resource.videoBitRate(), videoBitRate);
+ QCOMPARE(resource.resolution(), resolution);
+ }
+ {
+ QMediaResource resource(request, mimeType);
+
+ QCOMPARE(resource.isNull(), false);
+ QCOMPARE(resource.url(), url);
+ QCOMPARE(resource.request(), request);
QCOMPARE(resource.mimeType(), mimeType);
QCOMPARE(resource.language(), QString());
QCOMPARE(resource.audioCodec(), QString());