summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/declarative/declarative.pro2
-rw-r--r--tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp5
-rw-r--r--tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp4
-rw-r--r--tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp10
-rw-r--r--tests/auto/declarative/qmlshadersplugin/main.qml80
-rw-r--r--tests/auto/declarative/qmlshadersplugin/qmlshadersplugin.pro18
-rw-r--r--tests/auto/declarative/qmlshadersplugin/tst_qmlshadersplugin.cpp205
-rw-r--r--tests/auto/headers/tst_headers.cpp2
-rw-r--r--tests/auto/lancelot/scripts/statictext.qps122
-rw-r--r--tests/auto/networkselftest/tst_networkselftest.cpp15
-rw-r--r--tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp15
-rw-r--r--tests/auto/qaccessibility/tst_qaccessibility.cpp63
-rw-r--r--tests/auto/qcssparser/qcssparser.pro2
-rw-r--r--tests/auto/qdatetime/qdatetime.pro4
-rw-r--r--tests/auto/qdatetime/tst_qdatetime.cpp7
-rw-r--r--tests/auto/qeventloop/tst_qeventloop.cpp11
-rw-r--r--tests/auto/qfont/tst_qfont.cpp13
-rw-r--r--tests/auto/qftp/tst_qftp.cpp21
-rw-r--r--tests/auto/qglyphrun/tst_qglyphrun.cpp79
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp11
-rw-r--r--tests/auto/qheaderview/tst_qheaderview.cpp12
-rw-r--r--tests/auto/qhostinfo/tst_qhostinfo.cpp30
-rw-r--r--tests/auto/qmenubar/tst_qmenubar.cpp10
-rw-r--r--tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp44
-rw-r--r--tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp4
-rw-r--r--tests/auto/qnetworkinterface/tst_qnetworkinterface.cpp15
-rw-r--r--tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp29
-rw-r--r--tests/auto/qnetworkreply/tst_qnetworkreply.cpp73
-rw-r--r--tests/auto/qpainter/tst_qpainter.cpp6
-rw-r--r--tests/auto/qscriptextensionplugin/staticplugin/staticplugin.pro1
-rw-r--r--tests/auto/qsslcertificate/certificates/cert-ss-san-utf8.pem16
-rw-r--r--tests/auto/qsslcertificate/certificates/cert-ss-san-utf8.pem.san5
-rwxr-xr-xtests/auto/qsslcertificate/certificates/gencertificates.sh10
-rw-r--r--tests/auto/qsslcertificate/tst_qsslcertificate.cpp32
-rw-r--r--tests/auto/qstatictext/tst_qstatictext.cpp4
-rw-r--r--tests/auto/qstring/tst_qstring.cpp2
-rw-r--r--tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp5
-rw-r--r--tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp21
-rw-r--r--tests/auto/qtconcurrentrun/tst_qtconcurrentrun.cpp67
-rw-r--r--tests/auto/qtcpserver/tst_qtcpserver.cpp19
-rw-r--r--tests/auto/qtextdocument/tst_qtextdocument.cpp26
-rw-r--r--tests/auto/qtextlayout/tst_qtextlayout.cpp42
-rw-r--r--tests/auto/qtoolbutton/tst_qtoolbutton.cpp2
-rw-r--r--tests/auto/qtreewidget/tst_qtreewidget.cpp20
-rw-r--r--tests/auto/qudpsocket/tst_qudpsocket.cpp15
-rw-r--r--tests/auto/qurl/tst_qurl.cpp30
-rw-r--r--tests/auto/quuid/tst_quuid.cpp101
48 files changed, 1181 insertions, 151 deletions
diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro
index 98e15e8..72c32cb 100644
--- a/tests/auto/declarative/declarative.pro
+++ b/tests/auto/declarative/declarative.pro
@@ -78,5 +78,7 @@ contains(QT_CONFIG, private_tests) {
qpacketprotocol
}
+contains(QT_CONFIG, opengl): SUBDIRS += qmlshadersplugin
+
# Tests which should run in Pulse
PULSE_TESTS = $$SUBDIRS
diff --git a/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp b/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp
index 3a626bf..541d9a1 100644
--- a/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp
+++ b/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp
@@ -58,7 +58,6 @@
Q_DECLARE_METATYPE(QDeclarativeAnchors::Anchor)
Q_DECLARE_METATYPE(QDeclarativeAnchorLine::AnchorLine)
-
class tst_qdeclarativeanchors : public QObject
{
Q_OBJECT
@@ -291,7 +290,7 @@ void tst_qdeclarativeanchors::basicAnchorsRTL()
QDeclarativeItem* rootItem = qobject_cast<QDeclarativeItem*>(view->rootObject());
foreach(QObject *child, rootItem->children()) {
- bool mirrored = QDeclarativeItemPrivate::get(qobject_cast<QDeclarativeItem*>(child))->anchors()->property("mirrored").toBool();
+ bool mirrored = QDeclarativeItemPrivate::get(qobject_cast<QDeclarativeItem*>(child))->anchors()->mirrored();
QCOMPARE(mirrored, false);
}
@@ -299,7 +298,7 @@ void tst_qdeclarativeanchors::basicAnchorsRTL()
mirrorAnchors(qobject_cast<QDeclarativeItem*>(child));
foreach(QObject *child, rootItem->children()) {
- bool mirrored = QDeclarativeItemPrivate::get(qobject_cast<QDeclarativeItem*>(child))->anchors()->property("mirrored").toBool();
+ bool mirrored = QDeclarativeItemPrivate::get(qobject_cast<QDeclarativeItem*>(child))->anchors()->mirrored();
QCOMPARE(mirrored, true);
}
diff --git a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp
index 361d7f3..9c20bd6 100644
--- a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp
+++ b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp
@@ -224,7 +224,7 @@ void tst_QDeclarativeDebug::recursiveObjectTest(QObject *o, const QDeclarativeDe
QCOMPARE(p.name(), QString::fromUtf8(pmeta.name()));
- if (pmeta.type() < QVariant::UserType) // TODO test complex types
+ if (pmeta.type() > 0 && pmeta.type() < QVariant::UserType) // TODO test complex types
QCOMPARE(p.value(), pmeta.read(o));
if (p.name() == "parent")
@@ -1027,7 +1027,7 @@ void tst_QDeclarativeDebug::setBindingForObject()
// set handler
//
rootObject = findRootObject();
- QCOMPARE(rootObject.children().size(), 4); // Rectangle, Text, MouseArea, QDeclarativeComponentAttached
+ QCOMPARE(rootObject.children().size(), 5); // Rectangle, Text, MouseArea, Component.onCompleted, NonScriptPropertyElement
QDeclarativeDebugObjectReference mouseAreaObject = rootObject.children().at(2);
QDeclarativeDebugObjectQuery *q_obj = m_dbg->queryObjectRecursive(mouseAreaObject, this);
waitForQuery(q_obj);
diff --git a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
index d75960c..0d581d4 100644
--- a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
+++ b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
@@ -174,7 +174,7 @@ void tst_qdeclarativeqt::rect()
QCOMPARE(qvariant_cast<QRectF>(object->property("test2")), QRectF(-10, 13, 100, 109.6));
QCOMPARE(qvariant_cast<QRectF>(object->property("test3")), QRectF());
QCOMPARE(qvariant_cast<QRectF>(object->property("test4")), QRectF());
- QCOMPARE(qvariant_cast<QRectF>(object->property("test5")), QRectF());
+ QCOMPARE(qvariant_cast<QRectF>(object->property("test5")), QRectF(10, 13, 100, -109));
delete object;
}
diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
index 1720c33..19b7a76 100644
--- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
+++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
@@ -2431,15 +2431,20 @@ void tst_qdeclarativetextinput::preeditAutoScroll()
QTest::qWaitForWindowShown(&view);
QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view));
+ QSignalSpy cursorRectangleSpy(&input, SIGNAL(cursorRectangleChanged()));
+ int cursorRectangleChanges = 0;
+
// test the text is scrolled so the preedit is visible.
ic.sendPreeditText(preeditText.mid(0, 3), 1);
QVERIFY(input.positionAt(0) != 0);
QVERIFY(input.cursorRectangle().left() < input.boundingRect().width());
+ QCOMPARE(cursorRectangleSpy.count(), ++cursorRectangleChanges);
// test the text is scrolled back when the preedit is removed.
ic.sendEvent(QInputMethodEvent());
QCOMPARE(input.positionAt(0), 0);
QCOMPARE(input.positionAt(input.width()), 5);
+ QCOMPARE(cursorRectangleSpy.count(), ++cursorRectangleChanges);
// some tolerance for different fonts.
#ifdef Q_OS_LINUX
@@ -2455,26 +2460,31 @@ void tst_qdeclarativetextinput::preeditAutoScroll()
ic.sendPreeditText(preeditText, i + 1);
QVERIFY(input.cursorRectangle().right() >= fm.width(preeditText.at(i)) - error);
QVERIFY(input.positionToRectangle(0).x() < x);
+ QCOMPARE(cursorRectangleSpy.count(), ++cursorRectangleChanges);
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)) - error);
QVERIFY(input.positionToRectangle(0).x() > x);
+ QCOMPARE(cursorRectangleSpy.count(), ++cursorRectangleChanges);
x = input.positionToRectangle(0).x();
}
// Test incrementing the preedit cursor doesn't cause further
// scrolling when right most text is visible.
ic.sendPreeditText(preeditText, preeditText.length() - 3);
+ QCOMPARE(cursorRectangleSpy.count(), ++cursorRectangleChanges);
x = input.positionToRectangle(0).x();
for (int i = 2; i >= 0; --i) {
ic.sendPreeditText(preeditText, preeditText.length() - i);
QCOMPARE(input.positionToRectangle(0).x(), x);
+ QCOMPARE(cursorRectangleSpy.count(), ++cursorRectangleChanges);
}
for (int i = 1; i < 3; ++i) {
ic.sendPreeditText(preeditText, preeditText.length() - i);
QCOMPARE(input.positionToRectangle(0).x(), x);
+ QCOMPARE(cursorRectangleSpy.count(), ++cursorRectangleChanges);
}
// Test disabling auto scroll.
diff --git a/tests/auto/declarative/qmlshadersplugin/main.qml b/tests/auto/declarative/qmlshadersplugin/main.qml
new file mode 100644
index 0000000..fc80b39
--- /dev/null
+++ b/tests/auto/declarative/qmlshadersplugin/main.qml
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QML Shaders plugin of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 1.0
+import Qt.labs.shaders 1.0
+
+ Rectangle {
+ width: 300
+ height: 300
+
+ Text {
+ id: textLabel
+ text: "Hello World"
+ anchors.centerIn: parent
+ font.pixelSize: 48
+ }
+
+ ShaderEffectItem {
+ objectName: "effectItem"
+ property variant source: ShaderEffectSource { objectName: "effectSource"; sourceItem: textLabel; hideSource: true }
+ property real wiggleAmount: 0.01
+ anchors.fill: textLabel
+
+ SequentialAnimation on wiggleAmount {
+ loops: Animation.Infinite
+ NumberAnimation { to: -0.01; duration: 500 }
+ NumberAnimation { to: 0.01; duration: 500 }
+ }
+
+ fragmentShader: "
+ varying highp vec2 qt_TexCoord0;
+ uniform sampler2D source;
+ uniform highp float wiggleAmount;
+ void main(void)
+ {
+ highp vec2 wiggledTexCoord = qt_TexCoord0;
+ wiggledTexCoord.s += sin(4.0 * 3.141592653589 * wiggledTexCoord.t) * wiggleAmount;
+ gl_FragColor = texture2D(source, wiggledTexCoord.st);
+ }
+ "
+ }
+ }
diff --git a/tests/auto/declarative/qmlshadersplugin/qmlshadersplugin.pro b/tests/auto/declarative/qmlshadersplugin/qmlshadersplugin.pro
new file mode 100644
index 0000000..aa0e07a
--- /dev/null
+++ b/tests/auto/declarative/qmlshadersplugin/qmlshadersplugin.pro
@@ -0,0 +1,18 @@
+load(qttest_p4)
+
+QT += opengl declarative
+SOURCES += tst_qmlshadersplugin.cpp
+
+SOURCES += \
+ ../../../../src/imports/shaders/shadereffectitem.cpp \
+ ../../../../src/imports/shaders/shadereffectsource.cpp \
+ ../../../../src/imports/shaders/shadereffect.cpp \
+ ../../../../src/imports/shaders/shadereffectbuffer.cpp \
+ ../../../../src/imports/shaders/scenegraph/qsggeometry.cpp
+
+HEADERS += \
+ ../../../../src/imports/shaders/shadereffectitem.h \
+ ../../../../src/imports/shaders/shadereffectsource.h \
+ ../../../../src/imports/shaders/shadereffect.h \
+ ../../../../src/imports/shaders/shadereffectbuffer.h \
+ ../../../../src/imports/shaders/scenegraph/qsggeometry.h
diff --git a/tests/auto/declarative/qmlshadersplugin/tst_qmlshadersplugin.cpp b/tests/auto/declarative/qmlshadersplugin/tst_qmlshadersplugin.cpp
new file mode 100644
index 0000000..a904a88
--- /dev/null
+++ b/tests/auto/declarative/qmlshadersplugin/tst_qmlshadersplugin.cpp
@@ -0,0 +1,205 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QML Shaders plugin of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QtDeclarative>
+#include "../../../../src/imports/shaders/shadereffectitem.h"
+#include "../../../../src/imports/shaders/shadereffectsource.h"
+#include "../../../../src/imports/shaders/shadereffect.h"
+
+static const char qt_default_vertex_code[] =
+ "uniform highp mat4 qt_ModelViewProjectionMatrix;\n"
+ "attribute highp vec4 qt_Vertex;\n"
+ "attribute highp vec2 qt_MultiTexCoord0;\n"
+ "varying highp vec2 qt_TexCoord0;\n"
+ "void main(void)\n"
+ "{\n"
+ "qt_TexCoord0 = qt_MultiTexCoord0;\n"
+ "gl_Position = qt_ModelViewProjectionMatrix * qt_Vertex;\n"
+ "}\n";
+
+static const char qt_default_fragment_code[] =
+ "varying highp vec2 qt_TexCoord0;\n"
+ "uniform lowp sampler2D source;\n"
+ "void main(void)\n"
+ "{\n"
+ "gl_FragColor = texture2D(source, qt_TexCoord0.st);\n"
+ "}\n";
+
+class tst_qmlshadersplugin : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void initTestCase();
+ void shaderEffectItemAPI();
+ void shaderEffectSourceAPI();
+ void combined();
+
+private:
+ QDeclarativeEngine engine;
+};
+
+void tst_qmlshadersplugin::initTestCase()
+{
+ const char *uri ="Qt.labs.shaders";
+ qmlRegisterType<ShaderEffectItem>(uri, 1, 0, "ShaderEffectItem");
+ qmlRegisterType<ShaderEffectSource>(uri, 1, 0, "ShaderEffectSource");
+}
+
+
+void tst_qmlshadersplugin::shaderEffectItemAPI()
+{
+ // Creation
+ QString componentStr = "import QtQuick 1.0\n"
+ "import Qt.labs.shaders 1.0\n"
+ "ShaderEffectItem {\n"
+ "property variant source\n"
+ "width: 200; height: 300\n"
+ "}";
+ QDeclarativeComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+
+ QObject *obj = component.create();
+ QTest::qWait(100);
+ QVERIFY(obj != 0);
+
+ // Default values
+ QCOMPARE(obj->property("width").toDouble(), 200.);
+ QCOMPARE(obj->property("height").toDouble(), 300.);
+ QCOMPARE(obj->property("fragmentShader").toString(), QString(""));
+ QCOMPARE(obj->property("vertexShader").toString(), QString(""));
+ QCOMPARE(obj->property("blending").toBool(), true);
+ QCOMPARE(obj->property("meshResolution").toSize(), QSize(1, 1));
+ QCOMPARE(obj->property("visible").toBool(), true);
+
+ // Seting the values
+ QVERIFY(obj->setProperty("fragmentShader", QString(qt_default_fragment_code)));
+ QVERIFY(obj->setProperty("vertexShader", QString(qt_default_vertex_code)));
+ QVERIFY(obj->setProperty("blending", false));
+ QVERIFY(obj->setProperty("meshResolution", QSize(20, 10)));
+ QVERIFY(obj->setProperty("visible", false));
+
+ QCOMPARE(obj->property("fragmentShader").toString(), QString(qt_default_fragment_code));
+ QCOMPARE(obj->property("vertexShader").toString(), QString(qt_default_vertex_code));
+ QCOMPARE(obj->property("blending").toBool(), false);
+ QCOMPARE(obj->property("meshResolution").toSize(), QSize(20, 10));
+ QCOMPARE(obj->property("visible").toBool(), false);
+
+ delete obj;
+}
+
+void tst_qmlshadersplugin::shaderEffectSourceAPI()
+{
+ // Creation
+ QString componentStr = "import QtQuick 1.0\n"
+ "import Qt.labs.shaders 1.0\n"
+ "ShaderEffectSource {}";
+ QDeclarativeComponent shaderEffectSourceComponent(&engine);
+ shaderEffectSourceComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+
+ QObject *obj = shaderEffectSourceComponent.create();
+ QTest::qWait(100);
+ QVERIFY(obj != 0);
+
+ // Default values
+ QCOMPARE(obj->property("sourceRect").toRect(), QRect(0, 0, 0, 0));
+ QCOMPARE(obj->property("textureSize").toSize(), QSize(0, 0));
+ QCOMPARE(obj->property("live").toBool(), true);
+ QCOMPARE(obj->property("hideSource").toBool(), false);
+ QCOMPARE(obj->property("wrapMode").toUInt(), static_cast<unsigned int>(ShaderEffectSource::ClampToEdge));
+
+ // Seting the values
+ componentStr = "import QtQuick 1.0\n"
+ "Item {}";
+ QDeclarativeComponent itemComponent(&engine);
+ itemComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QDeclarativeItem *item = qobject_cast<QDeclarativeItem *> (itemComponent.create());
+ QVERIFY(item != 0);
+
+ QVERIFY(obj->setProperty("sourceItem", QVariant::fromValue(item)));
+ QVERIFY(obj->setProperty("sourceRect", QRect(10, 20, 30, 40)));
+ QVERIFY(obj->setProperty("textureSize", QSize(50, 100)));
+ QVERIFY(obj->setProperty("live", false));
+ QVERIFY(obj->setProperty("hideSource", true));
+ QVERIFY(obj->setProperty("wrapMode", static_cast<unsigned int>(ShaderEffectSource::Repeat)));
+
+ QCOMPARE(obj->property("sourceItem"), QVariant::fromValue(item));
+ QCOMPARE(obj->property("sourceRect").toRect(), QRect(10, 20, 30, 40));
+ QCOMPARE(obj->property("textureSize").toSize(), QSize(50, 100));
+ QCOMPARE(obj->property("live").toBool(), false);
+ QCOMPARE(obj->property("hideSource").toBool(), true);
+ QCOMPARE(obj->property("wrapMode").toUInt(), static_cast<unsigned int>(ShaderEffectSource::Repeat));
+
+ delete item;
+ delete obj;
+}
+
+void tst_qmlshadersplugin::combined()
+{
+ QGLFormat format = QGLFormat::defaultFormat();
+ format.setSampleBuffers(false);
+ format.setSwapInterval(1);
+
+ QGLWidget* glWidget = new QGLWidget(format);
+ glWidget->setAutoFillBackground(false);
+
+ QDeclarativeView view;
+ view.setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
+ view.setAttribute(Qt::WA_OpaquePaintEvent);
+ view.setAttribute(Qt::WA_NoSystemBackground);
+ view.setViewport(glWidget);
+ view.setSource(QUrl::fromLocalFile("main.qml"));
+ view.show();
+ QTest::qWait(1000);
+
+ QObject *item = view.rootObject()->findChild<QDeclarativeItem*>("effectItem");
+ QVERIFY(item != 0);
+
+ QObject *src = view.rootObject()->findChild<QDeclarativeItem*>("effectSource");
+ QVERIFY(src != 0);
+
+ QCOMPARE(item->property("source"), QVariant::fromValue(src));
+}
+
+QTEST_MAIN(tst_qmlshadersplugin)
+
+#include "tst_qmlshadersplugin.moc"
diff --git a/tests/auto/headers/tst_headers.cpp b/tests/auto/headers/tst_headers.cpp
index 2686a00..335e832 100644
--- a/tests/auto/headers/tst_headers.cpp
+++ b/tests/auto/headers/tst_headers.cpp
@@ -177,7 +177,7 @@ void tst_Headers::allSourceFilesData()
|| sourceFile.endsWith("/src/corelib/global/qconfig.h")
|| sourceFile.endsWith("/src/corelib/global/qconfig.cpp")
|| sourceFile.endsWith("/src/tools/uic/qclass_lib_map.h")
- || sourceFile.endsWith("src/network/access/qnetworkcookiejartlds_p.h")
+ || sourceFile.endsWith("src/corelib/io/qurltlds_p.h")
)
continue;
diff --git a/tests/auto/lancelot/scripts/statictext.qps b/tests/auto/lancelot/scripts/statictext.qps
new file mode 100644
index 0000000..b62b623
--- /dev/null
+++ b/tests/auto/lancelot/scripts/statictext.qps
@@ -0,0 +1,122 @@
+drawStaticText -5 5 "Text that is drawn outside the bounds..."
+
+translate 20 20
+begin_block text_drawing
+save
+ setFont "sansserif" 10 normal
+ drawStaticText 0 20 "sansserif 10pt, normal"
+
+ setFont "sansserif" 12 normal
+ drawStaticText 0 40 "sansserif 12pt, normal"
+
+ setFont "sansserif" 10 bold
+ drawStaticText 0 60 "sansserif 12pt, bold"
+
+ setFont "sansserif" 10 bold italic
+ drawStaticText 0 80 "sansserif 10pt, bold italic"
+
+
+ translate 0 100
+ setPen #7fff0000
+
+ setFont "sansserif" 10 normal
+ drawStaticText 0 20 "alpha sansserif 10pt, normal"
+
+ setFont "sansserif" 12 normal
+ drawStaticText 0 40 "alpha sansserif 12pt, normal"
+
+ setFont "sansserif" 10 bold
+ drawStaticText 0 60 "alpha sansserif 12pt, bold"
+
+ setFont "sansserif" 10 bold italic
+ drawStaticText 0 80 "alpha sansserif 10pt, bold italic"
+
+
+ translate 0 100
+ setPen black
+ save
+ scale 0.9 0.9
+
+ setFont "sansserif" 10 normal
+ drawStaticText 0 20 "scaled sansserif 10pt, normal"
+
+ setFont "sansserif" 12 normal
+ drawStaticText 0 40 "scaled sansserif 12pt, normal"
+
+ setFont "sansserif" 10 bold
+ drawStaticText 0 60 "scaled sansserif 12pt, bold"
+
+ setFont "sansserif" 10 bold italic
+ drawStaticText 0 80 "scaled sansserif 10pt, bold italic"
+ restore
+
+ translate 0 100
+ setPen black
+ save
+ translate 200 90
+ rotate 185
+
+ setFont "sansserif" 10 normal
+ drawStaticText 0 20 "scaled sansserif 10pt, normal"
+
+ setFont "sansserif" 12 normal
+ drawStaticText 0 40 "scaled sansserif 12pt, normal"
+
+ setFont "sansserif" 10 bold
+ drawStaticText 0 60 "scaled sansserif 12pt, bold"
+
+ setFont "sansserif" 10 bold italic
+ drawStaticText 0 80 "scaled sansserif 10pt, bold italic"
+ restore
+
+ translate 0 100
+ gradient_appendStop 0 red
+ gradient_appendStop 0.5 #00ff00
+ gradient_appendStop 1 blue
+ gradient_setLinear 0 0 200 0
+ setPen brush
+
+ setFont "sansserif" 10 normal
+ drawStaticText 0 0 "gradient sansserif 10pt, normal"
+
+ setFont "sansserif" 12 normal
+ drawStaticText 0 20 "gradient sansserif 12pt, normal"
+
+ setFont "sansserif" 10 bold
+ drawStaticText 0 40 "gradient sansserif 12pt, bold"
+
+ setFont "sansserif" 10 bold italic
+ drawStaticText 0 60 "gradient sansserif 10pt, bold italic"
+restore
+end_block
+
+translate 250 0
+drawStaticText 25 520 "clipped to rectangle"
+save
+ setPen #3f000000
+ setBrush nobrush
+ drawRect 20 0 100 500
+ setClipRect 20 0 100 500
+ setPen black
+ repeat_block text_drawing
+restore
+
+translate 150 0
+drawStaticText 25 520 "clipped to path"
+save
+ path_moveTo clip 20 0
+ path_cubicTo clip 0 200 40 400 20 400
+ path_lineTo clip 30 500
+ path_lineTo clip 30 0
+ path_lineTo clip 40 0
+ path_lineTo clip 40 500
+ path_lineTo clip 120 500
+ path_lineTo clip 120 0
+ path_lineTo clip 20 0
+ setPen #3f000000
+ setBrush nobrush
+ drawPath clip
+ setClipPath clip
+ setPen black
+ repeat_block text_drawing
+restore
diff --git a/tests/auto/networkselftest/tst_networkselftest.cpp b/tests/auto/networkselftest/tst_networkselftest.cpp
index c21fd03..b2ce5ca 100644
--- a/tests/auto/networkselftest/tst_networkselftest.cpp
+++ b/tests/auto/networkselftest/tst_networkselftest.cpp
@@ -371,11 +371,18 @@ void tst_NetworkSelfTest::initTestCase()
{
#ifndef QT_NO_BEARERMANAGEMENT
netConfMan = new QNetworkConfigurationManager(this);
+ netConfMan->updateConfigurations();
+ connect(netConfMan, SIGNAL(updateCompleted()), &QTestEventLoop::instance(), SLOT(exitLoop()));
+ QTestEventLoop::instance().enterLoop(10);
networkConfiguration = netConfMan->defaultConfiguration();
- networkSession.reset(new QNetworkSession(networkConfiguration));
- if (!networkSession->isOpen()) {
- networkSession->open();
- QVERIFY(networkSession->waitForOpened(30000));
+ if (networkConfiguration.isValid()) {
+ networkSession.reset(new QNetworkSession(networkConfiguration));
+ if (!networkSession->isOpen()) {
+ networkSession->open();
+ QVERIFY(networkSession->waitForOpened(30000));
+ }
+ } else {
+ QVERIFY(!(netConfMan->capabilities() & QNetworkConfigurationManager::NetworkSessionRequired));
}
#endif
}
diff --git a/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp b/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp
index e4372c5..aefe0b9 100644
--- a/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp
+++ b/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp
@@ -141,11 +141,18 @@ void tst_QAbstractNetworkCache::initTestCase()
{
#ifndef QT_NO_BEARERMANAGEMENT
netConfMan = new QNetworkConfigurationManager(this);
+ netConfMan->updateConfigurations();
+ connect(netConfMan, SIGNAL(updateCompleted()), &QTestEventLoop::instance(), SLOT(exitLoop()));
+ QTestEventLoop::instance().enterLoop(10);
networkConfiguration = netConfMan->defaultConfiguration();
- networkSession.reset(new QNetworkSession(networkConfiguration));
- if (!networkSession->isOpen()) {
- networkSession->open();
- QVERIFY(networkSession->waitForOpened(30000));
+ if (networkConfiguration.isValid()) {
+ networkSession.reset(new QNetworkSession(networkConfiguration));
+ if (!networkSession->isOpen()) {
+ networkSession->open();
+ QVERIFY(networkSession->waitForOpened(30000));
+ }
+ } else {
+ QVERIFY(!(netConfMan->capabilities() & QNetworkConfigurationManager::NetworkSessionRequired));
}
#endif
}
diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp
index 92e3a8b..109afbc 100644
--- a/tests/auto/qaccessibility/tst_qaccessibility.cpp
+++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp
@@ -238,6 +238,7 @@ private slots:
void navigateControllers();
void navigateLabels();
void text();
+ void textAttributes();
void setText();
void hideShowTest();
@@ -1563,6 +1564,60 @@ void tst_QAccessibility::text()
#endif // !QT3_SUPPORT
}
+void tst_QAccessibility::textAttributes()
+{
+ QTextEdit textEdit;
+ int startOffset;
+ int endOffset;
+ QString attributes;
+ QString text("<html><head></head><body>"
+ "Hello, <b>this</b> is an <i><b>example</b> text</i>."
+ "<span style=\"font-family: monospace\">Multiple fonts are used.</span>"
+ "Multiple <span style=\"font-size: 8pt\">text sizes</span> are used."
+ "Let's give some color to <span style=\"color:#f0f1f2; background-color:#14f01e\">Qt</span>."
+ "</body></html>");
+
+ textEdit.setText(text);
+ QAccessibleInterface *interface = QAccessible::queryAccessibleInterface(&textEdit);
+
+ QAccessibleTextInterface *textInterface=interface->textInterface();
+
+ QVERIFY(textInterface);
+ QCOMPARE(textInterface->characterCount(), 112);
+
+ attributes = textInterface->attributes(10, &startOffset, &endOffset);
+ QCOMPARE(startOffset, 7);
+ QCOMPARE(endOffset, 11);
+ attributes.prepend(';');
+ QVERIFY(attributes.contains(QLatin1String(";font-weight:bold;")));
+
+ attributes = textInterface->attributes(18, &startOffset, &endOffset);
+ QCOMPARE(startOffset, 18);
+ QCOMPARE(endOffset, 25);
+ attributes.prepend(';');
+ QVERIFY(attributes.contains(QLatin1String(";font-weight:bold;")));
+ QVERIFY(attributes.contains(QLatin1String(";font-style:italic;")));
+
+ attributes = textInterface->attributes(34, &startOffset, &endOffset);
+ QCOMPARE(startOffset, 31);
+ QCOMPARE(endOffset, 55);
+ attributes.prepend(';');
+ QVERIFY(attributes.contains(QLatin1String(";font-family:\"monospace\";")));
+
+ attributes = textInterface->attributes(65, &startOffset, &endOffset);
+ QCOMPARE(startOffset, 64);
+ QCOMPARE(endOffset, 74);
+ attributes.prepend(';');
+ QVERIFY(attributes.contains(QLatin1String(";font-size:8pt;")));
+
+ attributes = textInterface->attributes(110, &startOffset, &endOffset);
+ QCOMPARE(startOffset, 109);
+ QCOMPARE(endOffset, 111);
+ attributes.prepend(';');
+ QVERIFY(attributes.contains(QLatin1String(";background-color:rgb(20,240,30);")));
+ QVERIFY(attributes.contains(QLatin1String(";color:rgb(240,241,242);")));
+}
+
void tst_QAccessibility::setText()
{
#if !defined(QT3_SUPPORT)
@@ -2645,6 +2700,8 @@ void tst_QAccessibility::textEditTest()
{
{
QTextEdit edit;
+ int startOffset;
+ int endOffset;
QString text = "hello world\nhow are you today?\n";
edit.setText(text);
edit.show();
@@ -2654,6 +2711,12 @@ void tst_QAccessibility::textEditTest()
QCOMPARE(iface->childCount(), 6);
QCOMPARE(iface->text(QAccessible::Value, 4), QString("hello world"));
QCOMPARE(iface->text(QAccessible::Value, 5), QString("how are you today?"));
+ QCOMPARE(iface->textInterface()->textAtOffset(8, QAccessible2::WordBoundary, &startOffset, &endOffset), QString("world"));
+ QCOMPARE(startOffset, 6);
+ QCOMPARE(endOffset, 11);
+ QCOMPARE(iface->textInterface()->textAtOffset(14, QAccessible2::LineBoundary, &startOffset, &endOffset), QString("how are you today?"));
+ QCOMPARE(startOffset, 12);
+ QCOMPARE(endOffset, 30);
QCOMPARE(iface->text(QAccessible::Value, 6), QString());
QCOMPARE(iface->textInterface()->characterCount(), 31);
QFontMetrics fm(edit.font());
diff --git a/tests/auto/qcssparser/qcssparser.pro b/tests/auto/qcssparser/qcssparser.pro
index f696f19..fc3daa3 100644
--- a/tests/auto/qcssparser/qcssparser.pro
+++ b/tests/auto/qcssparser/qcssparser.pro
@@ -10,7 +10,7 @@ requires(contains(QT_CONFIG,private_tests))
wince*|symbian: {
addFiles.files = testdata
addFiles.path = .
- timesFont.files = C:/Windows/Fonts/times.ttf
+ timesFont.files = c:/windows/fonts/times.ttf
timesFont.path = .
DEPLOYMENT += addFiles timesFont
}
diff --git a/tests/auto/qdatetime/qdatetime.pro b/tests/auto/qdatetime/qdatetime.pro
index 08a321e..a3f3091 100644
--- a/tests/auto/qdatetime/qdatetime.pro
+++ b/tests/auto/qdatetime/qdatetime.pro
@@ -1,5 +1,4 @@
load(qttest_p4)
-
SOURCES += tst_qdatetime.cpp
QT = core
@@ -10,6 +9,5 @@ win32-msvc|win32-msvc9x {
QMAKE_CFLAGS_RELEASE -= -O1
QMAKE_CXXFLAGS_RELEASE -= -O1
}
-
-
CONFIG += parallel_test
+HEADERS = tst_qdatetime.loc
diff --git a/tests/auto/qdatetime/tst_qdatetime.cpp b/tests/auto/qdatetime/tst_qdatetime.cpp
index 95995e8..5462250 100644
--- a/tests/auto/qdatetime/tst_qdatetime.cpp
+++ b/tests/auto/qdatetime/tst_qdatetime.cpp
@@ -155,9 +155,16 @@ Q_DECLARE_METATYPE(QTime)
tst_QDateTime::tst_QDateTime()
{
+#ifdef Q_OS_SYMBIAN
+ // Symbian's timezone server cannot handle DST correctly for dates before year 1997
+ uint x1 = QDateTime(QDate(2000, 1, 1), QTime()).toTime_t();
+ uint x2 = QDateTime(QDate(2000, 6, 1), QTime()).toTime_t();
+ europeanTimeZone = (x1 == 946681200 && x2 == 959810400);
+#else
uint x1 = QDateTime(QDate(1990, 1, 1), QTime()).toTime_t();
uint x2 = QDateTime(QDate(1990, 6, 1), QTime()).toTime_t();
europeanTimeZone = (x1 == 631148400 && x2 == 644191200);
+#endif
}
tst_QDateTime::~tst_QDateTime()
diff --git a/tests/auto/qeventloop/tst_qeventloop.cpp b/tests/auto/qeventloop/tst_qeventloop.cpp
index b31f8cd..7a8c441 100644
--- a/tests/auto/qeventloop/tst_qeventloop.cpp
+++ b/tests/auto/qeventloop/tst_qeventloop.cpp
@@ -602,10 +602,12 @@ public slots:
QTcpSocket *serverSocket = server->nextPendingConnection();
serverSocket->write(data, size);
serverSocket->flush();
- QTest::qSleep(200); //allow the TCP/IP stack time to loopback the data, so our socket is ready to read
- QCoreApplication::processEvents(QEventLoop::ExcludeSocketNotifiers);
+ QEventLoop loop;
+ QTimer::singleShot(200, &loop, SLOT(quit())); //allow the TCP/IP stack time to loopback the data, so our socket is ready to read
+ loop.exec(QEventLoop::ExcludeSocketNotifiers);
testResult = dataArrived;
- QCoreApplication::processEvents(); //check the deferred event is processed
+ QTimer::singleShot(200, &loop, SLOT(quit()));
+ loop.exec(); //check the deferred event is processed
serverSocket->close();
QThread::currentThread()->exit(0);
}
@@ -631,6 +633,9 @@ public:
void tst_QEventLoop::processEventsExcludeSocket()
{
+#if defined(Q_WS_QWS)
+ QSKIP("Socket message seems to be leaking through QEventLoop::exec(ExcludeSocketNotifiers) on qws (QTBUG-19699)", SkipAll);
+#endif
SocketTestThread thread;
thread.start();
QVERIFY(thread.wait());
diff --git a/tests/auto/qfont/tst_qfont.cpp b/tests/auto/qfont/tst_qfont.cpp
index cfafa78..711ffc0 100644
--- a/tests/auto/qfont/tst_qfont.cpp
+++ b/tests/auto/qfont/tst_qfont.cpp
@@ -77,6 +77,7 @@ private slots:
void insertAndRemoveSubstitutions();
void serializeSpacing();
void lastResortFont();
+ void styleName();
};
// Testing get/set functions
@@ -612,5 +613,17 @@ void tst_QFont::lastResortFont()
QVERIFY(!font.lastResortFont().isEmpty());
}
+void tst_QFont::styleName()
+{
+#if !defined(Q_WS_MAC)
+ QSKIP("Only tested on Mac", SkipAll);
+#else
+ QFont font("Helvetica Neue");
+ font.setStyleName("UltraLight");
+
+ QCOMPARE(QFontInfo(font).styleName(), QString("UltraLight"));
+#endif
+}
+
QTEST_MAIN(tst_QFont)
#include "tst_qfont.moc"
diff --git a/tests/auto/qftp/tst_qftp.cpp b/tests/auto/qftp/tst_qftp.cpp
index 1fa0787..7e431cf 100644
--- a/tests/auto/qftp/tst_qftp.cpp
+++ b/tests/auto/qftp/tst_qftp.cpp
@@ -155,6 +155,7 @@ private:
QFtp *ftp;
#ifndef QT_NO_BEARERMANAGEMENT
+ QNetworkConfigurationManager *netConfMan;
QSharedPointer<QNetworkSession> networkSessionExplicit;
QSharedPointer<QNetworkSession> networkSessionImplicit;
#endif
@@ -225,10 +226,20 @@ void tst_QFtp::initTestCase_data()
void tst_QFtp::initTestCase()
{
#ifndef QT_NO_BEARERMANAGEMENT
- QNetworkConfigurationManager manager;
- networkSessionImplicit = QSharedPointer<QNetworkSession>(new QNetworkSession(manager.defaultConfiguration()));
- networkSessionImplicit->open();
- QVERIFY(networkSessionImplicit->waitForOpened(60000)); //there may be user prompt on 1st connect
+ netConfMan = new QNetworkConfigurationManager(this);
+ netConfMan->updateConfigurations();
+ connect(netConfMan, SIGNAL(updateCompleted()), &QTestEventLoop::instance(), SLOT(exitLoop()));
+ QTestEventLoop::instance().enterLoop(10);
+ QNetworkConfiguration networkConfiguration = netConfMan->defaultConfiguration();
+ if (networkConfiguration.isValid()) {
+ networkSessionImplicit = QSharedPointer<QNetworkSession>(new QNetworkSession(networkConfiguration));
+ if (!networkSessionImplicit->isOpen()) {
+ networkSessionImplicit->open();
+ QVERIFY(networkSessionImplicit->waitForOpened(30000));
+ }
+ } else {
+ QVERIFY(!(netConfMan->capabilities() & QNetworkConfigurationManager::NetworkSessionRequired));
+ }
#endif
}
@@ -254,6 +265,8 @@ void tst_QFtp::init()
}
#ifndef QT_NO_BEARERMANAGEMENT
if (setSession) {
+ if (!networkSessionImplicit)
+ QSKIP("test requires a valid default network configuration", SkipSingle);
networkSessionExplicit = networkSessionImplicit;
if (!networkSessionExplicit->isOpen()) {
networkSessionExplicit->open();
diff --git a/tests/auto/qglyphrun/tst_qglyphrun.cpp b/tests/auto/qglyphrun/tst_qglyphrun.cpp
index 3ea84e3..a18a2ac 100644
--- a/tests/auto/qglyphrun/tst_qglyphrun.cpp
+++ b/tests/auto/qglyphrun/tst_qglyphrun.cpp
@@ -72,6 +72,8 @@ private slots:
void drawUnderlinedText();
void drawRightToLeft();
void detach();
+ void setRawData();
+ void setRawDataAndGetAsVector();
private:
int m_testFontId;
@@ -284,6 +286,83 @@ void tst_QGlyphRun::drawExistingGlyphs()
QCOMPARE(textLayoutDraw, drawGlyphs);
}
+void tst_QGlyphRun::setRawData()
+{
+ QGlyphRun glyphRun;
+ glyphRun.setRawFont(QRawFont::fromFont(m_testFont));
+ glyphRun.setGlyphIndexes(QVector<quint32>() << 2 << 2 << 2);
+ glyphRun.setPositions(QVector<QPointF>() << QPointF(2, 3) << QPointF(20, 3) << QPointF(10, 20));
+
+ QPixmap baseline(100, 50);
+ baseline.fill(Qt::white);
+ {
+ QPainter p(&baseline);
+ p.drawGlyphRun(QPointF(3, 2), glyphRun);
+ }
+
+ QGlyphRun baselineCopied = glyphRun;
+
+ quint32 glyphIndexArray[3] = { 2, 2, 2 };
+ QPointF glyphPositionArray[3] = { QPointF(2, 3), QPointF(20, 3), QPointF(10, 20) };
+
+ glyphRun.setRawData(glyphIndexArray, glyphPositionArray, 3);
+
+ QPixmap rawDataGlyphs(100, 50);
+ rawDataGlyphs.fill(Qt::white);
+ {
+ QPainter p(&rawDataGlyphs);
+ p.drawGlyphRun(QPointF(3, 2), glyphRun);
+ }
+
+ quint32 otherGlyphIndexArray[1] = { 2 };
+ QPointF otherGlyphPositionArray[1] = { QPointF(2, 3) };
+
+ glyphRun.setRawData(otherGlyphIndexArray, otherGlyphPositionArray, 1);
+
+ QPixmap baselineCopiedPixmap(100, 50);
+ baselineCopiedPixmap.fill(Qt::white);
+ {
+ QPainter p(&baselineCopiedPixmap);
+ p.drawGlyphRun(QPointF(3, 2), baselineCopied);
+ }
+
+#if defined(DEBUG_SAVE_IMAGE)
+ baseline.save("setRawData_baseline.png");
+ rawDataGlyphs.save("setRawData_rawDataGlyphs.png");
+ baselineCopiedPixmap.save("setRawData_baselineCopiedPixmap.png");
+#endif
+
+ QCOMPARE(rawDataGlyphs, baseline);
+ QCOMPARE(baselineCopiedPixmap, baseline);
+}
+
+void tst_QGlyphRun::setRawDataAndGetAsVector()
+{
+ QVector<quint32> glyphIndexArray;
+ glyphIndexArray << 3 << 2 << 1 << 4;
+
+ QVector<QPointF> glyphPositionArray;
+ glyphPositionArray << QPointF(1, 2) << QPointF(3, 4) << QPointF(5, 6) << QPointF(7, 8);
+
+ QGlyphRun glyphRun;
+ glyphRun.setRawData(glyphIndexArray.constData(), glyphPositionArray.constData(), 4);
+
+ QVector<quint32> glyphIndexes = glyphRun.glyphIndexes();
+ QVector<QPointF> glyphPositions = glyphRun.positions();
+
+ QCOMPARE(glyphIndexes.size(), 4);
+ QCOMPARE(glyphPositions.size(), 4);
+
+ QCOMPARE(glyphIndexes, glyphIndexArray);
+ QCOMPARE(glyphPositions, glyphPositionArray);
+
+ QGlyphRun otherGlyphRun;
+ otherGlyphRun.setGlyphIndexes(glyphIndexArray);
+ otherGlyphRun.setPositions(glyphPositionArray);
+
+ QCOMPARE(glyphRun, otherGlyphRun);
+}
+
void tst_QGlyphRun::drawNonExistentGlyphs()
{
QVector<quint32> glyphIndexes;
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index 9b7b228..3665b10 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -6413,6 +6413,7 @@ void tst_QGraphicsItem::boundingRegion_data()
QTest::newRow("(0, 0, 10, 10) | 0.0 | identity | {(0, 0, 10, 10)}") << QLineF(0, 0, 10, 10) << qreal(0.0) << QTransform()
<< QRegion(QRect(0, 0, 10, 10));
+#if 0
{
QRegion r;
r += QRect(0, 0, 6, 2);
@@ -6430,6 +6431,7 @@ void tst_QGraphicsItem::boundingRegion_data()
r += QRect(6, 9, 4, 1);
QTest::newRow("(0, 0, 10, 10) | 1.0 | identity | {(0, 0, 10, 10)}") << QLineF(0, 0, 10, 10) << qreal(1.0) << QTransform() << r;
}
+#endif
QTest::newRow("(0, 0, 10, 0) | 0.0 | identity | {(0, 0, 10, 10)}") << QLineF(0, 0, 10, 0) << qreal(0.0) << QTransform()
<< QRegion(QRect(0, 0, 10, 1));
QTest::newRow("(0, 0, 10, 0) | 0.5 | identity | {(0, 0, 10, 1)}") << QLineF(0, 0, 10, 0) << qreal(0.5) << QTransform()
@@ -8029,7 +8031,16 @@ void tst_QGraphicsItem::sorting()
QGraphicsView view(&scene);
view.setResizeAnchor(QGraphicsView::NoAnchor);
view.setTransformationAnchor(QGraphicsView::NoAnchor);
+#ifdef Q_OS_SYMBIAN
+ // Adjust area in devices where scrollbars are thicker than 25 pixels as they will
+ // obstruct painting otherwise.
+ int scrollWidth = qMax(25, view.verticalScrollBar()->width());
+ int scrollHeight = qMax(25, view.horizontalScrollBar()->height());
+
+ view.resize(95 + scrollWidth, 75 + scrollHeight);
+#else
view.resize(120, 100);
+#endif
view.setFrameStyle(0);
view.show();
#ifdef Q_WS_X11
diff --git a/tests/auto/qheaderview/tst_qheaderview.cpp b/tests/auto/qheaderview/tst_qheaderview.cpp
index c4d5272..a6ffea3 100644
--- a/tests/auto/qheaderview/tst_qheaderview.cpp
+++ b/tests/auto/qheaderview/tst_qheaderview.cpp
@@ -565,7 +565,7 @@ void tst_QHeaderView::sectionSize()
QFETCH(int, lastVisibleSectionSize);
QFETCH(int, persistentSectionSize);
-#ifdef Q_OS_WINCE
+#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
// We test on a device with doubled pixels. Therefore we need to specify
// different boundaries.
initialDefaultSize = qMax(view->minimumSectionSize(), 30);
@@ -678,6 +678,16 @@ void tst_QHeaderView::visualIndexAt()
QFETCH(QList<int>, coordinate);
QFETCH(QList<int>, visual);
+#ifdef Q_OS_SYMBIAN
+ // Some Symbian devices have larger minimum section size than what is expected.
+ // Need to do this here instead of visualIndexAt_data() as view pointer doesn't
+ // seem to be valid there.
+ int minSize = view->minimumSectionSize();
+ if (minSize > 30) {
+ coordinate.clear();
+ coordinate << -1 << 0 << minSize + 1 << (minSize * 3) + 1 << 99999;
+ }
+#endif
view->setStretchLastSection(true);
topLevel->show();
diff --git a/tests/auto/qhostinfo/tst_qhostinfo.cpp b/tests/auto/qhostinfo/tst_qhostinfo.cpp
index c528a5c..2fa5e76 100644
--- a/tests/auto/qhostinfo/tst_qhostinfo.cpp
+++ b/tests/auto/qhostinfo/tst_qhostinfo.cpp
@@ -197,13 +197,19 @@ tst_QHostInfo::~tst_QHostInfo()
void tst_QHostInfo::initTestCase()
{
#ifndef QT_NO_BEARERMANAGEMENT
- //start the default network
netConfMan = new QNetworkConfigurationManager(this);
+ netConfMan->updateConfigurations();
+ connect(netConfMan, SIGNAL(updateCompleted()), &QTestEventLoop::instance(), SLOT(exitLoop()));
+ QTestEventLoop::instance().enterLoop(10);
networkConfiguration = netConfMan->defaultConfiguration();
- networkSession.reset(new QNetworkSession(networkConfiguration));
- if (!networkSession->isOpen()) {
- networkSession->open();
- QVERIFY(networkSession->waitForOpened(30000));
+ if (networkConfiguration.isValid()) {
+ networkSession.reset(new QNetworkSession(networkConfiguration));
+ if (!networkSession->isOpen()) {
+ networkSession->open();
+ QVERIFY(networkSession->waitForOpened(30000));
+ }
+ } else {
+ QVERIFY(!(netConfMan->capabilities() & QNetworkConfigurationManager::NetworkSessionRequired));
}
#endif
@@ -213,6 +219,13 @@ void tst_QHostInfo::initTestCase()
#else
ipv6Available = false;
ipv6LookupsAvailable = false;
+
+ QTcpServer server;
+ if (server.listen(QHostAddress("::1"))) {
+ // We have IPv6 support
+ ipv6Available = true;
+ }
+
#if !defined(QT_NO_GETADDRINFO)
// check if the system getaddrinfo can do IPv6 lookups
struct addrinfo hint, *result = 0;
@@ -235,13 +248,6 @@ void tst_QHostInfo::initTestCase()
#endif
#endif
- QTcpServer server;
- if (server.listen(QHostAddress("::1"))) {
- // We have IPv6 support
- ipv6Available = true;
- }
-
-
// run each testcase with and without test enabled
QTest::addColumn<bool>("cache");
QTest::newRow("WithCache") << true;
diff --git a/tests/auto/qmenubar/tst_qmenubar.cpp b/tests/auto/qmenubar/tst_qmenubar.cpp
index 72048d9..d548a51 100644
--- a/tests/auto/qmenubar/tst_qmenubar.cpp
+++ b/tests/auto/qmenubar/tst_qmenubar.cpp
@@ -515,6 +515,10 @@ void tst_QMenuBar::activatedCount_noQt3()
#if defined(Q_WS_MAC) || defined(Q_OS_WINCE_WM)
QSKIP("On Mac/WinCE, native key events are needed to test menu action activation", SkipAll);
#endif
+#ifdef Q_OS_SYMBIAN
+ QSKIP("On Symbian OS, native key events are needed to test menu action activation", SkipAll);
+#endif
+
// create a popup menu with menu items set the accelerators later...
initSimpleMenubar_noQt3();
@@ -1573,6 +1577,12 @@ void tst_QMenuBar::task256322_highlight()
file2->setText("file2");
QAction *nothing = win.menuBar()->addAction("nothing");
+#ifdef Q_WS_S60
+ // Set minimum width to ensure that menu items are not added to the menu extension.
+ // Minimum width 360 is the minimal screen width in any supported Symbian device.
+ win.menuBar()->setMinimumWidth(360);
+#endif
+
win.show();
QTest::qWait(200);
diff --git a/tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp b/tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp
index d29ef77..57bf583 100644
--- a/tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp
+++ b/tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp
@@ -62,7 +62,6 @@ public slots:
void cleanup();
private slots:
- void usedInThread(); // this test must be first, or it will falsely pass
void allConfigurations();
void defaultConfiguration();
void configurationFromIdentifier();
@@ -330,49 +329,6 @@ void tst_QNetworkConfigurationManager::configurationFromIdentifier()
QVERIFY(!invalid.isValid());
}
-class QNCMTestThread : public QThread
-{
-protected:
- virtual void run()
- {
- QNetworkConfigurationManager manager;
- preScanConfigs = manager.allConfigurations();
- QSignalSpy spy(&manager, SIGNAL(updateCompleted()));
- manager.updateConfigurations(); //initiate scans
- QTRY_VERIFY(spy.count() == 1); //wait for scan to complete
- configs = manager.allConfigurations();
- }
-public:
- QList<QNetworkConfiguration> configs;
- QList<QNetworkConfiguration> preScanConfigs;
-};
-
-// regression test for QTBUG-18795
-void tst_QNetworkConfigurationManager::usedInThread()
-{
-#if defined Q_OS_MAC && !defined (QT_NO_COREWLAN)
- QSKIP("QTBUG-19070 Mac CoreWlan plugin is broken", SkipAll);
-#else
- QNCMTestThread thread;
- connect(&thread, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
- thread.start();
- QTestEventLoop::instance().enterLoop(100); //QTRY_VERIFY could take ~90 seconds to time out in the thread
- QVERIFY(!QTestEventLoop::instance().timeout());
- qDebug() << "prescan:" << thread.preScanConfigs.count();
- qDebug() << "postscan:" << thread.configs.count();
-
- QNetworkConfigurationManager manager;
- QList<QNetworkConfiguration> preScanConfigs = manager.allConfigurations();
- QSignalSpy spy(&manager, SIGNAL(updateCompleted()));
- manager.updateConfigurations(); //initiate scans
- QTRY_VERIFY(spy.count() == 1); //wait for scan to complete
- QList<QNetworkConfiguration> configs = manager.allConfigurations();
- QCOMPARE(thread.configs, configs);
- //Don't compare pre scan configs, because these may be cached and therefore give different results
- //which makes the test unstable. The post scan results should have all configurations every time
- //QCOMPARE(thread.preScanConfigs, preScanConfigs);
-#endif
-}
QTEST_MAIN(tst_QNetworkConfigurationManager)
#include "tst_qnetworkconfigurationmanager.moc"
diff --git a/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp b/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp
index d59a510..1b4256b 100644
--- a/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp
+++ b/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp
@@ -42,7 +42,7 @@
#include <QtTest/QtTest>
#include <QtNetwork/QNetworkCookieJar>
-#include "private/qnetworkcookiejar_p.h"
+#include "private/qtldurl_p.h"
class tst_QNetworkCookieJar: public QObject
{
@@ -438,7 +438,7 @@ void tst_QNetworkCookieJar::effectiveTLDs()
#endif
QFETCH(QString, domain);
QFETCH(bool, isTLD);
- QCOMPARE(QNetworkCookieJarPrivate::isEffectiveTLD(domain), isTLD);
+ QCOMPARE(qIsEffectiveTLD(domain), isTLD);
}
QTEST_MAIN(tst_QNetworkCookieJar)
diff --git a/tests/auto/qnetworkinterface/tst_qnetworkinterface.cpp b/tests/auto/qnetworkinterface/tst_qnetworkinterface.cpp
index ae3436d..2077717 100644
--- a/tests/auto/qnetworkinterface/tst_qnetworkinterface.cpp
+++ b/tests/auto/qnetworkinterface/tst_qnetworkinterface.cpp
@@ -89,11 +89,18 @@ void tst_QNetworkInterface::initTestCase()
{
#ifndef QT_NO_BEARERMANAGEMENT
netConfMan = new QNetworkConfigurationManager(this);
+ netConfMan->updateConfigurations();
+ connect(netConfMan, SIGNAL(updateCompleted()), &QTestEventLoop::instance(), SLOT(exitLoop()));
+ QTestEventLoop::instance().enterLoop(10);
networkConfiguration = netConfMan->defaultConfiguration();
- networkSession.reset(new QNetworkSession(networkConfiguration));
- if (!networkSession->isOpen()) {
- networkSession->open();
- QVERIFY(networkSession->waitForOpened(30000));
+ if (networkConfiguration.isValid()) {
+ networkSession.reset(new QNetworkSession(networkConfiguration));
+ if (!networkSession->isOpen()) {
+ networkSession->open();
+ QVERIFY(networkSession->waitForOpened(30000));
+ }
+ } else {
+ QVERIFY(!(netConfMan->capabilities() & QNetworkConfigurationManager::NetworkSessionRequired));
}
#endif
}
diff --git a/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp b/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp
index 136d4d8..45464ca 100644
--- a/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp
+++ b/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp
@@ -41,12 +41,10 @@
#include <QtTest/QTest>
-#include <QtTest/QTestEventLoop>
#include <qcoreapplication.h>
#include <qdebug.h>
#include <qnetworkproxy.h>
-#include <QThread>
#include <QNetworkConfiguration>
#include <QNetworkConfigurationManager>
#include <QNetworkSession>
@@ -78,7 +76,6 @@ public:
};
private slots:
- void systemProxyForQueryCalledFromThread();
void systemProxyForQuery() const;
#ifndef QT_NO_BEARERMANAGEMENT
void fromConfigurations();
@@ -138,32 +135,6 @@ void tst_QNetworkProxyFactory::systemProxyForQuery() const
QFAIL("One or more system proxy lookup failures occurred.");
}
-class QSPFQThread : public QThread
-{
-protected:
- virtual void run()
- {
- proxies = QNetworkProxyFactory::systemProxyForQuery(query);
- }
-public:
- QNetworkProxyQuery query;
- QList<QNetworkProxy> proxies;
-};
-
-//regression test for QTBUG-18799
-void tst_QNetworkProxyFactory::systemProxyForQueryCalledFromThread()
-{
- QUrl url(QLatin1String("http://qt.nokia.com"));
- QNetworkProxyQuery query(url);
- QSPFQThread thread;
- thread.query = query;
- connect(&thread, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
- thread.start();
- QTestEventLoop::instance().enterLoop(5);
- QVERIFY(thread.isFinished());
- QCOMPARE(thread.proxies, QNetworkProxyFactory::systemProxyForQuery(query));
-}
-
#ifndef QT_NO_BEARERMANAGEMENT
//Purpose of this test is just to check systemProxyForQuery doesn't hang or crash
diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
index c70075f..25925bd 100644
--- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
@@ -219,6 +219,8 @@ private Q_SLOTS:
void putGetDeleteGetFromHttp();
void sendCustomRequestToHttp_data();
void sendCustomRequestToHttp();
+ void connectToIPv6Address_data();
+ void connectToIPv6Address();
void ioGetFromData_data();
void ioGetFromData();
@@ -447,14 +449,19 @@ public:
QSemaphore ready;
bool doClose;
bool doSsl;
+ bool ipv6;
bool multiple;
int totalConnections;
- MiniHttpServer(const QByteArray &data, bool ssl = false, QThread *thread = 0)
- : client(0), dataToTransmit(data), doClose(true), doSsl(ssl),
+ MiniHttpServer(const QByteArray &data, bool ssl = false, QThread *thread = 0, bool useipv6 = false)
+ : client(0), dataToTransmit(data), doClose(true), doSsl(ssl), ipv6(useipv6),
multiple(false), totalConnections(0)
{
- listen();
+ if(useipv6) {
+ listen(QHostAddress::AnyIPv6);
+ } else {
+ listen();
+ }
if (thread) {
connect(thread, SIGNAL(started()), this, SLOT(threadStartedSlot()));
moveToThread(thread);
@@ -466,7 +473,7 @@ public:
protected:
void incomingConnection(int socketDescriptor)
{
- //qDebug() << "incomingConnection" << socketDescriptor;
+ //qDebug() << "incomingConnection" << socketDescriptor << "doSsl:" << doSsl << "ipv6:" << ipv6;
if (!doSsl) {
client = new QTcpSocket;
client->setSocketDescriptor(socketDescriptor);
@@ -1283,11 +1290,18 @@ void tst_QNetworkReply::initTestCase()
#endif
#ifndef QT_NO_BEARERMANAGEMENT
netConfMan = new QNetworkConfigurationManager(this);
+ netConfMan->updateConfigurations();
+ connect(netConfMan, SIGNAL(updateCompleted()), &QTestEventLoop::instance(), SLOT(exitLoop()));
+ QTestEventLoop::instance().enterLoop(10);
networkConfiguration = netConfMan->defaultConfiguration();
- networkSession.reset(new QNetworkSession(networkConfiguration));
- if (!networkSession->isOpen()) {
- networkSession->open();
- QVERIFY(networkSession->waitForOpened(30000));
+ if (networkConfiguration.isValid()) {
+ networkSession.reset(new QNetworkSession(networkConfiguration));
+ if (!networkSession->isOpen()) {
+ networkSession->open();
+ QVERIFY(networkSession->waitForOpened(30000));
+ }
+ } else {
+ QVERIFY(!(netConfMan->capabilities() & QNetworkConfigurationManager::NetworkSessionRequired));
}
#endif
}
@@ -2326,6 +2340,49 @@ void tst_QNetworkReply::putGetDeleteGetFromHttp()
}
+void tst_QNetworkReply::connectToIPv6Address_data()
+{
+ QTest::addColumn<QUrl>("url");
+ QTest::addColumn<QNetworkReply::NetworkError>("error");
+ QTest::addColumn<QByteArray>("dataToSend");
+ QTest::addColumn<QByteArray>("hostfield");
+ QTest::newRow("localhost") << QUrl(QByteArray("http://[::1]")) << QNetworkReply::NoError<< QByteArray("localhost") << QByteArray("[::1]");
+ //QTest::newRow("ipv4localhost") << QUrl(QByteArray("http://127.0.0.1")) << QNetworkReply::NoError<< QByteArray("ipv4localhost") << QByteArray("127.0.0.1");
+ //to add more test data here
+}
+
+void tst_QNetworkReply::connectToIPv6Address()
+{
+ QFETCH(QUrl, url);
+ QFETCH(QNetworkReply::NetworkError, error);
+ QFETCH(QByteArray, dataToSend);
+ QFETCH(QByteArray, hostfield);
+
+ QByteArray httpResponse = QByteArray("HTTP/1.0 200 OK\r\nContent-Length: ");
+ httpResponse += QByteArray::number(dataToSend.size());
+ httpResponse += "\r\n\r\n";
+ httpResponse += dataToSend;
+
+ MiniHttpServer server(httpResponse, false, NULL/*thread*/, true/*useipv6*/);
+ server.doClose = true;
+
+ url.setPort(server.serverPort());
+ QNetworkRequest request(url);
+
+ QNetworkReplyPtr reply = manager.get(request);
+ connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
+ QTestEventLoop::instance().enterLoop(10);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+ QByteArray content = reply->readAll();
+ //qDebug() << server.receivedData;
+ QByteArray hostinfo = "\r\nHost: " + hostfield + ":" + QByteArray::number(server.serverPort()) + "\r\n";
+ QSKIP("Fix this -- Host Info verification failed on Windows XP", SkipAll);
+ QVERIFY(server.receivedData.contains(hostinfo));
+ QVERIFY(content == dataToSend);
+ QCOMPARE(reply->url(), request.url());
+ QVERIFY(reply->error() == error);
+}
+
void tst_QNetworkReply::sendCustomRequestToHttp_data()
{
QTest::addColumn<QUrl>("url");
diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp
index 501074f..948d14a 100644
--- a/tests/auto/qpainter/tst_qpainter.cpp
+++ b/tests/auto/qpainter/tst_qpainter.cpp
@@ -1315,7 +1315,7 @@ void tst_QPainter::drawRect2()
p.end();
QRect stroke = getPaintedSize(image, Qt::white);
- QCOMPARE(stroke, fill.adjusted(0, 0, 1, 1));
+ QCOMPARE(stroke.adjusted(1, 1, 0, 0), fill.adjusted(0, 0, 1, 1));
}
}
@@ -1412,13 +1412,13 @@ void tst_QPainter::drawPath_data()
{
QPainterPath p;
p.addRect(2.25, 2.25, 10, 10);
- QTest::newRow("non-aligned rect") << p << QRect(2, 2, 10, 10) << 10 * 10;
+ QTest::newRow("non-aligned rect") << p << QRect(3, 3, 10, 10) << 10 * 10;
}
{
QPainterPath p;
p.addRect(2.25, 2.25, 10.5, 10.5);
- QTest::newRow("non-aligned rect 2") << p << QRect(2, 2, 11, 11) << 11 * 11;
+ QTest::newRow("non-aligned rect 2") << p << QRect(3, 3, 10, 10) << 10 * 10;
}
{
diff --git a/tests/auto/qscriptextensionplugin/staticplugin/staticplugin.pro b/tests/auto/qscriptextensionplugin/staticplugin/staticplugin.pro
index a003338..65c4e8f 100644
--- a/tests/auto/qscriptextensionplugin/staticplugin/staticplugin.pro
+++ b/tests/auto/qscriptextensionplugin/staticplugin/staticplugin.pro
@@ -1,5 +1,6 @@
TEMPLATE = lib
CONFIG += static plugin
+CONFIG -= create_prl # not needed, and complicates debug/release
SOURCES = staticplugin.cpp
RESOURCES = staticplugin.qrc
QT = core script
diff --git a/tests/auto/qsslcertificate/certificates/cert-ss-san-utf8.pem b/tests/auto/qsslcertificate/certificates/cert-ss-san-utf8.pem
new file mode 100644
index 0000000..e1b731d
--- /dev/null
+++ b/tests/auto/qsslcertificate/certificates/cert-ss-san-utf8.pem
@@ -0,0 +1,16 @@
+-----BEGIN CERTIFICATE-----
+MIICkTCCAfqgAwIBAgIJAL1nF+PLAF2KMA0GCSqGSIb3DQEBBQUAMGkxKzApBgNV
+BAoMIkjElcSCxrLDvyDKjeG6v8qI4bq34bi7IFLDqWPDtnJkxZ0xFTATBgNVBAsM
+DOOIp0HjiYHvvatCQzEWMBQGA1UEAwwNSm9obm55IEd1aXRhcjELMAkGA1UEBhMC
+Tk8wHhcNMTEwNTA1MDgxMzEwWhcNMTEwNjA0MDgxMzEwWjBpMSswKQYDVQQKDCJI
+xJXEgsayw78gyo3hur/KiOG6t+G4uyBSw6ljw7ZyZMWdMRUwEwYDVQQLDAzjiKdB
+44mB772rQkMxFjAUBgNVBAMMDUpvaG5ueSBHdWl0YXIxCzAJBgNVBAYTAk5PMIGf
+MA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC2zSxS17I6596dJE/VAmGz+06D9S8n
+3C0hnIGNVu+LwbgDJTvOw0SzNj4UP72UGgd3UI1KLBg5XWIsRNmE3COJMMh6syjI
+L1Ept+tVXxGL6n4gl+0nZ7dkUyxJmeFtigYrL+qCH1yd5rmf3sC3jO4IosuAiG66
+IDkJEVo64NT8ZQIDAQABo0EwPzA9BgNVHREENjA0gQ9hcm5lQGZvb2Jhci5vcmeC
+Dnd3dy5mb29iYXIub3JngRFiamFybmVAZm9vYmFyLm9yZzANBgkqhkiG9w0BAQUF
+AAOBgQAqVhbC0/EUFdnKlYV3PrknwGX1dPEPGJuIQHa0KpoicvNiOhs1HxBDYbzc
+F6wcAMEynq4YwGKhcQLZOs2mo0LreAjA9rU/yBnqrnUW/4gxtUUvmJKK+62IjfLp
+eO1L+1NcEMJiaZf8fip4VXhXdOYUhgE8WUZ1UJRC6w3T/yAgcQ==
+-----END CERTIFICATE-----
diff --git a/tests/auto/qsslcertificate/certificates/cert-ss-san-utf8.pem.san b/tests/auto/qsslcertificate/certificates/cert-ss-san-utf8.pem.san
new file mode 100644
index 0000000..f46a637
--- /dev/null
+++ b/tests/auto/qsslcertificate/certificates/cert-ss-san-utf8.pem.san
@@ -0,0 +1,5 @@
+[subj_alt_name]
+subjectAltName=\
+ email:arne@foobar.org,\
+ DNS:www.foobar.org,\
+ email:bjarne@foobar.org
diff --git a/tests/auto/qsslcertificate/certificates/gencertificates.sh b/tests/auto/qsslcertificate/certificates/gencertificates.sh
index 9f873d9..0bac191 100755
--- a/tests/auto/qsslcertificate/certificates/gencertificates.sh
+++ b/tests/auto/qsslcertificate/certificates/gencertificates.sh
@@ -90,5 +90,15 @@ openssl req -x509 -in req-san.pem -out $outname -key rsa-pri-1024.pem \
-config san.cnf -extensions subj_alt_name
/bin/cp san.cnf $outname.san
+#--- Non-ASCII Subject ---------------------------------------------------------------------
+echo -e "\n generating self signed root cert. with Subject containing UTF-8 characters ..."
+outname=cert-ss-san-utf8.pem
+#subject="/O=HĕĂƲÿ ʍếʈặḻ Récördŝ/OU=㈧A㉁ォBC/CN=Johnny Guitar/C=NO"
+subject=$'/O=H\xc4\x95\xc4\x82\xc6\xb2\xc3\xbf \xca\x8d\xe1\xba\xbf\xca\x88\xe1\xba\xb7\xe1\xb8\xbb R\xc3\xa9c\xc3\xb6rd\xc5\x9d/OU=\xe3\x88\xa7A\xe3\x89\x81\xef\xbd\xabBC/CN=Johnny Guitar/C=NO'
+openssl req -out req-san.pem -new -key rsa-pri-1024.pem -utf8 -subj "$subject"
+openssl req -x509 -in req-san.pem -out $outname -key rsa-pri-1024.pem \
+ -config san.cnf -extensions subj_alt_name -nameopt multiline,utf8,-esc_msb
+/bin/cp san.cnf $outname.san
+
echo -e "\n cleaning up ..."
/bin/rm rsa-pri-1024.pem rsa-pub-1024.* req*.pem
diff --git a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp
index c38147d..9276685 100644
--- a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp
+++ b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp
@@ -96,6 +96,7 @@ private slots:
void digest_data();
void digest();
void alternateSubjectNames_data();
+ void utf8SubjectNames();
void alternateSubjectNames();
void publicKey_data();
void publicKey();
@@ -407,6 +408,27 @@ void tst_QSslCertificate::alternateSubjectNames()
}
}
+void tst_QSslCertificate::utf8SubjectNames()
+{
+ QSslCertificate cert = QSslCertificate::fromPath("certificates/cert-ss-san-utf8.pem", QSsl::Pem,
+ QRegExp::FixedString).first();
+ QVERIFY(!cert.isNull());
+
+ // O is "Heavy Metal Records" with heavy use of "decorations" like accents, umlauts etc.,
+ // OU uses arabian / asian script letters near codepoint 64K.
+ // strings split where the compiler would otherwise find three-digit hex numbers
+ static const char *o = "H\xc4\x95\xc4\x82\xc6\xb2\xc3\xbf \xca\x8d\xe1\xba\xbf\xca\x88\xe1\xba"
+ "\xb7\xe1\xb8\xbb R\xc3\xa9" "c" "\xc3\xb6rd\xc5\x9d";
+ static const char *ou = "\xe3\x88\xa7" "A" "\xe3\x89\x81\xef\xbd\xab" "BC";
+
+ // the following two tests should help find "\x"-literal encoding bugs in the test itself
+ QCOMPARE(cert.subjectInfo("O").length(), QString::fromUtf8(o).length());
+ QCOMPARE (cert.subjectInfo("O").toUtf8().toHex(), QByteArray(o).toHex());
+
+ QCOMPARE(cert.subjectInfo("O"), QString::fromUtf8(o));
+ QCOMPARE(cert.subjectInfo("OU"), QString::fromUtf8(ou));
+}
+
void tst_QSslCertificate::publicKey_data()
{
QTest::addColumn<QString>("certFilePath");
@@ -519,13 +541,13 @@ void tst_QSslCertificate::fromPath_data()
QTest::newRow("\"certificates/*\" fixed der") << QString("certificates/*") << int(QRegExp::FixedString) << false << 0;
QTest::newRow("\"certificates/*\" regexp pem") << QString("certificates/*") << int(QRegExp::RegExp) << true << 0;
QTest::newRow("\"certificates/*\" regexp der") << QString("certificates/*") << int(QRegExp::RegExp) << false << 0;
- QTest::newRow("\"certificates/*\" wildcard pem") << QString("certificates/*") << int(QRegExp::Wildcard) << true << 4;
+ QTest::newRow("\"certificates/*\" wildcard pem") << QString("certificates/*") << int(QRegExp::Wildcard) << true << 5;
QTest::newRow("\"certificates/*\" wildcard der") << QString("certificates/*") << int(QRegExp::Wildcard) << false << 0;
QTest::newRow("\"c*/c*.pem\" fixed pem") << QString("c*/c*.pem") << int(QRegExp::FixedString) << true << 0;
QTest::newRow("\"c*/c*.pem\" fixed der") << QString("c*/c*.pem") << int(QRegExp::FixedString) << false << 0;
QTest::newRow("\"c*/c*.pem\" regexp pem") << QString("c*/c*.pem") << int(QRegExp::RegExp) << true << 0;
QTest::newRow("\"c*/c*.pem\" regexp der") << QString("c*/c*.pem") << int(QRegExp::RegExp) << false << 0;
- QTest::newRow("\"c*/c*.pem\" wildcard pem") << QString("c*/c*.pem") << int(QRegExp::Wildcard) << true << 4;
+ QTest::newRow("\"c*/c*.pem\" wildcard pem") << QString("c*/c*.pem") << int(QRegExp::Wildcard) << true << 5;
QTest::newRow("\"c*/c*.pem\" wildcard der") << QString("c*/c*.pem") << int(QRegExp::Wildcard) << false << 0;
QTest::newRow("\"d*/c*.pem\" fixed pem") << QString("d*/c*.pem") << int(QRegExp::FixedString) << true << 0;
QTest::newRow("\"d*/c*.pem\" fixed der") << QString("d*/c*.pem") << int(QRegExp::FixedString) << false << 0;
@@ -535,7 +557,7 @@ void tst_QSslCertificate::fromPath_data()
QTest::newRow("\"d*/c*.pem\" wildcard der") << QString("d*/c*.pem") << int(QRegExp::Wildcard) << false << 0;
QTest::newRow("\"c.*/c.*.pem\" fixed pem") << QString("c.*/c.*.pem") << int(QRegExp::FixedString) << true << 0;
QTest::newRow("\"c.*/c.*.pem\" fixed der") << QString("c.*/c.*.pem") << int(QRegExp::FixedString) << false << 0;
- QTest::newRow("\"c.*/c.*.pem\" regexp pem") << QString("c.*/c.*.pem") << int(QRegExp::RegExp) << true << 4;
+ QTest::newRow("\"c.*/c.*.pem\" regexp pem") << QString("c.*/c.*.pem") << int(QRegExp::RegExp) << true << 5;
QTest::newRow("\"c.*/c.*.pem\" regexp der") << QString("c.*/c.*.pem") << int(QRegExp::RegExp) << false << 0;
QTest::newRow("\"c.*/c.*.pem\" wildcard pem") << QString("c.*/c.*.pem") << int(QRegExp::Wildcard) << true << 0;
QTest::newRow("\"c.*/c.*.pem\" wildcard der") << QString("c.*/c.*.pem") << int(QRegExp::Wildcard) << false << 0;
@@ -546,7 +568,7 @@ void tst_QSslCertificate::fromPath_data()
QTest::newRow("\"d.*/c.*.pem\" wildcard pem") << QString("d.*/c.*.pem") << int(QRegExp::Wildcard) << true << 0;
QTest::newRow("\"d.*/c.*.pem\" wildcard der") << QString("d.*/c.*.pem") << int(QRegExp::Wildcard) << false << 0;
#ifdef Q_OS_LINUX
- QTest::newRow("absolute path wildcard pem") << QString(QDir::currentPath() + "/certificates/*.pem") << int(QRegExp::Wildcard) << true << 4;
+ QTest::newRow("absolute path wildcard pem") << QString(QDir::currentPath() + "/certificates/*.pem") << int(QRegExp::Wildcard) << true << 5;
#endif
QTest::newRow("trailing-whitespace") << QString("more-certificates/trailing-whitespace.pem") << int(QRegExp::FixedString) << true << 1;
@@ -769,7 +791,7 @@ void tst_QSslCertificate::nulInCN()
QString cn = cert.subjectInfo(QSslCertificate::CommonName);
QVERIFY(cn != "www.bank.com");
- static const char realCN[] = "www.bank.com\\x00.badguy.com";
+ static const char realCN[] = "www.bank.com\0.badguy.com";
QCOMPARE(cn, QString::fromLatin1(realCN, sizeof realCN - 1));
}
diff --git a/tests/auto/qstatictext/tst_qstatictext.cpp b/tests/auto/qstatictext/tst_qstatictext.cpp
index 29845d9..e14c9db 100644
--- a/tests/auto/qstatictext/tst_qstatictext.cpp
+++ b/tests/auto/qstatictext/tst_qstatictext.cpp
@@ -361,7 +361,7 @@ bool tst_QStaticText::supportsTransformations() const
QPaintEngine::Type type = engine->type();
if (type == QPaintEngine::OpenGL
-#if !defined(Q_WS_WIN) && !defined(Q_WS_X11)
+#if !defined(Q_WS_WIN) && !defined(Q_WS_X11) && !defined(Q_WS_MAC)
|| type == QPaintEngine::Raster
#endif
)
@@ -601,7 +601,7 @@ void tst_QStaticText::setPenPlainText()
QStaticText staticText("XXXXX");
staticText.setTextFormat(Qt::PlainText);
- p.drawStaticText(0, fm.ascent(), staticText);
+ p.drawStaticText(0, 0, staticText);
}
QImage img = image.toImage();
diff --git a/tests/auto/qstring/tst_qstring.cpp b/tests/auto/qstring/tst_qstring.cpp
index 11fd986..c19b168 100644
--- a/tests/auto/qstring/tst_qstring.cpp
+++ b/tests/auto/qstring/tst_qstring.cpp
@@ -4334,7 +4334,7 @@ void tst_QString::localeAwareCompare_data()
void tst_QString::localeAwareCompare()
{
#ifdef Q_OS_SYMBIAN
- QSKIP("QTBUG-16921: There is no way to set up the system locale, so this test is not reliable in Symbian.");
+ QSKIP("QTBUG-16921: There is no way to set up the system locale, so this test is not reliable in Symbian.", SkipSingle);
#else
#ifdef Q_OS_WIN
# ifndef Q_OS_WINCE
diff --git a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp
index 1799019..a4fc1a9 100644
--- a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp
+++ b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp
@@ -1608,7 +1608,12 @@ class ChangeEventWidget : public QWidget
static bool recurse = false;
if (!recurse) {
recurse = true;
+
+#ifdef Q_OS_SYMBIAN
+ QStyle *style = new QWindowsStyle();
+#else
QStyle *style = new QMotifStyle;
+#endif
style->setParent(this);
setStyle(style);
recurse = false;
diff --git a/tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp b/tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp
index 22a90cf..f4249ab 100644
--- a/tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp
+++ b/tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp
@@ -146,6 +146,15 @@ void tst_QtConcurrentMap::map()
QCOMPARE(numberList, QList<Number>() << 2 << 4 << 6);
QtConcurrent::map(numberList.begin(), numberList.end(), &Number::multiplyBy2).waitForFinished();
QCOMPARE(numberList, QList<Number>() << 4 << 8 << 12);
+
+#ifdef Q_COMPILER_LAMBDA
+ // lambda
+ QtConcurrent::map(list, [](int &x){x *= 2;}).waitForFinished();
+ QCOMPARE(list, QList<int>() << 128 << 256 << 384);
+ QtConcurrent::map(list.begin(), list.end(), [](int &x){x *= 2;}).waitForFinished();
+ QCOMPARE(list, QList<int>() << 256 << 512 << 768);
+#endif
+
}
// functors don't take arguments by reference, making these no-ops
@@ -170,6 +179,14 @@ void tst_QtConcurrentMap::map()
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
QtConcurrent::map(list.begin(), list.end(), multiplyBy2Immutable).waitForFinished();
QCOMPARE(list, QList<int>() << 1 << 2 << 3);
+
+#ifdef Q_COMPILER_LAMBDA
+ // lambda
+ QtConcurrent::map(list, [](int x){x *= 2;}).waitForFinished();
+ QCOMPARE(list, QList<int>() << 1 << 2 << 3);
+ QtConcurrent::map(list.begin(), list.end(), [](int x){x *= 2;}).waitForFinished();
+ QCOMPARE(list, QList<int>() << 1 << 2 << 3);
+#endif
}
// Linked lists and forward iterators
@@ -2303,6 +2320,10 @@ void tst_QtConcurrentMap::stlContainers()
{
#ifdef QT_NO_STL
QSKIP("Qt compiled without STL support", SkipAll);
+#elif defined(Q_COMPILER_RVALUE_REFS)
+ //mapped uses &Container::push_back, but in c++0x, std::vector has two overload of it
+ // meaning it is not possible to take the address of that function anymore.
+ QSKIP("mapped do not work with c++0x stl vector", SkipAll);
#else
std::vector<int> vector;
vector.push_back(1);
diff --git a/tests/auto/qtconcurrentrun/tst_qtconcurrentrun.cpp b/tests/auto/qtconcurrentrun/tst_qtconcurrentrun.cpp
index e4e9479..cacb09a 100644
--- a/tests/auto/qtconcurrentrun/tst_qtconcurrentrun.cpp
+++ b/tests/auto/qtconcurrentrun/tst_qtconcurrentrun.cpp
@@ -67,6 +67,8 @@ private slots:
#if 0
void createFunctor();
#endif
+ void functor();
+ void lambda();
};
#if 0
@@ -444,6 +446,71 @@ void tst_QtConcurrentRun::createFunctor()
}
#endif
+struct Functor {
+ int operator()() { return 42; }
+ double operator()(double a, double b) { return a/b; }
+ int operator()(int a, int b) { return a/b; }
+ void operator()(int) { }
+ void operator()(int, int, int) { }
+ void operator()(int, int, int, int) { }
+ void operator()(int, int, int, int, int) { }
+ void operator()(int, int, int, int, int, int) { }
+};
+
+void tst_QtConcurrentRun::functor()
+{
+ //this test functor without result_type, decltype need to be supported by the compiler
+#ifndef Q_COMPILER_DECLTYPE
+ QSKIP("Compiler do not suport decltype", SkipAll);
+#else
+ Functor f;
+ {
+ QFuture<int> fut = QtConcurrent::run(f);
+ QCOMPARE(fut.result(), 42);
+ }
+ {
+ QFuture<double> fut = QtConcurrent::run(f, 8.5, 1.8);
+ QCOMPARE(fut.result(), (8.5/1.8));
+ }
+ {
+ QFuture<int> fut = QtConcurrent::run(f, 19, 3);
+ QCOMPARE(fut.result(), int(19/3));
+ }
+ {
+ QtConcurrent::run(f, 1).waitForFinished();
+ QtConcurrent::run(f, 1,2).waitForFinished();
+ QtConcurrent::run(f, 1,2,3).waitForFinished();
+ QtConcurrent::run(f, 1,2,3,4).waitForFinished();
+ QtConcurrent::run(f, 1,2,3,4,5).waitForFinished();
+ }
+#endif
+}
+
+
+void tst_QtConcurrentRun::lambda()
+{
+#ifndef Q_COMPILER_LAMBDA
+ QSKIP("Compiler do not suport lambda", SkipAll);
+#else
+
+ QCOMPARE(QtConcurrent::run([](){ return 45; }).result(), 45);
+ QCOMPARE(QtConcurrent::run([](int a){ return a+15; }, 12).result(), 12+15);
+ QCOMPARE(QtConcurrent::run([](int a, double b){ return a + b; }, 12, 15).result(), double(12+15));
+ QCOMPARE(QtConcurrent::run([](int a , int, int, int, int b){ return a + b; }, 1, 2, 3, 4, 5).result(), 1 + 5);
+
+#ifdef Q_COMPILER_INITIALIZER_LISTS
+ {
+ QString str { "Hello World Foo" };
+ QFuture<QStringList> f1 = QtConcurrent::run([&](){ return str.split(' '); });
+ auto r = f1.result();
+ QCOMPARE(r, QStringList({"Hello", "World", "Foo"}));
+ }
+#endif
+
+#endif
+}
+
+
#include "tst_qtconcurrentrun.moc"
#else
diff --git a/tests/auto/qtcpserver/tst_qtcpserver.cpp b/tests/auto/qtcpserver/tst_qtcpserver.cpp
index 3416a7c..a7c2604 100644
--- a/tests/auto/qtcpserver/tst_qtcpserver.cpp
+++ b/tests/auto/qtcpserver/tst_qtcpserver.cpp
@@ -116,6 +116,7 @@ private slots:
private:
#ifndef QT_NO_BEARERMANAGEMENT
QNetworkSession *networkSession;
+ QNetworkConfigurationManager *netConfMan;
#endif
};
@@ -154,10 +155,20 @@ void tst_QTcpServer::initTestCase_data()
void tst_QTcpServer::initTestCase()
{
#ifndef QT_NO_BEARERMANAGEMENT
- QNetworkConfigurationManager man;
- networkSession = new QNetworkSession(man.defaultConfiguration(), this);
- networkSession->open();
- QVERIFY(networkSession->waitForOpened());
+ netConfMan = new QNetworkConfigurationManager(this);
+ netConfMan->updateConfigurations();
+ connect(netConfMan, SIGNAL(updateCompleted()), &QTestEventLoop::instance(), SLOT(exitLoop()));
+ QTestEventLoop::instance().enterLoop(10);
+ QNetworkConfiguration networkConfiguration = netConfMan->defaultConfiguration();
+ if (networkConfiguration.isValid()) {
+ networkSession = new QNetworkSession(networkConfiguration);
+ if (!networkSession->isOpen()) {
+ networkSession->open();
+ QVERIFY(networkSession->waitForOpened(30000));
+ }
+ } else {
+ QVERIFY(!(netConfMan->capabilities() & QNetworkConfigurationManager::NetworkSessionRequired));
+ }
#endif
}
diff --git a/tests/auto/qtextdocument/tst_qtextdocument.cpp b/tests/auto/qtextdocument/tst_qtextdocument.cpp
index 1129219..68252ef 100644
--- a/tests/auto/qtextdocument/tst_qtextdocument.cpp
+++ b/tests/auto/qtextdocument/tst_qtextdocument.cpp
@@ -182,6 +182,8 @@ private slots:
void copiedFontSize();
+ void htmlExportImportBlockCount();
+
private:
void backgroundImage_checkExpectedHtml(const QTextDocument &doc);
@@ -1582,7 +1584,7 @@ void tst_QTextDocument::toHtml()
expectedOutput.replace("OPENDEFAULTBLOCKSTYLE", "style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;");
expectedOutput.replace("DEFAULTBLOCKSTYLE", "style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"");
- expectedOutput.replace("EMPTYBLOCK", "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"></p>\n");
+ expectedOutput.replace("EMPTYBLOCK", "<p style=\"-qt-paragraph-type:empty; height:1em; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"></p>\n");
if (expectedOutput.endsWith(QLatin1Char('\n')))
expectedOutput.chop(1);
expectedOutput.append(htmlTail);
@@ -2760,5 +2762,27 @@ void tst_QTextDocument::copiedFontSize()
QCOMPARE(cursorOutput.charFormat().font().pixelSize(), 24);
}
+void tst_QTextDocument::htmlExportImportBlockCount()
+{
+ QTextDocument document;
+ {
+ QTextCursor cursor(&document);
+ cursor.insertText("Foo");
+ cursor.insertBlock();
+ cursor.insertBlock();
+ cursor.insertBlock();
+ cursor.insertBlock();
+ cursor.insertText("Bar");
+ }
+
+ QCOMPARE(document.blockCount(), 5);
+ QString html = document.toHtml();
+
+ document.clear();
+ document.setHtml(html);
+
+ QCOMPARE(document.blockCount(), 5);
+}
+
QTEST_MAIN(tst_QTextDocument)
#include "tst_qtextdocument.moc"
diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp
index b6adc2b..2414ab3 100644
--- a/tests/auto/qtextlayout/tst_qtextlayout.cpp
+++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp
@@ -127,6 +127,8 @@ private slots:
void textWithSurrogates_qtbug15679();
void textWidthWithStackedTextEngine();
void textWidthWithLineSeparator();
+ void cursorInLigatureWithMultipleLines();
+ void xToCursorForLigatures();
private:
QFont testFont;
@@ -1460,5 +1462,45 @@ void tst_QTextLayout::textWidthWithLineSeparator()
QCOMPARE(line1.naturalTextWidth(), line2.naturalTextWidth());
}
+void tst_QTextLayout::cursorInLigatureWithMultipleLines()
+{
+#if !defined(Q_WS_MAC)
+ QSKIP("This test can not be run on Mac", SkipAll);
+#endif
+ QTextLayout layout("first line finish", QFont("Times", 20));
+ layout.beginLayout();
+ QTextLine line = layout.createLine();
+ line.setLineWidth(70);
+ line = layout.createLine();
+ layout.endLayout();
+
+ // The second line will be "finish", with "fi" as a ligature
+ QVERIFY(line.cursorToX(0) != line.cursorToX(1));
+}
+
+void tst_QTextLayout::xToCursorForLigatures()
+{
+#if !defined(Q_WS_MAC)
+ QSKIP("This test can not be run on Mac", SkipAll);
+#endif
+ QTextLayout layout("fi", QFont("Times", 20));
+ layout.beginLayout();
+ QTextLine line = layout.createLine();
+ layout.endLayout();
+
+ QVERIFY(line.xToCursor(0) != line.xToCursor(line.naturalTextWidth() / 2));
+
+ // U+0061 U+0308
+ QTextLayout layout2(QString::fromUtf8("\x61\xCC\x88"), QFont("Times", 20));
+
+ layout2.beginLayout();
+ line = layout2.createLine();
+ layout2.endLayout();
+
+ qreal width = line.naturalTextWidth();
+ QVERIFY(line.xToCursor(0) == line.xToCursor(width / 2) ||
+ line.xToCursor(width) == line.xToCursor(width / 2));
+}
+
QTEST_MAIN(tst_QTextLayout)
#include "tst_qtextlayout.moc"
diff --git a/tests/auto/qtoolbutton/tst_qtoolbutton.cpp b/tests/auto/qtoolbutton/tst_qtoolbutton.cpp
index 427a505..a4aa312 100644
--- a/tests/auto/qtoolbutton/tst_qtoolbutton.cpp
+++ b/tests/auto/qtoolbutton/tst_qtoolbutton.cpp
@@ -231,7 +231,7 @@ void tst_QToolButton::task176137_autoRepeatOfAction()
void tst_QToolButton::sendMouseClick()
{
- QTest::mouseClick(w, Qt::LeftButton, 0, QPoint(7,7));
+ QTest::mouseClick(w, Qt::LeftButton, 0);
}
QTEST_MAIN(tst_QToolButton)
diff --git a/tests/auto/qtreewidget/tst_qtreewidget.cpp b/tests/auto/qtreewidget/tst_qtreewidget.cpp
index dc878c4..7d2cdfb 100644
--- a/tests/auto/qtreewidget/tst_qtreewidget.cpp
+++ b/tests/auto/qtreewidget/tst_qtreewidget.cpp
@@ -50,6 +50,8 @@
#include <qlineedit.h>
#include <QScrollBar>
#include <QStyledItemDelegate>
+#include <QDesktopWidget>
+#include <QApplication>
#include "../../shared/util.h"
@@ -3102,10 +3104,21 @@ void tst_QTreeWidget::task206367_duplication()
QWidget topLevel;
QTreeWidget treeWidget(&topLevel);
topLevel.show();
+#ifndef Q_WS_S60
treeWidget.resize(200, 200);
+#endif
treeWidget.setSortingEnabled(true);
QTreeWidgetItem* rootItem = new QTreeWidgetItem( &treeWidget, QStringList("root") );
+#ifdef Q_WS_S60
+ // Ensure that eight items fit into tree widget. In Symbian VGA devices 8 rows of
+ // data will take more than 200 pixels.
+ int calculatedHeight = treeWidget.visualItemRect(treeWidget.topLevelItem(0)).height() +
+ 2 * QApplication::style()->pixelMetric(QStyle::PM_DefaultFrameWidth, 0, 0);
+ calculatedHeight *= 8; // eight 'rows': header, root and 2 items with 2 children
+ treeWidget.resize(200, qMax(200, calculatedHeight));
+#endif
+
for (int nFile = 0; nFile < 2; nFile++ ) {
QTreeWidgetItem* itemFile = new QTreeWidgetItem(rootItem, QStringList(QString::number(nFile)));
for (int nRecord = 0; nRecord < 2; nRecord++)
@@ -3211,6 +3224,13 @@ void tst_QTreeWidget::task239150_editorWidth()
{
//we check that an item with no text will get an editor with a correct size
QTreeWidget tree;
+#ifdef Q_OS_SYMBIAN
+ //By default widgets are 640*360 in Symbian. Call to create_sys() sets the real size of the widget.
+ //Therefore, with VGA Symbian devices, we need to update the widget width to match screen width.
+ //As VGA devices have larger font, longer texts wouldn't otherwise fit into tree widget.
+ if (QApplication::desktop() && QApplication::desktop()->availableGeometry().width() > tree.width())
+ tree.resize(QApplication::desktop()->availableGeometry().size());
+#endif
QStyleOptionFrameV2 opt;
opt.init(&tree);
diff --git a/tests/auto/qudpsocket/tst_qudpsocket.cpp b/tests/auto/qudpsocket/tst_qudpsocket.cpp
index 9ca049b..a38082e 100644
--- a/tests/auto/qudpsocket/tst_qudpsocket.cpp
+++ b/tests/auto/qudpsocket/tst_qudpsocket.cpp
@@ -148,11 +148,18 @@ void tst_QUdpSocket::initTestCase_data()
#ifndef QT_NO_BEARERMANAGEMENT
netConfMan = new QNetworkConfigurationManager(this);
+ netConfMan->updateConfigurations();
+ connect(netConfMan, SIGNAL(updateCompleted()), &QTestEventLoop::instance(), SLOT(exitLoop()));
+ QTestEventLoop::instance().enterLoop(10);
networkConfiguration = netConfMan->defaultConfiguration();
- networkSession = QSharedPointer<QNetworkSession>(new QNetworkSession(networkConfiguration));
- if (!networkSession->isOpen()) {
- networkSession->open();
- QVERIFY(networkSession->waitForOpened(30000));
+ if (networkConfiguration.isValid()) {
+ networkSession = QSharedPointer<QNetworkSession>(new QNetworkSession(networkConfiguration));
+ if (!networkSession->isOpen()) {
+ networkSession->open();
+ QVERIFY(networkSession->waitForOpened(30000));
+ }
+ } else {
+ QVERIFY(!(netConfMan->capabilities() & QNetworkConfigurationManager::NetworkSessionRequired));
}
#endif
}
diff --git a/tests/auto/qurl/tst_qurl.cpp b/tests/auto/qurl/tst_qurl.cpp
index 613053b..b78679b 100644
--- a/tests/auto/qurl/tst_qurl.cpp
+++ b/tests/auto/qurl/tst_qurl.cpp
@@ -49,6 +49,7 @@
#include <qurl.h>
#include <qtextcodec.h>
#include <qmap.h>
+#include "private/qtldurl_p.h"
// For testsuites
#define IDNA_ACE_PREFIX "xn--"
@@ -88,6 +89,8 @@ public slots:
void init();
void cleanup();
private slots:
+ void effectiveTLDs_data();
+ void effectiveTLDs();
void getSetCheck();
void constructing();
void assignment();
@@ -3167,8 +3170,8 @@ void tst_QUrl::nameprep_testsuite_data()
#ifdef QT_BUILD_INTERNAL
QT_BEGIN_NAMESPACE
-extern void qt_nameprep(QString *source, int from);
-extern bool qt_check_std3rules(const QChar *, int);
+Q_CORE_EXPORT extern void qt_nameprep(QString *source, int from);
+Q_CORE_EXPORT extern bool qt_check_std3rules(const QChar *, int);
QT_END_NAMESPACE
#endif
@@ -4005,5 +4008,28 @@ void tst_QUrl::taskQTBUG_8701()
QCOMPARE(foo_uni_bar, QUrl(foo_uni_bar, QUrl::StrictMode).toString());
}
+void tst_QUrl::effectiveTLDs_data()
+{
+ QTest::addColumn<QUrl>("domain");
+ QTest::addColumn<QString>("TLD");
+
+ QTest::newRow("yes0") << QUrl::fromEncoded("http://test.co.uk") << ".co.uk";
+ QTest::newRow("yes1") << QUrl::fromEncoded("http://test.com") << ".com";
+ QTest::newRow("yes2") << QUrl::fromEncoded("http://www.test.de") << ".de";
+ QTest::newRow("yes3") << QUrl::fromEncoded("http://test.ulm.museum") << ".ulm.museum";
+ QTest::newRow("yes4") << QUrl::fromEncoded("http://www.com.krodsherad.no") << ".krodsherad.no";
+ QTest::newRow("yes5") << QUrl::fromEncoded("http://www.co.uk.1.bg") << ".1.bg";
+ QTest::newRow("yes6") << QUrl::fromEncoded("http://www.com.com.cn") << ".com.cn";
+ QTest::newRow("yes7") << QUrl::fromEncoded("http://www.test.org.ws") << ".org.ws";
+ QTest::newRow("yes9") << QUrl::fromEncoded("http://www.com.co.uk.wallonie.museum") << ".wallonie.museum";
+}
+
+void tst_QUrl::effectiveTLDs()
+{
+ QFETCH(QUrl, domain);
+ QFETCH(QString, TLD);
+ QCOMPARE(domain.topLevelDomain(), TLD);
+}
+
QTEST_MAIN(tst_QUrl)
#include "tst_qurl.moc"
diff --git a/tests/auto/quuid/tst_quuid.cpp b/tests/auto/quuid/tst_quuid.cpp
index 6333e83..4948312 100644
--- a/tests/auto/quuid/tst_quuid.cpp
+++ b/tests/auto/quuid/tst_quuid.cpp
@@ -60,7 +60,14 @@ public:
tst_QUuid();
private slots:
+ void fromChar();
void toString();
+ void fromString();
+ void toByteArray();
+ void fromByteArray();
+ void toRfc4122();
+ void fromRfc4122();
+ void check_QDataStream();
void isNull();
void equal();
void notEqual();
@@ -83,16 +90,106 @@ public:
tst_QUuid::tst_QUuid()
{
- uuidA = "{fc69b59e-cc34-4436-a43c-ee95d128b8c5}";
- uuidB = "{1ab6e93a-b1cb-4a87-ba47-ec7e99039a7b}";
+ //"{fc69b59e-cc34-4436-a43c-ee95d128b8c5}";
+ uuidA = QUuid(0xfc69b59e, 0xcc34 ,0x4436 ,0xa4 ,0x3c ,0xee ,0x95 ,0xd1 ,0x28 ,0xb8 ,0xc5);
+
+ //"{1ab6e93a-b1cb-4a87-ba47-ec7e99039a7b}";
+ uuidB = QUuid(0x1ab6e93a ,0xb1cb ,0x4a87 ,0xba ,0x47 ,0xec ,0x7e ,0x99 ,0x03 ,0x9a ,0x7b);
}
+void tst_QUuid::fromChar()
+{
+ QCOMPARE(uuidA, QUuid("{fc69b59e-cc34-4436-a43c-ee95d128b8c5}"));
+ QCOMPARE(uuidA, QUuid("fc69b59e-cc34-4436-a43c-ee95d128b8c5}"));
+ QCOMPARE(uuidA, QUuid("{fc69b59e-cc34-4436-a43c-ee95d128b8c5"));
+ QCOMPARE(uuidA, QUuid("fc69b59e-cc34-4436-a43c-ee95d128b8c5"));
+ QCOMPARE(QUuid(), QUuid("{fc69b59e-cc34-4436-a43c-ee95d128b8c"));
+ QCOMPARE(QUuid(), QUuid("{fc69b59e-cc34"));
+ QCOMPARE(QUuid(), QUuid("fc69b59e-cc34-"));
+ QCOMPARE(QUuid(), QUuid("fc69b59e-cc34"));
+ QCOMPARE(QUuid(), QUuid("cc34"));
+ QCOMPARE(QUuid(), QUuid(NULL));
+
+ QCOMPARE(uuidB, QUuid(QString("{1ab6e93a-b1cb-4a87-ba47-ec7e99039a7b}")));
+}
void tst_QUuid::toString()
{
QCOMPARE(uuidA.toString(), QString("{fc69b59e-cc34-4436-a43c-ee95d128b8c5}"));
+
+ QCOMPARE(uuidB.toString(), QString("{1ab6e93a-b1cb-4a87-ba47-ec7e99039a7b}"));
+}
+
+void tst_QUuid::fromString()
+{
+ QCOMPARE(uuidA, QUuid(QString("{fc69b59e-cc34-4436-a43c-ee95d128b8c5}")));
+ QCOMPARE(uuidA, QUuid(QString("fc69b59e-cc34-4436-a43c-ee95d128b8c5}")));
+ QCOMPARE(uuidA, QUuid(QString("{fc69b59e-cc34-4436-a43c-ee95d128b8c5")));
+ QCOMPARE(uuidA, QUuid(QString("fc69b59e-cc34-4436-a43c-ee95d128b8c5")));
+ QCOMPARE(QUuid(), QUuid(QString("{fc69b59e-cc34-4436-a43c-ee95d128b8c")));
+
+ QCOMPARE(uuidB, QUuid(QString("{1ab6e93a-b1cb-4a87-ba47-ec7e99039a7b}")));
+}
+
+void tst_QUuid::toByteArray()
+{
+ QCOMPARE(uuidA.toByteArray(), QByteArray("{fc69b59e-cc34-4436-a43c-ee95d128b8c5}"));
+
+ QCOMPARE(uuidB.toByteArray(), QByteArray("{1ab6e93a-b1cb-4a87-ba47-ec7e99039a7b}"));
+}
+
+void tst_QUuid::fromByteArray()
+{
+ QCOMPARE(uuidA, QUuid(QByteArray("{fc69b59e-cc34-4436-a43c-ee95d128b8c5}")));
+ QCOMPARE(uuidA, QUuid(QByteArray("fc69b59e-cc34-4436-a43c-ee95d128b8c5}")));
+ QCOMPARE(uuidA, QUuid(QByteArray("{fc69b59e-cc34-4436-a43c-ee95d128b8c5")));
+ QCOMPARE(uuidA, QUuid(QByteArray("fc69b59e-cc34-4436-a43c-ee95d128b8c5")));
+ QCOMPARE(QUuid(), QUuid(QByteArray("{fc69b59e-cc34-4436-a43c-ee95d128b8c")));
+
+ QCOMPARE(uuidB, QUuid(QByteArray("{1ab6e93a-b1cb-4a87-ba47-ec7e99039a7b}")));
+}
+
+void tst_QUuid::toRfc4122()
+{
+ QCOMPARE(uuidA.toRfc4122(), QByteArray::fromHex("fc69b59ecc344436a43cee95d128b8c5"));
+
+ QCOMPARE(uuidB.toRfc4122(), QByteArray::fromHex("1ab6e93ab1cb4a87ba47ec7e99039a7b"));
}
+void tst_QUuid::fromRfc4122()
+{
+ QCOMPARE(uuidA, QUuid::fromRfc4122(QByteArray::fromHex("fc69b59ecc344436a43cee95d128b8c5")));
+
+ QCOMPARE(uuidB, QUuid::fromRfc4122(QByteArray::fromHex("1ab6e93ab1cb4a87ba47ec7e99039a7b")));
+}
+
+void tst_QUuid::check_QDataStream()
+{
+ QUuid tmp;
+ QByteArray ar;
+ {
+ QDataStream out(&ar,QIODevice::WriteOnly);
+ out.setByteOrder(QDataStream::BigEndian);
+ out << uuidA;
+ }
+ {
+ QDataStream in(&ar,QIODevice::ReadOnly);
+ in.setByteOrder(QDataStream::BigEndian);
+ in >> tmp;
+ QCOMPARE(uuidA, tmp);
+ }
+ {
+ QDataStream out(&ar,QIODevice::WriteOnly);
+ out.setByteOrder(QDataStream::LittleEndian);
+ out << uuidA;
+ }
+ {
+ QDataStream in(&ar,QIODevice::ReadOnly);
+ in.setByteOrder(QDataStream::LittleEndian);
+ in >> tmp;
+ QCOMPARE(uuidA, tmp);
+ }
+}
void tst_QUuid::isNull()
{