summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-11-04 09:45:54 +0100
committerOlivier Goffart <ogoffart@trolltech.com>2009-11-04 09:45:54 +0100
commite22581675866cbf88e948eae2e83eb13a43a2d44 (patch)
tree782b173b702a48fca5f68d9622cad67d65d01d88 /tests/auto
parent950cd9b3c1ae6a1b462d596a62aea92f9c231afb (diff)
parentdb997a02c1d306260d8bbfe4f13e8312efb6fa7c (diff)
Merge commit 'origin/4.6' into 4.6
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/auto.pro2
-rw-r--r--tests/auto/collections/tst_collections.cpp109
-rw-r--r--tests/auto/qabstractvideosurface/tst_qabstractvideosurface.cpp38
-rw-r--r--tests/auto/qdatastream/tst_qdatastream.cpp81
-rw-r--r--tests/auto/qdbusabstractinterface/tst_qdbusabstractinterface.cpp59
-rw-r--r--tests/auto/qdbusinterface/tst_qdbusinterface.cpp34
-rw-r--r--tests/auto/qdbusservicewatcher/qdbusservicewatcher.pro8
-rw-r--r--tests/auto/qdbusservicewatcher/tst_qdbusservicewatcher.cpp273
-rw-r--r--tests/auto/qdom/tst_qdom.cpp1
-rw-r--r--tests/auto/qgl/tst_qgl.cpp22
-rw-r--r--tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp4
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp14
-rw-r--r--tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp6
-rw-r--r--tests/auto/qlocalsocket/tst_qlocalsocket.cpp2
-rw-r--r--tests/auto/qmatrixnxn/tst_qmatrixnxn.cpp168
-rw-r--r--tests/auto/qsslsocket/tst_qsslsocket.cpp4
-rw-r--r--tests/auto/qstatemachine/tst_qstatemachine.cpp94
-rw-r--r--tests/auto/qstringbuilder1/qstringbuilder1.pro3
-rw-r--r--tests/auto/qstringbuilder1/stringbuilder.cpp56
-rw-r--r--tests/auto/qstringbuilder1/stringbuilder.h55
-rw-r--r--tests/auto/qstringbuilder1/tst_qstringbuilder1.cpp33
-rw-r--r--tests/auto/qstringbuilder2/qstringbuilder2.pro3
-rw-r--r--tests/auto/qstringbuilder2/tst_qstringbuilder2.cpp32
-rw-r--r--tests/auto/qstringbuilder3/qstringbuilder3.pro3
-rw-r--r--tests/auto/qstringbuilder3/tst_qstringbuilder3.cpp31
-rw-r--r--tests/auto/qstringbuilder4/qstringbuilder4.pro3
-rw-r--r--tests/auto/qstringbuilder4/tst_qstringbuilder4.cpp34
-rw-r--r--tests/auto/qtextlayout/tst_qtextlayout.cpp13
-rw-r--r--tests/auto/qudpsocket/tst_qudpsocket.cpp10
-rw-r--r--tests/auto/qvariant/tst_qvariant.cpp6
-rw-r--r--tests/auto/qvideoframe/tst_qvideoframe.cpp18
-rw-r--r--tests/auto/qvideosurfaceformat/tst_qvideosurfaceformat.cpp77
32 files changed, 836 insertions, 460 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index 0f7a7f1eb2..1ec4c16548 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -501,3 +501,5 @@ contains(QT_CONFIG, webkit): SUBDIRS += \
qwebhistoryinterface \
qwebelement \
qwebhistory
+
+contains(QT_CONFIG, declarative): SUBDIRS += declarative
diff --git a/tests/auto/collections/tst_collections.cpp b/tests/auto/collections/tst_collections.cpp
index 670cff0377..f97805edae 100644
--- a/tests/auto/collections/tst_collections.cpp
+++ b/tests/auto/collections/tst_collections.cpp
@@ -164,6 +164,7 @@ private slots:
void qtimerList();
void containerTypedefs();
void forwardDeclared();
+ void alignment();
};
struct LargeStatic {
@@ -3481,5 +3482,113 @@ void tst_Collections::forwardDeclared()
{ typedef QSet<T1> C; C *x = 0; /* C::iterator i; */ C::const_iterator j; Q_UNUSED(x) }
}
+#if defined(Q_ALIGNOF) && defined(Q_DECL_ALIGN)
+
+class Q_DECL_ALIGN(4) Aligned4
+{
+ char i;
+public:
+ Aligned4(int i = 0) : i(i) {}
+ bool checkAligned() const
+ {
+ return (quintptr(this) & 3) == 0;
+ }
+
+ inline bool operator==(const Aligned4 &other) const { return i == other.i; }
+ inline bool operator<(const Aligned4 &other) const { return i < other.i; }
+ friend inline int qHash(const Aligned4 &a) { return qHash(a.i); }
+};
+
+class Q_DECL_ALIGN(128) Aligned128
+{
+ char i;
+public:
+ Aligned128(int i = 0) : i(i) {}
+ bool checkAligned() const
+ {
+ return (quintptr(this) & 127) == 0;
+ }
+
+ inline bool operator==(const Aligned128 &other) const { return i == other.i; }
+ inline bool operator<(const Aligned128 &other) const { return i < other.i; }
+ friend inline int qHash(const Aligned128 &a) { return qHash(a.i); }
+};
+
+template<typename C>
+void testVectorAlignment()
+{
+ typedef typename C::value_type Aligned;
+ C container;
+ container.append(Aligned());
+ QVERIFY(container[0].checkAligned());
+
+ for (int i = 0; i < 200; ++i)
+ container.append(Aligned());
+
+ for (int i = 0; i < container.size(); ++i)
+ QVERIFY(container.at(i).checkAligned());
+}
+
+template<typename C>
+void testContiguousCacheAlignment()
+{
+ typedef typename C::value_type Aligned;
+ C container(150);
+ container.append(Aligned());
+ QVERIFY(container[container.firstIndex()].checkAligned());
+
+ for (int i = 0; i < 200; ++i)
+ container.append(Aligned());
+
+ for (int i = container.firstIndex(); i < container.lastIndex(); ++i)
+ QVERIFY(container.at(i).checkAligned());
+}
+
+template<typename C>
+void testAssociativeContainerAlignment()
+{
+ typedef typename C::key_type Key;
+ typedef typename C::mapped_type Value;
+ C container;
+ container.insert(Key(), Value());
+
+ typename C::const_iterator it = container.constBegin();
+ QVERIFY(it.key().checkAligned());
+ QVERIFY(it.value().checkAligned());
+
+ // add some more elements
+ for (int i = 0; i < 200; ++i)
+ container.insert(Key(i), Value(i));
+
+ it = container.constBegin();
+ for ( ; it != container.constEnd(); ++it) {
+ QVERIFY(it.key().checkAligned());
+ QVERIFY(it.value().checkAligned());
+ }
+}
+
+void tst_Collections::alignment()
+{
+ testVectorAlignment<QVector<Aligned4> >();
+ testVectorAlignment<QVector<Aligned128> >();
+ testContiguousCacheAlignment<QContiguousCache<Aligned4> >();
+ testContiguousCacheAlignment<QContiguousCache<Aligned128> >();
+ testAssociativeContainerAlignment<QMap<Aligned4, Aligned4> >();
+ testAssociativeContainerAlignment<QMap<Aligned4, Aligned128> >();
+ testAssociativeContainerAlignment<QMap<Aligned128, Aligned4> >();
+ testAssociativeContainerAlignment<QMap<Aligned128, Aligned128> >();
+ testAssociativeContainerAlignment<QHash<Aligned4, Aligned4> >();
+ testAssociativeContainerAlignment<QHash<Aligned4, Aligned128> >();
+ testAssociativeContainerAlignment<QHash<Aligned128, Aligned4> >();
+ testAssociativeContainerAlignment<QHash<Aligned128, Aligned128> >();
+}
+
+#else
+void tst_Collections::alignment()
+{
+ QSKIP("Compiler doesn't support necessary extension keywords", SkipAll)
+}
+#endif
+
QTEST_APPLESS_MAIN(tst_Collections)
#include "tst_collections.moc"
diff --git a/tests/auto/qabstractvideosurface/tst_qabstractvideosurface.cpp b/tests/auto/qabstractvideosurface/tst_qabstractvideosurface.cpp
index 20ca759b05..b4d2ac8342 100644
--- a/tests/auto/qabstractvideosurface/tst_qabstractvideosurface.cpp
+++ b/tests/auto/qabstractvideosurface/tst_qabstractvideosurface.cpp
@@ -61,6 +61,8 @@ private slots:
void setError();
void isFormatSupported_data();
void isFormatSupported();
+ void nearestFormat_data();
+ void nearestFormat();
void start_data();
void start();
};
@@ -232,6 +234,22 @@ void tst_QAbstractVideoSurface::isFormatSupported()
QCOMPARE(surface.isFormatSupported(format), supported);
}
+void tst_QAbstractVideoSurface::nearestFormat_data()
+{
+ isFormatSupported_data();
+}
+
+void tst_QAbstractVideoSurface::nearestFormat()
+{
+ QFETCH(SupportedFormatMap, supportedFormats);
+ QFETCH(QVideoSurfaceFormat, format);
+ QFETCH(bool, supported);
+
+ QtTestVideoSurface surface(supportedFormats);
+
+ QCOMPARE(surface.nearestFormat(format) == format, supported);
+}
+
void tst_QAbstractVideoSurface::start_data()
{
QTest::addColumn<QVideoSurfaceFormat>("format");
@@ -256,35 +274,35 @@ void tst_QAbstractVideoSurface::start()
surface.setError(QAbstractVideoSurface::ResourceError);
QSignalSpy formatSpy(&surface, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat)));
- QSignalSpy startedSpy(&surface, SIGNAL(startedChanged(bool)));
+ QSignalSpy activeSpy(&surface, SIGNAL(activeChanged(bool)));
- QVERIFY(!surface.isStarted());
+ QVERIFY(!surface.isActive());
QCOMPARE(surface.surfaceFormat(), QVideoSurfaceFormat());
QVERIFY(surface.start(format));
- QVERIFY(surface.isStarted());
+ QVERIFY(surface.isActive());
QCOMPARE(surface.surfaceFormat(), format);
QCOMPARE(formatSpy.count(), 1);
- QCOMPARE(qvariant_cast<QVideoSurfaceFormat>(formatSpy.at(0).at(0)), format);
+ QCOMPARE(qvariant_cast<QVideoSurfaceFormat>(formatSpy.last().at(0)), format);
- QCOMPARE(startedSpy.count(), 1);
- QCOMPARE(startedSpy.at(0).at(0).toBool(), true);
+ QCOMPARE(activeSpy.count(), 1);
+ QCOMPARE(activeSpy.last().at(0).toBool(), true);
// error() is reset on a successful start.
QCOMPARE(surface.error(), QAbstractVideoSurface::NoError);
surface.stop();
- QVERIFY(!surface.isStarted());
+ QVERIFY(!surface.isActive());
QCOMPARE(surface.surfaceFormat(), QVideoSurfaceFormat());
QCOMPARE(formatSpy.count(), 2);
- QCOMPARE(qvariant_cast<QVideoSurfaceFormat>(formatSpy.at(1).at(0)), QVideoSurfaceFormat());
+ QCOMPARE(qvariant_cast<QVideoSurfaceFormat>(formatSpy.last().at(0)), QVideoSurfaceFormat());
- QCOMPARE(startedSpy.count(), 2);
- QCOMPARE(startedSpy.at(1).at(0).toBool(), false);
+ QCOMPARE(activeSpy.count(), 2);
+ QCOMPARE(activeSpy.last().at(0).toBool(), false);
}
QTEST_MAIN(tst_QAbstractVideoSurface)
diff --git a/tests/auto/qdatastream/tst_qdatastream.cpp b/tests/auto/qdatastream/tst_qdatastream.cpp
index add0945148..56fc53a235 100644
--- a/tests/auto/qdatastream/tst_qdatastream.cpp
+++ b/tests/auto/qdatastream/tst_qdatastream.cpp
@@ -3100,22 +3100,6 @@ void tst_QDataStream::streamToAndFromQByteArray()
void tst_QDataStream::streamRealDataTypes()
{
-#if defined(Q_OS_WINCE)
- // Note: Probably actually same 'qreal being typedeffed as float instead of double' issue as in Symbian
- // instead of what CE skip message says.
- QSKIP("Skipped on CE as it demands too much memory and fragments", SkipAll);
-#elif defined(Q_OS_SYMBIAN)
- // qreal is typedeffed float in symbian instead of double like in most platforms, so reference stream
- // gets corrupted. Basically this test is flawed, as one shouldn't use naked typedeffed types in
- // streams that are meant to work cross-platform.
- // As this test also tests other floating point using classes, we do not simply skip it, but work around
- // the qreal issue by redefining qreal as double for the duration of this function.
- // Note that streaming classes works because they do explicitly use double instead of qreal when
- // writing/reading to/from stream.
-# define qreal double
- qWarning("Note: streamRealDataTypes test redefines qreal as double in symbian!!!");
-#endif
-
// Generate QPicture from SVG.
QSvgRenderer renderer(svgFile);
QVERIFY(renderer.isValid());
@@ -3163,7 +3147,6 @@ void tst_QDataStream::streamRealDataTypes()
file.close();
}
- qreal a, b, c, d, e, f;
QPointF point;
QRectF rect;
QPolygonF polygon;
@@ -3180,28 +3163,50 @@ void tst_QDataStream::streamRealDataTypes()
QDataStream stream(&file);
stream.setVersion(QDataStream::Qt_4_2);
- stream >> a >> b >> c >> d >> e >> f >> point
- >> rect >> polygon >> matrix >> p;
- if (i == 1)
- stream >> pict;
- stream >> textLength >> col >> rGrad >> cGrad
- >> pen;
-
- QCOMPARE(stream.status(), QDataStream::Ok);
-
- QCOMPARE(a, qreal(0));
- QCOMPARE(b, qreal(1.0));
- QCOMPARE(c, qreal(1.1));
- QCOMPARE(d, qreal(3.14));
- QCOMPARE(e, qreal(-3.14));
- QCOMPARE(f, qreal(-1));
+ if (i == 0) {
+ // the reference stream for 4.2 contains doubles,
+ // so we must read them out as doubles!
+ double a, b, c, d, e, f;
+ stream >> a;
+ QCOMPARE(a, 0.0);
+ stream >> b;
+ QCOMPARE(b, 1.0);
+ stream >> c;
+ QCOMPARE(c, 1.1);
+ stream >> d;
+ QCOMPARE(d, 3.14);
+ stream >> e;
+ QCOMPARE(e, -3.14);
+ stream >> f;
+ QCOMPARE(f, -1.0);
+ } else {
+ qreal a, b, c, d, e, f;
+ stream >> a;
+ QCOMPARE(a, qreal(0));
+ stream >> b;
+ QCOMPARE(b, qreal(1.0));
+ stream >> c;
+ QCOMPARE(c, qreal(1.1));
+ stream >> d;
+ QCOMPARE(d, qreal(3.14));
+ stream >> e;
+ QCOMPARE(e, qreal(-3.14));
+ stream >> f;
+ QCOMPARE(f, qreal(-1));
+ }
+ stream >> point;
QCOMPARE(point, QPointF(3, 5));
+ stream >> rect;
QCOMPARE(rect, QRectF(-1, -2, 3, 4));
+ stream >> polygon;
QCOMPARE((QVector<QPointF> &)polygon, (QPolygonF() << QPointF(0, 0) << QPointF(1, 2)));
+ stream >> matrix;
QCOMPARE(matrix, QMatrix().rotate(90).scale(2, 2));
+ stream >> p;
QCOMPARE(p, path);
+ if (i == 1) {
+ stream >> pict;
- if (i == 0) {
QByteArray pictA, pictB;
QBuffer bufA, bufB;
QVERIFY(bufA.open(QIODevice::ReadWrite));
@@ -3212,8 +3217,11 @@ void tst_QDataStream::streamRealDataTypes()
QCOMPARE(pictA, pictB);
}
+ stream >> textLength;
QCOMPARE(textLength, QTextLength(QTextLength::VariableLength, 1.5));
+ stream >> col;
QCOMPARE(col, color);
+ stream >> rGrad;
QCOMPARE(rGrad.style(), radialBrush.style());
QCOMPARE(rGrad.matrix(), radialBrush.matrix());
QCOMPARE(rGrad.gradient()->type(), radialBrush.gradient()->type());
@@ -3222,6 +3230,7 @@ void tst_QDataStream::streamRealDataTypes()
QCOMPARE(((QRadialGradient *)rGrad.gradient())->center(), ((QRadialGradient *)radialBrush.gradient())->center());
QCOMPARE(((QRadialGradient *)rGrad.gradient())->focalPoint(), ((QRadialGradient *)radialBrush.gradient())->focalPoint());
QCOMPARE(((QRadialGradient *)rGrad.gradient())->radius(), ((QRadialGradient *)radialBrush.gradient())->radius());
+ stream >> cGrad;
QCOMPARE(cGrad.style(), conicalBrush.style());
QCOMPARE(cGrad.matrix(), conicalBrush.matrix());
QCOMPARE(cGrad.gradient()->type(), conicalBrush.gradient()->type());
@@ -3231,11 +3240,11 @@ void tst_QDataStream::streamRealDataTypes()
QCOMPARE(((QConicalGradient *)cGrad.gradient())->angle(), ((QConicalGradient *)conicalBrush.gradient())->angle());
QCOMPARE(cGrad, conicalBrush);
+ stream >> pen;
QCOMPARE(pen.widthF(), qreal(1.5));
+
+ QCOMPARE(stream.status(), QDataStream::Ok);
}
-#if defined(Q_OS_SYMBIAN)
- #undef qreal
-#endif
}
#ifdef QT3_SUPPORT
diff --git a/tests/auto/qdbusabstractinterface/tst_qdbusabstractinterface.cpp b/tests/auto/qdbusabstractinterface/tst_qdbusabstractinterface.cpp
index baf769f6de..91050f56ec 100644
--- a/tests/auto/qdbusabstractinterface/tst_qdbusabstractinterface.cpp
+++ b/tests/auto/qdbusabstractinterface/tst_qdbusabstractinterface.cpp
@@ -103,6 +103,8 @@ private slots:
void getComplexSignal_data();
void getComplexSignal();
+ void followSignal();
+
void createErrors_data();
void createErrors();
@@ -130,6 +132,9 @@ tst_QDBusAbstractInterface::tst_QDBusAbstractInterface()
void tst_QDBusAbstractInterface::initTestCase()
{
+ // enable debugging temporarily:
+ putenv("QDBUS_DEBUG=1");
+
// register the object
QDBusConnection con = QDBusConnection::sessionBus();
QVERIFY(con.isConnected());
@@ -432,6 +437,60 @@ void tst_QDBusAbstractInterface::getComplexSignal()
QCOMPARE(s[0][0].value<RegisteredType>(), expectedValue);
}
+void tst_QDBusAbstractInterface::followSignal()
+{
+ const QString serviceToFollow = "com.trolltech.tst_qdbusabstractinterface.FollowMe";
+ Pinger p = getPinger(serviceToFollow);
+ QVERIFY2(p, "Not connected to D-Bus");
+
+ QDBusConnection con = p->connection();
+ QVERIFY(!con.interface()->isServiceRegistered(serviceToFollow));
+ Pinger control = getPinger("");
+
+ // we need to connect the signal somewhere in order for D-Bus to enable the rules
+ QTestEventLoop::instance().connect(p.data(), SIGNAL(voidSignal()), SLOT(exitLoop()));
+ QTestEventLoop::instance().connect(control.data(), SIGNAL(voidSignal()), SLOT(exitLoop()));
+ QSignalSpy s(p.data(), SIGNAL(voidSignal()));
+
+ emit targetObj.voidSignal();
+ QTestEventLoop::instance().enterLoop(200);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+
+ // signal must not have been received because the service isn't registered
+ QVERIFY(s.isEmpty());
+
+ // now register the service
+ QDBusReply<QDBusConnectionInterface::RegisterServiceReply> r =
+ con.interface()->registerService(serviceToFollow, QDBusConnectionInterface::DontQueueService,
+ QDBusConnectionInterface::DontAllowReplacement);
+ QVERIFY(r.isValid() && r.value() == QDBusConnectionInterface::ServiceRegistered);
+ QVERIFY(con.interface()->isServiceRegistered(serviceToFollow));
+
+ // emit the signal again:
+ emit targetObj.voidSignal();
+ QTestEventLoop::instance().enterLoop(2);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+
+ // now the signal must have been received:
+ QCOMPARE(s.size(), 1);
+ QVERIFY(s.at(0).size() == 0);
+ s.clear();
+
+ // disconnect the signal
+ disconnect(p.data(), SIGNAL(voidSignal()), &QTestEventLoop::instance(), 0);
+
+ // emit the signal again:
+ emit targetObj.voidSignal();
+ QTestEventLoop::instance().enterLoop(2);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+
+ // and now it mustn't have been received
+ QVERIFY(s.isEmpty());
+
+ // cleanup:
+ con.interface()->unregisterService(serviceToFollow);
+}
+
void tst_QDBusAbstractInterface::createErrors_data()
{
QTest::addColumn<QString>("service");
diff --git a/tests/auto/qdbusinterface/tst_qdbusinterface.cpp b/tests/auto/qdbusinterface/tst_qdbusinterface.cpp
index e31a3a0952..62d634265b 100644
--- a/tests/auto/qdbusinterface/tst_qdbusinterface.cpp
+++ b/tests/auto/qdbusinterface/tst_qdbusinterface.cpp
@@ -171,6 +171,13 @@ class tst_QDBusInterface: public QObject
{
Q_OBJECT
MyObject obj;
+public slots:
+ void testServiceOwnerChanged(const QString &service)
+ {
+ if (service == "com.example.Test")
+ QTestEventLoop::instance().exitLoop();
+ }
+
private slots:
void initTestCase();
@@ -235,32 +242,13 @@ void tst_QDBusInterface::invalidAfterServiceOwnerChanged()
QDBusInterface invalidInterface("com.example.Test", "/");
QVERIFY(!invalidInterface.isValid());
+ QTestEventLoop::instance().connect(connIface, SIGNAL(serviceOwnerChanged(QString, QString, QString)),
+ SLOT(exitLoop()));
QVERIFY(connIface->registerService("com.example.Test") == QDBusConnectionInterface::ServiceRegistered);
- QSignalSpy serviceOwnerChangedSpy(connIface, SIGNAL(serviceOwnerChanged(QString, QString, QString)));
-
- QEventLoop loop;
- QObject::connect(connIface, SIGNAL(serviceOwnerChanged(QString, QString, QString)),
- &loop, SLOT(quit()));
- loop.exec();
-
- // at least once, but other services might have changed while running the test, too.
- QVERIFY(serviceOwnerChangedSpy.count() >= 1);
- bool foundOurService = false;
- for (int i = 0; i < serviceOwnerChangedSpy.count(); ++i) {
- QList<QVariant> args = serviceOwnerChangedSpy.at(i);
- QString name = args[0].toString();
- QString oldOwner = args[1].toString();
- QString newOwner = args[2].toString();
- if (name == QLatin1String("com.example.Test")) {
- if (newOwner == conn.baseService()) {
- foundOurService = true;
- break;
- }
- }
- }
- QVERIFY(foundOurService);
+ QTestEventLoop::instance().enterLoop(5);
+ QVERIFY(!QTestEventLoop::instance().timeout());
QVERIFY(!invalidInterface.isValid());
}
diff --git a/tests/auto/qdbusservicewatcher/qdbusservicewatcher.pro b/tests/auto/qdbusservicewatcher/qdbusservicewatcher.pro
new file mode 100644
index 0000000000..4970f16863
--- /dev/null
+++ b/tests/auto/qdbusservicewatcher/qdbusservicewatcher.pro
@@ -0,0 +1,8 @@
+load(qttest_p4)
+QT = core
+contains(QT_CONFIG,dbus): {
+ SOURCES += tst_qdbusservicewatcher.cpp
+ QT += dbus
+} else {
+ SOURCES += ../qdbusmarshall/dummy.cpp
+}
diff --git a/tests/auto/qdbusservicewatcher/tst_qdbusservicewatcher.cpp b/tests/auto/qdbusservicewatcher/tst_qdbusservicewatcher.cpp
new file mode 100644
index 0000000000..10b43b1e32
--- /dev/null
+++ b/tests/auto/qdbusservicewatcher/tst_qdbusservicewatcher.cpp
@@ -0,0 +1,273 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the 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 <QtDBus/QDBusServiceWatcher>
+#include <QtDBus>
+#include <QtTest>
+
+class tst_QDBusServiceWatcher: public QObject
+{
+ Q_OBJECT
+ QString serviceName;
+public:
+ tst_QDBusServiceWatcher();
+
+private slots:
+ void initTestCase();
+ void cleanup();
+
+ void watchForCreation();
+ void watchForDisappearance();
+ void watchForOwnerChange();
+ void modeChange();
+};
+
+tst_QDBusServiceWatcher::tst_QDBusServiceWatcher()
+ : serviceName("com.example.TestName")
+{
+}
+
+void tst_QDBusServiceWatcher::initTestCase()
+{
+ QDBusConnection con = QDBusConnection::sessionBus();
+ QVERIFY(con.isConnected());
+}
+
+void tst_QDBusServiceWatcher::cleanup()
+{
+ // ensure that the name isn't registered
+ QDBusConnection::sessionBus().unregisterService(serviceName);
+}
+
+void tst_QDBusServiceWatcher::watchForCreation()
+{
+ QDBusConnection con = QDBusConnection::sessionBus();
+ QVERIFY(con.isConnected());
+
+ QDBusServiceWatcher watcher(serviceName, con, QDBusServiceWatcher::WatchForRegistration);
+
+ QSignalSpy spyR(&watcher, SIGNAL(serviceRegistered(QString)));
+ QSignalSpy spyU(&watcher, SIGNAL(serviceUnregistered(QString)));
+ QSignalSpy spyO(&watcher, SIGNAL(serviceOwnerChanged(QString,QString,QString)));
+ QTestEventLoop::instance().connect(&watcher, SIGNAL(serviceRegistered(QString)), SLOT(exitLoop()));
+
+ // register a name
+ QVERIFY(con.registerService(serviceName));
+
+ QTestEventLoop::instance().enterLoop(1);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+
+ QCOMPARE(spyR.count(), 1);
+ QCOMPARE(spyR.at(0).at(0).toString(), serviceName);
+
+ QCOMPARE(spyU.count(), 0);
+
+ QCOMPARE(spyO.count(), 1);
+ QCOMPARE(spyO.at(0).at(0).toString(), serviceName);
+ QVERIFY(spyO.at(0).at(1).toString().isEmpty());
+ QCOMPARE(spyO.at(0).at(2).toString(), con.baseService());
+
+ spyR.clear();
+ spyU.clear();
+ spyO.clear();
+
+ // unregister it:
+ con.unregisterService(serviceName);
+
+ // and register again
+ QVERIFY(con.registerService(serviceName));
+
+ QTestEventLoop::instance().enterLoop(1);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+
+ QCOMPARE(spyR.count(), 1);
+ QCOMPARE(spyR.at(0).at(0).toString(), serviceName);
+
+ QCOMPARE(spyU.count(), 0);
+
+ QCOMPARE(spyO.count(), 1);
+ QCOMPARE(spyO.at(0).at(0).toString(), serviceName);
+ QVERIFY(spyO.at(0).at(1).toString().isEmpty());
+ QCOMPARE(spyO.at(0).at(2).toString(), con.baseService());
+}
+
+void tst_QDBusServiceWatcher::watchForDisappearance()
+{
+ QDBusConnection con = QDBusConnection::sessionBus();
+ QVERIFY(con.isConnected());
+
+ QDBusServiceWatcher watcher(serviceName, con, QDBusServiceWatcher::WatchForUnregistration);
+
+ QSignalSpy spyR(&watcher, SIGNAL(serviceRegistered(QString)));
+ QSignalSpy spyU(&watcher, SIGNAL(serviceUnregistered(QString)));
+ QSignalSpy spyO(&watcher, SIGNAL(serviceOwnerChanged(QString,QString,QString)));
+ QTestEventLoop::instance().connect(&watcher, SIGNAL(serviceUnregistered(QString)), SLOT(exitLoop()));
+
+ // register a name
+ QVERIFY(con.registerService(serviceName));
+
+ // unregister it:
+ con.unregisterService(serviceName);
+
+ QTestEventLoop::instance().enterLoop(1);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+
+ QCOMPARE(spyR.count(), 0);
+
+ QCOMPARE(spyU.count(), 1);
+ QCOMPARE(spyU.at(0).at(0).toString(), serviceName);
+
+ QCOMPARE(spyO.count(), 1);
+ QCOMPARE(spyO.at(0).at(0).toString(), serviceName);
+ QCOMPARE(spyO.at(0).at(1).toString(), con.baseService());
+ QVERIFY(spyO.at(0).at(2).toString().isEmpty());
+}
+
+void tst_QDBusServiceWatcher::watchForOwnerChange()
+{
+ QDBusConnection con = QDBusConnection::sessionBus();
+ QVERIFY(con.isConnected());
+
+ QDBusServiceWatcher watcher(serviceName, con, QDBusServiceWatcher::WatchForOwnerChange);
+
+ QSignalSpy spyR(&watcher, SIGNAL(serviceRegistered(QString)));
+ QSignalSpy spyU(&watcher, SIGNAL(serviceUnregistered(QString)));
+ QSignalSpy spyO(&watcher, SIGNAL(serviceOwnerChanged(QString,QString,QString)));
+ QTestEventLoop::instance().connect(&watcher, SIGNAL(serviceRegistered(QString)), SLOT(exitLoop()));
+
+ // register a name
+ QVERIFY(con.registerService(serviceName));
+
+ QTestEventLoop::instance().enterLoop(1);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+
+ QCOMPARE(spyR.count(), 1);
+ QCOMPARE(spyR.at(0).at(0).toString(), serviceName);
+
+ QCOMPARE(spyU.count(), 0);
+
+ QCOMPARE(spyO.count(), 1);
+ QCOMPARE(spyO.at(0).at(0).toString(), serviceName);
+ QVERIFY(spyO.at(0).at(1).toString().isEmpty());
+ QCOMPARE(spyO.at(0).at(2).toString(), con.baseService());
+
+ spyR.clear();
+ spyU.clear();
+ spyO.clear();
+
+ // unregister it:
+ con.unregisterService(serviceName);
+
+ // and register again
+ QVERIFY(con.registerService(serviceName));
+
+ QTestEventLoop::instance().enterLoop(1);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+
+ QCOMPARE(spyR.count(), 1);
+ QCOMPARE(spyR.at(0).at(0).toString(), serviceName);
+
+ QCOMPARE(spyU.count(), 1);
+ QCOMPARE(spyU.at(0).at(0).toString(), serviceName);
+
+ QCOMPARE(spyO.count(), 2);
+ QCOMPARE(spyO.at(0).at(0).toString(), serviceName);
+ QCOMPARE(spyO.at(0).at(1).toString(), con.baseService());
+ QVERIFY(spyO.at(0).at(2).toString().isEmpty());
+ QCOMPARE(spyO.at(1).at(0).toString(), serviceName);
+ QVERIFY(spyO.at(1).at(1).toString().isEmpty());
+ QCOMPARE(spyO.at(1).at(2).toString(), con.baseService());
+}
+
+void tst_QDBusServiceWatcher::modeChange()
+{
+ QDBusConnection con = QDBusConnection::sessionBus();
+ QVERIFY(con.isConnected());
+
+ QDBusServiceWatcher watcher(serviceName, con, QDBusServiceWatcher::WatchForRegistration);
+
+ QSignalSpy spyR(&watcher, SIGNAL(serviceRegistered(QString)));
+ QSignalSpy spyU(&watcher, SIGNAL(serviceUnregistered(QString)));
+ QSignalSpy spyO(&watcher, SIGNAL(serviceOwnerChanged(QString,QString,QString)));
+ QTestEventLoop::instance().connect(&watcher, SIGNAL(serviceRegistered(QString)), SLOT(exitLoop()));
+
+ // register a name
+ QVERIFY(con.registerService(serviceName));
+
+ QTestEventLoop::instance().enterLoop(1);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+
+ QCOMPARE(spyR.count(), 1);
+ QCOMPARE(spyR.at(0).at(0).toString(), serviceName);
+
+ QCOMPARE(spyU.count(), 0);
+
+ QCOMPARE(spyO.count(), 1);
+ QCOMPARE(spyO.at(0).at(0).toString(), serviceName);
+ QVERIFY(spyO.at(0).at(1).toString().isEmpty());
+ QCOMPARE(spyO.at(0).at(2).toString(), con.baseService());
+
+ spyR.clear();
+ spyU.clear();
+ spyO.clear();
+
+ watcher.setWatchMode(QDBusServiceWatcher::WatchForUnregistration);
+
+ // unregister it:
+ con.unregisterService(serviceName);
+
+ QTestEventLoop::instance().connect(&watcher, SIGNAL(serviceUnregistered(QString)), SLOT(exitLoop()));
+ QTestEventLoop::instance().enterLoop(1);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+
+ QCOMPARE(spyR.count(), 0);
+
+ QCOMPARE(spyU.count(), 1);
+ QCOMPARE(spyU.at(0).at(0).toString(), serviceName);
+
+ QCOMPARE(spyO.count(), 1);
+ QCOMPARE(spyO.at(0).at(0).toString(), serviceName);
+ QCOMPARE(spyO.at(0).at(1).toString(), con.baseService());
+ QVERIFY(spyO.at(0).at(2).toString().isEmpty());
+}
+
+QTEST_MAIN(tst_QDBusServiceWatcher)
+#include "tst_qdbusservicewatcher.moc"
diff --git a/tests/auto/qdom/tst_qdom.cpp b/tests/auto/qdom/tst_qdom.cpp
index 0d58554ea8..6637202a08 100644
--- a/tests/auto/qdom/tst_qdom.cpp
+++ b/tests/auto/qdom/tst_qdom.cpp
@@ -322,7 +322,6 @@ void tst_QDom::toString_01_data()
*/
void tst_QDom::toString_01()
{
- QFAIL("make test fail instead of timing out, will be fixed later (QT-2357)");
QFETCH(QString, fileName);
QFile f(fileName);
diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp
index e036e4bc6d..e9f0476e0b 100644
--- a/tests/auto/qgl/tst_qgl.cpp
+++ b/tests/auto/qgl/tst_qgl.cpp
@@ -118,6 +118,16 @@ public:
void setAutoBufferSwap(bool on) { QGLWidget::setAutoBufferSwap(on); }
};
+static int appDefaultDepth()
+{
+ static int depth = 0;
+ if (depth == 0) {
+ QPixmap pm(1, 1);
+ depth = pm.depth();
+ }
+ return depth;
+}
+
// Using INT_MIN and INT_MAX will cause failures on systems
// where "int" is 64-bit, so use the explicit values instead.
#define TEST_INT_MIN (-2147483647 - 1)
@@ -714,6 +724,8 @@ public:
void tst_QGL::graphicsViewClipping()
{
+ if (appDefaultDepth() < 24)
+ QSKIP("This test won't work for bit depths < 24", SkipAll);
const int size = 64;
UnclippedWidget *widget = new UnclippedWidget;
widget->setFixedSize(size, size);
@@ -866,6 +878,8 @@ public:
void tst_QGL::glWidgetRendering()
{
+ if (appDefaultDepth() < 24)
+ QSKIP("This test won't work for bit depths < 24", SkipAll);
GLWidget w;
w.show();
@@ -1089,6 +1103,8 @@ protected:
void tst_QGL::glFBOUseInGLWidget()
{
+ if (appDefaultDepth() < 24)
+ QSKIP("This test won't work for bit depths < 24", SkipAll);
if (!QGLFramebufferObject::hasOpenGLFramebufferObjects())
QSKIP("QGLFramebufferObject not supported on this platform", SkipSingle);
@@ -1116,6 +1132,8 @@ void tst_QGL::glFBOUseInGLWidget()
void tst_QGL::glWidgetReparent()
{
+ if (appDefaultDepth() < 24)
+ QSKIP("This test won't work for bit depths < 24", SkipAll);
// Try it as a top-level first:
GLWidget *widget = new GLWidget;
widget->setGeometry(0, 0, 200, 30);
@@ -1582,6 +1600,8 @@ protected:
void tst_QGL::replaceClipping()
{
+ if (appDefaultDepth() < 24)
+ QSKIP("This test won't work for bit depths < 24", SkipAll);
ReplaceClippingGLWidget glw;
glw.resize(300, 300);
glw.show();
@@ -1707,6 +1727,8 @@ protected:
void tst_QGL::clipTest()
{
+ if (appDefaultDepth() < 24)
+ QSKIP("This test won't work for bit depths < 24", SkipAll);
ClipTestGLWidget glw;
glw.resize(220, 220);
glw.show();
diff --git a/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp b/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp
index fbeb425ba8..55294d55e7 100644
--- a/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp
+++ b/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp
@@ -357,7 +357,7 @@ void tst_QGraphicsEffectSource::pixmapPadding_data()
QTest::newRow("log,transparent") << int(Qt::LogicalCoordinates)
<< int(QGraphicsEffectSource::ExpandToTransparentBorderPadMode)
- << QSize(12, 12) << QPoint(-1, -1)
+ << QSize(14, 14) << QPoint(-2, -2)
<< 0x00000000u;
QTest::newRow("log,effectrect") << int(Qt::LogicalCoordinates)
@@ -372,7 +372,7 @@ void tst_QGraphicsEffectSource::pixmapPadding_data()
QTest::newRow("dev,transparent") << int(Qt::DeviceCoordinates)
<< int(QGraphicsEffectSource::ExpandToTransparentBorderPadMode)
- << QSize(22, 22) << QPoint(39, 39)
+ << QSize(24, 24) << QPoint(38, 38)
<< 0x00000000u;
QTest::newRow("dev,effectrect") << int(Qt::DeviceCoordinates)
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index 1081fd5b7a..d65c6ecdb2 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -7679,20 +7679,6 @@ void tst_QGraphicsItem::hitTestGraphicsEffectItem()
QCOMPARE(items.size(), 1);
QCOMPARE(items.at(0), static_cast<QGraphicsItem *>(item3));
- item1->repaints = 0;
- item2->repaints = 0;
- item3->repaints = 0;
-
- view.viewport()->update(75, 75, 20, 20);
- QTest::qWait(50);
-
- // item1 is the effect source and must therefore be repainted.
- // item2 intersects with the exposed region
- // item3 is just another child outside the exposed region
- QCOMPARE(item1->repaints, 1);
- QCOMPARE(item2->repaints, 1);
- QCOMPARE(item3->repaints, 0);
-
scene.setItemIndexMethod(QGraphicsScene::NoIndex);
QTest::qWait(100);
diff --git a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp
index d8ab06edf2..9b15ab1ad2 100644
--- a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp
+++ b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp
@@ -259,7 +259,7 @@ void tst_QGraphicsTransform::rotation3d()
// Check that "rotation" produces the 4x4 form of the 3x3 matrix.
// i.e. third row and column are 0 0 1 0.
- t.setIdentity();
+ t.setToIdentity();
rotation.applyTo(&t);
QMatrix4x4 r(expected);
if (sizeof(qreal) == sizeof(float) && angle == 268) {
@@ -274,7 +274,7 @@ void tst_QGraphicsTransform::rotation3d()
rotation.setAxis(QVector3D(0, 0, 0));
rotation.setOrigin(QVector3D(10, 10, 0));
- t.setIdentity();
+ t.setToIdentity();
rotation.applyTo(&t);
QVERIFY(t.isIdentity());
@@ -337,7 +337,7 @@ void tst_QGraphicsTransform::rotation3dArbitraryAxis()
// Check that "rotation" produces the 4x4 form of the 3x3 matrix.
// i.e. third row and column are 0 0 1 0.
- t.setIdentity();
+ t.setToIdentity();
rotation.applyTo(&t);
QMatrix4x4 r(expected);
QVERIFY(qFuzzyCompare(t, r));
diff --git a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp
index be39d0075f..ab7b0ac144 100644
--- a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp
+++ b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp
@@ -976,7 +976,7 @@ void tst_QLocalSocket::writeOnlySocket()
#if defined(Q_OS_SYMBIAN)
QTest::qWait(250);
#endif
- QVERIFY(server.waitForNewConnection());
+ QVERIFY(server.waitForNewConnection(200));
QLocalSocket* serverSocket = server.nextPendingConnection();
QVERIFY(serverSocket);
diff --git a/tests/auto/qmatrixnxn/tst_qmatrixnxn.cpp b/tests/auto/qmatrixnxn/tst_qmatrixnxn.cpp
index ff5e00f084..d6d217f2bb 100644
--- a/tests/auto/qmatrixnxn/tst_qmatrixnxn.cpp
+++ b/tests/auto/qmatrixnxn/tst_qmatrixnxn.cpp
@@ -151,14 +151,8 @@ private slots:
void convertGeneric();
- void extractAxisRotation_data();
- void extractAxisRotation();
-
- void extractTranslation_data();
- void extractTranslation();
-
- void inferSpecialType_data();
- void inferSpecialType();
+ void optimize_data();
+ void optimize();
void columnsAndRows();
@@ -515,13 +509,13 @@ void tst_QMatrixNxN::create2x2()
m5 = m3;
QVERIFY(isSame(m5, uniqueValues2));
- m5.setIdentity();
+ m5.setToIdentity();
QVERIFY(isIdentity(m5));
QMatrix2x2 m6(uniqueValues2);
QVERIFY(isSame(m6, uniqueValues2));
qreal vals[4];
- m6.toValueArray(vals);
+ m6.copyDataTo(vals);
for (int index = 0; index < 4; ++index)
QCOMPARE(vals[index], uniqueValues2[index]);
}
@@ -550,13 +544,13 @@ void tst_QMatrixNxN::create3x3()
m5 = m3;
QVERIFY(isSame(m5, uniqueValues3));
- m5.setIdentity();
+ m5.setToIdentity();
QVERIFY(isIdentity(m5));
QMatrix3x3 m6(uniqueValues3);
QVERIFY(isSame(m6, uniqueValues3));
qreal vals[9];
- m6.toValueArray(vals);
+ m6.copyDataTo(vals);
for (int index = 0; index < 9; ++index)
QCOMPARE(vals[index], uniqueValues3[index]);
}
@@ -585,13 +579,13 @@ void tst_QMatrixNxN::create4x4()
m5 = m3;
QVERIFY(isSame(m5, uniqueValues4));
- m5.setIdentity();
+ m5.setToIdentity();
QVERIFY(isIdentity(m5));
QMatrix4x4 m6(uniqueValues4);
QVERIFY(isSame(m6, uniqueValues4));
qreal vals[16];
- m6.toValueArray(vals);
+ m6.copyDataTo(vals);
for (int index = 0; index < 16; ++index)
QCOMPARE(vals[index], uniqueValues4[index]);
@@ -627,13 +621,13 @@ void tst_QMatrixNxN::create4x3()
m5 = m3;
QVERIFY(isSame(m5, uniqueValues4x3));
- m5.setIdentity();
+ m5.setToIdentity();
QVERIFY(isIdentity(m5));
QMatrix4x3 m6(uniqueValues4x3);
QVERIFY(isSame(m6, uniqueValues4x3));
qreal vals[12];
- m6.toValueArray(vals);
+ m6.copyDataTo(vals);
for (int index = 0; index < 12; ++index)
QCOMPARE(vals[index], uniqueValues4x3[index]);
}
@@ -802,7 +796,7 @@ void tst_QMatrixNxN::transposed4x3()
QMatrix4x3 m3(uniqueValues4x3);
QMatrix3x4 m4 = m3.transposed();
qreal values[12];
- m4.toValueArray(values);
+ m4.copyDataTo(values);
for (int index = 0; index < 12; ++index)
QCOMPARE(values[index], transposedValues3x4[index]);
}
@@ -1296,7 +1290,7 @@ void tst_QMatrixNxN::multiply4x3()
QGenericMatrix<3, 3, qreal> m4;
m4 = m1 * m2;
qreal values[9];
- m4.toValueArray(values);
+ m4.copyDataTo(values);
for (int index = 0; index < 9; ++index)
QCOMPARE(values[index], ((const qreal *)m3Values)[index]);
}
@@ -1898,7 +1892,7 @@ void tst_QMatrixNxN::inverted4x4()
}
// Test again, after inferring the special matrix type.
- m1.inferSpecialType();
+ m1.optimize();
m2 = m1.inverted(&inv);
QVERIFY(isSame(m2, (const qreal *)m2Values));
QCOMPARE(inv, invertible);
@@ -1913,12 +1907,12 @@ void tst_QMatrixNxN::orthonormalInverse4x4()
m2.rotate(45.0, 1.0, 0.0, 0.0);
m2.translate(10.0, 0.0, 0.0);
- // Use inferSpecialType() to drop the internal flags that
+ // Use optimize() to drop the internal flags that
// mark the matrix as orthonormal. This will force inverted()
// to compute m3.inverted() the long way. We can then compare
// the result to what the faster algorithm produces on m2.
QMatrix4x4 m3 = m2;
- m3.inferSpecialType();
+ m3.optimize();
bool invertible;
QVERIFY(qFuzzyCompare(m2.inverted(&invertible), m3.inverted()));
QVERIFY(invertible);
@@ -1926,7 +1920,7 @@ void tst_QMatrixNxN::orthonormalInverse4x4()
QMatrix4x4 m4;
m4.rotate(45.0, 0.0, 1.0, 0.0);
QMatrix4x4 m5 = m4;
- m5.inferSpecialType();
+ m5.optimize();
QVERIFY(qFuzzyCompare(m4.inverted(), m5.inverted()));
QMatrix4x4 m6;
@@ -1934,7 +1928,7 @@ void tst_QMatrixNxN::orthonormalInverse4x4()
m1.translate(-20.0, 20.0, 15.0);
m1.rotate(25, 1.0, 0.0, 0.0);
QMatrix4x4 m7 = m6;
- m7.inferSpecialType();
+ m7.optimize();
QVERIFY(qFuzzyCompare(m6.inverted(), m7.inverted()));
}
@@ -2081,7 +2075,7 @@ void tst_QMatrixNxN::scale4x4()
m8.scale(x);
QVERIFY(isSame(m8, (const qreal *)resultValues));
- m8.inferSpecialType();
+ m8.optimize();
m8.scale(1.0f);
QVERIFY(isSame(m8, (const qreal *)resultValues));
@@ -2412,7 +2406,7 @@ void tst_QMatrixNxN::rotate4x4()
if (x != 0 || y != 0 || z != 0) {
QQuaternion q = QQuaternion::fromAxisAndAngle(QVector3D(x, y, z), angle);
- QVector3D vq = q.rotateVector(v1);
+ QVector3D vq = q.rotatedVector(v1);
QVERIFY(fuzzyCompare(vq.x(), v1x));
QVERIFY(fuzzyCompare(vq.y(), v1y));
QVERIFY(fuzzyCompare(vq.z(), v1z));
@@ -2509,7 +2503,7 @@ void tst_QMatrixNxN::normalMatrix()
// Perform the test again, after inferring special matrix types.
// This tests the optimized paths in the normalMatrix() function.
- m1.inferSpecialType();
+ m1.optimize();
n1 = m1.normalMatrix();
if (invertible)
@@ -2850,120 +2844,6 @@ void tst_QMatrixNxN::convertGeneric()
QVERIFY(isSame(m11, conv4x4));
}
-void tst_QMatrixNxN::extractAxisRotation_data()
-{
- QTest::addColumn<float>("x");
- QTest::addColumn<float>("y");
- QTest::addColumn<float>("z");
- QTest::addColumn<float>("angle");
-
- QTest::newRow("1, 0, 0, 0 deg") << 1.0f << 0.0f << 0.0f << 0.0f;
- QTest::newRow("1, 0, 0, 90 deg") << 1.0f << 0.0f << 0.0f << 90.0f;
- QTest::newRow("1, 0, 0, 270 deg") << 1.0f << 0.0f << 0.0f << 270.0f;
- QTest::newRow("1, 0, 0, 45 deg") << 1.0f << 0.0f << 0.0f << 45.0f;
- QTest::newRow("1, 0, 0, 120 deg") << 1.0f << 0.0f << 0.0f << 120.0f;
- QTest::newRow("1, 0, 0, 300 deg") << 1.0f << 0.0f << 0.0f << 300.0f;
-
- QTest::newRow("0, 1, 0, 90 deg") << 0.0f << 1.0f << 0.0f << 90.0f;
- QTest::newRow("0, 1, 0, 270 deg") << 0.0f << 1.0f << 0.0f << 270.0f;
- QTest::newRow("0, 1, 0, 45 deg") << 0.0f << 1.0f << 0.0f << 45.0f;
- QTest::newRow("0, 1, 0, 120 deg") << 0.0f << 1.0f << 0.0f << 120.0f;
- QTest::newRow("0, 1, 0, 300 deg") << 0.0f << 1.0f << 0.0f << 300.0f;
-
- QTest::newRow("0, 0, 1, 90 deg") << 0.0f << 0.0f << 1.0f << 90.0f;
- QTest::newRow("0, 0, 1, 270 deg") << 0.0f << 0.0f << 1.0f << 270.0f;
- QTest::newRow("0, 0, 1, 45 deg") << 0.0f << 0.0f << 1.0f << 45.0f;
- QTest::newRow("0, 0, 1, 120 deg") << 0.0f << 0.0f << 1.0f << 120.0f;
- QTest::newRow("0, 0, 1, 300 deg") << 0.0f << 0.0f << 1.0f << 300.0f;
-
- QTest::newRow("1, 1, 1, 90 deg") << 1.0f << 1.0f << 1.0f << 90.0f;
- QTest::newRow("1, 1, 1, 270 deg") << 1.0f << 1.0f << 1.0f << 270.0f;
- QTest::newRow("1, 1, 1, 45 deg") << 1.0f << 1.0f << 1.0f << 45.0f;
- QTest::newRow("1, 1, 1, 120 deg") << 1.0f << 1.0f << 1.0f << 120.0f;
- QTest::newRow("1, 1, 1, 300 deg") << 1.0f << 1.0f << 1.0f << 300.0f;
-}
-
-void tst_QMatrixNxN::extractAxisRotation()
-{
- QFETCH(float, x);
- QFETCH(float, y);
- QFETCH(float, z);
- QFETCH(float, angle);
-
- QMatrix4x4 m;
- QVector3D origAxis(x, y, z);
-
- m.rotate(angle, x, y, z);
-
- origAxis.normalize();
- QVector3D extractedAxis;
- qreal extractedAngle;
-
- m.extractAxisRotation(extractedAngle, extractedAxis);
-
- if (angle > 180) {
- QVERIFY(fuzzyCompare(360.0f - angle, extractedAngle));
- QVERIFY(fuzzyCompare(extractedAxis, -origAxis));
- } else {
- QVERIFY(fuzzyCompare(angle, extractedAngle));
- QVERIFY(fuzzyCompare(extractedAxis, origAxis));
- }
-}
-
-void tst_QMatrixNxN::extractTranslation_data()
-{
- QTest::addColumn<QMatrix4x4>("rotation");
- QTest::addColumn<float>("x");
- QTest::addColumn<float>("y");
- QTest::addColumn<float>("z");
-
- static QMatrix4x4 m1;
-
- QTest::newRow("identity, 100, 50, 25")
- << m1 << 100.0f << 50.0f << 250.0f;
-
- m1.rotate(45.0, 1.0, 0.0, 0.0);
- QTest::newRow("rotX 45 + 100, 50, 25") << m1 << 100.0f << 50.0f << 25.0f;
-
- m1.setIdentity();
- m1.rotate(45.0, 0.0, 1.0, 0.0);
- QTest::newRow("rotY 45 + 100, 50, 25") << m1 << 100.0f << 50.0f << 25.0f;
-
- m1.setIdentity();
- m1.rotate(75, 0.0, 0.0, 1.0);
- m1.rotate(25, 1.0, 0.0, 0.0);
- m1.rotate(45, 0.0, 1.0, 0.0);
- QTest::newRow("rotZ 75, rotX 25, rotY 45, 100, 50, 25") << m1 << 100.0f << 50.0f << 25.0f;
-}
-
-void tst_QMatrixNxN::extractTranslation()
-{
- QFETCH(QMatrix4x4, rotation);
- QFETCH(float, x);
- QFETCH(float, y);
- QFETCH(float, z);
-
- rotation.translate(x, y, z);
-
- QVector3D vec = rotation.extractTranslation();
-
- QVERIFY(fuzzyCompare(vec.x(), x));
- QVERIFY(fuzzyCompare(vec.y(), y));
- QVERIFY(fuzzyCompare(vec.z(), z));
-
- QMatrix4x4 lookAt;
- QVector3D eye(1.5f, -2.5f, 2.5f);
- lookAt.lookAt(eye,
- QVector3D(10.0f, 10.0f, 10.0f),
- QVector3D(0.0f, 1.0f, 0.0f));
-
- QVector3D extEye = lookAt.extractTranslation();
-
- QVERIFY(fuzzyCompare(eye.x(), -extEye.x()));
- QVERIFY(fuzzyCompare(eye.y(), -extEye.y()));
- QVERIFY(fuzzyCompare(eye.z(), -extEye.z()));
-}
-
// Copy of "flagBits" in qmatrix4x4.h.
enum {
Identity = 0x0001, // Identity matrix
@@ -2981,7 +2861,7 @@ struct Matrix4x4
};
// Test the inferring of special matrix types.
-void tst_QMatrixNxN::inferSpecialType_data()
+void tst_QMatrixNxN::optimize_data()
{
QTest::addColumn<void *>("mValues");
QTest::addColumn<int>("flagBits");
@@ -3029,13 +2909,13 @@ void tst_QMatrixNxN::inferSpecialType_data()
QTest::newRow("below")
<< (void *)belowValues << (int)General;
}
-void tst_QMatrixNxN::inferSpecialType()
+void tst_QMatrixNxN::optimize()
{
QFETCH(void *, mValues);
QFETCH(int, flagBits);
QMatrix4x4 m((const qreal *)mValues);
- m.inferSpecialType();
+ m.optimize();
QCOMPARE(reinterpret_cast<Matrix4x4 *>(&m)->flagBits, flagBits);
}
@@ -3362,7 +3242,7 @@ void tst_QMatrixNxN::mapVector()
QFETCH(void *, mValues);
QMatrix4x4 m1((const qreal *)mValues);
- m1.inferSpecialType();
+ m1.optimize();
QVector3D v(3.5f, -1.0f, 2.5f);
diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp
index 2bd1684a76..db46b66f4a 100644
--- a/tests/auto/qsslsocket/tst_qsslsocket.cpp
+++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp
@@ -1755,9 +1755,7 @@ void tst_QSslSocket::readFromClosedSocket()
socket->close();
QVERIFY(!socket->bytesAvailable());
QVERIFY(!socket->bytesToWrite());
- socket->waitForDisconnected();
- QVERIFY(!socket->bytesAvailable());
- QVERIFY(!socket->bytesToWrite());
+ QVERIFY(socket->state() == QAbstractSocket::UnconnectedState);
}
void tst_QSslSocket::writeBigChunk()
diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp
index 975b3012db..9a2b2edf1a 100644
--- a/tests/auto/qstatemachine/tst_qstatemachine.cpp
+++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp
@@ -162,7 +162,7 @@ private slots:
void defaultGlobalRestorePolicy();
void globalRestorePolicySetToRestore();
- void globalRestorePolicySetToDoNotRestore();
+ void globalRestorePolicySetToDontRestore();
void noInitialStateForInitialState();
@@ -184,7 +184,7 @@ private slots:
void twoAnimatedTransitions();
void playAnimationTwice();
void nestedTargetStateForAnimation();
- void polishedSignalTransitionsReuseAnimationGroup();
+ void propertiesAssignedSignalTransitionsReuseAnimationGroup();
void animatedGlobalRestoreProperty();
void specificTargetValueOfAnimation();
@@ -286,8 +286,8 @@ void tst_QStateMachine::transitionToRootState()
machine.addState(initialState);
machine.setInitialState(initialState);
- QAbstractTransition *trans = initialState->addTransition(new EventTransition(QEvent::User, &machine));
- QVERIFY(trans != 0);
+ QAbstractTransition *trans = new EventTransition(QEvent::User, &machine);
+ initialState->addTransition(trans);
QCOMPARE(trans->sourceState(), initialState);
QCOMPARE(trans->targetState(), static_cast<QAbstractState *>(&machine));
@@ -310,7 +310,7 @@ void tst_QStateMachine::transitionFromRootState()
QState *root = &machine;
QState *s1 = new QState(root);
EventTransition *trans = new EventTransition(QEvent::User, s1);
- QCOMPARE(root->addTransition(trans), static_cast<QAbstractTransition *>(trans));
+ root->addTransition(trans);
QCOMPARE(trans->sourceState(), root);
QCOMPARE(trans->targetState(), static_cast<QAbstractState *>(s1));
}
@@ -984,7 +984,7 @@ void tst_QStateMachine::customErrorStateNotInGraph()
void tst_QStateMachine::restoreProperties()
{
QStateMachine machine;
- QCOMPARE(machine.globalRestorePolicy(), QStateMachine::DoNotRestoreProperties);
+ QCOMPARE(machine.globalRestorePolicy(), QStateMachine::DontRestoreProperties);
machine.setGlobalRestorePolicy(QStateMachine::RestoreProperties);
QObject *object = new QObject(&machine);
@@ -1155,7 +1155,7 @@ void tst_QStateMachine::stateEntryAndExit()
QCOMPARE(t->targetState(), (QAbstractState*)s2);
QCOMPARE(t->targetStates().size(), 1);
QCOMPARE(t->targetStates().at(0), (QAbstractState*)s2);
- QCOMPARE(s1->addTransition(t), (QAbstractTransition*)t);
+ s1->addTransition(t);
QCOMPARE(t->sourceState(), (QState*)s1);
QCOMPARE(t->machine(), &machine);
@@ -1173,7 +1173,7 @@ void tst_QStateMachine::stateEntryAndExit()
s2->removeTransition(trans);
QCOMPARE(trans->sourceState(), (QState*)0);
QCOMPARE(trans->targetState(), (QAbstractState*)s3);
- QCOMPARE(s2->addTransition(trans), trans);
+ s2->addTransition(trans);
QCOMPARE(trans->sourceState(), (QState*)s2);
}
@@ -1319,9 +1319,9 @@ void tst_QStateMachine::assignProperty()
QCOMPARE(s1->objectName(), QString::fromLatin1("foo"));
{
- QSignalSpy polishedSpy(s1, SIGNAL(polished()));
+ QSignalSpy propertiesAssignedSpy(s1, SIGNAL(propertiesAssigned()));
machine.start();
- QTRY_COMPARE(polishedSpy.count(), 1);
+ QTRY_COMPARE(propertiesAssignedSpy.count(), 1);
}
// nested states
@@ -1340,11 +1340,11 @@ void tst_QStateMachine::assignPropertyWithAnimation()
// Single animation
{
QStateMachine machine;
- QVERIFY(machine.animationsEnabled());
- machine.setAnimationsEnabled(false);
- QVERIFY(!machine.animationsEnabled());
- machine.setAnimationsEnabled(true);
- QVERIFY(machine.animationsEnabled());
+ QVERIFY(machine.isAnimated());
+ machine.setAnimated(false);
+ QVERIFY(!machine.isAnimated());
+ machine.setAnimated(true);
+ QVERIFY(machine.isAnimated());
QObject obj;
obj.setProperty("foo", 321);
obj.setProperty("bar", 654);
@@ -1371,7 +1371,7 @@ void tst_QStateMachine::assignPropertyWithAnimation()
QCOMPARE(trans->animations().size(), 1);
QCOMPARE(trans->animations().at(0), (QAbstractAnimation*)&anim);
QFinalState *s3 = new QFinalState(&machine);
- s2->addTransition(s2, SIGNAL(polished()), s3);
+ s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3);
machine.setInitialState(s1);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
@@ -1399,7 +1399,7 @@ void tst_QStateMachine::assignPropertyWithAnimation()
anim2.setDuration(150);
trans->addAnimation(&anim2);
QFinalState *s3 = new QFinalState(&machine);
- s2->addTransition(s2, SIGNAL(polished()), s3);
+ s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3);
machine.setInitialState(s1);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
@@ -1427,7 +1427,7 @@ void tst_QStateMachine::assignPropertyWithAnimation()
group.addAnimation(new QPropertyAnimation(&obj, "bar"));
trans->addAnimation(&group);
QFinalState *s3 = new QFinalState(&machine);
- s2->addTransition(s2, SIGNAL(polished()), s3);
+ s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3);
machine.setInitialState(s1);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
@@ -1473,10 +1473,10 @@ void tst_QStateMachine::assignPropertyWithAnimation()
anim2.setDuration(250);
trans->addAnimation(&anim2);
- s21->addTransition(s21, SIGNAL(polished()), s22);
+ s21->addTransition(s21, SIGNAL(propertiesAssigned()), s22);
QFinalState *s3 = new QFinalState(&machine);
- s22->addTransition(s2, SIGNAL(polished()), s3);
+ s22->addTransition(s2, SIGNAL(propertiesAssigned()), s3);
machine.setInitialState(s1);
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
@@ -1513,13 +1513,13 @@ void tst_QStateMachine::assignPropertyWithAnimation()
machine.setInitialState(group);
machine.start();
QTRY_COMPARE(machine.configuration().contains(s1), true);
- QSignalSpy polishedSpy(s2, SIGNAL(polished()));
+ QSignalSpy propertiesAssignedSpy(s2, SIGNAL(propertiesAssigned()));
emitter.emitSignalWithNoArg();
QTRY_COMPARE(machine.configuration().contains(s2), true);
- QVERIFY(polishedSpy.isEmpty());
+ QVERIFY(propertiesAssignedSpy.isEmpty());
emitter.emitSignalWithNoArg(); // will cause animations from s1-->s2 to abort
QTRY_COMPARE(machine.configuration().contains(s3), true);
- QVERIFY(polishedSpy.isEmpty());
+ QVERIFY(propertiesAssignedSpy.isEmpty());
QCOMPARE(obj.property("foo").toInt(), 911);
QCOMPARE(obj.property("bar").toInt(), 789);
}
@@ -2736,10 +2736,10 @@ void tst_QStateMachine::restorePolicyNotInherited()
}*/
-void tst_QStateMachine::globalRestorePolicySetToDoNotRestore()
+void tst_QStateMachine::globalRestorePolicySetToDontRestore()
{
QStateMachine machine;
- machine.setGlobalRestorePolicy(QStateMachine::DoNotRestoreProperties);
+ machine.setGlobalRestorePolicy(QStateMachine::DontRestoreProperties);
QObject *propertyHolder = new QObject(&machine);
propertyHolder->setProperty("a", 1);
@@ -3089,7 +3089,7 @@ void tst_QStateMachine::twoAnimations()
QState *s3 = new QState(&machine);
QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit()));
- s2->addTransition(s2, SIGNAL(polished()), s3);
+ s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3);
machine.setInitialState(s1);
machine.start();
@@ -3117,7 +3117,9 @@ void tst_QStateMachine::twoAnimatedTransitions()
QState *s2 = new QState(&machine);
s2->assignProperty(object, "foo", 5.0);
QPropertyAnimation *fooAnimation = new QPropertyAnimation(object, "foo", s2);
- s1->addTransition(new EventTransition(QEvent::User, s2))->addAnimation(fooAnimation);
+ EventTransition *trans = new EventTransition(QEvent::User, s2);
+ s1->addTransition(trans);
+ trans->addAnimation(fooAnimation);
QState *s3 = new QState(&machine);
QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit()));
@@ -3126,7 +3128,9 @@ void tst_QStateMachine::twoAnimatedTransitions()
QState *s4 = new QState(&machine);
s4->assignProperty(object, "foo", 2.0);
QPropertyAnimation *fooAnimation2 = new QPropertyAnimation(object, "foo", s4);
- s3->addTransition(new EventTransition(QEvent::User, s4))->addAnimation(fooAnimation2);
+ trans = new EventTransition(QEvent::User, s4);
+ s3->addTransition(trans);
+ trans->addAnimation(fooAnimation2);
QState *s5 = new QState(&machine);
QObject::connect(s5, SIGNAL(entered()), QApplication::instance(), SLOT(quit()));
@@ -3161,7 +3165,9 @@ void tst_QStateMachine::playAnimationTwice()
QState *s2 = new QState(&machine);
s2->assignProperty(object, "foo", 5.0);
QPropertyAnimation *fooAnimation = new QPropertyAnimation(object, "foo", s2);
- s1->addTransition(new EventTransition(QEvent::User, s2))->addAnimation(fooAnimation);
+ EventTransition *trans = new EventTransition(QEvent::User, s2);
+ s1->addTransition(trans);
+ trans->addAnimation(fooAnimation);
QState *s3 = new QState(&machine);
QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit()));
@@ -3169,7 +3175,9 @@ void tst_QStateMachine::playAnimationTwice()
QState *s4 = new QState(&machine);
s4->assignProperty(object, "foo", 2.0);
- s3->addTransition(new EventTransition(QEvent::User, s4))->addAnimation(fooAnimation);
+ trans = new EventTransition(QEvent::User, s4);
+ s3->addTransition(trans);
+ trans->addAnimation(fooAnimation);
QState *s5 = new QState(&machine);
QObject::connect(s5, SIGNAL(entered()), QApplication::instance(), SLOT(quit()));
@@ -3213,14 +3221,16 @@ void tst_QStateMachine::nestedTargetStateForAnimation()
QState *s2Child2 = new QState(s2);
s2Child2->assignProperty(object, "bar", 11.0);
- QAbstractTransition *at = s2Child->addTransition(new EventTransition(QEvent::User, s2Child2));
+ QAbstractTransition *at = new EventTransition(QEvent::User, s2Child2);
+ s2Child->addTransition(at);
QPropertyAnimation *animation = new QPropertyAnimation(object, "bar", s2);
animation->setDuration(2000);
connect(animation, SIGNAL(finished()), &counter, SLOT(slot()));
at->addAnimation(animation);
- at = s1->addTransition(new EventTransition(QEvent::User, s2));
+ at = new EventTransition(QEvent::User, s2);
+ s1->addTransition(at);
animation = new QPropertyAnimation(object, "foo", s2);
connect(animation, SIGNAL(finished()), &counter, SLOT(slot()));
@@ -3231,7 +3241,7 @@ void tst_QStateMachine::nestedTargetStateForAnimation()
at->addAnimation(animation);
QState *s3 = new QState(&machine);
- s2->addTransition(s2Child, SIGNAL(polished()), s3);
+ s2->addTransition(s2Child, SIGNAL(propertiesAssigned()), s3);
QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit()));
@@ -3248,7 +3258,7 @@ void tst_QStateMachine::nestedTargetStateForAnimation()
QCOMPARE(counter.counter, 2);
}
-void tst_QStateMachine::polishedSignalTransitionsReuseAnimationGroup()
+void tst_QStateMachine::propertiesAssignedSignalTransitionsReuseAnimationGroup()
{
QStateMachine machine;
QObject *object = new QObject(&machine);
@@ -3265,9 +3275,9 @@ void tst_QStateMachine::polishedSignalTransitionsReuseAnimationGroup()
QParallelAnimationGroup animationGroup;
animationGroup.addAnimation(new QPropertyAnimation(object, "foo"));
QSignalSpy animationFinishedSpy(&animationGroup, SIGNAL(finished()));
- s1->addTransition(s1, SIGNAL(polished()), s2)->addAnimation(&animationGroup);
- s2->addTransition(s2, SIGNAL(polished()), s3)->addAnimation(&animationGroup);
- s3->addTransition(s3, SIGNAL(polished()), s4);
+ s1->addTransition(s1, SIGNAL(propertiesAssigned()), s2)->addAnimation(&animationGroup);
+ s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3)->addAnimation(&animationGroup);
+ s3->addTransition(s3, SIGNAL(propertiesAssigned()), s4);
machine.setInitialState(s1);
QSignalSpy machineFinishedSpy(&machine, SIGNAL(finished()));
@@ -3299,7 +3309,8 @@ void tst_QStateMachine::animatedGlobalRestoreProperty()
QState *s4 = new QState(&machine);
QObject::connect(s4, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit()));
- QAbstractTransition *at = s1->addTransition(new EventTransition(QEvent::User, s2));
+ QAbstractTransition *at = new EventTransition(QEvent::User, s2);
+ s1->addTransition(at);
QPropertyAnimation *pa = new QPropertyAnimation(object, "foo", s2);
connect(pa, SIGNAL(finished()), &counter, SLOT(slot()));
at->addAnimation(pa);
@@ -3341,7 +3352,9 @@ void tst_QStateMachine::specificTargetValueOfAnimation()
QPropertyAnimation *anim = new QPropertyAnimation(object, "foo");
anim->setEndValue(10.0);
- s1->addTransition(new EventTransition(QEvent::User, s2))->addAnimation(anim);
+ EventTransition *trans = new EventTransition(QEvent::User, s2);
+ s1->addTransition(trans);
+ trans->addAnimation(anim);
QState *s3 = new QState(&machine);
QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit()));
@@ -3495,7 +3508,8 @@ void tst_QStateMachine::overrideDefaultAnimationWithSpecific()
QState *s3 = new QState(&machine);
QObject::connect(s3, SIGNAL(entered()), QCoreApplication::instance(), SLOT(quit()));
- QAbstractTransition *at = s1->addTransition(new EventTransition(QEvent::User, s2));
+ QAbstractTransition *at = new EventTransition(QEvent::User, s2);
+ s1->addTransition(at);
QPropertyAnimation *defaultAnimation = new QPropertyAnimation(object, "foo");
connect(defaultAnimation, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)), &counter, SLOT(slot()));
diff --git a/tests/auto/qstringbuilder1/qstringbuilder1.pro b/tests/auto/qstringbuilder1/qstringbuilder1.pro
index 1ca9d456a8..5bb14d4290 100644
--- a/tests/auto/qstringbuilder1/qstringbuilder1.pro
+++ b/tests/auto/qstringbuilder1/qstringbuilder1.pro
@@ -3,7 +3,4 @@ load(qttest_p4)
QT = core
SOURCES += tst_qstringbuilder1.cpp
-HEADERS += ../qstringbuilder1/stringbuilder.h
-
-DEFINES += SCENARIO=1
diff --git a/tests/auto/qstringbuilder1/stringbuilder.cpp b/tests/auto/qstringbuilder1/stringbuilder.cpp
index 9fea137a58..f35d4d20d5 100644
--- a/tests/auto/qstringbuilder1/stringbuilder.cpp
+++ b/tests/auto/qstringbuilder1/stringbuilder.cpp
@@ -39,61 +39,9 @@
**
****************************************************************************/
-// This is included in various .cpp files as a compile test for various scenarios
-// depending on NO_CAST_* and QT_USE_FAST_OPERATOR_PLUS and QT_USE_FAST_CONCATENATION
-
-#if SCENARIO == 1
-// this is the "no harm done" version. Only operator% is active,
-// with NO_CAST * defined
-#define P %
-#undef QT_USE_FAST_OPERATOR_PLUS
-#undef QT_USE_FAST_CONCATENATION
-#define QT_NO_CAST_FROM_ASCII
-#define QT_NO_CAST_TO_ASCII
-#endif
-
-
-#if SCENARIO == 2
-// this is the "full" version. Operator+ is replaced by a QStringBuilder
-// based version
-// with NO_CAST * defined
-#define P +
-#define QT_USE_FAST_OPERATOR_PLUS
-#define QT_USE_FAST_CONCATENATION
-#define QT_NO_CAST_FROM_ASCII
-#define QT_NO_CAST_TO_ASCII
-#endif
-
-#if SCENARIO == 3
-// this is the "no harm done" version. Only operator% is active,
-// with NO_CAST * _not_ defined
-#define P %
-#undef QT_USE_FAST_OPERATOR_PLUS
-#undef QT_USE_FAST_CONCATENATION
-#undef QT_NO_CAST_FROM_ASCII
-#undef QT_NO_CAST_TO_ASCII
-#endif
-
-#if SCENARIO == 4
-// this is the "full" version. Operator+ is replaced by a QStringBuilder
-// based version
-// with NO_CAST * _not_ defined
-#define P +
-#define QT_USE_FAST_OPERATOR_PLUS
-#define QT_USE_FAST_CONCATENATION
-#undef QT_NO_CAST_FROM_ASCII
-#undef QT_NO_CAST_TO_ASCII
-#endif
-
-#include <QtTest/QtTest>
-#include "stringbuilder.h"
-
-//TESTED_CLASS=QStringBuilder
-//TESTED_FILES=qstringbuilder.cpp
-
#define LITERAL "some literal"
-void tst_QStringBuilder::scenario()
+void runScenario()
{
QLatin1Literal l1literal(LITERAL);
QLatin1String l1string(LITERAL);
@@ -129,5 +77,3 @@ void tst_QStringBuilder::scenario()
QCOMPARE(r, r2);
#endif
}
-
-QTEST_APPLESS_MAIN(tst_QStringBuilder)
diff --git a/tests/auto/qstringbuilder1/stringbuilder.h b/tests/auto/qstringbuilder1/stringbuilder.h
deleted file mode 100644
index 5ac9dbea82..0000000000
--- a/tests/auto/qstringbuilder1/stringbuilder.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the 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$
-**
-****************************************************************************/
-
-#ifndef TST_QSTRINGBUILDER_H
-#define TST_QSTRINGBUILDER_H
-
-#include <qobject.h>
-
-class tst_QStringBuilder : public QObject
-{
- Q_OBJECT
-
-private slots:
- void scenario();
-};
-
-#endif
diff --git a/tests/auto/qstringbuilder1/tst_qstringbuilder1.cpp b/tests/auto/qstringbuilder1/tst_qstringbuilder1.cpp
index bd2e4b0c65..d0a613c572 100644
--- a/tests/auto/qstringbuilder1/tst_qstringbuilder1.cpp
+++ b/tests/auto/qstringbuilder1/tst_qstringbuilder1.cpp
@@ -39,4 +39,35 @@
**
****************************************************************************/
-#include "../qstringbuilder1/stringbuilder.cpp"
+
+// SCENARIO 1
+// this is the "no harm done" version. Only operator% is active,
+// with NO_CAST * defined
+#define P %
+#undef QT_USE_FAST_OPERATOR_PLUS
+#undef QT_USE_FAST_CONCATENATION
+#define QT_NO_CAST_FROM_ASCII
+#define QT_NO_CAST_TO_ASCII
+
+
+#include <QtTest/QtTest>
+
+//TESTED_CLASS=QStringBuilder
+//TESTED_FILES=qstringbuilder.cpp
+
+#define LITERAL "some literal"
+
+void runScenario(); // Defined in stringbuilder.cpp #included below.
+
+class tst_QStringBuilder1 : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void scenario() { runScenario(); }
+};
+
+#include "stringbuilder.cpp"
+#include "tst_qstringbuilder1.moc"
+
+QTEST_APPLESS_MAIN(tst_QStringBuilder1)
diff --git a/tests/auto/qstringbuilder2/qstringbuilder2.pro b/tests/auto/qstringbuilder2/qstringbuilder2.pro
index c0b3ebc797..4152dc31e3 100644
--- a/tests/auto/qstringbuilder2/qstringbuilder2.pro
+++ b/tests/auto/qstringbuilder2/qstringbuilder2.pro
@@ -3,6 +3,3 @@ load(qttest_p4)
QT = core
SOURCES += tst_qstringbuilder2.cpp
-HEADERS += ../qstringbuilder1/stringbuilder.h
-
-DEFINES += SCENARIO=2
diff --git a/tests/auto/qstringbuilder2/tst_qstringbuilder2.cpp b/tests/auto/qstringbuilder2/tst_qstringbuilder2.cpp
index bd2e4b0c65..4470928def 100644
--- a/tests/auto/qstringbuilder2/tst_qstringbuilder2.cpp
+++ b/tests/auto/qstringbuilder2/tst_qstringbuilder2.cpp
@@ -39,4 +39,36 @@
**
****************************************************************************/
+
+// SCENARIO 2
+// this is the "full" version. Operator+ is replaced by a QStringBuilder
+// based version
+// with NO_CAST * defined
+#define P +
+#define QT_USE_FAST_OPERATOR_PLUS
+#define QT_USE_FAST_CONCATENATION
+#define QT_NO_CAST_FROM_ASCII
+#define QT_NO_CAST_TO_ASCII
+
+
+#include <QtTest/QtTest>
+
+//TESTED_CLASS=QStringBuilder
+//TESTED_FILES=qstringbuilder.cpp
+
+#define LITERAL "some literal"
+
+void runScenario(); // Defined in stringbuilder.cpp #included below.
+
+class tst_QStringBuilder2 : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void scenario() { runScenario(); }
+};
+
#include "../qstringbuilder1/stringbuilder.cpp"
+#include "tst_qstringbuilder2.moc"
+
+QTEST_APPLESS_MAIN(tst_QStringBuilder2)
diff --git a/tests/auto/qstringbuilder3/qstringbuilder3.pro b/tests/auto/qstringbuilder3/qstringbuilder3.pro
index 93d1a39e7e..b4d222591d 100644
--- a/tests/auto/qstringbuilder3/qstringbuilder3.pro
+++ b/tests/auto/qstringbuilder3/qstringbuilder3.pro
@@ -3,6 +3,3 @@ load(qttest_p4)
QT = core
SOURCES += tst_qstringbuilder3.cpp
-HEADERS += ../qstringbuilder1/stringbuilder.h
-
-DEFINES += SCENARIO=3
diff --git a/tests/auto/qstringbuilder3/tst_qstringbuilder3.cpp b/tests/auto/qstringbuilder3/tst_qstringbuilder3.cpp
index bd2e4b0c65..30f0181056 100644
--- a/tests/auto/qstringbuilder3/tst_qstringbuilder3.cpp
+++ b/tests/auto/qstringbuilder3/tst_qstringbuilder3.cpp
@@ -39,4 +39,35 @@
**
****************************************************************************/
+
+// SCENARIO 3
+// this is the "no harm done" version. Only operator% is active,
+// with NO_CAST * _not_ defined
+#define P %
+#undef QT_USE_FAST_OPERATOR_PLUS
+#undef QT_USE_FAST_CONCATENATION
+#undef QT_NO_CAST_FROM_ASCII
+#undef QT_NO_CAST_TO_ASCII
+
+
+#include <QtTest/QtTest>
+
+//TESTED_CLASS=QStringBuilder
+//TESTED_FILES=qstringbuilder.cpp
+
+#define LITERAL "some literal"
+
+void runScenario(); // Defined in stringbuilder.cpp #included below.
+
+class tst_QStringBuilder3 : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void scenario() { runScenario(); }
+};
+
#include "../qstringbuilder1/stringbuilder.cpp"
+#include "tst_qstringbuilder3.moc"
+
+QTEST_APPLESS_MAIN(tst_QStringBuilder3)
diff --git a/tests/auto/qstringbuilder4/qstringbuilder4.pro b/tests/auto/qstringbuilder4/qstringbuilder4.pro
index eeec447885..6ec522884b 100644
--- a/tests/auto/qstringbuilder4/qstringbuilder4.pro
+++ b/tests/auto/qstringbuilder4/qstringbuilder4.pro
@@ -3,6 +3,3 @@ load(qttest_p4)
QT = core
SOURCES += tst_qstringbuilder4.cpp
-HEADERS += ../qstringbuilder1/stringbuilder.h
-
-DEFINES += SCENARIO=4
diff --git a/tests/auto/qstringbuilder4/tst_qstringbuilder4.cpp b/tests/auto/qstringbuilder4/tst_qstringbuilder4.cpp
index 2159283bb5..95b4ec3a6e 100644
--- a/tests/auto/qstringbuilder4/tst_qstringbuilder4.cpp
+++ b/tests/auto/qstringbuilder4/tst_qstringbuilder4.cpp
@@ -4,7 +4,7 @@
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the QtXmlPatterns module of the Qt Toolkit.
+** This file is part of the test suite module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
@@ -39,4 +39,36 @@
**
****************************************************************************/
+
+// SCENARIO 4
+// this is the "full" version. Operator+ is replaced by a QStringBuilder
+// based version
+// with NO_CAST * _not_ defined
+#define P +
+#define QT_USE_FAST_OPERATOR_PLUS
+#define QT_USE_FAST_CONCATENATION
+#undef QT_NO_CAST_FROM_ASCII
+#undef QT_NO_CAST_TO_ASCII
+
+
+#include <QtTest/QtTest>
+
+//TESTED_CLASS=QStringBuilder
+//TESTED_FILES=qstringbuilder.cpp
+
+#define LITERAL "some literal"
+
+void runScenario(); // Defined in stringbuilder.cpp #included below.
+
+class tst_QStringBuilder4 : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void scenario() { runScenario(); }
+};
+
#include "../qstringbuilder1/stringbuilder.cpp"
+#include "tst_qstringbuilder4.moc"
+
+QTEST_APPLESS_MAIN(tst_QStringBuilder4)
diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp
index fe87dfb175..7c3f4f2481 100644
--- a/tests/auto/qtextlayout/tst_qtextlayout.cpp
+++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp
@@ -118,6 +118,7 @@ private slots:
void smallTextLengthWordWrap();
void smallTextLengthWrapAtWordBoundaryOrAnywhere();
void testLineBreakingAllSpaces();
+ void lineWidthFromBOM();
private:
@@ -1306,6 +1307,18 @@ void tst_QTextLayout::columnWrapWithTabs()
}
+void tst_QTextLayout::lineWidthFromBOM()
+{
+ const QString string(QChar(0xfeff)); // BYTE ORDER MARK
+ QTextLayout layout(string);
+ layout.beginLayout();
+ QTextLine line = layout.createLine();
+ line.setLineWidth(INT_MAX / 256);
+ layout.endLayout();
+
+ // Don't spin into an infinite loop
+ }
+
QTEST_MAIN(tst_QTextLayout)
#include "tst_qtextlayout.moc"
diff --git a/tests/auto/qudpsocket/tst_qudpsocket.cpp b/tests/auto/qudpsocket/tst_qudpsocket.cpp
index 7ea2163bf3..9418be0450 100644
--- a/tests/auto/qudpsocket/tst_qudpsocket.cpp
+++ b/tests/auto/qudpsocket/tst_qudpsocket.cpp
@@ -719,6 +719,8 @@ void tst_QUdpSocket::outOfProcessConnectedClientServerTest()
QProcess serverProcess;
serverProcess.start(QLatin1String("clientserver/clientserver server 1 1"),
QIODevice::ReadWrite | QIODevice::Text);
+ QVERIFY2(serverProcess.waitForStarted(3000),
+ qPrintable("Failed to start subprocess: " + serverProcess.errorString()));
// Wait until the server has started and reports success.
while (!serverProcess.canReadLine())
@@ -732,6 +734,9 @@ void tst_QUdpSocket::outOfProcessConnectedClientServerTest()
clientProcess.start(QString::fromLatin1("clientserver/clientserver connectedclient %1 %2")
.arg(QLatin1String("127.0.0.1")).arg(serverPort),
QIODevice::ReadWrite | QIODevice::Text);
+ QVERIFY2(clientProcess.waitForStarted(3000),
+ qPrintable("Failed to start subprocess: " + clientProcess.errorString()));
+
// Wait until the server has started and reports success.
while (!clientProcess.canReadLine())
QVERIFY(clientProcess.waitForReadyRead(3000));
@@ -779,6 +784,8 @@ void tst_QUdpSocket::outOfProcessUnconnectedClientServerTest()
QProcess serverProcess;
serverProcess.start(QLatin1String("clientserver/clientserver server 1 1"),
QIODevice::ReadWrite | QIODevice::Text);
+ QVERIFY2(serverProcess.waitForStarted(3000),
+ qPrintable("Failed to start subprocess: " + serverProcess.errorString()));
// Wait until the server has started and reports success.
while (!serverProcess.canReadLine())
@@ -792,6 +799,9 @@ void tst_QUdpSocket::outOfProcessUnconnectedClientServerTest()
clientProcess.start(QString::fromLatin1("clientserver/clientserver unconnectedclient %1 %2")
.arg(QLatin1String("127.0.0.1")).arg(serverPort),
QIODevice::ReadWrite | QIODevice::Text);
+ QVERIFY2(clientProcess.waitForStarted(3000),
+ qPrintable("Failed to start subprocess: " + clientProcess.errorString()));
+
// Wait until the server has started and reports success.
while (!clientProcess.canReadLine())
QVERIFY(clientProcess.waitForReadyRead(3000));
diff --git a/tests/auto/qvariant/tst_qvariant.cpp b/tests/auto/qvariant/tst_qvariant.cpp
index e2a606f8a5..3d68a734db 100644
--- a/tests/auto/qvariant/tst_qvariant.cpp
+++ b/tests/auto/qvariant/tst_qvariant.cpp
@@ -1432,8 +1432,10 @@ void tst_QVariant::matrix4x4()
QVariant variant;
QMatrix4x4 matrix = qVariantValue<QMatrix4x4>(variant);
QVERIFY(matrix.isIdentity());
- qVariantSetValue(variant, QMatrix4x4().scale(2.0));
- QCOMPARE(QMatrix4x4().scale(2.0), qVariantValue<QMatrix4x4>(variant));
+ QMatrix4x4 m;
+ m.scale(2.0f);
+ qVariantSetValue(variant, m);
+ QCOMPARE(m, qVariantValue<QMatrix4x4>(variant));
void *mmatrix = QMetaType::construct(QVariant::Matrix4x4, 0);
QVERIFY(mmatrix);
diff --git a/tests/auto/qvideoframe/tst_qvideoframe.cpp b/tests/auto/qvideoframe/tst_qvideoframe.cpp
index b231069f88..432ef5cf1d 100644
--- a/tests/auto/qvideoframe/tst_qvideoframe.cpp
+++ b/tests/auto/qvideoframe/tst_qvideoframe.cpp
@@ -524,7 +524,7 @@ void tst_QVideoFrame::assign()
void tst_QVideoFrame::map_data()
{
QTest::addColumn<QSize>("size");
- QTest::addColumn<int>("numBytes");
+ QTest::addColumn<int>("mappedBytes");
QTest::addColumn<int>("bytesPerLine");
QTest::addColumn<QVideoFrame::PixelFormat>("pixelFormat");
QTest::addColumn<QAbstractVideoBuffer::MapMode>("mode");
@@ -554,29 +554,29 @@ void tst_QVideoFrame::map_data()
void tst_QVideoFrame::map()
{
QFETCH(QSize, size);
- QFETCH(int, numBytes);
+ QFETCH(int, mappedBytes);
QFETCH(int, bytesPerLine);
QFETCH(QVideoFrame::PixelFormat, pixelFormat);
QFETCH(QAbstractVideoBuffer::MapMode, mode);
- QVideoFrame frame(numBytes, size, bytesPerLine, pixelFormat);
+ QVideoFrame frame(mappedBytes, size, bytesPerLine, pixelFormat);
QVERIFY(!frame.bits());
- QCOMPARE(frame.numBytes(), 0);
+ QCOMPARE(frame.mappedBytes(), 0);
QCOMPARE(frame.bytesPerLine(), 0);
QCOMPARE(frame.mapMode(), QAbstractVideoBuffer::NotMapped);
QVERIFY(frame.map(mode));
QVERIFY(frame.bits());
- QCOMPARE(frame.numBytes(), numBytes);
+ QCOMPARE(frame.mappedBytes(), mappedBytes);
QCOMPARE(frame.bytesPerLine(), bytesPerLine);
QCOMPARE(frame.mapMode(), mode);
frame.unmap();
QVERIFY(!frame.bits());
- QCOMPARE(frame.numBytes(), 0);
+ QCOMPARE(frame.mappedBytes(), 0);
QCOMPARE(frame.bytesPerLine(), 0);
QCOMPARE(frame.mapMode(), QAbstractVideoBuffer::NotMapped);
}
@@ -614,21 +614,21 @@ void tst_QVideoFrame::mapImage()
QVideoFrame frame(image);
QVERIFY(!frame.bits());
- QCOMPARE(frame.numBytes(), 0);
+ QCOMPARE(frame.mappedBytes(), 0);
QCOMPARE(frame.bytesPerLine(), 0);
QCOMPARE(frame.mapMode(), QAbstractVideoBuffer::NotMapped);
QVERIFY(frame.map(mode));
QVERIFY(frame.bits());
- QCOMPARE(frame.numBytes(), image.numBytes());
+ QCOMPARE(frame.mappedBytes(), image.numBytes());
QCOMPARE(frame.bytesPerLine(), image.bytesPerLine());
QCOMPARE(frame.mapMode(), mode);
frame.unmap();
QVERIFY(!frame.bits());
- QCOMPARE(frame.numBytes(), 0);
+ QCOMPARE(frame.mappedBytes(), 0);
QCOMPARE(frame.bytesPerLine(), 0);
QCOMPARE(frame.mapMode(), QAbstractVideoBuffer::NotMapped);
}
diff --git a/tests/auto/qvideosurfaceformat/tst_qvideosurfaceformat.cpp b/tests/auto/qvideosurfaceformat/tst_qvideosurfaceformat.cpp
index 9623e8064e..a47cb4880d 100644
--- a/tests/auto/qvideosurfaceformat/tst_qvideosurfaceformat.cpp
+++ b/tests/auto/qvideosurfaceformat/tst_qvideosurfaceformat.cpp
@@ -68,8 +68,8 @@ private slots:
void scanLineDirection();
void frameRate_data();
void frameRate();
- void yuvColorSpace_data();
- void yuvColorSpace();
+ void yCbCrColorSpace_data();
+ void yCbCrColorSpace();
void pixelAspectRatio_data();
void pixelAspectRatio();
void sizeHint_data();
@@ -81,9 +81,6 @@ private slots:
void assign();
};
-Q_DECLARE_METATYPE(QVideoSurfaceFormat::ViewportMode)
-
-
tst_QVideoSurfaceFormat::tst_QVideoSurfaceFormat()
{
}
@@ -122,7 +119,7 @@ void tst_QVideoSurfaceFormat::constructNull()
QCOMPARE(format.scanLineDirection(), QVideoSurfaceFormat::TopToBottom);
QCOMPARE(format.frameRate(), 0.0);
QCOMPARE(format.pixelAspectRatio(), QSize(1, 1));
- QCOMPARE(format.yuvColorSpace(), QVideoSurfaceFormat::YCbCr_Undefined);
+ QCOMPARE(format.yCbCrColorSpace(), QVideoSurfaceFormat::YCbCr_Undefined);
}
void tst_QVideoSurfaceFormat::construct_data()
@@ -161,7 +158,7 @@ void tst_QVideoSurfaceFormat::construct()
QCOMPARE(format.scanLineDirection(), QVideoSurfaceFormat::TopToBottom);
QCOMPARE(format.frameRate(), 0.0);
QCOMPARE(format.pixelAspectRatio(), QSize(1, 1));
- QCOMPARE(format.yuvColorSpace(), QVideoSurfaceFormat::YCbCr_Undefined);
+ QCOMPARE(format.yCbCrColorSpace(), QVideoSurfaceFormat::YCbCr_Undefined);
}
void tst_QVideoSurfaceFormat::frameSize_data()
@@ -202,45 +199,23 @@ void tst_QVideoSurfaceFormat::viewport_data()
QTest::addColumn<QSize>("initialSize");
QTest::addColumn<QRect>("viewport");
QTest::addColumn<QSize>("newSize");
- QTest::addColumn<QVideoSurfaceFormat::ViewportMode>("viewportMode");
QTest::addColumn<QRect>("expectedViewport");
QTest::newRow("grow reset")
<< QSize(64, 64)
<< QRect(8, 8, 48, 48)
<< QSize(1024, 1024)
- << QVideoSurfaceFormat::ResetViewport
<< QRect(0, 0, 1024, 1024);
- QTest::newRow("grow keep")
- << QSize(64, 64)
- << QRect(8, 8, 48, 48)
- << QSize(1024, 1024)
- << QVideoSurfaceFormat::KeepViewport
- << QRect(8, 8, 48, 48);
QTest::newRow("shrink reset")
<< QSize(1024, 1024)
<< QRect(8, 8, 1008, 1008)
<< QSize(64, 64)
- << QVideoSurfaceFormat::ResetViewport
<< QRect(0, 0, 64, 64);
- QTest::newRow("shrink keep")
- << QSize(1024, 1024)
- << QRect(8, 8, 1008, 1008)
- << QSize(64, 64)
- << QVideoSurfaceFormat::KeepViewport
- << QRect(8, 8, 56, 56);
QTest::newRow("unchanged reset")
<< QSize(512, 512)
<< QRect(8, 8, 496, 496)
<< QSize(512, 512)
- << QVideoSurfaceFormat::ResetViewport
<< QRect(0, 0, 512, 512);
- QTest::newRow("unchanged keep")
- << QSize(512, 512)
- << QRect(8, 8, 496, 496)
- << QSize(512, 512)
- << QVideoSurfaceFormat::KeepViewport
- << QRect(8, 8, 496, 496);
}
void tst_QVideoSurfaceFormat::viewport()
@@ -248,7 +223,6 @@ void tst_QVideoSurfaceFormat::viewport()
QFETCH(QSize, initialSize);
QFETCH(QRect, viewport);
QFETCH(QSize, newSize);
- QFETCH(QVideoSurfaceFormat::ViewportMode, viewportMode);
QFETCH(QRect, expectedViewport);
{
@@ -261,7 +235,7 @@ void tst_QVideoSurfaceFormat::viewport()
QCOMPARE(format.viewport(), viewport);
QCOMPARE(format.property("viewport").toRect(), viewport);
- format.setFrameSize(newSize, viewportMode);
+ format.setFrameSize(newSize);
QCOMPARE(format.viewport(), expectedViewport);
QCOMPARE(format.property("viewport").toRect(), expectedViewport);
@@ -350,9 +324,9 @@ void tst_QVideoSurfaceFormat::frameRate()
}
}
-void tst_QVideoSurfaceFormat::yuvColorSpace_data()
+void tst_QVideoSurfaceFormat::yCbCrColorSpace_data()
{
- QTest::addColumn<QVideoSurfaceFormat::YuvColorSpace>("colorspace");
+ QTest::addColumn<QVideoSurfaceFormat::YCbCrColorSpace>("colorspace");
QTest::newRow("undefined")
<< QVideoSurfaceFormat::YCbCr_Undefined;
@@ -364,24 +338,24 @@ void tst_QVideoSurfaceFormat::yuvColorSpace_data()
<< QVideoSurfaceFormat::YCbCr_JPEG;
}
-void tst_QVideoSurfaceFormat::yuvColorSpace()
+void tst_QVideoSurfaceFormat::yCbCrColorSpace()
{
- QFETCH(QVideoSurfaceFormat::YuvColorSpace, colorspace);
+ QFETCH(QVideoSurfaceFormat::YCbCrColorSpace, colorspace);
{
QVideoSurfaceFormat format(QSize(64, 64), QVideoFrame::Format_RGB32);
- format.setYuvColorSpace(colorspace);
+ format.setYCbCrColorSpace(colorspace);
- QCOMPARE(format.yuvColorSpace(), colorspace);
- QCOMPARE(qvariant_cast<QVideoSurfaceFormat::YuvColorSpace>(format.property("yuvColorSpace")),
+ QCOMPARE(format.yCbCrColorSpace(), colorspace);
+ QCOMPARE(qvariant_cast<QVideoSurfaceFormat::YCbCrColorSpace>(format.property("yCbCrColorSpace")),
colorspace);
}
{
QVideoSurfaceFormat format(QSize(64, 64), QVideoFrame::Format_RGB32);
- format.setProperty("yuvColorSpace", qVariantFromValue(colorspace));
+ format.setProperty("yCbCrColorSpace", qVariantFromValue(colorspace));
- QCOMPARE(format.yuvColorSpace(), colorspace);
- QCOMPARE(qvariant_cast<QVideoSurfaceFormat::YuvColorSpace>(format.property("yuvColorSpace")),
+ QCOMPARE(format.yCbCrColorSpace(), colorspace);
+ QCOMPARE(qvariant_cast<QVideoSurfaceFormat::YCbCrColorSpace>(format.property("yCbCrColorSpace")),
colorspace);
}
}
@@ -483,7 +457,7 @@ void tst_QVideoSurfaceFormat::staticPropertyNames()
QVERIFY(propertyNames.contains("scanLineDirection"));
QVERIFY(propertyNames.contains("frameRate"));
QVERIFY(propertyNames.contains("pixelAspectRatio"));
- QVERIFY(propertyNames.contains("yuvColorSpace"));
+ QVERIFY(propertyNames.contains("yCbCrColorSpace"));
QVERIFY(propertyNames.contains("sizeHint"));
QCOMPARE(propertyNames.count(), 10);
}
@@ -566,19 +540,26 @@ void tst_QVideoSurfaceFormat::compare()
QCOMPARE(format1 == format4, false);
QCOMPARE(format1 != format4, true);
- format2.setFrameSize(1024, 768, QVideoSurfaceFormat::ResetViewport);
+ format2.setFrameSize(1024, 768);
// Not equal, frame size differs.
QCOMPARE(format1 == format2, false);
QCOMPARE(format1 != format2, true);
- format1.setFrameSize(1024, 768, QVideoSurfaceFormat::KeepViewport);
+ format1.setFrameSize(1024, 768);
+
+ // Equal.
+ QCOMPARE(format1 == format2, true);
+ QCOMPARE(format1 != format2, false);
+
+ format1.setViewport(QRect(0, 0, 800, 600));
+ format2.setViewport(QRect(112, 84, 800, 600));
- // Not equal, viewport differs.
+ // Not equal, viewports differ.
QCOMPARE(format1 == format2, false);
QCOMPARE(format1 != format2, true);
- format1.setViewport(QRect(0, 0, 1024, 768));
+ format1.setViewport(QRect(112, 84, 800, 600));
// Equal.
QCOMPARE(format1 == format2, true);
@@ -620,13 +601,13 @@ void tst_QVideoSurfaceFormat::compare()
QCOMPARE(format1 == format2, true);
QCOMPARE(format1 != format2, false);
- format2.setYuvColorSpace(QVideoSurfaceFormat::YCbCr_xvYCC601);
+ format2.setYCbCrColorSpace(QVideoSurfaceFormat::YCbCr_xvYCC601);
// Not equal yuv color space differs.
QCOMPARE(format1 == format2, false);
QCOMPARE(format1 != format2, true);
- format1.setYuvColorSpace(QVideoSurfaceFormat::YCbCr_xvYCC601);
+ format1.setYCbCrColorSpace(QVideoSurfaceFormat::YCbCr_xvYCC601);
// Equal.
QCOMPARE(format1 == format2, true);