summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/.gitignore (renamed from tests/auto/declarative/.gitignore)1
-rw-r--r--tests/auto/auto.pro1
-rw-r--r--tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/compiled.qml4
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/include_pragma.qml11
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/include_pragma_inner.js5
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/include_pragma_outer.js6
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/testtypes.h2
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp42
-rw-r--r--tests/auto/declarative/qdeclarativefolderlistmodel/data/basic.qml5
-rw-r--r--tests/auto/declarative/qdeclarativefolderlistmodel/data/dummy.qml1
-rw-r--r--tests/auto/declarative/qdeclarativefolderlistmodel/qdeclarativefolderlistmodel.pro17
-rw-r--r--tests/auto/declarative/qdeclarativefolderlistmodel/tst_qdeclarativefolderlistmodel.cpp113
-rw-r--r--tests/auto/declarative/qdeclarativegridview/data/manual-highlight.qml48
-rw-r--r--tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp30
-rw-r--r--tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp1
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/assignValueToSignal.errors.txt1
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/assignValueToSignal.qml (renamed from tests/auto/declarative/qdeclarativelanguage/data/emptySignal.2.qml)3
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/dynamicObjectProperties.2.qml11
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/emptySignal.2.errors.txt1
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/emptySignal.errors.txt2
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/emptySignal.qml3
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/scriptString2.qml5
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/scriptString3.qml5
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/scriptString4.qml5
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp66
-rw-r--r--tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp4
-rw-r--r--tests/auto/declarative/qdeclarativelistview/data/manual-highlight.qml47
-rw-r--r--tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp31
-rw-r--r--tests/auto/declarative/qdeclarativeloader/data/AnchoredLoader.qml14
-rw-r--r--tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp22
-rw-r--r--tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/data/mouseselection_default.qml7
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/data/mouseselection_false.qml7
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/data/mouseselection_true.qml7
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp45
-rw-r--r--tests/auto/declarative/qdeclarativevaluetypes/data/enums.5.qml10
-rw-r--r--tests/auto/declarative/qdeclarativevaluetypes/testtypes.h2
-rw-r--r--tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp8
-rw-r--r--tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp5
-rw-r--r--tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp11
-rw-r--r--tests/auto/declarative/qmlvisual/animation/parentAnimation2/data/parentAnimation2.0.pngbin0 -> 2046 bytes
-rw-r--r--tests/auto/declarative/qmlvisual/animation/parentAnimation2/data/parentAnimation2.1.pngbin0 -> 2059 bytes
-rw-r--r--tests/auto/declarative/qmlvisual/animation/parentAnimation2/data/parentAnimation2.2.pngbin0 -> 2052 bytes
-rw-r--r--tests/auto/declarative/qmlvisual/animation/parentAnimation2/data/parentAnimation2.3.pngbin0 -> 2011 bytes
-rw-r--r--tests/auto/declarative/qmlvisual/animation/parentAnimation2/data/parentAnimation2.qml1023
-rw-r--r--tests/auto/declarative/qmlvisual/animation/parentAnimation2/parentAnimation2.qml64
-rw-r--r--tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp1
-rw-r--r--tests/auto/gestures/tst_gestures.cpp83
-rw-r--r--tests/auto/mediaservices.pro19
-rw-r--r--tests/auto/qdeclarativeaudio/qdeclarativeaudio.pro14
-rw-r--r--tests/auto/qdeclarativeaudio/tst_qdeclarativeaudio.cpp1252
-rw-r--r--tests/auto/qdeclarativevideo/qdeclarativevideo.pro14
-rw-r--r--tests/auto/qdeclarativevideo/tst_qdeclarativevideo.cpp921
-rw-r--r--tests/auto/qgraphicsvideoitem/qgraphicsvideoitem.pro5
-rw-r--r--tests/auto/qgraphicsvideoitem/tst_qgraphicsvideoitem.cpp670
-rw-r--r--tests/auto/qlocale/tst_qlocale.cpp100
-rw-r--r--tests/auto/qmediacontent/qmediacontent.pro6
-rw-r--r--tests/auto/qmediacontent/tst_qmediacontent.cpp174
-rw-r--r--tests/auto/qmediaobject/qmediaobject.pro4
-rw-r--r--tests/auto/qmediaobject/tst_qmediaobject.cpp549
-rw-r--r--tests/auto/qmediaplayer/qmediaplayer.pro6
-rw-r--r--tests/auto/qmediaplayer/tst_qmediaplayer.cpp986
-rw-r--r--tests/auto/qmediaplaylist/qmediaplaylist.pro6
-rw-r--r--tests/auto/qmediaplaylist/tmp.unsupported_format0
-rw-r--r--tests/auto/qmediaplaylist/tst_qmediaplaylist.cpp593
-rw-r--r--tests/auto/qmediaplaylistnavigator/qmediaplaylistnavigator.pro6
-rw-r--r--tests/auto/qmediaplaylistnavigator/tst_qmediaplaylistnavigator.cpp316
-rw-r--r--tests/auto/qmediapluginloader/qmediapluginloader.pro6
-rw-r--r--tests/auto/qmediapluginloader/tst_qmediapluginloader.cpp121
-rw-r--r--tests/auto/qmediaresource/qmediaresource.pro6
-rw-r--r--tests/auto/qmediaresource/tst_qmediaresource.cpp516
-rw-r--r--tests/auto/qmediaservice/qmediaservice.pro6
-rw-r--r--tests/auto/qmediaservice/tst_qmediaservice.cpp219
-rw-r--r--tests/auto/qmediaserviceprovider/qmediaserviceprovider.pro6
-rw-r--r--tests/auto/qmediaserviceprovider/tst_qmediaserviceprovider.cpp481
-rw-r--r--tests/auto/qmediatimerange/qmediatimerange.pro6
-rw-r--r--tests/auto/qmediatimerange/tst_qmediatimerange.cpp735
-rw-r--r--tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp8
-rw-r--r--tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp8
-rw-r--r--tests/auto/qnetworksession/test/tst_qnetworksession.cpp8
-rw-r--r--tests/auto/qsoundeffect/qsoundeffect.pro20
-rw-r--r--tests/auto/qsoundeffect/test.wavbin38316 -> 0 bytes
-rw-r--r--tests/auto/qsoundeffect/tst_qsoundeffect.cpp144
-rw-r--r--tests/auto/qvideowidget/qvideowidget.pro6
-rw-r--r--tests/auto/qvideowidget/tst_qvideowidget.cpp1602
-rw-r--r--tests/benchmarks/declarative/binding/binding.pro11
-rw-r--r--tests/benchmarks/declarative/binding/tst_binding.cpp5
-rw-r--r--tests/benchmarks/declarative/compilation/compilation.pro8
-rw-r--r--tests/benchmarks/declarative/compilation/tst_compilation.cpp5
-rw-r--r--tests/benchmarks/declarative/creation/creation.pro9
-rw-r--r--tests/benchmarks/declarative/creation/tst_creation.cpp11
-rw-r--r--tests/benchmarks/declarative/declarative.pro7
-rw-r--r--tests/benchmarks/declarative/painting/painting.pro2
-rw-r--r--tests/benchmarks/declarative/qdeclarativecomponent/qdeclarativecomponent.pro11
-rw-r--r--tests/benchmarks/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp4
-rw-r--r--tests/benchmarks/declarative/qdeclarativeimage/qdeclarativeimage.pro3
-rw-r--r--tests/benchmarks/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp5
-rw-r--r--tests/benchmarks/declarative/qdeclarativemetaproperty/qdeclarativemetaproperty.pro13
-rw-r--r--tests/benchmarks/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp4
-rw-r--r--tests/benchmarks/declarative/qmltime/qmltime.pro16
-rw-r--r--tests/benchmarks/declarative/script/script.pro3
-rw-r--r--tests/benchmarks/declarative/script/tst_script.cpp5
-rw-r--r--tests/benchmarks/declarative/typeimports/tst_typeimports.cpp9
-rw-r--r--tests/benchmarks/declarative/typeimports/typeimports.pro8
107 files changed, 1913 insertions, 9553 deletions
diff --git a/tests/auto/declarative/.gitignore b/tests/.gitignore
index 57608cf..b203473 100644
--- a/tests/auto/declarative/.gitignore
+++ b/tests/.gitignore
@@ -1,3 +1,4 @@
+QObject.log
tst_*
!tst_*.*
tst_*.log
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index 12ebc75..c0004f7 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -16,7 +16,6 @@ unix:!embedded:contains(QT_CONFIG, dbus): SUBDIRS += dbus.pro
contains(QT_CONFIG, script): SUBDIRS += script.pro
contains(QT_CONFIG, webkit): SUBDIRS += webkit.pro
contains(QT_CONFIG, multimedia): SUBDIRS += multimedia.pro
-contains(QT_CONFIG, mediaservices): SUBDIRS += mediaservices.pro
contains(QT_CONFIG, phonon): SUBDIRS += phonon.pro
contains(QT_CONFIG, svg): SUBDIRS += svg.pro
contains(QT_CONFIG, declarative): SUBDIRS += declarative.pro
diff --git a/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp b/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp
index 851460f..7f0e6c0 100644
--- a/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp
+++ b/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp
@@ -398,7 +398,7 @@ void tst_qdeclarativecontext::destruction()
QObject obj;
QDeclarativeEngine::setContextForObject(&obj, ctxt);
- QDeclarativeExpression expr(ctxt, "a", 0);
+ QDeclarativeExpression expr(ctxt, 0, "a");
QCOMPARE(ctxt, QDeclarativeEngine::contextForObject(&obj));
QCOMPARE(ctxt, expr.context());
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/compiled.qml b/tests/auto/declarative/qdeclarativeecmascript/data/compiled.qml
index a883e85..1655905 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/data/compiled.qml
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/compiled.qml
@@ -31,6 +31,8 @@ QtObject {
property string test21: g
property string test22: h
property bool test23: i
+ property color test24: j
+ property color test25: k
property real a: 4.5
property real b: 11.2
@@ -41,4 +43,6 @@ QtObject {
property variant g: 6.7
property variant h: "!"
property variant i: true
+ property string j: "#112233"
+ property string k: "#aa112233"
}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/include_pragma.qml b/tests/auto/declarative/qdeclarativeecmascript/data/include_pragma.qml
new file mode 100644
index 0000000..67b8cfd
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/include_pragma.qml
@@ -0,0 +1,11 @@
+import Qt 4.7
+import "include_pragma_outer.js" as Script
+
+Item {
+ property int test1
+
+ Component.onCompleted: {
+ test1 = Script.callFunction()
+ }
+}
+
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/include_pragma_inner.js b/tests/auto/declarative/qdeclarativeecmascript/data/include_pragma_inner.js
new file mode 100644
index 0000000..a0380a2
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/include_pragma_inner.js
@@ -0,0 +1,5 @@
+.pragma library
+
+function getValue() {
+ return 100;
+}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/include_pragma_outer.js b/tests/auto/declarative/qdeclarativeecmascript/data/include_pragma_outer.js
new file mode 100644
index 0000000..d87bafc
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/include_pragma_outer.js
@@ -0,0 +1,6 @@
+Qt.include("include_pragma_inner.js")
+
+function callFunction() {
+ return getValue();
+}
+
diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h
index 1381d57..7bb8a8e 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h
+++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h
@@ -190,7 +190,7 @@ class MyExpression : public QDeclarativeExpression
Q_OBJECT
public:
MyExpression(QDeclarativeContext *ctxt, const QString &expr)
- : QDeclarativeExpression(ctxt, expr, 0), changed(false)
+ : QDeclarativeExpression(ctxt, 0, expr), changed(false)
{
QObject::connect(this, SIGNAL(valueChanged()), this, SLOT(expressionValueChanged()));
setNotifyOnValueChanged(true);
diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
index 64e5b3f..9a8ad64 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
+++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
@@ -2083,14 +2083,15 @@ void tst_qdeclarativeecmascript::compiled()
QCOMPARE(object->property("test15").toBool(), false);
QCOMPARE(object->property("test16").toBool(), true);
- QCOMPARE(object->property("test17").toInt(), 4);
+ QCOMPARE(object->property("test17").toInt(), 5);
QCOMPARE(object->property("test18").toReal(), qreal(176));
- QEXPECT_FAIL("", "QTBUG-9538", Continue);
- QCOMPARE(object->property("test19").toInt(), 6);
+ QCOMPARE(object->property("test19").toInt(), 7);
QCOMPARE(object->property("test20").toReal(), qreal(6.7));
QCOMPARE(object->property("test21").toString(), QLatin1String("6.7"));
QCOMPARE(object->property("test22").toString(), QLatin1String("!"));
QCOMPARE(object->property("test23").toBool(), true);
+ QCOMPARE(qvariant_cast<QColor>(object->property("test24")), QColor(0x11,0x22,0x33));
+ QCOMPARE(qvariant_cast<QColor>(object->property("test25")), QColor(0x11,0x22,0x33,0xAA));
delete object;
}
@@ -2103,20 +2104,21 @@ void tst_qdeclarativeecmascript::numberAssignment()
QObject *object = component.create();
QVERIFY(object != 0);
- QVERIFY(object->property("test1") == QVariant((qreal)6.7));
- QVERIFY(object->property("test2") == QVariant((qreal)6.7));
- QVERIFY(object->property("test3") == QVariant((qreal)6));
- QVERIFY(object->property("test4") == QVariant((qreal)6));
+ QCOMPARE(object->property("test1"), QVariant((qreal)6.7));
+ QCOMPARE(object->property("test2"), QVariant((qreal)6.7));
+ QCOMPARE(object->property("test2"), QVariant((qreal)6.7));
+ QCOMPARE(object->property("test3"), QVariant((qreal)6));
+ QCOMPARE(object->property("test4"), QVariant((qreal)6));
- QVERIFY(object->property("test5") == QVariant((int)7));
- QVERIFY(object->property("test6") == QVariant((int)7));
- QVERIFY(object->property("test7") == QVariant((int)6));
- QVERIFY(object->property("test8") == QVariant((int)6));
+ QCOMPARE(object->property("test5"), QVariant((int)7));
+ QCOMPARE(object->property("test6"), QVariant((int)7));
+ QCOMPARE(object->property("test7"), QVariant((int)6));
+ QCOMPARE(object->property("test8"), QVariant((int)6));
- QVERIFY(object->property("test9") == QVariant((unsigned int)7));
- QVERIFY(object->property("test10") == QVariant((unsigned int)7));
- QVERIFY(object->property("test11") == QVariant((unsigned int)6));
- QVERIFY(object->property("test12") == QVariant((unsigned int)6));
+ QCOMPARE(object->property("test9"), QVariant((unsigned int)7));
+ QCOMPARE(object->property("test10"), QVariant((unsigned int)7));
+ QCOMPARE(object->property("test11"), QVariant((unsigned int)6));
+ QCOMPARE(object->property("test12"), QVariant((unsigned int)6));
delete object;
}
@@ -2425,6 +2427,16 @@ void tst_qdeclarativeecmascript::include()
delete o;
}
+ // Including file with ".pragma library"
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("include_pragma.qml"));
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+ QCOMPARE(o->property("test1").toInt(), 100);
+
+ delete o;
+ }
+
// Remote - success
{
TestHTTPServer server(8111);
diff --git a/tests/auto/declarative/qdeclarativefolderlistmodel/data/basic.qml b/tests/auto/declarative/qdeclarativefolderlistmodel/data/basic.qml
new file mode 100644
index 0000000..2c4977d
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativefolderlistmodel/data/basic.qml
@@ -0,0 +1,5 @@
+import Qt.labs.folderlistmodel 1.0
+
+FolderListModel {
+ nameFilters: [ "*.qml" ]
+}
diff --git a/tests/auto/declarative/qdeclarativefolderlistmodel/data/dummy.qml b/tests/auto/declarative/qdeclarativefolderlistmodel/data/dummy.qml
new file mode 100644
index 0000000..609638b
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativefolderlistmodel/data/dummy.qml
@@ -0,0 +1 @@
+// This file is not used, it is just content for QDirModel
diff --git a/tests/auto/declarative/qdeclarativefolderlistmodel/qdeclarativefolderlistmodel.pro b/tests/auto/declarative/qdeclarativefolderlistmodel/qdeclarativefolderlistmodel.pro
new file mode 100644
index 0000000..487d0e1
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativefolderlistmodel/qdeclarativefolderlistmodel.pro
@@ -0,0 +1,17 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qdeclarativefolderlistmodel.cpp
+
+# Define SRCDIR equal to test's source directory
+symbian: {
+ DEFINES += SRCDIR=\".\"
+ importFiles.sources = data
+ importFiles.path =
+ DEPLOYMENT = importFiles
+} else {
+ DEFINES += SRCDIR=\\\"$$PWD\\\"
+}
+
+CONFIG += parallel_test
diff --git a/tests/auto/declarative/qdeclarativefolderlistmodel/tst_qdeclarativefolderlistmodel.cpp b/tests/auto/declarative/qdeclarativefolderlistmodel/tst_qdeclarativefolderlistmodel.cpp
new file mode 100644
index 0000000..8a8bfe7
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativefolderlistmodel/tst_qdeclarativefolderlistmodel.cpp
@@ -0,0 +1,113 @@
+/****************************************************************************
+**
+** 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 test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QtTest/QSignalSpy>
+#include "../../../shared/util.h"
+#include <QtDeclarative/qdeclarativeengine.h>
+#include <QtDeclarative/qdeclarativecomponent.h>
+#include <QtCore/qdir.h>
+#include <QtCore/qfile.h>
+#include <QtCore/qabstractitemmodel.h>
+#include <QDebug>
+
+// From qdeclarastivefolderlistmodel.h
+const int FileNameRole = Qt::UserRole+1;
+const int FilePathRole = Qt::UserRole+2;
+enum SortField { Unsorted, Name, Time, Size, Type };
+
+class tst_qdeclarativefolderlistmodel : public QObject
+{
+ Q_OBJECT
+public:
+ tst_qdeclarativefolderlistmodel() {}
+
+private slots:
+ void basicProperties();
+
+private:
+ void checkNoErrors(const QDeclarativeComponent& component);
+ QDeclarativeEngine engine;
+};
+
+void tst_qdeclarativefolderlistmodel::checkNoErrors(const QDeclarativeComponent& component)
+{
+ // Wait until the component is ready
+ QTRY_VERIFY(component.isReady() || component.isError());
+
+ if (component.isError()) {
+ QList<QDeclarativeError> errors = component.errors();
+ for (int ii = 0; ii < errors.count(); ++ii) {
+ const QDeclarativeError &error = errors.at(ii);
+ QByteArray errorStr = QByteArray::number(error.line()) + ":" +
+ QByteArray::number(error.column()) + ":" +
+ error.description().toUtf8();
+ qWarning() << errorStr;
+ }
+ }
+ QVERIFY(!component.isError());
+}
+
+void tst_qdeclarativefolderlistmodel::basicProperties()
+{
+ QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/basic.qml"));
+ checkNoErrors(component);
+
+ QAbstractListModel *flm = qobject_cast<QAbstractListModel*>(component.create());
+ QVERIFY(flm != 0);
+
+
+ flm->setProperty("folder",QUrl::fromLocalFile(SRCDIR "/data"));
+ QTRY_COMPARE(flm->property("count").toInt(),2); // wait for refresh
+ QCOMPARE(flm->property("folder").toUrl(), QUrl::fromLocalFile(SRCDIR "/data"));
+ QCOMPARE(flm->property("parentFolder").toUrl(), QUrl::fromLocalFile(SRCDIR));
+ QCOMPARE(flm->property("sortField").toInt(), int(Name));
+ QCOMPARE(flm->property("nameFilters").toStringList(), QStringList() << "*.qml");
+ QCOMPARE(flm->property("sortReversed").toBool(), false);
+ QCOMPARE(flm->property("showDirs").toBool(), true);
+ QCOMPARE(flm->property("showDotAndDotDot").toBool(), false);
+ QCOMPARE(flm->property("showOnlyReadable").toBool(), false);
+ QCOMPARE(flm->data(flm->index(0),FileNameRole).toString(), QLatin1String("basic.qml"));
+ QCOMPARE(flm->data(flm->index(1),FileNameRole).toString(), QLatin1String("dummy.qml"));
+}
+
+QTEST_MAIN(tst_qdeclarativefolderlistmodel)
+
+#include "tst_qdeclarativefolderlistmodel.moc"
diff --git a/tests/auto/declarative/qdeclarativegridview/data/manual-highlight.qml b/tests/auto/declarative/qdeclarativegridview/data/manual-highlight.qml
new file mode 100644
index 0000000..510fcc5
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativegridview/data/manual-highlight.qml
@@ -0,0 +1,48 @@
+import Qt 4.7
+
+Item {
+
+ ListModel {
+ id: model
+ ListElement {
+ name: "Bill Smith"
+ number: "555 3264"
+ }
+ ListElement {
+ name: "John Brown"
+ number: "555 8426"
+ }
+ ListElement {
+ name: "Sam Wise"
+ number: "555 0473"
+ }
+ ListElement {
+ name: "Bob Brown"
+ number: "555 5845"
+ }
+ }
+
+ Component {
+ id: highlight
+ Rectangle {
+ objectName: "highlight"
+ width: 80; height: 80
+ color: "lightsteelblue"; radius: 5
+ y: grid.currentItem.y
+ x: grid.currentItem.x
+ }
+ }
+
+ GridView {
+ id: grid
+ objectName: "grid"
+ anchors.fill: parent
+ model: model
+ delegate: Text { objectName: "wrapper"; text: name; width: 80; height: 80 }
+
+ highlight: highlight
+ highlightFollowsCurrentItem: false
+ focus: true
+ }
+
+}
diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp
index 89be151..2db3ee6 100644
--- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp
+++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp
@@ -75,6 +75,7 @@ private slots:
void resetModel();
void enforceRange();
void QTBUG_8456();
+ void manualHighlight();
private:
QDeclarativeView *createView();
@@ -1107,6 +1108,35 @@ void tst_QDeclarativeGridView::QTBUG_8456()
QTRY_COMPARE(gridview->currentIndex(), 0);
}
+void tst_QDeclarativeGridView::manualHighlight()
+{
+ QDeclarativeView *canvas = createView();
+
+ QString filename(SRCDIR "/data/manual-highlight.qml");
+ canvas->setSource(QUrl::fromLocalFile(filename));
+
+ qApp->processEvents();
+
+ QDeclarativeGridView *gridview = findItem<QDeclarativeGridView>(canvas->rootObject(), "grid");
+ QTRY_VERIFY(gridview != 0);
+
+ QDeclarativeItem *viewport = gridview->viewport();
+ QTRY_VERIFY(viewport != 0);
+
+ QTRY_COMPARE(gridview->currentIndex(), 0);
+ QTRY_COMPARE(gridview->currentItem(), findItem<QDeclarativeItem>(viewport, "wrapper", 0));
+ QTRY_COMPARE(gridview->highlightItem()->y(), gridview->currentItem()->y());
+ QTRY_COMPARE(gridview->highlightItem()->x(), gridview->currentItem()->x());
+
+ gridview->setCurrentIndex(2);
+
+ QTRY_COMPARE(gridview->currentIndex(), 2);
+ QTRY_COMPARE(gridview->currentItem(), findItem<QDeclarativeItem>(viewport, "wrapper", 2));
+ QTRY_COMPARE(gridview->highlightItem()->y(), gridview->currentItem()->y());
+ QTRY_COMPARE(gridview->highlightItem()->x(), gridview->currentItem()->x());
+}
+
+
QDeclarativeView *tst_QDeclarativeGridView::createView()
{
QDeclarativeView *canvas = new QDeclarativeView(0);
diff --git a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp
index e0143a6..720702a 100644
--- a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp
+++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp
@@ -400,7 +400,7 @@ T *tst_qdeclarativeimage::findItem(QGraphicsObject *parent, const QString &objec
//qDebug() << "try" << item;
if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) {
if (index != -1) {
- QDeclarativeExpression e(qmlContext(item), "index", item);
+ QDeclarativeExpression e(qmlContext(item), item, "index");
if (e.evaluate().toInt() == index)
return static_cast<T*>(item);
} else {
diff --git a/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp b/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp
index 9ae26f2..1e88255 100644
--- a/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp
+++ b/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp
@@ -534,7 +534,6 @@ void tst_qdeclarativeinstruction::dump()
<< "-------------------------------------------------------------------------------"
<< "0\t\t0\tINIT\t\t\t0\t3\t-1\t-1"
<< "1\t\t1\tCREATE\t\t\t0\t\t\t\"Test\""
- << "1\t\t1\tCREATE_SIMPLE\t\t-1"
<< "2\t\t2\tSETID\t\t\t0\t\t\t\"testId\""
<< "3\t\t3\tSET_DEFAULT"
<< "4\t\t4\tCREATE_COMPONENT\t3"
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/assignValueToSignal.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/assignValueToSignal.errors.txt
new file mode 100644
index 0000000..eb1430a
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/assignValueToSignal.errors.txt
@@ -0,0 +1 @@
+4:5:Cannot assign a value to a signal (expecting a script to be run)
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/emptySignal.2.qml b/tests/auto/declarative/qdeclarativelanguage/data/assignValueToSignal.qml
index c84fea3..6fa1259 100644
--- a/tests/auto/declarative/qdeclarativelanguage/data/emptySignal.2.qml
+++ b/tests/auto/declarative/qdeclarativelanguage/data/assignValueToSignal.qml
@@ -1,7 +1,6 @@
import Test 1.0
MyQmlObject {
- onBasicSignal {
- }
+ onBasicSignal: "hello world"
}
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/dynamicObjectProperties.2.qml b/tests/auto/declarative/qdeclarativelanguage/data/dynamicObjectProperties.2.qml
new file mode 100644
index 0000000..df3de20
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/dynamicObjectProperties.2.qml
@@ -0,0 +1,11 @@
+import Qt 4.7
+import Qt 4.7 as Qt47
+
+Qt.QtObject {
+ property Qt47.QtObject objectProperty
+ property list<Qt47.QtObject> objectPropertyList
+
+ objectProperty: QtObject {}
+ objectPropertyList: QtObject {}
+}
+
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/emptySignal.2.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/emptySignal.2.errors.txt
deleted file mode 100644
index 8b20434..0000000
--- a/tests/auto/declarative/qdeclarativelanguage/data/emptySignal.2.errors.txt
+++ /dev/null
@@ -1 +0,0 @@
-4:5:Incorrectly specified signal assignment
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/emptySignal.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/emptySignal.errors.txt
index 353bbf5..8b20434 100644
--- a/tests/auto/declarative/qdeclarativelanguage/data/emptySignal.errors.txt
+++ b/tests/auto/declarative/qdeclarativelanguage/data/emptySignal.errors.txt
@@ -1 +1 @@
-4:5:Empty signal assignment
+4:5:Incorrectly specified signal assignment
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/emptySignal.qml b/tests/auto/declarative/qdeclarativelanguage/data/emptySignal.qml
index 4c5a122..c84fea3 100644
--- a/tests/auto/declarative/qdeclarativelanguage/data/emptySignal.qml
+++ b/tests/auto/declarative/qdeclarativelanguage/data/emptySignal.qml
@@ -1,6 +1,7 @@
import Test 1.0
MyQmlObject {
- onBasicSignal: " "
+ onBasicSignal {
+ }
}
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/scriptString2.qml b/tests/auto/declarative/qdeclarativelanguage/data/scriptString2.qml
new file mode 100644
index 0000000..c42da2b
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/scriptString2.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+
+MyTypeObject {
+ scriptProperty: "hello\n\"world\""
+}
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/scriptString3.qml b/tests/auto/declarative/qdeclarativelanguage/data/scriptString3.qml
new file mode 100644
index 0000000..0cd82ff
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/scriptString3.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+
+MyTypeObject {
+ scriptProperty: 12.345
+}
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/scriptString4.qml b/tests/auto/declarative/qdeclarativelanguage/data/scriptString4.qml
new file mode 100644
index 0000000..3e2f9a4
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/scriptString4.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+
+MyTypeObject {
+ scriptProperty: true
+}
diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
index 6b070f5..011870c 100644
--- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
+++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
@@ -351,8 +351,8 @@ void tst_qdeclarativelanguage::errors_data()
QTest::newRow("invalidAttachedProperty.12") << "invalidAttachedProperty.12.qml" << "invalidAttachedProperty.12.errors.txt" << false;
QTest::newRow("invalidAttachedProperty.13") << "invalidAttachedProperty.13.qml" << "invalidAttachedProperty.13.errors.txt" << false;
+ QTest::newRow("assignValueToSignal") << "assignValueToSignal.qml" << "assignValueToSignal.errors.txt" << false;
QTest::newRow("emptySignal") << "emptySignal.qml" << "emptySignal.errors.txt" << false;
- QTest::newRow("emptySignal.2") << "emptySignal.2.qml" << "emptySignal.2.errors.txt" << false;
QTest::newRow("nestedErrors") << "nestedErrors.qml" << "nestedErrors.errors.txt" << false;
QTest::newRow("defaultGrouped") << "defaultGrouped.qml" << "defaultGrouped.errors.txt" << false;
@@ -683,6 +683,7 @@ void tst_qdeclarativelanguage::listProperties()
// ### Not complete
void tst_qdeclarativelanguage::dynamicObjectProperties()
{
+ {
QDeclarativeComponent component(&engine, TEST_FILE("dynamicObjectProperties.qml"));
VERIFY_ERRORS(0);
QObject *object = component.create();
@@ -690,6 +691,16 @@ void tst_qdeclarativelanguage::dynamicObjectProperties()
QVERIFY(object->property("objectProperty") == qVariantFromValue((QObject*)0));
QVERIFY(object->property("objectProperty2") != qVariantFromValue((QObject*)0));
+ }
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("dynamicObjectProperties.2.qml"));
+ QEXPECT_FAIL("", "QTBUG-10822", Abort);
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QVERIFY(object->property("objectProperty") != qVariantFromValue((QObject*)0));
+ }
}
// Tests the declaration of dynamic signals and slots
@@ -1105,19 +1116,48 @@ void tst_qdeclarativelanguage::onDestruction()
// Check that assignments to QDeclarativeScriptString properties work
void tst_qdeclarativelanguage::scriptString()
{
- QDeclarativeComponent component(&engine, TEST_FILE("scriptString.qml"));
- VERIFY_ERRORS(0);
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("scriptString.qml"));
+ VERIFY_ERRORS(0);
- MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create());
- QVERIFY(object != 0);
- QCOMPARE(object->scriptProperty().script(), QString("foo + bar"));
- QCOMPARE(object->scriptProperty().scopeObject(), qobject_cast<QObject*>(object));
- QCOMPARE(object->scriptProperty().context(), qmlContext(object));
-
- QVERIFY(object->grouped() != 0);
- QCOMPARE(object->grouped()->script().script(), QString("console.log(1921)"));
- QCOMPARE(object->grouped()->script().scopeObject(), qobject_cast<QObject*>(object));
- QCOMPARE(object->grouped()->script().context(), qmlContext(object));
+ MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->scriptProperty().script(), QString("foo + bar"));
+ QCOMPARE(object->scriptProperty().scopeObject(), qobject_cast<QObject*>(object));
+ QCOMPARE(object->scriptProperty().context(), qmlContext(object));
+
+ QVERIFY(object->grouped() != 0);
+ QCOMPARE(object->grouped()->script().script(), QString("console.log(1921)"));
+ QCOMPARE(object->grouped()->script().scopeObject(), qobject_cast<QObject*>(object));
+ QCOMPARE(object->grouped()->script().context(), qmlContext(object));
+ }
+
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("scriptString2.qml"));
+ VERIFY_ERRORS(0);
+
+ MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->scriptProperty().script(), QString("\"hello\\n\\\"world\\\"\""));
+ }
+
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("scriptString3.qml"));
+ VERIFY_ERRORS(0);
+
+ MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->scriptProperty().script(), QString("12.345"));
+ }
+
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("scriptString4.qml"));
+ VERIFY_ERRORS(0);
+
+ MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->scriptProperty().script(), QString("true"));
+ }
}
// Check that default property assignments are correctly spliced into explicit
diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
index 26a12f0..be4ffe8 100644
--- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
+++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
@@ -275,7 +275,7 @@ void tst_qdeclarativelistmodel::dynamic()
QDeclarativeListModel model;
QDeclarativeEngine::setContextForObject(&model,engine.rootContext());
engine.rootContext()->setContextObject(&model);
- QDeclarativeExpression e(engine.rootContext(), script, &model);
+ QDeclarativeExpression e(engine.rootContext(), &model, script);
if (!warning.isEmpty())
QTest::ignoreMessage(QtWarningMsg, warning.toLatin1());
@@ -332,7 +332,7 @@ void tst_qdeclarativelistmodel::dynamic_worker()
Q_ARG(QVariant, operations.mid(0, operations.length()-1))));
waitForWorker(item);
- QDeclarativeExpression e(eng.rootContext(), operations.last().toString(), &model);
+ QDeclarativeExpression e(eng.rootContext(), &model, operations.last().toString());
if (QByteArray(QTest::currentDataTag()).startsWith("nested"))
QVERIFY(e.evaluate().toInt() != result);
else
diff --git a/tests/auto/declarative/qdeclarativelistview/data/manual-highlight.qml b/tests/auto/declarative/qdeclarativelistview/data/manual-highlight.qml
new file mode 100644
index 0000000..4913ebe
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelistview/data/manual-highlight.qml
@@ -0,0 +1,47 @@
+import Qt 4.7
+
+Item {
+
+ ListModel {
+ id: model
+ ListElement {
+ name: "Bill Smith"
+ number: "555 3264"
+ }
+ ListElement {
+ name: "John Brown"
+ number: "555 8426"
+ }
+ ListElement {
+ name: "Sam Wise"
+ number: "555 0473"
+ }
+ ListElement {
+ name: "Bob Brown"
+ number: "555 5845"
+ }
+ }
+
+ Component {
+ id: highlight
+ Rectangle {
+ objectName: "highlight"
+ width: 180; height: 20
+ color: "lightsteelblue"; radius: 5
+ y: list.currentItem.y
+ }
+ }
+
+ ListView {
+ id: list
+ objectName: "list"
+ anchors.fill: parent
+ model: model
+ delegate: Text { objectName: "wrapper"; text: name }
+
+ highlight: highlight
+ highlightFollowsCurrentItem: false
+ focus: true
+ }
+
+}
diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
index ec2afae..203760e 100644
--- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
+++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
@@ -90,6 +90,7 @@ private slots:
void componentChanges();
void modelChanges();
void QTBUG_9791();
+ void manualHighlight();
private:
template <class T> void items();
@@ -1463,6 +1464,34 @@ void tst_QDeclarativeListView::QTBUG_9791()
delete canvas;
}
+void tst_QDeclarativeListView::manualHighlight()
+{
+ QDeclarativeView *canvas = new QDeclarativeView(0);
+ canvas->setFixedSize(240,320);
+
+ QDeclarativeContext *ctxt = canvas->rootContext();
+
+ QString filename(SRCDIR "/data/manual-highlight.qml");
+ canvas->setSource(QUrl::fromLocalFile(filename));
+
+ qApp->processEvents();
+
+ QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list");
+ QTRY_VERIFY(listview != 0);
+
+ QDeclarativeItem *viewport = listview->viewport();
+ QTRY_VERIFY(viewport != 0);
+
+ QTRY_COMPARE(listview->currentIndex(), 0);
+ QTRY_COMPARE(listview->currentItem(), findItem<QDeclarativeItem>(viewport, "wrapper", 0));
+ QTRY_COMPARE(listview->highlightItem()->y(), listview->currentItem()->y());
+
+ listview->setCurrentIndex(2);
+
+ QTRY_COMPARE(listview->currentIndex(), 2);
+ QTRY_COMPARE(listview->currentItem(), findItem<QDeclarativeItem>(viewport, "wrapper", 2));
+ QTRY_COMPARE(listview->highlightItem()->y(), listview->currentItem()->y());
+}
void tst_QDeclarativeListView::qListModelInterface_items()
{
@@ -1550,7 +1579,7 @@ T *tst_QDeclarativeListView::findItem(QGraphicsObject *parent, const QString &ob
//qDebug() << "try" << item;
if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) {
if (index != -1) {
- QDeclarativeExpression e(qmlContext(item), "index", item);
+ QDeclarativeExpression e(qmlContext(item), item, "index");
if (e.evaluate().toInt() == index)
return static_cast<T*>(item);
} else {
diff --git a/tests/auto/declarative/qdeclarativeloader/data/AnchoredLoader.qml b/tests/auto/declarative/qdeclarativeloader/data/AnchoredLoader.qml
new file mode 100644
index 0000000..5d02dae
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeloader/data/AnchoredLoader.qml
@@ -0,0 +1,14 @@
+import Qt 4.7
+
+Rectangle {
+ width: 300
+ height: 200
+ color: "blue"
+ Loader {
+ objectName: "loader"
+ anchors.fill: parent
+ sourceComponent: Component {
+ Rectangle { color: "red"; objectName: "sourceElement" }
+ }
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp
index 59580ea..11cc61b 100644
--- a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp
+++ b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp
@@ -78,6 +78,7 @@ private slots:
void clear();
void urlToComponent();
void componentToUrl();
+ void anchoredLoader();
void sizeLoaderToItem();
void sizeItemToLoader();
void noResize();
@@ -266,6 +267,27 @@ void tst_QDeclarativeLoader::componentToUrl()
delete item;
}
+void tst_QDeclarativeLoader::anchoredLoader()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("/AnchoredLoader.qml"));
+ QDeclarativeItem *rootItem = qobject_cast<QDeclarativeItem*>(component.create());
+ QVERIFY(rootItem != 0);
+ QDeclarativeItem *loader = rootItem->findChild<QDeclarativeItem*>("loader");
+ QDeclarativeItem *sourceElement = rootItem->findChild<QDeclarativeItem*>("sourceElement");
+
+ QVERIFY(loader != 0);
+ QVERIFY(sourceElement != 0);
+
+ QCOMPARE(rootItem->width(), 300.0);
+ QCOMPARE(rootItem->height(), 200.0);
+
+ QCOMPARE(loader->width(), 300.0);
+ QCOMPARE(loader->height(), 200.0);
+
+ QCOMPARE(sourceElement->width(), 300.0);
+ QCOMPARE(sourceElement->height(), 200.0);
+}
+
void tst_QDeclarativeLoader::sizeLoaderToItem()
{
QDeclarativeComponent component(&engine, TEST_FILE("/SizeToItem.qml"));
diff --git a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp
index 0e16f66..f32a6c7 100644
--- a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp
+++ b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp
@@ -760,7 +760,7 @@ T *tst_QDeclarativePathView::findItem(QGraphicsObject *parent, const QString &ob
//qDebug() << "try" << item;
if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) {
if (index != -1) {
- QDeclarativeExpression e(qmlContext(item), "index", item);
+ QDeclarativeExpression e(qmlContext(item), item, "index");
if (e.evaluate().toInt() == index)
return static_cast<T*>(item);
} else {
diff --git a/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_default.qml b/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_default.qml
new file mode 100644
index 0000000..f1cf86c
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_default.qml
@@ -0,0 +1,7 @@
+import Qt 4.7
+
+TextEdit {
+ focus: true
+ text: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ selectByMouse: false
+}
diff --git a/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_false.qml b/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_false.qml
new file mode 100644
index 0000000..f1cf86c
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_false.qml
@@ -0,0 +1,7 @@
+import Qt 4.7
+
+TextEdit {
+ focus: true
+ text: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ selectByMouse: false
+}
diff --git a/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_true.qml b/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_true.qml
new file mode 100644
index 0000000..90383b9
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_true.qml
@@ -0,0 +1,7 @@
+import Qt 4.7
+
+TextEdit {
+ focus: true
+ text: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ selectByMouse: true
+}
diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
index c65c883..4befc4c 100644
--- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
+++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
@@ -76,6 +76,8 @@ private slots:
void persistentSelection();
void focusOnPress();
void selection();
+ void mouseSelection_data();
+ void mouseSelection();
void inputMethodHints();
void cursorDelegate();
@@ -602,6 +604,49 @@ void tst_qdeclarativetextedit::selection()
QVERIFY(textEditObject->selectedText().size() == 10);
}
+void tst_qdeclarativetextedit::mouseSelection_data()
+{
+ QTest::addColumn<QString>("qmlfile");
+ QTest::addColumn<bool>("expectSelection");
+
+ // import installed
+ QTest::newRow("on") << SRCDIR "/data/mouseselection_true.qml" << true;
+ QTest::newRow("off") << SRCDIR "/data/mouseselection_false.qml" << false;
+ QTest::newRow("default") << SRCDIR "/data/mouseselection_default.qml" << false;
+}
+
+void tst_qdeclarativetextedit::mouseSelection()
+{
+ QFETCH(QString, qmlfile);
+ QFETCH(bool, expectSelection);
+
+ QDeclarativeView *canvas = createView(qmlfile);
+
+ canvas->show();
+ QApplication::setActiveWindow(canvas);
+ QTest::qWaitForWindowShown(canvas);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(canvas));
+
+ QVERIFY(canvas->rootObject() != 0);
+ QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit *>(canvas->rootObject());
+ QVERIFY(textEditObject != 0);
+
+ // press-and-drag-and-release from x1 to x2
+ int x1 = 10;
+ int x2 = 70;
+ int y = textEditObject->height()/2;
+ QTest::mousePress(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(x1,y)));
+ //QTest::mouseMove(canvas->viewport(), canvas->mapFromScene(QPoint(x2,y))); // doesn't work
+ QMouseEvent mv(QEvent::MouseMove, canvas->mapFromScene(QPoint(x2,y)), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier);
+ QApplication::sendEvent(canvas->viewport(), &mv);
+ QTest::mouseRelease(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(x2,y)));
+ QString str = textEditObject->selectedText();
+ if (expectSelection)
+ QVERIFY(str.length() > 3); // don't reallly care *what* was selected (and it's too sensitive to platform)
+ else
+ QVERIFY(str.isEmpty());
+}
+
void tst_qdeclarativetextedit::inputMethodHints()
{
QDeclarativeView *canvas = createView(SRCDIR "/data/inputmethodhints.qml");
diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/enums.5.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/enums.5.qml
new file mode 100644
index 0000000..a66e9d6
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativevaluetypes/data/enums.5.qml
@@ -0,0 +1,10 @@
+import Test 1.0
+import Qt 4.7 as MyQt
+
+MyTypeObject {
+ MyQt.Component.onCompleted: {
+ font.capitalization = MyQt.Font.AllUppercase
+ }
+}
+
+
diff --git a/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h b/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h
index 1da9990..7ed3993 100644
--- a/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h
+++ b/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h
@@ -99,7 +99,7 @@ public:
m_font.setOverline(true);
m_font.setStrikeOut(true);
m_font.setPointSize(29);
- m_font.setCapitalization(QFont::AllUppercase);
+ m_font.setCapitalization(QFont::AllLowercase);
m_font.setLetterSpacing(QFont::AbsoluteSpacing, 10.2);
m_font.setWordSpacing(19.7);
}
diff --git a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp
index 95b9baa..53fd68c 100644
--- a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp
+++ b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp
@@ -838,6 +838,14 @@ void tst_qdeclarativevaluetypes::enums()
QVERIFY(object->font().capitalization() == QFont::AllUppercase);
delete object;
}
+
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("enums.5.qml"));
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+ QVERIFY(object->font().capitalization() == QFont::AllUppercase);
+ delete object;
+ }
}
// Tests switching between "conflicting" bindings (eg. a binding on the core
diff --git a/tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp b/tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp
index dd2f46e..b183105 100644
--- a/tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp
+++ b/tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp
@@ -45,6 +45,7 @@
#include <QtDeclarative/qdeclarativeview.h>
#include <QtDeclarative/qdeclarativeitem.h>
#include <QtGui/qgraphicswidget.h>
+#include "../../../shared/util.h"
class tst_QDeclarativeView : public QObject
@@ -106,9 +107,9 @@ void tst_QDeclarativeView::resizemodedeclarativeitem()
// size update from root object
declarativeItem->setWidth(250);
declarativeItem->setHeight(350);
- qApp->processEvents();
QCOMPARE(declarativeItem->width(), 250.0);
QCOMPARE(declarativeItem->height(), 350.0);
+ QTRY_COMPARE(canvas->size(), QSize(250, 350));
QCOMPARE(canvas->size(), QSize(250, 350));
QCOMPARE(canvas->size(), canvas->sizeHint());
QCOMPARE(sceneResizedSpy.count(), 4);
@@ -134,9 +135,9 @@ void tst_QDeclarativeView::resizemodedeclarativeitem()
// size update from root object
declarativeItem->setWidth(80);
declarativeItem->setHeight(100);
- qApp->processEvents();
QCOMPARE(declarativeItem->width(), 80.0);
QCOMPARE(declarativeItem->height(), 100.0);
+ QTRY_COMPARE(canvas->size(), QSize(80, 100));
QCOMPARE(canvas->size(), QSize(80, 100));
QCOMPARE(canvas->size(), canvas->sizeHint());
QCOMPARE(sceneResizedSpy2.count(), 2);
diff --git a/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp b/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp
index c238ef9..8f3fb16 100644
--- a/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp
+++ b/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp
@@ -190,7 +190,7 @@ T *tst_qdeclarativevisualdatamodel::findItem(QGraphicsObject *parent, const QStr
//qDebug() << "try" << item;
if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) {
if (index != -1) {
- QDeclarativeExpression e(qmlContext(item), "index", item);
+ QDeclarativeExpression e(qmlContext(item), item, "index");
if (e.evaluate().toInt() == index)
return static_cast<T*>(item);
} else {
diff --git a/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp b/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp
index 831e318..7769979 100644
--- a/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp
+++ b/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp
@@ -238,7 +238,7 @@ void tst_qdeclarativexmllistmodel::roleErrors()
QCOMPARE(data.value(Qt::UserRole+1), QVariant());
QCOMPARE(data.value(Qt::UserRole+2), QVariant());
- QEXPECT_FAIL("", "QT-2456", Continue);
+ QEXPECT_FAIL("", "QTBUG-10797", Continue);
QCOMPARE(data.value(Qt::UserRole+3), QVariant());
delete model;
@@ -268,10 +268,12 @@ void tst_qdeclarativexmllistmodel::xml()
QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create());
QSignalSpy spy(model, SIGNAL(statusChanged(QDeclarativeXmlListModel::Status)));
+ QVERIFY(model->errorString().isEmpty());
QCOMPARE(model->progress(), qreal(0.0));
QCOMPARE(model->status(), QDeclarativeXmlListModel::Loading);
QTRY_COMPARE(spy.count(), 1); spy.clear();
QCOMPARE(model->status(), QDeclarativeXmlListModel::Ready);
+ QVERIFY(model->errorString().isEmpty());
QCOMPARE(model->progress(), qreal(1.0));
QCOMPARE(model->count(), 9);
@@ -284,6 +286,7 @@ void tst_qdeclarativexmllistmodel::xml()
QCOMPARE(model->status(), QDeclarativeXmlListModel::Loading);
QTRY_COMPARE(spy.count(), 1); spy.clear();
QCOMPARE(model->status(), QDeclarativeXmlListModel::Ready);
+ QVERIFY(model->errorString().isEmpty());
QCOMPARE(model->count(), count);
delete model;
@@ -309,10 +312,12 @@ void tst_qdeclarativexmllistmodel::source()
QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create());
QSignalSpy spy(model, SIGNAL(statusChanged(QDeclarativeXmlListModel::Status)));
+ QVERIFY(model->errorString().isEmpty());
QCOMPARE(model->progress(), qreal(0.0));
QCOMPARE(model->status(), QDeclarativeXmlListModel::Loading);
QTRY_COMPARE(spy.count(), 1); spy.clear();
QCOMPARE(model->status(), QDeclarativeXmlListModel::Ready);
+ QVERIFY(model->errorString().isEmpty());
QCOMPARE(model->progress(), qreal(1.0));
QCOMPARE(model->count(), 9);
@@ -320,6 +325,7 @@ void tst_qdeclarativexmllistmodel::source()
QCOMPARE(model->progress(), qreal(0.0));
QTRY_COMPARE(spy.count(), 1); spy.clear();
QCOMPARE(model->status(), QDeclarativeXmlListModel::Loading);
+ QVERIFY(model->errorString().isEmpty());
QEventLoop loop;
QTimer timer;
@@ -337,9 +343,12 @@ void tst_qdeclarativexmllistmodel::source()
QCOMPARE(model->status(), status);
QCOMPARE(model->count(), count);
+
if (status == QDeclarativeXmlListModel::Ready)
QCOMPARE(model->progress(), qreal(1.0));
+ QCOMPARE(model->errorString().isEmpty(), status == QDeclarativeXmlListModel::Ready);
+
delete model;
}
diff --git a/tests/auto/declarative/qmlvisual/animation/parentAnimation2/data/parentAnimation2.0.png b/tests/auto/declarative/qmlvisual/animation/parentAnimation2/data/parentAnimation2.0.png
new file mode 100644
index 0000000..135911c
--- /dev/null
+++ b/tests/auto/declarative/qmlvisual/animation/parentAnimation2/data/parentAnimation2.0.png
Binary files differ
diff --git a/tests/auto/declarative/qmlvisual/animation/parentAnimation2/data/parentAnimation2.1.png b/tests/auto/declarative/qmlvisual/animation/parentAnimation2/data/parentAnimation2.1.png
new file mode 100644
index 0000000..0d71292
--- /dev/null
+++ b/tests/auto/declarative/qmlvisual/animation/parentAnimation2/data/parentAnimation2.1.png
Binary files differ
diff --git a/tests/auto/declarative/qmlvisual/animation/parentAnimation2/data/parentAnimation2.2.png b/tests/auto/declarative/qmlvisual/animation/parentAnimation2/data/parentAnimation2.2.png
new file mode 100644
index 0000000..920d992
--- /dev/null
+++ b/tests/auto/declarative/qmlvisual/animation/parentAnimation2/data/parentAnimation2.2.png
Binary files differ
diff --git a/tests/auto/declarative/qmlvisual/animation/parentAnimation2/data/parentAnimation2.3.png b/tests/auto/declarative/qmlvisual/animation/parentAnimation2/data/parentAnimation2.3.png
new file mode 100644
index 0000000..1c4d89e
--- /dev/null
+++ b/tests/auto/declarative/qmlvisual/animation/parentAnimation2/data/parentAnimation2.3.png
Binary files differ
diff --git a/tests/auto/declarative/qmlvisual/animation/parentAnimation2/data/parentAnimation2.qml b/tests/auto/declarative/qmlvisual/animation/parentAnimation2/data/parentAnimation2.qml
new file mode 100644
index 0000000..9e1b923
--- /dev/null
+++ b/tests/auto/declarative/qmlvisual/animation/parentAnimation2/data/parentAnimation2.qml
@@ -0,0 +1,1023 @@
+import Qt.VisualTest 4.7
+
+VisualTest {
+ Frame {
+ msec: 0
+ }
+ Frame {
+ msec: 16
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 32
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 48
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 64
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 80
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 96
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 112
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 128
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 144
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 160
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 176
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 192
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 208
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 224
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 240
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 256
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 272
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 288
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 304
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 320
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 336
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 352
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 368
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 384
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 400
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 416
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 432
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 448
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 464
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 480
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 496
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 512
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 528
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 544
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 560
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 576
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 592
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 608
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 624
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 640
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 656
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 672
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 688
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 704
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Mouse {
+ type: 2
+ button: 1
+ buttons: 1
+ x: 350; y: 182
+ modifiers: 0
+ sendToViewport: true
+ }
+ Frame {
+ msec: 720
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 736
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 752
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 768
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 784
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 800
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Mouse {
+ type: 3
+ button: 1
+ buttons: 0
+ x: 350; y: 182
+ modifiers: 0
+ sendToViewport: true
+ }
+ Frame {
+ msec: 816
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 832
+ hash: "9b524b546d250d239ea99dd3319f3d6a"
+ }
+ Frame {
+ msec: 848
+ hash: "593300f166c2fd3c325cb35114ca595b"
+ }
+ Frame {
+ msec: 864
+ hash: "4451e76e111c99faa77b5fff9a2642fa"
+ }
+ Frame {
+ msec: 880
+ hash: "0b4a5675afba935e17eba19e29b709ee"
+ }
+ Frame {
+ msec: 896
+ hash: "8682866f0234eebf25aca27a7737c777"
+ }
+ Frame {
+ msec: 912
+ hash: "5b3b70dd366bb4c1b5e7d56ce50e59a6"
+ }
+ Frame {
+ msec: 928
+ hash: "897394982c93ebcbea68c25cec6d47d3"
+ }
+ Frame {
+ msec: 944
+ hash: "23c3c0383a517d33767adeebc53bfa3a"
+ }
+ Frame {
+ msec: 960
+ image: "parentAnimation2.0.png"
+ }
+ Frame {
+ msec: 976
+ hash: "95b4fe1e5eeffe1673e199308e8ce76c"
+ }
+ Frame {
+ msec: 992
+ hash: "dbb9a5aa9f569b97711aa2c1f5ebda47"
+ }
+ Frame {
+ msec: 1008
+ hash: "0a5a73409b019e650ea860e1a8e27328"
+ }
+ Frame {
+ msec: 1024
+ hash: "496bd0d053522bcf71d506b497ede0d5"
+ }
+ Frame {
+ msec: 1040
+ hash: "97a32b4a6c99ffe842c35e903bd23d79"
+ }
+ Frame {
+ msec: 1056
+ hash: "496dfbbb0c0c28e108adf4c25341ef11"
+ }
+ Frame {
+ msec: 1072
+ hash: "aa2e5eb88b1498f0d36897be2a36b0ff"
+ }
+ Frame {
+ msec: 1088
+ hash: "0c6f7b54264ab36cfd5145fb7b30432f"
+ }
+ Frame {
+ msec: 1104
+ hash: "797fc3ea1db51f12d900b4e0e4998065"
+ }
+ Frame {
+ msec: 1120
+ hash: "2b076b8bc1ec1e2f21a4d7a77c94cfeb"
+ }
+ Frame {
+ msec: 1136
+ hash: "8d5888ca1cfba19cea569bd38bada417"
+ }
+ Frame {
+ msec: 1152
+ hash: "15ae94de5aa106eaa18d0faefa5d61f5"
+ }
+ Frame {
+ msec: 1168
+ hash: "96e90d74d5a7788d5a6da6cfdb92b185"
+ }
+ Frame {
+ msec: 1184
+ hash: "5698a5e9e628209fc28644198eac65da"
+ }
+ Frame {
+ msec: 1200
+ hash: "074ac8f08de8f22c241e23ad8b89b0f0"
+ }
+ Frame {
+ msec: 1216
+ hash: "a49fdf41e9ee1e5d764262d4585af2ff"
+ }
+ Frame {
+ msec: 1232
+ hash: "accc9b6573a676a40fcf0129085f6fce"
+ }
+ Frame {
+ msec: 1248
+ hash: "1cc956d55f0c382c2f74dcc05a05494f"
+ }
+ Frame {
+ msec: 1264
+ hash: "38ff3121566b2c719f47d027fcef8b8e"
+ }
+ Frame {
+ msec: 1280
+ hash: "4de97b3361a16ca1710f2e75d5c9de6f"
+ }
+ Frame {
+ msec: 1296
+ hash: "dbd1455105630bb8f262140e79ceda1b"
+ }
+ Frame {
+ msec: 1312
+ hash: "bcdac4ab71a29b78bfa756b56b8d8414"
+ }
+ Frame {
+ msec: 1328
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1344
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1360
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1376
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1392
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1408
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1424
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1440
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1456
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1472
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1488
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1504
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1520
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1536
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1552
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1568
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1584
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1600
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1616
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1632
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1648
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1664
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1680
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1696
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1712
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Mouse {
+ type: 2
+ button: 1
+ buttons: 1
+ x: 415; y: 121
+ modifiers: 0
+ sendToViewport: true
+ }
+ Frame {
+ msec: 1728
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1744
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1760
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1776
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1792
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1808
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1824
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Mouse {
+ type: 3
+ button: 1
+ buttons: 0
+ x: 415; y: 121
+ modifiers: 0
+ sendToViewport: true
+ }
+ Frame {
+ msec: 1840
+ hash: "f02f73a85532c1dd403d64c50c7e73ca"
+ }
+ Frame {
+ msec: 1856
+ hash: "b59fbcfb7db77cf30ea4ff039a9163ae"
+ }
+ Frame {
+ msec: 1872
+ hash: "432a76f0663bfd35f6bbeb3fbeb91799"
+ }
+ Frame {
+ msec: 1888
+ hash: "098e18005d3a2ff9095587954c92339c"
+ }
+ Frame {
+ msec: 1904
+ hash: "069100bf4ec523a9e9d5bf557ffc51d1"
+ }
+ Frame {
+ msec: 1920
+ image: "parentAnimation2.1.png"
+ }
+ Frame {
+ msec: 1936
+ hash: "60ed700e49bf2c51aba9b44400b56294"
+ }
+ Frame {
+ msec: 1952
+ hash: "79aa15dc74668d963f36f28524f4d091"
+ }
+ Frame {
+ msec: 1968
+ hash: "6838cb2d728259adc8d91a4a69e35adf"
+ }
+ Frame {
+ msec: 1984
+ hash: "3f73c720ce5f1e65fb8537a9beb66d26"
+ }
+ Frame {
+ msec: 2000
+ hash: "95d990ccd3e45e780d875aae1f4654f8"
+ }
+ Frame {
+ msec: 2016
+ hash: "5389a121571f61e73903305860e60016"
+ }
+ Frame {
+ msec: 2032
+ hash: "66f0018b6f35c1c18b28f4959eef96a8"
+ }
+ Frame {
+ msec: 2048
+ hash: "c0fa0560a9a5a0f773394c4fd98c9fa3"
+ }
+ Frame {
+ msec: 2064
+ hash: "e2d665ae0ac3007520003bb4a24ca708"
+ }
+ Frame {
+ msec: 2080
+ hash: "ab6e6976e4214c725f71a4f0ba6d3f68"
+ }
+ Frame {
+ msec: 2096
+ hash: "642f48f731f896d0d4b66956485b615b"
+ }
+ Frame {
+ msec: 2112
+ hash: "cdc36222978e4361dd3ddc2cba78328d"
+ }
+ Frame {
+ msec: 2128
+ hash: "22fe869d83d9d290c4d1702e7553c7aa"
+ }
+ Frame {
+ msec: 2144
+ hash: "3cf2b6a4fd5c73c24717a1ce901cfb19"
+ }
+ Frame {
+ msec: 2160
+ hash: "ea7ecad2a9b7e6ca9a9d1c9c46e0f6dc"
+ }
+ Frame {
+ msec: 2176
+ hash: "3a7e7e2145b40732ef4e18218a959536"
+ }
+ Frame {
+ msec: 2192
+ hash: "1386046373ab246ae533aba206ffe502"
+ }
+ Frame {
+ msec: 2208
+ hash: "2183072e2117c2bc660767bc67e6c355"
+ }
+ Frame {
+ msec: 2224
+ hash: "659c6fedf573d19727f9852a9034e4fe"
+ }
+ Frame {
+ msec: 2240
+ hash: "5be4e8fa87593aeb4d59768a61441c37"
+ }
+ Frame {
+ msec: 2256
+ hash: "2030b883508d07735b20726d218fd751"
+ }
+ Frame {
+ msec: 2272
+ hash: "fd70334fa8a1ff80369cce6aa69255c4"
+ }
+ Frame {
+ msec: 2288
+ hash: "be666aafc8a3d2de9ffaff54d9ac15d1"
+ }
+ Frame {
+ msec: 2304
+ hash: "3370f2246f679068e40cdb48c92decad"
+ }
+ Frame {
+ msec: 2320
+ hash: "f0b4565fd441c071112bdc8225861f76"
+ }
+ Frame {
+ msec: 2336
+ hash: "61babd82afc20a3023c2fe483a2e73cb"
+ }
+ Frame {
+ msec: 2352
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2368
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2384
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2400
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2416
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2432
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2448
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2464
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2480
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2496
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2512
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2528
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2544
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2560
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2576
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2592
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2608
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2624
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2640
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2656
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2672
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2688
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2704
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2720
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2736
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2752
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2768
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Mouse {
+ type: 2
+ button: 1
+ buttons: 1
+ x: 207; y: 255
+ modifiers: 0
+ sendToViewport: true
+ }
+ Frame {
+ msec: 2784
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2800
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2816
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2832
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2848
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2864
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2880
+ image: "parentAnimation2.2.png"
+ }
+ Frame {
+ msec: 2896
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Mouse {
+ type: 3
+ button: 1
+ buttons: 0
+ x: 207; y: 255
+ modifiers: 0
+ sendToViewport: true
+ }
+ Frame {
+ msec: 2912
+ hash: "acab4a79f22ebc8a45759ae282e8f3db"
+ }
+ Frame {
+ msec: 2928
+ hash: "608af88c841d6058c3304cc134de0187"
+ }
+ Frame {
+ msec: 2944
+ hash: "96a727d6ff02c7baf85865fda9d871bd"
+ }
+ Frame {
+ msec: 2960
+ hash: "22cacf109e40b457041d6c2862c4f97f"
+ }
+ Frame {
+ msec: 2976
+ hash: "ea2a53381eef8ac75fce23c518f1e261"
+ }
+ Frame {
+ msec: 2992
+ hash: "a719237e74e9c40b46cc1f27cca5e286"
+ }
+ Frame {
+ msec: 3008
+ hash: "804ef3519ba9852afb0bd4ef793e0006"
+ }
+ Frame {
+ msec: 3024
+ hash: "4abc5026f0de1165717bd14630c9d9f6"
+ }
+ Frame {
+ msec: 3040
+ hash: "1e4dd04698691932725076073a0bd2e7"
+ }
+ Frame {
+ msec: 3056
+ hash: "12aae9dcfd9597ce600588b19bdf5a7d"
+ }
+ Frame {
+ msec: 3072
+ hash: "9176b69f7df68d860b7d7aecc2496f09"
+ }
+ Frame {
+ msec: 3088
+ hash: "9cba95a510685ab6367ba87246f6c922"
+ }
+ Frame {
+ msec: 3104
+ hash: "33ef448b9485fafb7a2af319f9f6e816"
+ }
+ Frame {
+ msec: 3120
+ hash: "791760db748e46aceb9f469c33b7bf2f"
+ }
+ Frame {
+ msec: 3136
+ hash: "201a00feef1bb445f2fd0ba8ef9467a1"
+ }
+ Frame {
+ msec: 3152
+ hash: "6e8962c3cb522f5a45b093f1780d2dae"
+ }
+ Frame {
+ msec: 3168
+ hash: "d75cb08203a4f2c05b4dfdca2196e3db"
+ }
+ Frame {
+ msec: 3184
+ hash: "0417d681c9b64e2cc252ab6fcf20148b"
+ }
+ Frame {
+ msec: 3200
+ hash: "85993e5a91a86cedb8c88819b035b6bb"
+ }
+ Frame {
+ msec: 3216
+ hash: "d7a0db647e641df9625b8eb5078a8ec3"
+ }
+ Frame {
+ msec: 3232
+ hash: "fa29824ed3fd3d4e0d8036079be6bcf8"
+ }
+ Frame {
+ msec: 3248
+ hash: "4fc84a3ae74bb6ab7b0b846c8747eb54"
+ }
+ Frame {
+ msec: 3264
+ hash: "a172921ffe15077382db8e8915fb340b"
+ }
+ Frame {
+ msec: 3280
+ hash: "480ee71d2407d729814a2e19d4320c59"
+ }
+ Frame {
+ msec: 3296
+ hash: "b8cf02a1ad96d5c3354f2b658085ed28"
+ }
+ Frame {
+ msec: 3312
+ hash: "80fc0f57f58250f63a77b1988a9e1d2e"
+ }
+ Frame {
+ msec: 3328
+ hash: "bc283b5d7c5b88ef447be5992a77b6a9"
+ }
+ Frame {
+ msec: 3344
+ hash: "89c86df88dc1a3188d52c1f75b80ccf1"
+ }
+ Frame {
+ msec: 3360
+ hash: "84148139d89b45949561321bd6f6c835"
+ }
+ Frame {
+ msec: 3376
+ hash: "9118d6933b3f77e0b5b8da2d630152e8"
+ }
+ Frame {
+ msec: 3392
+ hash: "2b5f746225053778fb07a606ff113e64"
+ }
+ Frame {
+ msec: 3408
+ hash: "0a1ed1bea6ed674826d0a2c3146a1c31"
+ }
+ Frame {
+ msec: 3424
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3440
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3456
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3472
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3488
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3504
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3520
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3536
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3552
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3568
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3584
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3600
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3616
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3632
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3648
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Key {
+ type: 6
+ key: 16777249
+ modifiers: 67108864
+ text: ""
+ autorep: false
+ count: 1
+ }
+ Frame {
+ msec: 3664
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3680
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3696
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3712
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3728
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3744
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3760
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3776
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3792
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3808
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3824
+ hash: "b3bfd7a06d3e246f4256ab5a267360b0"
+ }
+ Frame {
+ msec: 3840
+ image: "parentAnimation2.3.png"
+ }
+}
diff --git a/tests/auto/declarative/qmlvisual/animation/parentAnimation2/parentAnimation2.qml b/tests/auto/declarative/qmlvisual/animation/parentAnimation2/parentAnimation2.qml
new file mode 100644
index 0000000..dfab108
--- /dev/null
+++ b/tests/auto/declarative/qmlvisual/animation/parentAnimation2/parentAnimation2.qml
@@ -0,0 +1,64 @@
+import Qt 4.7
+
+/*
+Blue rect fills (with 10px margin) screen, then red, then green, then screen again.
+*/
+
+Rectangle {
+ id: whiteRect
+ width: 640; height: 480;
+
+ Rectangle {
+ id: redRect
+ x: 400; y: 50
+ width: 100; height: 100
+ color: "red"
+ }
+
+ Rectangle {
+ id: greenRect
+ x: 100; y: 150
+ width: 200; height: 300
+ color: "green"
+ }
+
+ Rectangle {
+ id: blueRect
+ x: 5; y: 5
+ width: parent.width-10
+ height: parent.height-10
+ color: "lightblue"
+
+ //Text { text: "Click me!"; anchors.centerIn: parent }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ switch(blueRect.state) {
+ case "": blueRect.state = "inRed"; break;
+ case "inRed": blueRect.state = "inGreen"; break;
+ case "inGreen": blueRect.state = ""; break;
+ }
+ }
+ }
+
+ states: [
+ State {
+ name: "inRed"
+ ParentChange { target: blueRect; parent: redRect; x: 5; y: 5; width: parent.width-10; height: parent.height-10 }
+ PropertyChanges { target: redRect; z: 1 }
+ },
+ State {
+ name: "inGreen"
+ ParentChange { target: blueRect; parent: greenRect; x: 5; y: 5; width: parent.width-10; height: parent.height-10 }
+ PropertyChanges { target: greenRect; z: 1 }
+ }
+ ]
+
+ transitions: Transition {
+ ParentAnimation { target: blueRect; //via: whiteRect;
+ NumberAnimation { properties: "x, y, width, height"; duration: 500 }
+ }
+ }
+ }
+}
diff --git a/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp b/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp
index 4aad29b..f105692 100644
--- a/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp
+++ b/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp
@@ -105,6 +105,7 @@ void tst_qmlvisual::visual_data()
files << QT_TEST_SOURCE_DIR "/qdeclarativeborderimage/animated.qml";
files << QT_TEST_SOURCE_DIR "/qdeclarativeflipable/test-flipable.qml";
files << QT_TEST_SOURCE_DIR "/qdeclarativepositioners/usingRepeater.qml";
+ files << QT_TEST_SOURCE_DIR "/animation/parentAnimation2/parentAnimation2.qml";
//these are tests we think are stable and useful enough to be run by the CI system
files << QT_TEST_SOURCE_DIR "/animation/bindinganimation/bindinganimation.qml";
diff --git a/tests/auto/gestures/tst_gestures.cpp b/tests/auto/gestures/tst_gestures.cpp
index dfadf48..4a9f1d1 100644
--- a/tests/auto/gestures/tst_gestures.cpp
+++ b/tests/auto/gestures/tst_gestures.cpp
@@ -336,6 +336,7 @@ private slots:
void finishedWithoutStarted();
void unknownGesture();
void graphicsItemGesture();
+ void graphicsView();
void graphicsItemTreeGesture();
void explicitGraphicsObjectTarget();
void gestureOverChildGraphicsItem();
@@ -859,7 +860,6 @@ void tst_Gestures::graphicsItemGesture()
QTest::qWaitForWindowShown(&view);
view.ensureVisible(scene.sceneRect());
- view.viewport()->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren);
item->grabGesture(CustomGesture::GestureType);
static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1;
@@ -908,6 +908,71 @@ void tst_Gestures::graphicsItemGesture()
QCOMPARE(item->gestureOverrideEventsReceived, 0);
}
+void tst_Gestures::graphicsView()
+{
+ QGraphicsScene scene;
+ QGraphicsView view(&scene);
+ view.setWindowFlags(Qt::X11BypassWindowManagerHint);
+
+ GestureItem *item = new GestureItem("item");
+ scene.addItem(item);
+ item->setPos(100, 100);
+
+ view.show();
+ QTest::qWaitForWindowShown(&view);
+ view.ensureVisible(scene.sceneRect());
+
+ item->grabGesture(CustomGesture::GestureType);
+
+ static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1;
+ static const int TotalCustomEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialMaybeThreshold + 1;
+
+ CustomEvent event;
+ // make sure the event is properly delivered if only the hotspot is set.
+ event.hotSpot = mapToGlobal(QPointF(10, 10), item, &view);
+ event.hasHotSpot = true;
+ sendCustomGesture(&event, item, &scene);
+
+ QCOMPARE(item->customEventsReceived, TotalCustomEventsCount);
+ QCOMPARE(item->gestureEventsReceived, TotalGestureEventsCount);
+ QCOMPARE(item->gestureOverrideEventsReceived, 0);
+
+ // change the viewport and try again
+ QWidget *newViewport = new QWidget;
+ view.setViewport(newViewport);
+
+ item->reset();
+ sendCustomGesture(&event, item, &scene);
+
+ QCOMPARE(item->customEventsReceived, TotalCustomEventsCount);
+ QCOMPARE(item->gestureEventsReceived, TotalGestureEventsCount);
+ QCOMPARE(item->gestureOverrideEventsReceived, 0);
+
+ // change the scene and try again
+ QGraphicsScene newScene;
+ item = new GestureItem("newItem");
+ newScene.addItem(item);
+ item->setPos(100, 100);
+ view.setScene(&newScene);
+
+ item->reset();
+ // first without a gesture
+ sendCustomGesture(&event, item, &newScene);
+
+ QCOMPARE(item->customEventsReceived, TotalCustomEventsCount);
+ QCOMPARE(item->gestureEventsReceived, 0);
+ QCOMPARE(item->gestureOverrideEventsReceived, 0);
+
+ // then grab the gesture and try again
+ item->reset();
+ item->grabGesture(CustomGesture::GestureType);
+ sendCustomGesture(&event, item, &newScene);
+
+ QCOMPARE(item->customEventsReceived, TotalCustomEventsCount);
+ QCOMPARE(item->gestureEventsReceived, TotalGestureEventsCount);
+ QCOMPARE(item->gestureOverrideEventsReceived, 0);
+}
+
void tst_Gestures::graphicsItemTreeGesture()
{
QGraphicsScene scene;
@@ -933,7 +998,6 @@ void tst_Gestures::graphicsItemTreeGesture()
QTest::qWaitForWindowShown(&view);
view.ensureVisible(scene.sceneRect());
- view.viewport()->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren);
item1->grabGesture(CustomGesture::GestureType);
static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1;
@@ -991,7 +1055,6 @@ void tst_Gestures::explicitGraphicsObjectTarget()
QTest::qWaitForWindowShown(&view);
view.ensureVisible(scene.sceneRect());
- view.viewport()->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren);
item1->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren);
item2->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren);
item2_child1->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren);
@@ -1051,7 +1114,6 @@ void tst_Gestures::gestureOverChildGraphicsItem()
QTest::qWaitForWindowShown(&view);
view.ensureVisible(scene.sceneRect());
- view.viewport()->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren);
item1->grabGesture(CustomGesture::GestureType);
static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1;
@@ -1519,8 +1581,6 @@ void tst_Gestures::autoCancelGestures2()
parent->setPos(0, 0);
child->setPos(10, 10);
scene.addItem(parent);
- view.viewport()->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren);
- view.viewport()->grabGesture(secondGesture, Qt::DontStartGestureOnChildren);
parent->grabGesture(CustomGesture::GestureType);
child->grabGesture(secondGesture);
@@ -1573,7 +1633,6 @@ void tst_Gestures::graphicsViewParentPropagation()
QTest::qWaitForWindowShown(&view);
view.ensureVisible(scene.sceneRect());
- view.viewport()->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren);
item0->grabGesture(CustomGesture::GestureType, Qt::ReceivePartialGestures | Qt::IgnoredGesturesPropagateToParent);
item1->grabGesture(CustomGesture::GestureType, Qt::ReceivePartialGestures | Qt::IgnoredGesturesPropagateToParent);
item1_c1->grabGesture(CustomGesture::GestureType, Qt::IgnoredGesturesPropagateToParent);
@@ -1644,8 +1703,6 @@ void tst_Gestures::panelPropagation()
QTest::qWaitForWindowShown(&view);
view.ensureVisible(scene.sceneRect());
- view.viewport()->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren);
-
static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1;
static const int TotalCustomEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialMaybeThreshold + 1;
@@ -1757,8 +1814,6 @@ void tst_Gestures::panelStacksBehindParent()
QTest::qWaitForWindowShown(&view);
view.ensureVisible(scene.sceneRect());
- view.viewport()->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren);
-
static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1;
CustomEvent event;
@@ -1843,8 +1898,6 @@ void tst_Gestures::deleteGestureTargetItem()
QTest::qWaitForWindowShown(&view);
view.ensureVisible(scene.sceneRect());
- view.viewport()->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren);
-
if (propagateUpdateGesture)
item2->ignoredUpdatedGestures << CustomGesture::GestureType;
connect(items.value(emitter, 0), signalName, items.value(receiver, 0), slotName);
@@ -1890,8 +1943,6 @@ void tst_Gestures::viewportCoordinates()
QTest::qWaitForWindowShown(&view);
view.ensureVisible(scene.sceneRect());
- view.viewport()->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren);
-
CustomEvent event;
event.hotSpot = mapToGlobal(item1->boundingRect().center(), item1, &view);
event.hasHotSpot = true;
@@ -1929,8 +1980,6 @@ void tst_Gestures::partialGesturePropagation()
QTest::qWaitForWindowShown(&view);
view.ensureVisible(scene.sceneRect());
- view.viewport()->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren);
-
item1->ignoredUpdatedGestures << CustomGesture::GestureType;
CustomEvent event;
diff --git a/tests/auto/mediaservices.pro b/tests/auto/mediaservices.pro
deleted file mode 100644
index 1b50cd7..0000000
--- a/tests/auto/mediaservices.pro
+++ /dev/null
@@ -1,19 +0,0 @@
-TEMPLATE=subdirs
-SUBDIRS=\
- qsoundeffect \
- qdeclarativeaudio \
- qdeclarativevideo \
- qgraphicsvideoitem \
- qmediacontent \
- qmediaobject \
- qmediaplayer \
- qmediaplaylist \
- qmediaplaylistnavigator \
- qmediapluginloader \
- qmediaresource \
- qmediaservice \
- qmediaserviceprovider \
- qmediatimerange \
- qvideowidget
-
-
diff --git a/tests/auto/qdeclarativeaudio/qdeclarativeaudio.pro b/tests/auto/qdeclarativeaudio/qdeclarativeaudio.pro
deleted file mode 100644
index ecfe299..0000000
--- a/tests/auto/qdeclarativeaudio/qdeclarativeaudio.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-load(qttest_p4)
-
-HEADERS += \
- $$PWD/../../../src/imports/multimedia/qdeclarativeaudio_p.h \
- $$PWD/../../../src/imports/multimedia/qdeclarativemediabase_p.h \
- $$PWD/../../../src/imports/multimedia/qmetadatacontrolmetaobject_p.h
-
-SOURCES += \
- tst_qdeclarativeaudio.cpp \
- $$PWD/../../../src/imports/multimedia/qdeclarativeaudio.cpp \
- $$PWD/../../../src/imports/multimedia/qdeclarativemediabase.cpp \
- $$PWD/../../../src/imports/multimedia/qmetadatacontrolmetaobject.cpp
-
-QT += mediaservices declarative
diff --git a/tests/auto/qdeclarativeaudio/tst_qdeclarativeaudio.cpp b/tests/auto/qdeclarativeaudio/tst_qdeclarativeaudio.cpp
deleted file mode 100644
index e393599..0000000
--- a/tests/auto/qdeclarativeaudio/tst_qdeclarativeaudio.cpp
+++ /dev/null
@@ -1,1252 +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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, 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.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QtTest>
-
-#include "../../../src/imports/multimedia/qdeclarativeaudio_p.h"
-
-#include <QtGui/qapplication.h>
-#include <QtMediaServices/qmediaplayercontrol.h>
-#include <QtMediaServices/qmediaservice.h>
-#include <QtMediaServices/qmetadatacontrol.h>
-
-
-class tst_QDeclarativeAudio : public QObject
-{
- Q_OBJECT
-public slots:
- void initTestCase();
-
-private slots:
- void nullPlayerControl();
- void nullMetaDataControl();
- void nullService();
-
- void source();
- void autoLoad();
- void playing();
- void paused();
- void duration();
- void position();
- void volume();
- void muted();
- void bufferProgress();
- void seekable();
- void playbackRate();
- void status();
- void metaData_data();
- void metaData();
- void error();
-};
-
-Q_DECLARE_METATYPE(QtMediaServices::MetaData);
-Q_DECLARE_METATYPE(QDeclarativeAudio::Error);
-
-class QtTestMediaPlayerControl : public QMediaPlayerControl
-{
- Q_OBJECT
-public:
- QtTestMediaPlayerControl(QObject *parent = 0)
- : QMediaPlayerControl(parent)
- , m_state(QMediaPlayer::StoppedState)
- , m_mediaStatus(QMediaPlayer::NoMedia)
- , m_duration(0)
- , m_position(0)
- , m_playbackRate(1.0)
- , m_volume(50)
- , m_bufferStatus(0)
- , m_muted(false)
- , m_audioAvailable(false)
- , m_videoAvailable(false)
- , m_seekable(false)
- {
- }
-
- QMediaPlayer::State state() const { return m_state; }
- void updateState(QMediaPlayer::State state) { emit stateChanged(m_state = state); }
-
- QMediaPlayer::MediaStatus mediaStatus() const { return m_mediaStatus; }
- void updateMediaStatus(QMediaPlayer::MediaStatus status) {
- emit mediaStatusChanged(m_mediaStatus = status); }
- void updateMediaStatus(QMediaPlayer::MediaStatus status, QMediaPlayer::State state)
- {
- m_mediaStatus = status;
- m_state = state;
-
- emit mediaStatusChanged(m_mediaStatus);
- emit stateChanged(m_state);
- }
-
- qint64 duration() const { return m_duration; }
- void setDuration(qint64 duration) { emit durationChanged(m_duration = duration); }
-
- qint64 position() const { return m_position; }
- void setPosition(qint64 position) { emit positionChanged(m_position = position); }
-
- int volume() const { return m_volume; }
- void setVolume(int volume) { emit volumeChanged(m_volume = volume); }
-
- bool isMuted() const { return m_muted; }
- void setMuted(bool muted) { emit mutedChanged(m_muted = muted); }
-
- int bufferStatus() const { return m_bufferStatus; }
- void setBufferStatus(int status) { emit bufferStatusChanged(m_bufferStatus = status); }
-
- bool isAudioAvailable() const { return m_audioAvailable; }
- void setAudioAvailable(bool available) {
- emit audioAvailableChanged(m_audioAvailable = available); }
- bool isVideoAvailable() const { return m_videoAvailable; }
- void setVideoAvailable(bool available) {
- emit videoAvailableChanged(m_videoAvailable = available); }
-
- bool isSeekable() const { return m_seekable; }
- void setSeekable(bool seekable) { emit seekableChanged(m_seekable = seekable); }
-
- QMediaTimeRange availablePlaybackRanges() const { return QMediaTimeRange(); }
-
- qreal playbackRate() const { return m_playbackRate; }
- void setPlaybackRate(qreal rate) { emit playbackRateChanged(m_playbackRate = rate); }
-
- QMediaContent media() const { return m_media; }
- const QIODevice *mediaStream() const { return 0; }
- void setMedia(const QMediaContent &media, QIODevice *)
- {
- m_media = media;
-
- m_mediaStatus = m_media.isNull()
- ? QMediaPlayer::NoMedia
- : QMediaPlayer::LoadingMedia;
-
- emit mediaChanged(m_media);
- emit mediaStatusChanged(m_mediaStatus);
- }
-
- void play() { emit stateChanged(m_state = QMediaPlayer::PlayingState); }
- void pause() { emit stateChanged(m_state = QMediaPlayer::PausedState); }
- void stop() { emit stateChanged(m_state = QMediaPlayer::StoppedState); }
-
- void emitError(QMediaPlayer::Error err, const QString &errorString) {
- emit error(err, errorString); }
-
-private:
- QMediaPlayer::State m_state;
- QMediaPlayer::MediaStatus m_mediaStatus;
- qint64 m_duration;
- qint64 m_position;
- qreal m_playbackRate;
- int m_volume;
- int m_bufferStatus;
- bool m_muted;
- bool m_audioAvailable;
- bool m_videoAvailable;
- bool m_seekable;
- QMediaContent m_media;
-};
-
-class QtTestMetaDataControl : public QMetaDataControl
-{
- Q_OBJECT
-public:
- QtTestMetaDataControl(QObject *parent = 0)
- : QMetaDataControl(parent)
- {
- }
-
- bool isWritable() const { return true; }
- bool isMetaDataAvailable() const { return true; }
-
- QVariant metaData(QtMediaServices::MetaData key) const { return m_metaData.value(key); }
- void setMetaData(QtMediaServices::MetaData key, const QVariant &value) {
- m_metaData.insert(key, value); emit metaDataChanged(); }
- void setMetaData(const QMap<QtMediaServices::MetaData, QVariant> &metaData) {
- m_metaData = metaData; emit metaDataChanged(); }
-
- QList<QtMediaServices::MetaData> availableMetaData() const { return m_metaData.keys(); }
-
- QVariant extendedMetaData(const QString &) const { return QVariant(); }
- void setExtendedMetaData(const QString &, const QVariant &) {}
- QStringList availableExtendedMetaData() const { return QStringList(); }
-
-private:
- QMap<QtMediaServices::MetaData, QVariant> m_metaData;
-};
-
-class QtTestMediaService : public QMediaService
-{
- Q_OBJECT
-public:
- QtTestMediaService(
- QtTestMediaPlayerControl *playerControl,
- QtTestMetaDataControl *metaDataControl,
- QObject *parent)
- : QMediaService(parent)
- , playerControl(playerControl)
- , metaDataControl(metaDataControl)
- {
- }
-
- QMediaControl *control(const char *name) const
- {
- if (qstrcmp(name, QMediaPlayerControl_iid) == 0)
- return playerControl;
- else if (qstrcmp(name, QMetaDataControl_iid) == 0)
- return metaDataControl;
- else
- return 0;
- }
-
- QtTestMediaPlayerControl *playerControl;
- QtTestMetaDataControl *metaDataControl;
-};
-
-class QtTestMediaServiceProvider : public QMediaServiceProvider
-{
- Q_OBJECT
-public:
- QtTestMediaServiceProvider()
- : service(new QtTestMediaService(
- new QtTestMediaPlayerControl(this), new QtTestMetaDataControl(this), this))
- {
- setDefaultServiceProvider(this);
- }
-
- QtTestMediaServiceProvider(QtTestMediaService *service)
- : service(service)
- {
- setDefaultServiceProvider(this);
- }
-
- QtTestMediaServiceProvider(
- QtTestMediaPlayerControl *playerControl, QtTestMetaDataControl *metaDataControl)
- : service(new QtTestMediaService(playerControl, metaDataControl, this))
- {
- setDefaultServiceProvider(this);
- }
-
- ~QtTestMediaServiceProvider()
- {
- setDefaultServiceProvider(0);
- }
-
- QMediaService *requestService(
- const QByteArray &type,
- const QMediaServiceProviderHint & = QMediaServiceProviderHint())
- {
- requestedService = type;
-
- return service;
- }
-
- void releaseService(QMediaService *) {}
-
- inline QtTestMediaPlayerControl *playerControl() { return service->playerControl; }
- inline QtTestMetaDataControl *metaDataControl() { return service->metaDataControl; }
-
- QtTestMediaService *service;
- QByteArray requestedService;
-};
-
-
-void tst_QDeclarativeAudio::initTestCase()
-{
- qRegisterMetaType<QDeclarativeAudio::Error>();
-}
-
-void tst_QDeclarativeAudio::nullPlayerControl()
-{
- QtTestMetaDataControl metaDataControl;
- QtTestMediaServiceProvider provider(0, &metaDataControl);
-
- QDeclarativeAudio audio;
-
- QCOMPARE(audio.source(), QUrl());
- audio.setSource(QUrl("http://example.com"));
- QCOMPARE(audio.source(), QUrl("http://example.com"));
-
- QCOMPARE(audio.isPlaying(), false);
- audio.setPlaying(true);
- QCOMPARE(audio.isPlaying(), true);
- audio.setPlaying(false);
- audio.play();
- QCOMPARE(audio.isPlaying(), false);
-
- QCOMPARE(audio.isPaused(), false);
- audio.pause();
- QCOMPARE(audio.isPaused(), false);
- audio.setPaused(true);
- QCOMPARE(audio.isPaused(), true);
-
- QCOMPARE(audio.duration(), 0);
-
- QCOMPARE(audio.position(), 0);
- audio.setPosition(10000);
- QCOMPARE(audio.position(), 10000);
-
- QCOMPARE(audio.volume(), qreal(1.0));
- audio.setVolume(0.5);
- QCOMPARE(audio.volume(), qreal(0.5));
-
- QCOMPARE(audio.isMuted(), false);
- audio.setMuted(true);
- QCOMPARE(audio.isMuted(), true);
-
- QCOMPARE(audio.bufferProgress(), qreal(0));
-
- QCOMPARE(audio.isSeekable(), false);
-
- QCOMPARE(audio.playbackRate(), qreal(1.0));
-
- QCOMPARE(audio.status(), QDeclarativeAudio::NoMedia);
-
- QCOMPARE(audio.error(), QDeclarativeAudio::ServiceMissing);
-}
-
-void tst_QDeclarativeAudio::nullMetaDataControl()
-{
- QtTestMediaPlayerControl playerControl;
- QtTestMediaServiceProvider provider(&playerControl, 0);
-
- QDeclarativeAudio audio;
-
- QCOMPARE(audio.metaObject()->indexOfProperty("title"), -1);
- QCOMPARE(audio.metaObject()->indexOfProperty("genre"), -1);
- QCOMPARE(audio.metaObject()->indexOfProperty("description"), -1);
-}
-
-void tst_QDeclarativeAudio::nullService()
-{
- QtTestMediaServiceProvider provider(0);
-
- QDeclarativeAudio audio;
-
- QCOMPARE(audio.source(), QUrl());
- audio.setSource(QUrl("http://example.com"));
- QCOMPARE(audio.source(), QUrl("http://example.com"));
-
- QCOMPARE(audio.isPlaying(), false);
- audio.setPlaying(true);
- QCOMPARE(audio.isPlaying(), true);
- audio.setPlaying(false);
- audio.play();
- QCOMPARE(audio.isPlaying(), false);
-
- QCOMPARE(audio.isPaused(), false);
- audio.pause();
- QCOMPARE(audio.isPaused(), false);
- audio.setPaused(true);
- QCOMPARE(audio.isPaused(), true);
-
- QCOMPARE(audio.duration(), 0);
-
- QCOMPARE(audio.position(), 0);
- audio.setPosition(10000);
- QCOMPARE(audio.position(), 10000);
-
- QCOMPARE(audio.volume(), qreal(1.0));
- audio.setVolume(0.5);
- QCOMPARE(audio.volume(), qreal(0.5));
-
- QCOMPARE(audio.isMuted(), false);
- audio.setMuted(true);
- QCOMPARE(audio.isMuted(), true);
-
- QCOMPARE(audio.bufferProgress(), qreal(0));
-
- QCOMPARE(audio.isSeekable(), false);
-
- QCOMPARE(audio.playbackRate(), qreal(1.0));
-
- QCOMPARE(audio.status(), QDeclarativeAudio::NoMedia);
-
- QCOMPARE(audio.error(), QDeclarativeAudio::ServiceMissing);
-
- QCOMPARE(audio.metaObject()->indexOfProperty("title"), -1);
- QCOMPARE(audio.metaObject()->indexOfProperty("genre"), -1);
- QCOMPARE(audio.metaObject()->indexOfProperty("description"), -1);
-}
-
-void tst_QDeclarativeAudio::source()
-{
- const QUrl url1("http://example.com");
- const QUrl url2("file:///local/path");
- const QUrl url3;
-
- QtTestMediaServiceProvider provider;
- QDeclarativeAudio audio;
- audio.componentComplete();
-
- QSignalSpy spy(&audio, SIGNAL(sourceChanged()));
-
- audio.setSource(url1);
- QCOMPARE(audio.source(), url1);
- QCOMPARE(provider.playerControl()->media().canonicalUrl(), url1);
- QCOMPARE(spy.count(), 1);
-
- audio.setSource(url2);
- QCOMPARE(audio.source(), url2);
- QCOMPARE(provider.playerControl()->media().canonicalUrl(), url2);
- QCOMPARE(spy.count(), 2);
-
- audio.setSource(url3);
- QCOMPARE(audio.source(), url3);
- QCOMPARE(provider.playerControl()->media().canonicalUrl(), url3);
- QCOMPARE(spy.count(), 3);
-}
-
-void tst_QDeclarativeAudio::autoLoad()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeAudio audio;
- audio.componentComplete();
-
- QSignalSpy spy(&audio, SIGNAL(autoLoadChanged()));
-
- QCOMPARE(audio.isAutoLoad(), true);
-
- audio.setAutoLoad(false);
- QCOMPARE(audio.isAutoLoad(), false);
- QCOMPARE(spy.count(), 1);
-
- audio.setSource(QUrl("http://example.com"));
- QCOMPARE(audio.source(), QUrl("http://example.com"));
- audio.play();
- QCOMPARE(audio.isPlaying(), true);
- audio.stop();
-
- audio.setAutoLoad(true);
- audio.setSource(QUrl("http://example.com"));
- audio.setPaused(true);
- QCOMPARE(spy.count(), 2);
- QCOMPARE(audio.isPaused(), true);
-}
-
-void tst_QDeclarativeAudio::playing()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeAudio audio;
-
- QSignalSpy playingChangedSpy(&audio, SIGNAL(playingChanged()));
- QSignalSpy startedSpy(&audio, SIGNAL(started()));
- QSignalSpy stoppedSpy(&audio, SIGNAL(stopped()));
-
- int playingChanged = 0;
- int started = 0;
- int stopped = 0;
-
- audio.componentComplete();
-
- QCOMPARE(audio.isPlaying(), false);
-
- // setPlaying(true) when stopped.
- audio.setPlaying(true);
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(startedSpy.count(), ++started);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPlaying(false) when playing.
- audio.setPlaying(false);
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(stoppedSpy.count(), ++stopped);
-
- // play() when stopped.
- audio.play();
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(startedSpy.count(), ++started);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // stop() when playing.
- audio.stop();
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(stoppedSpy.count(), ++stopped);
-
- // stop() when stopped.
- audio.stop();
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPlaying(false) when stopped.
- audio.setPlaying(false);
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- audio.setPlaying(true);
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(startedSpy.count(), ++started);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPlaying(true) when playing.
- audio.setPlaying(true);
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // play() when playing.
- audio.play();
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(stoppedSpy.count(), stopped);
-}
-
-void tst_QDeclarativeAudio::paused()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeAudio audio;
-
- QSignalSpy playingChangedSpy(&audio, SIGNAL(playingChanged()));
- QSignalSpy pausedChangedSpy(&audio, SIGNAL(pausedChanged()));
- QSignalSpy startedSpy(&audio, SIGNAL(started()));
- QSignalSpy pausedSpy(&audio, SIGNAL(paused()));
- QSignalSpy resumedSpy(&audio, SIGNAL(resumed()));
- QSignalSpy stoppedSpy(&audio, SIGNAL(stopped()));
-
- int playingChanged = 0;
- int pausedChanged = 0;
- int started = 0;
- int paused = 0;
- int resumed = 0;
- int stopped = 0;
-
- audio.componentComplete();
-
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(audio.isPaused(), false);
-
- // setPlaying(true) when stopped.
- audio.setPlaying(true);
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(audio.isPaused(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), ++started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPaused(true) when playing.
- audio.setPaused(true);
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(audio.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), ++paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPaused(true) when paused.
- audio.setPaused(true);
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(audio.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // pause() when paused.
- audio.pause();
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(audio.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPaused(false) when paused.
- audio.setPaused(false);
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(audio.isPaused(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), ++resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPaused(false) when playing.
- audio.setPaused(false);
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(audio.isPaused(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // pause() when playing.
- audio.pause();
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(audio.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), ++paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPlaying(false) when paused.
- audio.setPlaying(false);
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(audio.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), ++stopped);
-
- // setPaused(true) when stopped and paused.
- audio.setPaused(true);
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(audio.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPaused(false) when stopped and paused.
- audio.setPaused(false);
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(audio.isPaused(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPaused(true) when stopped.
- audio.setPaused(true);
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(audio.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPlaying(true) when stopped and paused.
- audio.setPlaying(true);
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(audio.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), ++started);
- QCOMPARE(pausedSpy.count(), ++paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // play() when paused.
- audio.play();
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(audio.isPaused(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), ++resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPaused(true) when playing.
- audio.setPaused(true);
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(audio.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), ++paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // stop() when paused.
- audio.stop();
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(audio.isPaused(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), ++stopped);
-
- // setPaused(true) when stopped.
- audio.setPaused(true);
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(audio.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // stop() when stopped and paused.
- audio.stop();
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(audio.isPaused(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // pause() when stopped.
- audio.pause();
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(audio.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), ++started);
- QCOMPARE(pausedSpy.count(), ++paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPlaying(false) when paused.
- audio.setPlaying(false);
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(audio.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), ++stopped);
-
- // pause() when stopped and paused.
- audio.pause();
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(audio.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), ++started);
- QCOMPARE(pausedSpy.count(), ++paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPlaying(false) when paused.
- audio.setPlaying(false);
- QCOMPARE(audio.isPlaying(), false);
- QCOMPARE(audio.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), ++stopped);
-
- // play() when stopped and paused.
- audio.play();
- QCOMPARE(audio.isPlaying(), true);
- QCOMPARE(audio.isPaused(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), ++started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-}
-
-void tst_QDeclarativeAudio::duration()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeAudio audio;
-
- audio.componentComplete();
-
- QSignalSpy spy(&audio, SIGNAL(durationChanged()));
-
- QCOMPARE(audio.duration(), 0);
-
- provider.playerControl()->setDuration(4040);
- QCOMPARE(audio.duration(), 4040);
- QCOMPARE(spy.count(), 1);
-
- provider.playerControl()->setDuration(-129);
- QCOMPARE(audio.duration(), -129);
- QCOMPARE(spy.count(), 2);
-
- provider.playerControl()->setDuration(0);
- QCOMPARE(audio.duration(), 0);
- QCOMPARE(spy.count(), 3);
-
- // Unnecessary duration changed signals aren't filtered.
- provider.playerControl()->setDuration(0);
- QCOMPARE(audio.duration(), 0);
- QCOMPARE(spy.count(), 4);
-}
-
-void tst_QDeclarativeAudio::position()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeAudio audio;
- audio.componentComplete();
-
- QSignalSpy spy(&audio, SIGNAL(positionChanged()));
-
- QCOMPARE(audio.position(), 0);
-
- // QDeclarativeAudio won't bound set positions to the duration. A media service may though.
- QCOMPARE(audio.duration(), 0);
-
- audio.setPosition(450);
- QCOMPARE(audio.position(), 450);
- QCOMPARE(provider.playerControl()->position(), qint64(450));
- QCOMPARE(spy.count(), 1);
-
- audio.setPosition(-5403);
- QCOMPARE(audio.position(), -5403);
- QCOMPARE(provider.playerControl()->position(), qint64(-5403));
- QCOMPARE(spy.count(), 2);
-
- audio.setPosition(-5403);
- QCOMPARE(audio.position(), -5403);
- QCOMPARE(provider.playerControl()->position(), qint64(-5403));
- QCOMPARE(spy.count(), 2);
-
- // Check the signal change signal is emitted if the change originates from the media service.
- provider.playerControl()->setPosition(0);
- QCOMPARE(audio.position(), 0);
- QCOMPARE(spy.count(), 3);
-
- connect(&audio, SIGNAL(positionChanged()), &QTestEventLoop::instance(), SLOT(exitLoop()));
-
- provider.playerControl()->updateState(QMediaPlayer::PlayingState);
- QTestEventLoop::instance().enterLoop(1);
- QVERIFY(spy.count() > 3 && spy.count() < 6); // 4 or 5
-
- provider.playerControl()->updateState(QMediaPlayer::PausedState);
- QTestEventLoop::instance().enterLoop(1);
- QVERIFY(spy.count() < 6);
-}
-
-void tst_QDeclarativeAudio::volume()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeAudio audio;
- audio.componentComplete();
-
- QSignalSpy spy(&audio, SIGNAL(volumeChanged()));
-
- QCOMPARE(audio.volume(), qreal(1.0));
-
- audio.setVolume(0.7);
- QCOMPARE(audio.volume(), qreal(0.7));
- QCOMPARE(provider.playerControl()->volume(), 70);
- QCOMPARE(spy.count(), 1);
-
- audio.setVolume(0.7);
- QCOMPARE(audio.volume(), qreal(0.7));
- QCOMPARE(provider.playerControl()->volume(), 70);
- QCOMPARE(spy.count(), 1);
-
- provider.playerControl()->setVolume(30);
- QCOMPARE(audio.volume(), qreal(0.3));
- QCOMPARE(spy.count(), 2);
-}
-
-void tst_QDeclarativeAudio::muted()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeAudio audio;
- audio.componentComplete();
-
- QSignalSpy spy(&audio, SIGNAL(mutedChanged()));
-
- QCOMPARE(audio.isMuted(), false);
-
- audio.setMuted(true);
- QCOMPARE(audio.isMuted(), true);
- QCOMPARE(provider.playerControl()->isMuted(), true);
- QCOMPARE(spy.count(), 1);
-
- provider.playerControl()->setMuted(false);
- QCOMPARE(audio.isMuted(), false);
- QCOMPARE(spy.count(), 2);
-
- audio.setMuted(false);
- QCOMPARE(audio.isMuted(), false);
- QCOMPARE(provider.playerControl()->isMuted(), false);
- QCOMPARE(spy.count(), 3);
-}
-
-void tst_QDeclarativeAudio::bufferProgress()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeAudio audio;
-
- audio.componentComplete();
-
- QSignalSpy spy(&audio, SIGNAL(bufferProgressChanged()));
-
- QCOMPARE(audio.bufferProgress(), qreal(0.0));
-
- provider.playerControl()->setBufferStatus(20);
- QCOMPARE(audio.bufferProgress(), qreal(0.2));
- QCOMPARE(spy.count(), 1);
-
- provider.playerControl()->setBufferStatus(20);
- QCOMPARE(audio.bufferProgress(), qreal(0.2));
- QCOMPARE(spy.count(), 2);
-
- provider.playerControl()->setBufferStatus(40);
- QCOMPARE(audio.bufferProgress(), qreal(0.4));
- QCOMPARE(spy.count(), 3);
-
- connect(&audio, SIGNAL(positionChanged()), &QTestEventLoop::instance(), SLOT(exitLoop()));
-
- provider.playerControl()->updateMediaStatus(
- QMediaPlayer::BufferingMedia, QMediaPlayer::PlayingState);
- QTestEventLoop::instance().enterLoop(1);
- QVERIFY(spy.count() > 3 && spy.count() < 6); // 4 or 5
-
- provider.playerControl()->updateMediaStatus(QMediaPlayer::BufferedMedia);
- QTestEventLoop::instance().enterLoop(1);
- QVERIFY(spy.count() < 6);
-}
-
-void tst_QDeclarativeAudio::seekable()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeAudio audio;
-
- audio.componentComplete();
-
- QSignalSpy spy(&audio, SIGNAL(seekableChanged()));
-
- QCOMPARE(audio.isSeekable(), false);
-
- provider.playerControl()->setSeekable(true);
- QCOMPARE(audio.isSeekable(), true);
- QCOMPARE(spy.count(), 1);
-
- provider.playerControl()->setSeekable(true);
- QCOMPARE(audio.isSeekable(), true);
- QCOMPARE(spy.count(), 2);
-
- provider.playerControl()->setSeekable(false);
- QCOMPARE(audio.isSeekable(), false);
- QCOMPARE(spy.count(), 3);
-}
-
-void tst_QDeclarativeAudio::playbackRate()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeAudio audio;
-
- audio.componentComplete();
-
- QSignalSpy spy(&audio, SIGNAL(playbackRateChanged()));
-
- QCOMPARE(audio.playbackRate(), qreal(1.0));
-
- audio.setPlaybackRate(0.5);
- QCOMPARE(audio.playbackRate(), qreal(0.5));
- QCOMPARE(provider.playerControl()->playbackRate(), qreal(0.5));
- QCOMPARE(spy.count(), 1);
-
- provider.playerControl()->setPlaybackRate(2.0);
- QCOMPARE(provider.playerControl()->playbackRate(), qreal(2.0));
- QCOMPARE(spy.count(), 2);
-
- audio.setPlaybackRate(2.0);
- QCOMPARE(audio.playbackRate(), qreal(2.0));
- QCOMPARE(provider.playerControl()->playbackRate(), qreal(2.0));
- QCOMPARE(spy.count(), 3);
-}
-
-void tst_QDeclarativeAudio::status()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeAudio audio;
-
- audio.componentComplete();
-
- QSignalSpy statusChangedSpy(&audio, SIGNAL(statusChanged()));
- QSignalSpy loadedSpy(&audio, SIGNAL(loaded()));
- QSignalSpy bufferingSpy(&audio, SIGNAL(buffering()));
- QSignalSpy stalledSpy(&audio, SIGNAL(stalled()));
- QSignalSpy bufferedSpy(&audio, SIGNAL(buffered()));
- QSignalSpy endOfMediaSpy(&audio, SIGNAL(endOfMedia()));
-
- QCOMPARE(audio.status(), QDeclarativeAudio::NoMedia);
-
- // Set media, start loading.
- provider.playerControl()->updateMediaStatus(QMediaPlayer::LoadingMedia);
- QCOMPARE(audio.status(), QDeclarativeAudio::Loading);
- QCOMPARE(statusChangedSpy.count(), 1);
- QCOMPARE(loadedSpy.count(), 0);
- QCOMPARE(bufferingSpy.count(), 0);
- QCOMPARE(stalledSpy.count(), 0);
- QCOMPARE(bufferedSpy.count(), 0);
- QCOMPARE(endOfMediaSpy.count(), 0);
-
- // Finish loading.
- provider.playerControl()->updateMediaStatus(QMediaPlayer::LoadedMedia);
- QCOMPARE(audio.status(), QDeclarativeAudio::Loaded);
- QCOMPARE(statusChangedSpy.count(), 2);
- QCOMPARE(loadedSpy.count(), 1);
- QCOMPARE(bufferingSpy.count(), 0);
- QCOMPARE(stalledSpy.count(), 0);
- QCOMPARE(bufferedSpy.count(), 0);
- QCOMPARE(endOfMediaSpy.count(), 0);
-
- // Play, start buffering.
- provider.playerControl()->updateMediaStatus(
- QMediaPlayer::StalledMedia, QMediaPlayer::PlayingState);
- QCOMPARE(audio.status(), QDeclarativeAudio::Stalled);
- QCOMPARE(statusChangedSpy.count(), 3);
- QCOMPARE(loadedSpy.count(), 1);
- QCOMPARE(bufferingSpy.count(), 0);
- QCOMPARE(stalledSpy.count(), 1);
- QCOMPARE(bufferedSpy.count(), 0);
- QCOMPARE(endOfMediaSpy.count(), 0);
-
- // Enough data buffered to proceed.
- provider.playerControl()->updateMediaStatus(QMediaPlayer::BufferingMedia);
- QCOMPARE(audio.status(), QDeclarativeAudio::Buffering);
- QCOMPARE(statusChangedSpy.count(), 4);
- QCOMPARE(loadedSpy.count(), 1);
- QCOMPARE(bufferingSpy.count(), 1);
- QCOMPARE(stalledSpy.count(), 1);
- QCOMPARE(bufferedSpy.count(), 0);
- QCOMPARE(endOfMediaSpy.count(), 0);
-
- // Errant second buffering status changed.
- provider.playerControl()->updateMediaStatus(QMediaPlayer::BufferingMedia);
- QCOMPARE(audio.status(), QDeclarativeAudio::Buffering);
- QCOMPARE(statusChangedSpy.count(), 4);
- QCOMPARE(loadedSpy.count(), 1);
- QCOMPARE(bufferingSpy.count(), 1);
- QCOMPARE(stalledSpy.count(), 1);
- QCOMPARE(bufferedSpy.count(), 0);
- QCOMPARE(endOfMediaSpy.count(), 0);
-
- // Buffer full.
- provider.playerControl()->updateMediaStatus(QMediaPlayer::BufferedMedia);
- QCOMPARE(audio.status(), QDeclarativeAudio::Buffered);
- QCOMPARE(statusChangedSpy.count(), 5);
- QCOMPARE(loadedSpy.count(), 1);
- QCOMPARE(bufferingSpy.count(), 1);
- QCOMPARE(stalledSpy.count(), 1);
- QCOMPARE(bufferedSpy.count(), 1);
- QCOMPARE(endOfMediaSpy.count(), 0);
-
- // Buffer getting low.
- provider.playerControl()->updateMediaStatus(QMediaPlayer::BufferingMedia);
- QCOMPARE(audio.status(), QDeclarativeAudio::Buffering);
- QCOMPARE(statusChangedSpy.count(), 6);
- QCOMPARE(loadedSpy.count(), 1);
- QCOMPARE(bufferingSpy.count(), 2);
- QCOMPARE(stalledSpy.count(), 1);
- QCOMPARE(bufferedSpy.count(), 1);
- QCOMPARE(endOfMediaSpy.count(), 0);
-
- // Buffer full.
- provider.playerControl()->updateMediaStatus(QMediaPlayer::BufferedMedia);
- QCOMPARE(audio.status(), QDeclarativeAudio::Buffered);
- QCOMPARE(statusChangedSpy.count(), 7);
- QCOMPARE(loadedSpy.count(), 1);
- QCOMPARE(bufferingSpy.count(), 2);
- QCOMPARE(stalledSpy.count(), 1);
- QCOMPARE(bufferedSpy.count(), 2);
- QCOMPARE(endOfMediaSpy.count(), 0);
-
- // Finished.
- provider.playerControl()->updateMediaStatus(
- QMediaPlayer::EndOfMedia, QMediaPlayer::StoppedState);
- QCOMPARE(audio.status(), QDeclarativeAudio::EndOfMedia);
- QCOMPARE(statusChangedSpy.count(), 8);
- QCOMPARE(loadedSpy.count(), 1);
- QCOMPARE(bufferingSpy.count(), 2);
- QCOMPARE(stalledSpy.count(), 1);
- QCOMPARE(bufferedSpy.count(), 2);
- QCOMPARE(endOfMediaSpy.count(), 1);
-}
-
-void tst_QDeclarativeAudio::metaData_data()
-{
- QTest::addColumn<QByteArray>("propertyName");
- QTest::addColumn<QtMediaServices::MetaData>("propertyKey");
- QTest::addColumn<QVariant>("value1");
- QTest::addColumn<QVariant>("value2");
-
- QTest::newRow("title")
- << QByteArray("title")
- << QtMediaServices::Title
- << QVariant(QString::fromLatin1("This is a title"))
- << QVariant(QString::fromLatin1("This is another title"));
-
- QTest::newRow("genre")
- << QByteArray("genre")
- << QtMediaServices::Genre
- << QVariant(QString::fromLatin1("rock"))
- << QVariant(QString::fromLatin1("pop"));
-
- QTest::newRow("trackNumber")
- << QByteArray("trackNumber")
- << QtMediaServices::TrackNumber
- << QVariant(8)
- << QVariant(12);
-}
-
-void tst_QDeclarativeAudio::metaData()
-{
- QFETCH(QByteArray, propertyName);
- QFETCH(QtMediaServices::MetaData, propertyKey);
- QFETCH(QVariant, value1);
- QFETCH(QVariant, value2);
-
- QtTestMediaServiceProvider provider;
- QDeclarativeAudio audio;
-
- audio.componentComplete();
-
- QSignalSpy spy(&audio, SIGNAL(__metaDataChanged()));
-
- const int index = audio.metaObject()->indexOfProperty(propertyName.constData());
- QVERIFY(index != -1);
-
- QMetaProperty property = audio.metaObject()->property(index);
- QCOMPARE(property.read(&audio), QVariant());
-
- property.write(&audio, value1);
- QCOMPARE(property.read(&audio), value1);
- QCOMPARE(provider.metaDataControl()->metaData(propertyKey), value1);
- QCOMPARE(spy.count(), 1);
-
- provider.metaDataControl()->setMetaData(propertyKey, value2);
- QCOMPARE(property.read(&audio), value2);
- QCOMPARE(spy.count(), 2);
-}
-
-void tst_QDeclarativeAudio::error()
-{
- const QString errorString = QLatin1String("Failed to open device.");
-
- QtTestMediaServiceProvider provider;
- QDeclarativeAudio audio;
-
- audio.componentComplete();
-
- QSignalSpy errorSpy(&audio, SIGNAL(error(QDeclarativeAudio::Error,QString)));
- QSignalSpy errorChangedSpy(&audio, SIGNAL(errorChanged()));
-
- QCOMPARE(audio.error(), QDeclarativeAudio::NoError);
- QCOMPARE(audio.errorString(), QString());
-
- provider.playerControl()->emitError(QMediaPlayer::ResourceError, errorString);
-
- QCOMPARE(audio.error(), QDeclarativeAudio::ResourceError);
- QCOMPARE(audio.errorString(), errorString);
- QCOMPARE(errorSpy.count(), 1);
- QCOMPARE(errorChangedSpy.count(), 1);
-
- // Changing the source resets the error properties.
- audio.setSource(QUrl("http://example.com"));
- QCOMPARE(audio.error(), QDeclarativeAudio::NoError);
- QCOMPARE(audio.errorString(), QString());
- QCOMPARE(errorSpy.count(), 1);
- QCOMPARE(errorChangedSpy.count(), 2);
-
- // But isn't noisy.
- audio.setSource(QUrl("file:///file/path"));
- QCOMPARE(audio.error(), QDeclarativeAudio::NoError);
- QCOMPARE(audio.errorString(), QString());
- QCOMPARE(errorSpy.count(), 1);
- QCOMPARE(errorChangedSpy.count(), 2);
-}
-
-
-QTEST_MAIN(tst_QDeclarativeAudio)
-
-#include "tst_qdeclarativeaudio.moc"
diff --git a/tests/auto/qdeclarativevideo/qdeclarativevideo.pro b/tests/auto/qdeclarativevideo/qdeclarativevideo.pro
deleted file mode 100644
index 64a20da..0000000
--- a/tests/auto/qdeclarativevideo/qdeclarativevideo.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-load(qttest_p4)
-
-HEADERS += \
- $$PWD/../../../src/imports/multimedia/qdeclarativevideo_p.h \
- $$PWD/../../../src/imports/multimedia/qdeclarativemediabase_p.h \
- $$PWD/../../../src/imports/multimedia/qmetadatacontrolmetaobject_p.h
-
-SOURCES += \
- tst_qdeclarativevideo.cpp \
- $$PWD/../../../src/imports/multimedia/qdeclarativevideo.cpp \
- $$PWD/../../../src/imports/multimedia/qdeclarativemediabase.cpp \
- $$PWD/../../../src/imports/multimedia/qmetadatacontrolmetaobject.cpp
-
-QT += multimedia mediaservices declarative
diff --git a/tests/auto/qdeclarativevideo/tst_qdeclarativevideo.cpp b/tests/auto/qdeclarativevideo/tst_qdeclarativevideo.cpp
deleted file mode 100644
index 99b447a..0000000
--- a/tests/auto/qdeclarativevideo/tst_qdeclarativevideo.cpp
+++ /dev/null
@@ -1,921 +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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, 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.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QtTest>
-
-#include "../../../src/imports/multimedia/qdeclarativevideo_p.h"
-
-#include <QtGui/qapplication.h>
-#include <QtMultimedia/qabstractvideosurface.h>
-#include <QtMediaServices/qgraphicsvideoitem.h>
-#include <QtMediaServices/qmediaplayercontrol.h>
-#include <QtMediaServices/qmediaservice.h>
-#include <QtMediaServices/qvideooutputcontrol.h>
-#include <QtMediaServices/qvideorenderercontrol.h>
-#include <QtMultimedia/qvideosurfaceformat.h>
-
-
-class tst_QDeclarativeVideo : public QObject
-{
- Q_OBJECT
-public slots:
- void initTestCase();
-
-private slots:
- void nullPlayerControl();
- void nullService();
-
- void playing();
- void paused();
- void error();
-
- void hasAudio();
- void hasVideo();
- void fillMode();
- void geometry();
-};
-
-Q_DECLARE_METATYPE(QtMediaServices::MetaData);
-Q_DECLARE_METATYPE(QDeclarativeVideo::Error);
-
-class QtTestMediaPlayerControl : public QMediaPlayerControl
-{
- Q_OBJECT
-public:
- QtTestMediaPlayerControl(QObject *parent = 0)
- : QMediaPlayerControl(parent)
- , m_state(QMediaPlayer::StoppedState)
- , m_mediaStatus(QMediaPlayer::NoMedia)
- , m_duration(0)
- , m_position(0)
- , m_playbackRate(1.0)
- , m_volume(50)
- , m_bufferStatus(0)
- , m_muted(false)
- , m_audioAvailable(false)
- , m_videoAvailable(false)
- , m_seekable(false)
- {
- }
-
- QMediaPlayer::State state() const { return m_state; }
- void updateState(QMediaPlayer::State state) { emit stateChanged(m_state = state); }
-
- QMediaPlayer::MediaStatus mediaStatus() const { return m_mediaStatus; }
- void updateMediaStatus(QMediaPlayer::MediaStatus status) {
- emit mediaStatusChanged(m_mediaStatus = status); }
- void updateMediaStatus(QMediaPlayer::MediaStatus status, QMediaPlayer::State state)
- {
- m_mediaStatus = status;
- m_state = state;
-
- emit mediaStatusChanged(m_mediaStatus);
- emit stateChanged(m_state);
- }
-
- qint64 duration() const { return m_duration; }
- void setDuration(qint64 duration) { emit durationChanged(m_duration = duration); }
-
- qint64 position() const { return m_position; }
- void setPosition(qint64 position) { emit positionChanged(m_position = position); }
-
- int volume() const { return m_volume; }
- void setVolume(int volume) { emit volumeChanged(m_volume = volume); }
-
- bool isMuted() const { return m_muted; }
- void setMuted(bool muted) { emit mutedChanged(m_muted = muted); }
-
- int bufferStatus() const { return m_bufferStatus; }
- void setBufferStatus(int status) { emit bufferStatusChanged(m_bufferStatus = status); }
-
- bool isAudioAvailable() const { return m_audioAvailable; }
- void setAudioAvailable(bool available) {
- emit audioAvailableChanged(m_audioAvailable = available); }
- bool isVideoAvailable() const { return m_videoAvailable; }
- void setVideoAvailable(bool available) {
- emit videoAvailableChanged(m_videoAvailable = available); }
-
- bool isSeekable() const { return m_seekable; }
- void setSeekable(bool seekable) { emit seekableChanged(m_seekable = seekable); }
-
- QMediaTimeRange availablePlaybackRanges() const { return QMediaTimeRange(); }
-
- qreal playbackRate() const { return m_playbackRate; }
- void setPlaybackRate(qreal rate) { emit playbackRateChanged(m_playbackRate = rate); }
-
- QMediaContent media() const { return m_media; }
- const QIODevice *mediaStream() const { return 0; }
- void setMedia(const QMediaContent &media, QIODevice *)
- {
- m_media = media;
-
- m_mediaStatus = m_media.isNull()
- ? QMediaPlayer::NoMedia
- : QMediaPlayer::LoadingMedia;
-
- emit mediaChanged(m_media);
- emit mediaStatusChanged(m_mediaStatus);
- }
-
- void play() { emit stateChanged(m_state = QMediaPlayer::PlayingState); }
- void pause() { emit stateChanged(m_state = QMediaPlayer::PausedState); }
- void stop() { emit stateChanged(m_state = QMediaPlayer::StoppedState); }
-
- void emitError(QMediaPlayer::Error err, const QString &errorString) {
- emit error(err, errorString); }
-
-private:
- QMediaPlayer::State m_state;
- QMediaPlayer::MediaStatus m_mediaStatus;
- qint64 m_duration;
- qint64 m_position;
- qreal m_playbackRate;
- int m_volume;
- int m_bufferStatus;
- bool m_muted;
- bool m_audioAvailable;
- bool m_videoAvailable;
- bool m_seekable;
- QMediaContent m_media;
-};
-
-class QtTestOutputControl : public QVideoOutputControl
-{
-public:
- QtTestOutputControl(QObject *parent) : QVideoOutputControl(parent), m_output(NoOutput) {}
-
- QList<Output> availableOutputs() const { return m_outputs; }
- void setAvailableOutputs(const QList<Output> outputs) { m_outputs = outputs; }
-
- Output output() const { return m_output; }
- virtual void setOutput(Output output) { m_output = output; }
-
-private:
- Output m_output;
- QList<Output> m_outputs;
-};
-
-class QtTestRendererControl : public QVideoRendererControl
-{
-public:
- QtTestRendererControl(QObject *parent ) : QVideoRendererControl(parent), m_surface(0) {}
-
- QAbstractVideoSurface *surface() const { return m_surface; }
- void setSurface(QAbstractVideoSurface *surface) { m_surface = surface; }
-
-private:
- QAbstractVideoSurface *m_surface;
-};
-
-class QtTestMediaService : public QMediaService
-{
- Q_OBJECT
-public:
- QtTestMediaService(
- QtTestMediaPlayerControl *playerControl,
- QtTestOutputControl *outputControl,
- QtTestRendererControl *rendererControl,
- QObject *parent)
- : QMediaService(parent)
- , playerControl(playerControl)
- , outputControl(outputControl)
- , rendererControl(rendererControl)
- {
- }
-
- QMediaControl *control(const char *name) const
- {
- if (qstrcmp(name, QMediaPlayerControl_iid) == 0)
- return playerControl;
- else if (qstrcmp(name, QVideoOutputControl_iid) == 0)
- return outputControl;
- else if (qstrcmp(name, QVideoRendererControl_iid) == 0)
- return rendererControl;
- else
- return 0;
- }
-
- QtTestMediaPlayerControl *playerControl;
- QtTestOutputControl *outputControl;
- QtTestRendererControl *rendererControl;
-};
-
-class QtTestMediaServiceProvider : public QMediaServiceProvider
-{
- Q_OBJECT
-public:
- QtTestMediaServiceProvider()
- : service(new QtTestMediaService(
- new QtTestMediaPlayerControl(this),
- new QtTestOutputControl(this),
- new QtTestRendererControl(this),
- this))
- {
- setDefaultServiceProvider(this);
- }
-
- QtTestMediaServiceProvider(QtTestMediaService *service)
- : service(service)
- {
- setDefaultServiceProvider(this);
- }
-
- QtTestMediaServiceProvider(
- QtTestMediaPlayerControl *playerControl,
- QtTestOutputControl *outputControl,
- QtTestRendererControl *rendererControl)
- : service(new QtTestMediaService(playerControl, outputControl, rendererControl, this))
- {
- setDefaultServiceProvider(this);
- }
-
- ~QtTestMediaServiceProvider()
- {
- setDefaultServiceProvider(0);
- }
-
- QMediaService *requestService(
- const QByteArray &type,
- const QMediaServiceProviderHint & = QMediaServiceProviderHint())
- {
- requestedService = type;
-
- return service;
- }
-
- void releaseService(QMediaService *) {}
-
- inline QtTestMediaPlayerControl *playerControl() { return service->playerControl; }
- inline QtTestRendererControl *rendererControl() { return service->rendererControl; }
-
- QtTestMediaService *service;
- QByteArray requestedService;
-};
-
-
-void tst_QDeclarativeVideo::initTestCase()
-{
- qRegisterMetaType<QDeclarativeVideo::Error>();
-}
-
-void tst_QDeclarativeVideo::nullPlayerControl()
-{
- QtTestMediaServiceProvider provider(0, 0, 0);
-
- QDeclarativeVideo video;
-
- QCOMPARE(video.source(), QUrl());
- video.setSource(QUrl("http://example.com"));
- QCOMPARE(video.source(), QUrl("http://example.com"));
-
- QCOMPARE(video.isPlaying(), false);
- video.setPlaying(true);
- QCOMPARE(video.isPlaying(), true);
- video.setPlaying(false);
- video.play();
- QCOMPARE(video.isPlaying(), false);
-
- QCOMPARE(video.isPaused(), false);
- video.pause();
- QCOMPARE(video.isPaused(), false);
- video.setPaused(true);
- QCOMPARE(video.isPaused(), true);
-
- QCOMPARE(video.duration(), 0);
-
- QCOMPARE(video.position(), 0);
- video.setPosition(10000);
- QCOMPARE(video.position(), 10000);
-
- QCOMPARE(video.volume(), qreal(1.0));
- video.setVolume(0.5);
- QCOMPARE(video.volume(), qreal(0.5));
-
- QCOMPARE(video.isMuted(), false);
- video.setMuted(true);
- QCOMPARE(video.isMuted(), true);
-
- QCOMPARE(video.bufferProgress(), qreal(0));
-
- QCOMPARE(video.isSeekable(), false);
-
- QCOMPARE(video.playbackRate(), qreal(1.0));
-
- QCOMPARE(video.hasAudio(), false);
- QCOMPARE(video.hasVideo(), false);
-
- QCOMPARE(video.status(), QDeclarativeVideo::NoMedia);
-
- QCOMPARE(video.error(), QDeclarativeVideo::ServiceMissing);
-}
-
-void tst_QDeclarativeVideo::nullService()
-{
- QtTestMediaServiceProvider provider(0);
-
- QDeclarativeVideo video;
-
- QCOMPARE(video.source(), QUrl());
- video.setSource(QUrl("http://example.com"));
- QCOMPARE(video.source(), QUrl("http://example.com"));
-
- QCOMPARE(video.isPlaying(), false);
- video.setPlaying(true);
- QCOMPARE(video.isPlaying(), true);
- video.setPlaying(false);
- video.play();
- QCOMPARE(video.isPlaying(), false);
-
- QCOMPARE(video.isPaused(), false);
- video.pause();
- QCOMPARE(video.isPaused(), false);
- video.setPaused(true);
- QCOMPARE(video.isPaused(), true);
-
- QCOMPARE(video.duration(), 0);
-
- QCOMPARE(video.position(), 0);
- video.setPosition(10000);
- QCOMPARE(video.position(), 10000);
-
- QCOMPARE(video.volume(), qreal(1.0));
- video.setVolume(0.5);
- QCOMPARE(video.volume(), qreal(0.5));
-
- QCOMPARE(video.isMuted(), false);
- video.setMuted(true);
- QCOMPARE(video.isMuted(), true);
-
- QCOMPARE(video.bufferProgress(), qreal(0));
-
- QCOMPARE(video.isSeekable(), false);
-
- QCOMPARE(video.playbackRate(), qreal(1.0));
-
- QCOMPARE(video.hasAudio(), false);
- QCOMPARE(video.hasVideo(), false);
-
- QCOMPARE(video.status(), QDeclarativeVideo::NoMedia);
-
- QCOMPARE(video.error(), QDeclarativeVideo::ServiceMissing);
-
- QCOMPARE(video.metaObject()->indexOfProperty("title"), -1);
- QCOMPARE(video.metaObject()->indexOfProperty("genre"), -1);
- QCOMPARE(video.metaObject()->indexOfProperty("description"), -1);
-}
-
-void tst_QDeclarativeVideo::playing()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeVideo video;
- video.componentComplete();
-
- QSignalSpy playingChangedSpy(&video, SIGNAL(playingChanged()));
- QSignalSpy startedSpy(&video, SIGNAL(started()));
- QSignalSpy stoppedSpy(&video, SIGNAL(stopped()));
-
- int playingChanged = 0;
- int started = 0;
- int stopped = 0;
-
- QCOMPARE(video.isPlaying(), false);
-
- // setPlaying(true) when stopped.
- video.setPlaying(true);
- QCOMPARE(video.isPlaying(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(startedSpy.count(), ++started);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPlaying(false) when playing.
- video.setPlaying(false);
- QCOMPARE(video.isPlaying(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(stoppedSpy.count(), ++stopped);
-
- // play() when stopped.
- video.play();
- QCOMPARE(video.isPlaying(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(startedSpy.count(), ++started);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // stop() when playing.
- video.stop();
- QCOMPARE(video.isPlaying(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(stoppedSpy.count(), ++stopped);
-
- // stop() when stopped.
- video.stop();
- QCOMPARE(video.isPlaying(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPlaying(false) when stopped.
- video.setPlaying(false);
- QCOMPARE(video.isPlaying(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- video.setPlaying(true);
- QCOMPARE(video.isPlaying(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(startedSpy.count(), ++started);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPlaying(true) when playing.
- video.setPlaying(true);
- QCOMPARE(video.isPlaying(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // play() when playing.
- video.play();
- QCOMPARE(video.isPlaying(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(stoppedSpy.count(), stopped);
-}
-
-void tst_QDeclarativeVideo::paused()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeVideo video;
- video.componentComplete();
-
- QSignalSpy playingChangedSpy(&video, SIGNAL(playingChanged()));
- QSignalSpy pausedChangedSpy(&video, SIGNAL(pausedChanged()));
- QSignalSpy startedSpy(&video, SIGNAL(started()));
- QSignalSpy pausedSpy(&video, SIGNAL(paused()));
- QSignalSpy resumedSpy(&video, SIGNAL(resumed()));
- QSignalSpy stoppedSpy(&video, SIGNAL(stopped()));
-
- int playingChanged = 0;
- int pausedChanged = 0;
- int started = 0;
- int paused = 0;
- int resumed = 0;
- int stopped = 0;
-
- QCOMPARE(video.isPlaying(), false);
- QCOMPARE(video.isPaused(), false);
-
- // setPlaying(true) when stopped.
- video.setPlaying(true);
- QCOMPARE(video.isPlaying(), true);
- QCOMPARE(video.isPaused(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), ++started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPaused(true) when playing.
- video.setPaused(true);
- QCOMPARE(video.isPlaying(), true);
- QCOMPARE(video.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), ++paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPaused(true) when paused.
- video.setPaused(true);
- QCOMPARE(video.isPlaying(), true);
- QCOMPARE(video.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // pause() when paused.
- video.pause();
- QCOMPARE(video.isPlaying(), true);
- QCOMPARE(video.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPaused(false) when paused.
- video.setPaused(false);
- QCOMPARE(video.isPlaying(), true);
- QCOMPARE(video.isPaused(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), ++resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPaused(false) when playing.
- video.setPaused(false);
- QCOMPARE(video.isPlaying(), true);
- QCOMPARE(video.isPaused(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // pause() when playing.
- video.pause();
- QCOMPARE(video.isPlaying(), true);
- QCOMPARE(video.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), ++paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPlaying(false) when paused.
- video.setPlaying(false);
- QCOMPARE(video.isPlaying(), false);
- QCOMPARE(video.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), ++stopped);
-
- // setPaused(true) when stopped and paused.
- video.setPaused(true);
- QCOMPARE(video.isPlaying(), false);
- QCOMPARE(video.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPaused(false) when stopped and paused.
- video.setPaused(false);
- QCOMPARE(video.isPlaying(), false);
- QCOMPARE(video.isPaused(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPaused(true) when stopped.
- video.setPaused(true);
- QCOMPARE(video.isPlaying(), false);
- QCOMPARE(video.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPlaying(true) when stopped and paused.
- video.setPlaying(true);
- QCOMPARE(video.isPlaying(), true);
- QCOMPARE(video.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), ++started);
- QCOMPARE(pausedSpy.count(), ++paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // play() when paused.
- video.play();
- QCOMPARE(video.isPlaying(), true);
- QCOMPARE(video.isPaused(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), ++resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPaused(true) when playing.
- video.setPaused(true);
- QCOMPARE(video.isPlaying(), true);
- QCOMPARE(video.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), ++paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // stop() when paused.
- video.stop();
- QCOMPARE(video.isPlaying(), false);
- QCOMPARE(video.isPaused(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), ++stopped);
-
- // setPaused(true) when stopped.
- video.setPaused(true);
- QCOMPARE(video.isPlaying(), false);
- QCOMPARE(video.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // stop() when stopped and paused.
- video.stop();
- QCOMPARE(video.isPlaying(), false);
- QCOMPARE(video.isPaused(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // pause() when stopped.
- video.pause();
- QCOMPARE(video.isPlaying(), true);
- QCOMPARE(video.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), ++started);
- QCOMPARE(pausedSpy.count(), ++paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPlaying(false) when paused.
- video.setPlaying(false);
- QCOMPARE(video.isPlaying(), false);
- QCOMPARE(video.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), ++stopped);
-
- // pause() when stopped and paused.
- video.pause();
- QCOMPARE(video.isPlaying(), true);
- QCOMPARE(video.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), ++started);
- QCOMPARE(pausedSpy.count(), ++paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-
- // setPlaying(false) when paused.
- video.setPlaying(false);
- QCOMPARE(video.isPlaying(), false);
- QCOMPARE(video.isPaused(), true);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), pausedChanged);
- QCOMPARE(startedSpy.count(), started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), ++stopped);
-
- // play() when stopped and paused.
- video.play();
- QCOMPARE(video.isPlaying(), true);
- QCOMPARE(video.isPaused(), false);
- QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState);
- QCOMPARE(playingChangedSpy.count(), ++playingChanged);
- QCOMPARE(pausedChangedSpy.count(), ++pausedChanged);
- QCOMPARE(startedSpy.count(), ++started);
- QCOMPARE(pausedSpy.count(), paused);
- QCOMPARE(resumedSpy.count(), resumed);
- QCOMPARE(stoppedSpy.count(), stopped);
-}
-
-void tst_QDeclarativeVideo::error()
-{
- const QString errorString = QLatin1String("Failed to open device.");
-
- QtTestMediaServiceProvider provider;
- QDeclarativeVideo video;
- video.componentComplete();
-
- QSignalSpy errorSpy(&video, SIGNAL(error(QDeclarativeVideo::Error,QString)));
- QSignalSpy errorChangedSpy(&video, SIGNAL(errorChanged()));
-
- QCOMPARE(video.error(), QDeclarativeVideo::NoError);
- QCOMPARE(video.errorString(), QString());
-
- provider.playerControl()->emitError(QMediaPlayer::ResourceError, errorString);
-
- QCOMPARE(video.error(), QDeclarativeVideo::ResourceError);
- QCOMPARE(video.errorString(), errorString);
- QCOMPARE(errorSpy.count(), 1);
- QCOMPARE(errorChangedSpy.count(), 1);
-
- // Changing the source resets the error properties.
- video.setSource(QUrl("http://example.com"));
- QCOMPARE(video.error(), QDeclarativeVideo::NoError);
- QCOMPARE(video.errorString(), QString());
- QCOMPARE(errorSpy.count(), 1);
- QCOMPARE(errorChangedSpy.count(), 2);
-
- // But isn't noisy.
- video.setSource(QUrl("file:///file/path"));
- QCOMPARE(video.error(), QDeclarativeVideo::NoError);
- QCOMPARE(video.errorString(), QString());
- QCOMPARE(errorSpy.count(), 1);
- QCOMPARE(errorChangedSpy.count(), 2);
-}
-
-
-void tst_QDeclarativeVideo::hasAudio()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeVideo video;
- video.componentComplete();
-
- QSignalSpy spy(&video, SIGNAL(hasAudioChanged()));
-
- QCOMPARE(video.hasAudio(), false);
-
- provider.playerControl()->setAudioAvailable(true);
- QCOMPARE(video.hasAudio(), true);
- QCOMPARE(spy.count(), 1);
-
- provider.playerControl()->setAudioAvailable(true);
- QCOMPARE(video.hasAudio(), true);
- QCOMPARE(spy.count(), 2);
-
- provider.playerControl()->setAudioAvailable(false);
- QCOMPARE(video.hasAudio(), false);
- QCOMPARE(spy.count(), 3);
-}
-
-void tst_QDeclarativeVideo::hasVideo()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeVideo video;
-
- video.componentComplete();
-
- QSignalSpy spy(&video, SIGNAL(hasVideoChanged()));
-
- QCOMPARE(video.hasVideo(), false);
-
- provider.playerControl()->setVideoAvailable(true);
- QCOMPARE(video.hasVideo(), true);
- QCOMPARE(spy.count(), 1);
-
- provider.playerControl()->setVideoAvailable(true);
- QCOMPARE(video.hasVideo(), true);
- QCOMPARE(spy.count(), 2);
-
- provider.playerControl()->setVideoAvailable(false);
- QCOMPARE(video.hasVideo(), false);
- QCOMPARE(spy.count(), 3);
-}
-
-void tst_QDeclarativeVideo::fillMode()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeVideo video;
- video.componentComplete();
-
- QList<QGraphicsItem *> children = video.childItems();
- QCOMPARE(children.count(), 1);
- QGraphicsVideoItem *videoItem = qgraphicsitem_cast<QGraphicsVideoItem *>(children.first());
- QVERIFY(videoItem != 0);
-
- QCOMPARE(video.fillMode(), QDeclarativeVideo::PreserveAspectFit);
-
- video.setFillMode(QDeclarativeVideo::PreserveAspectCrop);
- QCOMPARE(video.fillMode(), QDeclarativeVideo::PreserveAspectCrop);
- QCOMPARE(videoItem->aspectRatioMode(), Qt::KeepAspectRatioByExpanding);
-
- video.setFillMode(QDeclarativeVideo::Stretch);
- QCOMPARE(video.fillMode(), QDeclarativeVideo::Stretch);
- QCOMPARE(videoItem->aspectRatioMode(), Qt::IgnoreAspectRatio);
-
- video.setFillMode(QDeclarativeVideo::PreserveAspectFit);
- QCOMPARE(video.fillMode(), QDeclarativeVideo::PreserveAspectFit);
- QCOMPARE(videoItem->aspectRatioMode(), Qt::KeepAspectRatio);
-}
-
-void tst_QDeclarativeVideo::geometry()
-{
- QtTestMediaServiceProvider provider;
- QDeclarativeVideo video;
- video.componentComplete();
-
- QAbstractVideoSurface *surface = provider.rendererControl()->surface();
- QVERIFY(surface != 0);
-
- QList<QGraphicsItem *> children = video.childItems();
- QCOMPARE(children.count(), 1);
- QGraphicsVideoItem *videoItem = qgraphicsitem_cast<QGraphicsVideoItem *>(children.first());
- QVERIFY(videoItem != 0);
-
- QVideoSurfaceFormat format(QSize(640, 480), QVideoFrame::Format_RGB32);
-
- QVERIFY(surface->start(format));
-
- QCOMPARE(video.implicitWidth(), qreal(640));
- QCOMPARE(video.implicitHeight(), qreal(480));
-
- video.setWidth(560);
- video.setHeight(328);
-
- QCOMPARE(videoItem->size().width(), qreal(560));
- QCOMPARE(videoItem->size().height(), qreal(328));
-}
-
-QTEST_MAIN(tst_QDeclarativeVideo)
-
-#include "tst_qdeclarativevideo.moc"
diff --git a/tests/auto/qgraphicsvideoitem/qgraphicsvideoitem.pro b/tests/auto/qgraphicsvideoitem/qgraphicsvideoitem.pro
deleted file mode 100644
index b57e8e3..0000000
--- a/tests/auto/qgraphicsvideoitem/qgraphicsvideoitem.pro
+++ /dev/null
@@ -1,5 +0,0 @@
-load(qttest_p4)
-SOURCES += tst_qgraphicsvideoitem.cpp
-
-QT += multimedia mediaservices
-requires(contains(QT_CONFIG, mediaservices))
diff --git a/tests/auto/qgraphicsvideoitem/tst_qgraphicsvideoitem.cpp b/tests/auto/qgraphicsvideoitem/tst_qgraphicsvideoitem.cpp
deleted file mode 100644
index 1815779..0000000
--- a/tests/auto/qgraphicsvideoitem/tst_qgraphicsvideoitem.cpp
+++ /dev/null
@@ -1,670 +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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, 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.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QtTest>
-
-#include <QtMediaServices/qgraphicsvideoitem.h>
-
-#include <QtGui/qapplication.h>
-#include <QtGui/qgraphicsscene.h>
-#include <QtGui/qgraphicsview.h>
-#include <QtMultimedia/qabstractvideosurface.h>
-#include <QtMediaServices/qmediaobject.h>
-#include <QtMediaServices/qmediaservice.h>
-#include <QtMediaServices/qvideooutputcontrol.h>
-#include <QtMediaServices/qvideorenderercontrol.h>
-#include <QtMultimedia/qvideosurfaceformat.h>
-
-#include <QtMediaServices/private/qpaintervideosurface_p.h>
-
-class tst_QGraphicsVideoItem : public QObject
-{
- Q_OBJECT
-public slots:
- void initTestCase();
-
-private slots:
- void nullObject();
- void nullService();
- void nullOutputControl();
- void noOutputs();
- void serviceDestroyed();
- void mediaObjectDestroyed();
- void setMediaObject();
-
- void show();
-
- void aspectRatioMode();
- void offset();
- void size();
- void nativeSize_data();
- void nativeSize();
-
- void boundingRect_data();
- void boundingRect();
-
- void paint();
-};
-
-Q_DECLARE_METATYPE(const uchar *)
-Q_DECLARE_METATYPE(Qt::AspectRatioMode)
-
-class QtTestOutputControl : public QVideoOutputControl
-{
-public:
- QtTestOutputControl() : m_output(NoOutput) {}
-
- QList<Output> availableOutputs() const { return m_outputs; }
- void setAvailableOutputs(const QList<Output> outputs) { m_outputs = outputs; }
-
- Output output() const { return m_output; }
- virtual void setOutput(Output output) { m_output = output; }
-
-private:
- Output m_output;
- QList<Output> m_outputs;
-};
-
-class QtTestRendererControl : public QVideoRendererControl
-{
-public:
- QtTestRendererControl()
- : m_surface(0)
- {
- }
-
- QAbstractVideoSurface *surface() const { return m_surface; }
- void setSurface(QAbstractVideoSurface *surface) { m_surface = surface; }
-
-private:
- QAbstractVideoSurface *m_surface;
-};
-
-class QtTestVideoService : public QMediaService
-{
- Q_OBJECT
-public:
- QtTestVideoService(
- QtTestOutputControl *output,
- QtTestRendererControl *renderer)
- : QMediaService(0)
- , outputControl(output)
- , rendererControl(renderer)
- {
- }
-
- ~QtTestVideoService()
- {
- delete outputControl;
- delete rendererControl;
- }
-
- QMediaControl *control(const char *name) const
- {
- if (qstrcmp(name, QVideoOutputControl_iid) == 0)
- return outputControl;
- else if (qstrcmp(name, QVideoRendererControl_iid) == 0)
- return rendererControl;
- else
- return 0;
- }
-
- QtTestOutputControl *outputControl;
- QtTestRendererControl *rendererControl;
-};
-
-class QtTestVideoObject : public QMediaObject
-{
- Q_OBJECT
-public:
- QtTestVideoObject(QtTestRendererControl *renderer):
- QMediaObject(0, new QtTestVideoService(new QtTestOutputControl, renderer))
- {
- testService = qobject_cast<QtTestVideoService*>(service());
- QList<QVideoOutputControl::Output> outputs;
-
- if (renderer)
- outputs.append(QVideoOutputControl::RendererOutput);
-
- testService->outputControl->setAvailableOutputs(outputs);
- }
-
- QtTestVideoObject(QtTestVideoService *service):
- QMediaObject(0, service),
- testService(service)
- {
- }
-
- ~QtTestVideoObject()
- {
- delete testService;
- }
-
- QtTestVideoService *testService;
-};
-
-class QtTestGraphicsVideoItem : public QGraphicsVideoItem
-{
-public:
- QtTestGraphicsVideoItem(QGraphicsItem *parent = 0)
- : QGraphicsVideoItem(parent)
- , m_paintCount(0)
- {
- }
-
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
- {
- ++m_paintCount;
-
- QTestEventLoop::instance().exitLoop();
-
- QGraphicsVideoItem::paint(painter, option, widget);
- }
-
- bool waitForPaint(int secs)
- {
- const int paintCount = m_paintCount;
-
- QTestEventLoop::instance().enterLoop(secs);
-
- return m_paintCount != paintCount;
- }
-
- int paintCount() const
- {
- return m_paintCount;
- }
-
-private:
- int m_paintCount;
-};
-
-void tst_QGraphicsVideoItem::initTestCase()
-{
- qRegisterMetaType<Qt::AspectRatioMode>();
-}
-
-void tst_QGraphicsVideoItem::nullObject()
-{
- QGraphicsVideoItem item(0);
-
- QVERIFY(item.boundingRect().isEmpty());
-}
-
-void tst_QGraphicsVideoItem::nullService()
-{
- QtTestVideoService *service = 0;
-
- QtTestVideoObject object(service);
-
- QtTestGraphicsVideoItem *item = new QtTestGraphicsVideoItem;
- item->setMediaObject(&object);
-
- QVERIFY(item->boundingRect().isEmpty());
-
- item->hide();
- item->show();
-
- QGraphicsScene graphicsScene;
- graphicsScene.addItem(item);
- QGraphicsView graphicsView(&graphicsScene);
- graphicsView.show();
-}
-
-void tst_QGraphicsVideoItem::nullOutputControl()
-{
- QtTestVideoObject object(new QtTestVideoService(0, 0));
-
- QtTestGraphicsVideoItem *item = new QtTestGraphicsVideoItem;
- item->setMediaObject(&object);
-
- QVERIFY(item->boundingRect().isEmpty());
-
- item->hide();
- item->show();
-
- QGraphicsScene graphicsScene;
- graphicsScene.addItem(item);
- QGraphicsView graphicsView(&graphicsScene);
- graphicsView.show();
-}
-
-void tst_QGraphicsVideoItem::noOutputs()
-{
- QtTestRendererControl *control = 0;
- QtTestVideoObject object(control);
-
- QtTestGraphicsVideoItem *item = new QtTestGraphicsVideoItem;
- item->setMediaObject(&object);
-
- QVERIFY(item->boundingRect().isEmpty());
-
- item->hide();
- QCOMPARE(object.testService->outputControl->output(), QVideoOutputControl::NoOutput);
- item->show();
- QCOMPARE(object.testService->outputControl->output(), QVideoOutputControl::NoOutput);
-
- QGraphicsScene graphicsScene;
- graphicsScene.addItem(item);
- QGraphicsView graphicsView(&graphicsScene);
- graphicsView.show();
-}
-
-void tst_QGraphicsVideoItem::serviceDestroyed()
-{
- QtTestVideoObject object(new QtTestRendererControl);
-
- QGraphicsVideoItem item;
- item.setMediaObject(&object);
-
- QtTestVideoService *service = object.testService;
- object.testService = 0;
-
- delete service;
-
- QCOMPARE(item.mediaObject(), static_cast<QMediaObject *>(&object));
- QVERIFY(item.boundingRect().isEmpty());
-}
-
-void tst_QGraphicsVideoItem::mediaObjectDestroyed()
-{
- QtTestVideoObject *object = new QtTestVideoObject(new QtTestRendererControl);
-
- QGraphicsVideoItem item;
- item.setMediaObject(object);
-
- delete object;
- object = 0;
-
- QCOMPARE(item.mediaObject(), static_cast<QMediaObject *>(object));
- QVERIFY(item.boundingRect().isEmpty());
-}
-
-void tst_QGraphicsVideoItem::setMediaObject()
-{
- QMediaObject *nullObject = 0;
- QtTestVideoObject object(new QtTestRendererControl);
-
- QGraphicsVideoItem item;
-
- QCOMPARE(item.mediaObject(), nullObject);
- QCOMPARE(object.testService->outputControl->output(), QVideoOutputControl::NoOutput);
-
- item.setMediaObject(&object);
- QCOMPARE(item.mediaObject(), static_cast<QMediaObject *>(&object));
- QCOMPARE(object.testService->outputControl->output(), QVideoOutputControl::RendererOutput);
- QVERIFY(object.testService->rendererControl->surface() != 0);
-
- item.setMediaObject(0);
- QCOMPARE(item.mediaObject(), nullObject);
-
- QCOMPARE(object.testService->outputControl->output(), QVideoOutputControl::NoOutput);
-
- item.setVisible(false);
-
- item.setMediaObject(&object);
- QCOMPARE(item.mediaObject(), static_cast<QMediaObject *>(&object));
- QCOMPARE(object.testService->outputControl->output(), QVideoOutputControl::NoOutput);
- QVERIFY(object.testService->rendererControl->surface() != 0);
-}
-
-void tst_QGraphicsVideoItem::show()
-{
- QtTestVideoObject object(new QtTestRendererControl);
- QtTestGraphicsVideoItem *item = new QtTestGraphicsVideoItem;
- item->setMediaObject(&object);
-
- // Graphics items are visible by default
- QCOMPARE(object.testService->outputControl->output(), QVideoOutputControl::RendererOutput);
- QVERIFY(object.testService->rendererControl->surface() != 0);
-
- item->hide();
- QCOMPARE(object.testService->outputControl->output(), QVideoOutputControl::RendererOutput);
-
- item->show();
- QCOMPARE(object.testService->outputControl->output(), QVideoOutputControl::RendererOutput);
- QVERIFY(object.testService->rendererControl->surface() != 0);
-
- QVERIFY(item->boundingRect().isEmpty());
-
- QVideoSurfaceFormat format(QSize(320,240),QVideoFrame::Format_RGB32);
- QVERIFY(object.testService->rendererControl->surface()->start(format));
-
- QVERIFY(!item->boundingRect().isEmpty());
-
- QGraphicsScene graphicsScene;
- graphicsScene.addItem(item);
- QGraphicsView graphicsView(&graphicsScene);
- graphicsView.show();
-
- QVERIFY(item->paintCount() || item->waitForPaint(1));
-}
-
-void tst_QGraphicsVideoItem::aspectRatioMode()
-{
- QGraphicsVideoItem item;
-
- QCOMPARE(item.aspectRatioMode(), Qt::KeepAspectRatio);
-
- item.setAspectRatioMode(Qt::IgnoreAspectRatio);
- QCOMPARE(item.aspectRatioMode(), Qt::IgnoreAspectRatio);
-
- item.setAspectRatioMode(Qt::KeepAspectRatioByExpanding);
- QCOMPARE(item.aspectRatioMode(), Qt::KeepAspectRatioByExpanding);
-
- item.setAspectRatioMode(Qt::KeepAspectRatio);
- QCOMPARE(item.aspectRatioMode(), Qt::KeepAspectRatio);
-}
-
-void tst_QGraphicsVideoItem::offset()
-{
- QGraphicsVideoItem item;
-
- QCOMPARE(item.offset(), QPointF(0, 0));
-
- item.setOffset(QPointF(-32.4, 43.0));
- QCOMPARE(item.offset(), QPointF(-32.4, 43.0));
-
- item.setOffset(QPointF(1, 1));
- QCOMPARE(item.offset(), QPointF(1, 1));
-
- item.setOffset(QPointF(12, -30.4));
- QCOMPARE(item.offset(), QPointF(12, -30.4));
-
- item.setOffset(QPointF(-90.4, -75));
- QCOMPARE(item.offset(), QPointF(-90.4, -75));
-}
-
-void tst_QGraphicsVideoItem::size()
-{
- QGraphicsVideoItem item;
-
- QCOMPARE(item.size(), QSizeF(320, 240));
-
- item.setSize(QSizeF(542.5, 436.3));
- QCOMPARE(item.size(), QSizeF(542.5, 436.3));
-
- item.setSize(QSizeF(-43, 12));
- QCOMPARE(item.size(), QSizeF(0, 0));
-
- item.setSize(QSizeF(54, -9));
- QCOMPARE(item.size(), QSizeF(0, 0));
-
- item.setSize(QSizeF(-90, -65));
- QCOMPARE(item.size(), QSizeF(0, 0));
-
- item.setSize(QSizeF(1000, 1000));
- QCOMPARE(item.size(), QSizeF(1000, 1000));
-}
-
-void tst_QGraphicsVideoItem::nativeSize_data()
-{
- QTest::addColumn<QSize>("frameSize");
- QTest::addColumn<QRect>("viewport");
- QTest::addColumn<QSize>("pixelAspectRatio");
- QTest::addColumn<QSizeF>("nativeSize");
-
- QTest::newRow("640x480")
- << QSize(640, 480)
- << QRect(0, 0, 640, 480)
- << QSize(1, 1)
- << QSizeF(640, 480);
-
- QTest::newRow("800x600, (80,60, 640x480) viewport")
- << QSize(800, 600)
- << QRect(80, 60, 640, 480)
- << QSize(1, 1)
- << QSizeF(640, 480);
-
- QTest::newRow("800x600, (80,60, 640x480) viewport, 4:3")
- << QSize(800, 600)
- << QRect(80, 60, 640, 480)
- << QSize(4, 3)
- << QSizeF(853, 480);
-}
-
-void tst_QGraphicsVideoItem::nativeSize()
-{
- QFETCH(QSize, frameSize);
- QFETCH(QRect, viewport);
- QFETCH(QSize, pixelAspectRatio);
- QFETCH(QSizeF, nativeSize);
-
- QtTestVideoObject object(new QtTestRendererControl);
- QGraphicsVideoItem item;
- item.setMediaObject(&object);
-
- QCOMPARE(item.nativeSize(), QSizeF());
-
- QSignalSpy spy(&item, SIGNAL(nativeSizeChanged(QSizeF)));
-
- QVideoSurfaceFormat format(frameSize, QVideoFrame::Format_ARGB32);
- format.setViewport(viewport);
- format.setPixelAspectRatio(pixelAspectRatio);
-
- QVERIFY(object.testService->rendererControl->surface()->start(format));
-
- QCOMPARE(item.nativeSize(), nativeSize);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.last().first().toSizeF(), nativeSize);
-
- object.testService->rendererControl->surface()->stop();
-
- QCOMPARE(item.nativeSize(), QSizeF(0, 0));
- QCOMPARE(spy.count(), 2);
- QCOMPARE(spy.last().first().toSizeF(), QSizeF(0, 0));
-}
-
-void tst_QGraphicsVideoItem::boundingRect_data()
-{
- QTest::addColumn<QSize>("frameSize");
- QTest::addColumn<QPointF>("offset");
- QTest::addColumn<QSizeF>("size");
- QTest::addColumn<Qt::AspectRatioMode>("aspectRatioMode");
- QTest::addColumn<QRectF>("expectedRect");
-
-
- QTest::newRow("640x480: (0,0 640x480), Keep")
- << QSize(640, 480)
- << QPointF(0, 0)
- << QSizeF(640, 480)
- << Qt::KeepAspectRatio
- << QRectF(0, 0, 640, 480);
-
- QTest::newRow("800x600, (0,0, 640x480), Keep")
- << QSize(800, 600)
- << QPointF(0, 0)
- << QSizeF(640, 480)
- << Qt::KeepAspectRatio
- << QRectF(0, 0, 640, 480);
-
- QTest::newRow("800x600, (0,0, 640x480), KeepByExpanding")
- << QSize(800, 600)
- << QPointF(0, 0)
- << QSizeF(640, 480)
- << Qt::KeepAspectRatioByExpanding
- << QRectF(0, 0, 640, 480);
-
- QTest::newRow("800x600, (0,0, 640x480), Ignore")
- << QSize(800, 600)
- << QPointF(0, 0)
- << QSizeF(640, 480)
- << Qt::IgnoreAspectRatio
- << QRectF(0, 0, 640, 480);
-
- QTest::newRow("800x600, (100,100, 640x480), Keep")
- << QSize(800, 600)
- << QPointF(100, 100)
- << QSizeF(640, 480)
- << Qt::KeepAspectRatio
- << QRectF(100, 100, 640, 480);
-
- QTest::newRow("800x600, (100,-100, 640x480), KeepByExpanding")
- << QSize(800, 600)
- << QPointF(100, -100)
- << QSizeF(640, 480)
- << Qt::KeepAspectRatioByExpanding
- << QRectF(100, -100, 640, 480);
-
- QTest::newRow("800x600, (-100,-100, 640x480), Ignore")
- << QSize(800, 600)
- << QPointF(-100, -100)
- << QSizeF(640, 480)
- << Qt::IgnoreAspectRatio
- << QRectF(-100, -100, 640, 480);
-
- QTest::newRow("800x600, (0,0, 1920x1024), Keep")
- << QSize(800, 600)
- << QPointF(0, 0)
- << QSizeF(1920, 1024)
- << Qt::KeepAspectRatio
- << QRectF(832.0 / 3, 0, 4096.0 / 3, 1024);
-
- QTest::newRow("800x600, (0,0, 1920x1024), KeepByExpanding")
- << QSize(800, 600)
- << QPointF(0, 0)
- << QSizeF(1920, 1024)
- << Qt::KeepAspectRatioByExpanding
- << QRectF(0, 0, 1920, 1024);
-
- QTest::newRow("800x600, (0,0, 1920x1024), Ignore")
- << QSize(800, 600)
- << QPointF(0, 0)
- << QSizeF(1920, 1024)
- << Qt::IgnoreAspectRatio
- << QRectF(0, 0, 1920, 1024);
-
- QTest::newRow("800x600, (100,100, 1920x1024), Keep")
- << QSize(800, 600)
- << QPointF(100, 100)
- << QSizeF(1920, 1024)
- << Qt::KeepAspectRatio
- << QRectF(100 + 832.0 / 3, 100, 4096.0 / 3, 1024);
-
- QTest::newRow("800x600, (100,-100, 1920x1024), KeepByExpanding")
- << QSize(800, 600)
- << QPointF(100, -100)
- << QSizeF(1920, 1024)
- << Qt::KeepAspectRatioByExpanding
- << QRectF(100, -100, 1920, 1024);
-
- QTest::newRow("800x600, (-100,-100, 1920x1024), Ignore")
- << QSize(800, 600)
- << QPointF(-100, -100)
- << QSizeF(1920, 1024)
- << Qt::IgnoreAspectRatio
- << QRectF(-100, -100, 1920, 1024);
-}
-
-void tst_QGraphicsVideoItem::boundingRect()
-{
- QFETCH(QSize, frameSize);
- QFETCH(QPointF, offset);
- QFETCH(QSizeF, size);
- QFETCH(Qt::AspectRatioMode, aspectRatioMode);
- QFETCH(QRectF, expectedRect);
-
- QtTestVideoObject object(new QtTestRendererControl);
- QGraphicsVideoItem item;
- item.setMediaObject(&object);
-
- item.setOffset(offset);
- item.setSize(size);
- item.setAspectRatioMode(aspectRatioMode);
-
- QVideoSurfaceFormat format(frameSize, QVideoFrame::Format_ARGB32);
-
- QVERIFY(object.testService->rendererControl->surface()->start(format));
-
- QCOMPARE(item.boundingRect(), expectedRect);
-}
-
-static const uchar rgb32ImageData[] =
-{
- 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00,
- 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00
-};
-
-void tst_QGraphicsVideoItem::paint()
-{
- QtTestVideoObject object(new QtTestRendererControl);
- QtTestGraphicsVideoItem *item = new QtTestGraphicsVideoItem;
- item->setMediaObject(&object);
-
- QGraphicsScene graphicsScene;
- graphicsScene.addItem(item);
- QGraphicsView graphicsView(&graphicsScene);
- graphicsView.show();
-
- QPainterVideoSurface *surface = qobject_cast<QPainterVideoSurface *>(
- object.testService->rendererControl->surface());
-
- QVideoSurfaceFormat format(QSize(2, 2), QVideoFrame::Format_RGB32);
-
- QVERIFY(surface->start(format));
- QCOMPARE(surface->isActive(), true);
- QCOMPARE(surface->isReady(), true);
-
- QVERIFY(item->waitForPaint(1));
-
- QCOMPARE(surface->isActive(), true);
- QCOMPARE(surface->isReady(), true);
-
- QVideoFrame frame(sizeof(rgb32ImageData), QSize(2, 2), 8, QVideoFrame::Format_RGB32);
-
- frame.map(QAbstractVideoBuffer::WriteOnly);
- memcpy(frame.bits(), rgb32ImageData, frame.mappedBytes());
- frame.unmap();
-
- QVERIFY(surface->present(frame));
- QCOMPARE(surface->isActive(), true);
- QCOMPARE(surface->isReady(), false);
-
- QVERIFY(item->waitForPaint(1));
-
- QCOMPARE(surface->isActive(), true);
- QCOMPARE(surface->isReady(), true);
-}
-
-
-QTEST_MAIN(tst_QGraphicsVideoItem)
-
-#include "tst_qgraphicsvideoitem.moc"
diff --git a/tests/auto/qlocale/tst_qlocale.cpp b/tests/auto/qlocale/tst_qlocale.cpp
index 7a5d8a6..7e9b8ec 100644
--- a/tests/auto/qlocale/tst_qlocale.cpp
+++ b/tests/auto/qlocale/tst_qlocale.cpp
@@ -192,6 +192,7 @@ void tst_QLocale::ctor()
TEST_CTOR(French, France, QLocale::French, QLocale::France)
TEST_CTOR(C, France, QLocale::C, QLocale::AnyCountry)
+ TEST_CTOR(Spanish, LatinAmericaAndTheCaribbean, QLocale::Spanish, QLocale::LatinAmericaAndTheCaribbean)
QLocale::setDefault(QLocale(QLocale::English, QLocale::France));
@@ -323,6 +324,12 @@ void tst_QLocale::ctor()
TEST_CTOR("no_NO", Norwegian, Norway)
TEST_CTOR("nb_NO", Norwegian, Norway)
TEST_CTOR("nn_NO", NorwegianNynorsk, Norway)
+ TEST_CTOR("es_ES", Spanish, Spain)
+ TEST_CTOR("es_419", Spanish, LatinAmericaAndTheCaribbean)
+
+ // test default countries for languages
+ TEST_CTOR("mn", Mongolian, Mongolia)
+ TEST_CTOR("ne", Nepali, Nepal)
#undef TEST_CTOR
@@ -1321,10 +1328,12 @@ static const LocaleListItem g_locale_list[] = {
{ 9, 11}, // Armenian/Armenia
{ 10, 100}, // Assamese/India
{ 12, 15}, // Azerbaijani/Azerbaijan
+ { 12, 102}, // Azerbaijani/Iran
{ 14, 197}, // Basque/Spain
{ 15, 18}, // Bengali/Bangladesh
{ 15, 100}, // Bengali/India
{ 16, 25}, // Bhutani/Bhutan
+ { 19, 74}, // Breton/France
{ 20, 33}, // Bulgarian/Bulgaria
{ 21, 147}, // Burmese/Myanmar
{ 22, 20}, // Byelorussian/Belarus
@@ -1354,6 +1363,7 @@ static const LocaleListItem g_locale_list[] = {
{ 31, 107}, // English/Jamaica
{ 31, 133}, // English/Malta
{ 31, 134}, // English/MarshallIslands
+ { 31, 137}, // English/Mauritius
{ 31, 148}, // English/Namibia
{ 31, 154}, // English/NewZealand
{ 31, 160}, // English/NorthernMarianaIslands
@@ -1371,11 +1381,23 @@ static const LocaleListItem g_locale_list[] = {
{ 36, 73}, // Finnish/Finland
{ 37, 74}, // French/France
{ 37, 21}, // French/Belgium
+ { 37, 37}, // French/Cameroon
{ 37, 38}, // French/Canada
+ { 37, 41}, // French/CentralAfricanRepublic
+ { 37, 53}, // French/IvoryCoast
+ { 37, 88}, // French/Guadeloupe
+ { 37, 91}, // French/Guinea
{ 37, 125}, // French/Luxembourg
+ { 37, 128}, // French/Madagascar
+ { 37, 132}, // French/Mali
+ { 37, 135}, // French/Martinique
{ 37, 142}, // French/Monaco
+ { 37, 156}, // French/Niger
+ { 37, 176}, // French/Reunion
{ 37, 187}, // French/Senegal
{ 37, 206}, // French/Switzerland
+ { 37, 244}, // French/Saint Barthelemy
+ { 37, 245}, // French/Saint Martin
{ 40, 197}, // Galician/Spain
{ 41, 81}, // Georgian/Georgia
{ 42, 82}, // German/Germany
@@ -1406,6 +1428,9 @@ static const LocaleListItem g_locale_list[] = {
{ 64, 179}, // Kinyarwanda/Rwanda
{ 65, 116}, // Kirghiz/Kyrgyzstan
{ 66, 114}, // Korean/RepublicOfKorea
+ { 67, 102}, // Kurdish/Iran
+ { 67, 103}, // Kurdish/Iraq
+ { 67, 207}, // Kurdish/SyrianArabRepublic
{ 67, 217}, // Kurdish/Turkey
{ 69, 117}, // Laothian/Lao
{ 71, 118}, // Latvian/Latvia
@@ -1413,16 +1438,19 @@ static const LocaleListItem g_locale_list[] = {
{ 72, 50}, // Lingala/PeoplesRepublicOfCongo
{ 73, 124}, // Lithuanian/Lithuania
{ 74, 127}, // Macedonian/Macedonia
+ { 75, 128}, // Malagasy/Madagascar
{ 76, 130}, // Malay/Malaysia
{ 76, 32}, // Malay/BruneiDarussalam
{ 77, 100}, // Malayalam/India
{ 78, 133}, // Maltese/Malta
+ { 79, 154}, // Maori/NewZealand
{ 80, 100}, // Marathi/India
{ 82, 44}, // Mongolian/China
{ 82, 143}, // Mongolian/Mongolia
{ 84, 100}, // Nepali/India
{ 84, 150}, // Nepali/Nepal
{ 85, 161}, // Norwegian/Norway
+ { 86, 74}, // Occitan/France
{ 87, 100}, // Oriya/India
{ 88, 1}, // Pashto/Afghanistan
{ 89, 102}, // Persian/Iran
@@ -1430,22 +1458,30 @@ static const LocaleListItem g_locale_list[] = {
{ 90, 172}, // Polish/Poland
{ 91, 173}, // Portuguese/Portugal
{ 91, 30}, // Portuguese/Brazil
+ { 91, 92}, // Portuguese/GuineaBissau
+ { 91, 146}, // Portuguese/Mozambique
{ 92, 100}, // Punjabi/India
{ 92, 163}, // Punjabi/Pakistan
+ { 94, 206}, // RhaetoRomance/Switzerland
{ 95, 141}, // Romanian/Moldova
{ 95, 177}, // Romanian/Romania
{ 96, 178}, // Russian/RussianFederation
+ { 96, 141}, // Russian/Moldova
{ 96, 222}, // Russian/Ukraine
+ { 98, 41}, // Sangho/CentralAfricanRepublic
{ 99, 100}, // Sanskrit/India
{ 100, 241}, // Serbian/SerbiaAndMontenegro
{ 100, 27}, // Serbian/BosniaAndHerzegowina
{ 100, 238}, // Serbian/Yugoslavia
+ { 100, 242}, // Serbian/Montenegro
+ { 100, 243}, // Serbian/Serbia
{ 101, 241}, // SerboCroatian/SerbiaAndMontenegro
{ 101, 27}, // SerboCroatian/BosniaAndHerzegowina
{ 101, 238}, // SerboCroatian/Yugoslavia
{ 102, 120}, // Sesotho/Lesotho
{ 102, 195}, // Sesotho/SouthAfrica
{ 103, 195}, // Setswana/SouthAfrica
+ { 104, 240}, // Shona/Zimbabwe
{ 106, 198}, // Singhalese/SriLanka
{ 107, 195}, // Siswati/SouthAfrica
{ 107, 204}, // Siswati/Swaziland
@@ -1464,6 +1500,7 @@ static const LocaleListItem g_locale_list[] = {
{ 111, 61}, // Spanish/DominicanRepublic
{ 111, 63}, // Spanish/Ecuador
{ 111, 65}, // Spanish/ElSalvador
+ { 111, 66}, // Spanish/EquatorialGuinea
{ 111, 90}, // Spanish/Guatemala
{ 111, 96}, // Spanish/Honduras
{ 111, 139}, // Spanish/Mexico
@@ -1481,9 +1518,12 @@ static const LocaleListItem g_locale_list[] = {
{ 114, 73}, // Swedish/Finland
{ 116, 209}, // Tajik/Tajikistan
{ 117, 100}, // Tamil/India
+ { 117, 198}, // Tamil/SriLanka
{ 118, 178}, // Tatar/RussianFederation
{ 119, 100}, // Telugu/India
{ 120, 211}, // Thai/Thailand
+ { 121, 44}, // Tibetan/China
+ { 121, 100}, // Tibetan/India
{ 122, 67}, // Tigrinya/Eritrea
{ 122, 69}, // Tigrinya/Ethiopia
{ 123, 214}, // Tonga/Tonga
@@ -1524,9 +1564,63 @@ static const LocaleListItem g_locale_list[] = {
{ 160, 195}, // Venda/SouthAfrica
{ 161, 83}, // Ewe/Ghana
{ 161, 212}, // Ewe/Togo
+ { 162, 69}, // Walamo/Ethiopia
{ 163, 225}, // Hawaiian/UnitedStates
{ 164, 157}, // Tyap/Nigeria
- { 165, 129} // Chewa/Malawi
+ { 165, 129}, // Chewa/Malawi
+ { 166, 170}, // Filipino/Philippines
+ { 167, 206}, // Swiss German/Switzerland
+ { 168, 44}, // Sichuan Yi/China
+ { 169, 91}, // Kpelle/Guinea
+ { 169, 121}, // Kpelle/Liberia
+ { 170, 82}, // Low German/Germany
+ { 171, 195}, // South Ndebele/SouthAfrica
+ { 172, 195}, // Northern Sotho/SouthAfrica
+ { 173, 73}, // Northern Sami/Finland
+ { 173, 161}, // Northern Sami/Norway
+ { 174, 208}, // Taroko/Taiwan
+ { 175, 111}, // Gusii/Kenya
+ { 176, 111}, // Taita/Kenya
+ { 177, 187}, // Fulah/Senegal
+ { 178, 111}, // Kikuyu/Kenya
+ { 179, 111}, // Samburu/Kenya
+ { 180, 146}, // Sena/Mozambique
+ { 181, 240}, // North Ndebele/Zimbabwe
+ { 182, 210}, // Rombo/Tanzania
+ { 183, 145}, // Tachelhit/Morocco
+ { 184, 3}, // Kabyle/Algeria
+ { 185, 221}, // Nyankole/Uganda
+ { 186, 210}, // Bena/Tanzania
+ { 187, 210}, // Vunjo/Tanzania
+ { 188, 132}, // Bambara/Mali
+ { 189, 111}, // Embu/Kenya
+ { 190, 225}, // Cherokee/UnitedStates
+ { 191, 137}, // Morisyen/Mauritius
+ { 192, 210}, // Makonde/Tanzania
+ { 193, 210}, // Langi/Tanzania
+ { 194, 221}, // Ganda/Uganda
+ { 195, 239}, // Bemba/Zambia
+ { 196, 39}, // Kabuverdianu/CapeVerde
+ { 197, 111}, // Meru/Kenya
+ { 198, 111}, // Kalenjin/Kenya
+ { 199, 148}, // Nama/Namibia
+ { 200, 210}, // Machame/Tanzania
+ { 201, 82}, // Colognian/Germany
+ { 202, 111}, // Masai/Kenya
+ { 202, 210}, // Masai/Tanzania
+ { 203, 221}, // Soga/Uganda
+ { 204, 111}, // Luyia/Kenya
+ { 205, 210}, // Asu/Tanzania
+ { 206, 111}, // Teso/Kenya
+ { 206, 221}, // Teso/Uganda
+ { 207, 67}, // Saho/Eritrea
+ { 208, 132}, // Koyra Chiini/Mali
+ { 209, 210}, // Rwa/Tanzania
+ { 210, 111}, // Luo/Kenya
+ { 211, 221}, // Chiga/Uganda
+ { 212, 145}, // Central Morocco Tamazight/Morocco
+ { 213, 132}, // Koyraboro Senni/Mali
+ { 214, 210} // Shambala/Tanzania
};
static const int g_locale_list_count = sizeof(g_locale_list)/sizeof(g_locale_list[0]);
@@ -1896,8 +1990,8 @@ void tst_QLocale::ampm()
QCOMPARE(c.pmText(), QLatin1String("PM"));
QLocale de("de_DE");
- QCOMPARE(de.amText(), QLatin1String("AM"));
- QCOMPARE(de.pmText(), QLatin1String("PM"));
+ QCOMPARE(de.amText(), QLatin1String("vorm."));
+ QCOMPARE(de.pmText(), QLatin1String("nachm."));
QLocale sv("sv_SE");
QCOMPARE(sv.amText(), QLatin1String("fm"));
diff --git a/tests/auto/qmediacontent/qmediacontent.pro b/tests/auto/qmediacontent/qmediacontent.pro
deleted file mode 100644
index e20b4db..0000000
--- a/tests/auto/qmediacontent/qmediacontent.pro
+++ /dev/null
@@ -1,6 +0,0 @@
-load(qttest_p4)
-
-SOURCES += tst_qmediacontent.cpp
-
-QT = core network mediaservices
-
diff --git a/tests/auto/qmediacontent/tst_qmediacontent.cpp b/tests/auto/qmediacontent/tst_qmediacontent.cpp
deleted file mode 100644
index e33149a..0000000
--- a/tests/auto/qmediacontent/tst_qmediacontent.cpp
+++ /dev/null
@@ -1,174 +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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, 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.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QtTest>
-
-#include <QtMediaServices/qmediacontent.h>
-
-
-class tst_QMediaContent : public QObject
-{
- Q_OBJECT
-
-private slots:
- void testNull();
- void testUrlCtor();
- void testRequestCtor();
- void testResourceCtor();
- void testResourceListCtor();
- void testCopy();
- void testAssignment();
- void testEquality();
- void testResources();
-};
-
-void tst_QMediaContent::testNull()
-{
- QMediaContent media;
-
- QCOMPARE(media.isNull(), true);
- QCOMPARE(media.canonicalUrl(), QUrl());
- QCOMPARE(media.canonicalResource(), QMediaResource());
- QCOMPARE(media.resources(), QMediaResourceList());
-}
-
-void tst_QMediaContent::testUrlCtor()
-{
- QMediaContent media(QUrl("http://example.com/movie.mov"));
-
- QCOMPARE(media.canonicalUrl(), QUrl("http://example.com/movie.mov"));
- QCOMPARE(media.canonicalResource().url(), QUrl("http://example.com/movie.mov"));
-}
-
-void tst_QMediaContent::testRequestCtor()
-{
- QNetworkRequest request(QUrl("http://example.com/movie.mov"));
- request.setAttribute(QNetworkRequest::User, QVariant(1234));
-
- QMediaContent media(request);
-
- QCOMPARE(media.canonicalRequest(), request);
- QCOMPARE(media.canonicalUrl(), QUrl("http://example.com/movie.mov"));
- QCOMPARE(media.canonicalResource().request(), request);
- QCOMPARE(media.canonicalResource().url(), QUrl("http://example.com/movie.mov"));
-}
-
-void tst_QMediaContent::testResourceCtor()
-{
- QMediaContent media(QMediaResource(QUrl("http://example.com/movie.mov")));
-
- QCOMPARE(media.canonicalResource(), QMediaResource(QUrl("http://example.com/movie.mov")));
-}
-
-void tst_QMediaContent::testResourceListCtor()
-{
- QMediaResourceList resourceList;
- resourceList << QMediaResource(QUrl("http://example.com/movie.mov"));
-
- QMediaContent media(resourceList);
-
- QCOMPARE(media.canonicalUrl(), QUrl("http://example.com/movie.mov"));
- QCOMPARE(media.canonicalResource().url(), QUrl("http://example.com/movie.mov"));
-}
-
-void tst_QMediaContent::testCopy()
-{
- QMediaContent media1(QMediaResource(QUrl("http://example.com/movie.mov")));
- QMediaContent media2(media1);
-
- QVERIFY(media1 == media2);
-}
-
-void tst_QMediaContent::testAssignment()
-{
- QMediaContent media1(QMediaResource(QUrl("http://example.com/movie.mov")));
- QMediaContent media2;
- QMediaContent media3;
-
- media2 = media1;
- QVERIFY(media2 == media1);
-
- media2 = media3;
- QVERIFY(media2 == media3);
-}
-
-void tst_QMediaContent::testEquality()
-{
- QMediaContent media1;
- QMediaContent media2;
- QMediaContent media3(QMediaResource(QUrl("http://example.com/movie.mov")));
- QMediaContent media4(QMediaResource(QUrl("http://example.com/movie.mov")));
- QMediaContent media5(QMediaResource(QUrl("file:///some/where/over/the/rainbow.mp3")));
-
- // null == null
- QCOMPARE(media1 == media2, true);
- QCOMPARE(media1 != media2, false);
-
- // null != something
- QCOMPARE(media1 == media3, false);
- QCOMPARE(media1 != media3, true);
-
- // equiv
- QCOMPARE(media3 == media4, true);
- QCOMPARE(media3 != media4, false);
-
- // not equiv
- QCOMPARE(media4 == media5, false);
- QCOMPARE(media4 != media5, true);
-}
-
-void tst_QMediaContent::testResources()
-{
- QMediaResourceList resourceList;
-
- resourceList << QMediaResource(QUrl("http://example.com/movie-main.mov"));
- resourceList << QMediaResource(QUrl("http://example.com/movie-big.mov"));
- QMediaContent media(resourceList);
-
- QMediaResourceList res = media.resources();
- QCOMPARE(res.size(), 2);
- QCOMPARE(res[0], QMediaResource(QUrl("http://example.com/movie-main.mov")));
- QCOMPARE(res[1], QMediaResource(QUrl("http://example.com/movie-big.mov")));
-}
-
-QTEST_MAIN(tst_QMediaContent)
-
-#include "tst_qmediacontent.moc"
diff --git a/tests/auto/qmediaobject/qmediaobject.pro b/tests/auto/qmediaobject/qmediaobject.pro
deleted file mode 100644
index d6a0f7b..0000000
--- a/tests/auto/qmediaobject/qmediaobject.pro
+++ /dev/null
@@ -1,4 +0,0 @@
-load(qttest_p4)
-
-SOURCES += tst_qmediaobject.cpp
-QT = core mediaservices
diff --git a/tests/auto/qmediaobject/tst_qmediaobject.cpp b/tests/auto/qmediaobject/tst_qmediaobject.cpp
deleted file mode 100644
index 5a2fdeb..0000000
--- a/tests/auto/qmediaobject/tst_qmediaobject.cpp
+++ /dev/null
@@ -1,549 +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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, 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.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QtTest>
-
-#include <QtCore/qtimer.h>
-
-#include <QtMediaServices/qmediaobject.h>
-#include <QtMediaServices/qmediaservice.h>
-#include <QtMediaServices/qmetadatacontrol.h>
-
-
-class tst_QMediaObject : public QObject
-{
- Q_OBJECT
-
-private slots:
- void propertyWatch();
- void notifySignals_data();
- void notifySignals();
- void notifyInterval_data();
- void notifyInterval();
-
- void nullMetaDataControl();
- void isMetaDataAvailable();
- void isWritable();
- void metaDataChanged();
- void metaData_data();
- void metaData();
- void setMetaData_data();
- void setMetaData();
- void extendedMetaData_data() { metaData_data(); }
- void extendedMetaData();
- void setExtendedMetaData_data() { extendedMetaData_data(); }
- void setExtendedMetaData();
-
-
-private:
- void setupNotifyTests();
-};
-
-class QtTestMetaDataProvider : public QMetaDataControl
-{
- Q_OBJECT
-public:
- QtTestMetaDataProvider(QObject *parent = 0)
- : QMetaDataControl(parent)
- , m_available(false)
- , m_writable(false)
- {
- }
-
- bool isMetaDataAvailable() const { return m_available; }
- void setMetaDataAvailable(bool available) {
- if (m_available != available)
- emit metaDataAvailableChanged(m_available = available);
- }
- QList<QtMediaServices::MetaData> availableMetaData() const { return m_data.keys(); }
-
- bool isWritable() const { return m_writable; }
- void setWritable(bool writable) { emit writableChanged(m_writable = writable); }
-
- QVariant metaData(QtMediaServices::MetaData key) const { return m_data.value(key); }
- void setMetaData(QtMediaServices::MetaData key, const QVariant &value) {
- m_data.insert(key, value); }
-
- QVariant extendedMetaData(const QString &key) const { return m_extendedData.value(key); }
- void setExtendedMetaData(const QString &key, const QVariant &value) {
- m_extendedData.insert(key, value); }
-
- QStringList availableExtendedMetaData() const { return m_extendedData.keys(); }
-
- using QMetaDataControl::metaDataChanged;
-
- void populateMetaData()
- {
- m_available = true;
- }
-
- bool m_available;
- bool m_writable;
- QMap<QtMediaServices::MetaData, QVariant> m_data;
- QMap<QString, QVariant> m_extendedData;
-};
-
-class QtTestMetaDataService : public QMediaService
-{
- Q_OBJECT
-public:
- QtTestMetaDataService(QObject *parent = 0):QMediaService(parent), hasMetaData(true)
- {
- }
-
- QMediaControl *control(const char *iid) const
- {
- if (hasMetaData && qstrcmp(iid, QMetaDataControl_iid) == 0)
- return const_cast<QtTestMetaDataProvider *>(&metaData);
- else
- return 0;
- }
-
- QtTestMetaDataProvider metaData;
- bool hasMetaData;
-};
-
-
-class QtTestMediaObject : public QMediaObject
-{
- Q_OBJECT
- Q_PROPERTY(int a READ a WRITE setA NOTIFY aChanged)
- Q_PROPERTY(int b READ b WRITE setB NOTIFY bChanged)
- Q_PROPERTY(int c READ c WRITE setC NOTIFY cChanged)
- Q_PROPERTY(int d READ d WRITE setD)
-public:
- QtTestMediaObject(QMediaService *service = 0): QMediaObject(0, service), m_a(0), m_b(0), m_c(0), m_d(0) {}
-
- using QMediaObject::addPropertyWatch;
- using QMediaObject::removePropertyWatch;
-
- int a() const { return m_a; }
- void setA(int a) { m_a = a; }
-
- int b() const { return m_b; }
- void setB(int b) { m_b = b; }
-
- int c() const { return m_c; }
- void setC(int c) { m_c = c; }
-
- int d() const { return m_d; }
- void setD(int d) { m_d = d; }
-
-Q_SIGNALS:
- void aChanged(int a);
- void bChanged(int b);
- void cChanged(int c);
-
-private:
- int m_a;
- int m_b;
- int m_c;
- int m_d;
-};
-
-void tst_QMediaObject::propertyWatch()
-{
- QtTestMediaObject object;
- object.setNotifyInterval(0);
-
- QEventLoop loop;
- connect(&object, SIGNAL(aChanged(int)), &QTestEventLoop::instance(), SLOT(exitLoop()));
- connect(&object, SIGNAL(bChanged(int)), &QTestEventLoop::instance(), SLOT(exitLoop()));
- connect(&object, SIGNAL(cChanged(int)), &QTestEventLoop::instance(), SLOT(exitLoop()));
-
- QSignalSpy aSpy(&object, SIGNAL(aChanged(int)));
- QSignalSpy bSpy(&object, SIGNAL(bChanged(int)));
- QSignalSpy cSpy(&object, SIGNAL(cChanged(int)));
-
- QTestEventLoop::instance().enterLoop(1);
-
- QCOMPARE(aSpy.count(), 0);
- QCOMPARE(bSpy.count(), 0);
- QCOMPARE(cSpy.count(), 0);
-
- int aCount = 0;
- int bCount = 0;
- int cCount = 0;
-
- object.addPropertyWatch("a");
-
- QTestEventLoop::instance().enterLoop(1);
-
- QVERIFY(aSpy.count() > aCount);
- QCOMPARE(bSpy.count(), 0);
- QCOMPARE(cSpy.count(), 0);
- QCOMPARE(aSpy.last().value(0).toInt(), 0);
-
- aCount = aSpy.count();
-
- object.setA(54);
- object.setB(342);
- object.setC(233);
-
- QTestEventLoop::instance().enterLoop(1);
-
- QVERIFY(aSpy.count() > aCount);
- QCOMPARE(bSpy.count(), 0);
- QCOMPARE(cSpy.count(), 0);
- QCOMPARE(aSpy.last().value(0).toInt(), 54);
-
- aCount = aSpy.count();
-
- object.addPropertyWatch("b");
- object.addPropertyWatch("d");
- object.removePropertyWatch("e");
- object.setA(43);
- object.setB(235);
- object.setC(90);
-
- QTestEventLoop::instance().enterLoop(1);
-
- QVERIFY(aSpy.count() > aCount);
- QVERIFY(bSpy.count() > bCount);
- QCOMPARE(cSpy.count(), 0);
- QCOMPARE(aSpy.last().value(0).toInt(), 43);
- QCOMPARE(bSpy.last().value(0).toInt(), 235);
-
- aCount = aSpy.count();
- bCount = bSpy.count();
-
- object.removePropertyWatch("a");
- object.addPropertyWatch("c");
- object.addPropertyWatch("e");
-
- QTestEventLoop::instance().enterLoop(1);
-
- QCOMPARE(aSpy.count(), aCount);
- QVERIFY(bSpy.count() > bCount);
- QVERIFY(cSpy.count() > cCount);
- QCOMPARE(bSpy.last().value(0).toInt(), 235);
- QCOMPARE(cSpy.last().value(0).toInt(), 90);
-
- bCount = bSpy.count();
- cCount = cSpy.count();
-
- object.setA(435);
- object.setC(9845);
-
- QTestEventLoop::instance().enterLoop(1);
-
- QCOMPARE(aSpy.count(), aCount);
- QVERIFY(bSpy.count() > bCount);
- QVERIFY(cSpy.count() > cCount);
- QCOMPARE(bSpy.last().value(0).toInt(), 235);
- QCOMPARE(cSpy.last().value(0).toInt(), 9845);
-
- bCount = bSpy.count();
- cCount = cSpy.count();
-
- object.setA(8432);
- object.setB(324);
- object.setC(443);
- object.removePropertyWatch("c");
- object.removePropertyWatch("d");
-
- QTestEventLoop::instance().enterLoop(1);
-
- QCOMPARE(aSpy.count(), aCount);
- QVERIFY(bSpy.count() > bCount);
- QCOMPARE(cSpy.count(), cCount);
- QCOMPARE(bSpy.last().value(0).toInt(), 324);
- QCOMPARE(cSpy.last().value(0).toInt(), 9845);
-
- bCount = bSpy.count();
-
- object.removePropertyWatch("b");
-
- QTestEventLoop::instance().enterLoop(1);
-
- QCOMPARE(aSpy.count(), aCount);
- QCOMPARE(bSpy.count(), bCount);
- QCOMPARE(cSpy.count(), cCount);
-}
-
-void tst_QMediaObject::setupNotifyTests()
-{
- QTest::addColumn<int>("interval");
- QTest::addColumn<int>("count");
-
- QTest::newRow("single 750ms")
- << 750
- << 1;
- QTest::newRow("single 600ms")
- << 600
- << 1;
- QTest::newRow("x3 300ms")
- << 300
- << 3;
- QTest::newRow("x5 180ms")
- << 180
- << 5;
-}
-
-void tst_QMediaObject::notifySignals_data()
-{
- setupNotifyTests();
-}
-
-void tst_QMediaObject::notifySignals()
-{
- QFETCH(int, interval);
- QFETCH(int, count);
-
- QtTestMediaObject object;
- object.setNotifyInterval(interval);
- object.addPropertyWatch("a");
-
- QSignalSpy spy(&object, SIGNAL(aChanged(int)));
-
- QTestEventLoop::instance().enterLoop(1);
-
- QCOMPARE(spy.count(), count);
-}
-
-void tst_QMediaObject::notifyInterval_data()
-{
- setupNotifyTests();
-}
-
-void tst_QMediaObject::notifyInterval()
-{
- QFETCH(int, interval);
-
- QtTestMediaObject object;
- QSignalSpy spy(&object, SIGNAL(notifyIntervalChanged(int)));
-
- object.setNotifyInterval(interval);
- QCOMPARE(object.notifyInterval(), interval);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.last().value(0).toInt(), interval);
-
- object.setNotifyInterval(interval);
- QCOMPARE(object.notifyInterval(), interval);
- QCOMPARE(spy.count(), 1);
-}
-
-void tst_QMediaObject::nullMetaDataControl()
-{
- const QString titleKey(QLatin1String("Title"));
- const QString title(QLatin1String("Host of Seraphim"));
-
- QtTestMetaDataService service;
- service.hasMetaData = false;
-
- QtTestMediaObject object(&service);
-
- QSignalSpy spy(&object, SIGNAL(metaDataChanged()));
-
- QCOMPARE(object.isMetaDataAvailable(), false);
- QCOMPARE(object.isMetaDataWritable(), false);
-
- object.setMetaData(QtMediaServices::Title, title);
- object.setExtendedMetaData(titleKey, title);
-
- QCOMPARE(object.metaData(QtMediaServices::Title).toString(), QString());
- QCOMPARE(object.extendedMetaData(titleKey).toString(), QString());
- QCOMPARE(object.availableMetaData(), QList<QtMediaServices::MetaData>());
- QCOMPARE(object.availableExtendedMetaData(), QStringList());
- QCOMPARE(spy.count(), 0);
-}
-
-void tst_QMediaObject::isMetaDataAvailable()
-{
- QtTestMetaDataService service;
- service.metaData.setMetaDataAvailable(false);
-
- QtTestMediaObject object(&service);
- QCOMPARE(object.isMetaDataAvailable(), false);
-
- QSignalSpy spy(&object, SIGNAL(metaDataAvailableChanged(bool)));
- service.metaData.setMetaDataAvailable(true);
-
- QCOMPARE(object.isMetaDataAvailable(), true);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.at(0).at(0).toBool(), true);
-
- service.metaData.setMetaDataAvailable(false);
-
- QCOMPARE(object.isMetaDataAvailable(), false);
- QCOMPARE(spy.count(), 2);
- QCOMPARE(spy.at(1).at(0).toBool(), false);
-}
-
-void tst_QMediaObject::isWritable()
-{
- QtTestMetaDataService service;
- service.metaData.setWritable(false);
-
- QtTestMediaObject object(&service);
-
- QSignalSpy spy(&object, SIGNAL(metaDataWritableChanged(bool)));
-
- QCOMPARE(object.isMetaDataWritable(), false);
-
- service.metaData.setWritable(true);
-
- QCOMPARE(object.isMetaDataWritable(), true);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.at(0).at(0).toBool(), true);
-
- service.metaData.setWritable(false);
-
- QCOMPARE(object.isMetaDataWritable(), false);
- QCOMPARE(spy.count(), 2);
- QCOMPARE(spy.at(1).at(0).toBool(), false);
-}
-
-void tst_QMediaObject::metaDataChanged()
-{
- QtTestMetaDataService service;
- QtTestMediaObject object(&service);
-
- QSignalSpy spy(&object, SIGNAL(metaDataChanged()));
-
- service.metaData.metaDataChanged();
- QCOMPARE(spy.count(), 1);
-
- service.metaData.metaDataChanged();
- QCOMPARE(spy.count(), 2);
-}
-
-void tst_QMediaObject::metaData_data()
-{
- QTest::addColumn<QString>("artist");
- QTest::addColumn<QString>("title");
- QTest::addColumn<QString>("genre");
-
- QTest::newRow("")
- << QString::fromLatin1("Dead Can Dance")
- << QString::fromLatin1("Host of Seraphim")
- << QString::fromLatin1("Awesome");
-}
-
-void tst_QMediaObject::metaData()
-{
- QFETCH(QString, artist);
- QFETCH(QString, title);
- QFETCH(QString, genre);
-
- QtTestMetaDataService service;
- service.metaData.populateMetaData();
-
- QtTestMediaObject object(&service);
- QVERIFY(object.availableMetaData().isEmpty());
-
- service.metaData.m_data.insert(QtMediaServices::AlbumArtist, artist);
- service.metaData.m_data.insert(QtMediaServices::Title, title);
- service.metaData.m_data.insert(QtMediaServices::Genre, genre);
-
- QCOMPARE(object.metaData(QtMediaServices::AlbumArtist).toString(), artist);
- QCOMPARE(object.metaData(QtMediaServices::Title).toString(), title);
-
- QList<QtMediaServices::MetaData> metaDataKeys = object.availableMetaData();
- QCOMPARE(metaDataKeys.size(), 3);
- QVERIFY(metaDataKeys.contains(QtMediaServices::AlbumArtist));
- QVERIFY(metaDataKeys.contains(QtMediaServices::Title));
- QVERIFY(metaDataKeys.contains(QtMediaServices::Genre));
-}
-
-void tst_QMediaObject::setMetaData_data()
-{
- QTest::addColumn<QString>("title");
-
- QTest::newRow("")
- << QString::fromLatin1("In the Kingdom of the Blind the One eyed are Kings");
-}
-
-void tst_QMediaObject::setMetaData()
-{
- QFETCH(QString, title);
-
- QtTestMetaDataService service;
- service.metaData.populateMetaData();
-
- QtTestMediaObject object(&service);
-
- object.setMetaData(QtMediaServices::Title, title);
- QCOMPARE(object.metaData(QtMediaServices::Title).toString(), title);
- QCOMPARE(service.metaData.m_data.value(QtMediaServices::Title).toString(), title);
-}
-
-void tst_QMediaObject::extendedMetaData()
-{
- QFETCH(QString, artist);
- QFETCH(QString, title);
- QFETCH(QString, genre);
-
- QtTestMetaDataService service;
- QtTestMediaObject object(&service);
- QVERIFY(object.availableExtendedMetaData().isEmpty());
-
- service.metaData.m_extendedData.insert(QLatin1String("Artist"), artist);
- service.metaData.m_extendedData.insert(QLatin1String("Title"), title);
- service.metaData.m_extendedData.insert(QLatin1String("Genre"), genre);
-
- QCOMPARE(object.extendedMetaData(QLatin1String("Artist")).toString(), artist);
- QCOMPARE(object.extendedMetaData(QLatin1String("Title")).toString(), title);
-
- QStringList extendedKeys = object.availableExtendedMetaData();
- QCOMPARE(extendedKeys.size(), 3);
- QVERIFY(extendedKeys.contains(QLatin1String("Artist")));
- QVERIFY(extendedKeys.contains(QLatin1String("Title")));
- QVERIFY(extendedKeys.contains(QLatin1String("Genre")));
-}
-
-void tst_QMediaObject::setExtendedMetaData()
-{
- QtTestMetaDataService service;
- service.metaData.populateMetaData();
-
- QtTestMediaObject object(&service);
-
- QString title(QLatin1String("In the Kingdom of the Blind the One eyed are Kings"));
-
- object.setExtendedMetaData(QLatin1String("Title"), title);
- QCOMPARE(object.extendedMetaData(QLatin1String("Title")).toString(), title);
- QCOMPARE(service.metaData.m_extendedData.value(QLatin1String("Title")).toString(), title);
-}
-
-QTEST_MAIN(tst_QMediaObject)
-
-#include "tst_qmediaobject.moc"
diff --git a/tests/auto/qmediaplayer/qmediaplayer.pro b/tests/auto/qmediaplayer/qmediaplayer.pro
deleted file mode 100644
index f355078..0000000
--- a/tests/auto/qmediaplayer/qmediaplayer.pro
+++ /dev/null
@@ -1,6 +0,0 @@
-load(qttest_p4)
-
-SOURCES += tst_qmediaplayer.cpp
-
-QT = core mediaservices
-
diff --git a/tests/auto/qmediaplayer/tst_qmediaplayer.cpp b/tests/auto/qmediaplayer/tst_qmediaplayer.cpp
deleted file mode 100644
index 9a597e2..0000000
--- a/tests/auto/qmediaplayer/tst_qmediaplayer.cpp
+++ /dev/null
@@ -1,986 +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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, 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.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QtTest>
-#include <QtCore/qdebug.h>
-#include <QtCore/qbuffer.h>
-
-#include <QtMediaServices/qmediaplayer.h>
-#include <QtMediaServices/qmediaplayercontrol.h>
-#include <QtMediaServices/qmediaplaylist.h>
-#include <QtMediaServices/qmediaservice.h>
-
-
-
-class AutoConnection
-{
-public:
- AutoConnection(QObject *sender, const char *signal, QObject *receiver, const char *method)
- : sender(sender), signal(signal), receiver(receiver), method(method)
- {
- QObject::connect(sender, signal, receiver, method);
- }
-
- ~AutoConnection()
- {
- QObject::disconnect(sender, signal, receiver, method);
- }
-
-private:
- QObject *sender;
- const char *signal;
- QObject *receiver;
- const char *method;
-};
-
-
-class MockPlayerControl : public QMediaPlayerControl
-{
- friend class MockPlayerService;
-
-public:
- MockPlayerControl():QMediaPlayerControl(0) {}
-
- QMediaPlayer::State state() const { return _state; }
- QMediaPlayer::MediaStatus mediaStatus() const { return _mediaStatus; }
-
- qint64 duration() const { return _duration; }
-
- qint64 position() const { return _position; }
-
- void setPosition(qint64 position) { if (position != _position) emit positionChanged(_position = position); }
-
- int volume() const { return _volume; }
- void setVolume(int volume) { emit volumeChanged(_volume = volume); }
-
- bool isMuted() const { return _muted; }
- void setMuted(bool muted) { if (muted != _muted) emit mutedChanged(_muted = muted); }
-
- int bufferStatus() const { return _bufferStatus; }
-
- bool isAudioAvailable() const { return _audioAvailable; }
- bool isVideoAvailable() const { return _videoAvailable; }
-
- bool isSeekable() const { return _isSeekable; }
- QMediaTimeRange availablePlaybackRanges() const { return QMediaTimeRange(_seekRange.first, _seekRange.second); }
- void setSeekRange(qint64 minimum, qint64 maximum) { _seekRange = qMakePair(minimum, maximum); }
-
- qreal playbackRate() const { return _playbackRate; }
- void setPlaybackRate(qreal rate) { if (rate != _playbackRate) emit playbackRateChanged(_playbackRate = rate); }
-
- QMediaContent media() const { return _media; }
- void setMedia(const QMediaContent &content, QIODevice *stream)
- {
- _stream = stream;
- _media = content;
- if (_state != QMediaPlayer::StoppedState) {
- _mediaStatus = _media.isNull() ? QMediaPlayer::NoMedia : QMediaPlayer::LoadingMedia;
- emit stateChanged(_state = QMediaPlayer::StoppedState);
- emit mediaStatusChanged(_mediaStatus);
- }
- emit mediaChanged(_media = content);
- }
- QIODevice *mediaStream() const { return _stream; }
-
- void play() { if (_isValid && !_media.isNull() && _state != QMediaPlayer::PlayingState) emit stateChanged(_state = QMediaPlayer::PlayingState); }
- void pause() { if (_isValid && !_media.isNull() && _state != QMediaPlayer::PausedState) emit stateChanged(_state = QMediaPlayer::PausedState); }
- void stop() { if (_state != QMediaPlayer::StoppedState) emit stateChanged(_state = QMediaPlayer::StoppedState); }
-
- QMediaPlayer::State _state;
- QMediaPlayer::MediaStatus _mediaStatus;
- QMediaPlayer::Error _error;
- qint64 _duration;
- qint64 _position;
- int _volume;
- bool _muted;
- int _bufferStatus;
- bool _audioAvailable;
- bool _videoAvailable;
- bool _isSeekable;
- QPair<qint64, qint64> _seekRange;
- qreal _playbackRate;
- QMediaContent _media;
- QIODevice *_stream;
- bool _isValid;
- QString _errorString;
-};
-
-
-class MockPlayerService : public QMediaService
-{
- Q_OBJECT
-
-public:
- MockPlayerService():QMediaService(0)
- {
- mockControl = new MockPlayerControl;
- }
-
- ~MockPlayerService()
- {
- delete mockControl;
- }
-
- QMediaControl* control(const char *iid) const
- {
- if (qstrcmp(iid, QMediaPlayerControl_iid) == 0)
- return mockControl;
-
- return 0;
- }
-
- void setState(QMediaPlayer::State state) { emit mockControl->stateChanged(mockControl->_state = state); }
- void setState(QMediaPlayer::State state, QMediaPlayer::MediaStatus status) {
- mockControl->_state = state;
- mockControl->_mediaStatus = status;
- emit mockControl->mediaStatusChanged(status);
- emit mockControl->stateChanged(state);
- }
- void setMediaStatus(QMediaPlayer::MediaStatus status) { emit mockControl->mediaStatusChanged(mockControl->_mediaStatus = status); }
- void setIsValid(bool isValid) { mockControl->_isValid = isValid; }
- void setMedia(QMediaContent media) { mockControl->_media = media; }
- void setDuration(qint64 duration) { mockControl->_duration = duration; }
- void setPosition(qint64 position) { mockControl->_position = position; }
- void setSeekable(bool seekable) { mockControl->_isSeekable = seekable; }
- void setVolume(int volume) { mockControl->_volume = volume; }
- void setMuted(bool muted) { mockControl->_muted = muted; }
- void setVideoAvailable(bool videoAvailable) { mockControl->_videoAvailable = videoAvailable; }
- void setBufferStatus(int bufferStatus) { mockControl->_bufferStatus = bufferStatus; }
- void setPlaybackRate(qreal playbackRate) { mockControl->_playbackRate = playbackRate; }
- void setError(QMediaPlayer::Error error) { mockControl->_error = error; emit mockControl->error(mockControl->_error, mockControl->_errorString); }
- void setErrorString(QString errorString) { mockControl->_errorString = errorString; emit mockControl->error(mockControl->_error, mockControl->_errorString); }
-
- void reset()
- {
- mockControl->_state = QMediaPlayer::StoppedState;
- mockControl->_mediaStatus = QMediaPlayer::UnknownMediaStatus;
- mockControl->_error = QMediaPlayer::NoError;
- mockControl->_duration = 0;
- mockControl->_position = 0;
- mockControl->_volume = 0;
- mockControl->_muted = false;
- mockControl->_bufferStatus = 0;
- mockControl->_videoAvailable = false;
- mockControl->_isSeekable = false;
- mockControl->_playbackRate = 0.0;
- mockControl->_media = QMediaContent();
- mockControl->_stream = 0;
- mockControl->_isValid = false;
- mockControl->_errorString = QString();
- }
-
- MockPlayerControl *mockControl;
-};
-
-class MockProvider : public QMediaServiceProvider
-{
-public:
- MockProvider(MockPlayerService *service):mockService(service) {}
- QMediaService *requestService(const QByteArray &, const QMediaServiceProviderHint &)
- {
- return mockService;
- }
-
- void releaseService(QMediaService *service) { delete service; }
-
- MockPlayerService *mockService;
-};
-
-class tst_QMediaPlayer: public QObject
-{
- Q_OBJECT
-
-public slots:
- void initTestCase_data();
- void initTestCase();
- void cleanupTestCase();
- void init();
- void cleanup();
-
-private slots:
- void testNullService();
- void testValid();
- void testMedia();
- void testDuration();
- void testPosition();
- void testVolume();
- void testMuted();
- void testVideoAvailable();
- void testBufferStatus();
- void testSeekable();
- void testPlaybackRate();
- void testError();
- void testErrorString();
- void testService();
- void testPlay();
- void testPause();
- void testStop();
- void testMediaStatus();
- void testPlaylist();
-
-private:
- MockProvider *mockProvider;
- MockPlayerService *mockService;
- QMediaPlayer *player;
-};
-
-void tst_QMediaPlayer::initTestCase_data()
-{
- QTest::addColumn<bool>("valid");
- QTest::addColumn<QMediaPlayer::State>("state");
- QTest::addColumn<QMediaPlayer::MediaStatus>("status");
- QTest::addColumn<QMediaContent>("mediaContent");
- QTest::addColumn<qint64>("duration");
- QTest::addColumn<qint64>("position");
- QTest::addColumn<bool>("seekable");
- QTest::addColumn<int>("volume");
- QTest::addColumn<bool>("muted");
- QTest::addColumn<bool>("videoAvailable");
- QTest::addColumn<int>("bufferStatus");
- QTest::addColumn<qreal>("playbackRate");
- QTest::addColumn<QMediaPlayer::Error>("error");
- QTest::addColumn<QString>("errorString");
-
- QTest::newRow("invalid") << false << QMediaPlayer::StoppedState << QMediaPlayer::UnknownMediaStatus <<
- QMediaContent() << qint64(0) << qint64(0) << false << 0 << false << false << 0 <<
- qreal(0) << QMediaPlayer::NoError << QString();
- QTest::newRow("valid+null") << true << QMediaPlayer::StoppedState << QMediaPlayer::UnknownMediaStatus <<
- QMediaContent() << qint64(0) << qint64(0) << false << 0 << false << false << 50 <<
- qreal(0) << QMediaPlayer::NoError << QString();
- QTest::newRow("valid+content+stopped") << true << QMediaPlayer::StoppedState << QMediaPlayer::UnknownMediaStatus <<
- QMediaContent(QUrl("file:///some.mp3")) << qint64(0) << qint64(0) << false << 50 << false << false << 0 <<
- qreal(1) << QMediaPlayer::NoError << QString();
- QTest::newRow("valid+content+playing") << true << QMediaPlayer::PlayingState << QMediaPlayer::LoadedMedia <<
- QMediaContent(QUrl("file:///some.mp3")) << qint64(10000) << qint64(10) << true << 50 << true << false << 0 <<
- qreal(1) << QMediaPlayer::NoError << QString();
- QTest::newRow("valid+content+paused") << true << QMediaPlayer::PausedState << QMediaPlayer::LoadedMedia <<
- QMediaContent(QUrl("file:///some.mp3")) << qint64(10000) << qint64(10) << true << 50 << true << false << 0 <<
- qreal(1) << QMediaPlayer::NoError << QString();
- QTest::newRow("valud+streaming") << true << QMediaPlayer::PlayingState << QMediaPlayer::LoadedMedia <<
- QMediaContent(QUrl("http://example.com/stream")) << qint64(10000) << qint64(10000) << false << 50 << false << true << 0 <<
- qreal(1) << QMediaPlayer::NoError << QString();
- QTest::newRow("valid+error") << true << QMediaPlayer::StoppedState << QMediaPlayer::UnknownMediaStatus <<
- QMediaContent(QUrl("http://example.com/stream")) << qint64(0) << qint64(0) << false << 50 << false << false << 0 <<
- qreal(0) << QMediaPlayer::ResourceError << QString("Resource unavailable");
-}
-
-void tst_QMediaPlayer::initTestCase()
-{
- qRegisterMetaType<QMediaContent>();
-
- mockService = new MockPlayerService;
- mockProvider = new MockProvider(mockService);
- player = new QMediaPlayer(0, 0, mockProvider);
-}
-
-void tst_QMediaPlayer::cleanupTestCase()
-{
- delete player;
-}
-
-void tst_QMediaPlayer::init()
-{
- mockService->reset();
-}
-
-void tst_QMediaPlayer::cleanup()
-{
-}
-
-void tst_QMediaPlayer::testNullService()
-{
- MockProvider provider(0);
- QMediaPlayer player(0, 0, &provider);
-
- const QIODevice *nullDevice = 0;
-
- QCOMPARE(player.media(), QMediaContent());
- QCOMPARE(player.mediaStream(), nullDevice);
- QCOMPARE(player.state(), QMediaPlayer::StoppedState);
- QCOMPARE(player.mediaStatus(), QMediaPlayer::UnknownMediaStatus);
- QCOMPARE(player.duration(), qint64(-1));
- QCOMPARE(player.position(), qint64(0));
- QCOMPARE(player.volume(), 0);
- QCOMPARE(player.isMuted(), false);
- QCOMPARE(player.isVideoAvailable(), false);
- QCOMPARE(player.bufferStatus(), 0);
- QCOMPARE(player.isSeekable(), false);
- QCOMPARE(player.playbackRate(), qreal(0));
- QCOMPARE(player.error(), QMediaPlayer::ServiceMissingError);
-
- {
- QFETCH_GLOBAL(QMediaContent, mediaContent);
-
- QSignalSpy spy(&player, SIGNAL(mediaChanged(QMediaContent)));
- QFile file;
-
- player.setMedia(mediaContent, &file);
- QCOMPARE(player.media(), QMediaContent());
- QCOMPARE(player.mediaStream(), nullDevice);
- QCOMPARE(spy.count(), 0);
- } {
- QSignalSpy stateSpy(&player, SIGNAL(stateChanged(QMediaPlayer::State)));
- QSignalSpy statusSpy(&player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)));
-
- player.play();
- QCOMPARE(player.state(), QMediaPlayer::StoppedState);
- QCOMPARE(player.mediaStatus(), QMediaPlayer::UnknownMediaStatus);
- QCOMPARE(stateSpy.count(), 0);
- QCOMPARE(statusSpy.count(), 0);
-
- player.pause();
- QCOMPARE(player.state(), QMediaPlayer::StoppedState);
- QCOMPARE(player.mediaStatus(), QMediaPlayer::UnknownMediaStatus);
- QCOMPARE(stateSpy.count(), 0);
- QCOMPARE(statusSpy.count(), 0);
-
- player.stop();
- QCOMPARE(player.state(), QMediaPlayer::StoppedState);
- QCOMPARE(player.mediaStatus(), QMediaPlayer::UnknownMediaStatus);
- QCOMPARE(stateSpy.count(), 0);
- QCOMPARE(statusSpy.count(), 0);
- } {
- QFETCH_GLOBAL(int, volume);
- QFETCH_GLOBAL(bool, muted);
-
- QSignalSpy volumeSpy(&player, SIGNAL(volumeChanged(int)));
- QSignalSpy mutingSpy(&player, SIGNAL(mutedChanged(bool)));
-
- player.setVolume(volume);
- QCOMPARE(player.volume(), 0);
- QCOMPARE(volumeSpy.count(), 0);
-
- player.setMuted(muted);
- QCOMPARE(player.isMuted(), false);
- QCOMPARE(mutingSpy.count(), 0);
- } {
- QFETCH_GLOBAL(qint64, position);
-
- QSignalSpy spy(&player, SIGNAL(positionChanged(qint64)));
-
- player.setPosition(position);
- QCOMPARE(player.position(), qint64(0));
- QCOMPARE(spy.count(), 0);
- } {
- QFETCH_GLOBAL(qreal, playbackRate);
-
- QSignalSpy spy(&player, SIGNAL(playbackRateChanged(qreal)));
-
- player.setPlaybackRate(playbackRate);
- QCOMPARE(player.playbackRate(), qreal(0));
- QCOMPARE(spy.count(), 0);
- } {
- QMediaPlaylist playlist;
- playlist.setMediaObject(&player);
-
- QSignalSpy mediaSpy(&player, SIGNAL(mediaChanged(QMediaContent)));
- QSignalSpy statusSpy(&player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)));
-
- playlist.addMedia(QUrl("http://example.com/stream"));
- playlist.addMedia(QUrl("file:///some.mp3"));
-
- playlist.setCurrentIndex(0);
- QCOMPARE(playlist.currentIndex(), 0);
- QCOMPARE(player.media(), QMediaContent());
- QCOMPARE(mediaSpy.count(), 0);
- QCOMPARE(statusSpy.count(), 0);
-
- playlist.next();
- QCOMPARE(playlist.currentIndex(), 1);
- QCOMPARE(player.media(), QMediaContent());
- QCOMPARE(mediaSpy.count(), 0);
- QCOMPARE(statusSpy.count(), 0);
- }
-}
-
-void tst_QMediaPlayer::testValid()
-{
- /*
- QFETCH_GLOBAL(bool, valid);
-
- mockService->setIsValid(valid);
- QCOMPARE(player->isValid(), valid);
- */
-}
-
-void tst_QMediaPlayer::testMedia()
-{
- QFETCH_GLOBAL(QMediaContent, mediaContent);
-
- mockService->setMedia(mediaContent);
- QCOMPARE(player->media(), mediaContent);
-
- QBuffer stream;
- player->setMedia(mediaContent, &stream);
- QCOMPARE(player->media(), mediaContent);
- QCOMPARE((QBuffer*)player->mediaStream(), &stream);
-}
-
-void tst_QMediaPlayer::testDuration()
-{
- QFETCH_GLOBAL(qint64, duration);
-
- mockService->setDuration(duration);
- QVERIFY(player->duration() == duration);
-}
-
-void tst_QMediaPlayer::testPosition()
-{
- QFETCH_GLOBAL(bool, valid);
- QFETCH_GLOBAL(bool, seekable);
- QFETCH_GLOBAL(qint64, position);
- QFETCH_GLOBAL(qint64, duration);
-
- mockService->setIsValid(valid);
- mockService->setSeekable(seekable);
- mockService->setPosition(position);
- mockService->setDuration(duration);
- QVERIFY(player->isSeekable() == seekable);
- QVERIFY(player->position() == position);
- QVERIFY(player->duration() == duration);
-
- if (seekable) {
- { QSignalSpy spy(player, SIGNAL(positionChanged(qint64)));
- player->setPosition(position);
- QCOMPARE(player->position(), position);
- QCOMPARE(spy.count(), 0); }
-
- mockService->setPosition(position);
- { QSignalSpy spy(player, SIGNAL(positionChanged(qint64)));
- player->setPosition(0);
- QCOMPARE(player->position(), qint64(0));
- QCOMPARE(spy.count(), position == 0 ? 0 : 1); }
-
- mockService->setPosition(position);
- { QSignalSpy spy(player, SIGNAL(positionChanged(qint64)));
- player->setPosition(duration);
- QCOMPARE(player->position(), duration);
- QCOMPARE(spy.count(), position == duration ? 0 : 1); }
-
- mockService->setPosition(position);
- { QSignalSpy spy(player, SIGNAL(positionChanged(qint64)));
- player->setPosition(-1);
- QCOMPARE(player->position(), qint64(0));
- QCOMPARE(spy.count(), position == 0 ? 0 : 1); }
-
- mockService->setPosition(position);
- { QSignalSpy spy(player, SIGNAL(positionChanged(qint64)));
- player->setPosition(duration + 1);
- QCOMPARE(player->position(), duration);
- QCOMPARE(spy.count(), position == duration ? 0 : 1); }
- }
- else {
- QSignalSpy spy(player, SIGNAL(positionChanged(qint64)));
- player->setPosition(position);
-
- QCOMPARE(player->position(), position);
- QCOMPARE(spy.count(), 0);
- }
-}
-
-void tst_QMediaPlayer::testVolume()
-{
- QFETCH_GLOBAL(bool, valid);
- QFETCH_GLOBAL(int, volume);
-
- mockService->setVolume(volume);
- QVERIFY(player->volume() == volume);
-
- if (valid) {
- { QSignalSpy spy(player, SIGNAL(volumeChanged(int)));
- player->setVolume(10);
- QCOMPARE(player->volume(), 10);
- QCOMPARE(spy.count(), 1); }
-
- { QSignalSpy spy(player, SIGNAL(volumeChanged(int)));
- player->setVolume(-1000);
- QCOMPARE(player->volume(), 0);
- QCOMPARE(spy.count(), 1); }
-
- { QSignalSpy spy(player, SIGNAL(volumeChanged(int)));
- player->setVolume(100);
- QCOMPARE(player->volume(), 100);
- QCOMPARE(spy.count(), 1); }
-
- { QSignalSpy spy(player, SIGNAL(volumeChanged(int)));
- player->setVolume(1000);
- QCOMPARE(player->volume(), 100);
- QCOMPARE(spy.count(), 0); }
- }
-}
-
-void tst_QMediaPlayer::testMuted()
-{
- QFETCH_GLOBAL(bool, valid);
- QFETCH_GLOBAL(bool, muted);
- QFETCH_GLOBAL(int, volume);
-
- if (valid) {
- mockService->setMuted(muted);
- mockService->setVolume(volume);
- QVERIFY(player->isMuted() == muted);
-
- QSignalSpy spy(player, SIGNAL(mutedChanged(bool)));
- player->setMuted(!muted);
- QCOMPARE(player->isMuted(), !muted);
- QCOMPARE(player->volume(), volume);
- QCOMPARE(spy.count(), 1);
- }
-}
-
-void tst_QMediaPlayer::testVideoAvailable()
-{
- QFETCH_GLOBAL(bool, videoAvailable);
-
- mockService->setVideoAvailable(videoAvailable);
- QVERIFY(player->isVideoAvailable() == videoAvailable);
-}
-
-void tst_QMediaPlayer::testBufferStatus()
-{
- QFETCH_GLOBAL(int, bufferStatus);
-
- mockService->setBufferStatus(bufferStatus);
- QVERIFY(player->bufferStatus() == bufferStatus);
-}
-
-void tst_QMediaPlayer::testSeekable()
-{
- QFETCH_GLOBAL(bool, seekable);
-
- mockService->setSeekable(seekable);
- QVERIFY(player->isSeekable() == seekable);
-}
-
-void tst_QMediaPlayer::testPlaybackRate()
-{
- QFETCH_GLOBAL(bool, valid);
- QFETCH_GLOBAL(qreal, playbackRate);
-
- if (valid) {
- mockService->setPlaybackRate(playbackRate);
- QVERIFY(player->playbackRate() == playbackRate);
-
- QSignalSpy spy(player, SIGNAL(playbackRateChanged(qreal)));
- player->setPlaybackRate(playbackRate + 0.5f);
- QCOMPARE(player->playbackRate(), playbackRate + 0.5f);
- QCOMPARE(spy.count(), 1);
- }
-}
-
-void tst_QMediaPlayer::testError()
-{
- QFETCH_GLOBAL(QMediaPlayer::Error, error);
-
- mockService->setError(error);
- QVERIFY(player->error() == error);
-}
-
-void tst_QMediaPlayer::testErrorString()
-{
- QFETCH_GLOBAL(QString, errorString);
-
- mockService->setErrorString(errorString);
- QVERIFY(player->errorString() == errorString);
-}
-
-void tst_QMediaPlayer::testService()
-{
- /*
- QFETCH_GLOBAL(bool, valid);
-
- mockService->setIsValid(valid);
-
- if (valid)
- QVERIFY(player->service() != 0);
- else
- QVERIFY(player->service() == 0);
- */
-}
-
-void tst_QMediaPlayer::testPlay()
-{
- QFETCH_GLOBAL(bool, valid);
- QFETCH_GLOBAL(QMediaContent, mediaContent);
- QFETCH_GLOBAL(QMediaPlayer::State, state);
-
- mockService->setIsValid(valid);
- mockService->setState(state);
- mockService->setMedia(mediaContent);
- QVERIFY(player->state() == state);
- QVERIFY(player->media() == mediaContent);
-
- QSignalSpy spy(player, SIGNAL(stateChanged(QMediaPlayer::State)));
-
- player->play();
-
- if (!valid || mediaContent.isNull()) {
- QCOMPARE(player->state(), QMediaPlayer::StoppedState);
- QCOMPARE(spy.count(), 0);
- }
- else {
- QCOMPARE(player->state(), QMediaPlayer::PlayingState);
- QCOMPARE(spy.count(), state == QMediaPlayer::PlayingState ? 0 : 1);
- }
-}
-
-void tst_QMediaPlayer::testPause()
-{
- QFETCH_GLOBAL(bool, valid);
- QFETCH_GLOBAL(QMediaContent, mediaContent);
- QFETCH_GLOBAL(QMediaPlayer::State, state);
-
- mockService->setIsValid(valid);
- mockService->setState(state);
- mockService->setMedia(mediaContent);
- QVERIFY(player->state() == state);
- QVERIFY(player->media() == mediaContent);
-
- QSignalSpy spy(player, SIGNAL(stateChanged(QMediaPlayer::State)));
-
- player->pause();
-
- if (!valid || mediaContent.isNull()) {
- QCOMPARE(player->state(), QMediaPlayer::StoppedState);
- QCOMPARE(spy.count(), 0);
- }
- else {
- QCOMPARE(player->state(), QMediaPlayer::PausedState);
- QCOMPARE(spy.count(), state == QMediaPlayer::PausedState ? 0 : 1);
- }
-}
-
-void tst_QMediaPlayer::testStop()
-{
- QFETCH_GLOBAL(QMediaContent, mediaContent);
- QFETCH_GLOBAL(QMediaPlayer::State, state);
-
- mockService->setState(state);
- mockService->setMedia(mediaContent);
- QVERIFY(player->state() == state);
- QVERIFY(player->media() == mediaContent);
-
- QSignalSpy spy(player, SIGNAL(stateChanged(QMediaPlayer::State)));
-
- player->stop();
-
- if (mediaContent.isNull() || state == QMediaPlayer::StoppedState) {
- QCOMPARE(player->state(), QMediaPlayer::StoppedState);
- QCOMPARE(spy.count(), 0);
- }
- else {
- QCOMPARE(player->state(), QMediaPlayer::StoppedState);
- QCOMPARE(spy.count(), 1);
- }
-}
-
-void tst_QMediaPlayer::testMediaStatus()
-{
- QFETCH_GLOBAL(int, bufferStatus);
- int bufferSignals = 0;
-
- player->setNotifyInterval(10);
-
- mockService->setMediaStatus(QMediaPlayer::NoMedia);
- mockService->setBufferStatus(bufferStatus);
-
- AutoConnection connection(
- player, SIGNAL(bufferStatusChanged(int)),
- &QTestEventLoop::instance(), SLOT(exitLoop()));
-
- QSignalSpy statusSpy(player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)));
- QSignalSpy bufferSpy(player, SIGNAL(bufferStatusChanged(int)));
-
- QCOMPARE(player->mediaStatus(), QMediaPlayer::NoMedia);
-
- mockService->setMediaStatus(QMediaPlayer::LoadingMedia);
- QCOMPARE(player->mediaStatus(), QMediaPlayer::LoadingMedia);
- QCOMPARE(statusSpy.count(), 1);
-
- QCOMPARE(qvariant_cast<QMediaPlayer::MediaStatus>(statusSpy.last().value(0)),
- QMediaPlayer::LoadingMedia);
-
- mockService->setMediaStatus(QMediaPlayer::LoadedMedia);
- QCOMPARE(player->mediaStatus(), QMediaPlayer::LoadedMedia);
- QCOMPARE(statusSpy.count(), 2);
-
- QCOMPARE(qvariant_cast<QMediaPlayer::MediaStatus>(statusSpy.last().value(0)),
- QMediaPlayer::LoadedMedia);
-
- // Verify the bufferStatusChanged() signal isn't being emitted.
- QTestEventLoop::instance().enterLoop(1);
- QCOMPARE(bufferSpy.count(), 0);
-
- mockService->setMediaStatus(QMediaPlayer::StalledMedia);
- QCOMPARE(player->mediaStatus(), QMediaPlayer::StalledMedia);
- QCOMPARE(statusSpy.count(), 3);
-
- QCOMPARE(qvariant_cast<QMediaPlayer::MediaStatus>(statusSpy.last().value(0)),
- QMediaPlayer::StalledMedia);
-
- // Verify the bufferStatusChanged() signal is being emitted.
- QTestEventLoop::instance().enterLoop(1);
- QVERIFY(bufferSpy.count() > bufferSignals);
- QCOMPARE(bufferSpy.last().value(0).toInt(), bufferStatus);
- bufferSignals = bufferSpy.count();
-
- mockService->setMediaStatus(QMediaPlayer::BufferingMedia);
- QCOMPARE(player->mediaStatus(), QMediaPlayer::BufferingMedia);
- QCOMPARE(statusSpy.count(), 4);
-
- QCOMPARE(qvariant_cast<QMediaPlayer::MediaStatus>(statusSpy.last().value(0)),
- QMediaPlayer::BufferingMedia);
-
- // Verify the bufferStatusChanged() signal is being emitted.
- QTestEventLoop::instance().enterLoop(1);
- QVERIFY(bufferSpy.count() > bufferSignals);
- QCOMPARE(bufferSpy.last().value(0).toInt(), bufferStatus);
- bufferSignals = bufferSpy.count();
-
- mockService->setMediaStatus(QMediaPlayer::BufferedMedia);
- QCOMPARE(player->mediaStatus(), QMediaPlayer::BufferedMedia);
- QCOMPARE(statusSpy.count(), 5);
-
- QCOMPARE(qvariant_cast<QMediaPlayer::MediaStatus>(statusSpy.last().value(0)),
- QMediaPlayer::BufferedMedia);
-
- // Verify the bufferStatusChanged() signal isn't being emitted.
- QTestEventLoop::instance().enterLoop(1);
- QCOMPARE(bufferSpy.count(), bufferSignals);
-
- mockService->setMediaStatus(QMediaPlayer::EndOfMedia);
- QCOMPARE(player->mediaStatus(), QMediaPlayer::EndOfMedia);
- QCOMPARE(statusSpy.count(), 6);
-
- QCOMPARE(qvariant_cast<QMediaPlayer::MediaStatus>(statusSpy.last().value(0)),
- QMediaPlayer::EndOfMedia);
-}
-
-void tst_QMediaPlayer::testPlaylist()
-{
- QMediaContent content0(QUrl(QLatin1String("test://audio/song1.mp3")));
- QMediaContent content1(QUrl(QLatin1String("test://audio/song2.mp3")));
- QMediaContent content2(QUrl(QLatin1String("test://video/movie1.mp4")));
- QMediaContent content3(QUrl(QLatin1String("test://video/movie2.mp4")));
- QMediaContent content4(QUrl(QLatin1String("test://image/photo.jpg")));
-
- mockService->setIsValid(true);
- mockService->setState(QMediaPlayer::StoppedState, QMediaPlayer::NoMedia);
-
- QMediaPlaylist *playlist = new QMediaPlaylist;
- playlist->setMediaObject(player);
-
- QSignalSpy stateSpy(player, SIGNAL(stateChanged(QMediaPlayer::State)));
- QSignalSpy mediaSpy(player, SIGNAL(mediaChanged(QMediaContent)));
-
- // Test the player does nothing with an empty playlist attached.
- player->play();
- QCOMPARE(player->state(), QMediaPlayer::StoppedState);
- QCOMPARE(player->media(), QMediaContent());
- QCOMPARE(stateSpy.count(), 0);
- QCOMPARE(mediaSpy.count(), 0);
-
- playlist->addMedia(content0);
- playlist->addMedia(content1);
- playlist->addMedia(content2);
- playlist->addMedia(content3);
-
- // Test changing the playlist position, changes the current media, but not the playing state.
- playlist->setCurrentIndex(1);
- QCOMPARE(player->media(), content1);
- QCOMPARE(player->state(), QMediaPlayer::StoppedState);
- QCOMPARE(stateSpy.count(), 0);
- QCOMPARE(mediaSpy.count(), 1);
-
- // Test playing starts with the current media.
- player->play();
- QCOMPARE(player->media(), content1);
- QCOMPARE(player->state(), QMediaPlayer::PlayingState);
- QCOMPARE(stateSpy.count(), 1);
- QCOMPARE(mediaSpy.count(), 1);
-
- // Test pausing doesn't change the current media.
- player->pause();
- QCOMPARE(player->media(), content1);
- QCOMPARE(player->state(), QMediaPlayer::PausedState);
- QCOMPARE(stateSpy.count(), 2);
- QCOMPARE(mediaSpy.count(), 1);
-
- // Test stopping doesn't change the current media.
- player->stop();
- QCOMPARE(player->media(), content1);
- QCOMPARE(player->state(), QMediaPlayer::StoppedState);
- QCOMPARE(stateSpy.count(), 3);
- QCOMPARE(mediaSpy.count(), 1);
-
- // Test when the player service reaches the end of the current media, the player moves onto
- // the next item without stopping.
- player->play();
- QCOMPARE(player->media(), content1);
- QCOMPARE(player->state(), QMediaPlayer::PlayingState);
- QCOMPARE(stateSpy.count(), 4);
- QCOMPARE(mediaSpy.count(), 1);
-
- mockService->setState(QMediaPlayer::StoppedState, QMediaPlayer::EndOfMedia);
- QCOMPARE(player->media(), content2);
- QCOMPARE(player->state(), QMediaPlayer::PlayingState);
- QCOMPARE(stateSpy.count(), 4);
- QCOMPARE(mediaSpy.count(), 2);
-
- // Test skipping the current media doesn't change the state.
- playlist->next();
- QCOMPARE(player->media(), content3);
- QCOMPARE(player->state(), QMediaPlayer::PlayingState);
- QCOMPARE(stateSpy.count(), 4);
- QCOMPARE(mediaSpy.count(), 3);
-
- // Test changing the current media while paused doesn't change the state.
- player->pause();
- mockService->setMediaStatus(QMediaPlayer::BufferedMedia);
- QCOMPARE(player->media(), content3);
- QCOMPARE(player->state(), QMediaPlayer::PausedState);
- QCOMPARE(stateSpy.count(), 5);
- QCOMPARE(mediaSpy.count(), 3);
-
- playlist->previous();
- QCOMPARE(player->media(), content2);
- QCOMPARE(player->state(), QMediaPlayer::PausedState);
- QCOMPARE(stateSpy.count(), 5);
- QCOMPARE(mediaSpy.count(), 4);
-
- // Test changing the current media while stopped doesn't change the state.
- player->stop();
- mockService->setMediaStatus(QMediaPlayer::LoadedMedia);
- QCOMPARE(player->media(), content2);
- QCOMPARE(player->state(), QMediaPlayer::StoppedState);
- QCOMPARE(stateSpy.count(), 6);
- QCOMPARE(mediaSpy.count(), 4);
-
- playlist->next();
- QCOMPARE(player->media(), content3);
- QCOMPARE(player->state(), QMediaPlayer::StoppedState);
- QCOMPARE(stateSpy.count(), 6);
- QCOMPARE(mediaSpy.count(), 5);
-
- // Test the player is stopped and the current media cleared when it reaches the end of the last
- // item in the playlist.
- player->play();
- QCOMPARE(player->media(), content3);
- QCOMPARE(player->state(), QMediaPlayer::PlayingState);
- QCOMPARE(stateSpy.count(), 7);
- QCOMPARE(mediaSpy.count(), 5);
-
- // Double up the signals to ensure some noise doesn't destabalize things.
- mockService->setState(QMediaPlayer::StoppedState, QMediaPlayer::EndOfMedia);
- mockService->setState(QMediaPlayer::StoppedState, QMediaPlayer::EndOfMedia);
- QCOMPARE(player->media(), QMediaContent());
- QCOMPARE(player->state(), QMediaPlayer::StoppedState);
- QCOMPARE(stateSpy.count(), 8);
- QCOMPARE(mediaSpy.count(), 6);
-
- // Test starts playing from the start of the playlist if there is no current media selected.
- player->play();
- QCOMPARE(player->media(), content0);
- QCOMPARE(player->state(), QMediaPlayer::PlayingState);
- QCOMPARE(stateSpy.count(), 9);
- QCOMPARE(mediaSpy.count(), 7);
-
- // Test deleting the playlist stops the player and clears the media it set.
- delete playlist;
- QCOMPARE(player->media(), QMediaContent());
- QCOMPARE(player->state(), QMediaPlayer::StoppedState);
- QCOMPARE(stateSpy.count(), 10);
- QCOMPARE(mediaSpy.count(), 8);
-
- // Test the player works as normal with the playlist removed.
- player->play();
- QCOMPARE(player->media(), QMediaContent());
- QCOMPARE(player->state(), QMediaPlayer::StoppedState);
- QCOMPARE(stateSpy.count(), 10);
- QCOMPARE(mediaSpy.count(), 8);
-
- player->setMedia(content1);
- player->play();
-
- QCOMPARE(player->media(), content1);
- QCOMPARE(player->state(), QMediaPlayer::PlayingState);
- QCOMPARE(stateSpy.count(), 11);
- QCOMPARE(mediaSpy.count(), 9);
-
- // Test the player can bind to playlist again
- playlist = new QMediaPlaylist;
- playlist->setMediaObject(player);
- QCOMPARE(playlist->mediaObject(), qobject_cast<QMediaObject*>(player));
-
- QCOMPARE(player->media(), QMediaContent());
- QCOMPARE(player->state(), QMediaPlayer::StoppedState);
-
- playlist->addMedia(content0);
- playlist->addMedia(content1);
- playlist->addMedia(content2);
- playlist->addMedia(content3);
-
- playlist->setCurrentIndex(1);
- QCOMPARE(player->media(), content1);
- QCOMPARE(player->state(), QMediaPlayer::StoppedState);
-
- // Test attaching the new playlist,
- // player should detach the current one
- QMediaPlaylist *playlist2 = new QMediaPlaylist;
- playlist2->addMedia(content1);
- playlist2->addMedia(content2);
- playlist2->addMedia(content3);
- playlist2->setCurrentIndex(2);
-
- player->play();
- playlist2->setMediaObject(player);
- QCOMPARE(playlist2->mediaObject(), qobject_cast<QMediaObject*>(player));
- QVERIFY(playlist->mediaObject() == 0);
- QCOMPARE(player->media(), playlist2->currentMedia());
- QCOMPARE(player->state(), QMediaPlayer::StoppedState);
-
- playlist2->setCurrentIndex(1);
- QCOMPARE(player->media(), playlist2->currentMedia());
-}
-
-QTEST_MAIN(tst_QMediaPlayer)
-
-#include "tst_qmediaplayer.moc"
diff --git a/tests/auto/qmediaplaylist/qmediaplaylist.pro b/tests/auto/qmediaplaylist/qmediaplaylist.pro
deleted file mode 100644
index 809473b..0000000
--- a/tests/auto/qmediaplaylist/qmediaplaylist.pro
+++ /dev/null
@@ -1,6 +0,0 @@
-load(qttest_p4)
-
-SOURCES = tst_qmediaplaylist.cpp
-
-QT = core mediaservices
-
diff --git a/tests/auto/qmediaplaylist/tmp.unsupported_format b/tests/auto/qmediaplaylist/tmp.unsupported_format
deleted file mode 100644
index e69de29..0000000
--- a/tests/auto/qmediaplaylist/tmp.unsupported_format
+++ /dev/null
diff --git a/tests/auto/qmediaplaylist/tst_qmediaplaylist.cpp b/tests/auto/qmediaplaylist/tst_qmediaplaylist.cpp
deleted file mode 100644
index 1037f37..0000000
--- a/tests/auto/qmediaplaylist/tst_qmediaplaylist.cpp
+++ /dev/null
@@ -1,593 +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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, 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.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QtTest>
-#include <QDebug>
-#include <QtMediaServices/qmediaservice.h>
-#include <QtMediaServices/qmediaplaylist.h>
-#include <QtMediaServices/qmediaplaylistcontrol.h>
-#include <QtMediaServices/qmediaplaylistnavigator.h>
-#include <QtMediaServices/private/qmediapluginloader_p.h>
-
-
-class MockReadOnlyPlaylistProvider : public QMediaPlaylistProvider
-{
- Q_OBJECT
-public:
- MockReadOnlyPlaylistProvider(QObject *parent)
- :QMediaPlaylistProvider(parent)
- {
- m_items.append(QMediaContent(QUrl(QLatin1String("file:///1"))));
- m_items.append(QMediaContent(QUrl(QLatin1String("file:///2"))));
- m_items.append(QMediaContent(QUrl(QLatin1String("file:///3"))));
- }
-
- int mediaCount() const { return m_items.size(); }
- QMediaContent media(int index) const
- {
- return index >=0 && index < mediaCount() ? m_items.at(index) : QMediaContent();
- }
-
-private:
- QList<QMediaContent> m_items;
-};
-
-class MockPlaylistControl : public QMediaPlaylistControl
-{
- Q_OBJECT
-public:
- MockPlaylistControl(QObject *parent) : QMediaPlaylistControl(parent)
- {
- m_navigator = new QMediaPlaylistNavigator(new MockReadOnlyPlaylistProvider(this), this);
- }
-
- ~MockPlaylistControl()
- {
- }
-
- QMediaPlaylistProvider* playlistProvider() const { return m_navigator->playlist(); }
- bool setPlaylistProvider(QMediaPlaylistProvider *playlist) { m_navigator->setPlaylist(playlist); return true; }
-
- int currentIndex() const { return m_navigator->currentIndex(); }
- void setCurrentIndex(int position) { m_navigator->jump(position); }
- int nextIndex(int steps) const { return m_navigator->nextIndex(steps); }
- int previousIndex(int steps) const { return m_navigator->previousIndex(steps); }
-
- void next() { m_navigator->next(); }
- void previous() { m_navigator->previous(); }
-
- QMediaPlaylist::PlaybackMode playbackMode() const { return m_navigator->playbackMode(); }
- void setPlaybackMode(QMediaPlaylist::PlaybackMode mode) { m_navigator->setPlaybackMode(mode); }
-
-private:
- QMediaPlaylistNavigator *m_navigator;
-};
-
-class MockPlaylistService : public QMediaService
-{
- Q_OBJECT
-
-public:
- MockPlaylistService():QMediaService(0)
- {
- mockControl = new MockPlaylistControl(this);
- }
-
- ~MockPlaylistService()
- {
- }
-
- QMediaControl* control(const char *iid) const
- {
- if (qstrcmp(iid, QMediaPlaylistControl_iid) == 0)
- return mockControl;
- return 0;
- }
-
- MockPlaylistControl *mockControl;
-};
-
-class MockReadOnlyPlaylistObject : public QMediaObject
-{
- Q_OBJECT
-public:
- MockReadOnlyPlaylistObject(QObject *parent = 0)
- :QMediaObject(parent, new MockPlaylistService)
- {
- }
-};
-
-
-class tst_QMediaPlaylist : public QObject
-{
- Q_OBJECT
-public slots:
- void init();
- void cleanup();
- void initTestCase();
-
-private slots:
- void construction();
- void append();
- void insert();
- void clear();
- void removeMedia();
- void currentItem();
- void saveAndLoad();
- void playbackMode();
- void playbackMode_data();
- void shuffle();
- void readOnlyPlaylist();
- void setMediaObject();
-
-private:
- QMediaContent content1;
- QMediaContent content2;
- QMediaContent content3;
-};
-
-void tst_QMediaPlaylist::init()
-{
-}
-
-void tst_QMediaPlaylist::initTestCase()
-{
- content1 = QMediaContent(QUrl(QLatin1String("file:///1")));
- content2 = QMediaContent(QUrl(QLatin1String("file:///2")));
- content3 = QMediaContent(QUrl(QLatin1String("file:///3")));
-}
-
-void tst_QMediaPlaylist::cleanup()
-{
-}
-
-void tst_QMediaPlaylist::construction()
-{
- QMediaPlaylist playlist;
- QCOMPARE(playlist.mediaCount(), 0);
- QVERIFY(playlist.isEmpty());
-}
-
-void tst_QMediaPlaylist::append()
-{
- QMediaPlaylist playlist;
- QVERIFY(!playlist.isReadOnly());
-
- playlist.addMedia(content1);
- QCOMPARE(playlist.mediaCount(), 1);
- QCOMPARE(playlist.media(0), content1);
-
- QSignalSpy aboutToBeInsertedSignalSpy(&playlist, SIGNAL(mediaAboutToBeInserted(int,int)));
- QSignalSpy insertedSignalSpy(&playlist, SIGNAL(mediaInserted(int,int)));
- playlist.addMedia(content2);
- QCOMPARE(playlist.mediaCount(), 2);
- QCOMPARE(playlist.media(1), content2);
-
- QCOMPARE(aboutToBeInsertedSignalSpy.count(), 1);
- QCOMPARE(aboutToBeInsertedSignalSpy.first()[0].toInt(), 1);
- QCOMPARE(aboutToBeInsertedSignalSpy.first()[1].toInt(), 1);
-
- QCOMPARE(insertedSignalSpy.count(), 1);
- QCOMPARE(insertedSignalSpy.first()[0].toInt(), 1);
- QCOMPARE(insertedSignalSpy.first()[1].toInt(), 1);
-
- aboutToBeInsertedSignalSpy.clear();
- insertedSignalSpy.clear();
-
- QMediaContent content4(QUrl(QLatin1String("file:///4")));
- QMediaContent content5(QUrl(QLatin1String("file:///5")));
- playlist.addMedia(QList<QMediaContent>() << content3 << content4 << content5);
- QCOMPARE(playlist.mediaCount(), 5);
- QCOMPARE(playlist.media(2), content3);
- QCOMPARE(playlist.media(3), content4);
- QCOMPARE(playlist.media(4), content5);
-
- QCOMPARE(aboutToBeInsertedSignalSpy.count(), 1);
- QCOMPARE(aboutToBeInsertedSignalSpy[0][0].toInt(), 2);
- QCOMPARE(aboutToBeInsertedSignalSpy[0][1].toInt(), 4);
-
- QCOMPARE(insertedSignalSpy.count(), 1);
- QCOMPARE(insertedSignalSpy[0][0].toInt(), 2);
- QCOMPARE(insertedSignalSpy[0][1].toInt(), 4);
-
- aboutToBeInsertedSignalSpy.clear();
- insertedSignalSpy.clear();
-
- playlist.addMedia(QList<QMediaContent>());
- QCOMPARE(aboutToBeInsertedSignalSpy.count(), 0);
- QCOMPARE(insertedSignalSpy.count(), 0);
-}
-
-void tst_QMediaPlaylist::insert()
-{
- QMediaPlaylist playlist;
- QVERIFY(!playlist.isReadOnly());
-
- playlist.addMedia(content1);
- QCOMPARE(playlist.mediaCount(), 1);
- QCOMPARE(playlist.media(0), content1);
-
- playlist.addMedia(content2);
- QCOMPARE(playlist.mediaCount(), 2);
- QCOMPARE(playlist.media(1), content2);
-
- QSignalSpy aboutToBeInsertedSignalSpy(&playlist, SIGNAL(mediaAboutToBeInserted(int,int)));
- QSignalSpy insertedSignalSpy(&playlist, SIGNAL(mediaInserted(int,int)));
-
- playlist.insertMedia(1, content3);
- QCOMPARE(playlist.mediaCount(), 3);
- QCOMPARE(playlist.media(0), content1);
- QCOMPARE(playlist.media(1), content3);
- QCOMPARE(playlist.media(2), content2);
-
- QCOMPARE(aboutToBeInsertedSignalSpy.count(), 1);
- QCOMPARE(aboutToBeInsertedSignalSpy.first()[0].toInt(), 1);
- QCOMPARE(aboutToBeInsertedSignalSpy.first()[1].toInt(), 1);
-
- QCOMPARE(insertedSignalSpy.count(), 1);
- QCOMPARE(insertedSignalSpy.first()[0].toInt(), 1);
- QCOMPARE(insertedSignalSpy.first()[1].toInt(), 1);
-
- aboutToBeInsertedSignalSpy.clear();
- insertedSignalSpy.clear();
-
- QMediaContent content4(QUrl(QLatin1String("file:///4")));
- QMediaContent content5(QUrl(QLatin1String("file:///5")));
- playlist.insertMedia(1, QList<QMediaContent>() << content4 << content5);
-
- QCOMPARE(playlist.media(0), content1);
- QCOMPARE(playlist.media(1), content4);
- QCOMPARE(playlist.media(2), content5);
- QCOMPARE(playlist.media(3), content3);
- QCOMPARE(playlist.media(4), content2);
- QCOMPARE(aboutToBeInsertedSignalSpy.count(), 1);
- QCOMPARE(aboutToBeInsertedSignalSpy[0][0].toInt(), 1);
- QCOMPARE(aboutToBeInsertedSignalSpy[0][1].toInt(), 2);
-
- QCOMPARE(insertedSignalSpy.count(), 1);
- QCOMPARE(insertedSignalSpy[0][0].toInt(), 1);
- QCOMPARE(insertedSignalSpy[0][1].toInt(), 2);
-
- aboutToBeInsertedSignalSpy.clear();
- insertedSignalSpy.clear();
-
- playlist.insertMedia(1, QList<QMediaContent>());
- QCOMPARE(aboutToBeInsertedSignalSpy.count(), 0);
- QCOMPARE(insertedSignalSpy.count(), 0);
-}
-
-
-void tst_QMediaPlaylist::currentItem()
-{
- QMediaPlaylist playlist;
- playlist.addMedia(content1);
- playlist.addMedia(content2);
-
- QCOMPARE(playlist.currentIndex(), -1);
- QCOMPARE(playlist.currentMedia(), QMediaContent());
-
- QCOMPARE(playlist.nextIndex(), 0);
- QCOMPARE(playlist.nextIndex(2), 1);
- QCOMPARE(playlist.previousIndex(), 1);
- QCOMPARE(playlist.previousIndex(2), 0);
-
- playlist.setCurrentIndex(0);
- QCOMPARE(playlist.currentIndex(), 0);
- QCOMPARE(playlist.currentMedia(), content1);
-
- QCOMPARE(playlist.nextIndex(), 1);
- QCOMPARE(playlist.nextIndex(2), -1);
- QCOMPARE(playlist.previousIndex(), -1);
- QCOMPARE(playlist.previousIndex(2), -1);
-
- playlist.setCurrentIndex(1);
- QCOMPARE(playlist.currentIndex(), 1);
- QCOMPARE(playlist.currentMedia(), content2);
-
- QCOMPARE(playlist.nextIndex(), -1);
- QCOMPARE(playlist.nextIndex(2), -1);
- QCOMPARE(playlist.previousIndex(), 0);
- QCOMPARE(playlist.previousIndex(2), -1);
-
- QTest::ignoreMessage(QtWarningMsg, "QMediaPlaylistNavigator: Jump outside playlist range ");
- playlist.setCurrentIndex(2);
-
- QCOMPARE(playlist.currentIndex(), -1);
- QCOMPARE(playlist.currentMedia(), QMediaContent());
-}
-
-void tst_QMediaPlaylist::clear()
-{
- QMediaPlaylist playlist;
- playlist.addMedia(content1);
- playlist.addMedia(content2);
-
- playlist.clear();
- QVERIFY(playlist.isEmpty());
- QCOMPARE(playlist.mediaCount(), 0);
-}
-
-void tst_QMediaPlaylist::removeMedia()
-{
- QMediaPlaylist playlist;
- playlist.addMedia(content1);
- playlist.addMedia(content2);
- playlist.addMedia(content3);
-
- QSignalSpy aboutToBeRemovedSignalSpy(&playlist, SIGNAL(mediaAboutToBeRemoved(int,int)));
- QSignalSpy removedSignalSpy(&playlist, SIGNAL(mediaRemoved(int,int)));
- playlist.removeMedia(1);
- QCOMPARE(playlist.mediaCount(), 2);
- QCOMPARE(playlist.media(1), content3);
-
- QCOMPARE(aboutToBeRemovedSignalSpy.count(), 1);
- QCOMPARE(aboutToBeRemovedSignalSpy.first()[0].toInt(), 1);
- QCOMPARE(aboutToBeRemovedSignalSpy.first()[1].toInt(), 1);
-
- QCOMPARE(removedSignalSpy.count(), 1);
- QCOMPARE(removedSignalSpy.first()[0].toInt(), 1);
- QCOMPARE(removedSignalSpy.first()[1].toInt(), 1);
-
- aboutToBeRemovedSignalSpy.clear();
- removedSignalSpy.clear();
-
- playlist.removeMedia(0,1);
- QVERIFY(playlist.isEmpty());
-
- QCOMPARE(aboutToBeRemovedSignalSpy.count(), 1);
- QCOMPARE(aboutToBeRemovedSignalSpy.first()[0].toInt(), 0);
- QCOMPARE(aboutToBeRemovedSignalSpy.first()[1].toInt(), 1);
-
- QCOMPARE(removedSignalSpy.count(), 1);
- QCOMPARE(removedSignalSpy.first()[0].toInt(), 0);
- QCOMPARE(removedSignalSpy.first()[1].toInt(), 1);
-
-
- playlist.addMedia(content1);
- playlist.addMedia(content2);
- playlist.addMedia(content3);
-
- playlist.removeMedia(0,1);
- QCOMPARE(playlist.mediaCount(), 1);
- QCOMPARE(playlist.media(0), content3);
-}
-
-void tst_QMediaPlaylist::saveAndLoad()
-{
- QMediaPlaylist playlist;
- playlist.addMedia(content1);
- playlist.addMedia(content2);
- playlist.addMedia(content3);
-
- QCOMPARE(playlist.error(), QMediaPlaylist::NoError);
- QVERIFY(playlist.errorString().isEmpty());
-
- QBuffer buffer;
- buffer.open(QBuffer::ReadWrite);
-
- bool res = playlist.save(&buffer, "unsupported_format");
- QVERIFY(!res);
- QVERIFY(playlist.error() != QMediaPlaylist::NoError);
- QVERIFY(!playlist.errorString().isEmpty());
-
- QSignalSpy errorSignal(&playlist, SIGNAL(loadFailed()));
- playlist.load(&buffer, "unsupported_format");
- QCOMPARE(errorSignal.size(), 1);
- QVERIFY(playlist.error() != QMediaPlaylist::NoError);
- QVERIFY(!playlist.errorString().isEmpty());
-
- res = playlist.save(QUrl(QLatin1String("tmp.unsupported_format")), "unsupported_format");
- QVERIFY(!res);
- QVERIFY(playlist.error() != QMediaPlaylist::NoError);
- QVERIFY(!playlist.errorString().isEmpty());
-
- errorSignal.clear();
- playlist.load(QUrl(QLatin1String("tmp.unsupported_format")), "unsupported_format");
- QCOMPARE(errorSignal.size(), 1);
- QVERIFY(playlist.error() != QMediaPlaylist::NoError);
- QVERIFY(!playlist.errorString().isEmpty());
-}
-
-void tst_QMediaPlaylist::playbackMode_data()
-{
- QTest::addColumn<QMediaPlaylist::PlaybackMode>("playbackMode");
- QTest::addColumn<int>("expectedPrevious");
- QTest::addColumn<int>("pos");
- QTest::addColumn<int>("expectedNext");
-
- QTest::newRow("Linear, 0") << QMediaPlaylist::Linear << -1 << 0 << 1;
- QTest::newRow("Linear, 1") << QMediaPlaylist::Linear << 0 << 1 << 2;
- QTest::newRow("Linear, 2") << QMediaPlaylist::Linear << 1 << 2 << -1;
-
- QTest::newRow("Loop, 0") << QMediaPlaylist::Loop << 2 << 0 << 1;
- QTest::newRow("Loop, 1") << QMediaPlaylist::Loop << 0 << 1 << 2;
- QTest::newRow("Lopp, 2") << QMediaPlaylist::Loop << 1 << 2 << 0;
-
- QTest::newRow("ItemOnce, 1") << QMediaPlaylist::CurrentItemOnce << -1 << 1 << -1;
- QTest::newRow("ItemInLoop, 1") << QMediaPlaylist::CurrentItemInLoop << 1 << 1 << 1;
-
-}
-
-void tst_QMediaPlaylist::playbackMode()
-{
- QFETCH(QMediaPlaylist::PlaybackMode, playbackMode);
- QFETCH(int, expectedPrevious);
- QFETCH(int, pos);
- QFETCH(int, expectedNext);
-
- QMediaPlaylist playlist;
- playlist.addMedia(content1);
- playlist.addMedia(content2);
- playlist.addMedia(content3);
-
- QCOMPARE(playlist.playbackMode(), QMediaPlaylist::Linear);
- QCOMPARE(playlist.currentIndex(), -1);
-
- playlist.setPlaybackMode(playbackMode);
- QCOMPARE(playlist.playbackMode(), playbackMode);
-
- playlist.setCurrentIndex(pos);
- QCOMPARE(playlist.currentIndex(), pos);
- QCOMPARE(playlist.nextIndex(), expectedNext);
- QCOMPARE(playlist.previousIndex(), expectedPrevious);
-
- playlist.next();
- QCOMPARE(playlist.currentIndex(), expectedNext);
-
- playlist.setCurrentIndex(pos);
- playlist.previous();
- QCOMPARE(playlist.currentIndex(), expectedPrevious);
-}
-
-void tst_QMediaPlaylist::shuffle()
-{
- QMediaPlaylist playlist;
- QList<QMediaContent> contentList;
-
- for (int i=0; i<100; i++) {
- QMediaContent content(QUrl(QString::number(i)));
- contentList.append(content);
- playlist.addMedia(content);
- }
-
- playlist.shuffle();
-
- QList<QMediaContent> shuffledContentList;
- for (int i=0; i<playlist.mediaCount(); i++)
- shuffledContentList.append(playlist.media(i));
-
- QVERIFY(contentList != shuffledContentList);
-
-}
-
-void tst_QMediaPlaylist::readOnlyPlaylist()
-{
- MockReadOnlyPlaylistObject mediaObject;
- QMediaPlaylist playlist;
- playlist.setMediaObject(&mediaObject);
-
- QVERIFY(playlist.isReadOnly());
- QVERIFY(!playlist.isEmpty());
- QCOMPARE(playlist.mediaCount(), 3);
-
- QCOMPARE(playlist.media(0), content1);
- QCOMPARE(playlist.media(1), content2);
- QCOMPARE(playlist.media(2), content3);
- QCOMPARE(playlist.media(3), QMediaContent());
-
- //it's a read only playlist, so all the modification should fail
- QVERIFY(!playlist.addMedia(content1));
- QCOMPARE(playlist.mediaCount(), 3);
- QVERIFY(!playlist.addMedia(QList<QMediaContent>() << content1 << content2));
- QCOMPARE(playlist.mediaCount(), 3);
- QVERIFY(!playlist.insertMedia(1, content1));
- QCOMPARE(playlist.mediaCount(), 3);
- QVERIFY(!playlist.insertMedia(1, QList<QMediaContent>() << content1 << content2));
- QCOMPARE(playlist.mediaCount(), 3);
- QVERIFY(!playlist.removeMedia(1));
- QCOMPARE(playlist.mediaCount(), 3);
- QVERIFY(!playlist.removeMedia(0,2));
- QCOMPARE(playlist.mediaCount(), 3);
- QVERIFY(!playlist.clear());
- QCOMPARE(playlist.mediaCount(), 3);
-
- //but it is still allowed to append/insert an empty list
- QVERIFY(playlist.addMedia(QList<QMediaContent>()));
- QVERIFY(playlist.insertMedia(1, QList<QMediaContent>()));
-
- playlist.shuffle();
- //it's still the same
- QCOMPARE(playlist.media(0), content1);
- QCOMPARE(playlist.media(1), content2);
- QCOMPARE(playlist.media(2), content3);
- QCOMPARE(playlist.media(3), QMediaContent());
-
-
- //load to read only playlist should fail,
- //unless underlaying provider supports it
- QBuffer buffer;
- buffer.open(QBuffer::ReadWrite);
- buffer.write(QByteArray("file:///1\nfile:///2"));
- buffer.seek(0);
-
- QSignalSpy errorSignal(&playlist, SIGNAL(loadFailed()));
- playlist.load(&buffer, "m3u");
- QCOMPARE(errorSignal.size(), 1);
- QCOMPARE(playlist.error(), QMediaPlaylist::AccessDeniedError);
- QVERIFY(!playlist.errorString().isEmpty());
- QCOMPARE(playlist.mediaCount(), 3);
-
- errorSignal.clear();
- playlist.load(QUrl(QLatin1String("tmp.m3u")), "m3u");
-
- QCOMPARE(errorSignal.size(), 1);
- QCOMPARE(playlist.error(), QMediaPlaylist::AccessDeniedError);
- QVERIFY(!playlist.errorString().isEmpty());
- QCOMPARE(playlist.mediaCount(), 3);
-}
-
-void tst_QMediaPlaylist::setMediaObject()
-{
- MockReadOnlyPlaylistObject mediaObject;
-
- QMediaPlaylist playlist;
- QVERIFY(playlist.mediaObject() == 0);
- QVERIFY(!playlist.isReadOnly());
-
- playlist.setMediaObject(&mediaObject);
- QCOMPARE(playlist.mediaObject(), qobject_cast<QMediaObject*>(&mediaObject));
- QCOMPARE(playlist.mediaCount(), 3);
- QVERIFY(playlist.isReadOnly());
-
- playlist.setMediaObject(0);
- QVERIFY(playlist.mediaObject() == 0);
- QCOMPARE(playlist.mediaCount(), 0);
- QVERIFY(!playlist.isReadOnly());
-
- playlist.setMediaObject(&mediaObject);
- QCOMPARE(playlist.mediaObject(), qobject_cast<QMediaObject*>(&mediaObject));
- QCOMPARE(playlist.mediaCount(), 3);
- QVERIFY(playlist.isReadOnly());
-}
-
-QTEST_MAIN(tst_QMediaPlaylist)
-#include "tst_qmediaplaylist.moc"
-
diff --git a/tests/auto/qmediaplaylistnavigator/qmediaplaylistnavigator.pro b/tests/auto/qmediaplaylistnavigator/qmediaplaylistnavigator.pro
deleted file mode 100644
index 3265762..0000000
--- a/tests/auto/qmediaplaylistnavigator/qmediaplaylistnavigator.pro
+++ /dev/null
@@ -1,6 +0,0 @@
-load(qttest_p4)
-
-SOURCES = tst_qmediaplaylistnavigator.cpp
-
-QT = core mediaservices
-
diff --git a/tests/auto/qmediaplaylistnavigator/tst_qmediaplaylistnavigator.cpp b/tests/auto/qmediaplaylistnavigator/tst_qmediaplaylistnavigator.cpp
deleted file mode 100644
index 04f736c..0000000
--- a/tests/auto/qmediaplaylistnavigator/tst_qmediaplaylistnavigator.cpp
+++ /dev/null
@@ -1,316 +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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, 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.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QtTest>
-#include <QDebug>
-#include <QtMediaServices/qlocalmediaplaylistprovider.h>
-#include <QtMediaServices/qmediaplaylistnavigator.h>
-
-
-class tst_QMediaPlaylistNavigator : public QObject
-{
- Q_OBJECT
-public slots:
- void init();
- void cleanup();
-
-private slots:
- void construction();
- void setPlaylist();
- void linearPlayback();
- void loopPlayback();
- void currentItemOnce();
- void currentItemInLoop();
- void randomPlayback();
-};
-
-void tst_QMediaPlaylistNavigator::init()
-{
-}
-
-void tst_QMediaPlaylistNavigator::cleanup()
-{
-}
-
-void tst_QMediaPlaylistNavigator::construction()
-{
- QLocalMediaPlaylistProvider playlist;
- QCOMPARE(playlist.mediaCount(), 0);
-
- QMediaPlaylistNavigator navigator(&playlist);
- QVERIFY(navigator.currentItem().isNull());
- QCOMPARE(navigator.currentIndex(), -1);
-}
-
-void tst_QMediaPlaylistNavigator::setPlaylist()
-{
- QMediaPlaylistNavigator navigator(0);
- QVERIFY(navigator.playlist() != 0);
- QCOMPARE(navigator.playlist()->mediaCount(), 0);
- QCOMPARE(navigator.playlist()->media(0), QMediaContent());
- QVERIFY(navigator.playlist()->isReadOnly() );
-
- QLocalMediaPlaylistProvider playlist;
- QCOMPARE(playlist.mediaCount(), 0);
-
- navigator.setPlaylist(&playlist);
- QCOMPARE(navigator.playlist(), (QMediaPlaylistProvider*)&playlist);
- QCOMPARE(navigator.playlist()->mediaCount(), 0);
- QVERIFY(!navigator.playlist()->isReadOnly() );
-}
-
-void tst_QMediaPlaylistNavigator::linearPlayback()
-{
- QLocalMediaPlaylistProvider playlist;
- QMediaPlaylistNavigator navigator(&playlist);
-
- navigator.setPlaybackMode(QMediaPlaylist::Linear);
- QTest::ignoreMessage(QtWarningMsg, "QMediaPlaylistNavigator: Jump outside playlist range ");
- navigator.jump(0);//it's ok to have warning here
- QVERIFY(navigator.currentItem().isNull());
- QCOMPARE(navigator.currentIndex(), -1);
-
- QMediaContent content1(QUrl(QLatin1String("file:///1")));
- playlist.addMedia(content1);
- navigator.jump(0);
- QVERIFY(!navigator.currentItem().isNull());
-
- QCOMPARE(navigator.currentIndex(), 0);
- QCOMPARE(navigator.currentItem(), content1);
- QCOMPARE(navigator.nextItem(), QMediaContent());
- QCOMPARE(navigator.nextItem(2), QMediaContent());
- QCOMPARE(navigator.previousItem(), QMediaContent());
- QCOMPARE(navigator.previousItem(2), QMediaContent());
-
- QMediaContent content2(QUrl(QLatin1String("file:///2")));
- playlist.addMedia(content2);
- QCOMPARE(navigator.currentIndex(), 0);
- QCOMPARE(navigator.currentItem(), content1);
- QCOMPARE(navigator.nextItem(), content2);
- QCOMPARE(navigator.nextItem(2), QMediaContent());
- QCOMPARE(navigator.previousItem(), QMediaContent());
- QCOMPARE(navigator.previousItem(2), QMediaContent());
-
- navigator.jump(1);
- QCOMPARE(navigator.currentIndex(), 1);
- QCOMPARE(navigator.currentItem(), content2);
- QCOMPARE(navigator.nextItem(), QMediaContent());
- QCOMPARE(navigator.nextItem(2), QMediaContent());
- QCOMPARE(navigator.previousItem(), content1);
- QCOMPARE(navigator.previousItem(2), QMediaContent());
-
- navigator.jump(0);
- navigator.next();
- QCOMPARE(navigator.currentIndex(), 1);
- navigator.next();
- QCOMPARE(navigator.currentIndex(), -1);
- navigator.next();//jump to the first item
- QCOMPARE(navigator.currentIndex(), 0);
-
- navigator.previous();
- QCOMPARE(navigator.currentIndex(), -1);
- navigator.previous();//jump to the last item
- QCOMPARE(navigator.currentIndex(), 1);
-}
-
-void tst_QMediaPlaylistNavigator::loopPlayback()
-{
- QLocalMediaPlaylistProvider playlist;
- QMediaPlaylistNavigator navigator(&playlist);
-
- navigator.setPlaybackMode(QMediaPlaylist::Loop);
- QTest::ignoreMessage(QtWarningMsg, "QMediaPlaylistNavigator: Jump outside playlist range ");
- navigator.jump(0);
- QVERIFY(navigator.currentItem().isNull());
- QCOMPARE(navigator.currentIndex(), -1);
-
- QMediaContent content1(QUrl(QLatin1String("file:///1")));
- playlist.addMedia(content1);
- navigator.jump(0);
- QVERIFY(!navigator.currentItem().isNull());
-
- QCOMPARE(navigator.currentIndex(), 0);
- QCOMPARE(navigator.currentItem(), content1);
- QCOMPARE(navigator.nextItem(), content1);
- QCOMPARE(navigator.nextItem(2), content1);
- QCOMPARE(navigator.previousItem(), content1);
- QCOMPARE(navigator.previousItem(2), content1);
-
- QMediaContent content2(QUrl(QLatin1String("file:///2")));
- playlist.addMedia(content2);
- QCOMPARE(navigator.currentIndex(), 0);
- QCOMPARE(navigator.currentItem(), content1);
- QCOMPARE(navigator.nextItem(), content2);
- QCOMPARE(navigator.nextItem(2), content1); //loop over end of the list
- QCOMPARE(navigator.previousItem(), content2);
- QCOMPARE(navigator.previousItem(2), content1);
-
- navigator.jump(1);
- QCOMPARE(navigator.currentIndex(), 1);
- QCOMPARE(navigator.currentItem(), content2);
- QCOMPARE(navigator.nextItem(), content1);
- QCOMPARE(navigator.nextItem(2), content2);
- QCOMPARE(navigator.previousItem(), content1);
- QCOMPARE(navigator.previousItem(2), content2);
-
- navigator.jump(0);
- navigator.next();
- QCOMPARE(navigator.currentIndex(), 1);
- navigator.next();
- QCOMPARE(navigator.currentIndex(), 0);
- navigator.previous();
- QCOMPARE(navigator.currentIndex(), 1);
- navigator.previous();
- QCOMPARE(navigator.currentIndex(), 0);
-}
-
-void tst_QMediaPlaylistNavigator::currentItemOnce()
-{
- QLocalMediaPlaylistProvider playlist;
- QMediaPlaylistNavigator navigator(&playlist);
-
- navigator.setPlaybackMode(QMediaPlaylist::CurrentItemOnce);
-
- QCOMPARE(navigator.playbackMode(), QMediaPlaylist::CurrentItemOnce);
- QCOMPARE(navigator.currentIndex(), -1);
-
- playlist.addMedia(QMediaContent(QUrl(QLatin1String("file:///1"))));
- playlist.addMedia(QMediaContent(QUrl(QLatin1String("file:///2"))));
- playlist.addMedia(QMediaContent(QUrl(QLatin1String("file:///3"))));
-
- QCOMPARE(navigator.currentIndex(), -1);
- navigator.next();
- QCOMPARE(navigator.currentIndex(), -1);
-
- navigator.jump(1);
- QCOMPARE(navigator.currentIndex(), 1);
- navigator.next();
- QCOMPARE(navigator.currentIndex(), -1);
- navigator.next();
- QCOMPARE(navigator.currentIndex(), -1);
- navigator.previous();
- QCOMPARE(navigator.currentIndex(), -1);
- navigator.jump(1);
- navigator.previous();
- QCOMPARE(navigator.currentIndex(), -1);
-}
-
-void tst_QMediaPlaylistNavigator::currentItemInLoop()
-{
- QLocalMediaPlaylistProvider playlist;
- QMediaPlaylistNavigator navigator(&playlist);
-
- navigator.setPlaybackMode(QMediaPlaylist::CurrentItemInLoop);
-
- QCOMPARE(navigator.playbackMode(), QMediaPlaylist::CurrentItemInLoop);
- QCOMPARE(navigator.currentIndex(), -1);
-
- playlist.addMedia(QMediaContent(QUrl(QLatin1String("file:///1"))));
- playlist.addMedia(QMediaContent(QUrl(QLatin1String("file:///2"))));
- playlist.addMedia(QMediaContent(QUrl(QLatin1String("file:///3"))));
-
- QCOMPARE(navigator.currentIndex(), -1);
- navigator.next();
- QCOMPARE(navigator.currentIndex(), -1);
- navigator.jump(1);
- navigator.next();
- QCOMPARE(navigator.currentIndex(), 1);
- navigator.next();
- QCOMPARE(navigator.currentIndex(), 1);
- navigator.previous();
- QCOMPARE(navigator.currentIndex(), 1);
- navigator.previous();
- QCOMPARE(navigator.currentIndex(), 1);
-}
-
-void tst_QMediaPlaylistNavigator::randomPlayback()
-{
- QLocalMediaPlaylistProvider playlist;
- QMediaPlaylistNavigator navigator(&playlist);
-
- navigator.setPlaybackMode(QMediaPlaylist::Random);
-
- QCOMPARE(navigator.playbackMode(), QMediaPlaylist::Random);
- QCOMPARE(navigator.currentIndex(), -1);
-
- playlist.addMedia(QMediaContent(QUrl(QLatin1String("file:///1"))));
- playlist.addMedia(QMediaContent(QUrl(QLatin1String("file:///2"))));
- playlist.addMedia(QMediaContent(QUrl(QLatin1String("file:///3"))));
-
- playlist.shuffle();
-
- QCOMPARE(navigator.currentIndex(), -1);
- navigator.next();
- int pos1 = navigator.currentIndex();
- navigator.next();
- int pos2 = navigator.currentIndex();
- navigator.next();
- int pos3 = navigator.currentIndex();
-
- QVERIFY(pos1 != -1);
- QVERIFY(pos2 != -1);
- QVERIFY(pos3 != -1);
-
- navigator.previous();
- QCOMPARE(navigator.currentIndex(), pos2);
- navigator.next();
- QCOMPARE(navigator.currentIndex(), pos3);
- navigator.next();
- int pos4 = navigator.currentIndex();
- navigator.previous();
- QCOMPARE(navigator.currentIndex(), pos3);
- navigator.previous();
- QCOMPARE(navigator.currentIndex(), pos2);
- navigator.previous();
- QCOMPARE(navigator.currentIndex(), pos1);
- navigator.previous();
- int pos0 = navigator.currentIndex();
- QVERIFY(pos0 != -1);
- navigator.next();
- navigator.next();
- navigator.next();
- navigator.next();
- QCOMPARE(navigator.currentIndex(), pos4);
-
-}
-
-QTEST_MAIN(tst_QMediaPlaylistNavigator)
-#include "tst_qmediaplaylistnavigator.moc"
diff --git a/tests/auto/qmediapluginloader/qmediapluginloader.pro b/tests/auto/qmediapluginloader/qmediapluginloader.pro
deleted file mode 100644
index a47cc57..0000000
--- a/tests/auto/qmediapluginloader/qmediapluginloader.pro
+++ /dev/null
@@ -1,6 +0,0 @@
-load(qttest_p4)
-
-SOURCES = tst_qmediapluginloader.cpp
-
-QT = core mediaservices
-
diff --git a/tests/auto/qmediapluginloader/tst_qmediapluginloader.cpp b/tests/auto/qmediapluginloader/tst_qmediapluginloader.cpp
deleted file mode 100644
index 001e68a..0000000
--- a/tests/auto/qmediapluginloader/tst_qmediapluginloader.cpp
+++ /dev/null
@@ -1,121 +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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, 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.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QtTest>
-#include <QDebug>
-
-#include <QtMediaServices/private/qmediapluginloader_p.h>
-#include <QtMediaServices/qmediaserviceproviderplugin.h>
-
-
-
-class tst_QMediaPluginLoader : public QObject
-{
- Q_OBJECT
-
-public slots:
- void initTestCase();
- void cleanupTestCase();
-
-private slots:
- void testInstance();
- void testInstances();
- void testInvalidKey();
-
-private:
- QMediaPluginLoader *loader;
-};
-
-void tst_QMediaPluginLoader::initTestCase()
-{
- loader = new QMediaPluginLoader(QMediaServiceProviderFactoryInterface_iid,
- QLatin1String("/mediaservice"),
- Qt::CaseInsensitive);
-}
-
-void tst_QMediaPluginLoader::cleanupTestCase()
-{
- delete loader;
-}
-
-void tst_QMediaPluginLoader::testInstance()
-{
- const QStringList keys = loader->keys();
-
- if (keys.isEmpty()) // Test is invalidated, skip.
- QSKIP("No plug-ins available", SkipAll);
-
- foreach (const QString &key, keys)
- QVERIFY(loader->instance(key) != 0);
-}
-
-void tst_QMediaPluginLoader::testInstances()
-{
- const QStringList keys = loader->keys();
-
- if (keys.isEmpty()) // Test is invalidated, skip.
- QSKIP("No plug-ins available", SkipAll);
-
- foreach (const QString &key, keys)
- QVERIFY(loader->instances(key).size() > 0);
-}
-
-// Last so as to not interfere with the other tests if there is a failure.
-void tst_QMediaPluginLoader::testInvalidKey()
-{
- const QString key(QLatin1String("invalid-key"));
-
- // This test assumes there is no 'invalid-key' in the key list, verify that.
- if (loader->keys().contains(key))
- QSKIP("a plug-in includes the invalid key", SkipAll);
-
- QVERIFY(loader->instance(key) == 0);
-
- // Test looking up the key hasn't inserted it into the list. See QMap::operator[].
- QVERIFY(!loader->keys().contains(key));
-
- QVERIFY(loader->instances(key).isEmpty());
- QVERIFY(!loader->keys().contains(key));
-}
-
-QTEST_MAIN(tst_QMediaPluginLoader)
-
-#include "tst_qmediapluginloader.moc"
diff --git a/tests/auto/qmediaresource/qmediaresource.pro b/tests/auto/qmediaresource/qmediaresource.pro
deleted file mode 100644
index 64669a2..0000000
--- a/tests/auto/qmediaresource/qmediaresource.pro
+++ /dev/null
@@ -1,6 +0,0 @@
-load(qttest_p4)
-
-SOURCES = tst_qmediaresource.cpp
-
-QT = core mediaservices network
-
diff --git a/tests/auto/qmediaresource/tst_qmediaresource.cpp b/tests/auto/qmediaresource/tst_qmediaresource.cpp
deleted file mode 100644
index 984cfef..0000000
--- a/tests/auto/qmediaresource/tst_qmediaresource.cpp
+++ /dev/null
@@ -1,516 +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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, 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.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QtTest>
-
-#include <QtMediaServices/qmediaresource.h>
-
-
-class tst_QMediaResource : public QObject
-{
- Q_OBJECT
-private slots:
- void constructNull();
- void construct_data();
- void construct();
- void setResolution();
- void equality();
- void copy();
- void assign();
-};
-
-void tst_QMediaResource::constructNull()
-{
- QMediaResource resource;
-
- QCOMPARE(resource.isNull(), true);
- QCOMPARE(resource.url(), QUrl());
- QCOMPARE(resource.request(), QNetworkRequest());
- QCOMPARE(resource.mimeType(), QString());
- 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());
-}
-
-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");
- QTest::addColumn<QString>("videoCodec");
- QTest::addColumn<qint64>("dataSize");
- QTest::addColumn<int>("audioBitRate");
- QTest::addColumn<int>("sampleRate");
- QTest::addColumn<int>("channelCount");
- QTest::addColumn<int>("videoBitRate");
- QTest::addColumn<QSize>("resolution");
-
- 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")
- << QString()
- << qint64(5465433)
- << 128000
- << 44100
- << 2
- << 0
- << 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()
- << QString()
- << qint64(23600)
- << 0
- << 0
- << 0
- << 0
- << 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")
- << QString::fromLatin1("h264")
- << qint64(36245851)
- << 96000
- << 44000
- << 5
- << 750000
- << 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()
- << QString()
- << qint64(2360)
- << 0
- << 0
- << 0
- << 0
- << QSize(128, 128);
-}
-
-void tst_QMediaResource::construct()
-{
- QFETCH(QUrl, url);
- QFETCH(QNetworkRequest, request);
- QFETCH(QString, mimeType);
- QFETCH(QString, language);
- QFETCH(QString, audioCodec);
- QFETCH(QString, videoCodec);
- QFETCH(qint64, dataSize);
- QFETCH(int, audioBitRate);
- QFETCH(int, sampleRate);
- QFETCH(int, channelCount);
- QFETCH(int, videoBitRate);
- QFETCH(QSize, resolution);
-
- {
- QMediaResource resource(url);
-
- QCOMPARE(resource.isNull(), false);
- QCOMPARE(resource.url(), url);
- QCOMPARE(resource.mimeType(), QString());
- 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());
- }
- {
- QMediaResource resource(url, 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());
- 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());
- 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);
- }
-}
-
-void tst_QMediaResource::setResolution()
-{
- QMediaResource resource(
- QUrl(QString::fromLatin1("file::///thumbs/test.png")),
- QString::fromLatin1("image/png"));
-
- QCOMPARE(resource.resolution(), QSize());
-
- resource.setResolution(QSize(120, 80));
- QCOMPARE(resource.resolution(), QSize(120, 80));
-
- resource.setResolution(QSize(-1, 23));
- QCOMPARE(resource.resolution(), QSize(-1, 23));
-
- resource.setResolution(QSize(-43, 34));
- QCOMPARE(resource.resolution(), QSize(-43, 34));
-
- resource.setResolution(QSize(64, -1));
- QCOMPARE(resource.resolution(), QSize(64, -1));
-
- resource.setResolution(QSize(64, -83));
- QCOMPARE(resource.resolution(), QSize(64, -83));
-
- resource.setResolution(QSize(-12, -83));
- QCOMPARE(resource.resolution(), QSize(-12, -83));
-
- resource.setResolution(QSize());
- QCOMPARE(resource.resolution(), QSize(-1, -1));
-
- resource.setResolution(120, 80);
- QCOMPARE(resource.resolution(), QSize(120, 80));
-
- resource.setResolution(-1, 23);
- QCOMPARE(resource.resolution(), QSize(-1, 23));
-
- resource.setResolution(-43, 34);
- QCOMPARE(resource.resolution(), QSize(-43, 34));
-
- resource.setResolution(64, -1);
- QCOMPARE(resource.resolution(), QSize(64, -1));
-
- resource.setResolution(64, -83);
- QCOMPARE(resource.resolution(), QSize(64, -83));
-
- resource.setResolution(-12, -83);
- QCOMPARE(resource.resolution(), QSize(-12, -83));
-
- resource.setResolution(-1, -1);
- QCOMPARE(resource.resolution(), QSize());
-}
-
-void tst_QMediaResource::equality()
-{
- QMediaResource resource1(
- QUrl(QString::fromLatin1("http://test.com/test.mp4")),
- QString::fromLatin1("video/mp4"));
- QMediaResource resource2(
- QUrl(QString::fromLatin1("http://test.com/test.mp4")),
- QString::fromLatin1("video/mp4"));
- QMediaResource resource3(
- QUrl(QString::fromLatin1("file:///thumbs/test.jpg")));
- QMediaResource resource4(
- QUrl(QString::fromLatin1("file:///thumbs/test.jpg")));
- QMediaResource resource5(
- QUrl(QString::fromLatin1("http://test.com/test.mp3")),
- QString::fromLatin1("audio/mpeg"));
-
- QCOMPARE(resource1 == resource2, true);
- QCOMPARE(resource1 != resource2, false);
-
- QCOMPARE(resource3 == resource4, true);
- QCOMPARE(resource3 != resource4, false);
-
- QCOMPARE(resource1 == resource3, false);
- QCOMPARE(resource1 != resource3, true);
-
- QCOMPARE(resource1 == resource5, false);
- QCOMPARE(resource1 != resource5, true);
-
- resource1.setAudioCodec(QString::fromLatin1("mp3"));
- resource2.setAudioCodec(QString::fromLatin1("aac"));
-
- // Not equal differing audio codecs.
- QCOMPARE(resource1 == resource2, false);
- QCOMPARE(resource1 != resource2, true);
-
- resource1.setAudioCodec(QString::fromLatin1("aac"));
-
- // Equal.
- QCOMPARE(resource1 == resource2, true);
- QCOMPARE(resource1 != resource2, false);
-
- resource1.setVideoCodec(QString());
-
- // Equal.
- QCOMPARE(resource1 == resource2, true);
- QCOMPARE(resource1 != resource2, false);
-
- resource1.setVideoCodec(QString::fromLatin1("h264"));
-
- // Not equal differing video codecs.
- QCOMPARE(resource1 == resource2, false);
- QCOMPARE(resource1 != resource2, true);
-
- resource2.setVideoCodec(QString::fromLatin1("h264"));
-
- // Equal.
- QCOMPARE(resource1 == resource2, true);
- QCOMPARE(resource1 != resource2, false);
-
- resource2.setDataSize(0);
-
- // Equal.
- QCOMPARE(resource1 == resource2, true);
- QCOMPARE(resource1 != resource2, false);
-
- resource1.setDataSize(546423);
-
- // Not equal differing video codecs.
- QCOMPARE(resource1 == resource2, false);
- QCOMPARE(resource1 != resource2, true);
-
- resource2.setDataSize(546423);
-
- // Equal.
- QCOMPARE(resource1 == resource2, true);
- QCOMPARE(resource1 != resource2, false);
-
- resource1.setAudioBitRate(96000);
- resource1.setSampleRate(48000);
- resource2.setSampleRate(44100);
- resource1.setChannelCount(0);
- resource1.setVideoBitRate(900000);
- resource2.setLanguage(QString::fromLatin1("eng"));
-
- // Not equal, audio bit rate, sample rate, video bit rate, and
- // language.
- QCOMPARE(resource1 == resource2, false);
- QCOMPARE(resource1 != resource2, true);
-
- resource2.setAudioBitRate(96000);
- resource1.setSampleRate(44100);
-
- // Not equal, differing video bit rate, and language.
- QCOMPARE(resource1 == resource2, false);
- QCOMPARE(resource1 != resource2, true);
-
- resource2.setVideoBitRate(900000);
- resource1.setLanguage(QString::fromLatin1("eng"));
-
- // Equal
- QCOMPARE(resource1 == resource2, true);
- QCOMPARE(resource1 != resource2, false);
-
- resource1.setResolution(QSize());
-
- // Equal
- QCOMPARE(resource1 == resource2, true);
- QCOMPARE(resource1 != resource2, false);
-
- resource2.setResolution(-1, -1);
-
- // Equal
- QCOMPARE(resource1 == resource2, true);
- QCOMPARE(resource1 != resource2, false);
-
- resource1.setResolution(QSize(-640, -480));
-
- // Not equal, differing resolution.
- QCOMPARE(resource1 == resource2, false);
- QCOMPARE(resource1 != resource2, true);
- resource1.setResolution(QSize(640, 480));
- resource2.setResolution(QSize(800, 600));
-
- // Not equal, differing resolution.
- QCOMPARE(resource1 == resource2, false);
- QCOMPARE(resource1 != resource2, true);
-
- resource1.setResolution(800, 600);
-
- // Equal
- QCOMPARE(resource1 == resource2, true);
- QCOMPARE(resource1 != resource2, false);
-}
-
-void tst_QMediaResource::copy()
-{
- const QUrl url(QString::fromLatin1("http://test.com/test.mp4"));
- const QString mimeType(QLatin1String("video/mp4"));
- const QString amrCodec(QLatin1String("amr"));
- const QString mp3Codec(QLatin1String("mp3"));
- const QString aacCodec(QLatin1String("aac"));
- const QString h264Codec(QLatin1String("h264"));
-
- QMediaResource original(url, mimeType);
- original.setAudioCodec(amrCodec);
-
- QMediaResource copy(original);
-
- QCOMPARE(copy.url(), url);
- QCOMPARE(copy.mimeType(), mimeType);
- QCOMPARE(copy.audioCodec(), amrCodec);
-
- QCOMPARE(original == copy, true);
- QCOMPARE(original != copy, false);
-
- original.setAudioCodec(mp3Codec);
-
- QCOMPARE(copy.audioCodec(), amrCodec);
- QCOMPARE(original == copy, false);
- QCOMPARE(original != copy, true);
-
- copy.setAudioCodec(aacCodec);
- copy.setVideoCodec(h264Codec);
-
- QCOMPARE(copy.url(), url);
- QCOMPARE(copy.mimeType(), mimeType);
-
- QCOMPARE(original.audioCodec(), mp3Codec);
-}
-
-void tst_QMediaResource::assign()
-{
- const QUrl url(QString::fromLatin1("http://test.com/test.mp4"));
- const QString mimeType(QLatin1String("video/mp4"));
- const QString amrCodec(QLatin1String("amr"));
- const QString mp3Codec(QLatin1String("mp3"));
- const QString aacCodec(QLatin1String("aac"));
- const QString h264Codec(QLatin1String("h264"));
-
- QMediaResource copy(QUrl(QString::fromLatin1("file:///thumbs/test.jpg")));
-
- QMediaResource original(url, mimeType);
- original.setAudioCodec(amrCodec);
-
- copy = original;
-
- QCOMPARE(copy.url(), url);
- QCOMPARE(copy.mimeType(), mimeType);
- QCOMPARE(copy.audioCodec(), amrCodec);
-
- QCOMPARE(original == copy, true);
- QCOMPARE(original != copy, false);
-
- original.setAudioCodec(mp3Codec);
-
- QCOMPARE(copy.audioCodec(), amrCodec);
- QCOMPARE(original == copy, false);
- QCOMPARE(original != copy, true);
-
- copy.setAudioCodec(aacCodec);
- copy.setVideoCodec(h264Codec);
-
- QCOMPARE(copy.url(), url);
- QCOMPARE(copy.mimeType(), mimeType);
-
- QCOMPARE(original.audioCodec(), mp3Codec);
-}
-
-QTEST_MAIN(tst_QMediaResource)
-
-#include "tst_qmediaresource.moc"
diff --git a/tests/auto/qmediaservice/qmediaservice.pro b/tests/auto/qmediaservice/qmediaservice.pro
deleted file mode 100644
index 8acd03a..0000000
--- a/tests/auto/qmediaservice/qmediaservice.pro
+++ /dev/null
@@ -1,6 +0,0 @@
-load(qttest_p4)
-
-SOURCES = tst_qmediaservice.cpp
-
-QT = core gui mediaservices
-
diff --git a/tests/auto/qmediaservice/tst_qmediaservice.cpp b/tests/auto/qmediaservice/tst_qmediaservice.cpp
deleted file mode 100644
index a544e77..0000000
--- a/tests/auto/qmediaservice/tst_qmediaservice.cpp
+++ /dev/null
@@ -1,219 +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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, 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.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QtTest>
-
-#include <QtMediaServices/qvideodevicecontrol.h>
-#include <QtMediaServices/qmediacontrol.h>
-#include <QtMediaServices/qmediaservice.h>
-
-#include <QtGui/qapplication.h>
-#include <QtGui/qstyle.h>
-
-class QtTestMediaService;
-
-
-class tst_QMediaService : public QObject
-{
- Q_OBJECT
-private slots:
- void initTestCase();
-
- void control_iid();
- void control();
-};
-
-
-class QtTestMediaControlA : public QMediaControl
-{
- Q_OBJECT
-};
-
-
-#define QtTestMediaControlA_iid "com.nokia.QtTestMediaControlA"
-QT_BEGIN_NAMESPACE
-Q_MEDIA_DECLARE_CONTROL(QtTestMediaControlA, QtTestMediaControlA_iid)
-QT_END_NAMESPACE
-
-
-class QtTestMediaControlB : public QMediaControl
-{
- Q_OBJECT
-};
-
-#define QtTestMediaControlB_iid "com.nokia.QtTestMediaControlB"
-QT_BEGIN_NAMESPACE
-Q_MEDIA_DECLARE_CONTROL(QtTestMediaControlB, QtTestMediaControlB_iid)
-QT_END_NAMESPACE
-
-
-class QtTestMediaControlC : public QMediaControl
-{
- Q_OBJECT
-};
-
-#define QtTestMediaControlC_iid "com.nokia.QtTestMediaControlC"
-QT_BEGIN_NAMESPACE
-Q_MEDIA_DECLARE_CONTROL(QtTestMediaControlC, QtTestMediaControlA_iid) // Yes A.
-QT_END_NAMESPACE
-
-class QtTestMediaControlD : public QMediaControl
-{
- Q_OBJECT
-};
-
-#define QtTestMediaControlD_iid "com.nokia.QtTestMediaControlD"
-QT_BEGIN_NAMESPACE
-Q_MEDIA_DECLARE_CONTROL(QtTestMediaControlD, QtTestMediaControlD_iid)
-QT_END_NAMESPACE
-
-class QtTestMediaControlE : public QMediaControl
-{
- Q_OBJECT
-};
-
-struct QtTestDevice
-{
- QtTestDevice() {}
- QtTestDevice(const QString &name, const QString &description, const QIcon &icon)
- : name(name), description(description), icon(icon)
- {
- }
-
- QString name;
- QString description;
- QIcon icon;
-};
-
-class QtTestVideoDeviceControl : public QVideoDeviceControl
-{
-public:
- QtTestVideoDeviceControl(QObject *parent = 0)
- : QVideoDeviceControl(parent)
- , m_selectedDevice(-1)
- , m_defaultDevice(-1)
- {
- }
-
- int deviceCount() const { return devices.count(); }
-
- QString deviceName(int index) const { return devices.value(index).name; }
- QString deviceDescription(int index) const { return devices.value(index).description; }
- QIcon deviceIcon(int index) const { return devices.value(index).icon; }
-
- int defaultDevice() const { return m_defaultDevice; }
- void setDefaultDevice(int index) { m_defaultDevice = index; }
-
- int selectedDevice() const { return m_selectedDevice; }
- void setSelectedDevice(int index)
- {
- emit selectedDeviceChanged(m_selectedDevice = index);
- emit selectedDeviceChanged(devices.value(index).name);
- }
-
- QList<QtTestDevice> devices;
-
-private:
- int m_selectedDevice;
- int m_defaultDevice;
-};
-
-class QtTestMediaService : public QMediaService
-{
- Q_OBJECT
-public:
- QtTestMediaService()
- : QMediaService(0)
- , hasDeviceControls(false)
- {
- }
-
- QMediaControl* control(const char *name) const
- {
- if (strcmp(name, QtTestMediaControlA_iid) == 0)
- return const_cast<QtTestMediaControlA *>(&controlA);
- else if (strcmp(name, QtTestMediaControlB_iid) == 0)
- return const_cast<QtTestMediaControlB *>(&controlB);
- else if (strcmp(name, QtTestMediaControlC_iid) == 0)
- return const_cast<QtTestMediaControlC *>(&controlC);
- else if (hasDeviceControls && strcmp(name, QVideoDeviceControl_iid) == 0)
- return const_cast<QtTestVideoDeviceControl *>(&videoDeviceControl);
- else
- return 0;
- }
-
- using QMediaService::control;
-
- QtTestMediaControlA controlA;
- QtTestMediaControlB controlB;
- QtTestMediaControlC controlC;
- QtTestVideoDeviceControl videoDeviceControl;
- bool hasDeviceControls;
-};
-
-void tst_QMediaService::initTestCase()
-{
-}
-
-void tst_QMediaService::control_iid()
-{
- const char *nullString = 0;
-
- // Default implementation.
- QCOMPARE(qmediacontrol_iid<QtTestMediaControlE *>(), nullString);
-
- // Partial template.
- QVERIFY(qstrcmp(qmediacontrol_iid<QtTestMediaControlA *>(), QtTestMediaControlA_iid) == 0);
-}
-
-void tst_QMediaService::control()
-{
- QtTestMediaService service;
-
- QCOMPARE(service.control<QtTestMediaControlA *>(), &service.controlA);
- QCOMPARE(service.control<QtTestMediaControlB *>(), &service.controlB);
- QVERIFY(!service.control<QtTestMediaControlC *>()); // Faulty implementation returns A.
- QVERIFY(!service.control<QtTestMediaControlD *>()); // No control of that type.
-}
-
-QTEST_MAIN(tst_QMediaService)
-
-#include "tst_qmediaservice.moc"
diff --git a/tests/auto/qmediaserviceprovider/qmediaserviceprovider.pro b/tests/auto/qmediaserviceprovider/qmediaserviceprovider.pro
deleted file mode 100644
index 69b3864..0000000
--- a/tests/auto/qmediaserviceprovider/qmediaserviceprovider.pro
+++ /dev/null
@@ -1,6 +0,0 @@
-load(qttest_p4)
-
-SOURCES = tst_qmediaserviceprovider.cpp
-
-QT = core gui mediaservices
-
diff --git a/tests/auto/qmediaserviceprovider/tst_qmediaserviceprovider.cpp b/tests/auto/qmediaserviceprovider/tst_qmediaserviceprovider.cpp
deleted file mode 100644
index 64abedb..0000000
--- a/tests/auto/qmediaserviceprovider/tst_qmediaserviceprovider.cpp
+++ /dev/null
@@ -1,481 +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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, 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.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QtTest>
-#include <QDebug>
-#include <QStringList>
-
-#include <QtMediaServices/qmediaserviceprovider.h>
-#include <QtMediaServices/qmediaserviceproviderplugin.h>
-#include <QtMediaServices/private/qmediapluginloader_p.h>
-#include <QtMediaServices/qmediaobject.h>
-#include <QtMediaServices/qmediaservice.h>
-#include <QtMediaServices/qmediaplayer.h>
-
-class MockMediaService : public QMediaService
-{
- Q_OBJECT
-public:
- MockMediaService(const QString& name, QObject *parent = 0) : QMediaService(parent)
- { setObjectName(name); }
- ~MockMediaService() {}
-
- QMediaControl* control(const char *) const {return 0;}
-};
-
-class MockServicePlugin1 : public QMediaServiceProviderPlugin,
- public QMediaServiceSupportedFormatsInterface,
- public QMediaServiceSupportedDevicesInterface
-{
- Q_OBJECT
- Q_INTERFACES(QMediaServiceSupportedFormatsInterface)
- Q_INTERFACES(QMediaServiceSupportedDevicesInterface)
-public:
- QStringList keys() const
- {
- return QStringList() <<
- QLatin1String(Q_MEDIASERVICE_MEDIAPLAYER);
- }
-
- QMediaService* create(QString const& key)
- {
- if (keys().contains(key))
- return new MockMediaService("MockServicePlugin1");
- else
- return 0;
- }
-
- void release(QMediaService *service)
- {
- delete service;
- }
-
- QtMediaServices::SupportEstimate hasSupport(const QString &mimeType, const QStringList& codecs) const
- {
- if (codecs.contains(QLatin1String("mpeg4")))
- return QtMediaServices::NotSupported;
-
- if (mimeType == "audio/ogg") {
- return QtMediaServices::ProbablySupported;
- }
-
- return QtMediaServices::MaybeSupported;
- }
-
- QStringList supportedMimeTypes() const
- {
- return QStringList("audio/ogg");
- }
-
- QList<QByteArray> devices(const QByteArray &service) const
- {
- Q_UNUSED(service);
- QList<QByteArray> res;
- return res;
- }
-
- QString deviceDescription(const QByteArray &service, const QByteArray &device)
- {
- if (devices(service).contains(device))
- return QString(device)+" description";
- else
- return QString();
- }
-};
-
-class MockServicePlugin2 : public QMediaServiceProviderPlugin,
- public QMediaServiceSupportedFormatsInterface,
- public QMediaServiceFeaturesInterface
-{
- Q_OBJECT
- Q_INTERFACES(QMediaServiceSupportedFormatsInterface)
- Q_INTERFACES(QMediaServiceFeaturesInterface)
-public:
- QStringList keys() const
- {
- return QStringList() << QLatin1String(Q_MEDIASERVICE_MEDIAPLAYER);
- }
-
- QMediaService* create(QString const& key)
- {
- if (keys().contains(key))
- return new MockMediaService("MockServicePlugin2");
- else
- return 0;
- }
-
- void release(QMediaService *service)
- {
- delete service;
- }
-
- QtMediaServices::SupportEstimate hasSupport(const QString &mimeType, const QStringList& codecs) const
- {
- Q_UNUSED(codecs);
-
- if (mimeType == "audio/wav")
- return QtMediaServices::PreferredService;
-
- return QtMediaServices::NotSupported;
- }
-
- QStringList supportedMimeTypes() const
- {
- return QStringList("audio/wav");
- }
-
- QMediaServiceProviderHint::Features supportedFeatures(const QByteArray &service) const
- {
- if (service == QByteArray(Q_MEDIASERVICE_MEDIAPLAYER))
- return QMediaServiceProviderHint::LowLatencyPlayback;
- else
- return 0;
- }
-};
-
-
-class MockServicePlugin3 : public QMediaServiceProviderPlugin,
- public QMediaServiceSupportedDevicesInterface
-{
- Q_OBJECT
- Q_INTERFACES(QMediaServiceSupportedDevicesInterface)
-public:
- QStringList keys() const
- {
- return QStringList() <<
- QLatin1String(Q_MEDIASERVICE_MEDIAPLAYER);
- }
-
- QMediaService* create(QString const& key)
- {
- if (keys().contains(key))
- return new MockMediaService("MockServicePlugin3");
- else
- return 0;
- }
-
- void release(QMediaService *service)
- {
- delete service;
- }
-
- QList<QByteArray> devices(const QByteArray &service) const
- {
- Q_UNUSED(service);
- QList<QByteArray> res;
- return res;
- }
-
- QString deviceDescription(const QByteArray &service, const QByteArray &device)
- {
- if (devices(service).contains(device))
- return QString(device)+" description";
- else
- return QString();
- }
-};
-
-class MockServicePlugin4 : public QMediaServiceProviderPlugin,
- public QMediaServiceSupportedFormatsInterface,
- public QMediaServiceFeaturesInterface
-{
- Q_OBJECT
- Q_INTERFACES(QMediaServiceSupportedFormatsInterface)
- Q_INTERFACES(QMediaServiceFeaturesInterface)
-public:
- QStringList keys() const
- {
- return QStringList() << QLatin1String(Q_MEDIASERVICE_MEDIAPLAYER);
- }
-
- QMediaService* create(QString const& key)
- {
- if (keys().contains(key))
- return new MockMediaService("MockServicePlugin4");
- else
- return 0;
- }
-
- void release(QMediaService *service)
- {
- delete service;
- }
-
- QtMediaServices::SupportEstimate hasSupport(const QString &mimeType, const QStringList& codecs) const
- {
- if (codecs.contains(QLatin1String("jpeg2000")))
- return QtMediaServices::NotSupported;
-
- if (supportedMimeTypes().contains(mimeType))
- return QtMediaServices::ProbablySupported;
-
- return QtMediaServices::MaybeSupported;
- }
-
- QStringList supportedMimeTypes() const
- {
- return QStringList() << "video/mp4" << "video/quicktime";
- }
-
- QMediaServiceProviderHint::Features supportedFeatures(const QByteArray &service) const
- {
- if (service == QByteArray(Q_MEDIASERVICE_MEDIAPLAYER))
- return QMediaServiceProviderHint::StreamPlayback;
- else
- return 0;
- }
-};
-
-
-
-class MockMediaServiceProvider : public QMediaServiceProvider
-{
- QMediaService* requestService(const QByteArray &type, const QMediaServiceProviderHint &)
- {
- Q_UNUSED(type);
- return 0;
- }
-
- void releaseService(QMediaService *service)
- {
- Q_UNUSED(service);
- }
-};
-
-
-class tst_QMediaServiceProvider : public QObject
-{
- Q_OBJECT
-
-public slots:
- void initTestCase();
-
-private slots:
- void testDefaultProviderAvailable();
- void testObtainService();
- void testHasSupport();
- void testSupportedMimeTypes();
- void testProviderHints();
-
-private:
- QObjectList plugins;
-};
-
-void tst_QMediaServiceProvider::initTestCase()
-{
- plugins << new MockServicePlugin1;
- plugins << new MockServicePlugin2;
- plugins << new MockServicePlugin3;
- plugins << new MockServicePlugin4;
-
- QMediaPluginLoader::setStaticPlugins(QLatin1String("/mediaservices"), plugins);
-}
-
-void tst_QMediaServiceProvider::testDefaultProviderAvailable()
-{
- // Must always be a default provider available
- QVERIFY(QMediaServiceProvider::defaultServiceProvider() != 0);
-}
-
-void tst_QMediaServiceProvider::testObtainService()
-{
- QMediaServiceProvider *provider = QMediaServiceProvider::defaultServiceProvider();
-
- if (provider == 0)
- QSKIP("No default provider", SkipSingle);
-
- QMediaService *service = 0;
-
- // Player
- service = provider->requestService(Q_MEDIASERVICE_MEDIAPLAYER);
- QVERIFY(service != 0);
- provider->releaseService(service);
-}
-
-void tst_QMediaServiceProvider::testHasSupport()
-{
- MockMediaServiceProvider mockProvider;
- QCOMPARE(mockProvider.hasSupport(QByteArray(Q_MEDIASERVICE_MEDIAPLAYER), "video/ogv", QStringList()),
- QtMediaServices::MaybeSupported);
-
- QMediaServiceProvider *provider = QMediaServiceProvider::defaultServiceProvider();
-
- if (provider == 0)
- QSKIP("No default provider", SkipSingle);
-
- QCOMPARE(provider->hasSupport(QByteArray(Q_MEDIASERVICE_MEDIAPLAYER), "video/ogv", QStringList()),
- QtMediaServices::MaybeSupported);
-
- QCOMPARE(provider->hasSupport(QByteArray(Q_MEDIASERVICE_MEDIAPLAYER), "audio/ogg", QStringList()),
- QtMediaServices::ProbablySupported);
-
- //while the service returns PreferredService, provider should return ProbablySupported
- QCOMPARE(provider->hasSupport(QByteArray(Q_MEDIASERVICE_MEDIAPLAYER), "audio/wav", QStringList()),
- QtMediaServices::ProbablySupported);
-
- //even while all the plugins with "hasSupport" returned NotSupported,
- //MockServicePlugin3 has no "hasSupport" interface, so MaybeSupported
- QCOMPARE(provider->hasSupport(QByteArray(Q_MEDIASERVICE_MEDIAPLAYER), "video/avi",
- QStringList() << "mpeg4"),
- QtMediaServices::MaybeSupported);
-
- QCOMPARE(provider->hasSupport(QByteArray("non existing service"), "video/ogv", QStringList()),
- QtMediaServices::NotSupported);
-
- QCOMPARE(QMediaPlayer::hasSupport("video/ogv"), QtMediaServices::MaybeSupported);
- QCOMPARE(QMediaPlayer::hasSupport("audio/ogg"), QtMediaServices::ProbablySupported);
- QCOMPARE(QMediaPlayer::hasSupport("audio/wav"), QtMediaServices::ProbablySupported);
-
- //test low latency flag support
- QCOMPARE(QMediaPlayer::hasSupport("audio/wav", QStringList(), QMediaPlayer::LowLatency),
- QtMediaServices::ProbablySupported);
- //plugin1 probably supports audio/ogg, it checked because it doesn't provide features iface
- QCOMPARE(QMediaPlayer::hasSupport("audio/ogg", QStringList(), QMediaPlayer::LowLatency),
- QtMediaServices::ProbablySupported);
- //Plugin4 is not checked here, sine it's known not support low latency
- QCOMPARE(QMediaPlayer::hasSupport("video/quicktime", QStringList(), QMediaPlayer::LowLatency),
- QtMediaServices::MaybeSupported);
-
- //test streaming flag support
- QCOMPARE(QMediaPlayer::hasSupport("video/quicktime", QStringList(), QMediaPlayer::StreamPlayback),
- QtMediaServices::ProbablySupported);
- //Plugin2 is not checked here, sine it's known not support streaming
- QCOMPARE(QMediaPlayer::hasSupport("audio/wav", QStringList(), QMediaPlayer::StreamPlayback),
- QtMediaServices::MaybeSupported);
-
- //ensure the correct media player plugin is choosen for mime type
- QMediaPlayer simplePlayer(0, QMediaPlayer::LowLatency);
- QCOMPARE(simplePlayer.service()->objectName(), QLatin1String("MockServicePlugin2"));
-
- QMediaPlayer mediaPlayer;
- QVERIFY(mediaPlayer.service()->objectName() != QLatin1String("MockServicePlugin2"));
-
- QMediaPlayer streamPlayer(0, QMediaPlayer::StreamPlayback);
- QCOMPARE(streamPlayer.service()->objectName(), QLatin1String("MockServicePlugin4"));
-}
-
-void tst_QMediaServiceProvider::testSupportedMimeTypes()
-{
- QMediaServiceProvider *provider = QMediaServiceProvider::defaultServiceProvider();
-
- if (provider == 0)
- QSKIP("No default provider", SkipSingle);
-
- QVERIFY(provider->supportedMimeTypes(QByteArray(Q_MEDIASERVICE_MEDIAPLAYER)).contains("audio/ogg"));
- QVERIFY(!provider->supportedMimeTypes(QByteArray(Q_MEDIASERVICE_MEDIAPLAYER)).contains("audio/mp3"));
-}
-
-void tst_QMediaServiceProvider::testProviderHints()
-{
- {
- QMediaServiceProviderHint hint;
- QVERIFY(hint.isNull());
- QCOMPARE(hint.type(), QMediaServiceProviderHint::Null);
- QVERIFY(hint.device().isEmpty());
- QVERIFY(hint.mimeType().isEmpty());
- QVERIFY(hint.codecs().isEmpty());
- QCOMPARE(hint.features(), 0);
- }
-
- {
- QByteArray deviceName(QByteArray("testDevice"));
- QMediaServiceProviderHint hint(deviceName);
- QVERIFY(!hint.isNull());
- QCOMPARE(hint.type(), QMediaServiceProviderHint::Device);
- QCOMPARE(hint.device(), deviceName);
- QVERIFY(hint.mimeType().isEmpty());
- QVERIFY(hint.codecs().isEmpty());
- QCOMPARE(hint.features(), 0);
- }
-
- {
- QMediaServiceProviderHint hint(QMediaServiceProviderHint::LowLatencyPlayback);
- QVERIFY(!hint.isNull());
- QCOMPARE(hint.type(), QMediaServiceProviderHint::SupportedFeatures);
- QVERIFY(hint.device().isEmpty());
- QVERIFY(hint.mimeType().isEmpty());
- QVERIFY(hint.codecs().isEmpty());
- QCOMPARE(hint.features(), QMediaServiceProviderHint::LowLatencyPlayback);
- }
-
- {
- QString mimeType(QLatin1String("video/ogg"));
- QStringList codecs;
- codecs << "theora" << "vorbis";
-
- QMediaServiceProviderHint hint(mimeType,codecs);
- QVERIFY(!hint.isNull());
- QCOMPARE(hint.type(), QMediaServiceProviderHint::ContentType);
- QVERIFY(hint.device().isEmpty());
- QCOMPARE(hint.mimeType(), mimeType);
- QCOMPARE(hint.codecs(), codecs);
-
- QMediaServiceProviderHint hint2(hint);
-
- QVERIFY(!hint2.isNull());
- QCOMPARE(hint2.type(), QMediaServiceProviderHint::ContentType);
- QVERIFY(hint2.device().isEmpty());
- QCOMPARE(hint2.mimeType(), mimeType);
- QCOMPARE(hint2.codecs(), codecs);
-
- QMediaServiceProviderHint hint3;
- QVERIFY(hint3.isNull());
- hint3 = hint;
- QVERIFY(!hint3.isNull());
- QCOMPARE(hint3.type(), QMediaServiceProviderHint::ContentType);
- QVERIFY(hint3.device().isEmpty());
- QCOMPARE(hint3.mimeType(), mimeType);
- QCOMPARE(hint3.codecs(), codecs);
-
- QCOMPARE(hint, hint2);
- QCOMPARE(hint3, hint2);
-
- QMediaServiceProviderHint hint4(mimeType,codecs);
- QCOMPARE(hint, hint4);
-
- QMediaServiceProviderHint hint5(mimeType,QStringList());
- QVERIFY(hint != hint5);
- }
-}
-
-QTEST_MAIN(tst_QMediaServiceProvider)
-
-#include "tst_qmediaserviceprovider.moc"
diff --git a/tests/auto/qmediatimerange/qmediatimerange.pro b/tests/auto/qmediatimerange/qmediatimerange.pro
deleted file mode 100644
index c5e74ce..0000000
--- a/tests/auto/qmediatimerange/qmediatimerange.pro
+++ /dev/null
@@ -1,6 +0,0 @@
-load(qttest_p4)
-
-SOURCES = tst_qmediatimerange.cpp
-
-QT = core mediaservices
-
diff --git a/tests/auto/qmediatimerange/tst_qmediatimerange.cpp b/tests/auto/qmediatimerange/tst_qmediatimerange.cpp
deleted file mode 100644
index a21abe2..0000000
--- a/tests/auto/qmediatimerange/tst_qmediatimerange.cpp
+++ /dev/null
@@ -1,735 +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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, 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.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QtTest>
-#include <QtCore/qdebug.h>
-
-#include <QtMediaServices/qmediatimerange.h>
-
-class tst_QMediaTimeRange: public QObject
-{
- Q_OBJECT
-
-public slots:
-
-private slots:
- void testCtor();
- void testGetters();
- void testAssignment();
- void testNormalize();
- void testTranslated();
- void testEarliestLatest();
- void testContains();
- void testAddInterval();
- void testAddTimeRange();
- void testRemoveInterval();
- void testRemoveTimeRange();
- void testClear();
- void testComparisons();
- void testArithmetic();
-};
-
-void tst_QMediaTimeRange::testCtor()
-{
- // Default Ctor
- QMediaTimeRange a;
- QVERIFY(a.isEmpty());
-
- // (qint, qint) Ctor
- QMediaTimeRange b(10, 20);
-
- QVERIFY(!b.isEmpty());
- QVERIFY(b.isContinuous());
- QVERIFY(b.earliestTime() == 10);
- QVERIFY(b.latestTime() == 20);
-
- // Interval Ctor
- QMediaTimeRange c(QMediaTimeInterval(30, 40));
-
- QVERIFY(!c.isEmpty());
- QVERIFY(c.isContinuous());
- QVERIFY(c.earliestTime() == 30);
- QVERIFY(c.latestTime() == 40);
-
- // Abnormal Interval Ctor
- QMediaTimeRange d(QMediaTimeInterval(20, 10));
-
- QVERIFY(d.isEmpty());
-
- // Copy Ctor
- QMediaTimeRange e(b);
-
- QVERIFY(!e.isEmpty());
- QVERIFY(e.isContinuous());
- QVERIFY(e.earliestTime() == 10);
- QVERIFY(e.latestTime() == 20);
-}
-
-void tst_QMediaTimeRange::testGetters()
-{
- QMediaTimeRange x;
-
- // isEmpty
- QVERIFY(x.isEmpty());
-
- x.addInterval(10, 20);
-
- // isEmpty + isContinuous
- QVERIFY(!x.isEmpty());
- QVERIFY(x.isContinuous());
-
- x.addInterval(30, 40);
-
- // isEmpty + isContinuous + intervals + start + end
- QVERIFY(!x.isEmpty());
- QVERIFY(!x.isContinuous());
- QVERIFY(x.intervals().count() == 2);
- QVERIFY(x.intervals()[0].start() == 10);
- QVERIFY(x.intervals()[0].end() == 20);
- QVERIFY(x.intervals()[1].start() == 30);
- QVERIFY(x.intervals()[1].end() == 40);
-}
-
-void tst_QMediaTimeRange::testAssignment()
-{
- QMediaTimeRange x;
-
- // Range Assignment
- x = QMediaTimeRange(10, 20);
-
- QVERIFY(!x.isEmpty());
- QVERIFY(x.isContinuous());
- QVERIFY(x.earliestTime() == 10);
- QVERIFY(x.latestTime() == 20);
-
- // Interval Assignment
- x = QMediaTimeInterval(30, 40);
-
- QVERIFY(!x.isEmpty());
- QVERIFY(x.isContinuous());
- QVERIFY(x.earliestTime() == 30);
- QVERIFY(x.latestTime() == 40);
-
- // Shared Data Check
- QMediaTimeRange y;
-
- y = x;
- y.addInterval(10, 20);
-
- QVERIFY(!x.isEmpty());
- QVERIFY(x.isContinuous());
- QVERIFY(x.earliestTime() == 30);
- QVERIFY(x.latestTime() == 40);
-}
-
-void tst_QMediaTimeRange::testNormalize()
-{
- QMediaTimeInterval x(20, 10);
-
- QVERIFY(!x.isNormal());
-
- x = x.normalized();
-
- QVERIFY(x.isNormal());
- QVERIFY(x.start() == 10);
- QVERIFY(x.end() == 20);
-}
-
-void tst_QMediaTimeRange::testTranslated()
-{
- QMediaTimeInterval x(10, 20);
- x = x.translated(10);
-
- QVERIFY(x.start() == 20);
- QVERIFY(x.end() == 30);
-}
-
-void tst_QMediaTimeRange::testEarliestLatest()
-{
- // Test over a single interval
- QMediaTimeRange x(30, 40);
-
- QVERIFY(x.earliestTime() == 30);
- QVERIFY(x.latestTime() == 40);
-
- // Test over multiple intervals
- x.addInterval(50, 60);
-
- QVERIFY(x.earliestTime() == 30);
- QVERIFY(x.latestTime() == 60);
-}
-
-void tst_QMediaTimeRange::testContains()
-{
- // Test over a single interval
- QMediaTimeRange x(10, 20);
-
- QVERIFY(!x.isEmpty());
- QVERIFY(x.isContinuous());
- QVERIFY(x.contains(15));
- QVERIFY(x.contains(10));
- QVERIFY(x.contains(20));
- QVERIFY(!x.contains(25));
-
- // Test over multiple intervals
- x.addInterval(40, 50);
-
- QVERIFY(!x.isEmpty());
- QVERIFY(!x.isContinuous());
- QVERIFY(x.contains(15));
- QVERIFY(x.contains(45));
- QVERIFY(!x.contains(30));
-
- // Test over a concrete interval
- QMediaTimeInterval y(10, 20);
- QVERIFY(y.contains(15));
- QVERIFY(y.contains(10));
- QVERIFY(y.contains(20));
- QVERIFY(!y.contains(25));
-}
-
-void tst_QMediaTimeRange::testAddInterval()
-{
- // All intervals Overlap
- QMediaTimeRange x;
- x.addInterval(10, 40);
- x.addInterval(30, 50);
- x.addInterval(20, 60);
-
- QVERIFY(!x.isEmpty());
- QVERIFY(x.isContinuous());
- QVERIFY(x.earliestTime() == 10);
- QVERIFY(x.latestTime() == 60);
-
- // 1 adjacent interval, 1 encompassed interval
- x = QMediaTimeRange();
- x.addInterval(10, 40);
- x.addInterval(20, 30);
- x.addInterval(41, 50);
-
- QVERIFY(!x.isEmpty());
- QVERIFY(x.isContinuous());
- QVERIFY(x.earliestTime() == 10);
- QVERIFY(x.latestTime() == 50);
-
- // 1 overlapping interval, 1 disjoint interval
- x = QMediaTimeRange();
- x.addInterval(10, 30);
- x.addInterval(20, 40);
- x.addInterval(50, 60);
-
- QVERIFY(!x.isEmpty());
- QVERIFY(!x.isContinuous());
- QVERIFY(x.intervals().count() == 2);
- QVERIFY(x.intervals()[0].start() == 10);
- QVERIFY(x.intervals()[0].end() == 40);
- QVERIFY(x.intervals()[1].start() == 50);
- QVERIFY(x.intervals()[1].end() == 60);
-
- // Identical Add
- x = QMediaTimeRange();
- x.addInterval(10, 20);
- x.addInterval(10, 20);
-
- QVERIFY(!x.isEmpty());
- QVERIFY(x.isContinuous());
- QVERIFY(x.earliestTime() == 10);
- QVERIFY(x.latestTime() == 20);
-
- // Multi-Merge
- x = QMediaTimeRange();
- x.addInterval(10, 20);
- x.addInterval(30, 40);
- x.addInterval(50, 60);
- x.addInterval(15, 55);
-
- QVERIFY(!x.isEmpty());
- QVERIFY(x.isContinuous());
- QVERIFY(x.earliestTime() == 10);
- QVERIFY(x.latestTime() == 60);
-
- // Interval Parameter - All intervals Overlap
- x = QMediaTimeRange();
- x.addInterval(QMediaTimeInterval(10, 40));
- x.addInterval(QMediaTimeInterval(30, 50));
- x.addInterval(QMediaTimeInterval(20, 60));
-
- QVERIFY(!x.isEmpty());
- QVERIFY(x.isContinuous());
- QVERIFY(x.earliestTime() == 10);
- QVERIFY(x.latestTime() == 60);
-
- // Interval Parameter - Abnormal Interval
- x = QMediaTimeRange();
- x.addInterval(QMediaTimeInterval(20, 10));
-
- QVERIFY(x.isEmpty());
-}
-
-void tst_QMediaTimeRange::testAddTimeRange()
-{
- // Add Time Range uses Add Interval internally,
- // so in this test the focus is on combinations of number
- // of intervals added, rather than the different types of
- // merges which can occur.
- QMediaTimeRange a, b;
-
- // Add Single into Single
- a = QMediaTimeRange(10, 30);
- b = QMediaTimeRange(20, 40);
-
- b.addTimeRange(a);
-
- QVERIFY(!b.isEmpty());
- QVERIFY(b.isContinuous());
- QVERIFY(b.earliestTime() == 10);
- QVERIFY(b.latestTime() == 40);
-
- // Add Multiple into Single
- a = QMediaTimeRange();
- a.addInterval(10, 30);
- a.addInterval(40, 60);
-
- b = QMediaTimeRange(20, 50);
-
- b.addTimeRange(a);
-
- QVERIFY(!b.isEmpty());
- QVERIFY(b.isContinuous());
- QVERIFY(b.earliestTime() == 10);
- QVERIFY(b.latestTime() == 60);
-
- // Add Single into Multiple
- a = QMediaTimeRange(20, 50);
-
- b = QMediaTimeRange();
- b.addInterval(10, 30);
- b.addInterval(40, 60);
-
- b.addTimeRange(a);
-
- QVERIFY(!b.isEmpty());
- QVERIFY(b.isContinuous());
- QVERIFY(b.earliestTime() == 10);
- QVERIFY(b.latestTime() == 60);
-
- // Add Multiple into Multiple
- a = QMediaTimeRange();
- a.addInterval(10, 30);
- a.addInterval(40, 70);
- a.addInterval(80, 100);
-
- b = QMediaTimeRange();
- b.addInterval(20, 50);
- b.addInterval(60, 90);
-
- b.addTimeRange(a);
-
- QVERIFY(!b.isEmpty());
- QVERIFY(b.isContinuous());
- QVERIFY(b.earliestTime() == 10);
- QVERIFY(b.latestTime() == 100);
-
- // Add Nothing to Single
- a = QMediaTimeRange();
- b = QMediaTimeRange(10, 20);
-
- b.addTimeRange(a);
-
- QVERIFY(!b.isEmpty());
- QVERIFY(b.isContinuous());
- QVERIFY(b.earliestTime() == 10);
- QVERIFY(b.latestTime() == 20);
-
- // Add Single to Nothing
- a = QMediaTimeRange(10, 20);
- b = QMediaTimeRange();
-
- b.addTimeRange(a);
-
- QVERIFY(!b.isEmpty());
- QVERIFY(b.isContinuous());
- QVERIFY(b.earliestTime() == 10);
- QVERIFY(b.latestTime() == 20);
-
- // Add Nothing to Nothing
- a = QMediaTimeRange();
- b = QMediaTimeRange();
-
- b.addTimeRange(a);
-
- QVERIFY(b.isEmpty());
-}
-
-void tst_QMediaTimeRange::testRemoveInterval()
-{
- // Removing an interval, causing a split
- QMediaTimeRange x;
- x.addInterval(10, 50);
- x.removeInterval(20, 40);
-
- QVERIFY(!x.isEmpty());
- QVERIFY(!x.isContinuous());
- QVERIFY(x.intervals().count() == 2);
- QVERIFY(x.intervals()[0].start() == 10);
- QVERIFY(x.intervals()[0].end() == 19);
- QVERIFY(x.intervals()[1].start() == 41);
- QVERIFY(x.intervals()[1].end() == 50);
-
- // Removing an interval, causing a deletion
- x = QMediaTimeRange();
- x.addInterval(20, 30);
- x.removeInterval(10, 40);
-
- QVERIFY(x.isEmpty());
-
- // Removing an interval, causing a tail trim
- x = QMediaTimeRange();
- x.addInterval(20, 40);
- x.removeInterval(30, 50);
-
- QVERIFY(!x.isEmpty());
- QVERIFY(x.isContinuous());
- QVERIFY(x.earliestTime() == 20);
- QVERIFY(x.latestTime() == 29);
-
- // Removing an interval, causing a head trim
- x = QMediaTimeRange();
- x.addInterval(20, 40);
- x.removeInterval(10, 30);
-
- QVERIFY(!x.isEmpty());
- QVERIFY(x.isContinuous());
- QVERIFY(x.earliestTime() == 31);
- QVERIFY(x.latestTime() == 40);
-
- // Identical Remove
- x = QMediaTimeRange();
- x.addInterval(10, 20);
- x.removeInterval(10, 20);
-
- QVERIFY(x.isEmpty());
-
- // Multi-Trim
- x = QMediaTimeRange();
- x.addInterval(10, 20);
- x.addInterval(30, 40);
- x.removeInterval(15, 35);
-
- QVERIFY(!x.isEmpty());
- QVERIFY(!x.isContinuous());
- QVERIFY(x.intervals().count() == 2);
- QVERIFY(x.intervals()[0].start() == 10);
- QVERIFY(x.intervals()[0].end() == 14);
- QVERIFY(x.intervals()[1].start() == 36);
- QVERIFY(x.intervals()[1].end() == 40);
-
- // Multi-Delete
- x = QMediaTimeRange();
- x.addInterval(10, 20);
- x.addInterval(30, 40);
- x.addInterval(50, 60);
- x.removeInterval(10, 60);
-
- QVERIFY(x.isEmpty());
-
- // Interval Parameter - Removing an interval, causing a split
- x = QMediaTimeRange();
- x.addInterval(10, 50);
- x.removeInterval(QMediaTimeInterval(20, 40));
-
- QVERIFY(!x.isEmpty());
- QVERIFY(!x.isContinuous());
- QVERIFY(x.intervals().count() == 2);
- QVERIFY(x.intervals()[0].start() == 10);
- QVERIFY(x.intervals()[0].end() == 19);
- QVERIFY(x.intervals()[1].start() == 41);
- QVERIFY(x.intervals()[1].end() == 50);
-
- // Interval Parameter - Abnormal Interval
- x = QMediaTimeRange();
- x.addInterval(10, 40);
- x.removeInterval(QMediaTimeInterval(30, 20));
-
- QVERIFY(!x.isEmpty());
- QVERIFY(x.isContinuous());
- QVERIFY(x.earliestTime() == 10);
- QVERIFY(x.latestTime() == 40);
-}
-
-void tst_QMediaTimeRange::testRemoveTimeRange()
-{
- // Remove Time Range uses Remove Interval internally,
- // so in this test the focus is on combinations of number
- // of intervals removed, rather than the different types of
- // deletions which can occur.
- QMediaTimeRange a, b;
-
- // Remove Single from Single
- a = QMediaTimeRange(10, 30);
- b = QMediaTimeRange(20, 40);
-
- b.removeTimeRange(a);
-
- QVERIFY(!b.isEmpty());
- QVERIFY(b.isContinuous());
- QVERIFY(b.earliestTime() == 31);
- QVERIFY(b.latestTime() == 40);
-
- // Remove Multiple from Single
- a = QMediaTimeRange();
- a.addInterval(10, 30);
- a.addInterval(40, 60);
-
- b = QMediaTimeRange(20, 50);
-
- b.removeTimeRange(a);
-
- QVERIFY(!b.isEmpty());
- QVERIFY(b.isContinuous());
- QVERIFY(b.earliestTime() == 31);
- QVERIFY(b.latestTime() == 39);
-
- // Remove Single from Multiple
- a = QMediaTimeRange(20, 50);
-
- b = QMediaTimeRange();
- b.addInterval(10, 30);
- b.addInterval(40, 60);
-
- b.removeTimeRange(a);
-
- QVERIFY(!b.isEmpty());
- QVERIFY(!b.isContinuous());
- QVERIFY(b.intervals().count() == 2);
- QVERIFY(b.intervals()[0].start() == 10);
- QVERIFY(b.intervals()[0].end() == 19);
- QVERIFY(b.intervals()[1].start() == 51);
- QVERIFY(b.intervals()[1].end() == 60);
-
- // Remove Multiple from Multiple
- a = QMediaTimeRange();
- a.addInterval(20, 50);
- a.addInterval(50, 90);
-
-
- b = QMediaTimeRange();
- b.addInterval(10, 30);
- b.addInterval(40, 70);
- b.addInterval(80, 100);
-
- b.removeTimeRange(a);
-
- QVERIFY(!b.isEmpty());
- QVERIFY(!b.isContinuous());
- QVERIFY(b.intervals().count() == 2);
- QVERIFY(b.intervals()[0].start() == 10);
- QVERIFY(b.intervals()[0].end() == 19);
- QVERIFY(b.intervals()[1].start() == 91);
- QVERIFY(b.intervals()[1].end() == 100);
-
- // Remove Nothing from Single
- a = QMediaTimeRange();
- b = QMediaTimeRange(10, 20);
-
- b.removeTimeRange(a);
-
- QVERIFY(!b.isEmpty());
- QVERIFY(b.isContinuous());
- QVERIFY(b.earliestTime() == 10);
- QVERIFY(b.latestTime() == 20);
-
- // Remove Single from Nothing
- a = QMediaTimeRange(10, 20);
- b = QMediaTimeRange();
-
- b.removeTimeRange(a);
-
- QVERIFY(b.isEmpty());
-
- // Remove Nothing from Nothing
- a = QMediaTimeRange();
- b = QMediaTimeRange();
-
- b.removeTimeRange(a);
-
- QVERIFY(b.isEmpty());
-}
-
-void tst_QMediaTimeRange::testClear()
-{
- QMediaTimeRange x;
-
- // Clear Nothing
- x.clear();
-
- QVERIFY(x.isEmpty());
-
- // Clear Single
- x = QMediaTimeRange(10, 20);
- x.clear();
-
- QVERIFY(x.isEmpty());
-
- // Clear Multiple
- x = QMediaTimeRange();
- x.addInterval(10, 20);
- x.addInterval(30, 40);
- x.clear();
-
- QVERIFY(x.isEmpty());
-}
-
-void tst_QMediaTimeRange::testComparisons()
-{
- // Interval equality
- QVERIFY(QMediaTimeInterval(10, 20) == QMediaTimeInterval(10, 20));
- QVERIFY(QMediaTimeInterval(10, 20) != QMediaTimeInterval(10, 30));
- QVERIFY(!(QMediaTimeInterval(10, 20) != QMediaTimeInterval(10, 20)));
- QVERIFY(!(QMediaTimeInterval(10, 20) == QMediaTimeInterval(10, 30)));
-
- // Time range equality - Single Interval
- QMediaTimeRange a(10, 20), b(20, 30), c(10, 20);
-
- QVERIFY(a == c);
- QVERIFY(!(a == b));
- QVERIFY(a != b);
- QVERIFY(!(a != c));
-
- // Time Range Equality - Multiple Intervals
- QMediaTimeRange x, y, z;
-
- x.addInterval(10, 20);
- x.addInterval(30, 40);
- x.addInterval(50, 60);
-
- y.addInterval(10, 20);
- y.addInterval(35, 45);
- y.addInterval(50, 60);
-
- z.addInterval(10, 20);
- z.addInterval(30, 40);
- z.addInterval(50, 60);
-
- QVERIFY(x == z);
- QVERIFY(!(x == y));
- QVERIFY(x != y);
- QVERIFY(!(x != z));
-}
-
-void tst_QMediaTimeRange::testArithmetic()
-{
- QMediaTimeRange a(10, 20), b(20, 30);
-
- // Test +=
- a += b;
-
- QVERIFY(a.isContinuous());
- QVERIFY(a.earliestTime() == 10);
- QVERIFY(a.latestTime() == 30);
-
- // Test -=
- a -= b;
-
- QVERIFY(a.isContinuous());
- QVERIFY(a.earliestTime() == 10);
- QVERIFY(a.latestTime() == 19);
-
- // Test += and -= on intervals
- a -= QMediaTimeInterval(10, 20);
- a += QMediaTimeInterval(40, 50);
-
- QVERIFY(a.isContinuous());
- QVERIFY(a.earliestTime() == 40);
- QVERIFY(a.latestTime() == 50);
-
- // Test Interval + Interval
- a = QMediaTimeInterval(10, 20) + QMediaTimeInterval(20, 30);
- QVERIFY(a.isContinuous());
- QVERIFY(a.earliestTime() == 10);
- QVERIFY(a.latestTime() == 30);
-
- // Test Range + Interval
- a = a + QMediaTimeInterval(30, 40);
- QVERIFY(a.isContinuous());
- QVERIFY(a.earliestTime() == 10);
- QVERIFY(a.latestTime() == 40);
-
- // Test Interval + Range
- a = QMediaTimeInterval(40, 50) + a;
- QVERIFY(a.isContinuous());
- QVERIFY(a.earliestTime() == 10);
- QVERIFY(a.latestTime() == 50);
-
- // Test Range + Range
- a = a + QMediaTimeRange(50, 60);
- QVERIFY(a.isContinuous());
- QVERIFY(a.earliestTime() == 10);
- QVERIFY(a.latestTime() == 60);
-
- // Test Range - Interval
- a = a - QMediaTimeInterval(50, 60);
- QVERIFY(a.isContinuous());
- QVERIFY(a.earliestTime() == 10);
- QVERIFY(a.latestTime() == 49);
-
- // Test Range - Range
- a = a - QMediaTimeRange(40, 50);
- QVERIFY(a.isContinuous());
- QVERIFY(a.earliestTime() == 10);
- QVERIFY(a.latestTime() == 39);
-
- // Test Interval - Range
- b = QMediaTimeInterval(0, 20) - a;
- QVERIFY(b.isContinuous());
- QVERIFY(b.earliestTime() == 0);
- QVERIFY(b.latestTime() == 9);
-
- // Test Interval - Interval
- a = QMediaTimeInterval(10, 20) - QMediaTimeInterval(15, 30);
- QVERIFY(a.isContinuous());
- QVERIFY(a.earliestTime() == 10);
- QVERIFY(a.latestTime() == 14);
-}
-
-QTEST_MAIN(tst_QMediaTimeRange)
-
-#include "tst_qmediatimerange.moc"
diff --git a/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp b/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp
index a3cccb2..e66719a 100644
--- a/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp
+++ b/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp
@@ -52,7 +52,7 @@
*/
#include <QNetworkAccessManager>
-#if defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5)
+#if defined(Q_OS_UNIX) && !defined(QT_NO_ICD)
#include <stdio.h>
#include <iapconf.h>
#endif
@@ -73,7 +73,7 @@ private slots:
void isRoamingAvailable();
private:
-#if defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5)
+#if defined(Q_OS_UNIX) && !defined(QT_NO_ICD)
Maemo::IAPConf *iapconf;
Maemo::IAPConf *iapconf2;
Maemo::IAPConf *gprsiap;
@@ -85,7 +85,7 @@ private:
void tst_QNetworkConfiguration::initTestCase()
{
-#if defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5)
+#if defined(Q_OS_UNIX) && !defined(QT_NO_ICD)
iapconf = new Maemo::IAPConf("007");
iapconf->setValue("ipv4_type", "AUTO");
iapconf->setValue("wlan_wepkey1", "connt");
@@ -158,7 +158,7 @@ void tst_QNetworkConfiguration::initTestCase()
void tst_QNetworkConfiguration::cleanupTestCase()
{
-#if defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5)
+#if defined(Q_OS_UNIX) && !defined(QT_NO_ICD)
iapconf->clear();
delete iapconf;
iapconf2->clear();
diff --git a/tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp b/tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp
index 7cc527c..c732a5b 100644
--- a/tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp
+++ b/tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp
@@ -45,7 +45,7 @@
#include <QtNetwork/qnetworkconfiguration.h>
#include <QtNetwork/qnetworkconfigmanager.h>
-#if defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5)
+#if defined(Q_OS_UNIX) && !defined(QT_NO_ICD)
#include <stdio.h>
#include <iapconf.h>
#endif
@@ -67,7 +67,7 @@ private slots:
void configurationFromIdentifier();
private:
-#if defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5)
+#if defined(Q_OS_UNIX) && !defined(QT_NO_ICD)
Maemo::IAPConf *iapconf;
Maemo::IAPConf *iapconf2;
Maemo::IAPConf *gprsiap;
@@ -79,7 +79,7 @@ private:
void tst_QNetworkConfigurationManager::initTestCase()
{
-#if defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5)
+#if defined(Q_OS_UNIX) && !defined(QT_NO_ICD)
iapconf = new Maemo::IAPConf("007");
iapconf->setValue("ipv4_type", "AUTO");
iapconf->setValue("wlan_wepkey1", "connt");
@@ -153,7 +153,7 @@ void tst_QNetworkConfigurationManager::initTestCase()
void tst_QNetworkConfigurationManager::cleanupTestCase()
{
-#if defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5)
+#if defined(Q_OS_UNIX) && !defined(QT_NO_ICD)
iapconf->clear();
delete iapconf;
iapconf2->clear();
diff --git a/tests/auto/qnetworksession/test/tst_qnetworksession.cpp b/tests/auto/qnetworksession/test/tst_qnetworksession.cpp
index 934a50e..e4f2486 100644
--- a/tests/auto/qnetworksession/test/tst_qnetworksession.cpp
+++ b/tests/auto/qnetworksession/test/tst_qnetworksession.cpp
@@ -48,7 +48,7 @@
#include <QtNetwork/qnetworkconfigmanager.h>
#include <QtNetwork/qnetworksession.h>
-#if defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5)
+#if defined(Q_OS_UNIX) && !defined(QT_NO_ICD)
#include <stdio.h>
#include <iapconf.h>
#endif
@@ -104,7 +104,7 @@ private:
int inProcessSessionManagementCount;
-#if defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5)
+#if defined(Q_OS_UNIX) && !defined(QT_NO_ICD)
Maemo::IAPConf *iapconf;
Maemo::IAPConf *iapconf2;
Maemo::IAPConf *gprsiap;
@@ -140,7 +140,7 @@ void tst_QNetworkSession::initTestCase()
testsToRun["userChoiceSession"] = true;
testsToRun["sessionOpenCloseStop"] = true;
-#if defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5)
+#if defined(Q_OS_UNIX) && !defined(QT_NO_ICD)
iapconf = new Maemo::IAPConf("007");
iapconf->setValue("ipv4_type", "AUTO");
iapconf->setValue("wlan_wepkey1", "connt");
@@ -226,7 +226,7 @@ void tst_QNetworkSession::cleanupTestCase()
"inProcessSessionManagement()");
}
-#if defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5)
+#if defined(Q_OS_UNIX) && !defined(QT_NO_ICD)
iapconf->clear();
delete iapconf;
iapconf2->clear();
diff --git a/tests/auto/qsoundeffect/qsoundeffect.pro b/tests/auto/qsoundeffect/qsoundeffect.pro
deleted file mode 100644
index 5344a16..0000000
--- a/tests/auto/qsoundeffect/qsoundeffect.pro
+++ /dev/null
@@ -1,20 +0,0 @@
-load(qttest_p4)
-
-SOURCES += tst_qsoundeffect.cpp
-
-QT = core multimedia mediaservices
-
-wince* {
- deploy.sources += 4.wav
- DEPLOYMENT = deploy
- DEFINES += SRCDIR=\\\"\\\"
- QT += gui
-} else {
- DEFINES += SRCDIR=\\\"$$PWD/\\\"
-}
-
-unix:!mac {
- !contains(QT_CONFIG, pulseaudio) {
- DEFINES += QT_MULTIMEDIA_QMEDIAPLAYER
- }
-}
diff --git a/tests/auto/qsoundeffect/test.wav b/tests/auto/qsoundeffect/test.wav
deleted file mode 100644
index e4088a9..0000000
--- a/tests/auto/qsoundeffect/test.wav
+++ /dev/null
Binary files differ
diff --git a/tests/auto/qsoundeffect/tst_qsoundeffect.cpp b/tests/auto/qsoundeffect/tst_qsoundeffect.cpp
deleted file mode 100644
index e76a4c5..0000000
--- a/tests/auto/qsoundeffect/tst_qsoundeffect.cpp
+++ /dev/null
@@ -1,144 +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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, 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.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-
-#include <QtTest/QtTest>
-#include <QtCore/qlocale.h>
-#include <qaudiooutput.h>
-#include <qaudiodeviceinfo.h>
-#include <qaudio.h>
-#include <private/qsoundeffect_p.h>
-
-
-class tst_QSoundEffect : public QObject
-{
- Q_OBJECT
-public:
- tst_QSoundEffect(QObject* parent=0) : QObject(parent) {}
-
-private slots:
- void initTestCase();
- void testSource();
- void testLooping();
- void testVolume();
- void testMuting();
-
-private:
- QSoundEffect* sound;
-};
-
-void tst_QSoundEffect::initTestCase()
-{
-#ifndef QT_MULTIMEDIA_QMEDIAPLAYER
- sound = new QSoundEffect;
-
- QVERIFY(sound->source().isEmpty());
- QVERIFY(sound->loops() == 1);
- QVERIFY(sound->volume() == 100);
- QVERIFY(sound->isMuted() == false);
-#endif
-}
-
-void tst_QSoundEffect::testSource()
-{
-#ifndef QT_MULTIMEDIA_QMEDIAPLAYER
- QSignalSpy readSignal(sound, SIGNAL(sourceChanged()));
-
- QUrl url = QUrl::fromLocalFile(QString("%1%2").arg(SRCDIR).arg("test.wav"));
- sound->setSource(url);
-
- QCOMPARE(sound->source(),url);
- QCOMPARE(readSignal.count(),1);
-
- QTestEventLoop::instance().enterLoop(1);
- sound->play();
-
- QTest::qWait(3000);
-#endif
-}
-
-void tst_QSoundEffect::testLooping()
-{
-#ifndef QT_MULTIMEDIA_QMEDIAPLAYER
- QSignalSpy readSignal(sound, SIGNAL(loopsChanged()));
-
- sound->setLoops(5);
- QCOMPARE(sound->loops(),5);
-
- sound->play();
-
- // test.wav is about 200ms, wait until it has finished playing 5 times
- QTest::qWait(3000);
-#endif
-}
-
-void tst_QSoundEffect::testVolume()
-{
-#ifndef QT_MULTIMEDIA_QMEDIAPLAYER
- QSignalSpy readSignal(sound, SIGNAL(volumeChanged()));
-
- sound->setVolume(50);
- QCOMPARE(sound->volume(),50);
-
- QTest::qWait(20);
- QCOMPARE(readSignal.count(),1);
-#endif
-}
-
-void tst_QSoundEffect::testMuting()
-{
-#ifndef QT_MULTIMEDIA_QMEDIAPLAYER
- QSignalSpy readSignal(sound, SIGNAL(mutedChanged()));
-
- sound->setMuted(true);
- QCOMPARE(sound->isMuted(),true);
-
- QTest::qWait(20);
- QCOMPARE(readSignal.count(),1);
-
- delete sound;
-#endif
-}
-
-QTEST_MAIN(tst_QSoundEffect)
-
-#include "tst_qsoundeffect.moc"
diff --git a/tests/auto/qvideowidget/qvideowidget.pro b/tests/auto/qvideowidget/qvideowidget.pro
deleted file mode 100644
index 12686f3..0000000
--- a/tests/auto/qvideowidget/qvideowidget.pro
+++ /dev/null
@@ -1,6 +0,0 @@
-load(qttest_p4)
-
-SOURCES = tst_qvideowidget.cpp
-
-QT = core gui multimedia mediaservices
-
diff --git a/tests/auto/qvideowidget/tst_qvideowidget.cpp b/tests/auto/qvideowidget/tst_qvideowidget.cpp
deleted file mode 100644
index 8a54789..0000000
--- a/tests/auto/qvideowidget/tst_qvideowidget.cpp
+++ /dev/null
@@ -1,1602 +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 test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, 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.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QtTest>
-
-#include <QtMediaServices/qvideowidget.h>
-
-#include <QtMediaServices/qmediaobject.h>
-#include <QtMediaServices/qmediaservice.h>
-#include <QtMediaServices/private/qpaintervideosurface_p.h>
-#include <QtMediaServices/qvideooutputcontrol.h>
-#include <QtMediaServices/qvideowindowcontrol.h>
-#include <QtMediaServices/qvideowidgetcontrol.h>
-#include <QtMediaServices/qvideorenderercontrol.h>
-#include <QtMultimedia/qabstractvideosurface.h>
-#include <QtMultimedia/qvideosurfaceformat.h>
-
-#include <QtGui/qapplication.h>
-
-
-class tst_QVideoWidget : public QObject
-{
- Q_OBJECT
-private slots:
- void nullObject();
- void nullService();
- void nullOutputControl();
- void noOutputs();
- void serviceDestroyed();
- void objectDestroyed();
- void setMediaObject();
-
- void showWindowControl();
- void aspectRatioWindowControl();
- void sizeHintWindowControl_data() { sizeHint_data(); }
- void sizeHintWindowControl();
- void brightnessWindowControl_data() { color_data(); }
- void brightnessWindowControl();
- void contrastWindowControl_data() { color_data(); }
- void contrastWindowControl();
- void hueWindowControl_data() { color_data(); }
- void hueWindowControl();
- void saturationWindowControl_data() { color_data(); }
- void saturationWindowControl();
-
- void showWidgetControl();
- void aspectRatioWidgetControl();
- void sizeHintWidgetControl_data() { sizeHint_data(); }
- void sizeHintWidgetControl();
- void brightnessWidgetControl_data() { color_data(); }
- void brightnessWidgetControl();
- void contrastWidgetControl_data() { color_data(); }
- void contrastWidgetControl();
- void hueWidgetControl_data() { color_data(); }
- void hueWidgetControl();
- void saturationWidgetControl_data() { color_data(); }
- void saturationWidgetControl();
-
- void showRendererControl();
- void aspectRatioRendererControl();
- void sizeHintRendererControl_data();
- void sizeHintRendererControl();
- void brightnessRendererControl_data() { color_data(); }
- void brightnessRendererControl();
- void contrastRendererControl_data() { color_data(); }
- void contrastRendererControl();
- void hueRendererControl_data() { color_data(); }
- void hueRendererControl();
- void saturationRendererControl_data() { color_data(); }
- void saturationRendererControl();
-
- void paintRendererControl();
-
-#ifndef Q_WS_X11
- void fullScreenWindowControl();
- void fullScreenWidgetControl();
- void fullScreenRendererControl();
-#endif
-
-private:
- void sizeHint_data();
- void color_data();
-};
-
-Q_DECLARE_METATYPE(Qt::AspectRatioMode)
-Q_DECLARE_METATYPE(const uchar *)
-
-class QtTestOutputControl : public QVideoOutputControl
-{
-public:
- QtTestOutputControl() : m_output(NoOutput) {}
-
- QList<Output> availableOutputs() const { return m_outputs; }
- void setAvailableOutputs(const QList<Output> outputs) { m_outputs = outputs; }
-
- Output output() const { return m_output; }
- virtual void setOutput(Output output) { m_output = output; }
-
-private:
- Output m_output;
- QList<Output> m_outputs;
-};
-
-class QtTestWindowControl : public QVideoWindowControl
-{
-public:
- QtTestWindowControl()
- : m_winId(0)
- , m_repaintCount(0)
- , m_brightness(0)
- , m_contrast(0)
- , m_saturation(0)
- , m_aspectRatioMode(Qt::KeepAspectRatio)
- , m_fullScreen(0)
- {
- }
-
- WId winId() const { return m_winId; }
- void setWinId(WId id) { m_winId = id; }
-
- QRect displayRect() const { return m_displayRect; }
- void setDisplayRect(const QRect &rect) { m_displayRect = rect; }
-
- bool isFullScreen() const { return m_fullScreen; }
- void setFullScreen(bool fullScreen) { emit fullScreenChanged(m_fullScreen = fullScreen); }
-
- int repaintCount() const { return m_repaintCount; }
- void setRepaintCount(int count) { m_repaintCount = count; }
- void repaint() { ++m_repaintCount; }
-
- QSize nativeSize() const { return m_nativeSize; }
- void setNativeSize(const QSize &size) { m_nativeSize = size; emit nativeSizeChanged(); }
-
- Qt::AspectRatioMode aspectRatioMode() const { return m_aspectRatioMode; }
- void setAspectRatioMode(Qt::AspectRatioMode mode) { m_aspectRatioMode = mode; }
-
- int brightness() const { return m_brightness; }
- void setBrightness(int brightness) { emit brightnessChanged(m_brightness = brightness); }
-
- int contrast() const { return m_contrast; }
- void setContrast(int contrast) { emit contrastChanged(m_contrast = contrast); }
-
- int hue() const { return m_hue; }
- void setHue(int hue) { emit hueChanged(m_hue = hue); }
-
- int saturation() const { return m_saturation; }
- void setSaturation(int saturation) { emit saturationChanged(m_saturation = saturation); }
-
-private:
- WId m_winId;
- int m_repaintCount;
- int m_brightness;
- int m_contrast;
- int m_hue;
- int m_saturation;
- Qt::AspectRatioMode m_aspectRatioMode;
- QRect m_displayRect;
- QSize m_nativeSize;
- bool m_fullScreen;
-};
-
-class QtTestWidgetControl : public QVideoWidgetControl
-{
-public:
- QtTestWidgetControl()
- : m_brightness(1.0)
- , m_contrast(1.0)
- , m_hue(1.0)
- , m_saturation(1.0)
- , m_aspectRatioMode(Qt::KeepAspectRatio)
- , m_fullScreen(false)
- {
- }
-
- bool isFullScreen() const { return m_fullScreen; }
- void setFullScreen(bool fullScreen) { emit fullScreenChanged(m_fullScreen = fullScreen); }
-
- Qt::AspectRatioMode aspectRatioMode() const { return m_aspectRatioMode; }
- void setAspectRatioMode(Qt::AspectRatioMode mode) { m_aspectRatioMode = mode; }
-
- int brightness() const { return m_brightness; }
- void setBrightness(int brightness) { emit brightnessChanged(m_brightness = brightness); }
-
- int contrast() const { return m_contrast; }
- void setContrast(int contrast) { emit contrastChanged(m_contrast = contrast); }
-
- int hue() const { return m_hue; }
- void setHue(int hue) { emit hueChanged(m_hue = hue); }
-
- int saturation() const { return m_saturation; }
- void setSaturation(int saturation) { emit saturationChanged(m_saturation = saturation); }
-
- void setSizeHint(const QSize &size) { m_widget.setSizeHint(size); }
-
- QWidget *videoWidget() { return &m_widget; }
-
-private:
- class Widget : public QWidget
- {
- public:
- QSize sizeHint() const { return m_sizeHint; }
- void setSizeHint(const QSize &size) { m_sizeHint = size; updateGeometry(); }
- private:
- QSize m_sizeHint;
- } m_widget;
- int m_brightness;
- int m_contrast;
- int m_hue;
- int m_saturation;
- Qt::AspectRatioMode m_aspectRatioMode;
- QSize m_sizeHint;
- bool m_fullScreen;
-};
-
-class QtTestRendererControl : public QVideoRendererControl
-{
-public:
- QtTestRendererControl()
- : m_surface(0)
- {
- }
-
- QAbstractVideoSurface *surface() const { return m_surface; }
- void setSurface(QAbstractVideoSurface *surface) { m_surface = surface; }
-
-private:
- QAbstractVideoSurface *m_surface;
-};
-
-class QtTestVideoService : public QMediaService
-{
- Q_OBJECT
-public:
- QtTestVideoService(
- QtTestOutputControl *output,
- QtTestWindowControl *window,
- QtTestWidgetControl *widget,
- QtTestRendererControl *renderer)
- : QMediaService(0)
- , outputControl(output)
- , windowControl(window)
- , widgetControl(widget)
- , rendererControl(renderer)
- {
- }
-
- ~QtTestVideoService()
- {
- delete outputControl;
- delete windowControl;
- delete widgetControl;
- delete rendererControl;
- }
-
- QMediaControl *control(const char *name) const
- {
- if (qstrcmp(name, QVideoOutputControl_iid) == 0)
- return outputControl;
- else if (qstrcmp(name, QVideoWindowControl_iid) == 0)
- return windowControl;
- else if (qstrcmp(name, QVideoWidgetControl_iid) == 0)
- return widgetControl;
- else if (qstrcmp(name, QVideoRendererControl_iid) == 0)
- return rendererControl;
- else
- return 0;
- }
-
- QtTestOutputControl *outputControl;
- QtTestWindowControl *windowControl;
- QtTestWidgetControl *widgetControl;
- QtTestRendererControl *rendererControl;
-};
-
-class QtTestVideoObject : public QMediaObject
-{
- Q_OBJECT
-public:
- QtTestVideoObject(
- QtTestWindowControl *window,
- QtTestWidgetControl *widget,
- QtTestRendererControl *renderer):
- QMediaObject(0, new QtTestVideoService(new QtTestOutputControl, window, widget, renderer))
- {
- testService = qobject_cast<QtTestVideoService*>(service());
- QList<QVideoOutputControl::Output> outputs;
-
- if (window)
- outputs.append(QVideoOutputControl::WindowOutput);
- if (widget)
- outputs.append(QVideoOutputControl::WidgetOutput);
- if (renderer)
- outputs.append(QVideoOutputControl::RendererOutput);
-
- testService->outputControl->setAvailableOutputs(outputs);
- }
-
- QtTestVideoObject(QtTestVideoService *service):
- QMediaObject(0, service),
- testService(service)
- {
- }
-
- ~QtTestVideoObject()
- {
- delete testService;
- }
-
- QtTestVideoService *testService;
-};
-
-void tst_QVideoWidget::nullObject()
-{
- QVideoWidget widget;
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
-
- QVERIFY(widget.sizeHint().isEmpty());
-
- widget.setFullScreen(true);
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(widget.isFullScreen(), true);
-
- widget.setAspectRatioMode(Qt::IgnoreAspectRatio);
- QCOMPARE(widget.aspectRatioMode(), Qt::IgnoreAspectRatio);
-
- {
- QSignalSpy spy(&widget, SIGNAL(brightnessChanged(int)));
-
- widget.setBrightness(100);
- QCOMPARE(widget.brightness(), 100);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.value(0).value(0).toInt(), 100);
-
- widget.setBrightness(100);
- QCOMPARE(widget.brightness(), 100);
- QCOMPARE(spy.count(), 1);
-
- widget.setBrightness(-120);
- QCOMPARE(widget.brightness(), -100);
- QCOMPARE(spy.count(), 2);
- QCOMPARE(spy.value(1).value(0).toInt(), -100);
- } {
- QSignalSpy spy(&widget, SIGNAL(contrastChanged(int)));
-
- widget.setContrast(100);
- QCOMPARE(widget.contrast(), 100);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.value(0).value(0).toInt(), 100);
-
- widget.setContrast(100);
- QCOMPARE(widget.contrast(), 100);
- QCOMPARE(spy.count(), 1);
-
- widget.setContrast(-120);
- QCOMPARE(widget.contrast(), -100);
- QCOMPARE(spy.count(), 2);
- QCOMPARE(spy.value(1).value(0).toInt(), -100);
- } {
- QSignalSpy spy(&widget, SIGNAL(hueChanged(int)));
-
- widget.setHue(100);
- QCOMPARE(widget.hue(), 100);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.value(0).value(0).toInt(), 100);
-
- widget.setHue(100);
- QCOMPARE(widget.hue(), 100);
- QCOMPARE(spy.count(), 1);
-
- widget.setHue(-120);
- QCOMPARE(widget.hue(), -100);
- QCOMPARE(spy.count(), 2);
- QCOMPARE(spy.value(1).value(0).toInt(), -100);
- } {
- QSignalSpy spy(&widget, SIGNAL(saturationChanged(int)));
-
- widget.setSaturation(100);
- QCOMPARE(widget.saturation(), 100);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.value(0).value(0).toInt(), 100);
-
- widget.setSaturation(100);
- QCOMPARE(widget.saturation(), 100);
- QCOMPARE(spy.count(), 1);
-
- widget.setSaturation(-120);
- QCOMPARE(widget.saturation(), -100);
- QCOMPARE(spy.count(), 2);
- QCOMPARE(spy.value(1).value(0).toInt(), -100);
- }
-}
-
-void tst_QVideoWidget::nullService()
-{
- QtTestVideoObject object(0);
-
- QVideoWidget widget;
- widget.setMediaObject(&object);
-
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
-
- QVERIFY(widget.sizeHint().isEmpty());
-
- widget.setFullScreen(true);
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(widget.isFullScreen(), true);
-
- widget.setAspectRatioMode(Qt::IgnoreAspectRatio);
- QCOMPARE(widget.aspectRatioMode(), Qt::IgnoreAspectRatio);
-
- widget.setBrightness(100);
- QCOMPARE(widget.brightness(), 100);
-
- widget.setContrast(100);
- QCOMPARE(widget.contrast(), 100);
-
- widget.setHue(100);
- QCOMPARE(widget.hue(), 100);
-
- widget.setSaturation(100);
- QCOMPARE(widget.saturation(), 100);
-}
-
-void tst_QVideoWidget::nullOutputControl()
-{
- QtTestVideoObject object(new QtTestVideoService(0, 0, 0, 0));
-
- QVideoWidget widget;
- widget.setMediaObject(&object);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
-
- QVERIFY(widget.sizeHint().isEmpty());
-
- widget.setFullScreen(true);
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(widget.isFullScreen(), true);
-
- widget.setBrightness(100);
- QCOMPARE(widget.brightness(), 100);
-
- widget.setContrast(100);
- QCOMPARE(widget.contrast(), 100);
-
- widget.setHue(100);
- QCOMPARE(widget.hue(), 100);
-
- widget.setSaturation(100);
- QCOMPARE(widget.saturation(), 100);
-}
-
-void tst_QVideoWidget::noOutputs()
-{
- QtTestVideoObject object(0, 0, 0);
-
- QVideoWidget widget;
- widget.setMediaObject(&object);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
-
- QVERIFY(widget.sizeHint().isEmpty());
-
- widget.setFullScreen(true);
- QCOMPARE(widget.isFullScreen(), true);
-
- widget.setBrightness(100);
- QCOMPARE(widget.brightness(), 100);
-
- widget.setContrast(100);
- QCOMPARE(widget.contrast(), 100);
-
- widget.setHue(100);
- QCOMPARE(widget.hue(), 100);
-
- widget.setSaturation(100);
- QCOMPARE(widget.saturation(), 100);
-}
-
-void tst_QVideoWidget::serviceDestroyed()
-{
- QtTestVideoObject object(new QtTestWindowControl, new QtTestWidgetControl, 0);
-
- QVideoWidget widget;
- widget.setMediaObject(&object);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
-
- widget.show();
- QTest::qWaitForWindowShown(&widget);
-
- widget.setBrightness(100);
- widget.setContrast(100);
- widget.setHue(100);
- widget.setSaturation(100);
-
- delete object.testService;
- object.testService = 0;
-
- QCOMPARE(widget.mediaObject(), static_cast<QMediaObject *>(&object));
-
- QCOMPARE(widget.brightness(), 100);
- QCOMPARE(widget.contrast(), 100);
- QCOMPARE(widget.hue(), 100);
- QCOMPARE(widget.saturation(), 100);
-
- widget.setFullScreen(true);
- QCOMPARE(widget.isFullScreen(), true);
-}
-
-void tst_QVideoWidget::objectDestroyed()
-{
- QtTestVideoObject *object = new QtTestVideoObject(
- new QtTestWindowControl,
- new QtTestWidgetControl,
- 0);
-
- QVideoWidget widget;
- widget.setMediaObject(object);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
-
- widget.show();
- QTest::qWaitForWindowShown(&widget);
-
- widget.setBrightness(100);
- widget.setContrast(100);
- widget.setHue(100);
- widget.setSaturation(100);
-
- // Delete the media object without deleting the service.
- QtTestVideoService *service = object->testService;
- object->testService = 0;
-
- delete object;
- object = 0;
-
- QCOMPARE(widget.mediaObject(), static_cast<QMediaObject *>(object));
-
- QCOMPARE(service->outputControl->output(), QVideoOutputControl::NoOutput);
-
- QCOMPARE(widget.brightness(), 100);
- QCOMPARE(widget.contrast(), 100);
- QCOMPARE(widget.hue(), 100);
- QCOMPARE(widget.saturation(), 100);
-
- widget.setFullScreen(true);
- QCOMPARE(widget.isFullScreen(), true);
-
- delete service;
-}
-
-void tst_QVideoWidget::setMediaObject()
-{
- QMediaObject *nullObject = 0;
- QtTestVideoObject windowObject(new QtTestWindowControl, 0, 0);
- QtTestVideoObject widgetObject(0, new QtTestWidgetControl, 0);
- QtTestVideoObject rendererObject(0, 0, new QtTestRendererControl);
-
- QVideoWidget widget;
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
-
- widget.show();
- QTest::qWaitForWindowShown(&widget);
-
- QCOMPARE(widget.mediaObject(), nullObject);
- QCOMPARE(windowObject.testService->outputControl->output(), QVideoOutputControl::NoOutput);
- QCOMPARE(widgetObject.testService->outputControl->output(), QVideoOutputControl::NoOutput);
- QCOMPARE(rendererObject.testService->outputControl->output(), QVideoOutputControl::NoOutput);
-
- widget.setMediaObject(&windowObject);
- QCOMPARE(widget.mediaObject(), static_cast<QMediaObject *>(&windowObject));
- QCOMPARE(windowObject.testService->outputControl->output(), QVideoOutputControl::WindowOutput);
- QVERIFY(windowObject.testService->windowControl->winId() != 0);
-
-
- widget.setMediaObject(&widgetObject);
- QCOMPARE(widget.mediaObject(), static_cast<QMediaObject *>(&widgetObject));
- QCOMPARE(widgetObject.testService->outputControl->output(), QVideoOutputControl::WidgetOutput);
-
- QCoreApplication::processEvents(QEventLoop::AllEvents);
- QCOMPARE(widgetObject.testService->widgetControl->videoWidget()->isVisible(), true);
-
- QCOMPARE(windowObject.testService->outputControl->output(), QVideoOutputControl::NoOutput);
-
- widget.setMediaObject(&rendererObject);
- QCOMPARE(widget.mediaObject(), static_cast<QMediaObject *>(&rendererObject));
- QCOMPARE(rendererObject.testService->outputControl->output(), QVideoOutputControl::RendererOutput);
- QVERIFY(rendererObject.testService->rendererControl->surface() != 0);
-
- QCOMPARE(widgetObject.testService->outputControl->output(), QVideoOutputControl::NoOutput);
-
- widget.setMediaObject(0);
- QCOMPARE(widget.mediaObject(), nullObject);
-
- QCOMPARE(rendererObject.testService->outputControl->output(), QVideoOutputControl::NoOutput);
-}
-
-void tst_QVideoWidget::showWindowControl()
-{
- QtTestVideoObject object(new QtTestWindowControl, 0, 0);
- object.testService->windowControl->setNativeSize(QSize(240, 180));
-
- QVideoWidget widget;
- widget.setMediaObject(&object);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
-
- QCOMPARE(object.testService->outputControl->output(), QVideoOutputControl::NoOutput);
-
- widget.show();
- QTest::qWaitForWindowShown(&widget);
-
- QCOMPARE(object.testService->outputControl->output(), QVideoOutputControl::WindowOutput);
- QVERIFY(object.testService->windowControl->winId() != 0);
-
- QVERIFY(object.testService->windowControl->repaintCount() > 0);
-
- widget.resize(640, 480);
- QCOMPARE(object.testService->windowControl->displayRect(), QRect(0, 0, 640, 480));
-
- widget.move(10, 10);
- QCOMPARE(object.testService->windowControl->displayRect(), QRect(0, 0, 640, 480));
-
- widget.hide();
-
- QCOMPARE(object.testService->outputControl->output(), QVideoOutputControl::WindowOutput);
-}
-
-void tst_QVideoWidget::showWidgetControl()
-{
- QtTestVideoObject object(0, new QtTestWidgetControl, 0);
- QVideoWidget widget;
- widget.setMediaObject(&object);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
-
- QCOMPARE(object.testService->outputControl->output(), QVideoOutputControl::NoOutput);
-
- widget.show();
- QTest::qWaitForWindowShown(&widget);
-
- QCOMPARE(object.testService->outputControl->output(), QVideoOutputControl::WidgetOutput);
- QCOMPARE(object.testService->widgetControl->videoWidget()->isVisible(), true);
-
- widget.resize(640, 480);
-
- widget.move(10, 10);
-
- widget.hide();
-
- QCOMPARE(object.testService->outputControl->output(), QVideoOutputControl::WidgetOutput);
- QCOMPARE(object.testService->widgetControl->videoWidget()->isVisible(), false);
-}
-
-void tst_QVideoWidget::showRendererControl()
-{
- QtTestVideoObject object(0, 0, new QtTestRendererControl);
- QVideoWidget widget;
- widget.setMediaObject(&object);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
-
- QCOMPARE(object.testService->outputControl->output(), QVideoOutputControl::NoOutput);
-
- widget.show();
- QTest::qWaitForWindowShown(&widget);
-
- QCOMPARE(object.testService->outputControl->output(), QVideoOutputControl::RendererOutput);
- QVERIFY(object.testService->rendererControl->surface() != 0);
-
- widget.resize(640, 480);
-
- widget.move(10, 10);
-
- widget.hide();
-
- QCOMPARE(object.testService->outputControl->output(), QVideoOutputControl::RendererOutput);
-}
-
-void tst_QVideoWidget::aspectRatioWindowControl()
-{
- QtTestVideoObject object(new QtTestWindowControl, 0, 0);
- object.testService->windowControl->setAspectRatioMode(Qt::IgnoreAspectRatio);
-
- QVideoWidget widget;
- widget.setMediaObject(&object);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
-
- // Test the aspect ratio defaults to keeping the aspect ratio.
- QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
-
- // Test the control has been informed of the aspect ratio change, post show.
- widget.show();
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
- QCOMPARE(object.testService->windowControl->aspectRatioMode(), Qt::KeepAspectRatio);
-
- // Test an aspect ratio change is enforced immediately while visible.
- widget.setAspectRatioMode(Qt::IgnoreAspectRatio);
- QCOMPARE(widget.aspectRatioMode(), Qt::IgnoreAspectRatio);
- QCOMPARE(object.testService->windowControl->aspectRatioMode(), Qt::IgnoreAspectRatio);
-
- // Test an aspect ratio set while not visible is respected.
- widget.hide();
- widget.setAspectRatioMode(Qt::KeepAspectRatio);
- QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
- widget.show();
- QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
- QCOMPARE(object.testService->windowControl->aspectRatioMode(), Qt::KeepAspectRatio);
-}
-
-void tst_QVideoWidget::aspectRatioWidgetControl()
-{
- QtTestVideoObject object(0, new QtTestWidgetControl, 0);
- object.testService->widgetControl->setAspectRatioMode(Qt::IgnoreAspectRatio);
-
- QVideoWidget widget;
- widget.setMediaObject(&object);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
-
- // Test the aspect ratio defaults to keeping the aspect ratio.
- QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
-
- // Test the control has been informed of the aspect ratio change, post show.
- widget.show();
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
- QCOMPARE(object.testService->widgetControl->aspectRatioMode(), Qt::KeepAspectRatio);
-
- // Test an aspect ratio change is enforced immediately while visible.
- widget.setAspectRatioMode(Qt::IgnoreAspectRatio);
- QCOMPARE(widget.aspectRatioMode(), Qt::IgnoreAspectRatio);
- QCOMPARE(object.testService->widgetControl->aspectRatioMode(), Qt::IgnoreAspectRatio);
-
- // Test an aspect ratio set while not visible is respected.
- widget.hide();
- widget.setAspectRatioMode(Qt::KeepAspectRatio);
- QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
- widget.show();
- QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
- QCOMPARE(object.testService->widgetControl->aspectRatioMode(), Qt::KeepAspectRatio);
-}
-
-void tst_QVideoWidget::aspectRatioRendererControl()
-{
- QtTestVideoObject object(0, 0, new QtTestRendererControl);
-
- QVideoWidget widget;
- widget.setMediaObject(&object);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
-
- // Test the aspect ratio defaults to keeping the aspect ratio.
- QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
-
- // Test the control has been informed of the aspect ratio change, post show.
- widget.show();
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
-
- // Test an aspect ratio change is enforced immediately while visible.
- widget.setAspectRatioMode(Qt::IgnoreAspectRatio);
- QCOMPARE(widget.aspectRatioMode(), Qt::IgnoreAspectRatio);
-
- // Test an aspect ratio set while not visible is respected.
- widget.hide();
- widget.setAspectRatioMode(Qt::KeepAspectRatio);
- QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
- widget.show();
- QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio);
-}
-
-void tst_QVideoWidget::sizeHint_data()
-{
- QTest::addColumn<QSize>("size");
-
- QTest::newRow("720x576")
- << QSize(720, 576);
-}
-
-void tst_QVideoWidget::sizeHintWindowControl()
-{
- QFETCH(QSize, size);
-
- QtTestVideoObject object(new QtTestWindowControl, 0, 0);
- QVideoWidget widget;
- widget.setMediaObject(&object);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
- widget.show();
- QTest::qWaitForWindowShown(&widget);
-
- QVERIFY(widget.sizeHint().isEmpty());
-
- object.testService->windowControl->setNativeSize(size);
- QCOMPARE(widget.sizeHint(), size);
-}
-
-void tst_QVideoWidget::sizeHintWidgetControl()
-{
- QFETCH(QSize, size);
-
- QtTestVideoObject object(0, new QtTestWidgetControl, 0);
- QVideoWidget widget;
- widget.setMediaObject(&object);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
- widget.show();
- QTest::qWaitForWindowShown(&widget);
-
- QVERIFY(widget.sizeHint().isEmpty());
-
- object.testService->widgetControl->setSizeHint(size);
- QCOMPARE(widget.sizeHint(), size);
-}
-
-void tst_QVideoWidget::sizeHintRendererControl_data()
-{
- QTest::addColumn<QSize>("frameSize");
- QTest::addColumn<QRect>("viewport");
- QTest::addColumn<QSize>("pixelAspectRatio");
- QTest::addColumn<QSize>("expectedSize");
-
- QTest::newRow("640x480")
- << QSize(640, 480)
- << QRect(0, 0, 640, 480)
- << QSize(1, 1)
- << QSize(640, 480);
-
- QTest::newRow("800x600, (80,60, 640x480) viewport")
- << QSize(800, 600)
- << QRect(80, 60, 640, 480)
- << QSize(1, 1)
- << QSize(640, 480);
-
- QTest::newRow("800x600, (80,60, 640x480) viewport, 4:3")
- << QSize(800, 600)
- << QRect(80, 60, 640, 480)
- << QSize(4, 3)
- << QSize(853, 480);
-
-}
-
-void tst_QVideoWidget::sizeHintRendererControl()
-{
- QFETCH(QSize, frameSize);
- QFETCH(QRect, viewport);
- QFETCH(QSize, pixelAspectRatio);
- QFETCH(QSize, expectedSize);
-
- QtTestVideoObject object(0, 0, new QtTestRendererControl);
- QVideoWidget widget;
- widget.setMediaObject(&object);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
-
- widget.show();
- QTest::qWaitForWindowShown(&widget);
-
- QVideoSurfaceFormat format(frameSize, QVideoFrame::Format_ARGB32);
- format.setViewport(viewport);
- format.setPixelAspectRatio(pixelAspectRatio);
-
- QVERIFY(object.testService->rendererControl->surface()->start(format));
-
- QCOMPARE(widget.sizeHint(), expectedSize);
-}
-
-#ifndef Q_WS_X11
-
-void tst_QVideoWidget::fullScreenWindowControl()
-{
- QtTestVideoObject object(new QtTestWindowControl, 0, 0);
- QVideoWidget widget;
- widget.setMediaObject(&object);
- widget.show();
- QTest::qWaitForWindowShown(&widget);
-
- Qt::WindowFlags windowFlags = widget.windowFlags();
-
- QSignalSpy spy(&widget, SIGNAL(fullScreenChanged(bool)));
-
- // Test showing full screen with setFullScreen(true).
- widget.setFullScreen(true);
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(object.testService->windowControl->isFullScreen(), true);
- QCOMPARE(widget.isFullScreen(), true);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.value(0).value(0).toBool(), true);
-
- // Test returning to normal with setFullScreen(false).
- widget.setFullScreen(false);
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(object.testService->windowControl->isFullScreen(), false);
- QCOMPARE(widget.isFullScreen(), false);
- QCOMPARE(spy.count(), 2);
- QCOMPARE(spy.value(1).value(0).toBool(), false);
- QCOMPARE(widget.windowFlags(), windowFlags);
-
- // Test showing full screen with showFullScreen().
- widget.showFullScreen();
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(object.testService->windowControl->isFullScreen(), true);
- QCOMPARE(widget.isFullScreen(), true);
- QCOMPARE(spy.count(), 3);
- QCOMPARE(spy.value(2).value(0).toBool(), true);
-
- // Test returning to normal with showNormal().
- widget.showNormal();
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(object.testService->windowControl->isFullScreen(), false);
- QCOMPARE(widget.isFullScreen(), false);
- QCOMPARE(spy.count(), 4);
- QCOMPARE(spy.value(3).value(0).toBool(), false);
- QCOMPARE(widget.windowFlags(), windowFlags);
-
- // Test setFullScreen(false) and showNormal() do nothing when isFullScreen() == false.
- widget.setFullScreen(false);
- QCOMPARE(object.testService->windowControl->isFullScreen(), false);
- QCOMPARE(widget.isFullScreen(), false);
- QCOMPARE(spy.count(), 4);
- widget.showNormal();
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(object.testService->windowControl->isFullScreen(), false);
- QCOMPARE(widget.isFullScreen(), false);
- QCOMPARE(spy.count(), 4);
-
- // Test setFullScreen(true) and showFullScreen() do nothing when isFullScreen() == true.
- widget.showFullScreen();
- QTest::qWaitForWindowShown(&widget);
- widget.setFullScreen(true);
- QCOMPARE(object.testService->windowControl->isFullScreen(), true);
- QCOMPARE(widget.isFullScreen(), true);
- QCOMPARE(spy.count(), 5);
- widget.showFullScreen();
- QCOMPARE(object.testService->windowControl->isFullScreen(), true);
- QCOMPARE(widget.isFullScreen(), true);
- QCOMPARE(spy.count(), 5);
-
- // Test if the window control exits full screen mode, the widget follows suit.
- object.testService->windowControl->setFullScreen(false);
- QCOMPARE(widget.isFullScreen(), false);
- QCOMPARE(spy.count(), 6);
- QCOMPARE(spy.value(5).value(0).toBool(), false);
-
- // Test if the window control enters full screen mode, the widget does nothing.
- object.testService->windowControl->setFullScreen(false);
- QCOMPARE(widget.isFullScreen(), false);
- QCOMPARE(spy.count(), 6);
-}
-
-void tst_QVideoWidget::fullScreenWidgetControl()
-{
- QtTestVideoObject object(0, new QtTestWidgetControl, 0);
- QVideoWidget widget;
- widget.setMediaObject(&object);
- widget.show();
- QTest::qWaitForWindowShown(&widget);
-
- Qt::WindowFlags windowFlags = widget.windowFlags();
-
- QSignalSpy spy(&widget, SIGNAL(fullScreenChanged(bool)));
-
- // Test showing full screen with setFullScreen(true).
- widget.setFullScreen(true);
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(object.testService->widgetControl->isFullScreen(), true);
- QCOMPARE(widget.isFullScreen(), true);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.value(0).value(0).toBool(), true);
-
- // Test returning to normal with setFullScreen(false).
- widget.setFullScreen(false);
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(object.testService->widgetControl->isFullScreen(), false);
- QCOMPARE(widget.isFullScreen(), false);
- QCOMPARE(spy.count(), 2);
- QCOMPARE(spy.value(1).value(0).toBool(), false);
- QCOMPARE(widget.windowFlags(), windowFlags);
-
- // Test showing full screen with showFullScreen().
- widget.showFullScreen();
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(object.testService->widgetControl->isFullScreen(), true);
- QCOMPARE(widget.isFullScreen(), true);
- QCOMPARE(spy.count(), 3);
- QCOMPARE(spy.value(2).value(0).toBool(), true);
-
- // Test returning to normal with showNormal().
- widget.showNormal();
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(object.testService->widgetControl->isFullScreen(), false);
- QCOMPARE(widget.isFullScreen(), false);
- QCOMPARE(spy.count(), 4);
- QCOMPARE(spy.value(3).value(0).toBool(), false);
- QCOMPARE(widget.windowFlags(), windowFlags);
-
- // Test setFullScreen(false) and showNormal() do nothing when isFullScreen() == false.
- widget.setFullScreen(false);
- QCOMPARE(object.testService->widgetControl->isFullScreen(), false);
- QCOMPARE(widget.isFullScreen(), false);
- QCOMPARE(spy.count(), 4);
- widget.showNormal();
- QCOMPARE(object.testService->widgetControl->isFullScreen(), false);
- QCOMPARE(widget.isFullScreen(), false);
- QCOMPARE(spy.count(), 4);
-
- // Test setFullScreen(true) and showFullScreen() do nothing when isFullScreen() == true.
- widget.showFullScreen();
- QTest::qWaitForWindowShown(&widget);
- widget.setFullScreen(true);
- QCOMPARE(object.testService->widgetControl->isFullScreen(), true);
- QCOMPARE(widget.isFullScreen(), true);
- QCOMPARE(spy.count(), 5);
- widget.showFullScreen();
- QCOMPARE(object.testService->widgetControl->isFullScreen(), true);
- QCOMPARE(widget.isFullScreen(), true);
- QCOMPARE(spy.count(), 5);
-
- // Test if the window control exits full screen mode, the widget follows suit.
- object.testService->widgetControl->setFullScreen(false);
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(widget.isFullScreen(), false);
- QCOMPARE(spy.count(), 6);
- QCOMPARE(spy.value(5).value(0).toBool(), false);
-
- // Test if the window control enters full screen mode, the widget does nothing.
- object.testService->widgetControl->setFullScreen(false);
- QCOMPARE(widget.isFullScreen(), false);
- QCOMPARE(spy.count(), 6);
-}
-
-
-void tst_QVideoWidget::fullScreenRendererControl()
-{
- QtTestVideoObject object(0, 0, new QtTestRendererControl);
- QVideoWidget widget;
- widget.setMediaObject(&object);
- widget.show();
- QTest::qWaitForWindowShown(&widget);
-
- Qt::WindowFlags windowFlags = widget.windowFlags();
-
- QSignalSpy spy(&widget, SIGNAL(fullScreenChanged(bool)));
-
- // Test showing full screen with setFullScreen(true).
- widget.setFullScreen(true);
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(widget.isFullScreen(), true);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.value(0).value(0).toBool(), true);
-
- // Test returning to normal with setFullScreen(false).
- widget.setFullScreen(false);
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(widget.isFullScreen(), false);
- QCOMPARE(spy.count(), 2);
- QCOMPARE(spy.value(1).value(0).toBool(), false);
- QCOMPARE(widget.windowFlags(), windowFlags);
-
- // Test showing full screen with showFullScreen().
- widget.showFullScreen();
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(widget.isFullScreen(), true);
- QCOMPARE(spy.count(), 3);
- QCOMPARE(spy.value(2).value(0).toBool(), true);
-
- // Test returning to normal with showNormal().
- widget.showNormal();
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(widget.isFullScreen(), false);
- QCOMPARE(spy.count(), 4);
- QCOMPARE(spy.value(3).value(0).toBool(), false);
- QCOMPARE(widget.windowFlags(), windowFlags);
-
- // Test setFullScreen(false) and showNormal() do nothing when isFullScreen() == false.
- widget.setFullScreen(false);
- QCOMPARE(widget.isFullScreen(), false);
- QCOMPARE(spy.count(), 4);
- widget.showNormal();
- QCOMPARE(widget.isFullScreen(), false);
- QCOMPARE(spy.count(), 4);
-
- // Test setFullScreen(true) and showFullScreen() do nothing when isFullScreen() == true.
- widget.showFullScreen();
- QTest::qWaitForWindowShown(&widget);
- widget.setFullScreen(true);
- QCOMPARE(widget.isFullScreen(), true);
- QCOMPARE(spy.count(), 5);
- widget.showFullScreen();
- QCOMPARE(widget.isFullScreen(), true);
- QCOMPARE(spy.count(), 5);
-}
-
-#endif
-
-void tst_QVideoWidget::color_data()
-{
- QTest::addColumn<int>("controlValue");
- QTest::addColumn<int>("value");
- QTest::addColumn<int>("expectedValue");
-
- QTest::newRow("12")
- << 0
- << 12
- << 12;
- QTest::newRow("-56")
- << 87
- << -56
- << -56;
- QTest::newRow("100")
- << 32
- << 100
- << 100;
- QTest::newRow("1294")
- << 0
- << 1294
- << 100;
- QTest::newRow("-102")
- << 34
- << -102
- << -100;
-}
-
-void tst_QVideoWidget::brightnessWindowControl()
-{
- QFETCH(int, controlValue);
- QFETCH(int, value);
- QFETCH(int, expectedValue);
-
- QtTestVideoObject object(new QtTestWindowControl, 0, 0);
- object.testService->windowControl->setBrightness(controlValue);
-
- QVideoWidget widget;
- widget.setMediaObject(&object);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
- widget.show();
- QTest::qWaitForWindowShown(&widget);
-
- // Test the video widget resets the controls starting brightness to the default.
- QCOMPARE(widget.brightness(), 0);
-
- QSignalSpy spy(&widget, SIGNAL(brightnessChanged(int)));
-
- // Test the video widget sets the brightness value, bounded if necessary and emits a changed
- // signal.
- widget.setBrightness(value);
- QCOMPARE(widget.brightness(), expectedValue);
- QCOMPARE(object.testService->windowControl->brightness(), expectedValue);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.value(0).value(0).toInt(), expectedValue);
-
- // Test the changed signal isn't emitted if the value is unchanged.
- widget.setBrightness(value);
- QCOMPARE(widget.brightness(), expectedValue);
- QCOMPARE(object.testService->windowControl->brightness(), expectedValue);
- QCOMPARE(spy.count(), 1);
-
- // Test the changed signal is emitted if the brightness is changed internally.
- object.testService->windowControl->setBrightness(controlValue);
- QCOMPARE(widget.brightness(), controlValue);
- QCOMPARE(spy.count(), 2);
- QCOMPARE(spy.value(1).value(0).toInt(), controlValue);
-}
-
-void tst_QVideoWidget::brightnessWidgetControl()
-{
- QFETCH(int, controlValue);
- QFETCH(int, value);
- QFETCH(int, expectedValue);
-
- QtTestVideoObject object(0, new QtTestWidgetControl, 0);
- object.testService->widgetControl->setBrightness(controlValue);
-
- QVideoWidget widget;
- widget.setMediaObject(&object);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
-
- QCOMPARE(widget.brightness(), 0);
-
- widget.show();
- QTest::qWaitForWindowShown(&widget);
-
- QSignalSpy spy(&widget, SIGNAL(brightnessChanged(int)));
-
- widget.setBrightness(value);
- QCOMPARE(widget.brightness(), expectedValue);
- QCOMPARE(object.testService->widgetControl->brightness(), expectedValue);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.value(0).value(0).toInt(), expectedValue);
-
- widget.setBrightness(value);
- QCOMPARE(widget.brightness(), expectedValue);
- QCOMPARE(object.testService->widgetControl->brightness(), expectedValue);
- QCOMPARE(spy.count(), 1);
-
- object.testService->widgetControl->setBrightness(controlValue);
- QCOMPARE(widget.brightness(), controlValue);
- QCOMPARE(spy.count(), 2);
- QCOMPARE(spy.value(1).value(0).toInt(), controlValue);
-}
-
-void tst_QVideoWidget::brightnessRendererControl()
-{
- QFETCH(int, value);
- QFETCH(int, expectedValue);
-
- QtTestVideoObject object(0, 0, new QtTestRendererControl);
-
- QVideoWidget widget;
- widget.setMediaObject(&object);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
- widget.show();
- QTest::qWaitForWindowShown(&widget);
-
- QSignalSpy spy(&widget, SIGNAL(brightnessChanged(int)));
-
- widget.setBrightness(value);
- QCOMPARE(widget.brightness(), expectedValue);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.value(0).value(0).toInt(), expectedValue);
-
- widget.setBrightness(value);
- QCOMPARE(widget.brightness(), expectedValue);
- QCOMPARE(spy.count(), 1);
-}
-
-void tst_QVideoWidget::contrastWindowControl()
-{
- QFETCH(int, controlValue);
- QFETCH(int, value);
- QFETCH(int, expectedValue);
-
- QtTestVideoObject object(new QtTestWindowControl, 0, 0);
- object.testService->windowControl->setContrast(controlValue);
-
- QVideoWidget widget;
- widget.setMediaObject(&object);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
-
- QCOMPARE(widget.contrast(), 0);
-
- widget.show();
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(widget.contrast(), 0);
-
- QSignalSpy spy(&widget, SIGNAL(contrastChanged(int)));
-
- widget.setContrast(value);
- QCOMPARE(widget.contrast(), expectedValue);
- QCOMPARE(object.testService->windowControl->contrast(), expectedValue);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.value(0).value(0).toInt(), expectedValue);
-
- widget.setContrast(value);
- QCOMPARE(widget.contrast(), expectedValue);
- QCOMPARE(object.testService->windowControl->contrast(), expectedValue);
- QCOMPARE(spy.count(), 1);
-
- object.testService->windowControl->setContrast(controlValue);
- QCOMPARE(widget.contrast(), controlValue);
- QCOMPARE(spy.count(), 2);
- QCOMPARE(spy.value(1).value(0).toInt(), controlValue);
-}
-
-void tst_QVideoWidget::contrastWidgetControl()
-{
- QFETCH(int, controlValue);
- QFETCH(int, value);
- QFETCH(int, expectedValue);
-
- QtTestVideoObject object(0, new QtTestWidgetControl, 0);
- object.testService->widgetControl->setContrast(controlValue);
-
- QVideoWidget widget;
- widget.setMediaObject(&object);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
- QCOMPARE(widget.contrast(), 0);
-
- widget.show();
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(widget.contrast(), 0);
-
- QSignalSpy spy(&widget, SIGNAL(contrastChanged(int)));
-
- widget.setContrast(value);
- QCOMPARE(widget.contrast(), expectedValue);
- QCOMPARE(object.testService->widgetControl->contrast(), expectedValue);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.value(0).value(0).toInt(), expectedValue);
-
- widget.setContrast(value);
- QCOMPARE(widget.contrast(), expectedValue);
- QCOMPARE(object.testService->widgetControl->contrast(), expectedValue);
- QCOMPARE(spy.count(), 1);
-
- object.testService->widgetControl->setContrast(controlValue);
- QCOMPARE(widget.contrast(), controlValue);
- QCOMPARE(spy.count(), 2);
- QCOMPARE(spy.value(1).value(0).toInt(), controlValue);
-}
-
-void tst_QVideoWidget::contrastRendererControl()
-{
- QFETCH(int, value);
- QFETCH(int, expectedValue);
-
- QtTestVideoObject object(0, 0, new QtTestRendererControl);
-
- QVideoWidget widget;
- widget.setMediaObject(&object);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
- widget.show();
- QTest::qWaitForWindowShown(&widget);
-
- QSignalSpy spy(&widget, SIGNAL(contrastChanged(int)));
-
- widget.setContrast(value);
- QCOMPARE(widget.contrast(), expectedValue);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.value(0).value(0).toInt(), expectedValue);
-
- widget.setContrast(value);
- QCOMPARE(widget.contrast(), expectedValue);
- QCOMPARE(spy.count(), 1);
-}
-
-void tst_QVideoWidget::hueWindowControl()
-{
- QFETCH(int, controlValue);
- QFETCH(int, value);
- QFETCH(int, expectedValue);
-
- QtTestVideoObject object(new QtTestWindowControl, 0, 0);
- object.testService->windowControl->setHue(controlValue);
-
- QVideoWidget widget;
- widget.setMediaObject(&object);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
- QCOMPARE(widget.hue(), 0);
-
- widget.show();
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(widget.hue(), 0);
-
- QSignalSpy spy(&widget, SIGNAL(hueChanged(int)));
-
- widget.setHue(value);
- QCOMPARE(widget.hue(), expectedValue);
- QCOMPARE(object.testService->windowControl->hue(), expectedValue);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.value(0).value(0).toInt(), expectedValue);
-
- widget.setHue(value);
- QCOMPARE(widget.hue(), expectedValue);
- QCOMPARE(object.testService->windowControl->hue(), expectedValue);
- QCOMPARE(spy.count(), 1);
-
- object.testService->windowControl->setHue(controlValue);
- QCOMPARE(widget.hue(), controlValue);
- QCOMPARE(spy.count(), 2);
- QCOMPARE(spy.value(1).value(0).toInt(), controlValue);
-}
-
-void tst_QVideoWidget::hueWidgetControl()
-{
- QFETCH(int, controlValue);
- QFETCH(int, value);
- QFETCH(int, expectedValue);
-
- QtTestVideoObject object(0, new QtTestWidgetControl, 0);
- object.testService->widgetControl->setHue(controlValue);
-
- QVideoWidget widget;
- widget.setMediaObject(&object);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
- QCOMPARE(widget.hue(), 0);
-
- widget.show();
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(widget.hue(), 0);
-
- QSignalSpy spy(&widget, SIGNAL(hueChanged(int)));
-
- widget.setHue(value);
- QCOMPARE(widget.hue(), expectedValue);
- QCOMPARE(object.testService->widgetControl->hue(), expectedValue);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.value(0).value(0).toInt(), expectedValue);
-
- widget.setHue(value);
- QCOMPARE(widget.hue(), expectedValue);
- QCOMPARE(object.testService->widgetControl->hue(), expectedValue);
- QCOMPARE(spy.count(), 1);
-
- object.testService->widgetControl->setHue(controlValue);
- QCOMPARE(widget.hue(), controlValue);
- QCOMPARE(spy.count(), 2);
- QCOMPARE(spy.value(1).value(0).toInt(), controlValue);
-}
-
-void tst_QVideoWidget::hueRendererControl()
-{
- QFETCH(int, value);
- QFETCH(int, expectedValue);
-
- QtTestVideoObject object(0, 0, new QtTestRendererControl);
-
- QVideoWidget widget;
- widget.setMediaObject(&object);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
- widget.show();
- QTest::qWaitForWindowShown(&widget);
-
- QSignalSpy spy(&widget, SIGNAL(hueChanged(int)));
-
- widget.setHue(value);
- QCOMPARE(widget.hue(), expectedValue);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.value(0).value(0).toInt(), expectedValue);
-
- widget.setHue(value);
- QCOMPARE(widget.hue(), expectedValue);
- QCOMPARE(spy.count(), 1);
-}
-
-void tst_QVideoWidget::saturationWindowControl()
-{
- QFETCH(int, controlValue);
- QFETCH(int, value);
- QFETCH(int, expectedValue);
-
- QtTestVideoObject object(new QtTestWindowControl, 0, 0);
- object.testService->windowControl->setSaturation(controlValue);
-
- QVideoWidget widget;
- widget.setMediaObject(&object);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
- QCOMPARE(widget.saturation(), 0);
- widget.show();
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(widget.saturation(), 0);
-
- QSignalSpy spy(&widget, SIGNAL(saturationChanged(int)));
-
- widget.setSaturation(value);
- QCOMPARE(widget.saturation(), expectedValue);
- QCOMPARE(object.testService->windowControl->saturation(), expectedValue);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.value(0).value(0).toInt(), expectedValue);
-
- widget.setSaturation(value);
- QCOMPARE(widget.saturation(), expectedValue);
- QCOMPARE(object.testService->windowControl->saturation(), expectedValue);
- QCOMPARE(spy.count(), 1);
-
- object.testService->windowControl->setSaturation(controlValue);
- QCOMPARE(widget.saturation(), controlValue);
- QCOMPARE(spy.count(), 2);
- QCOMPARE(spy.value(1).value(0).toInt(), controlValue);
-}
-
-void tst_QVideoWidget::saturationWidgetControl()
-{
- QFETCH(int, controlValue);
- QFETCH(int, value);
- QFETCH(int, expectedValue);
-
- QtTestVideoObject object(0, new QtTestWidgetControl, 0);
- object.testService->widgetControl->setSaturation(controlValue);
-
- QVideoWidget widget;
- widget.setMediaObject(&object);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
-
- QCOMPARE(widget.saturation(), 0);
- widget.show();
- QTest::qWaitForWindowShown(&widget);
- QCOMPARE(widget.saturation(), 0);
-
- QSignalSpy spy(&widget, SIGNAL(saturationChanged(int)));
-
- widget.setSaturation(value);
- QCOMPARE(widget.saturation(), expectedValue);
- QCOMPARE(object.testService->widgetControl->saturation(), expectedValue);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.value(0).value(0).toInt(), expectedValue);
-
- widget.setSaturation(value);
- QCOMPARE(widget.saturation(), expectedValue);
- QCOMPARE(object.testService->widgetControl->saturation(), expectedValue);
- QCOMPARE(spy.count(), 1);
-
- object.testService->widgetControl->setSaturation(controlValue);
- QCOMPARE(widget.saturation(), controlValue);
- QCOMPARE(spy.count(), 2);
- QCOMPARE(spy.value(1).value(0).toInt(), controlValue);
-
-}
-
-void tst_QVideoWidget::saturationRendererControl()
-{
- QFETCH(int, value);
- QFETCH(int, expectedValue);
-
- QtTestVideoObject object(0, 0, new QtTestRendererControl);
-
- QVideoWidget widget;
- widget.setMediaObject(&object);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
- widget.show();
- QTest::qWaitForWindowShown(&widget);
- QSignalSpy spy(&widget, SIGNAL(saturationChanged(int)));
-
- widget.setSaturation(value);
- QCOMPARE(widget.saturation(), expectedValue);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.value(0).value(0).toInt(), expectedValue);
-
- widget.setSaturation(value);
- QCOMPARE(widget.saturation(), expectedValue);
- QCOMPARE(spy.count(), 1);
-}
-
-static const uchar rgb32ImageData[] =
-{
- 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00,
- 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00
-};
-
-void tst_QVideoWidget::paintRendererControl()
-{
- QtTestVideoObject object(0, 0, new QtTestRendererControl);
-
- QVideoWidget widget;
- widget.setMediaObject(&object);
- widget.setWindowFlags(Qt::X11BypassWindowManagerHint);
- widget.show();
- QTest::qWaitForWindowShown(&widget);
-
- QPainterVideoSurface *surface = qobject_cast<QPainterVideoSurface *>(
- object.testService->rendererControl->surface());
-
- QVideoSurfaceFormat format(QSize(2, 2), QVideoFrame::Format_RGB32);
-
- QVERIFY(surface->start(format));
- QCOMPARE(surface->isActive(), true);
- QCOMPARE(surface->isReady(), true);
-
- QCoreApplication::processEvents(QEventLoop::AllEvents);
-
- QCOMPARE(surface->isActive(), true);
- QCOMPARE(surface->isReady(), true);
-
- QVideoFrame frame(sizeof(rgb32ImageData), QSize(2, 2), 8, QVideoFrame::Format_RGB32);
-
- frame.map(QAbstractVideoBuffer::WriteOnly);
- memcpy(frame.bits(), rgb32ImageData, frame.mappedBytes());
- frame.unmap();
-
- QVERIFY(surface->present(frame));
- QCOMPARE(surface->isActive(), true);
- QCOMPARE(surface->isReady(), false);
-
- //wait up to 2 seconds for the frame to be presented
- for (int i=0; i<200 && !surface->isReady(); i++)
- QTest::qWait(10);
-
- QCOMPARE(surface->isActive(), true);
- QCOMPARE(surface->isReady(), true);
-}
-
-QTEST_MAIN(tst_QVideoWidget)
-
-#include "tst_qvideowidget.moc"
diff --git a/tests/benchmarks/declarative/binding/binding.pro b/tests/benchmarks/declarative/binding/binding.pro
index 268541f..c1a8223 100644
--- a/tests/benchmarks/declarative/binding/binding.pro
+++ b/tests/benchmarks/declarative/binding/binding.pro
@@ -7,12 +7,11 @@ macx:CONFIG -= app_bundle
SOURCES += tst_binding.cpp testtypes.cpp
HEADERS += testtypes.h
-# Define SRCDIR equal to test's source directory
-symbian: {
- DEFINES += SRCDIR=\".\"
- importFiles.sources = data
- importFiles.path =
- DEPLOYMENT = importFiles
+symbian {
+ data.sources = data
+ data.path = .
+ DEPLOYMENT = data
} else {
+ # Define SRCDIR equal to test's source directory
DEFINES += SRCDIR=\\\"$$PWD\\\"
}
diff --git a/tests/benchmarks/declarative/binding/tst_binding.cpp b/tests/benchmarks/declarative/binding/tst_binding.cpp
index dbddac3..6e3e146 100644
--- a/tests/benchmarks/declarative/binding/tst_binding.cpp
+++ b/tests/benchmarks/declarative/binding/tst_binding.cpp
@@ -48,6 +48,11 @@
//TESTED_FILES=
+#ifdef Q_OS_SYMBIAN
+// In Symbian OS test data is located in applications private dir
+#define SRCDIR "."
+#endif
+
class tst_binding : public QObject
{
Q_OBJECT
diff --git a/tests/benchmarks/declarative/compilation/compilation.pro b/tests/benchmarks/declarative/compilation/compilation.pro
index 32f4aba..9277187 100644
--- a/tests/benchmarks/declarative/compilation/compilation.pro
+++ b/tests/benchmarks/declarative/compilation/compilation.pro
@@ -8,4 +8,10 @@ CONFIG += release
SOURCES += tst_compilation.cpp
-DEFINES += SRCDIR=\\\"$$PWD\\\"
+symbian {
+ data.sources += data
+ data.path = .
+ DEPLOYMENT += data
+} else {
+ DEFINES += SRCDIR=\\\"$$PWD\\\"
+}
diff --git a/tests/benchmarks/declarative/compilation/tst_compilation.cpp b/tests/benchmarks/declarative/compilation/tst_compilation.cpp
index 5694d5b..0c6e917 100644
--- a/tests/benchmarks/declarative/compilation/tst_compilation.cpp
+++ b/tests/benchmarks/declarative/compilation/tst_compilation.cpp
@@ -46,8 +46,7 @@
#ifdef Q_OS_SYMBIAN
// In Symbian OS test data is located in applications private dir
-// Application private dir is default serach path for files, so SRCDIR can be set to empty
-#define SRCDIR ""
+#define SRCDIR "."
#endif
class tst_compilation : public QObject
@@ -63,7 +62,7 @@ private:
QDeclarativeEngine engine;
};
-tst_compilation::tst_compilation()
+tst_compilation::tst_compilation()
{
}
diff --git a/tests/benchmarks/declarative/creation/creation.pro b/tests/benchmarks/declarative/creation/creation.pro
index 08ad772..6540fa2 100644
--- a/tests/benchmarks/declarative/creation/creation.pro
+++ b/tests/benchmarks/declarative/creation/creation.pro
@@ -6,11 +6,10 @@ macx:CONFIG -= app_bundle
SOURCES += tst_creation.cpp
-symbian: {
- DEFINES += SRCDIR=\".\"
- importFiles.sources = data
- importFiles.path =
- DEPLOYMENT = importFiles
+symbian {
+ data.sources = data
+ data.path = .
+ DEPLOYMENT += data
} else {
DEFINES += SRCDIR=\\\"$$PWD\\\"
}
diff --git a/tests/benchmarks/declarative/creation/tst_creation.cpp b/tests/benchmarks/declarative/creation/tst_creation.cpp
index 6e9197b..1c3332e 100644
--- a/tests/benchmarks/declarative/creation/tst_creation.cpp
+++ b/tests/benchmarks/declarative/creation/tst_creation.cpp
@@ -50,6 +50,11 @@
#include <QDeclarativeContext>
#include <private/qobject_p.h>
+#ifdef Q_OS_SYMBIAN
+// In Symbian OS test data is located in applications private dir
+#define SRCDIR "."
+#endif
+
class tst_creation : public QObject
{
Q_OBJECT
@@ -91,8 +96,8 @@ public:
TestType(QObject *parent = 0)
: QObject(parent) {}
- QDeclarativeListProperty<QObject> resources() {
- return QDeclarativeListProperty<QObject>(this, 0, resources_append);
+ QDeclarativeListProperty<QObject> resources() {
+ return QDeclarativeListProperty<QObject>(this, 0, resources_append);
}
static void resources_append(QDeclarativeListProperty<QObject> *p, QObject *o) {
@@ -100,7 +105,7 @@ public:
}
};
-tst_creation::tst_creation()
+tst_creation::tst_creation()
{
qmlRegisterType<TestType>("Qt.test", 1, 0, "TestType");
}
diff --git a/tests/benchmarks/declarative/declarative.pro b/tests/benchmarks/declarative/declarative.pro
index 262247a..5dd31f3 100644
--- a/tests/benchmarks/declarative/declarative.pro
+++ b/tests/benchmarks/declarative/declarative.pro
@@ -1,7 +1,4 @@
TEMPLATE = subdirs
-!symbian: {
- SUBDIRS += painting
-}
SUBDIRS += \
binding \
@@ -12,3 +9,7 @@ SUBDIRS += \
qdeclarativemetaproperty \
script \
qmltime
+
+contains(QT_CONFIG, opengl): SUBDIRS += painting
+
+
diff --git a/tests/benchmarks/declarative/painting/painting.pro b/tests/benchmarks/declarative/painting/painting.pro
index a228ea7..69c0006 100644
--- a/tests/benchmarks/declarative/painting/painting.pro
+++ b/tests/benchmarks/declarative/painting/painting.pro
@@ -2,6 +2,8 @@
# Automatically generated by qmake (2.01a) fr 29. jan 13:57:52 2010
######################################################################
+requires(contains(QT_CONFIG,opengl))
+
TEMPLATE = app
TARGET =
DEPENDPATH += .
diff --git a/tests/benchmarks/declarative/qdeclarativecomponent/qdeclarativecomponent.pro b/tests/benchmarks/declarative/qdeclarativecomponent/qdeclarativecomponent.pro
index 670e425..b2f39c1 100644
--- a/tests/benchmarks/declarative/qdeclarativecomponent/qdeclarativecomponent.pro
+++ b/tests/benchmarks/declarative/qdeclarativecomponent/qdeclarativecomponent.pro
@@ -7,12 +7,11 @@ macx:CONFIG -= app_bundle
SOURCES += tst_qdeclarativecomponent.cpp testtypes.cpp
HEADERS += testtypes.h
-# Define SRCDIR equal to test's source directory
-symbian: {
- DEFINES += SRCDIR=\".\"
- importFiles.sources = data
- importFiles.path =
- DEPLOYMENT = importFiles
+symbian {
+ data.sources = data
+ data.path = .
+ DEPLOYMENT += data
} else {
+ # Define SRCDIR equal to test's source directory
DEFINES += SRCDIR=\\\"$$PWD\\\"
}
diff --git a/tests/benchmarks/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp b/tests/benchmarks/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp
index 4b1456e..13420ff 100644
--- a/tests/benchmarks/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp
+++ b/tests/benchmarks/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp
@@ -48,6 +48,10 @@
//TESTED_FILES=
+#ifdef Q_OS_SYMBIAN
+// In Symbian OS test data is located in applications private dir
+#define SRCDIR "."
+#endif
class tst_qmlcomponent : public QObject
{
diff --git a/tests/benchmarks/declarative/qdeclarativeimage/qdeclarativeimage.pro b/tests/benchmarks/declarative/qdeclarativeimage/qdeclarativeimage.pro
index fb5779a..a68792b 100644
--- a/tests/benchmarks/declarative/qdeclarativeimage/qdeclarativeimage.pro
+++ b/tests/benchmarks/declarative/qdeclarativeimage/qdeclarativeimage.pro
@@ -7,8 +7,7 @@ CONFIG += release
SOURCES += tst_qdeclarativeimage.cpp
-symbian: {
- DEFINES += SRCDIR=\".\"
+symbian {
importFiles.sources = image.png
importFiles.path =
DEPLOYMENT = importFiles
diff --git a/tests/benchmarks/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/benchmarks/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp
index e979f20..2d9744e 100644
--- a/tests/benchmarks/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp
+++ b/tests/benchmarks/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp
@@ -44,6 +44,11 @@
#include <QDeclarativeComponent>
#include <private/qdeclarativeimage_p.h>
+#ifdef Q_OS_SYMBIAN
+// In Symbian OS test data is located in applications private dir
+#define SRCDIR "."
+#endif
+
class tst_qmlgraphicsimage : public QObject
{
Q_OBJECT
diff --git a/tests/benchmarks/declarative/qdeclarativemetaproperty/qdeclarativemetaproperty.pro b/tests/benchmarks/declarative/qdeclarativemetaproperty/qdeclarativemetaproperty.pro
index 55dfafe..65ee7e0 100644
--- a/tests/benchmarks/declarative/qdeclarativemetaproperty/qdeclarativemetaproperty.pro
+++ b/tests/benchmarks/declarative/qdeclarativemetaproperty/qdeclarativemetaproperty.pro
@@ -6,12 +6,11 @@ macx:CONFIG -= app_bundle
SOURCES += tst_qdeclarativemetaproperty.cpp
-# Define SRCDIR equal to test's source directory
-symbian: {
- DEFINES += SRCDIR=\".\"
- importFiles.sources = data
- importFiles.path =
- DEPLOYMENT = importFiles
+symbian {
+ data.sources += data
+ data.path = .
+ DEPLOYMENT += data
} else {
- DEFINES += SRCDIR=\\\"$$PWD\\\"
+ # Define SRCDIR equal to test's source directory
+ DEFINES += SRCDIR=\\\"$$PWD\\\"
}
diff --git a/tests/benchmarks/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp b/tests/benchmarks/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp
index 8a5f4ae..6e71e7d 100644
--- a/tests/benchmarks/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp
+++ b/tests/benchmarks/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp
@@ -48,6 +48,10 @@
//TESTED_FILES=
+#ifdef Q_OS_SYMBIAN
+// In Symbian OS test data is located in applications private dir
+#define SRCDIR "."
+#endif
class tst_qmlmetaproperty : public QObject
{
diff --git a/tests/benchmarks/declarative/qmltime/qmltime.pro b/tests/benchmarks/declarative/qmltime/qmltime.pro
index 9352f3b..6f5ad5e 100644
--- a/tests/benchmarks/declarative/qmltime/qmltime.pro
+++ b/tests/benchmarks/declarative/qmltime/qmltime.pro
@@ -6,18 +6,10 @@ macx:CONFIG -= app_bundle
SOURCES += qmltime.cpp
-symbian* {
+symbian {
TARGET.CAPABILITY = "All -TCB"
- example.sources = example.qml
- esample.path = .
- tests.sources = tests/*
- tests.path = tests
- anshors.sources = tests/anchors/*
- anchors.path = tests/anchors
- item_creation.sources = tests/item_creation/*
- item_creation.path = tests/item_creation
- positioner_creation.sources = tests/positioner_creation/*
- positioner_creation.path = tests/positioner_creation
- DEPLOYMENT += example tests anchors item_creation positioner_creation
+ example.sources = example.qml tests
+ example.path = .
+ DEPLOYMENT += example
}
diff --git a/tests/benchmarks/declarative/script/script.pro b/tests/benchmarks/declarative/script/script.pro
index 91db871..685ba03 100644
--- a/tests/benchmarks/declarative/script/script.pro
+++ b/tests/benchmarks/declarative/script/script.pro
@@ -7,8 +7,7 @@ CONFIG += release
SOURCES += tst_script.cpp
-symbian: {
- DEFINES += SRCDIR=\".\"
+symbian {
importFiles.sources = data
importFiles.path =
DEPLOYMENT = importFiles
diff --git a/tests/benchmarks/declarative/script/tst_script.cpp b/tests/benchmarks/declarative/script/tst_script.cpp
index 6dc7ed6..99f294c 100644
--- a/tests/benchmarks/declarative/script/tst_script.cpp
+++ b/tests/benchmarks/declarative/script/tst_script.cpp
@@ -48,6 +48,11 @@
#include <QScriptEngine>
#include <QScriptValue>
+#ifdef Q_OS_SYMBIAN
+// In Symbian OS test data is located in applications private dir
+#define SRCDIR "."
+#endif
+
class tst_script : public QObject
{
Q_OBJECT
diff --git a/tests/benchmarks/declarative/typeimports/tst_typeimports.cpp b/tests/benchmarks/declarative/typeimports/tst_typeimports.cpp
index b92ab46..f4c4c1f 100644
--- a/tests/benchmarks/declarative/typeimports/tst_typeimports.cpp
+++ b/tests/benchmarks/declarative/typeimports/tst_typeimports.cpp
@@ -46,8 +46,7 @@
#ifdef Q_OS_SYMBIAN
// In Symbian OS test data is located in applications private dir
-// Application private dir is default serach path for files, so SRCDIR can be set to empty
-#define SRCDIR ""
+#define SRCDIR "."
#endif
class tst_typeimports : public QObject
@@ -72,8 +71,8 @@ class TestType1 : public QObject
public:
TestType1(QObject *parent = 0) : QObject(parent) {}
- QDeclarativeListProperty<QObject> resources() {
- return QDeclarativeListProperty<QObject>(this, 0, resources_append);
+ QDeclarativeListProperty<QObject> resources() {
+ return QDeclarativeListProperty<QObject>(this, 0, resources_append);
}
static void resources_append(QDeclarativeListProperty<QObject> *p, QObject *o) {
@@ -104,7 +103,7 @@ public:
};
-tst_typeimports::tst_typeimports()
+tst_typeimports::tst_typeimports()
{
qmlRegisterType<TestType1>("Qt.test", 1, 0, "TestType1");
qmlRegisterType<TestType2>("Qt.test", 1, 0, "TestType2");
diff --git a/tests/benchmarks/declarative/typeimports/typeimports.pro b/tests/benchmarks/declarative/typeimports/typeimports.pro
index 8a74e0d..a5df3f0 100644
--- a/tests/benchmarks/declarative/typeimports/typeimports.pro
+++ b/tests/benchmarks/declarative/typeimports/typeimports.pro
@@ -6,10 +6,10 @@ macx:CONFIG -= app_bundle
SOURCES += tst_typeimports.cpp
-symbian* {
- data.sources = data/*
- data.path = data
- DEPLOYMENT += addFiles
+symbian {
+ data.sources = data
+ data.path = .
+ DEPLOYMENT += data
} else {
DEFINES += SRCDIR=\\\"$$PWD\\\"
} \ No newline at end of file