summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorKurt Korbatits <kurt.korbatits@nokia.com>2010-03-11 23:33:41 (GMT)
committerKurt Korbatits <kurt.korbatits@nokia.com>2010-03-11 23:33:41 (GMT)
commit3a1c77a8d92610f11b95ead77b1d2c68f0883739 (patch)
tree659c500c6da020eede2d8b92f86ef22c5e63d24b /tests/auto
parentb7ef079177ceec96f821393796c6c5b14c21704e (diff)
parent655a79094749f13f4b72d94a7b768ac89d21c7f4 (diff)
downloadQt-3a1c77a8d92610f11b95ead77b1d2c68f0883739.zip
Qt-3a1c77a8d92610f11b95ead77b1d2c68f0883739.tar.gz
Qt-3a1c77a8d92610f11b95ead77b1d2c68f0883739.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt-multimedia-staging into 4.6
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/mediaobject/media/test.sdp32
-rwxr-xr-xtests/auto/mediaobject/mediaobject.pro6
-rw-r--r--tests/auto/mediaobject/mediaobject.qrc1
-rw-r--r--tests/auto/mediaobject/tst_mediaobject.cpp75
-rw-r--r--tests/auto/qvarlengtharray/tst_qvarlengtharray.cpp47
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp57
6 files changed, 208 insertions, 10 deletions
diff --git a/tests/auto/mediaobject/media/test.sdp b/tests/auto/mediaobject/media/test.sdp
new file mode 100644
index 0000000..0d8706c
--- /dev/null
+++ b/tests/auto/mediaobject/media/test.sdp
@@ -0,0 +1,32 @@
+v=0
+o=- 3476526279 2351211129 IN IP4 XXX.XXX.XXX.XXX
+s=SOME STRING
+e=support@localhost
+c=IN IP4 XXX.XXX.XXX.XXX
+t=0 0
+a=range:npt=now-
+a=random_access_denied
+a=control:rtsp://link
+m=video 0 RTP/AVP 96
+b=AS:100
+b=RR:2500
+b=RS:2500
+a=control:rtsp://link
+a=rtpmap:96 MP4V-ES/90000
+a=3GPP-Adaptation-Support:1
+a=cliprect:0,0,144,176
+a=mpeg4-esid:201
+a=x-envivio-verid:00022B15
+a=fmtp:96 profile-level-id=2;config=000001b002000001b50ea020202f000001000000012000c788ba9850584121463f
+a=framerate:15.0
+m=audio 0 RTP/AVP 97
+b=AS:14
+b=RR:350
+b=RS:350
+a=control:rtsp://link
+a=rtpmap:97 AMR/8000
+a=3GPP-Adaptation-Support:1
+a=mpeg4-esid:101
+a=x-envivio-verid:00022B15
+a=fmtp:97 octet-align=1
+a=maxptime:200
diff --git a/tests/auto/mediaobject/mediaobject.pro b/tests/auto/mediaobject/mediaobject.pro
index 5d4a098..bef2fe9 100755
--- a/tests/auto/mediaobject/mediaobject.pro
+++ b/tests/auto/mediaobject/mediaobject.pro
@@ -14,3 +14,9 @@ wince*{
DEFINES += tst_MediaObject=tst_MediaObject_waveout
}
+symbian*:{
+ addFiles.sources = media/test.sdp
+ addFiles.path = media
+ DEPLOYMENT += addFiles
+}
+
diff --git a/tests/auto/mediaobject/mediaobject.qrc b/tests/auto/mediaobject/mediaobject.qrc
index 4f46213..77954f4 100644
--- a/tests/auto/mediaobject/mediaobject.qrc
+++ b/tests/auto/mediaobject/mediaobject.qrc
@@ -3,5 +3,6 @@
<file>media/sax.wav</file>
<file>media/sax.ogg</file>
<file>media/sax.mp3</file>
+<file>media/test.sdp</file>
</qresource>
</RCC>
diff --git a/tests/auto/mediaobject/tst_mediaobject.cpp b/tests/auto/mediaobject/tst_mediaobject.cpp
index 5ae80b9..5b0943e 100644
--- a/tests/auto/mediaobject/tst_mediaobject.cpp
+++ b/tests/auto/mediaobject/tst_mediaobject.cpp
@@ -139,6 +139,7 @@ class tst_MediaObject : public QObject
void pauseToPause();
void pauseToPlay();
void pauseToStop();
+ void playSDP();
void testPrefinishMark();
void testSeek();
@@ -160,6 +161,11 @@ class tst_MediaObject : public QObject
Phonon::MediaObject *m_media;
QSignalSpy *m_stateChangedSignalSpy;
QString m_tmpFileName;
+
+ static void copyMediaFile(const QString &original,
+ const QString &name,
+ QString &resultFilePath,
+ QUrl *const asURL = 0);
#endif //QT_NO_PHONON
bool m_success;
};
@@ -352,6 +358,24 @@ void tst_MediaObject::_pausePlayback()
m_success = true;
}
+/*!
+ Copies the file \a name to the testing area. The resulting file name path is
+ returned in resultFilePath, and also set as a URL in \a asURL.
+ */
+void tst_MediaObject::copyMediaFile(const QString &original,
+ const QString &name,
+ QString &resultFilePath,
+ QUrl *const asURL)
+{
+ resultFilePath = QDir::toNativeSeparators(QDir::tempPath() + name);
+ if (asURL)
+ *asURL = QUrl::fromLocalFile(resultFilePath);
+
+ QFile::remove(resultFilePath);
+ QVERIFY(QFile::copy(original, resultFilePath));
+ QFile::setPermissions(resultFilePath, QFile::permissions(resultFilePath) | QFile::WriteOther);
+}
+
void tst_MediaObject::initTestCase()
{
QCoreApplication::setApplicationName("tst_MediaObject");
@@ -375,14 +399,8 @@ void tst_MediaObject::initTestCase()
QVERIFY(m_stateChangedSignalSpy->isValid());
m_stateChangedSignalSpy->clear();
- if (m_url.isEmpty()) {
- m_tmpFileName = QDir::toNativeSeparators(QDir::tempPath() + MEDIA_FILE);
- QFile::remove(m_tmpFileName);
- QVERIFY(QFile::copy(MEDIA_FILEPATH, m_tmpFileName));
- QFile::Permissions p = QFile::permissions(m_tmpFileName);
- QFile::setPermissions(m_tmpFileName, p | QFile::WriteOther);
- m_url = QUrl::fromLocalFile(m_tmpFileName);
- }
+ if (m_url.isEmpty())
+ copyMediaFile(MEDIA_FILEPATH, MEDIA_FILE, m_tmpFileName, &m_url);
qDebug() << "Using url:" << m_url.toString();
@@ -533,6 +551,47 @@ void tst_MediaObject::pauseToStop()
stopPlayback(Phonon::PausedState);
}
+/*!
+
+ We attempt to play a SDP file. An SDP file essentially describes different
+ media streams and is hence a layer in front of the actual media(s).
+ Sometimes the backend handles the SDP file, in other cases not.
+
+ Some Phonon backends doesn't support SDP at all, ifdef appropriately. Real
+ Player and Helix, the two backends for Symbian, are known to support SDP.
+ */
+void tst_MediaObject::playSDP()
+{
+#ifdef Q_OS_SYMBIAN
+ QString sdpFile;
+ copyMediaFile(QLatin1String(":/media/test.sdp"), QLatin1String("test.sdp"), sdpFile);
+
+ // Let's verify our test setup.
+ QVERIFY(QFileInfo(sdpFile).isReadable());
+
+ // We need a window in order to setup the video.
+ QWidget widget;
+ widget.show();
+
+ const MediaSource oldSource(m_media->currentSource());
+ const MediaSource sdpSource(sdpFile);
+ m_media->setCurrentSource(sdpSource);
+ if (m_media->state() != Phonon::StoppedState)
+ QTest::waitForSignal(m_media, SIGNAL(stateChanged(Phonon::State, Phonon::State)), 10000);
+
+ // At this point we're in error state due to absent media, but it has now loaded the SDP:
+ QCOMPARE(m_media->errorString(), QString::fromLatin1("Buffering clip failed: Unknown error (-39)"));
+
+ // We cannot play the SDP, we can neither attempt to play it, because we
+ // won't get a state change from ErrorState to ErrorState, and hence block
+ // on a never occuring signal.
+ m_media->setCurrentSource(oldSource);
+
+#else
+ QSKIP("Unsupported on this platform.", SkipAll);
+#endif
+}
+
void tst_MediaObject::testPrefinishMark()
{
const qint32 requestedPrefinishMarkTime = 2000;
diff --git a/tests/auto/qvarlengtharray/tst_qvarlengtharray.cpp b/tests/auto/qvarlengtharray/tst_qvarlengtharray.cpp
index 0fcde21..1c43069 100644
--- a/tests/auto/qvarlengtharray/tst_qvarlengtharray.cpp
+++ b/tests/auto/qvarlengtharray/tst_qvarlengtharray.cpp
@@ -42,6 +42,7 @@
#include <QtTest/QtTest>
#include <qvarlengtharray.h>
+#include <qvariant.h>
const int N = 1;
@@ -61,6 +62,7 @@ private slots:
void removeLast();
void oldTests();
void task214223();
+ void QTBUG6718_resize();
};
int fooCtor = 0;
@@ -71,7 +73,7 @@ struct Foo
int *p;
Foo() { p = new int; ++fooCtor; }
- Foo(const Foo &other) { p = new int; ++fooCtor; }
+ Foo(const Foo &/*other*/) { p = new int; ++fooCtor; }
void operator=(const Foo & /* other */) { }
@@ -244,9 +246,50 @@ void tst_QVarLengthArray::task214223()
// will make the next call to append(const T&) corrupt the memory
// you should get a segfault pretty soon after that :-)
QVarLengthArray<float, 1> d(1);
- for (int i=0; i<30; i++)
+ for (int i=0; i<30; i++)
d.append(i);
}
+void tst_QVarLengthArray::QTBUG6718_resize()
+{
+ //MOVABLE
+ {
+ QVarLengthArray<QVariant,1> values(1);
+ QCOMPARE(values.size(), 1);
+ values[0] = 1;
+ values.resize(2);
+ QCOMPARE(values[1], QVariant());
+ QCOMPARE(values[0], QVariant(1));
+ values[1] = 2;
+ QCOMPARE(values[1], QVariant(2));
+ QCOMPARE(values.size(), 2);
+ }
+
+ //POD
+ {
+ QVarLengthArray<int,1> values(1);
+ QCOMPARE(values.size(), 1);
+ values[0] = 1;
+ values.resize(2);
+ QCOMPARE(values[0], 1);
+ values[1] = 2;
+ QCOMPARE(values[1], 2);
+ QCOMPARE(values.size(), 2);
+ }
+
+ //COMPLEX
+ {
+ QVarLengthArray<QVarLengthArray<QString, 15>,1> values(1);
+ QCOMPARE(values.size(), 1);
+ values[0].resize(10);
+ values.resize(2);
+ QCOMPARE(values[1].size(), 0);
+ QCOMPARE(values[0].size(), 10);
+ values[1].resize(20);
+ QCOMPARE(values[1].size(), 20);
+ QCOMPARE(values.size(), 2);
+ }
+}
+
QTEST_APPLESS_MAIN(tst_QVarLengthArray)
#include "tst_qvarlengtharray.moc"
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index abd9604..65f4945 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -402,6 +402,7 @@ private slots:
void scrollWithoutBackingStore();
void taskQTBUG_7532_tabOrderWithFocusProxy();
+ void movedAndResizedAttributes();
private:
bool ensureScreenSize(int width, int height);
@@ -10040,5 +10041,61 @@ void tst_QWidget::taskQTBUG_7532_tabOrderWithFocusProxy()
// No Q_ASSERT, then it's allright.
}
+void tst_QWidget::movedAndResizedAttributes()
+{
+#if defined (Q_OS_MAC) || defined(Q_WS_QWS)
+ QEXPECT_FAIL("", "FixMe, QTBUG-8941", Abort);
+ QVERIFY(false);
+#else
+ QWidget w;
+ w.show();
+
+ QVERIFY(!w.testAttribute(Qt::WA_Moved));
+ QVERIFY(!w.testAttribute(Qt::WA_Resized));
+
+ w.setWindowState(Qt::WindowFullScreen);
+
+ QVERIFY(!w.testAttribute(Qt::WA_Moved));
+ QVERIFY(!w.testAttribute(Qt::WA_Resized));
+
+ w.setWindowState(Qt::WindowMaximized);
+
+ QVERIFY(!w.testAttribute(Qt::WA_Moved));
+ QVERIFY(!w.testAttribute(Qt::WA_Resized));
+
+ w.setWindowState(Qt::WindowMinimized);
+
+ QVERIFY(!w.testAttribute(Qt::WA_Moved));
+ QVERIFY(!w.testAttribute(Qt::WA_Resized));
+
+ w.showNormal();
+
+ QVERIFY(!w.testAttribute(Qt::WA_Moved));
+ QVERIFY(!w.testAttribute(Qt::WA_Resized));
+
+ w.showMaximized();
+
+ QVERIFY(!w.testAttribute(Qt::WA_Moved));
+ QVERIFY(!w.testAttribute(Qt::WA_Resized));
+
+ w.showFullScreen();
+
+ QVERIFY(!w.testAttribute(Qt::WA_Moved));
+ QVERIFY(!w.testAttribute(Qt::WA_Resized));
+
+ w.showNormal();
+ w.move(10,10);
+ QVERIFY(w.testAttribute(Qt::WA_Moved));
+#if defined(Q_OS_WIN)
+ QEXPECT_FAIL("", "FixMe, QTBUG-8911", Abort);
+#endif
+ QVERIFY(!w.testAttribute(Qt::WA_Resized));
+
+ w.resize(100, 100);
+ QVERIFY(w.testAttribute(Qt::WA_Moved));
+ QVERIFY(w.testAttribute(Qt::WA_Resized));
+#endif
+}
+
QTEST_MAIN(tst_QWidget)
#include "tst_qwidget.moc"