summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2009-10-21 07:42:29 (GMT)
committerJason McDonald <jason.mcdonald@nokia.com>2009-10-21 07:42:29 (GMT)
commita3e38f1a2a7990d541dd9d49899b5488ae64a466 (patch)
tree2b6eacecf0726195cd375dc19f8aa673a81c320f
parent9964c9461bfb80a0ee1bb830c3c3e0dd3aa75f53 (diff)
parent58574ea3590fbb28da5be73b983d83f0a8824d00 (diff)
downloadQt-a3e38f1a2a7990d541dd9d49899b5488ae64a466.zip
Qt-a3e38f1a2a7990d541dd9d49899b5488ae64a466.tar.gz
Qt-a3e38f1a2a7990d541dd9d49899b5488ae64a466.tar.bz2
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt into 4.5
-rw-r--r--src/gui/widgets/qmenu_mac.mm8
-rw-r--r--tests/auto/qsslsocket/tst_qsslsocket.cpp45
-rw-r--r--tests/benchmarks/benchmarks.pro1
-rw-r--r--tests/benchmarks/qnetworkreply/qnetworkreply.pro13
-rw-r--r--tests/benchmarks/qnetworkreply/tst_qnetworkreply.cpp111
5 files changed, 178 insertions, 0 deletions
diff --git a/src/gui/widgets/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm
index c3b954f..ec9313f 100644
--- a/src/gui/widgets/qmenu_mac.mm
+++ b/src/gui/widgets/qmenu_mac.mm
@@ -572,6 +572,10 @@ static void qt_mac_get_accel(quint32 accel_key, quint32 *modif, quint32 *key) {
*key = kMenuNorthwestArrowGlyph;
else if (accel_key == Qt::Key_End)
*key = kMenuSoutheastArrowGlyph;
+ else if (accel_key == Qt::Key_Back)
+ *key = kMenuLeftArrowDashedGlyph;
+ else if (accel_key == Qt::Key_Forward)
+ *key = kMenuRightArrowDashedGlyph;
}
}
#else // Cocoa
@@ -1239,6 +1243,10 @@ NSString *keySequenceToKeyEqivalent(const QKeySequence &accel)
keyEquiv[0] = NSHomeFunctionKey;
else if (accel_key == Qt::Key_End)
keyEquiv[0] = NSEndFunctionKey;
+ else if (accel_key == Qt::Key_Back)
+ keyEquiv[0] = 0 ; // ### could not find Cocoa equivalent to kMenuLeftArrowDashedGlyph
+ else if (accel_key == Qt::Key_Forward)
+ keyEquiv[0] = 0 ; // ### could not find Cocoa equivalent to kMenuRightArrowDashedGlyph
else
keyEquiv[0] = unichar(QChar(accel_key).toLower().unicode());
return [NSString stringWithCharacters:keyEquiv length:1];
diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp
index 6b330e1..2f1c2e2 100644
--- a/tests/auto/qsslsocket/tst_qsslsocket.cpp
+++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp
@@ -173,6 +173,7 @@ private slots:
void disconnectFromHostWhenConnected();
void resetProxy();
void readFromClosedSocket();
+ void writeBigChunk();
static void exitLoop()
{
@@ -1537,6 +1538,50 @@ void tst_QSslSocket::readFromClosedSocket()
QVERIFY(!socket->bytesToWrite());
}
+void tst_QSslSocket::writeBigChunk()
+{
+ if (!QSslSocket::supportsSsl())
+ return;
+
+ QSslSocketPtr socket = newSocket();
+ this->socket = socket;
+
+ connect(socket, SIGNAL(sslErrors(const QList<QSslError> &)), this, SLOT(ignoreErrorSlot()));
+ socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443);
+
+ QByteArray data;
+ data.resize(1024*1024*10); // 10 MB
+ // init with garbage. needed so ssl cannot compress it in an efficient way.
+ for (int i = 0; i < data.size() / sizeof(int); i++) {
+ int r = qrand();
+ data.data()[i*sizeof(int)] = r;
+ }
+
+ QVERIFY(socket->waitForEncrypted(10000));
+ QString errorBefore = socket->errorString();
+
+ int ret = socket->write(data.constData(), data.size());
+ QVERIFY(data.size() == ret);
+
+ // spin the event loop once so QSslSocket::transmit() gets called
+ QCoreApplication::processEvents();
+ QString errorAfter = socket->errorString();
+
+ // no better way to do this right now since the error is the same as the default error.
+ if (socket->errorString().startsWith(QLatin1String("Unable to write data")))
+ {
+ qWarning() << socket->error() << socket->errorString();
+ QFAIL("Error while writing! Check if the OpenSSL BIO size is limited?!");
+ }
+ // also check the error string. If another error (than UnknownError) occured, it should be different than before
+ QVERIFY(errorBefore == errorAfter);
+
+ // check that everything has been written to OpenSSL
+ QVERIFY(socket->bytesToWrite() == 0);
+
+ socket->close();
+}
+
#endif // QT_NO_OPENSSL
QTEST_MAIN(tst_QSslSocket)
diff --git a/tests/benchmarks/benchmarks.pro b/tests/benchmarks/benchmarks.pro
index 8e2c243..fb2b9ea 100644
--- a/tests/benchmarks/benchmarks.pro
+++ b/tests/benchmarks/benchmarks.pro
@@ -8,6 +8,7 @@ SUBDIRS = containers-associative \
qpixmap \
blendbench \
qstringlist \
+ qnetworkreply \
qobject \
qrect \
qregexp \
diff --git a/tests/benchmarks/qnetworkreply/qnetworkreply.pro b/tests/benchmarks/qnetworkreply/qnetworkreply.pro
new file mode 100644
index 0000000..1e67d81
--- /dev/null
+++ b/tests/benchmarks/qnetworkreply/qnetworkreply.pro
@@ -0,0 +1,13 @@
+load(qttest_p4)
+TEMPLATE = app
+TARGET = tst_qnetworkreply
+DEPENDPATH += .
+INCLUDEPATH += .
+
+QT -= gui
+QT += network
+
+CONFIG += release
+
+# Input
+SOURCES += tst_qnetworkreply.cpp
diff --git a/tests/benchmarks/qnetworkreply/tst_qnetworkreply.cpp b/tests/benchmarks/qnetworkreply/tst_qnetworkreply.cpp
new file mode 100644
index 0000000..e622d62
--- /dev/null
+++ b/tests/benchmarks/qnetworkreply/tst_qnetworkreply.cpp
@@ -0,0 +1,111 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+// This file contains benchmarks for QNetworkReply functions.
+
+#include <QDebug>
+#include <qtest.h>
+#include <QtTest/QtTest>
+#include <QtNetwork/qnetworkreply.h>
+#include <QtNetwork/qnetworkrequest.h>
+#include <QtNetwork/qnetworkaccessmanager.h>
+#include "../../auto/network-settings.h"
+
+class tst_qnetworkreply : public QObject
+{
+ Q_OBJECT
+private slots:
+ void httpLatency();
+#ifndef QT_NO_OPENSSL
+ void echoPerformance_data();
+ void echoPerformance();
+#endif
+};
+
+void tst_qnetworkreply::httpLatency()
+{
+ QNetworkAccessManager manager;
+ QBENCHMARK{
+ QNetworkRequest request(QUrl("http://" + QtNetworkSettings::serverName() + "/qtest/"));
+ QNetworkReply* reply = manager.get(request);
+ connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()), Qt::QueuedConnection);
+ QTestEventLoop::instance().enterLoop(5);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+ delete reply;
+ }
+}
+
+#ifndef QT_NO_OPENSSL
+void tst_qnetworkreply::echoPerformance_data()
+{
+ QTest::addColumn<bool>("ssl");
+ QTest::newRow("no_ssl") << false;
+ QTest::newRow("ssl") << true;
+}
+
+void tst_qnetworkreply::echoPerformance()
+{
+ QFETCH(bool, ssl);
+ QNetworkAccessManager manager;
+ QNetworkRequest request(QUrl((ssl ? "https://" : "http://") + QtNetworkSettings::serverName() + "/qtest/cgi-bin/echo.cgi"));
+
+ QByteArray data;
+ data.resize(1024*1024*10); // 10 MB
+ // init with garbage. needed so ssl cannot compress it in an efficient way.
+ for (int i = 0; i < data.size() / sizeof(int); i++) {
+ int r = qrand();
+ data.data()[i*sizeof(int)] = r;
+ }
+
+ QBENCHMARK{
+ QNetworkReply* reply = manager.post(request, data);
+ connect(reply, SIGNAL(sslErrors( const QList<QSslError> &)), reply, SLOT(ignoreSslErrors()));
+ connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()), Qt::QueuedConnection);
+ QTestEventLoop::instance().enterLoop(5);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+ QVERIFY(reply->error() == QNetworkReply::NoError);
+ delete reply;
+ }
+}
+#endif
+
+QTEST_MAIN(tst_qnetworkreply)
+
+#include "main.moc"