qtmobility/tests/auto/qmediaresource/tst_qmediaresource.cpp
changeset 4 90517678cc4f
parent 1 2b40d63a9c3d
child 5 453da2cfceef
--- a/qtmobility/tests/auto/qmediaresource/tst_qmediaresource.cpp	Fri Apr 16 15:51:22 2010 +0300
+++ b/qtmobility/tests/auto/qmediaresource/tst_qmediaresource.cpp	Mon May 03 13:18:40 2010 +0300
@@ -63,6 +63,7 @@
 
     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::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 @@
 
     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 @@
             << 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 @@
             << 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 @@
             << 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()
 {
     QFETCH(QUrl, url);
+    QFETCH(QNetworkRequest, request);
     QFETCH(QString, mimeType);
     QFETCH(QString, language);
     QFETCH(QString, audioCodec);
@@ -174,6 +181,44 @@
 
         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());