summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@accenture.com>2011-04-11 10:48:44 (GMT)
committerShane Kearns <shane.kearns@accenture.com>2011-04-11 10:48:44 (GMT)
commit1062da14facb7dd10f0928a4c242549d3626f9ba (patch)
tree4462fcaa82b45c47eddcdcb1d89e1cc03de45a85 /tests/auto
parent847df81a5680fe4d71196d0afe5e68e41ae49700 (diff)
parentdd60cf7ba8afdf5c84f5793c1e1d08ab18303a74 (diff)
downloadQt-1062da14facb7dd10f0928a4c242549d3626f9ba.zip
Qt-1062da14facb7dd10f0928a4c242549d3626f9ba.tar.gz
Qt-1062da14facb7dd10f0928a4c242549d3626f9ba.tar.bz2
Merge branch 'master' of scm.dev.troll.no:qt/qt-earth-team into symbian-socket-engine
Conflicts: src/s60installs/bwins/QtCoreu.def src/s60installs/bwins/QtGuiu.def src/s60installs/bwins/QtNetworku.def src/s60installs/eabi/QtCoreu.def src/s60installs/eabi/QtGuiu.def src/s60installs/eabi/QtNetworku.def src/s60installs/eabi/QtOpenVGu.def tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/collections/tst_collections.cpp11
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/writeAttachedProperty.qml6
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp30
-rw-r--r--tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp22
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativepincharea/data/flickresize.qml50
-rw-r--r--tests/auto/declarative/qdeclarativepincharea/tst_qdeclarativepincharea.cpp73
-rw-r--r--tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp22
-rw-r--r--tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp18
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/data/CursorRect.qml8
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp32
-rw-r--r--tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp85
-rw-r--r--tests/auto/declarative/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp8
-rw-r--r--tests/auto/mediaobject/dummy/dummy.pro2
-rw-r--r--tests/auto/moc/tst_moc.cpp22
-rw-r--r--tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp35
-rw-r--r--tests/auto/qbytearray/tst_qbytearray.cpp12
-rw-r--r--tests/auto/qdatetime/tst_qdatetime.cpp2
-rw-r--r--tests/auto/qdir/qdir.pro2
-rw-r--r--tests/auto/qdir/tst_qdir.cpp20
-rw-r--r--tests/auto/qftp/tst_qftp.cpp15
-rw-r--r--tests/auto/qfuture/tst_qfuture.cpp28
-rw-r--r--tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp4
-rwxr-xr-xtests/auto/qimagereader/images/txts.pngbin0 -> 5413 bytes
-rw-r--r--tests/auto/qimagereader/qimagereader.qrc1
-rw-r--r--tests/auto/qimagereader/tst_qimagereader.cpp28
-rw-r--r--tests/auto/qlocale/tst_qlocale.cpp6
-rw-r--r--tests/auto/qmetaobject/tst_qmetaobject.cpp29
-rw-r--r--tests/auto/qmutex/tst_qmutex.cpp69
-rw-r--r--tests/auto/qnetworkdiskcache/tst_qnetworkdiskcache.cpp32
-rw-r--r--tests/auto/qnetworkreply/tst_qnetworkreply.cpp40
-rw-r--r--tests/auto/qobject/tst_qobject.cpp31
-rw-r--r--tests/auto/qpainterpath/tst_qpainterpath.cpp4
-rw-r--r--tests/auto/qpixmap/tst_qpixmap.cpp15
-rw-r--r--tests/auto/qprocessenvironment/tst_qprocessenvironment.cpp54
-rw-r--r--tests/auto/qscriptv8testsuite/abstracttestsuite.cpp12
-rw-r--r--tests/auto/qscriptv8testsuite/skip.txt14
-rw-r--r--tests/auto/qsemaphore/tst_qsemaphore.cpp26
-rw-r--r--tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp34
-rw-r--r--tests/auto/qsqlquery/tst_qsqlquery.cpp7
-rw-r--r--tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp6
-rw-r--r--tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp6
-rw-r--r--tests/auto/qsslcertificate/more-certificates/blacklisted1.pem19
-rw-r--r--tests/auto/qsslcertificate/more-certificates/blacklisted2.pem19
-rw-r--r--tests/auto/qsslcertificate/more-certificates/blacklisted3.pem19
-rw-r--r--tests/auto/qsslcertificate/more-certificates/blacklisted4.pem19
-rw-r--r--tests/auto/qsslcertificate/more-certificates/blacklisted5.pem19
-rw-r--r--tests/auto/qsslcertificate/more-certificates/blacklisted6.pem19
-rw-r--r--tests/auto/qsslcertificate/more-certificates/blacklisted7.pem19
-rw-r--r--tests/auto/qsslcertificate/more-certificates/blacklisted8.pem19
-rw-r--r--tests/auto/qsslcertificate/more-certificates/blacklisted9.pem19
-rw-r--r--tests/auto/qsslcertificate/tst_qsslcertificate.cpp11
-rw-r--r--tests/auto/qsslsocket/certs/fake-login.live.com.key15
-rw-r--r--tests/auto/qsslsocket/certs/fake-login.live.com.pem19
-rw-r--r--tests/auto/qsslsocket/tst_qsslsocket.cpp85
-rw-r--r--tests/auto/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp7
-rw-r--r--tests/auto/qsslsocket_onDemandCertificates_static/tst_qsslsocket_onDemandCertificates_static.cpp12
-rw-r--r--tests/auto/qstring/tst_qstring.cpp38
-rw-r--r--tests/auto/qstringbuilder1/stringbuilder.cpp59
-rw-r--r--tests/auto/qstringlist/tst_qstringlist.cpp13
-rw-r--r--tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp167
-rw-r--r--tests/auto/qtextboundaryfinder/tst_qtextboundaryfinder.cpp6
-rw-r--r--tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp85
-rw-r--r--tests/auto/qthread/tst_qthread.cpp85
-rw-r--r--tests/auto/qthreadstorage/tst_qthreadstorage.cpp15
-rw-r--r--tests/auto/qvariant/tst_qvariant.cpp13
-rw-r--r--tests/auto/qwindowsurface/tst_qwindowsurface.cpp48
68 files changed, 1523 insertions, 251 deletions
diff --git a/tests/auto/collections/tst_collections.cpp b/tests/auto/collections/tst_collections.cpp
index 9b24660..b1ea326 100644
--- a/tests/auto/collections/tst_collections.cpp
+++ b/tests/auto/collections/tst_collections.cpp
@@ -104,13 +104,6 @@ void foo()
#include "q3cleanuphandler.h"
#endif
-// Do not test initialization of pods on msvc6 and msvc 2002
-// This is a known issue
-#if defined Q_CC_MSVC && _MSC_VER < 1310
-# define NOPODINITIALIZATION
-#endif
-
-
template class QList<int>;
//TESTED_FILES=
@@ -198,10 +191,6 @@ QT_END_NAMESPACE
struct Pod {
int i1, i2;
-
-#if defined NOPODINITIALIZATION
- Pod() : i1(0), i2(0) { }
-#endif
};
tst_Collections::tst_Collections()
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/writeAttachedProperty.qml b/tests/auto/declarative/qdeclarativeecmascript/data/writeAttachedProperty.qml
new file mode 100644
index 0000000..31bf69d
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/writeAttachedProperty.qml
@@ -0,0 +1,6 @@
+import QtQuick 1.0
+import Qt.test 1.0
+
+QtObject {
+ function writeValue2() { MyQmlObject.value2 = 9 }
+}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
index 40b0e1b..48466d5 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
+++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
@@ -639,15 +639,29 @@ void tst_qdeclarativeecmascript::overrideExtensionProperties()
void tst_qdeclarativeecmascript::attachedProperties()
{
- QDeclarativeComponent component(&engine, TEST_FILE("attachedProperty.qml"));
- QObject *object = component.create();
- QVERIFY(object != 0);
- QCOMPARE(object->property("a").toInt(), 19);
- QCOMPARE(object->property("b").toInt(), 19);
- QCOMPARE(object->property("c").toInt(), 19);
- QCOMPARE(object->property("d").toInt(), 19);
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("attachedProperty.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("a").toInt(), 19);
+ QCOMPARE(object->property("b").toInt(), 19);
+ QCOMPARE(object->property("c").toInt(), 19);
+ QCOMPARE(object->property("d").toInt(), 19);
+ }
- // ### Need to test attached property assignment
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("writeAttachedProperty.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QMetaObject::invokeMethod(object, "writeValue2");
+
+ MyQmlAttachedObject *attached =
+ qobject_cast<MyQmlAttachedObject *>(qmlAttachedPropertiesObject<MyQmlObject>(object));
+ QVERIFY(attached != 0);
+
+ QCOMPARE(attached->value2(), 9);
+ }
}
void tst_qdeclarativeecmascript::enums()
diff --git a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp
index 9e090d2..c5a3d14 100644
--- a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp
+++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp
@@ -91,6 +91,7 @@ private slots:
void sourceSize_QTBUG_14303();
void sourceSize_QTBUG_16389();
void nullPixmapPaint();
+ void resetSourceSize();
void testQtQuick11Attributes();
void testQtQuick11Attributes_data();
@@ -693,6 +694,27 @@ void tst_qdeclarativeimage::nullPixmapPaint()
delete image;
}
+void tst_qdeclarativeimage::resetSourceSize()
+{
+ QString src = QUrl::fromLocalFile(SRCDIR "/data/heart200.png").toString();
+ QString componentStr = "import QtQuick 1.1\nImage { function reset() { sourceSize = undefined }\nsource: \"" + src + "\"; sourceSize: Qt.size(100,100) }";
+
+ QDeclarativeComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QDeclarativeImage *obj = qobject_cast<QDeclarativeImage*>(component.create());
+ QVERIFY(obj != 0);
+ QCOMPARE(obj->pixmap().width(), 100);
+ QCOMPARE(obj->pixmap().height(), 100);
+ QCOMPARE(obj->sourceSize().height(), 100);
+ QCOMPARE(obj->sourceSize().width(), 100);
+
+ QMetaObject::invokeMethod(obj, "reset");
+ QCOMPARE(obj->pixmap().width(), 200);
+ QCOMPARE(obj->pixmap().height(), 200);
+ QCOMPARE(obj->sourceSize().height(), 200);
+ QCOMPARE(obj->sourceSize().width(), 200);
+}
+
void tst_qdeclarativeimage::testQtQuick11Attributes()
{
QFETCH(QString, code);
diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
index 5a2591f..2ce493b 100644
--- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
+++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
@@ -174,7 +174,7 @@ private:
QVERIFY(component.errors().isEmpty()); \
} else { \
QFile file(QLatin1String(SRCDIR) + QLatin1String("/data/") + QLatin1String(errorfile)); \
- QVERIFY(file.open(QIODevice::ReadOnly)); \
+ QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text)); \
QByteArray data = file.readAll(); \
file.close(); \
QList<QByteArray> expected = data.split('\n'); \
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp
index dc104e2..9d1c609 100644
--- a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp
@@ -85,7 +85,7 @@ private slots:
QVERIFY(component.errors().isEmpty()); \
} else { \
QFile file(QLatin1String("data/") + QLatin1String(errorfile)); \
- QVERIFY(file.open(QIODevice::ReadOnly)); \
+ QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text)); \
QByteArray data = file.readAll(); \
file.close(); \
QList<QByteArray> expected = data.split('\n'); \
diff --git a/tests/auto/declarative/qdeclarativepincharea/data/flickresize.qml b/tests/auto/declarative/qdeclarativepincharea/data/flickresize.qml
new file mode 100644
index 0000000..2da58fc
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativepincharea/data/flickresize.qml
@@ -0,0 +1,50 @@
+import QtQuick 1.1
+
+Flickable {
+ id: flick
+ property real scale: 1.0
+ width: 640
+ height: 360
+ contentWidth: 500
+ contentHeight: 500
+
+ PinchArea {
+ objectName: "pincharea"
+ width: Math.max(flick.contentWidth, flick.width)
+ height: Math.max(flick.contentHeight, flick.height)
+
+ property real initialWidth
+ property real initialHeight
+ onPinchStarted: {
+ initialWidth = flick.contentWidth
+ initialHeight = flick.contentHeight
+ }
+
+ onPinchUpdated: {
+ // adjust content pos due to drag
+ flick.contentX += pinch.previousCenter.x - pinch.center.x
+ flick.contentY += pinch.previousCenter.y - pinch.center.y
+
+ // resize content
+ flick.resizeContent(initialWidth * pinch.scale, initialHeight * pinch.scale, pinch.center)
+ flick.scale = pinch.scale
+ }
+
+ onPinchFinished: {
+ // Move its content within bounds.
+ flick.returnToBounds()
+ }
+
+ Rectangle {
+ width: flick.contentWidth
+ height: flick.contentHeight
+ color: "white"
+ Rectangle {
+ anchors.centerIn: parent
+ width: parent.width-40
+ height: parent.height-40
+ color: "blue"
+ }
+ }
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativepincharea/tst_qdeclarativepincharea.cpp b/tests/auto/declarative/qdeclarativepincharea/tst_qdeclarativepincharea.cpp
index f175033..90506ba 100644
--- a/tests/auto/declarative/qdeclarativepincharea/tst_qdeclarativepincharea.cpp
+++ b/tests/auto/declarative/qdeclarativepincharea/tst_qdeclarativepincharea.cpp
@@ -43,6 +43,7 @@
#include <QtTest/QSignalSpy>
#include <private/qdeclarativepincharea_p.h>
#include <private/qdeclarativerectangle_p.h>
+#include <private/qdeclarativeflickable_p.h>
#include <QtDeclarative/qdeclarativeview.h>
#include <QtDeclarative/qdeclarativecontext.h>
@@ -58,6 +59,7 @@ private slots:
void pinchProperties();
void scale();
void pan();
+ void flickable();
private:
QDeclarativeView *createView();
@@ -301,6 +303,77 @@ void tst_QDeclarativePinchArea::pan()
delete canvas;
}
+void tst_QDeclarativePinchArea::flickable()
+{
+ QDeclarativeView *canvas = createView();
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/flickresize.qml"));
+ canvas->show();
+ canvas->setFocus();
+ QTest::qWaitForWindowShown(canvas);
+ QVERIFY(canvas->rootObject() != 0);
+ qApp->processEvents();
+
+ QDeclarativePinchArea *pinchArea = canvas->rootObject()->findChild<QDeclarativePinchArea*>("pincharea");
+ QDeclarativePinch *pinch = pinchArea->pinch();
+ QVERIFY(pinchArea != 0);
+ QVERIFY(pinch != 0);
+
+ QDeclarativeFlickable *root = qobject_cast<QDeclarativeFlickable*>(canvas->rootObject());
+ QVERIFY(root != 0);
+
+ QWidget *vp = canvas->viewport();
+
+ QPoint p1(110, 80);
+ QPoint p2(100, 100);
+
+ // begin by moving one touch point (mouse)
+ QTest::mousePress(vp, Qt::LeftButton, 0, canvas->mapFromScene(p1));
+ QTest::touchEvent(vp).press(0, p1);
+ {
+ p1 -= QPoint(10,10);
+ QMouseEvent mv(QEvent::MouseMove, canvas->mapFromScene(p1), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier);
+ QApplication::sendEvent(canvas->viewport(), &mv);
+ QTest::touchEvent(vp).move(0, p1);
+ }
+ {
+ p1 -= QPoint(10,10);
+ QMouseEvent mv(QEvent::MouseMove, canvas->mapFromScene(p1), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier);
+ QApplication::sendEvent(vp, &mv);
+ QTest::touchEvent(vp).move(0, p1);
+ }
+ {
+ p1 -= QPoint(10,10);
+ QMouseEvent mv(QEvent::MouseMove, canvas->mapFromScene(p1), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier);
+ QApplication::sendEvent(vp, &mv);
+ QTest::touchEvent(vp).move(0, p1);
+ }
+
+ // Flickable has reacted to the gesture
+ QVERIFY(root->isMoving());
+ QVERIFY(root->property("scale").toReal() == 1.0);
+
+ // add another touch point and continue moving
+ QTest::touchEvent(vp).stationary(0).press(1, p2);
+ p1 -= QPoint(10,10);
+ p2 += QPoint(10,10);
+ QTest::touchEvent(vp).move(0, p1).move(1, p2);
+
+ QCOMPARE(root->property("scale").toReal(), 1.0);
+
+ p1 -= QPoint(10,10);
+ p2 += QPoint(10,10);
+ QTest::touchEvent(vp).move(0, p1).move(1, p2);
+
+ // PinchArea has stolen the gesture.
+ QVERIFY(!root->isMoving());
+ QVERIFY(root->property("scale").toReal() > 1.0);
+
+ QTest::mouseRelease(vp, Qt::LeftButton, 0, canvas->mapFromScene(p1));
+ QTest::touchEvent(vp).release(0, p1).release(1, p2);
+
+ delete canvas;
+}
+
QDeclarativeView *tst_QDeclarativePinchArea::createView()
{
QDeclarativeView *canvas = new QDeclarativeView(0);
diff --git a/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp b/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp
index 92ab722..78821cb 100644
--- a/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp
+++ b/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp
@@ -154,6 +154,15 @@ void tst_QDeclarativePositioners::test_horizontal_rtl()
QCOMPARE(row->width(), 110.0);
QCOMPARE(row->height(), 50.0);
+ // Change the width of the row and check that items stay to the right
+ row->setWidth(200);
+ QCOMPARE(one->x(), 150.0);
+ QCOMPARE(one->y(), 0.0);
+ QCOMPARE(two->x(), 130.0);
+ QCOMPARE(two->y(), 0.0);
+ QCOMPARE(three->x(), 90.0);
+ QCOMPARE(three->y(), 0.0);
+
delete canvas;
}
@@ -527,6 +536,19 @@ void tst_QDeclarativePositioners::test_grid_rightToLeft()
QCOMPARE(grid->width(), 100.0);
QCOMPARE(grid->height(), 100.0);
+ // Change the width of the grid and check that items stay to the right
+ grid->setWidth(200);
+ QCOMPARE(one->x(), 150.0);
+ QCOMPARE(one->y(), 0.0);
+ QCOMPARE(two->x(), 130.0);
+ QCOMPARE(two->y(), 0.0);
+ QCOMPARE(three->x(), 100.0);
+ QCOMPARE(three->y(), 0.0);
+ QCOMPARE(four->x(), 150.0);
+ QCOMPARE(four->y(), 50.0);
+ QCOMPARE(five->x(), 140.0);
+ QCOMPARE(five->y(), 50.0);
+
delete canvas;
}
diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
index 8841aa3..3d6641b 100644
--- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
+++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
@@ -658,6 +658,24 @@ void tst_qdeclarativetext::verticalAlignment()
}
}
+ //confirm that bounding rect is correctly positioned.
+ QString componentStr = "import QtQuick 1.0\nText { height: 80; text: \"Hello\" }";
+ QDeclarativeComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create());
+ QVERIFY(textObject != 0);
+ QRectF br = textObject->boundingRect();
+ QVERIFY(br.y() == 0);
+
+ textObject->setVAlign(QDeclarativeText::AlignVCenter);
+ br = textObject->boundingRect();
+ QCOMPARE(qFloor(br.y()), qFloor((80.0 - br.height())/2));
+
+ textObject->setVAlign(QDeclarativeText::AlignBottom);
+ br = textObject->boundingRect();
+ QCOMPARE(qFloor(br.y()), qFloor(80.0 - br.height()));
+
+ delete textObject;
}
void tst_qdeclarativetext::font()
diff --git a/tests/auto/declarative/qdeclarativetextedit/data/CursorRect.qml b/tests/auto/declarative/qdeclarativetextedit/data/CursorRect.qml
new file mode 100644
index 0000000..3af0313
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativetextedit/data/CursorRect.qml
@@ -0,0 +1,8 @@
+import QtQuick 1.0
+
+TextEdit {
+ focus: true
+ objectName: "myEdit"
+ width: 50
+ text: "This is a long piece of text"
+}
diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
index f62c2c5..8f1be6f 100644
--- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
+++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
@@ -148,6 +148,7 @@ private slots:
void preeditMicroFocus();
void inputContextMouseHandler();
void inputMethodComposing();
+ void cursorRectangleSize();
private:
void simulateKey(QDeclarativeView *, int key, Qt::KeyboardModifiers modifiers = 0);
@@ -1340,6 +1341,12 @@ void tst_qdeclarativetextedit::mouseSelection()
else
QVERIFY(str.isEmpty());
+ // Clicking and shift to clicking between the same points should select the same text.
+ textEditObject->setCursorPosition(0);
+ QTest::mouseClick(canvas->viewport(), Qt::LeftButton, Qt::NoModifier, canvas->mapFromScene(QPoint(x1,y)));
+ QTest::mouseClick(canvas->viewport(), Qt::LeftButton, Qt::ShiftModifier, canvas->mapFromScene(QPoint(x2,y)));
+ QCOMPARE(textEditObject->selectedText(), str);
+
delete canvas;
}
@@ -1436,6 +1443,12 @@ void tst_qdeclarativetextedit::mouseSelectionMode()
QVERIFY(str != text);
}
+ // Clicking and shift to clicking between the same points should select the same text.
+ textEditObject->setCursorPosition(0);
+ QTest::mouseClick(canvas->viewport(), Qt::LeftButton, Qt::NoModifier, canvas->mapFromScene(QPoint(x1,y)));
+ QTest::mouseClick(canvas->viewport(), Qt::LeftButton, Qt::ShiftModifier, canvas->mapFromScene(QPoint(x2,y)));
+ QCOMPARE(textEditObject->selectedText(), str);
+
delete canvas;
}
@@ -2409,6 +2422,25 @@ void tst_qdeclarativetextedit::inputMethodComposing()
QCOMPARE(spy.count(), 2);
}
+void tst_qdeclarativetextedit::cursorRectangleSize()
+{
+ QDeclarativeView *canvas = createView(SRCDIR "/data/CursorRect.qml");
+ QVERIFY(canvas->rootObject() != 0);
+ canvas->show();
+ canvas->setFocus();
+ QApplication::setActiveWindow(canvas);
+ QTest::qWaitForWindowShown(canvas);
+
+ QDeclarativeTextEdit *textEdit = qobject_cast<QDeclarativeTextEdit *>(canvas->rootObject());
+ QVERIFY(textEdit != 0);
+ textEdit->setFocus(Qt::OtherFocusReason);
+ QRectF cursorRect = textEdit->positionToRectangle(textEdit->cursorPosition());
+ QRectF microFocusFromScene = canvas->scene()->inputMethodQuery(Qt::ImMicroFocus).toRectF();
+ QRectF microFocusFromApp= QApplication::focusWidget()->inputMethodQuery(Qt::ImMicroFocus).toRectF();
+
+ QCOMPARE(microFocusFromScene.size(), cursorRect.size());
+ QCOMPARE(microFocusFromApp.size(), cursorRect.size());
+}
QTEST_MAIN(tst_qdeclarativetextedit)
#include "tst_qdeclarativetextedit.moc"
diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
index 45f38a4..ef32ee3 100644
--- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
+++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
@@ -135,6 +135,7 @@ private slots:
void preeditMicroFocus();
void inputContextMouseHandler();
void inputMethodComposing();
+ void cursorRectangleSize();
private:
void simulateKey(QDeclarativeView *, int key);
@@ -604,10 +605,8 @@ void tst_qdeclarativetextinput::moveCursorSelection_data()
<< standard[2] << 13 << 6 << QDeclarativeTextInput::SelectWords << 6 << 13 << false;
QTest::newRow("Hello<(, world!)>|words")
<< standard[2] << 5 << 13 << QDeclarativeTextInput::SelectWords << 5 << 13 << true;
- // Fails due to an issue with QTextBoundaryFinder and punctuation at the end of strings.
- // QTBUG-11365
- // QTest::newRow("world<(!)>|words")
- // << standard[2] << 12 << 13 << QDeclarativeTextInput::SelectWords << 12 << 13 << true;
+ QTest::newRow("world<(!)>|words")
+ << standard[2] << 12 << 13 << QDeclarativeTextInput::SelectWords << 12 << 13 << true;
QTest::newRow("world!<()>)|words")
<< standard[2] << 13 << 13 << QDeclarativeTextInput::SelectWords << 13 << 13 << true;
QTest::newRow("world<()>!)|words")
@@ -653,16 +652,15 @@ void tst_qdeclarativetextinput::moveCursorSelection_data()
QTest::newRow(" <s(pac)ey> text |words")
<< standard[4] << 1 << 4 << QDeclarativeTextInput::SelectWords << 1 << 7 << true;
QTest::newRow(" spacey <t(ex)t> |words")
- << standard[4] << 11 << 13 << QDeclarativeTextInput::SelectWords << 10 << 14 << false; // Should be reversible. QTBUG-11365
+ << standard[4] << 11 << 13 << QDeclarativeTextInput::SelectWords << 10 << 14 << true;
QTest::newRow("<( )>spacey text |words|ltr")
<< standard[4] << 0 << 1 << QDeclarativeTextInput::SelectWords << 0 << 1 << false;
QTest::newRow("<( )spacey> text |words|rtl")
<< standard[4] << 1 << 0 << QDeclarativeTextInput::SelectWords << 0 << 7 << false;
QTest::newRow("spacey <text( )>|words|ltr")
<< standard[4] << 14 << 15 << QDeclarativeTextInput::SelectWords << 10 << 15 << false;
-// QTBUG-11365
-// QTest::newRow("spacey text<( )>|words|rtl")
-// << standard[4] << 15 << 14 << QDeclarativeTextInput::SelectWords << 14 << 15 << false;
+ QTest::newRow("spacey text<( )>|words|rtl")
+ << standard[4] << 15 << 14 << QDeclarativeTextInput::SelectWords << 14 << 15 << false;
QTest::newRow("<()> spacey text |words")
<< standard[4] << 0 << 0 << QDeclarativeTextInput::SelectWords << 0 << 0 << false;
QTest::newRow(" spacey text <()>|words")
@@ -857,23 +855,21 @@ void tst_qdeclarativetextinput::moveCursorSelectionSequence_data()
<< 15 << 12 << 15
<< 10 << 15
<< 15 << 15;
-// QTBUG-11365
-// QTest::newRow(" spacey <te(xt{^ )>}|rtl")
-// << standard[4]
-// << 15 << 12 << 14
-// << 10 << 15
-// << 14 << 15;
+ QTest::newRow(" spacey <te(xt{^ )>}|rtl")
+ << standard[4]
+ << 15 << 12 << 14
+ << 10 << 15
+ << 14 << 15;
QTest::newRow(" spacey {<te(x^t} )>|ltr")
<< standard[4]
<< 12 << 15 << 13
<< 10 << 15
<< 10 << 14;
-// QTBUG-11365
-// QTest::newRow(" spacey {<te(xt^} )>|ltr")
-// << standard[4]
-// << 12 << 15 << 14
-// << 10 << 15
-// << 10 << 14;
+ QTest::newRow(" spacey {<te(xt^} )>|ltr")
+ << standard[4]
+ << 12 << 15 << 14
+ << 10 << 15
+ << 10 << 14;
}
void tst_qdeclarativetextinput::moveCursorSelectionSequence()
@@ -1633,12 +1629,11 @@ void tst_qdeclarativetextinput::cursorDelegate()
//Test Delegate gets moved
for(int i=0; i<= textInputObject->text().length(); i++){
textInputObject->setCursorPosition(i);
- //+5 is because the TextInput cursorRectangle is just a 10xHeight area centered on cursor position
- QCOMPARE(textInputObject->cursorRectangle().x() + 5, qRound(delegateObject->x()));
+ QCOMPARE(textInputObject->cursorRectangle().x(), qRound(delegateObject->x()));
QCOMPARE(textInputObject->cursorRectangle().y(), qRound(delegateObject->y()));
}
textInputObject->setCursorPosition(0);
- QCOMPARE(textInputObject->cursorRectangle().x()+5, qRound(delegateObject->x()));
+ QCOMPARE(textInputObject->cursorRectangle().x(), qRound(delegateObject->x()));
QCOMPARE(textInputObject->cursorRectangle().y(), qRound(delegateObject->y()));
//Test Delegate gets deleted
textInputObject->setCursorDelegate(0);
@@ -1727,19 +1722,26 @@ void tst_qdeclarativetextinput::cursorRectangle()
QRect r;
+ // some tolerance for different fonts.
+#ifdef Q_OS_LINUX
+ const int error = 2;
+#else
+ const int error = 5;
+#endif
+
for (int i = 0; i <= 5; ++i) {
input.setCursorPosition(i);
r = input.cursorRectangle();
int textWidth = fm.width(text.mid(0, i));
- QVERIFY(r.left() < textWidth);
- QVERIFY(r.right() > textWidth);
+ QVERIFY(r.left() < textWidth + error);
+ QVERIFY(r.right() > textWidth - error);
QCOMPARE(input.inputMethodQuery(Qt::ImMicroFocus).toRect(), r);
}
// Check the cursor rectangle remains within the input bounding rect when auto scrolling.
QVERIFY(r.left() < input.boundingRect().width());
- QVERIFY(r.right() >= input.width());
+ QVERIFY(r.right() >= input.width() - error);
for (int i = 6; i < text.length(); ++i) {
input.setCursorPosition(i);
@@ -2240,18 +2242,25 @@ void tst_qdeclarativetextinput::preeditAutoScroll()
QCOMPARE(input.positionAt(0), 0);
QCOMPARE(input.positionAt(input.width()), 5);
+ // some tolerance for different fonts.
+#ifdef Q_OS_LINUX
+ const int error = 2;
+#else
+ const int error = 5;
+#endif
+
// test if the preedit is larger than the text input that the
// character preceding the cursor is still visible.
qreal x = input.positionToRectangle(0).x();
for (int i = 0; i < 3; ++i) {
ic.sendPreeditText(preeditText, i + 1);
- QVERIFY(input.cursorRectangle().right() >= fm.width(preeditText.at(i)));
+ QVERIFY(input.cursorRectangle().right() >= fm.width(preeditText.at(i)) - error);
QVERIFY(input.positionToRectangle(0).x() < x);
x = input.positionToRectangle(0).x();
}
for (int i = 1; i >= 0; --i) {
ic.sendPreeditText(preeditText, i + 1);
- QVERIFY(input.cursorRectangle().right() >= fm.width(preeditText.at(i)));
+ QVERIFY(input.cursorRectangle().right() >= fm.width(preeditText.at(i)) - error);
QVERIFY(input.positionToRectangle(0).x() > x);
x = input.positionToRectangle(0).x();
}
@@ -2489,6 +2498,26 @@ void tst_qdeclarativetextinput::inputMethodComposing()
QCOMPARE(spy.count(), 2);
}
+void tst_qdeclarativetextinput::cursorRectangleSize()
+{
+ QDeclarativeView *canvas = createView(SRCDIR "/data/positionAt.qml");
+ QVERIFY(canvas->rootObject() != 0);
+ canvas->show();
+ canvas->setFocus();
+ QApplication::setActiveWindow(canvas);
+ QTest::qWaitForWindowShown(canvas);
+
+ QDeclarativeTextInput *textInput = qobject_cast<QDeclarativeTextInput *>(canvas->rootObject());
+ QVERIFY(textInput != 0);
+ textInput->setFocus(Qt::OtherFocusReason);
+ QRectF cursorRect = textInput->positionToRectangle(textInput->cursorPosition());
+ QRectF microFocusFromScene = canvas->scene()->inputMethodQuery(Qt::ImMicroFocus).toRectF();
+ QRectF microFocusFromApp= QApplication::focusWidget()->inputMethodQuery(Qt::ImMicroFocus).toRectF();
+
+ QCOMPARE(microFocusFromScene.size(), cursorRect.size());
+ QCOMPARE(microFocusFromApp.size(), cursorRect.size());
+}
+
QTEST_MAIN(tst_qdeclarativetextinput)
#include "tst_qdeclarativetextinput.moc"
diff --git a/tests/auto/declarative/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp b/tests/auto/declarative/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp
index 06baed8..1b9831c 100644
--- a/tests/auto/declarative/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp
+++ b/tests/auto/declarative/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp
@@ -140,9 +140,9 @@ void tst_QMetaObjectBuilder::mocVersionCheck()
// whenenver moc changes. Once QMetaObjectBuilder has been
// updated, this test can be changed to check for the next version.
int version = int(QObject::staticMetaObject.d.data[0]);
- QVERIFY(version == 4 || version == 5);
+ QVERIFY(version == 4 || version == 5 || version == 6);
version = int(staticMetaObject.d.data[0]);
- QVERIFY(version == 4 || version == 5);
+ QVERIFY(version == 4 || version == 5 || version == 6);
}
void tst_QMetaObjectBuilder::create()
@@ -920,9 +920,9 @@ void tst_QMetaObjectBuilder::relatedMetaObject()
QVERIFY(checkForSideEffects(builder, QMetaObjectBuilder::RelatedMetaObjects));
}
-static int smetacall(QMetaObject::Call, int, void **)
+static void smetacall(QObject *, QMetaObject::Call, int, void **)
{
- return 0;
+ return;
}
void tst_QMetaObjectBuilder::staticMetacall()
diff --git a/tests/auto/mediaobject/dummy/dummy.pro b/tests/auto/mediaobject/dummy/dummy.pro
index c81411c..9797500 100644
--- a/tests/auto/mediaobject/dummy/dummy.pro
+++ b/tests/auto/mediaobject/dummy/dummy.pro
@@ -1,7 +1,7 @@
TEMPLATE = lib
isEmpty(QT_MAJOR_VERSION) {
- VERSION=4.7.3
+ VERSION=4.7.4
} else {
VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION}
}
diff --git a/tests/auto/moc/tst_moc.cpp b/tests/auto/moc/tst_moc.cpp
index 203f0ae..7a8f958 100644
--- a/tests/auto/moc/tst_moc.cpp
+++ b/tests/auto/moc/tst_moc.cpp
@@ -497,7 +497,7 @@ private slots:
void revisions();
void warnings_data();
void warnings();
-
+ void privateClass();
signals:
void sigWithUnsignedArg(unsigned foo);
@@ -517,6 +517,7 @@ private:
private:
QString qtIncludePath;
+ class PrivateClass;
};
void tst_Moc::initTestCase()
@@ -1648,6 +1649,25 @@ void tst_Moc::warnings()
}
+class tst_Moc::PrivateClass : public QObject {
+ Q_PROPERTY(int someProperty READ someSlot WRITE someSlot2)
+Q_OBJECT
+Q_SIGNALS:
+ void someSignal();
+public Q_SLOTS:
+ int someSlot() { return 1; }
+ void someSlot2(int) {}
+public:
+ Q_INVOKABLE PrivateClass() {}
+};
+
+void tst_Moc::privateClass()
+{
+ QVERIFY(PrivateClass::staticMetaObject.indexOfConstructor("PrivateClass()") == 0);
+ QVERIFY(PrivateClass::staticMetaObject.indexOfSignal("someSignal()") > 0);
+}
+
+
QTEST_APPLESS_MAIN(tst_Moc)
#include "tst_moc.moc"
diff --git a/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp b/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp
index 76e6711..4a66d4d 100644
--- a/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp
+++ b/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp
@@ -150,22 +150,25 @@ void tst_QAbstractNetworkCache::initTestCase()
#endif
}
-void tst_QAbstractNetworkCache::expires_data()
+void tst_QAbstractNetworkCache::expires_data() // Server sending Expires header, but neither max-age nor Last-Modified
{
QTest::addColumn<QNetworkRequest::CacheLoadControl>("cacheLoadControl");
QTest::addColumn<QString>("url");
QTest::addColumn<bool>("fetchFromCache");
+ // httpcachetest_expires304.cgi will send a 304 upon receiving a If-Modified-Since header
QTest::newRow("304-0") << QNetworkRequest::AlwaysNetwork << "httpcachetest_expires304.cgi" << AlwaysFalse;
- QTest::newRow("304-1") << QNetworkRequest::PreferNetwork << "httpcachetest_expires304.cgi" << true;
+ QTest::newRow("304-1") << QNetworkRequest::PreferNetwork << "httpcachetest_expires304.cgi" << false; // neither Last-Modified nor ETag given
QTest::newRow("304-2") << QNetworkRequest::AlwaysCache << "httpcachetest_expires304.cgi" << AlwaysTrue;
- QTest::newRow("304-3") << QNetworkRequest::PreferCache << "httpcachetest_expires304.cgi" << true;
+ QTest::newRow("304-3") << QNetworkRequest::PreferCache << "httpcachetest_expires304.cgi" << true; // we know the expiration date, so we can read from cache
+ // httpcachetest_expires500.cgi will send a 500 upon receiving a If-Modified-Since header
QTest::newRow("500-0") << QNetworkRequest::AlwaysNetwork << "httpcachetest_expires500.cgi" << AlwaysFalse;
- QTest::newRow("500-1") << QNetworkRequest::PreferNetwork << "httpcachetest_expires500.cgi" << true;
+ QTest::newRow("500-1") << QNetworkRequest::PreferNetwork << "httpcachetest_expires500.cgi" << false; // neither Last-Modified nor ETag given
QTest::newRow("500-2") << QNetworkRequest::AlwaysCache << "httpcachetest_expires500.cgi" << AlwaysTrue;
- QTest::newRow("500-3") << QNetworkRequest::PreferCache << "httpcachetest_expires500.cgi" << true;
+ QTest::newRow("500-3") << QNetworkRequest::PreferCache << "httpcachetest_expires500.cgi" << true; // we know the expiration date, so we can read from cache
+ // httpcachetest_expires200.cgi will always send a 200 header
QTest::newRow("200-0") << QNetworkRequest::AlwaysNetwork << "httpcachetest_expires200.cgi" << AlwaysFalse;
QTest::newRow("200-1") << QNetworkRequest::PreferNetwork << "httpcachetest_expires200.cgi" << false;
QTest::newRow("200-2") << QNetworkRequest::AlwaysCache << "httpcachetest_expires200.cgi" << AlwaysTrue;
@@ -193,15 +196,17 @@ void tst_QAbstractNetworkCache::lastModified_data()
QTest::addColumn<QString>("url");
QTest::addColumn<bool>("fetchFromCache");
+ // httpcachetest_lastModified304.cgi will send a 304 upon receiving a If-Modified-Since header
QTest::newRow("304-0") << QNetworkRequest::AlwaysNetwork << "httpcachetest_lastModified304.cgi" << AlwaysFalse;
- QTest::newRow("304-1") << QNetworkRequest::PreferNetwork << "httpcachetest_lastModified304.cgi" << true;
+ QTest::newRow("304-1") << QNetworkRequest::PreferNetwork << "httpcachetest_lastModified304.cgi" << true; // we know the last modified date, so we can send If-Modified-Since and get 304, then we can read from cache
QTest::newRow("304-2") << QNetworkRequest::AlwaysCache << "httpcachetest_lastModified304.cgi" << AlwaysTrue;
- QTest::newRow("304-3") << QNetworkRequest::PreferCache << "httpcachetest_lastModified304.cgi" << true;
+ QTest::newRow("304-3") << QNetworkRequest::PreferCache << "httpcachetest_lastModified304.cgi" << true; // we know the last modified date, so we can send If-Modified-Since and get 304, then we can read from cache
+ // httpcachetest_lastModified200.cgi will always send a 200 header
QTest::newRow("200-0") << QNetworkRequest::AlwaysNetwork << "httpcachetest_lastModified200.cgi" << AlwaysFalse;
- QTest::newRow("200-1") << QNetworkRequest::PreferNetwork << "httpcachetest_lastModified200.cgi" << false;
+ QTest::newRow("200-1") << QNetworkRequest::PreferNetwork << "httpcachetest_lastModified200.cgi" << false; // we won't get a 304 (although sending If-Modified-Since), so we cannot read from cache
QTest::newRow("200-2") << QNetworkRequest::AlwaysCache << "httpcachetest_lastModified200.cgi" << AlwaysTrue;
- QTest::newRow("200-3") << QNetworkRequest::PreferCache << "httpcachetest_lastModified200.cgi" << false;
+ QTest::newRow("200-3") << QNetworkRequest::PreferCache << "httpcachetest_lastModified200.cgi" << false; // we won't get a 304 (although sending If-Modified-Since), so we cannot read from cache
}
void tst_QAbstractNetworkCache::lastModified()
@@ -226,14 +231,14 @@ void tst_QAbstractNetworkCache::etag_data()
QTest::addColumn<bool>("fetchFromCache");
QTest::newRow("304-0") << QNetworkRequest::AlwaysNetwork << "httpcachetest_etag304.cgi" << AlwaysFalse;
- QTest::newRow("304-1") << QNetworkRequest::PreferNetwork << "httpcachetest_etag304.cgi" << true;
+ QTest::newRow("304-1") << QNetworkRequest::PreferNetwork << "httpcachetest_etag304.cgi" << true; // we will send If-None-Match and get 304
QTest::newRow("304-2") << QNetworkRequest::AlwaysCache << "httpcachetest_etag304.cgi" << AlwaysTrue;
- QTest::newRow("304-3") << QNetworkRequest::PreferCache << "httpcachetest_etag304.cgi" << true;
+ QTest::newRow("304-3") << QNetworkRequest::PreferCache << "httpcachetest_etag304.cgi" << true; // we don't have expiration information, but will get 304, as with PreferNetwork
QTest::newRow("200-0") << QNetworkRequest::AlwaysNetwork << "httpcachetest_etag200.cgi" << AlwaysFalse;
- QTest::newRow("200-1") << QNetworkRequest::PreferNetwork << "httpcachetest_etag200.cgi" << false;
+ QTest::newRow("200-1") << QNetworkRequest::PreferNetwork << "httpcachetest_etag200.cgi" << false; // we will send If-None-Match and get 200
QTest::newRow("200-2") << QNetworkRequest::AlwaysCache << "httpcachetest_etag200.cgi" << AlwaysTrue;
- QTest::newRow("200-3") << QNetworkRequest::PreferCache << "httpcachetest_etag200.cgi" << false;
+ QTest::newRow("200-3") << QNetworkRequest::PreferCache << "httpcachetest_etag200.cgi" << false; // we don't have expiration information, and will get 200, as with PreferNetwork
}
void tst_QAbstractNetworkCache::etag()
@@ -273,8 +278,8 @@ void tst_QAbstractNetworkCache::cacheControl_data()
// see QTBUG-7060
//QTest::newRow("nokia-boston") << QNetworkRequest::PreferNetwork << "http://waplabdc.nokia-boston.com/browser/users/venkat/cache/Cache_directives/private_1b.asp" << true;
- QTest::newRow("304-2b") << QNetworkRequest::PreferNetwork << "httpcachetest_cachecontrol200.cgi?private, max-age=1000" << true;
- QTest::newRow("304-4b") << QNetworkRequest::PreferCache << "httpcachetest_cachecontrol200.cgi?private, max-age=1000" << true;
+ QTest::newRow("304-2b") << QNetworkRequest::PreferNetwork << "httpcachetest_cachecontrol200.cgi?private, max-age=1000" << false; // script always returns 200, so we cannot load from cache
+ QTest::newRow("304-4b") << QNetworkRequest::PreferCache << "httpcachetest_cachecontrol200.cgi?private, max-age=1000" << true; // we got expiry information
}
void tst_QAbstractNetworkCache::cacheControl()
diff --git a/tests/auto/qbytearray/tst_qbytearray.cpp b/tests/auto/qbytearray/tst_qbytearray.cpp
index 5fff22a..0dea9be 100644
--- a/tests/auto/qbytearray/tst_qbytearray.cpp
+++ b/tests/auto/qbytearray/tst_qbytearray.cpp
@@ -898,12 +898,12 @@ void tst_QByteArray::indexOf_data()
QByteArray veryBigHaystack(500, 'a');
veryBigHaystack += 'B';
QTest::newRow("BoyerMooreStressTest") << veryBigHaystack << veryBigHaystack << 0 << 0;
- QTest::newRow("BoyerMooreStressTest2") << veryBigHaystack + 'c' << veryBigHaystack << 0 << 0;
- QTest::newRow("BoyerMooreStressTest3") << 'c' + veryBigHaystack << veryBigHaystack << 0 << 1;
- QTest::newRow("BoyerMooreStressTest4") << veryBigHaystack << veryBigHaystack + 'c' << 0 << -1;
- QTest::newRow("BoyerMooreStressTest5") << veryBigHaystack << 'c' + veryBigHaystack << 0 << -1;
- QTest::newRow("BoyerMooreStressTest6") << 'd' + veryBigHaystack << 'c' + veryBigHaystack << 0 << -1;
- QTest::newRow("BoyerMooreStressTest6") << veryBigHaystack + 'c' << 'c' + veryBigHaystack << 0 << -1;
+ QTest::newRow("BoyerMooreStressTest2") << QByteArray(veryBigHaystack + 'c') << QByteArray(veryBigHaystack) << 0 << 0;
+ QTest::newRow("BoyerMooreStressTest3") << QByteArray('c' + veryBigHaystack) << QByteArray(veryBigHaystack) << 0 << 1;
+ QTest::newRow("BoyerMooreStressTest4") << QByteArray(veryBigHaystack) << QByteArray(veryBigHaystack + 'c') << 0 << -1;
+ QTest::newRow("BoyerMooreStressTest5") << QByteArray(veryBigHaystack) << QByteArray('c' + veryBigHaystack) << 0 << -1;
+ QTest::newRow("BoyerMooreStressTest6") << QByteArray('d' + veryBigHaystack) << QByteArray('c' + veryBigHaystack) << 0 << -1;
+ QTest::newRow("BoyerMooreStressTest6") << QByteArray(veryBigHaystack + 'c') << QByteArray('c' + veryBigHaystack) << 0 << -1;
}
void tst_QByteArray::indexOf()
diff --git a/tests/auto/qdatetime/tst_qdatetime.cpp b/tests/auto/qdatetime/tst_qdatetime.cpp
index fa9c70b..f8836a6 100644
--- a/tests/auto/qdatetime/tst_qdatetime.cpp
+++ b/tests/auto/qdatetime/tst_qdatetime.cpp
@@ -198,8 +198,8 @@ void tst_QDateTime::ctor()
QDateTime dt3(QDate(2004, 1, 2), QTime(1, 2, 3), Qt::UTC);
QVERIFY(dt1 == dt2);
- QVERIFY(dt1 != dt3);
if (europeanTimeZone) {
+ QVERIFY(dt1 != dt3);
QVERIFY(dt1 < dt3);
QVERIFY(dt1.addSecs(3600).toUTC() == dt3);
}
diff --git a/tests/auto/qdir/qdir.pro b/tests/auto/qdir/qdir.pro
index 472e646..384c048 100644
--- a/tests/auto/qdir/qdir.pro
+++ b/tests/auto/qdir/qdir.pro
@@ -4,7 +4,7 @@ RESOURCES += qdir.qrc
QT = core
wince*|symbian {
- DirFiles.files = testdir testdata searchdir resources entrylist types tst_qdir.cpp
+ DirFiles.files = testdir testData searchdir resources entrylist types tst_qdir.cpp
DirFiles.path = .
DEPLOYMENT += DirFiles
}
diff --git a/tests/auto/qdir/tst_qdir.cpp b/tests/auto/qdir/tst_qdir.cpp
index 21460be..8112814 100644
--- a/tests/auto/qdir/tst_qdir.cpp
+++ b/tests/auto/qdir/tst_qdir.cpp
@@ -420,6 +420,9 @@ void tst_QDir::isRelativePath_data()
#endif
QTest::newRow("data2") << "somedir" << true;
QTest::newRow("data3") << "/somedir" << false;
+
+ QTest::newRow("resource0") << ":/prefix" << false;
+ QTest::newRow("resource1") << ":/prefix/foo.bar" << false;
}
void tst_QDir::isRelativePath()
@@ -874,6 +877,8 @@ void tst_QDir::canonicalPath_data()
QTest::newRow("drive:\\..\\..") << QDir::toNativeSeparators(QDir::rootPath().append("../..")) << QDir::rootPath();
QTest::newRow("drive:") << QDir().canonicalPath().left(2) << QDir().canonicalPath();
#endif
+
+ QTest::newRow("resource") << ":/tst_qdir/resources/entryList" << ":/tst_qdir/resources/entryList";
}
void tst_QDir::canonicalPath()
@@ -1067,6 +1072,9 @@ tst_QDir::cleanPath_data()
QTest::newRow("data10") << "/:/" << "/:";
#endif
#endif
+
+ QTest::newRow("resource0") << ":/prefix/foo.bar" << ":/prefix/foo.bar";
+ QTest::newRow("resource1") << "://prefix/..//prefix/foo.bar" << ":/prefix/foo.bar";
}
@@ -1090,6 +1098,7 @@ void tst_QDir::absoluteFilePath_data()
QTest::newRow("2") << "/" << "passwd" << "/passwd";
QTest::newRow("3") << "relative" << "path" << QDir::currentPath() + "/relative/path";
QTest::newRow("4") << "" << "" << QDir::currentPath();
+ QTest::newRow("resource") << ":/prefix" << "foo.bar" << ":/prefix/foo.bar";
}
void tst_QDir::absoluteFilePath()
@@ -1118,6 +1127,7 @@ void tst_QDir::absolutePath_data()
QTest::newRow("4") << "c:/machine/share/dir1" << "c:/machine/share/dir1";
QTest::newRow("5") << "c:\\machine\\share\\dir1" << "c:/machine/share/dir1";
#endif
+ QTest::newRow("resource") << ":/prefix/foo.bar" << ":/prefix/foo.bar";
}
void tst_QDir::absolutePath()
@@ -1177,6 +1187,9 @@ void tst_QDir::relativeFilePath_data()
QTest::newRow("33") << "//anotherHost/foo" << "C:/foo/bar" << "C:/foo/bar";
# endif
#endif
+
+ QTest::newRow("resource0") << ":/prefix" << "foo.bar" << "foo.bar";
+ QTest::newRow("resource1") << ":/prefix" << ":/prefix/foo.bar" << "foo.bar";
}
void tst_QDir::relativeFilePath()
@@ -1199,6 +1212,7 @@ void tst_QDir::filePath_data()
QTest::newRow("2") << "/" << "passwd" << "/passwd";
QTest::newRow("3") << "relative" << "path" << "relative/path";
QTest::newRow("4") << "" << "" << ".";
+ QTest::newRow("resource") << ":/prefix" << "foo.bar" << ":/prefix/foo.bar";
}
void tst_QDir::filePath()
@@ -1261,6 +1275,8 @@ void tst_QDir::exists2_data()
QTest::newRow("4") << "/testData" << false;
QTest::newRow("5") << "tst_qdir.cpp" << true;
QTest::newRow("6") << "/resources.cpp" << false;
+ QTest::newRow("resource0") << ":/prefix/foo.bar" << false;
+ QTest::newRow("resource1") << ":/tst_qdir/resources/entryList/file1.data" << true;
}
void tst_QDir::exists2()
@@ -1297,6 +1313,8 @@ void tst_QDir::dirName_data()
QTest::newRow("bslash1") << "\\winnt\\system32" << "system32";
QTest::newRow("bslash2") << "c:\\winnt\\system32\\kernel32.dll" << "kernel32.dll";
#endif
+
+ QTest::newRow("resource") << ":/prefix" << "prefix";
}
void tst_QDir::dirName()
@@ -1967,6 +1985,8 @@ void tst_QDir::isRelative_data()
foreach (QFileInfo root, QDir::drives()) {
QTest::newRow(root.absolutePath().toLocal8Bit()) << root.absolutePath() << false;
}
+
+ QTest::newRow("resource") << ":/prefix" << false;
}
void tst_QDir::isRelative()
diff --git a/tests/auto/qftp/tst_qftp.cpp b/tests/auto/qftp/tst_qftp.cpp
index 7e3cd75..78157d8 100644
--- a/tests/auto/qftp/tst_qftp.cpp
+++ b/tests/auto/qftp/tst_qftp.cpp
@@ -301,6 +301,10 @@ void tst_QFtp::init()
void tst_QFtp::cleanup()
{
+ if (ftp) {
+ delete ftp;
+ ftp = 0;
+ }
QFETCH_GLOBAL(bool, setProxy);
if (setProxy) {
QNetworkProxy::setApplicationProxy(QNetworkProxy::DefaultProxy);
@@ -1597,6 +1601,8 @@ void tst_QFtp::binaryAscii()
addCommand(QFtp::Close, ftp->close());
QTestEventLoop::instance().enterLoop( 30 );
+ delete ftp;
+ ftp = 0;
if ( QTestEventLoop::instance().timeout() )
QFAIL( "Network operation timed out" );
@@ -1617,6 +1623,8 @@ void tst_QFtp::binaryAscii()
addCommand(QFtp::Close, ftp->close());
QTestEventLoop::instance().enterLoop( 30 );
+ delete ftp;
+ ftp = 0;
if ( QTestEventLoop::instance().timeout() )
QFAIL( "Network operation timed out" );
@@ -2070,8 +2078,11 @@ void tst_QFtp::doneSignal()
ftp.close();
done_success = 0;
- while ( ftp.hasPendingCommands() )
- QCoreApplication::instance()->processEvents();
+ connect(&ftp, SIGNAL(done(bool)), &(QTestEventLoop::instance()), SLOT(exitLoop()));
+ QTestEventLoop::instance().enterLoop(61);
+ if (QTestEventLoop::instance().timeout())
+ QFAIL("Network operation timed out");
+
QTest::qWait(200);
QCOMPARE(spy.count(), 1);
diff --git a/tests/auto/qfuture/tst_qfuture.cpp b/tests/auto/qfuture/tst_qfuture.cpp
index fa4ccb5..8afdf48 100644
--- a/tests/auto/qfuture/tst_qfuture.cpp
+++ b/tests/auto/qfuture/tst_qfuture.cpp
@@ -81,6 +81,7 @@ private slots:
void voidConversions();
#ifndef QT_NO_EXCEPTIONS
void exceptions();
+ void exceptions_QTBUG18149();
#endif
};
@@ -1431,6 +1432,33 @@ void tst_QFuture::exceptions()
}
+
+void tst_QFuture::exceptions_QTBUG18149()
+{
+ class MyClass
+ {
+ public:
+ ~MyClass()
+ {
+ QFuture<void> f = createExceptionFuture();
+ bool caught = false;
+ try {
+ f.waitForFinished();
+ } catch (Exception &) {
+ caught = true;
+ }
+ QVERIFY(caught);
+ }
+ };
+
+ try {
+ MyClass m;
+ throw 0;
+ } catch (int) {}
+
+}
+
+
#endif // QT_NO_EXCEPTIONS
#include "tst_qfuture.moc"
diff --git a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp
index 9434a0b..903d7e7 100644
--- a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp
+++ b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp
@@ -225,6 +225,10 @@ void tst_QGraphicsTransform::rotation()
rotation.setAngle(90);
QCOMPARE(transform2D(rotation).map(QPointF(10, 10)), QPointF(10, 10));
QCOMPARE(transform2D(rotation).map(QPointF(20, 10)), QPointF(10, 20));
+
+ rotation.setOrigin(QVector3D(0, 0, 0));
+ rotation.setAngle(qQNaN());
+ QCOMPARE(transform2D(rotation).map(QPointF(20, 10)), QPointF(20, 10));
}
Q_DECLARE_METATYPE(Qt::Axis);
diff --git a/tests/auto/qimagereader/images/txts.png b/tests/auto/qimagereader/images/txts.png
new file mode 100755
index 0000000..99be1eb
--- /dev/null
+++ b/tests/auto/qimagereader/images/txts.png
Binary files differ
diff --git a/tests/auto/qimagereader/qimagereader.qrc b/tests/auto/qimagereader/qimagereader.qrc
index 5536b38..632b73a 100644
--- a/tests/auto/qimagereader/qimagereader.qrc
+++ b/tests/auto/qimagereader/qimagereader.qrc
@@ -64,5 +64,6 @@
<file>images/corrupt.svg</file>
<file>images/corrupt.svgz</file>
<file>images/qtbug13653-no_eoi.jpg</file>
+ <file>images/txts.png</file>
</qresource>
</RCC>
diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp
index f02fd6a..5db5f56 100644
--- a/tests/auto/qimagereader/tst_qimagereader.cpp
+++ b/tests/auto/qimagereader/tst_qimagereader.cpp
@@ -183,6 +183,9 @@ private slots:
void saveFormat_data();
void saveFormat();
+ void readText_data();
+ void readText();
+
void preserveTexts_data();
void preserveTexts();
};
@@ -1968,6 +1971,31 @@ void tst_QImageReader::saveFormat()
}
+void tst_QImageReader::readText_data()
+{
+ QTest::addColumn<QString>("fileName");
+ QTest::addColumn<QString>("key");
+ QTest::addColumn<QString>("text");
+
+ QTest::newRow("png, tEXt before img") << "txts.png" << "Title" << "PNG";
+ QTest::newRow("png, zTXt before img") << "txts.png" << "Comment" << "Some compressed text.";
+ QTest::newRow("png, tEXt after img") << "txts.png" << "Disclaimer" << "For testing only.";
+ QTest::newRow("png, zTXt after img") << "txts.png" << "Description" << "Rendered by Persistence of Vision (tm) Ray Tracer";
+}
+
+
+void tst_QImageReader::readText()
+{
+ QFETCH(QString, fileName);
+ QFETCH(QString, key);
+ QFETCH(QString, text);
+
+ QImage img(prefix + fileName);
+ QVERIFY(img.textKeys().contains(key));
+ QCOMPARE(img.text(key), text);
+}
+
+
void tst_QImageReader::preserveTexts_data()
{
QTest::addColumn<QString>("text");
diff --git a/tests/auto/qlocale/tst_qlocale.cpp b/tests/auto/qlocale/tst_qlocale.cpp
index 6f4de91..cabf12e 100644
--- a/tests/auto/qlocale/tst_qlocale.cpp
+++ b/tests/auto/qlocale/tst_qlocale.cpp
@@ -1147,7 +1147,11 @@ void tst_QLocale::macDefaultLocale()
expectedGMTSpecifier.append(QString("0%1").arg(qAbs(diff)));
else
expectedGMTSpecifier.append(QString("%1").arg(qAbs(diff)));
- QVERIFY(timeString.contains(expectedGMTSpecifier));
+ QVERIFY2(timeString.contains(expectedGMTSpecifier), qPrintable(
+ QString("timeString `%1', expectedGMTSpecifier `%2'")
+ .arg(timeString)
+ .arg(expectedGMTSpecifier)
+ ));
}
QCOMPARE(locale.dayName(1), QString("Monday"));
QCOMPARE(locale.dayName(7), QString("Sunday"));
diff --git a/tests/auto/qmetaobject/tst_qmetaobject.cpp b/tests/auto/qmetaobject/tst_qmetaobject.cpp
index d496c56..13e3bcd 100644
--- a/tests/auto/qmetaobject/tst_qmetaobject.cpp
+++ b/tests/auto/qmetaobject/tst_qmetaobject.cpp
@@ -175,6 +175,9 @@ private slots:
void metaMethod();
+ void indexOfMethod_data();
+ void indexOfMethod();
+
signals:
void value6Changed();
void value7Changed(const QString &);
@@ -1077,5 +1080,31 @@ void tst_QMetaObject::metaMethod()
QCOMPARE(obj.slotResult, QString("sl13"));
}
+void tst_QMetaObject::indexOfMethod_data()
+{
+ QTest::addColumn<QObject *>("object");
+ QTest::addColumn<QByteArray>("name");
+ QTest::addColumn<bool>("isSignal");
+ QTest::newRow("indexOfMethod_data") << (QObject*)this << QByteArray("indexOfMethod_data()") << false;
+ QTest::newRow("deleteLater") << (QObject*)this << QByteArray("deleteLater()") << false;
+ QTest::newRow("value6changed") << (QObject*)this << QByteArray("value6Changed()") << true;
+ QTest::newRow("value7changed") << (QObject*)this << QByteArray("value7Changed(QString)") << true;
+ QTest::newRow("destroyed") << (QObject*)this << QByteArray("destroyed()") << true;
+ QTest::newRow("destroyed2") << (QObject*)this << QByteArray("destroyed(QObject*)") << true;
+}
+
+void tst_QMetaObject::indexOfMethod()
+{
+ QFETCH(QObject *, object);
+ QFETCH(QByteArray, name);
+ QFETCH(bool, isSignal);
+ int idx = object->metaObject()->indexOfMethod(name);
+ QVERIFY(idx >= 0);
+ QCOMPARE(object->metaObject()->method(idx).signature(), name.constData());
+ QCOMPARE(object->metaObject()->indexOfSlot(name), isSignal ? -1 : idx);
+ QCOMPARE(object->metaObject()->indexOfSignal(name), !isSignal ? -1 : idx);
+}
+
+
QTEST_MAIN(tst_QMetaObject)
#include "tst_qmetaobject.moc"
diff --git a/tests/auto/qmutex/tst_qmutex.cpp b/tests/auto/qmutex/tst_qmutex.cpp
index ea983cb..a8c4b37 100644
--- a/tests/auto/qmutex/tst_qmutex.cpp
+++ b/tests/auto/qmutex/tst_qmutex.cpp
@@ -129,27 +129,57 @@ void tst_QMutex::tryLock()
testsTurn.release();
threadsTurn.acquire();
+ QVERIFY(!normalMutex.tryLock(0));
+ testsTurn.release();
+
+ threadsTurn.acquire();
+ timer.start();
+ QVERIFY(normalMutex.tryLock(0));
+ QVERIFY(timer.elapsed() < 1000);
+ QVERIFY(lockCount.testAndSetRelaxed(0, 1));
+ QVERIFY(!normalMutex.tryLock(0));
+ QVERIFY(lockCount.testAndSetRelaxed(1, 0));
+ normalMutex.unlock();
+ testsTurn.release();
+
+ threadsTurn.acquire();
}
};
Thread thread;
thread.start();
+ // thread can't acquire lock
+ testsTurn.acquire();
+ normalMutex.lock();
+ QVERIFY(lockCount.testAndSetRelaxed(0, 1));
+ threadsTurn.release();
+
+ // thread can acquire lock
+ testsTurn.acquire();
+ QVERIFY(lockCount.testAndSetRelaxed(1, 0));
+ normalMutex.unlock();
+ threadsTurn.release();
+
+ // thread can't acquire lock, timeout = 1000
testsTurn.acquire();
normalMutex.lock();
QVERIFY(lockCount.testAndSetRelaxed(0, 1));
threadsTurn.release();
+ // thread can acquire lock, timeout = 1000
testsTurn.acquire();
QVERIFY(lockCount.testAndSetRelaxed(1, 0));
normalMutex.unlock();
threadsTurn.release();
+ // thread can't acquire lock, timeout = 0
testsTurn.acquire();
normalMutex.lock();
QVERIFY(lockCount.testAndSetRelaxed(0, 1));
threadsTurn.release();
+ // thread can acquire lock, timeout = 0
testsTurn.acquire();
QVERIFY(lockCount.testAndSetRelaxed(1, 0));
normalMutex.unlock();
@@ -190,6 +220,7 @@ void tst_QMutex::tryLock()
timer.start();
QVERIFY(!recursiveMutex.tryLock(1000));
QVERIFY(timer.elapsed() >= 1000);
+ QVERIFY(!recursiveMutex.tryLock(0));
testsTurn.release();
threadsTurn.acquire();
@@ -206,12 +237,47 @@ void tst_QMutex::tryLock()
testsTurn.release();
threadsTurn.acquire();
+ QVERIFY(!recursiveMutex.tryLock(0));
+ QVERIFY(!recursiveMutex.tryLock(0));
+ testsTurn.release();
+
+ threadsTurn.acquire();
+ timer.start();
+ QVERIFY(recursiveMutex.tryLock(0));
+ QVERIFY(timer.elapsed() < 1000);
+ QVERIFY(lockCount.testAndSetRelaxed(0, 1));
+ QVERIFY(recursiveMutex.tryLock(0));
+ QVERIFY(lockCount.testAndSetRelaxed(1, 2));
+ QVERIFY(lockCount.testAndSetRelaxed(2, 1));
+ recursiveMutex.unlock();
+ QVERIFY(lockCount.testAndSetRelaxed(1, 0));
+ recursiveMutex.unlock();
+ testsTurn.release();
+
+ threadsTurn.acquire();
}
};
Thread thread;
thread.start();
+ // thread can't acquire lock
+ testsTurn.acquire();
+ recursiveMutex.lock();
+ QVERIFY(lockCount.testAndSetRelaxed(0, 1));
+ recursiveMutex.lock();
+ QVERIFY(lockCount.testAndSetRelaxed(1, 2));
+ threadsTurn.release();
+
+ // thread can acquire lock
+ testsTurn.acquire();
+ QVERIFY(lockCount.testAndSetRelaxed(2, 1));
+ recursiveMutex.unlock();
+ QVERIFY(lockCount.testAndSetRelaxed(1, 0));
+ recursiveMutex.unlock();
+ threadsTurn.release();
+
+ // thread can't acquire lock, timeout = 1000
testsTurn.acquire();
recursiveMutex.lock();
QVERIFY(lockCount.testAndSetRelaxed(0, 1));
@@ -219,6 +285,7 @@ void tst_QMutex::tryLock()
QVERIFY(lockCount.testAndSetRelaxed(1, 2));
threadsTurn.release();
+ // thread can acquire lock, timeout = 1000
testsTurn.acquire();
QVERIFY(lockCount.testAndSetRelaxed(2, 1));
recursiveMutex.unlock();
@@ -226,6 +293,7 @@ void tst_QMutex::tryLock()
recursiveMutex.unlock();
threadsTurn.release();
+ // thread can't acquire lock, timeout = 0
testsTurn.acquire();
recursiveMutex.lock();
QVERIFY(lockCount.testAndSetRelaxed(0, 1));
@@ -233,6 +301,7 @@ void tst_QMutex::tryLock()
QVERIFY(lockCount.testAndSetRelaxed(1, 2));
threadsTurn.release();
+ // thread can acquire lock, timeout = 0
testsTurn.acquire();
QVERIFY(lockCount.testAndSetRelaxed(2, 1));
recursiveMutex.unlock();
diff --git a/tests/auto/qnetworkdiskcache/tst_qnetworkdiskcache.cpp b/tests/auto/qnetworkdiskcache/tst_qnetworkdiskcache.cpp
index 9e06cc4..78b5f1b 100644
--- a/tests/auto/qnetworkdiskcache/tst_qnetworkdiskcache.cpp
+++ b/tests/auto/qnetworkdiskcache/tst_qnetworkdiskcache.cpp
@@ -46,6 +46,8 @@
#include "../../shared/util.h"
#define EXAMPLE_URL "http://user:pass@www.example.com/#foo"
+//cached objects are organized into these many subdirs
+#define NUM_SUBDIRECTORIES 16
class tst_QNetworkDiskCache : public QObject
{
@@ -176,10 +178,10 @@ void tst_QNetworkDiskCache::initTestCase()
cache.clear();
QString s = QDir::tempPath() + "/diskCache/";
QDir dir;
- dir.rmdir(s + "http");
- dir.rmdir(s + "https");
+ dir.rmdir(s + "data7"); // the number is the internal cache version
dir.rmdir(s + "prepared");
dir.rmdir(s);
+ dir.rmdir(s + "http"); // delete directory used by 4.7 and earlier (would make the tests fail)
}
// This will be called after the last test function is executed.
@@ -277,16 +279,16 @@ void tst_QNetworkDiskCache::clear()
QVERIFY(cache.cacheSize() > qint64(0));
QString cacheDirectory = cache.cacheDirectory();
- QCOMPARE(countFiles(cacheDirectory).count(), 3);
+ QCOMPARE(countFiles(cacheDirectory).count(), NUM_SUBDIRECTORIES + 3);
cache.clear();
- QCOMPARE(countFiles(cacheDirectory).count(), 2);
+ QCOMPARE(countFiles(cacheDirectory).count(), NUM_SUBDIRECTORIES + 2);
// don't delete files that it didn't create
- QTemporaryFile file(cacheDirectory + "/cache_XXXXXX");
+ QTemporaryFile file(cacheDirectory + "/XXXXXX");
if (file.open()) {
- QCOMPARE(countFiles(cacheDirectory).count(), 3);
+ QCOMPARE(countFiles(cacheDirectory).count(), NUM_SUBDIRECTORIES + 3);
cache.clear();
- QCOMPARE(countFiles(cacheDirectory).count(), 3);
+ QCOMPARE(countFiles(cacheDirectory).count(), NUM_SUBDIRECTORIES + 3);
}
}
@@ -314,12 +316,6 @@ void tst_QNetworkDiskCache::data()
QUrl url(EXAMPLE_URL);
cache.setupWithOne(url, data);
- // flush the cache
- QTemporaryFile file(cache.cacheDirectory() + "/cache_XXXXXX.cache");
- if (file.open()) {
- cache.call_fileMetaData(file.fileName());
- }
-
for (int i = 0; i < 3; ++i) {
QIODevice *d = cache.data(url);
QVERIFY(d);
@@ -359,9 +355,9 @@ void tst_QNetworkDiskCache::remove()
QUrl url(EXAMPLE_URL);
cache.setupWithOne(url);
QString cacheDirectory = cache.cacheDirectory();
- QCOMPARE(countFiles(cacheDirectory).count(), 3);
+ QCOMPARE(countFiles(cacheDirectory).count(), NUM_SUBDIRECTORIES + 3);
cache.remove(url);
- QCOMPARE(countFiles(cacheDirectory).count(), 2);
+ QCOMPARE(countFiles(cacheDirectory).count(), NUM_SUBDIRECTORIES + 2);
}
void tst_QNetworkDiskCache::setCacheDirectory_data()
@@ -408,7 +404,7 @@ void tst_QNetworkDiskCache::fileMetaData()
QString cacheDirectory = cache.cacheDirectory();
QStringList list = countFiles(cacheDirectory);
- QCOMPARE(list.count(), 3);
+ QCOMPARE(list.count(), NUM_SUBDIRECTORIES + 3);
foreach(QString fileName, list) {
QFileInfo info(fileName);
if (info.isFile()) {
@@ -485,7 +481,7 @@ void tst_QNetworkDiskCache::oldCacheVersionFile()
if (pass == 0) {
QString name;
{
- QTemporaryFile file(cache.cacheDirectory() + "/cache_XXXXXX.cache");
+ QTemporaryFile file(cache.cacheDirectory() + "/XXXXXX.d");
file.setAutoRemove(false);
QVERIFY(file.open());
QDataStream out(&file);
@@ -501,7 +497,7 @@ void tst_QNetworkDiskCache::oldCacheVersionFile()
QVERIFY(!QFile::exists(name));
} else {
QStringList files = countFiles(cache.cacheDirectory());
- QCOMPARE(files.count(), 3);
+ QCOMPARE(files.count(), NUM_SUBDIRECTORIES + 3);
// find the file
QString cacheFile;
foreach (QString file, files) {
diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
index 10fce94..146d2f3 100644
--- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
@@ -93,6 +93,7 @@ Q_DECLARE_METATYPE(QNetworkReply::NetworkError)
Q_DECLARE_METATYPE(QBuffer*)
Q_DECLARE_METATYPE(QHttpMultiPart *)
Q_DECLARE_METATYPE(QList<QFile*>) // for multiparts
+Q_DECLARE_METATYPE(QSslConfiguration)
class QNetworkReplyPtr: public QSharedPointer<QNetworkReply>
{
@@ -330,6 +331,8 @@ private Q_SLOTS:
void ignoreSslErrorsList();
void ignoreSslErrorsListWithSlot_data();
void ignoreSslErrorsListWithSlot();
+ void sslConfiguration_data();
+ void sslConfiguration();
#endif
void getAndThenDeleteObject_data();
@@ -4209,14 +4212,8 @@ void tst_QNetworkReply::ioPostToHttpsUploadProgress()
// some progress should have been made
QVERIFY(!spy.isEmpty());
QList<QVariant> args = spy.last();
- qDebug() << "tst_QNetworkReply::ioPostToHttpsUploadProgress"
- << args.at(0).toLongLong()
- << sourceFile.size()
- << spy.size();
QVERIFY(args.at(0).toLongLong() > 0);
- // FIXME this is where it messes up
- QEXPECT_FAIL("", "Either the readBufferSize of QSslSocket is broken or we do upload too much. Hm.", Abort);
QVERIFY(args.at(0).toLongLong() != sourceFile.size());
incomingSocket->setReadBufferSize(32*1024);
@@ -5438,6 +5435,37 @@ void tst_QNetworkReply::ignoreSslErrorsListWithSlot()
QCOMPARE(reply->error(), expectedNetworkError);
}
+void tst_QNetworkReply::sslConfiguration_data()
+{
+ QTest::addColumn<QSslConfiguration>("configuration");
+ QTest::addColumn<bool>("works");
+
+ QTest::newRow("empty") << QSslConfiguration() << false;
+ QSslConfiguration conf = QSslConfiguration::defaultConfiguration();
+ QTest::newRow("default") << conf << false; // does not contain test server cert
+ QList<QSslCertificate> testServerCert = QSslCertificate::fromPath(SRCDIR "/certs/qt-test-server-cacert.pem");
+ conf.setCaCertificates(testServerCert);
+ QTest::newRow("set-root-cert") << conf << true;
+ conf.setProtocol(QSsl::SecureProtocols);
+ QTest::newRow("secure") << conf << true;
+}
+
+void tst_QNetworkReply::sslConfiguration()
+{
+ QNetworkRequest request(QUrl("https://" + QtNetworkSettings::serverName() + "/index.html"));
+ QFETCH(QSslConfiguration, configuration);
+ request.setSslConfiguration(configuration);
+ QNetworkReplyPtr reply = manager.get(request);
+
+ connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
+ QTestEventLoop::instance().enterLoop(10);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+
+ QFETCH(bool, works);
+ QNetworkReply::NetworkError expectedError = works ? QNetworkReply::NoError : QNetworkReply::SslHandshakeFailedError;
+ QCOMPARE(reply->error(), expectedError);
+}
+
#endif // QT_NO_OPENSSL
void tst_QNetworkReply::getAndThenDeleteObject_data()
diff --git a/tests/auto/qobject/tst_qobject.cpp b/tests/auto/qobject/tst_qobject.cpp
index d2307ee..4b926e4 100644
--- a/tests/auto/qobject/tst_qobject.cpp
+++ b/tests/auto/qobject/tst_qobject.cpp
@@ -135,7 +135,7 @@ private slots:
void disconnectByMetaMethod();
void disconnectNotSignalMetaMethod();
void autoConnectionBehavior();
-
+ void baseDestroyed();
protected:
};
@@ -3925,5 +3925,34 @@ void tst_QObject::autoConnectionBehavior()
delete receiver;
}
+class BaseDestroyed : public QObject
+{ Q_OBJECT
+ QList<QString> fooList;
+ bool destroyed;
+public:
+ BaseDestroyed() : destroyed(false)
+ { fooList << "a" << "b"; }
+ ~BaseDestroyed()
+ {
+ QVERIFY(!destroyed);
+ destroyed = true;
+ }
+
+public slots:
+ void slotUseList()
+ {
+ QVERIFY(!destroyed);
+ fooList << "c" << "d";
+ }
+};
+
+void tst_QObject::baseDestroyed()
+{
+ BaseDestroyed d;
+ connect(&d, SIGNAL(destroyed()), &d, SLOT(slotUseList()));
+ //When d goes out of scope, slotUseList should not be called as the BaseDestroyed has
+ // already been destroyed while ~QObject emit destroyed
+}
+
QTEST_MAIN(tst_QObject)
#include "tst_qobject.moc"
diff --git a/tests/auto/qpainterpath/tst_qpainterpath.cpp b/tests/auto/qpainterpath/tst_qpainterpath.cpp
index 86adabb..c2e64e0 100644
--- a/tests/auto/qpainterpath/tst_qpainterpath.cpp
+++ b/tests/auto/qpainterpath/tst_qpainterpath.cpp
@@ -426,6 +426,10 @@ void tst_QPainterPath::intersects_QRectF_data()
QTest::newRow("horizontal line") << linePath(0, 0, 10, 0) << QRectF(1, -1, 2, 2) << true;
QTest::newRow("vertical line") << linePath(0, 0, 0, 10) << QRectF(-1, 1, 2, 2) << true;
+
+ path = QPainterPath();
+ path.addEllipse(QRectF(-5000.0, -5000.0, 1500000.0, 1500000.0));
+ QTest::newRow("huge ellipse, qreal=float crash") << path << QRectF(1100000.35, 1098000.2, 1500000.0, 1500000.0) << true;
}
void tst_QPainterPath::intersects_QRectF()
diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp
index 480893a..4d032e8 100644
--- a/tests/auto/qpixmap/tst_qpixmap.cpp
+++ b/tests/auto/qpixmap/tst_qpixmap.cpp
@@ -52,6 +52,7 @@
#include <qsplashscreen.h>
#include <private/qpixmapdata_p.h>
+#include <private/qdrawhelper_p.h>
#include <QSet>
@@ -656,9 +657,12 @@ void tst_QPixmap::mask()
QVERIFY(!pm.isNull());
QVERIFY(!bm.isNull());
- // hw: todo: this will fail if the default pixmap format is
- // argb32_premultiplied. The mask will be all 1's
- QVERIFY(pm.mask().isNull());
+ if (!pm.hasAlphaChannel()) {
+ // This would fail if the default pixmap format is
+ // argb32_premultiplied. The mask will be all 1's.
+ // Therefore this is skipped when the alpha channel is present.
+ QVERIFY(pm.mask().isNull());
+ }
QImage img = bm.toImage();
QVERIFY(img.format() == QImage::Format_MonoLSB
@@ -1280,7 +1284,10 @@ void tst_QPixmap::fromSymbianCFbsBitmap()
QCOMPARE(actualColor, color);
QImage shouldBe(pixmap.width(), pixmap.height(), image.format());
- shouldBe.fill(color.rgba());
+ if (image.format() == QImage::Format_RGB16)
+ shouldBe.fill(qrgb565(color.rgba()).rawValue());
+ else
+ shouldBe.fill(color.rgba());
QCOMPARE(image, shouldBe);
}
__UHEAP_MARKEND;
diff --git a/tests/auto/qprocessenvironment/tst_qprocessenvironment.cpp b/tests/auto/qprocessenvironment/tst_qprocessenvironment.cpp
index ea06295..1c26343 100644
--- a/tests/auto/qprocessenvironment/tst_qprocessenvironment.cpp
+++ b/tests/auto/qprocessenvironment/tst_qprocessenvironment.cpp
@@ -56,6 +56,8 @@ private slots:
void insert();
void emptyNull();
void toStringList();
+ void keys();
+ void insertEnv();
void caseSensitivity();
void systemEnvironment();
@@ -154,6 +156,58 @@ void tst_QProcessEnvironment::toStringList()
QVERIFY(result.contains("HELLO=World"));
}
+void tst_QProcessEnvironment::keys()
+{
+ QProcessEnvironment e;
+ QVERIFY(e.isEmpty());
+ QVERIFY(e.keys().isEmpty());
+
+ e.insert("FOO", "bar");
+ QStringList result = e.keys();
+ QCOMPARE(result.length(), 1);
+ QCOMPARE(result.at(0), QString("FOO"));
+
+ e.clear();
+ e.insert("BAZ", "");
+ result = e.keys();
+ QCOMPARE(result.at(0), QString("BAZ"));
+
+ e.insert("FOO", "bar");
+ e.insert("A", "bc");
+ e.insert("HELLO", "World");
+ result = e.keys();
+ QCOMPARE(result.length(), 4);
+
+ // order is not specified, so use contains()
+ QVERIFY(result.contains("FOO"));
+ QVERIFY(result.contains("BAZ"));
+ QVERIFY(result.contains("A"));
+ QVERIFY(result.contains("HELLO"));
+}
+
+void tst_QProcessEnvironment::insertEnv()
+{
+ QProcessEnvironment e;
+ e.insert("FOO", "bar");
+ e.insert("A", "bc");
+ e.insert("Hello", "World");
+
+ QProcessEnvironment e2;
+ e2.insert("FOO2", "bar2");
+ e2.insert("A2", "bc2");
+ e2.insert("Hello", "Another World");
+
+ e.insert(e2);
+ QStringList keys = e.keys();
+ QCOMPARE(keys.length(), 5);
+
+ QCOMPARE(e.value("FOO"), QString("bar"));
+ QCOMPARE(e.value("A"), QString("bc"));
+ QCOMPARE(e.value("Hello"), QString("Another World"));
+ QCOMPARE(e.value("FOO2"), QString("bar2"));
+ QCOMPARE(e.value("A2"), QString("bc2"));
+}
+
void tst_QProcessEnvironment::caseSensitivity()
{
QProcessEnvironment e;
diff --git a/tests/auto/qscriptv8testsuite/abstracttestsuite.cpp b/tests/auto/qscriptv8testsuite/abstracttestsuite.cpp
index d47eb24..0978293 100644
--- a/tests/auto/qscriptv8testsuite/abstracttestsuite.cpp
+++ b/tests/auto/qscriptv8testsuite/abstracttestsuite.cpp
@@ -276,8 +276,11 @@ bool TestConfigParser::isKnownSymbol(const QString &symbol)
<< "Q_OS_SOLARIS"
<< "Q_OS_WINCE"
<< "Q_OS_SYMBIAN"
+ << "Q_OS_MAC"
+ << "Q_OS_WIN"
<< "Q_CC_MSVC"
<< "Q_CC_MINGW"
+ << "Q_CC_INTEL"
;
}
return knownSymbols.contains(symbol);
@@ -299,12 +302,21 @@ bool TestConfigParser::isDefined(const QString &symbol)
#ifdef Q_OS_SYMBIAN
<< "Q_OS_SYMBIAN"
#endif
+#ifdef Q_OS_MAC
+ << "Q_OS_MAC"
+#endif
+#ifdef Q_OS_WIN
+ << "Q_OS_WIN"
+#endif
#ifdef Q_CC_MSVC
<< "Q_CC_MSVC"
#endif
#ifdef Q_CC_MINGW
<< "Q_CC_MINGW"
#endif
+#ifdef Q_CC_INTEL
+ << "Q_CC_INTEL"
+#endif
;
}
return definedSymbols.contains(symbol);
diff --git a/tests/auto/qscriptv8testsuite/skip.txt b/tests/auto/qscriptv8testsuite/skip.txt
index 3c2cc53..9658c2b 100644
--- a/tests/auto/qscriptv8testsuite/skip.txt
+++ b/tests/auto/qscriptv8testsuite/skip.txt
@@ -15,3 +15,17 @@ mul-exhaustive | Demands too much memory on WinCE
[Q_OS_SYMBIAN]
nested-repetition-count-overflow | Demands too much memory on Symbian
unicode-test | Demands too much memory on Symbian
+
+[Q_CC_INTEL]
+math-min-max | Unresolved failures with intel compiler
+negate-zero | Unresolved failures with intel compiler
+smi-negative-zero | Unresolved failures with intel compiler
+str-to-num | Unresolved failures with intel compiler
+to-precision | Unresolved failures with intel compiler
+
+[Q_OS_MAC]
+smi-negative-zero | Unresolved failures on Mac OS X (Cocoa)
+to-precision | Unresolved failures on Mac OS X (Cocoa)
+
+[Q_OS_WIN]
+to-precision | Unresolved failures on Windows
diff --git a/tests/auto/qsemaphore/tst_qsemaphore.cpp b/tests/auto/qsemaphore/tst_qsemaphore.cpp
index ba2175a..9fc6de1 100644
--- a/tests/auto/qsemaphore/tst_qsemaphore.cpp
+++ b/tests/auto/qsemaphore/tst_qsemaphore.cpp
@@ -244,6 +244,8 @@ void tst_QSemaphore::tryAcquireWithTimeout()
QSemaphore semaphore;
QTime time;
+#define QVERIFYGE(a,b) {int e = a; if (a<b) qDebug() << #a << "=" << e << " !>= " << #b << "=" << b; QVERIFY(e>=b);}
+#define QVERIFYLE(a,b) {int e = a; if (b<a) qDebug() << #a << "=" << e << " !<= " << #b << "=" << b; QVERIFY(e<=b);}
QCOMPARE(semaphore.available(), 0);
@@ -251,69 +253,69 @@ void tst_QSemaphore::tryAcquireWithTimeout()
QCOMPARE(semaphore.available(), 1);
time.start();
QVERIFY(!semaphore.tryAcquire(2, timeout));
- QVERIFY(time.elapsed() >= timeout);
+ QVERIFYGE(time.elapsed(), timeout);
QCOMPARE(semaphore.available(), 1);
semaphore.release();
QCOMPARE(semaphore.available(), 2);
time.start();
QVERIFY(!semaphore.tryAcquire(3, timeout));
- QVERIFY(time.elapsed() >= timeout);
+ QVERIFYGE(time.elapsed(), timeout);
QCOMPARE(semaphore.available(), 2);
semaphore.release(10);
QCOMPARE(semaphore.available(), 12);
time.start();
QVERIFY(!semaphore.tryAcquire(100, timeout));
- QVERIFY(time.elapsed() >= timeout);
+ QVERIFYGE(time.elapsed(), timeout);
QCOMPARE(semaphore.available(), 12);
semaphore.release(10);
QCOMPARE(semaphore.available(), 22);
time.start();
QVERIFY(!semaphore.tryAcquire(100, timeout));
- QVERIFY(time.elapsed() >= timeout);
+ QVERIFYGE(time.elapsed(), timeout);
QCOMPARE(semaphore.available(), 22);
time.start();
QVERIFY(semaphore.tryAcquire(1, timeout));
- QVERIFY(time.elapsed() <= timeout);
+ QVERIFYLE(time.elapsed(), timeout);
QCOMPARE(semaphore.available(), 21);
time.start();
QVERIFY(semaphore.tryAcquire(1, timeout));
- QVERIFY(time.elapsed() <= timeout);
+ QVERIFYLE(time.elapsed(), timeout);
QCOMPARE(semaphore.available(), 20);
time.start();
QVERIFY(semaphore.tryAcquire(10, timeout));
- QVERIFY(time.elapsed() <= timeout);
+ QVERIFYLE(time.elapsed(), timeout);
QCOMPARE(semaphore.available(), 10);
time.start();
QVERIFY(semaphore.tryAcquire(10, timeout));
- QVERIFY(time.elapsed() <= timeout);
+ QVERIFYLE(time.elapsed(), timeout);
QCOMPARE(semaphore.available(), 0);
// should not be able to acquire more
time.start();
QVERIFY(!semaphore.tryAcquire(1, timeout));
- QVERIFY(time.elapsed() >= timeout);
+ QVERIFYGE(time.elapsed(), timeout);
QCOMPARE(semaphore.available(), 0);
time.start();
QVERIFY(!semaphore.tryAcquire(1, timeout));
- QVERIFY(time.elapsed() >= timeout);
+ QVERIFYGE(time.elapsed(), timeout);
QCOMPARE(semaphore.available(), 0);
time.start();
QVERIFY(!semaphore.tryAcquire(10, timeout));
- QVERIFY(time.elapsed() >= timeout);
+ QVERIFYGE(time.elapsed(), timeout);
QCOMPARE(semaphore.available(), 0);
time.start();
QVERIFY(!semaphore.tryAcquire(10, timeout));
- QVERIFY(time.elapsed() >= timeout);
+ QVERIFYGE(time.elapsed(), timeout);
QCOMPARE(semaphore.available(), 0);
}
diff --git a/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp b/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp
index 910d437..bd19afb 100644
--- a/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp
+++ b/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp
@@ -179,8 +179,8 @@ void tst_QSoftKeyManager::handleCommand()
// QTest::keyPress(&w, Qt::Key_Context1);
// QTest::keyPress(&w, Qt::Key_Context2);
- simulateSymbianCommand(6000);
- simulateSymbianCommand(6001);
+ simulateSymbianCommand(s60CommandStart); //0 = LSK position
+ simulateSymbianCommand(s60CommandStart + 2); //2 = RSK position
QApplication::processEvents();
@@ -205,28 +205,32 @@ void tst_QSoftKeyManager::checkSoftkeyEnableStates()
w.show();
QApplication::processEvents();
- QSignalSpy spy0(w.actions()[0], SIGNAL(triggered())); //restore defaults action
- QSignalSpy spy1(w.actions()[1], SIGNAL(triggered())); //disabled help action
+ //According to StandardButton enum in QDialogButtonBox the Help action
+ //is inserted before RestoreDefaults and thus help action is in index 0
+ QSignalSpy spy0(w.actions()[0], SIGNAL(triggered())); //disabled help action
+ QSignalSpy spy1(w.actions()[1], SIGNAL(triggered())); //restore defaults action
//Verify that enabled button gets all the action trigger signals and
//disabled button gets none.
for (int i = 0; i < 10; i++) {
- //simulate "Restore Defaults" softkey press
- simulateSymbianCommand(s60CommandStart);
//simulate "help" softkey press
- simulateSymbianCommand(s60CommandStart + 1);
+ simulateSymbianCommand(s60CommandStart);
+ //simulate "Restore Defaults" softkey press
+ simulateSymbianCommand(s60CommandStart + 2);
}
QApplication::processEvents();
- QCOMPARE(spy0.count(), 10);
- QCOMPARE(spy1.count(), 0);
+ //Restore defaults button is enabled and its signals are recorded to spy1
+ QCOMPARE(spy0.count(), 0);
+ QCOMPARE(spy1.count(), 10);
+
spy0.clear();
spy1.clear();
for (int i = 0; i < 10; i++) {
- //simulate "Restore Defaults" softkey press
- simulateSymbianCommand(s60CommandStart);
//simulate "help" softkey press
- simulateSymbianCommand(s60CommandStart + 1);
+ simulateSymbianCommand(s60CommandStart);
+ //simulate "Restore Defaults" softkey press
+ simulateSymbianCommand(s60CommandStart + 2);
//switch enabled button to disabled and vice versa
pBHelp->setEnabled(!pBHelp->isEnabled());
pBDefaults->setEnabled(!pBDefaults->isEnabled());
@@ -261,7 +265,7 @@ void tst_QSoftKeyManager::noMergingOverWindowBoundary()
//Verify that both base softkeys emit triggered signals
simulateSymbianCommand(s60CommandStart);
- simulateSymbianCommand(s60CommandStart + 1);
+ simulateSymbianCommand(s60CommandStart + 2);
QCOMPARE(baseLeftSpy.count(), 1);
QCOMPARE(baseRightSpy.count(), 1);
@@ -275,7 +279,7 @@ void tst_QSoftKeyManager::noMergingOverWindowBoundary()
QApplication::processEvents();
simulateSymbianCommand(s60CommandStart);
- simulateSymbianCommand(s60CommandStart + 1);
+ simulateSymbianCommand(s60CommandStart + 2);
QCOMPARE(baseLeftSpy.count(), 0);
QCOMPARE(baseRightSpy.count(), 0);
@@ -291,7 +295,7 @@ void tst_QSoftKeyManager::noMergingOverWindowBoundary()
QApplication::processEvents();
simulateSymbianCommand(s60CommandStart);
- simulateSymbianCommand(s60CommandStart + 1);
+ simulateSymbianCommand(s60CommandStart + 2);
QCOMPARE(baseLeftSpy.count(), 0);
QCOMPARE(baseRightSpy.count(), 0);
diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp
index 288b29c..be2087d 100644
--- a/tests/auto/qsqlquery/tst_qsqlquery.cpp
+++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp
@@ -928,13 +928,12 @@ void tst_QSqlQuery::record()
QSqlQuery q( db );
QVERIFY( q.record().isEmpty() );
QVERIFY_SQL( q, exec( "select id, t_varchar, t_char from " + qtest + " order by id" ) );
- QSqlRecord rec = q.record();
QCOMPARE( q.record().fieldName( 0 ).toLower(), QString( "id" ) );
QCOMPARE( q.record().fieldName( 1 ).toLower(), QString( "t_varchar" ) );
QCOMPARE( q.record().fieldName( 2 ).toLower(), QString( "t_char" ) );
- QVERIFY( !q.record().value( 0 ).isValid() );
- QVERIFY( !q.record().value( 1 ).isValid() );
- QVERIFY( !q.record().value( 2 ).isValid() );
+ QCOMPARE(q.record().value(0), QVariant(q.record().field(0).type()));
+ QCOMPARE(q.record().value(1), QVariant(q.record().field(1).type()));
+ QCOMPARE(q.record().value(2), QVariant(q.record().field(2).type()));
QVERIFY( q.next() );
QVERIFY( q.next() );
diff --git a/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp b/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp
index e876764..9507e54 100644
--- a/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp
+++ b/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp
@@ -428,9 +428,9 @@ void tst_QSqlQueryModel::record()
QCOMPARE(rec.fieldName(0), isToUpper ? QString("ID") : QString("id"));
QCOMPARE(rec.fieldName(1), isToUpper ? QString("NAME") : QString("name"));
QCOMPARE(rec.fieldName(2), isToUpper ? QString("TITLE") : QString("title"));
- QCOMPARE(rec.value(0), QVariant());
- QCOMPARE(rec.value(1), QVariant());
- QCOMPARE(rec.value(2), QVariant());
+ QCOMPARE(rec.value(0), QVariant(rec.field(0).type()));
+ QCOMPARE(rec.value(1), QVariant(rec.field(1).type()));
+ QCOMPARE(rec.value(2), QVariant(rec.field(2).type()));
rec = model.record(0);
QCOMPARE(rec.fieldName(0), isToUpper ? QString("ID") : QString("id"));
diff --git a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp
index bf68375..b91d025 100644
--- a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp
+++ b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp
@@ -569,9 +569,9 @@ void tst_QSqlTableModel::insertMultiRecords()
QVERIFY(model.insertRow(2));
- QCOMPARE(model.data(model.index(2, 0)), QVariant());
- QCOMPARE(model.data(model.index(2, 1)), QVariant());
- QCOMPARE(model.data(model.index(2, 2)), QVariant());
+ QCOMPARE(model.data(model.index(2, 0)), QVariant(model.record().field(0).type()));
+ QCOMPARE(model.data(model.index(2, 1)), QVariant(model.record().field(1).type()));
+ QCOMPARE(model.data(model.index(2, 2)), QVariant(model.record().field(2).type()));
QVERIFY(model.insertRow(3));
QVERIFY(model.insertRow(0));
diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted1.pem b/tests/auto/qsslcertificate/more-certificates/blacklisted1.pem
new file mode 100644
index 0000000..3945aea
--- /dev/null
+++ b/tests/auto/qsslcertificate/more-certificates/blacklisted1.pem
@@ -0,0 +1,19 @@
+-----BEGIN CERTIFICATE-----
+MIIDDzCCAnigAwIBAgIQBH7L6fylX3vQnq424QyuHjANBgkqhkiG9w0BAQUFADBf
+MQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50
+ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMRgwFgYDVQQDEw9tYWlsLmdvb2dsZS5jb20w
+HhcNMTEwMzI0MTMwNjI1WhcNMTEwNDIzMTMwNjI1WjBfMQswCQYDVQQGEwJBVTET
+MBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQ
+dHkgTHRkMRgwFgYDVQQDEw9tYWlsLmdvb2dsZS5jb20wgZ8wDQYJKoZIhvcNAQEB
+BQADgY0AMIGJAoGBAOeAGV2FbGnT4rLjTvCNEEDjj0/iIUATa6RT8WKF2PVaOzbE
+oceiODx6hTStvBnCgs+h/d3eVKgp+uAyBde5sW/HlOwHrNgKF3ZDvxegzIOEHaVI
+ndNtBpFS3UyOEkO0NxfioBatNRYpeTRU/DVmazu3yvzgrV1V2mDsrNngVWxJAgMB
+AAGjgcswgcgwHQYDVR0OBBYEFHcF1eqRpm7B78aY8ZjseN6zSYbvMIGYBgNVHSME
+gZAwgY2AFHcF1eqRpm7B78aY8ZjseN6zSYbvoWOkYTBfMQswCQYDVQQGEwJBVTET
+MBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQ
+dHkgTHRkMRgwFgYDVQQDEw9tYWlsLmdvb2dsZS5jb22CEAR+y+n8pV970J6uNuEM
+rh4wDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQBEb1iF+EbhAJli5Sj2
++iEdJ5xMP8R6FtgqAYknqXD8+tyEyXxJXdN186qdAWuTD9N22AUqi61BPWxUkufW
+xH8FYMEHdFCkitvYE0321+GT5pJz6ON/d5Co+wusumt7T5oSjzj8Ax9V+nmo3Nkb
+dSANM4/Lnc6moijcpJZq+GC1ng==
+-----END CERTIFICATE-----
diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted2.pem b/tests/auto/qsslcertificate/more-certificates/blacklisted2.pem
new file mode 100644
index 0000000..4b8d059
--- /dev/null
+++ b/tests/auto/qsslcertificate/more-certificates/blacklisted2.pem
@@ -0,0 +1,19 @@
+-----BEGIN CERTIFICATE-----
+MIIDDjCCAnegAwIBAgIRAPXIavNhYvE6ZPVPbclYfAYwDQYJKoZIhvcNAQEFBQAw
+XjELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGElu
+dGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEXMBUGA1UEAxMOd3d3Lmdvb2dsZS5jb20w
+HhcNMTEwMzI0MTMwNzExWhcNMTEwNDIzMTMwNzExWjBeMQswCQYDVQQGEwJBVTET
+MBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQ
+dHkgTHRkMRcwFQYDVQQDEw53d3cuZ29vZ2xlLmNvbTCBnzANBgkqhkiG9w0BAQEF
+AAOBjQAwgYkCgYEAy1fNDFl65Njfcd1EUJeaxvyiKln+JKlqUmk1x4mrE1BQoa0C
+QZaiXAF21rDhivWejZWBiEQ4IWbg3b12ANY74G1KqAfLC4BNKS9UP94hy18vezRA
+pFc+m/HAClwc8AdACpl8eZpQW8cMgdvnMBMZTrQkgV0JYykX+uDD9Tb+QNUCAwEA
+AaOByzCByDAdBgNVHQ4EFgQUSelG6IVRj2ZQbp049zkQ0X/Po9wwgZgGA1UdIwSB
+kDCBjYAUSelG6IVRj2ZQbp049zkQ0X/Po9yhYqRgMF4xCzAJBgNVBAYTAkFVMRMw
+EQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBXaWRnaXRzIFB0
+eSBMdGQxFzAVBgNVBAMTDnd3dy5nb29nbGUuY29tghEA9chq82Fi8Tpk9U9tyVh8
+BjAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBALQyDC/AMQMNj2fa6E8L
+umILCklWJwG1K1p/1bUAgm0CB8zm94n1xrh/ZK4+HS+k2a9OQmvLRbFyJn8Wua8p
+3UU0267UNkCanA1FKHuO3Mo18wLvjMLWjjCQ4g1C9IvJx6P+8EFDQFG+MJBV/w2k
+gJXXVl3q1T1dvahIgfav9QBL
+-----END CERTIFICATE-----
diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted3.pem b/tests/auto/qsslcertificate/more-certificates/blacklisted3.pem
new file mode 100644
index 0000000..e47ece6
--- /dev/null
+++ b/tests/auto/qsslcertificate/more-certificates/blacklisted3.pem
@@ -0,0 +1,19 @@
+-----BEGIN CERTIFICATE-----
+MIIDETCCAnqgAwIBAgIRANdVj9r18RBbshMoK3B3KaMwDQYJKoZIhvcNAQEFBQAw
+XzELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGElu
+dGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEYMBYGA1UEAxMPbG9naW4ueWFob28uY29t
+MB4XDTExMDMyNDEzMDg0MloXDTExMDQyMzEzMDg0MlowXzELMAkGA1UEBhMCQVUx
+EzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMg
+UHR5IEx0ZDEYMBYGA1UEAxMPbG9naW4ueWFob28uY29tMIGfMA0GCSqGSIb3DQEB
+AQUAA4GNADCBiQKBgQCosFLKRvGtxjvdAjWdEAHYycFTa4VtdpXmCNhNHf2xbeLn
+xzde10KjEe44pQxNI+UUD1rJkyuH6wUfloyefn0D2Mu+MvusmvOEzFosa4EDbK9s
+BAAlsSiyJgrp/GgbEPq/XOl4XJRBIVP1WC6LllduNbskFCipDqS+HQwifXmmwQID
+AQABo4HMMIHJMB0GA1UdDgQWBBSEgWnsoYtd5GEx/MGJvKxuIuROJzCBmQYDVR0j
+BIGRMIGOgBSEgWnsoYtd5GEx/MGJvKxuIuROJ6FjpGEwXzELMAkGA1UEBhMCQVUx
+EzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMg
+UHR5IEx0ZDEYMBYGA1UEAxMPbG9naW4ueWFob28uY29tghEA11WP2vXxEFuyEygr
+cHcpozAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAKNpIrzTOxIykKZt
+EE6HU2nW1lrWUkIMjwjL8ntw7QI4JLMDN1ADVIxWaGTeQ+U/eXFou6dDNAYVAijK
+ONDXgOItxW2YvSw0wOZsZj6INX2x88/0yRH+19TqaL/r+Y1D1h/0zefkHgfXufnY
+Ex7BHju/rGBTp6R1mr+Tlh1tewva
+-----END CERTIFICATE-----
diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted4.pem b/tests/auto/qsslcertificate/more-certificates/blacklisted4.pem
new file mode 100644
index 0000000..64c7d41
--- /dev/null
+++ b/tests/auto/qsslcertificate/more-certificates/blacklisted4.pem
@@ -0,0 +1,19 @@
+-----BEGIN CERTIFICATE-----
+MIIDDzCCAnigAwIBAgIQOSpDTw4H3x+KowXeNODCKTANBgkqhkiG9w0BAQUFADBf
+MQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50
+ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMRgwFgYDVQQDEw9sb2dpbi55YWhvby5jb20w
+HhcNMTEwMzI0MTMwOTE1WhcNMTEwNDIzMTMwOTE1WjBfMQswCQYDVQQGEwJBVTET
+MBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQ
+dHkgTHRkMRgwFgYDVQQDEw9sb2dpbi55YWhvby5jb20wgZ8wDQYJKoZIhvcNAQEB
+BQADgY0AMIGJAoGBANO2gz9x2H92xz5OvZSEul9gHxqqd+kdjeoS2exyvjC9wzqb
+gYXqNmAsbtNp4WmieEQFd0riCAEkIAn8JpHTCsMHN4rHhS+W+4D5a/drI2jfnZEF
+orNYJG1PHSQV/rvh6d7wkVdT+0SYOjrFTAA2biGWaK3W9ztf2yX577w+uQtBAgMB
+AAGjgcswgcgwHQYDVR0OBBYEFJjDp8Prs7oReRmskIeFixp0vDkGMIGYBgNVHSME
+gZAwgY2AFJjDp8Prs7oReRmskIeFixp0vDkGoWOkYTBfMQswCQYDVQQGEwJBVTET
+MBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQ
+dHkgTHRkMRgwFgYDVQQDEw9sb2dpbi55YWhvby5jb22CEDkqQ08OB98fiqMF3jTg
+wikwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQAZyo0Q3leeM1+lxeCd
+Wp0ZYHMSW11ANc6nuMWOmJC+nIQGlyGiP3IqeUvIfekwboV638bahVPwcl2HYWsS
+/l01Bgyd25Zn6VTQBfMK01dILyxscjVwdHuojzYBN05sl+qkVoqQr5EroQQbgDc9
+6I88p6Kjajv3IusCwfK6wlqISw==
+-----END CERTIFICATE-----
diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted5.pem b/tests/auto/qsslcertificate/more-certificates/blacklisted5.pem
new file mode 100644
index 0000000..c7ddbf2
--- /dev/null
+++ b/tests/auto/qsslcertificate/more-certificates/blacklisted5.pem
@@ -0,0 +1,19 @@
+-----BEGIN CERTIFICATE-----
+MIIDDzCCAnigAwIBAgIQPnXO1GtpMCEhiDCuhqgqcTANBgkqhkiG9w0BAQUFADBf
+MQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50
+ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMRgwFgYDVQQDEw9sb2dpbi55YWhvby5jb20w
+HhcNMTEwMzI0MTMwOTQ4WhcNMTEwNDIzMTMwOTQ4WjBfMQswCQYDVQQGEwJBVTET
+MBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQ
+dHkgTHRkMRgwFgYDVQQDEw9sb2dpbi55YWhvby5jb20wgZ8wDQYJKoZIhvcNAQEB
+BQADgY0AMIGJAoGBALkiHG9TgTw/00CMW8D23NBDAa3331AL5kTkAaXbAWg2R/1o
+yKQfXq3hgHbyWGPccUT+tU6FmaBf3bIndLK7iGx81RGzGgXeoQ5mpgnJ50iCeW73
+G99VlVwutPia7d9qqui84YdcG9t+P2Fuxv+xRqAB6lKOaa4qTPIbH50PgwOvAgMB
+AAGjgcswgcgwHQYDVR0OBBYEFBWJrs8bnZ5fikfaLbTxK0ssj69MMIGYBgNVHSME
+gZAwgY2AFBWJrs8bnZ5fikfaLbTxK0ssj69MoWOkYTBfMQswCQYDVQQGEwJBVTET
+MBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQ
+dHkgTHRkMRgwFgYDVQQDEw9sb2dpbi55YWhvby5jb22CED51ztRraTAhIYgwroao
+KnEwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQCIfqqs1a7RzdmV8U00
+v/xAsxscKvQvmu6BK+HwvY5iL2pSwXTYgRLJLoj5QGOd3mmgOFsyW3BPSCP1+fVE
+M1ROhU2u8wHub+hGGds18Fx6F4yZjdh8pNUoOUR9A0Ym+VDJr2p50oUNTTy0RbH8
+9ns/gbemx84cjF9DD2G5stQhYg==
+-----END CERTIFICATE-----
diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted6.pem b/tests/auto/qsslcertificate/more-certificates/blacklisted6.pem
new file mode 100644
index 0000000..bc2be2a
--- /dev/null
+++ b/tests/auto/qsslcertificate/more-certificates/blacklisted6.pem
@@ -0,0 +1,19 @@
+-----BEGIN CERTIFICATE-----
+MIIDETCCAnqgAwIBAgIRAOkCi5V45BXcGnEKK4gVREcwDQYJKoZIhvcNAQEFBQAw
+XzELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGElu
+dGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEYMBYGA1UEAxMPbG9naW4uc2t5cGUuY29t
+MB4XDTExMDMyNDEzMTAxNloXDTExMDQyMzEzMTAxNlowXzELMAkGA1UEBhMCQVUx
+EzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMg
+UHR5IEx0ZDEYMBYGA1UEAxMPbG9naW4uc2t5cGUuY29tMIGfMA0GCSqGSIb3DQEB
+AQUAA4GNADCBiQKBgQDFq06qqRl86pP7GRX3m7FMMSaSU6zlNGAo+WPoRfYAzB6x
+5KpvlfxMCo3T/nWtInX3Bw9TBWCZSweQ2GEjggO0irjw5UX3MiToLxK+rwzWztm9
+H3LBxTWR0cOOa78kRFvNQ1onvNHbs8fJzXjG7b2IJDOIwG1HAT1LK80oPXZc1wID
+AQABo4HMMIHJMB0GA1UdDgQWBBTiGNxw0ImW/wfW0mD3eA65PY5CAzCBmQYDVR0j
+BIGRMIGOgBTiGNxw0ImW/wfW0mD3eA65PY5CA6FjpGEwXzELMAkGA1UEBhMCQVUx
+EzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMg
+UHR5IEx0ZDEYMBYGA1UEAxMPbG9naW4uc2t5cGUuY29tghEA6QKLlXjkFdwacQor
+iBVERzAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAHdb1QY/oxuro/4x
+GX9jbm930ysoeXkWZSKVtVxoxrPIferu8jVpb1SLRjGcMnmjJoNWNFpvnbZgoYei
+f3wdSWun7ndyQBh61k8eM7UABDOUXUHOsHuHj7s1koMKtet4gykmMfd6VxBkwBvN
+ZXOll4X+TKe8nrxbnGUByIwQaRM+
+-----END CERTIFICATE-----
diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted7.pem b/tests/auto/qsslcertificate/more-certificates/blacklisted7.pem
new file mode 100644
index 0000000..19d4353
--- /dev/null
+++ b/tests/auto/qsslcertificate/more-certificates/blacklisted7.pem
@@ -0,0 +1,19 @@
+-----BEGIN CERTIFICATE-----
+MIIDGjCCAoOgAwIBAgIRAJI51TSPQNFpWnRUcOHyP0MwDQYJKoZIhvcNAQEFBQAw
+YjELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGElu
+dGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEbMBkGA1UEAxMSYWRkb25zLm1vemlsbGEu
+b3JnMB4XDTExMDMyNDEzMTA0NFoXDTExMDQyMzEzMTA0NFowYjELMAkGA1UEBhMC
+QVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdpZGdp
+dHMgUHR5IEx0ZDEbMBkGA1UEAxMSYWRkb25zLm1vemlsbGEub3JnMIGfMA0GCSqG
+SIb3DQEBAQUAA4GNADCBiQKBgQC1lsoAcZTwF8Pf0E9do5avLdobB/O7EhhrCMs2
+/EMO07aIlrLwl3UP/Fmu/cAkKuX8Mx+Eif9x+XT3ZqGKGYKiqPTJcNfeZvgwbn0j
+wXDtEo4DuURrwtBU9okS+v4dF6F4RtHQKAGcsXoOjhR7ah71kve+PG2GG0sJ167V
+klK1xwIDAQABo4HPMIHMMB0GA1UdDgQWBBRgGDJ4Qp0WFyLIzm4Nz5wgqDSSxjCB
+nAYDVR0jBIGUMIGRgBRgGDJ4Qp0WFyLIzm4Nz5wgqDSSxqFmpGQwYjELMAkGA1UE
+BhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdp
+ZGdpdHMgUHR5IEx0ZDEbMBkGA1UEAxMSYWRkb25zLm1vemlsbGEub3JnghEAkjnV
+NI9A0WladFRw4fI/QzAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBACeE
+DHMQ+LWEuoa/6z2EgrgM1k9rvBbUtCR+rjTuyzVW4OLXdpiVwZPOAiKphpq7q8Sb
+TQ3zwsCoPLLJk5VolwcPfcD8Y2/tYK3NCYl+HzGxxnzPDFVaZM5Jh8RI861Hc00D
+hVoQaptPK/V/lr0KEevqjhusAdFZbwlWA923zASa
+-----END CERTIFICATE-----
diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted8.pem b/tests/auto/qsslcertificate/more-certificates/blacklisted8.pem
new file mode 100644
index 0000000..aedf3f7
--- /dev/null
+++ b/tests/auto/qsslcertificate/more-certificates/blacklisted8.pem
@@ -0,0 +1,19 @@
+-----BEGIN CERTIFICATE-----
+MIIDDjCCAnegAwIBAgIRALC3Ez7Qlvm1b66RyHS9OsAwDQYJKoZIhvcNAQEFBQAw
+XjELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGElu
+dGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEXMBUGA1UEAxMObG9naW4ubGl2ZS5jb20w
+HhcNMTEwMzI0MTMxMTA2WhcNMTEwNDIzMTMxMTA2WjBeMQswCQYDVQQGEwJBVTET
+MBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQ
+dHkgTHRkMRcwFQYDVQQDEw5sb2dpbi5saXZlLmNvbTCBnzANBgkqhkiG9w0BAQEF
+AAOBjQAwgYkCgYEA3OVNj9ijzMewvDeZYzgCWoKtyjclyIHxrQfHZpcexaKbxUap
+1MtF6L0ayjtRWpiBYuPteUSy/Ja4Oh6zZz8K6z5rVgXhmy3xPIYuOoWaTKEOhb0Z
+oHTBtGh8aWWai1XWw37HIm2FP8cmfgdH4lZwVvpTZIUxYidsyqyjB9IrhiMCAwEA
+AaOByzCByDAdBgNVHQ4EFgQU4CcQcIvEhJC0tqHlNFMkv6MlDN4wgZgGA1UdIwSB
+kDCBjYAU4CcQcIvEhJC0tqHlNFMkv6MlDN6hYqRgMF4xCzAJBgNVBAYTAkFVMRMw
+EQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBXaWRnaXRzIFB0
+eSBMdGQxFzAVBgNVBAMTDmxvZ2luLmxpdmUuY29tghEAsLcTPtCW+bVvrpHIdL06
+wDAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAMNzIStXDNSNQ8ayxrcj
+4RrUMsHWUG/6XPrgfYqCP5TfPGAa5qBfNb9LfUbiS4b0flJVN1RlHVwwRo0yf9v4
+LGg0dSuPQAOWlLeUR1GminO1jHZw7E4dYfR7QEmiiOgaQU+CbxLsf5vCaKInN9Gu
+jv/5xytVCbMoLoZ4EBVb0tka
+-----END CERTIFICATE-----
diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted9.pem b/tests/auto/qsslcertificate/more-certificates/blacklisted9.pem
new file mode 100644
index 0000000..d179b29
--- /dev/null
+++ b/tests/auto/qsslcertificate/more-certificates/blacklisted9.pem
@@ -0,0 +1,19 @@
+-----BEGIN CERTIFICATE-----
+MIIDDjCCAnegAwIBAgIRANjzX063hystqwaS4xU4L7AwDQYJKoZIhvcNAQEFBQAw
+XjELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGElu
+dGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEXMBUGA1UEAxMOZ2xvYmFsIHRydXN0ZWUw
+HhcNMTEwMzI0MTMxMTM3WhcNMTEwNDIzMTMxMTM3WjBeMQswCQYDVQQGEwJBVTET
+MBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQ
+dHkgTHRkMRcwFQYDVQQDEw5nbG9iYWwgdHJ1c3RlZTCBnzANBgkqhkiG9w0BAQEF
+AAOBjQAwgYkCgYEArHCVym7AEZDBhDkrUSG3Q94a+caNcCk5fE6ltZHiZHv096xr
+cixHYvSGvms780bkI+oot2xI/e9awwkV+7VjWNvr0HrajzBWeimwk+myjP+3ddMY
+Kmr0eI6bmvmPHtOFJE5Ar8/62FwD0wlLogRIx56JtXcCpkiUQktJVPz2gtMCAwEA
+AaOByzCByDAdBgNVHQ4EFgQUUJwC/qSGBmcB+DVrd43ovRLdLmQwgZgGA1UdIwSB
+kDCBjYAUUJwC/qSGBmcB+DVrd43ovRLdLmShYqRgMF4xCzAJBgNVBAYTAkFVMRMw
+EQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBXaWRnaXRzIFB0
+eSBMdGQxFzAVBgNVBAMTDmdsb2JhbCB0cnVzdGVlghEA2PNfTreHKy2rBpLjFTgv
+sDAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBACAYxI+r3+JNelL6SBB0
+Pda3LkbCm+schP64NBYDdGl2Kus2b2QZ83T7xENBFEhyNoXvc6pRI4/Oh6JDxmG1
+7WmqOVStS/4JeAu6ygiyI1ImRKq2/MvJx/kaKh6IiXanB5nW1U+fhDV6kMOEfpwV
+i6FBibpHboPQoqzPPRe7qHSL
+-----END CERTIFICATE-----
diff --git a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp
index 1e3a8dd..57f2fa8 100644
--- a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp
+++ b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp
@@ -111,6 +111,8 @@ private slots:
void nulInSan();
void largeSerialNumber();
void largeExpirationDate();
+ void blacklistedCertificates();
+
// ### add tests for certificate bundles (multiple certificates concatenated into a single
// structure); both PEM and DER formatted
#endif
@@ -817,6 +819,15 @@ void tst_QSslCertificate::largeExpirationDate() // QTBUG-12489
QCOMPARE(cert.expiryDate().toUTC(), QDateTime(QDate(2051, 8, 29), QTime(9, 53, 41), Qt::UTC));
}
+void tst_QSslCertificate::blacklistedCertificates()
+{
+ QList<QSslCertificate> blacklistedCerts = QSslCertificate::fromPath("more-certificates/blacklisted*.pem", QSsl::Pem, QRegExp::Wildcard);
+ QVERIFY2(blacklistedCerts.count() > 0, "Please run this test from the source directory");
+ for (int a = 0; a < blacklistedCerts.count(); a++) {
+ QVERIFY(! blacklistedCerts.at(a).isValid());
+ }
+}
+
#endif // QT_NO_OPENSSL
QTEST_MAIN(tst_QSslCertificate)
diff --git a/tests/auto/qsslsocket/certs/fake-login.live.com.key b/tests/auto/qsslsocket/certs/fake-login.live.com.key
new file mode 100644
index 0000000..692a7bd
--- /dev/null
+++ b/tests/auto/qsslsocket/certs/fake-login.live.com.key
@@ -0,0 +1,15 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIICXQIBAAKBgQDOtxdvMa0VHUQYG5q7Tsi1Jj4qKEJppyZEkmuRXOi0fDbd1SwE
+bwHrLGMvDO6OMrYBbq3WDNrtnIfF9CvzUOEch+gjr4hEVQqecU5fb45Wor7yNel3
+/C/gxfbzuXHrsj/gUjNghL2i10+c2NW+hUo/sWO6OusaBT6d6s7ee+YBcQIDAQAB
+AoGAb8cVhu0HuLkgjyCuJMbPRRUu3ED02Iin6sB6JhplQuNAD+grayJTmUVhRJnr
+jTziqhedLHe7Em1oBaSo92MutfMpXvWiccSlbNygI61VgmrJpVB+qIN5H9cQc9ql
+Zymc+nIPa1+i5rsrOzlpUytTh7AsbZ27QG4tQXR/kQejEiECQQD6BgTxBeT8D7x9
+DuukoBaSCkLwx7U7P1NXx15EI3lA1nO51t6UHfvk/jGPp8Sl4wv4alJ7AQxr5uQ/
+vC3kzA/1AkEA06gNu10se8pe3n8qL2RRt+FmVjHkQdD9Mm2Dx9oWCs2A4wOSOrlo
+6/nKYF1CaQNYn9HgsNbHVEUpnICVO18qDQJBALEw/uOJ1+TDikPfBSWgxx4s45Ad
+GNWqZXh6NNZ5hX9r/IwiOZAjR9fcRmeW8IjYRi2BvH6sGY+HDRAWXzgdXtkCQCma
+dOiJTf8fLjqp4E7kdzOfuI/kyqstOze4Uxjrgz2oW1dEEnA8laUcumzqp+0gXUE8
+7d+UuCWWWrGKjMrYz9kCQQDh5E5+b6Djn082Jo6gvyuXWC5eXju6IdmihlJ2SMzD
+s2y3IDjOUtTeQQRDymLneteMz0ha79KeUp6VnAvZCOVe
+-----END RSA PRIVATE KEY-----
diff --git a/tests/auto/qsslsocket/certs/fake-login.live.com.pem b/tests/auto/qsslsocket/certs/fake-login.live.com.pem
new file mode 100644
index 0000000..429f951
--- /dev/null
+++ b/tests/auto/qsslsocket/certs/fake-login.live.com.pem
@@ -0,0 +1,19 @@
+-----BEGIN CERTIFICATE-----
+MIIDDjCCAnegAwIBAgIRALC3Ez7Qlvm1b66RyHS9OsAwDQYJKoZIhvcNAQEFBQAw
+XjELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGElu
+dGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEXMBUGA1UEAxMObG9naW4ubGl2ZS5jb20w
+HhcNMTEwMzI1MTMyODUwWhcNMTEwNDI0MTMyODUwWjBeMQswCQYDVQQGEwJBVTET
+MBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQ
+dHkgTHRkMRcwFQYDVQQDEw5sb2dpbi5saXZlLmNvbTCBnzANBgkqhkiG9w0BAQEF
+AAOBjQAwgYkCgYEAzrcXbzGtFR1EGBuau07ItSY+KihCaacmRJJrkVzotHw23dUs
+BG8B6yxjLwzujjK2AW6t1gza7ZyHxfQr81DhHIfoI6+IRFUKnnFOX2+OVqK+8jXp
+d/wv4MX287lx67I/4FIzYIS9otdPnNjVvoVKP7FjujrrGgU+nerO3nvmAXECAwEA
+AaOByzCByDAdBgNVHQ4EFgQUpSOEcmtkQITvBdM2IDfcXnJ0FCAwgZgGA1UdIwSB
+kDCBjYAUpSOEcmtkQITvBdM2IDfcXnJ0FCChYqRgMF4xCzAJBgNVBAYTAkFVMRMw
+EQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBXaWRnaXRzIFB0
+eSBMdGQxFzAVBgNVBAMTDmxvZ2luLmxpdmUuY29tghEAsLcTPtCW+bVvrpHIdL06
+wDAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAD+2HT4GSHHKCdbl9VkX
+zsl+D+drMm2b0ksxz9SgPihP7aW50EEIJDEEihNMTa27mhpeOXHc/sLqDi4ECUao
+/0Ns/5uoVuAIrAKCydmtPsonVFh9XWjyrfUzPOHAc9p2bmJ1i9a3kTsLB6jlrVDO
+VufGzsowHlHZ0TtKf5omojU5
+-----END CERTIFICATE-----
diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp
index 023fbb3..b508d47 100644
--- a/tests/auto/qsslsocket/tst_qsslsocket.cpp
+++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp
@@ -67,6 +67,7 @@ typedef QList<QSslError::SslError> SslErrorList;
Q_DECLARE_METATYPE(SslErrorList)
Q_DECLARE_METATYPE(QSslError)
Q_DECLARE_METATYPE(QSsl::SslProtocol)
+Q_DECLARE_METATYPE(QSslConfiguration)
#endif
#if defined Q_OS_HPUX && defined Q_CC_GNU
@@ -152,6 +153,8 @@ private slots:
void setLocalCertificate();
void setPrivateKey();
void setSocketDescriptor();
+ void setSslConfiguration_data();
+ void setSslConfiguration();
void waitForEncrypted();
void waitForConnectedEncryptedReadyRead();
void startClientEncryption();
@@ -185,6 +188,7 @@ private slots:
void ignoreSslErrorsListWithSlot();
void readFromClosedSocket();
void writeBigChunk();
+ void blacklistedCertificates();
void setEmptyDefaultConfiguration();
static void exitLoop()
@@ -859,9 +863,16 @@ class SslServer : public QTcpServer
{
Q_OBJECT
public:
- SslServer() : socket(0), protocol(QSsl::TlsV1) { }
+ SslServer(const QString &keyFile = SRCDIR "certs/fluke.key", const QString &certFile = SRCDIR "certs/fluke.cert")
+ : socket(0),
+ protocol(QSsl::TlsV1),
+ m_keyFile(keyFile),
+ m_certFile(certFile) { }
QSslSocket *socket;
QSsl::SslProtocol protocol;
+ QString m_keyFile;
+ QString m_certFile;
+
protected:
void incomingConnection(int socketDescriptor)
{
@@ -869,13 +880,13 @@ protected:
socket->setProtocol(protocol);
connect(socket, SIGNAL(sslErrors(const QList<QSslError> &)), this, SLOT(ignoreErrorSlot()));
- QFile file(SRCDIR "certs/fluke.key");
+ QFile file(m_keyFile);
QVERIFY(file.open(QIODevice::ReadOnly));
QSslKey key(file.readAll(), QSsl::Rsa, QSsl::Pem, QSsl::PrivateKey);
QVERIFY(!key.isNull());
socket->setPrivateKey(key);
- QList<QSslCertificate> localCert = QSslCertificate::fromPath(SRCDIR "certs/fluke.cert");
+ QList<QSslCertificate> localCert = QSslCertificate::fromPath(m_certFile);
QVERIFY(!localCert.isEmpty());
QVERIFY(localCert.first().handle());
socket->setLocalCertificate(localCert.first());
@@ -1040,6 +1051,39 @@ void tst_QSslSocket::setSocketDescriptor()
QVERIFY(client->localPort() != 0);
}
+void tst_QSslSocket::setSslConfiguration_data()
+{
+ QTest::addColumn<QSslConfiguration>("configuration");
+ QTest::addColumn<bool>("works");
+
+ QTest::newRow("empty") << QSslConfiguration() << false;
+ QSslConfiguration conf = QSslConfiguration::defaultConfiguration();
+ QTest::newRow("default") << conf << false; // does not contain test server cert
+ QList<QSslCertificate> testServerCert = QSslCertificate::fromPath(SRCDIR "certs/qt-test-server-cacert.pem");
+ conf.setCaCertificates(testServerCert);
+ QTest::newRow("set-root-cert") << conf << true;
+ conf.setProtocol(QSsl::SecureProtocols);
+ QTest::newRow("secure") << conf << true;
+}
+
+void tst_QSslSocket::setSslConfiguration()
+{
+ if (!QSslSocket::supportsSsl())
+ return;
+
+ QSslSocketPtr socket = newSocket();
+ QFETCH(QSslConfiguration, configuration);
+ socket->setSslConfiguration(configuration);
+ this->socket = socket;
+ socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443);
+ QFETCH(bool, works);
+ QCOMPARE(socket->waitForEncrypted(10000), works);
+ if (works) {
+ socket->disconnectFromHost();
+ QVERIFY2(socket->waitForDisconnected(), qPrintable(socket->errorString()));
+ }
+}
+
void tst_QSslSocket::waitForEncrypted()
{
if (!QSslSocket::supportsSsl())
@@ -1941,6 +1985,38 @@ void tst_QSslSocket::writeBigChunk()
socket->close();
}
+void tst_QSslSocket::blacklistedCertificates()
+{
+ QFETCH_GLOBAL(bool, setProxy);
+ if (setProxy)
+ return;
+
+ SslServer server(SRCDIR "certs/fake-login.live.com.key", SRCDIR "certs/fake-login.live.com.pem");
+ QSslSocket *receiver = new QSslSocket(this);
+ connect(receiver, SIGNAL(readyRead()), SLOT(exitLoop()));
+
+ // connect two sockets to each other:
+ QVERIFY(server.listen(QHostAddress::LocalHost));
+ receiver->connectToHost("127.0.0.1", server.serverPort());
+ QVERIFY(receiver->waitForConnected(5000));
+ QVERIFY(server.waitForNewConnection(0));
+
+ QSslSocket *sender = server.socket;
+ QVERIFY(sender);
+ QVERIFY(sender->state() == QAbstractSocket::ConnectedState);
+ receiver->setObjectName("receiver");
+ sender->setObjectName("sender");
+ receiver->startClientEncryption();
+
+ connect(receiver, SIGNAL(sslErrors(QList<QSslError>)), SLOT(exitLoop()));
+ connect(receiver, SIGNAL(encrypted()), SLOT(exitLoop()));
+ enterLoop(1);
+ QList<QSslError> sslErrors = receiver->sslErrors();
+ QVERIFY(sslErrors.count() > 0);
+ // there are more errors (self signed cert and hostname mismatch), but we only care about the blacklist error
+ QCOMPARE(sslErrors.at(0).error(), QSslError::CertificateBlacklisted);
+}
+
void tst_QSslSocket::setEmptyDefaultConfiguration()
{
// used to produce a crash in QSslConfigurationPrivate::deepCopyDefaultConfiguration, QTBUG-13265
@@ -1952,8 +2028,9 @@ void tst_QSslSocket::setEmptyDefaultConfiguration()
QSslConfiguration::setDefaultConfiguration(emptyConf);
QSslSocketPtr socket = newSocket();
+ connect(socket, SIGNAL(sslErrors(const QList<QSslError> &)), this, SLOT(ignoreErrorSlot()));
socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443);
-
+ QVERIFY2(!socket->waitForEncrypted(4000), qPrintable(socket->errorString()));
}
#endif // QT_NO_OPENSSL
diff --git a/tests/auto/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp b/tests/auto/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp
index abdd550..6d3590a 100644
--- a/tests/auto/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp
+++ b/tests/auto/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp
@@ -217,6 +217,13 @@ void tst_QSslSocket_onDemandCertificates_member::onDemandRootCertLoadingMemberMe
socket3->setCaCertificates(QList<QSslCertificate>());
socket3->connectToHostEncrypted(host, 443);
QVERIFY(!socket3->waitForEncrypted());
+
+ // setting empty SSL configuration explicitly -> should not work
+ QSslSocketPtr socket4 = newSocket();
+ this->socket = socket4;
+ socket4->setSslConfiguration(QSslConfiguration());
+ socket4->connectToHostEncrypted(host, 443);
+ QVERIFY(!socket4->waitForEncrypted());
}
#endif // QT_NO_OPENSSL
diff --git a/tests/auto/qsslsocket_onDemandCertificates_static/tst_qsslsocket_onDemandCertificates_static.cpp b/tests/auto/qsslsocket_onDemandCertificates_static/tst_qsslsocket_onDemandCertificates_static.cpp
index 5003b5c..14a7c3b 100644
--- a/tests/auto/qsslsocket_onDemandCertificates_static/tst_qsslsocket_onDemandCertificates_static.cpp
+++ b/tests/auto/qsslsocket_onDemandCertificates_static/tst_qsslsocket_onDemandCertificates_static.cpp
@@ -218,6 +218,18 @@ void tst_QSslSocket_onDemandCertificates_static::onDemandRootCertLoadingStaticMe
this->socket = socket3;
socket3->connectToHostEncrypted(host, 443);
QVERIFY(!socket3->waitForEncrypted());
+
+ QSslSocket::setDefaultCaCertificates(QSslSocket::systemCaCertificates());
+
+ // setting empty default configuration -> should not work
+ QSslConfiguration conf;
+ QSslConfiguration originalDefaultConf = QSslConfiguration::defaultConfiguration();
+ QSslConfiguration::setDefaultConfiguration(conf);
+ QSslSocketPtr socket4 = newSocket();
+ this->socket = socket4;
+ socket4->connectToHostEncrypted(host, 443);
+ QVERIFY(!socket4->waitForEncrypted(4000));
+ QSslConfiguration::setDefaultConfiguration(originalDefaultConf); // restore old behaviour for run with proxies etc.
}
#endif // QT_NO_OPENSSL
diff --git a/tests/auto/qstring/tst_qstring.cpp b/tests/auto/qstring/tst_qstring.cpp
index abc8d9a..25e16fe 100644
--- a/tests/auto/qstring/tst_qstring.cpp
+++ b/tests/auto/qstring/tst_qstring.cpp
@@ -697,11 +697,11 @@ void tst_QString::acc_01()
QVERIFY(a<=c);
QVERIFY(!(c<=a));
QVERIFY(!(d<=a));
- QCOMPARE(a+b,(QString)"ABCABC");
- QCOMPARE(a +"XXXX",(QString)"ABCXXXX");
- QCOMPARE(a+'X',(QString)"ABCX");
- QCOMPARE("XXXX"+a,(QString)"XXXXABC");
- QCOMPARE('X'+a,(QString)"XABC");
+ QCOMPARE(QString(a+b),(QString)"ABCABC");
+ QCOMPARE(QString(a+"XXXX"),(QString)"ABCXXXX");
+ QCOMPARE(QString(a+'X'),(QString)"ABCX");
+ QCOMPARE(QString("XXXX"+a),(QString)"XXXXABC");
+ QCOMPARE(QString('X'+a),(QString)"XABC");
a = (const char*)0;
QVERIFY(a.isNull());
QVERIFY(*a.toLatin1().constData() == '\0');
@@ -1060,12 +1060,12 @@ void tst_QString::indexOf_data()
QString veryBigHaystack(500, 'a');
veryBigHaystack += 'B';
QTest::newRow("BoyerMooreStressTest") << veryBigHaystack << veryBigHaystack << 0 << true << 0;
- QTest::newRow("BoyerMooreStressTest2") << veryBigHaystack + 'c' << veryBigHaystack << 0 << true << 0;
- QTest::newRow("BoyerMooreStressTest3") << 'c' + veryBigHaystack << veryBigHaystack << 0 << true << 1;
- QTest::newRow("BoyerMooreStressTest4") << veryBigHaystack << veryBigHaystack + 'c' << 0 << true << -1;
- QTest::newRow("BoyerMooreStressTest5") << veryBigHaystack << 'c' + veryBigHaystack << 0 << true << -1;
- QTest::newRow("BoyerMooreStressTest6") << 'd' + veryBigHaystack << 'c' + veryBigHaystack << 0 << true << -1;
- QTest::newRow("BoyerMooreStressTest6") << veryBigHaystack + 'c' << 'c' + veryBigHaystack << 0 << true << -1;
+ QTest::newRow("BoyerMooreStressTest2") << QString(veryBigHaystack + 'c') << veryBigHaystack << 0 << true << 0;
+ QTest::newRow("BoyerMooreStressTest3") << QString('c' + veryBigHaystack) << veryBigHaystack << 0 << true << 1;
+ QTest::newRow("BoyerMooreStressTest4") << veryBigHaystack << QString(veryBigHaystack + 'c') << 0 << true << -1;
+ QTest::newRow("BoyerMooreStressTest5") << veryBigHaystack << QString('c' + veryBigHaystack) << 0 << true << -1;
+ QTest::newRow("BoyerMooreStressTest6") << QString('d' + veryBigHaystack) << QString('c' + veryBigHaystack) << 0 << true << -1;
+ QTest::newRow("BoyerMooreStressTest6") << QString(veryBigHaystack + 'c') << QString('c' + veryBigHaystack) << 0 << true << -1;
QTest::newRow("BoyerMooreInsensitiveStressTest") << veryBigHaystack << veryBigHaystack << 0 << false << 0;
@@ -1175,14 +1175,14 @@ void tst_QString::indexOf2_data()
QString whale = "a5zby6cx7dw8evf9ug0th1si2rj3qkp4lomn";
QString minnow = "zby";
QTest::newRow( "data40" ) << whale << minnow << 2;
- QTest::newRow( "data41" ) << (whale + whale) << minnow << 2;
- QTest::newRow( "data42" ) << (minnow + whale) << minnow << 0;
+ QTest::newRow( "data41" ) << QString(whale + whale) << minnow << 2;
+ QTest::newRow( "data42" ) << QString(minnow + whale) << minnow << 0;
QTest::newRow( "data43" ) << whale << whale << 0;
- QTest::newRow( "data44" ) << (whale + whale) << whale << 0;
- QTest::newRow( "data45" ) << whale << (whale + whale) << -1;
- QTest::newRow( "data46" ) << (whale + whale) << (whale + whale) << 0;
- QTest::newRow( "data47" ) << (whale + whale) << (whale + minnow) << -1;
- QTest::newRow( "data48" ) << (minnow + whale) << whale << (int)minnow.length();
+ QTest::newRow( "data44" ) << QString(whale + whale) << whale << 0;
+ QTest::newRow( "data45" ) << whale << QString(whale + whale) << -1;
+ QTest::newRow( "data46" ) << QString(whale + whale) << QString(whale + whale) << 0;
+ QTest::newRow( "data47" ) << QString(whale + whale) << QString(whale + minnow) << -1;
+ QTest::newRow( "data48" ) << QString(minnow + whale) << whale << (int)minnow.length();
}
void tst_QString::indexOf2()
@@ -1631,7 +1631,7 @@ void tst_QString::toLower()
QCOMPARE( QString("`ABYZ{").toLower(), QString("`abyz{"));
QCOMPARE( QString("`abyz{").toLower(), QString("`abyz{"));
- QCOMPARE( QString(1, QChar(0x130)).toLower(), QString(1, QChar(0x69)) + QChar(0x307));
+ QCOMPARE( QString(1, QChar(0x130)).toLower(), QString(QString(1, QChar(0x69)) + QChar(0x307)));
QString lower;
lower += QChar(QChar::highSurrogate(0x10428));
diff --git a/tests/auto/qstringbuilder1/stringbuilder.cpp b/tests/auto/qstringbuilder1/stringbuilder.cpp
index f3c0ea9..035a1f4 100644
--- a/tests/auto/qstringbuilder1/stringbuilder.cpp
+++ b/tests/auto/qstringbuilder1/stringbuilder.cpp
@@ -137,4 +137,63 @@ void runScenario()
string = QString::fromLatin1(LITERAL);
QCOMPARE(QByteArray(qPrintable(string P string)), QByteArray(string.toLatin1() + string.toLatin1()));
+
+
+
+ //QByteArray
+ {
+ QByteArray ba = LITERAL;
+ QByteArray superba = ba P ba P LITERAL;
+ QCOMPARE(superba, QByteArray(LITERAL LITERAL LITERAL));
+
+ QByteArray testWith0 = ba P "test\0with\0zero" P ba;
+ QCOMPARE(testWith0, QByteArray(LITERAL "test" LITERAL));
+
+ QByteArray ba2 = ba P '\0' + LITERAL;
+ QCOMPARE(ba2, QByteArray(LITERAL "\0" LITERAL, ba.size()*2+1));
+
+ const char *mmh = "test\0foo";
+ QCOMPARE(QByteArray(ba P mmh P ba), testWith0);
+
+ QByteArray raw = QByteArray::fromRawData(UTF8_LITERAL_EXTRA, UTF8_LITERAL_LEN);
+ QByteArray r = "hello" P raw;
+ QByteArray r2 = "hello" UTF8_LITERAL;
+ QCOMPARE(r, r2);
+ r2 = QByteArray("hello\0") P UTF8_LITERAL;
+ QCOMPARE(r, r2);
+ }
+
+ //operator QString +=
+ {
+ QString str = QString::fromUtf8(UTF8_LITERAL);
+ str += QLatin1String(LITERAL) P str;
+ QCOMPARE(str, QString::fromUtf8(UTF8_LITERAL LITERAL UTF8_LITERAL));
+#ifndef QT_NO_CAST_FROM_ASCII
+ str = (QString::fromUtf8(UTF8_LITERAL) += QLatin1String(LITERAL) P UTF8_LITERAL);
+ QCOMPARE(str, QString::fromUtf8(UTF8_LITERAL LITERAL UTF8_LITERAL));
+#endif
+ }
+
+ //operator QByteArray +=
+ {
+ QByteArray ba = UTF8_LITERAL;
+ ba += QByteArray(LITERAL) P UTF8_LITERAL;
+ QCOMPARE(ba, QByteArray(UTF8_LITERAL LITERAL UTF8_LITERAL));
+ ba += LITERAL P QByteArray::fromRawData(UTF8_LITERAL_EXTRA, UTF8_LITERAL_LEN);
+ QCOMPARE(ba, QByteArray(UTF8_LITERAL LITERAL UTF8_LITERAL LITERAL UTF8_LITERAL));
+ QByteArray withZero = QByteArray(LITERAL "\0" LITERAL, LITERAL_LEN*2+1);
+ QByteArray ba2 = withZero;
+ ba2 += ba2 P withZero;
+ QCOMPARE(ba2, QByteArray(withZero + withZero + withZero));
+#ifndef QT_NO_CAST_TO_ASCII
+ ba = UTF8_LITERAL;
+ ba2 = (ba += QLatin1String(LITERAL) + QString::fromUtf8(UTF8_LITERAL));
+ QCOMPARE(ba2, ba);
+ QCOMPARE(ba, QByteArray(UTF8_LITERAL LITERAL UTF8_LITERAL));
+ ba = UTF8_LITERAL;
+ ba += QLatin1String(LITERAL) P withZero;
+ QCOMPARE(ba, QByteArray(UTF8_LITERAL LITERAL + withZero));
+#endif
+ }
+
}
diff --git a/tests/auto/qstringlist/tst_qstringlist.cpp b/tests/auto/qstringlist/tst_qstringlist.cpp
index 283c17f..d8db00a 100644
--- a/tests/auto/qstringlist/tst_qstringlist.cpp
+++ b/tests/auto/qstringlist/tst_qstringlist.cpp
@@ -78,6 +78,8 @@ private slots:
void join() const;
void join_data() const;
void joinEmptiness() const;
+
+ void initializeList() const;
};
extern const char email[];
@@ -321,5 +323,16 @@ void tst_QStringList::joinEmptiness() const
QVERIFY(string.isNull());
}
+void tst_QStringList::initializeList() const
+{
+#ifdef Q_COMPILER_INITIALIZER_LISTS
+ QStringList v1{QLatin1String("hello"),"world",QString::fromLatin1("plop")};
+ QCOMPARE(v1, (QStringList() << "hello" << "world" << "plop"));
+ QCOMPARE(v1, (QStringList{"hello","world","plop"}));
+#else
+ QSKIP("Require C++0x support, pass the right flag to the compiler", SkipAll);
+#endif
+}
+
QTEST_APPLESS_MAIN(tst_QStringList)
#include "tst_qstringlist.moc"
diff --git a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp
index f89e033..b6b0d3c 100644
--- a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp
+++ b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp
@@ -75,6 +75,10 @@ public:
public slots:
void init();
void cleanup();
+
+ void initTestCase();
+ void cleanupTestCase();
+
private slots:
void construction();
void fileTemplate();
@@ -97,9 +101,24 @@ private slots:
void setTemplateAfterOpen();
void autoRemoveAfterFailedRename();
+ void QTBUG_4796_data();
+ void QTBUG_4796();
+
public:
};
+void tst_QTemporaryFile::initTestCase()
+{
+ // For QTBUG_4796
+ QVERIFY(QDir("test-XXXXXX").exists() || QDir().mkdir("test-XXXXXX"));
+}
+
+void tst_QTemporaryFile::cleanupTestCase()
+{
+ // From QTBUG_4796
+ QVERIFY(QDir().rmdir("test-XXXXXX"));
+}
+
void tst_QTemporaryFile::construction()
{
QTemporaryFile file(0);
@@ -144,26 +163,35 @@ void tst_QTemporaryFile::cleanup()
void tst_QTemporaryFile::fileTemplate_data()
{
QTest::addColumn<QString>("constructorTemplate");
+ QTest::addColumn<QString>("prefix");
QTest::addColumn<QString>("suffix");
QTest::addColumn<QString>("fileTemplate");
- QTest::newRow("constructor default") << "" << "" << "";
- QTest::newRow("constructor with xxx sufix") << "qt_XXXXXXxxx" << "xxx" << "";
- QTest::newRow("constructor with xXx sufix") << "qt_XXXXXXxXx" << "xXx" << "";
- QTest::newRow("constructor with no sufix") << "qt_XXXXXX" << "" << "";
- QTest::newRow("constructor with >6 X's and xxx suffix") << "qt_XXXXXXXXXXxxx" << "xxx" << "";
- QTest::newRow("constructor with >6 X's, no suffix") << "qt_XXXXXXXXXX" << "" << "";
-
- QTest::newRow("set template, no suffix") << "" << "" << "foo";
- QTest::newRow("set template, with lowercase XXXXXX") << "" << "xxxxxx" << "qt_XXXXXXxxxxxx";
- QTest::newRow("set template, with xxx") << "" << ".xxx" << "qt_XXXXXX.xxx";
- QTest::newRow("set template, with >6 X's") << "" << ".xxx" << "qt_XXXXXXXXXXXXXX.xxx";
- QTest::newRow("set template, with >6 X's, no suffix") << "" << "" << "qt_XXXXXXXXXXXXXX";
+ QTest::newRow("constructor default") << "" << "." << "" << "";
+ QTest::newRow("constructor with xxx sufix") << "qt_XXXXXXxxx" << "qt_" << "xxx" << "";
+ QTest::newRow("constructor with xXx sufix") << "qt_XXXXXXxXx" << "qt_" << "xXx" << "";
+ QTest::newRow("constructor with no sufix") << "qt_XXXXXX" << "qt_" << "" << "";
+ QTest::newRow("constructor with >6 X's and xxx suffix") << "qt_XXXXXXXXXXxxx" << "qt_" << "xxx" << "";
+ QTest::newRow("constructor with >6 X's, no suffix") << "qt_XXXXXXXXXX" << "qt_" << "" << "";
+
+ QTest::newRow("constructor with XXXX suffix") << "qt_XXXXXX_XXXX" << "qt_" << "_XXXX" << "";
+ QTest::newRow("constructor with XXXXX suffix") << "qt_XXXXXX_XXXXX" << "qt_" << "_XXXXX" << "";
+ QTest::newRow("constructor with XXXX prefix") << "qt_XXXX" << "qt_XXXX." << "" << "";
+ QTest::newRow("constructor with XXXXX prefix") << "qt_XXXXX" << "qt_XXXXX." << "" << "";
+ QTest::newRow("constructor with XXXX prefix and suffix") << "qt_XXXX_XXXXXX_XXXX" << "qt_XXXX_" << "_XXXX" << "";
+ QTest::newRow("constructor with XXXXX prefix and suffix") << "qt_XXXXX_XXXXXX_XXXXX" << "qt_XXXXX_" << "_XXXXX" << "";
+
+ QTest::newRow("set template, no suffix") << "" << "foo" << "" << "foo";
+ QTest::newRow("set template, with lowercase XXXXXX") << "" << "qt_" << "xxxxxx" << "qt_XXXXXXxxxxxx";
+ QTest::newRow("set template, with xxx") << "" << "qt_" << ".xxx" << "qt_XXXXXX.xxx";
+ QTest::newRow("set template, with >6 X's") << "" << "qt_" << ".xxx" << "qt_XXXXXXXXXXXXXX.xxx";
+ QTest::newRow("set template, with >6 X's, no suffix") << "" << "qt_" << "" << "qt_XXXXXXXXXXXXXX";
}
void tst_QTemporaryFile::fileTemplate()
{
QFETCH(QString, constructorTemplate);
+ QFETCH(QString, prefix);
QFETCH(QString, suffix);
QFETCH(QString, fileTemplate);
@@ -173,8 +201,11 @@ void tst_QTemporaryFile::fileTemplate()
QCOMPARE(file.open(), true);
- QCOMPARE(file.fileName().right(suffix.length()), suffix);
- file.close();
+ if (prefix.length())
+ QCOMPARE(file.fileName().left(prefix.length()), prefix);
+
+ if (suffix.length())
+ QCOMPARE(file.fileName().right(suffix.length()), suffix);
}
@@ -359,10 +390,7 @@ void tst_QTemporaryFile::stressTest()
for (int i = 0; i < iterations; ++i) {
QTemporaryFile file;
file.setAutoRemove(false);
- if (!file.open()) {
- qDebug() << "Could not open File:" << file.fileName();
- continue;
- }
+ QVERIFY2(file.open(), qPrintable(file.errorString()));
QVERIFY(!names.contains(file.fileName()));
names.insert(file.fileName());
}
@@ -594,5 +622,108 @@ void tst_QTemporaryFile::autoRemoveAfterFailedRename()
cleaner.reset();
}
+void tst_QTemporaryFile::QTBUG_4796_data()
+{
+ QTest::addColumn<QString>("prefix");
+ QTest::addColumn<QString>("suffix");
+ QTest::addColumn<bool>("openResult");
+
+ QString unicode = QString::fromUtf8("\xc3\xa5\xc3\xa6\xc3\xb8");
+
+ QTest::newRow("<empty>") << QString() << QString() << true;
+ QTest::newRow("blaXXXXXX") << QString("bla") << QString() << true;
+ QTest::newRow("XXXXXXbla") << QString() << QString("bla") << true;
+ QTest::newRow("does-not-exist/qt_temp.XXXXXX") << QString("does-not-exist/qt_temp") << QString() << false;
+ QTest::newRow("XXXXXX<unicode>") << QString() << unicode << true;
+ QTest::newRow("<unicode>XXXXXX") << unicode << QString() << true;
+ QTest::newRow("<unicode>XXXXXX<unicode>") << unicode << unicode << true;
+}
+
+void tst_QTemporaryFile::QTBUG_4796()
+{
+ QVERIFY(QDir("test-XXXXXX").exists());
+
+ struct CleanOnReturn
+ {
+ ~CleanOnReturn()
+ {
+ Q_FOREACH(QString tempName, tempNames)
+ QFile::remove(tempName);
+ }
+
+ void reset()
+ {
+ tempNames.clear();
+ }
+
+ QStringList tempNames;
+ };
+
+ CleanOnReturn cleaner;
+
+ QFETCH(QString, prefix);
+ QFETCH(QString, suffix);
+ QFETCH(bool, openResult);
+
+ {
+ QString fileTemplate1 = prefix + QString("XX") + suffix;
+ QString fileTemplate2 = prefix + QString("XXXX") + suffix;
+ QString fileTemplate3 = prefix + QString("XXXXXX") + suffix;
+ QString fileTemplate4 = prefix + QString("XXXXXXXX") + suffix;
+
+ QTemporaryFile file1(fileTemplate1);
+ QTemporaryFile file2(fileTemplate2);
+ QTemporaryFile file3(fileTemplate3);
+ QTemporaryFile file4(fileTemplate4);
+ QTemporaryFile file5("test-XXXXXX/" + fileTemplate1);
+ QTemporaryFile file6("test-XXXXXX/" + fileTemplate3);
+
+ QCOMPARE(file1.open(), openResult);
+ QCOMPARE(file2.open(), openResult);
+ QCOMPARE(file3.open(), openResult);
+ QCOMPARE(file4.open(), openResult);
+ QCOMPARE(file5.open(), openResult);
+ QCOMPARE(file6.open(), openResult);
+
+ QCOMPARE(file1.exists(), openResult);
+ QCOMPARE(file2.exists(), openResult);
+ QCOMPARE(file3.exists(), openResult);
+ QCOMPARE(file4.exists(), openResult);
+ QCOMPARE(file5.exists(), openResult);
+ QCOMPARE(file6.exists(), openResult);
+
+ // make sure the file exists under the *correct* name
+ if (openResult) {
+ cleaner.tempNames << file1.fileName()
+ << file2.fileName()
+ << file3.fileName()
+ << file4.fileName()
+ << file5.fileName()
+ << file6.fileName();
+
+ QVERIFY(file1.fileName().startsWith(fileTemplate1 + QLatin1Char('.')));
+ QVERIFY(file2.fileName().startsWith(fileTemplate2 + QLatin1Char('.')));
+ QVERIFY(file5.fileName().startsWith("test-XXXXXX/" + fileTemplate1 + QLatin1Char('.')));
+ QVERIFY(file6.fileName().startsWith("test-XXXXXX/" + prefix));
+
+ if (!prefix.isEmpty()) {
+ QVERIFY(file3.fileName().startsWith(prefix));
+ QVERIFY(file4.fileName().startsWith(prefix));
+ }
+
+ if (!suffix.isEmpty()) {
+ QVERIFY(file3.fileName().endsWith(suffix));
+ QVERIFY(file4.fileName().endsWith(suffix));
+ QVERIFY(file6.fileName().endsWith(suffix));
+ }
+ }
+ }
+
+ Q_FOREACH(QString const &tempName, cleaner.tempNames)
+ QVERIFY( !QFile::exists(tempName) );
+
+ cleaner.reset();
+}
+
QTEST_MAIN(tst_QTemporaryFile)
#include "tst_qtemporaryfile.moc"
diff --git a/tests/auto/qtextboundaryfinder/tst_qtextboundaryfinder.cpp b/tests/auto/qtextboundaryfinder/tst_qtextboundaryfinder.cpp
index 6157004..8003c44 100644
--- a/tests/auto/qtextboundaryfinder/tst_qtextboundaryfinder.cpp
+++ b/tests/auto/qtextboundaryfinder/tst_qtextboundaryfinder.cpp
@@ -257,10 +257,10 @@ void tst_QTextBoundaryFinder::sentenceBoundaries()
void tst_QTextBoundaryFinder::isAtWordStart()
{
- QString txt("The quick brown fox jumped over $the lazy. dog ");
+ QString txt("The quick brown fox jumped over $the lazy. dog I win!");
QList<int> start, end;
- start << 0 << 4 << 10 << 16 << 20 << 27 << 32 << 33 << 37 << 41 << 43;
- end << 3 << 9 << 15 << 19 << 26 << 31 << 33 << 36 << 41 << 42 << 46;
+ start << 0 << 4 << 10 << 16 << 20 << 27 << 32 << 33 << 37 << 41 << 43 << 48 << 50 << 53;
+ end << 3 << 9 << 15 << 19 << 26 << 31 << 33 << 36 << 41 << 42 << 46 << 49 << 53 << 54;
QTextBoundaryFinder finder(QTextBoundaryFinder::Word, txt);
for(int i=0; i < txt.length(); ++i) {
finder.setPosition(i);
diff --git a/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp b/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp
index 4f4e706a..1952796 100644
--- a/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp
+++ b/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp
@@ -61,6 +61,9 @@
#include <private/qtextengine_p.h>
#include <qtextlayout.h>
#undef private
+#else
+#include <private/qtextengine_p.h>
+#include <qtextlayout.h>
#endif
#include <qfontdatabase.h>
@@ -105,6 +108,9 @@ private slots:
void linearB();
void controlInSyllable_qtbug14204();
void combiningMarks_qtbug15675();
+
+ void mirroredChars_data();
+ void mirroredChars();
};
tst_QTextScriptEngine::tst_QTextScriptEngine()
@@ -1151,9 +1157,86 @@ void tst_QTextScriptEngine::combiningMarks_qtbug15675()
QVERIFY(e->layoutData->items[0].num_glyphs == 4);
QVERIFY(e->layoutData->glyphLayout.advances_y[2] > 0);
+#elif defined(Q_WS_X11)
+ QFontDatabase db;
+
+ if (!db.families().contains("DejaVu Sans Mono")) {
+ QSKIP("Required font (DejaVu Sans Mono) doesn't exist, skip test.", SkipAll);
+ return;
+ }
+
+ QString s;
+ s.append(QChar(0x0062));
+ s.append(QChar(0x0332));
+ s.append(QChar(0x0063));
+
+ QTextLayout layout(s, QFont("DejaVu Sans Mono"));
+ QTextEngine *e = layout.d;
+ e->itemize();
+ e->shape(0);
+
+ QVERIFY(e->layoutData->items[0].num_glyphs == 3);
+ QVERIFY(e->layoutData->glyphLayout.advances_x[1] == 0);
#else
- QSKIP("Mac specific test", SkipAll);
+ QSKIP("X11/Mac specific test", SkipAll);
+#endif
+}
+
+void tst_QTextScriptEngine::mirroredChars_data()
+{
+ QTest::addColumn<int>("hintingPreference");
+
+ QTest::newRow("Default hinting") << int(QFont::PreferDefaultHinting);
+ QTest::newRow("No hinting") << int(QFont::PreferNoHinting);
+ QTest::newRow("Vertical hinting") << int(QFont::PreferVerticalHinting);
+ QTest::newRow("Full hinting") << int(QFont::PreferFullHinting);
+}
+
+void tst_QTextScriptEngine::mirroredChars()
+{
+#if defined(Q_WS_MAC)
+ QSKIP("Not supported on Mac", SkipAll);
#endif
+ QFETCH(int, hintingPreference);
+
+ QFont font;
+ font.setHintingPreference(QFont::HintingPreference(hintingPreference));
+
+ QString s;
+ s.append(QLatin1Char('('));
+ s.append(QLatin1Char(')'));
+
+ HB_Glyph leftParenthesis;
+ HB_Glyph rightParenthesis;
+ {
+ QTextLayout layout(s);
+ layout.beginLayout();
+ layout.createLine();
+ layout.endLayout();
+
+ QTextEngine *e = layout.engine();
+ e->itemize();
+ e->shape(0);
+ QCOMPARE(e->layoutData->items[0].num_glyphs, ushort(2));
+
+ const QGlyphLayout &glyphLayout = e->layoutData->glyphLayout;
+ leftParenthesis = glyphLayout.glyphs[0];
+ rightParenthesis = glyphLayout.glyphs[1];
+ }
+
+ {
+ QTextLayout layout(s);
+ layout.setFlags(Qt::TextForceRightToLeft);
+
+ QTextEngine *e = layout.engine();
+ e->itemize();
+ e->shape(0);
+ QCOMPARE(e->layoutData->items[0].num_glyphs, ushort(2));
+
+ const QGlyphLayout &glyphLayout = e->layoutData->glyphLayout;
+ QCOMPARE(glyphLayout.glyphs[0], rightParenthesis);
+ QCOMPARE(glyphLayout.glyphs[1], leftParenthesis);
+ }
}
QTEST_MAIN(tst_QTextScriptEngine)
diff --git a/tests/auto/qthread/tst_qthread.cpp b/tests/auto/qthread/tst_qthread.cpp
index c69052e..6ad0678 100644
--- a/tests/auto/qthread/tst_qthread.cpp
+++ b/tests/auto/qthread/tst_qthread.cpp
@@ -103,7 +103,9 @@ private slots:
void adoptedThreadExit();
void adoptedThreadExec();
void adoptedThreadFinished();
+ void adoptedThreadExecFinished();
void adoptMultipleThreads();
+ void adoptMultipleThreadsOverlap();
void QTBUG13810_exitAndStart();
void QTBUG15378_exitAndExec();
@@ -663,7 +665,9 @@ void tst_QThread::usleep()
typedef void (*FunctionPointer)(void *);
void noop(void*) { }
-#ifdef Q_OS_UNIX
+#ifdef Q_OS_SYMBIAN
+typedef RThread ThreadHandle;
+#elif defined Q_OS_UNIX
typedef pthread_t ThreadHandle;
#elif defined Q_OS_WIN
typedef HANDLE ThreadHandle;
@@ -694,6 +698,7 @@ public:
protected:
static void *runUnix(void *data);
static unsigned WIN_FIX_STDCALL runWin(void *data);
+ static int runSymbian(void *data);
FunctionPointer functionPointer;
void *data;
@@ -703,7 +708,10 @@ void NativeThreadWrapper::start(FunctionPointer functionPointer, void *data)
{
this->functionPointer = functionPointer;
this->data = data;
-#ifdef Q_OS_UNIX
+#ifdef Q_OS_SYMBIAN
+ qt_symbian_throwIfError(nativeThreadHandle.Create(KNullDesC(), NativeThreadWrapper::runSymbian, 1024, &User::Allocator(), this));
+ nativeThreadHandle.Resume();
+#elif defined Q_OS_UNIX
const int state = pthread_create(&nativeThreadHandle, 0, NativeThreadWrapper::runUnix, this);
Q_UNUSED(state);
#elif defined(Q_OS_WINCE)
@@ -723,7 +731,12 @@ void NativeThreadWrapper::startAndWait(FunctionPointer functionPointer, void *da
void NativeThreadWrapper::join()
{
-#ifdef Q_OS_UNIX
+#ifdef Q_OS_SYMBIAN
+ TRequestStatus stat;
+ nativeThreadHandle.Logon(stat);
+ User::WaitForRequest(stat);
+ nativeThreadHandle.Close();
+#elif defined Q_OS_UNIX
pthread_join(nativeThreadHandle, 0);
#elif defined Q_OS_WIN
WaitForSingleObject(nativeThreadHandle, INFINITE);
@@ -763,6 +776,12 @@ unsigned WIN_FIX_STDCALL NativeThreadWrapper::runWin(void *data)
return 0;
}
+int NativeThreadWrapper::runSymbian(void *data)
+{
+ runUnix(data);
+ return 0;
+}
+
void NativeThreadWrapper::stop()
{
QMutexLocker lock(&mutex);
@@ -895,6 +914,21 @@ void tst_QThread::adoptedThreadFinished()
QVERIFY(!QTestEventLoop::instance().timeout());
}
+void tst_QThread::adoptedThreadExecFinished()
+{
+ NativeThreadWrapper nativeThread;
+ nativeThread.setWaitForStop();
+ nativeThread.startAndWait(adoptedThreadExecFunction);
+
+ QObject::connect(nativeThread.qthread, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
+
+ nativeThread.stop();
+ nativeThread.join();
+
+ QTestEventLoop::instance().enterLoop(5);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+}
+
void tst_QThread::adoptMultipleThreads()
{
#if defined(Q_OS_WIN)
@@ -924,6 +958,7 @@ void tst_QThread::adoptMultipleThreads()
for (int i = 0; i < numThreads; ++i) {
nativeThreads.at(i)->stop();
nativeThreads.at(i)->join();
+ delete nativeThreads.at(i);
}
QTestEventLoop::instance().enterLoop(5);
@@ -931,6 +966,50 @@ void tst_QThread::adoptMultipleThreads()
QCOMPARE(int(recorder.activationCount), numThreads);
}
+void tst_QThread::adoptMultipleThreadsOverlap()
+{
+#if defined(Q_OS_WIN)
+ // Windows CE is not capable of handling that many threads. On the emulator it is dead with 26 threads already.
+# if defined(Q_OS_WINCE)
+ const int numThreads = 20;
+# else
+ // need to test lots of threads, so that we exceed MAXIMUM_WAIT_OBJECTS in qt_adopted_thread_watcher()
+ const int numThreads = 200;
+# endif
+#elif defined(Q_OS_SYMBIAN)
+ // stress the monitoring thread's add function
+ const int numThreads = 100;
+#else
+ const int numThreads = 5;
+#endif
+ QVector<NativeThreadWrapper*> nativeThreads;
+
+ SignalRecorder recorder;
+
+ for (int i = 0; i < numThreads; ++i) {
+ nativeThreads.append(new NativeThreadWrapper());
+ nativeThreads.at(i)->setWaitForStop();
+ nativeThreads.at(i)->mutex.lock();
+ nativeThreads.at(i)->start();
+ }
+ for (int i = 0; i < numThreads; ++i) {
+ nativeThreads.at(i)->startCondition.wait(&nativeThreads.at(i)->mutex);
+ QObject::connect(nativeThreads.at(i)->qthread, SIGNAL(finished()), &recorder, SLOT(slot()));
+ nativeThreads.at(i)->mutex.unlock();
+ }
+
+ QObject::connect(nativeThreads.at(numThreads - 1)->qthread, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
+
+ for (int i = 0; i < numThreads; ++i) {
+ nativeThreads.at(i)->stop();
+ nativeThreads.at(i)->join();
+ delete nativeThreads.at(i);
+ }
+
+ QTestEventLoop::instance().enterLoop(5);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+ QCOMPARE(int(recorder.activationCount), numThreads);
+}
void tst_QThread::stressTest()
{
#if defined(Q_OS_WINCE)
diff --git a/tests/auto/qthreadstorage/tst_qthreadstorage.cpp b/tests/auto/qthreadstorage/tst_qthreadstorage.cpp
index a62bfee..2391c81 100644
--- a/tests/auto/qthreadstorage/tst_qthreadstorage.cpp
+++ b/tests/auto/qthreadstorage/tst_qthreadstorage.cpp
@@ -385,19 +385,18 @@ void tst_QThreadStorage::QTBUG14579_leakInDestructor()
QCOMPARE(int(SPointer::count), c);
}
-
-class QTBUG14579_reset;
-Q_GLOBAL_STATIC(QThreadStorage<QTBUG14579_reset *>, QTBUG14579_resetTls)
-
class QTBUG14579_reset {
public:
SPointer member;
- ~QTBUG14579_reset() {
- //Quite stupid, but WTF::ThreadSpecific<T>::destroy does it.
- QTBUG14579_resetTls()->setLocalData(this);
- }
+ ~QTBUG14579_reset();
};
+Q_GLOBAL_STATIC(QThreadStorage<QTBUG14579_reset *>, QTBUG14579_resetTls)
+
+QTBUG14579_reset::~QTBUG14579_reset() {
+ //Quite stupid, but WTF::ThreadSpecific<T>::destroy does it.
+ QTBUG14579_resetTls()->setLocalData(this);
+}
void tst_QThreadStorage::QTBUG14579_resetInDestructor()
{
diff --git a/tests/auto/qvariant/tst_qvariant.cpp b/tests/auto/qvariant/tst_qvariant.cpp
index 2e57264..6ebe84e 100644
--- a/tests/auto/qvariant/tst_qvariant.cpp
+++ b/tests/auto/qvariant/tst_qvariant.cpp
@@ -275,6 +275,8 @@ private slots:
void variantInVariant();
void colorInteger();
+
+ void forwardDeclare();
};
Q_DECLARE_METATYPE(QDate)
@@ -3439,5 +3441,16 @@ void tst_QVariant::colorInteger()
QCOMPARE(v.value<QColor>(), QColor(Qt::yellow));
}
+class Forward;
+Q_DECLARE_METATYPE(Forward*);
+
+void tst_QVariant::forwardDeclare()
+{
+ Forward *f = 0;
+ QVariant v = QVariant::fromValue(f);
+ QCOMPARE(qvariant_cast<Forward*>(v), f);
+}
+
+
QTEST_MAIN(tst_QVariant)
#include "tst_qvariant.moc"
diff --git a/tests/auto/qwindowsurface/tst_qwindowsurface.cpp b/tests/auto/qwindowsurface/tst_qwindowsurface.cpp
index b309917..b209258 100644
--- a/tests/auto/qwindowsurface/tst_qwindowsurface.cpp
+++ b/tests/auto/qwindowsurface/tst_qwindowsurface.cpp
@@ -66,7 +66,6 @@ private slots:
void getSetWindowSurface();
void flushOutsidePaintEvent();
void grabWidget();
- void staticContentsAndPartialUpdateSupport();
};
class MyWindowSurface : public QWindowSurface
@@ -82,8 +81,6 @@ public:
/* nothing */
}
- using QWindowSurface::setStaticContentsSupport;
- using QWindowSurface::setPartialUpdateSupport;
private:
QImage image;
};
@@ -283,51 +280,6 @@ void tst_QWindowSurface::grabWidget()
QVERIFY(QColor(childInvalidSubImage.pixel(0, 0)) == QColor(Qt::white));
}
-void tst_QWindowSurface::staticContentsAndPartialUpdateSupport()
-{
- QWidget widget;
- MyWindowSurface surface(&widget);
-
- // Default values.
- QVERIFY(surface.hasPartialUpdateSupport());
- QVERIFY(!surface.hasStaticContentsSupport());
-
- // Partial: YES, Static: YES
- surface.setStaticContentsSupport(true);
- QVERIFY(surface.hasPartialUpdateSupport());
- QVERIFY(surface.hasStaticContentsSupport());
-
- // Static contents requires support for partial updates.
- // We simply ingore bad combinations and spit out a warning.
-
- // CONFLICT: Partial: NO, Static: YES
- QTest::ignoreMessage(QtWarningMsg, "QWindowSurface::setPartialUpdateSupport: static contents support requires partial update support");
- surface.setPartialUpdateSupport(false);
- QVERIFY(surface.hasPartialUpdateSupport());
- QVERIFY(surface.hasStaticContentsSupport());
-
- // Partial: YES, Static: NO
- surface.setStaticContentsSupport(false);
- QVERIFY(surface.hasPartialUpdateSupport());
- QVERIFY(!surface.hasStaticContentsSupport());
-
- // Partial: NO, Static: NO
- surface.setPartialUpdateSupport(false);
- QVERIFY(!surface.hasPartialUpdateSupport());
- QVERIFY(!surface.hasStaticContentsSupport());
-
- // CONFLICT: Partial: NO, Static: YES
- QTest::ignoreMessage(QtWarningMsg, "QWindowSurface::setStaticContentsSupport: static contents support requires partial update support");
- surface.setStaticContentsSupport(true);
- QVERIFY(!surface.hasPartialUpdateSupport());
- QVERIFY(!surface.hasStaticContentsSupport());
-
- // Partial: YES, Static: NO
- surface.setPartialUpdateSupport(true);
- QVERIFY(surface.hasPartialUpdateSupport());
- QVERIFY(!surface.hasStaticContentsSupport());
-}
-
QTEST_MAIN(tst_QWindowSurface)
#else // Q_WS_MAC