summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/src/development/designer-manual.qdoc2
-rw-r--r--doc/src/frameworks-technologies/animation.qdoc4
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/ChangeLog10
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h12
-rw-r--r--src/3rdparty/webkit/VERSION2
-rw-r--r--src/3rdparty/webkit/WebCore/ChangeLog20
-rw-r--r--src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.cpp1
-rw-r--r--src/3rdparty/webkit/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp8
-rw-r--r--src/corelib/global/qglobal.cpp31
-rw-r--r--src/corelib/io/qdir.cpp7
-rw-r--r--src/corelib/io/qfsfileengine.cpp2
-rw-r--r--src/corelib/io/qiodevice.cpp12
-rw-r--r--src/corelib/statemachine/qsignaltransition.cpp2
-rw-r--r--src/gui/dialogs/qcolordialog_mac.mm1
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp28
-rw-r--r--src/gui/image/qimage.cpp19
-rw-r--r--src/gui/itemviews/qtableview.cpp14
-rw-r--r--src/gui/kernel/qapplication.cpp2
-rw-r--r--src/gui/kernel/qwidget.cpp14
-rw-r--r--src/gui/kernel/qwidget_mac.mm1
-rw-r--r--src/gui/kernel/qwidget_x11.cpp2
-rw-r--r--src/gui/statemachine/qguistatemachine.cpp2
-rw-r--r--src/gui/text/qtextcursor.cpp55
-rw-r--r--src/gui/widgets/qmdiarea.cpp16
-rw-r--r--src/network/socket/qabstractsocket.cpp22
-rw-r--r--src/network/socket/qhttpsocketengine.cpp20
-rw-r--r--src/network/socket/qhttpsocketengine_p.h2
-rw-r--r--src/s60main/qts60main.cpp27
-rw-r--r--src/s60main/qts60main_mcrt0.cpp27
-rw-r--r--src/xmlpatterns/api/qcoloroutput.cpp117
-rw-r--r--tests/auto/qfile/tst_qfile.cpp41
-rw-r--r--tests/auto/qftp/tst_qftp.cpp5
-rw-r--r--tests/auto/qhttp/tst_qhttp.cpp5
-rw-r--r--tests/auto/qsslsocket/tst_qsslsocket.cpp11
-rw-r--r--tests/auto/qtcpserver/test/test.pro2
-rw-r--r--tests/auto/qtcpserver/tst_qtcpserver.cpp180
-rw-r--r--tests/auto/qtcpsocket/test/test.pro2
-rw-r--r--tests/auto/qtcpsocket/tst_qtcpsocket.cpp24
-rw-r--r--tests/auto/qudpsocket/test/test.pro1
-rw-r--r--tests/auto/qudpsocket/tst_qudpsocket.cpp18
-rw-r--r--tests/benchmarks/benchmarks.pro1
-rw-r--r--tests/benchmarks/qhostinfo/main.cpp28
-rw-r--r--tests/benchmarks/qtcpserver/qtcpserver.pro13
-rw-r--r--tests/benchmarks/qtcpserver/tst_qtcpserver.cpp277
44 files changed, 654 insertions, 436 deletions
diff --git a/doc/src/development/designer-manual.qdoc b/doc/src/development/designer-manual.qdoc
index bfd8066..d7666f6 100644
--- a/doc/src/development/designer-manual.qdoc
+++ b/doc/src/development/designer-manual.qdoc
@@ -371,7 +371,7 @@
{setValue()} slot.
To do this, you have to switch to \gui{Edit Signals/Slots} mode, either by
- pressing \key{F4} or something \gui{Edit Signals/Slots} from the \gui{Edit}
+ pressing \key{F4} or selecting \gui{Edit Signals/Slots} from the \gui{Edit}
menu.
\table
diff --git a/doc/src/frameworks-technologies/animation.qdoc b/doc/src/frameworks-technologies/animation.qdoc
index cd6e304..77cc8dc 100644
--- a/doc/src/frameworks-technologies/animation.qdoc
+++ b/doc/src/frameworks-technologies/animation.qdoc
@@ -352,11 +352,11 @@
QStateMachine *machine = new QStateMachine;
- QState *state1 = new QState(machine->rootState());
+ QState *state1 = new QState(machine);
state1->assignProperty(button, "geometry", QRect(0, 0, 100, 30));
machine->setInitialState(state1);
- QState *state2 = new QState(machine->rootState());
+ QState *state2 = new QState(machine);
state2->assignProperty(button, "geometry", QRect(250, 250, 100, 30));
QSignalTransition *transition1 = state1->addTransition(button,
diff --git a/src/3rdparty/webkit/JavaScriptCore/ChangeLog b/src/3rdparty/webkit/JavaScriptCore/ChangeLog
index 50cff63..a559d9b 100644
--- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog
+++ b/src/3rdparty/webkit/JavaScriptCore/ChangeLog
@@ -1,3 +1,13 @@
+2009-12-08 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
+
+ Reviewed by Darin Adler.
+
+ Make WebKit build correctly on FreeBSD, IA64, and Alpha.
+ Based on work by Petr Salinger <Petr.Salinger@seznam.cz>,
+ and Colin Watson <cjwatson@ubuntu.com>.
+
+ * wtf/Platform.h:
+
2009-12-18 Yongjun Zhang <yongjun.zhang@nokia.com>
Reviewed by Simon Hausmann.
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h
index cb6c9b9..3e1093b 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h
@@ -347,6 +347,16 @@
#define WTF_PLATFORM_X86_64 1
#endif
+/* PLATFORM(IA64) */
+#if defined(__ia64__)
+#define WTF_PLATFORM_IA64 1
+#endif
+
+/* PLATFORM(ALPHA) */
+#if defined(__alpha__)
+#define WTF_PLATFORM_ALPHA 1
+#endif
+
/* PLATFORM(SH4) */
#if defined(__SH4__)
#define WTF_PLATFORM_SH4 1
@@ -709,7 +719,7 @@
#endif
#if !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32) && !defined(WTF_USE_JSVALUE32_64)
-#if PLATFORM(X86_64) && (PLATFORM(DARWIN) || PLATFORM(LINUX) || PLATFORM(WIN_OS))
+#if (PLATFORM(X86_64) && (PLATFORM(UNIX) || PLATFORM(WIN_OS))) || PLATFORM(IA64) || PLATFORM(ALPHA)
#define WTF_USE_JSVALUE64 1
#elif PLATFORM(ARM) || PLATFORM(PPC64)
#define WTF_USE_JSVALUE32 1
diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION
index daa3be7..70913ca 100644
--- a/src/3rdparty/webkit/VERSION
+++ b/src/3rdparty/webkit/VERSION
@@ -8,4 +8,4 @@ The commit imported was from the
and has the sha1 checksum
- 70b5989bdeea2f73bd950099fc0f0e954550ef54
+ 865abd2871c801c1d3d0f4eebd985b2daab89ebe
diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog
index 03bb1fb..e72293d 100644
--- a/src/3rdparty/webkit/WebCore/ChangeLog
+++ b/src/3rdparty/webkit/WebCore/ChangeLog
@@ -1,3 +1,23 @@
+2010-01-06 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Unreviewed trivial Qt build fix.
+
+ Prefix the phonon includes with phonon/ to avoid conflicts with the S60
+ audio routing API ( http://wiki.forum.nokia.com/index.php/Audio_Routing_API ).
+
+ * platform/graphics/qt/MediaPlayerPrivatePhonon.cpp:
+
+2009-12-31 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Do not include Frame.h under WebCore/html/canvas
+ https://bugs.webkit.org/show_bug.cgi?id=33082
+
+ No new tests, as there is no new functionality.
+
+ * html/canvas/CanvasRenderingContext2D.cpp:
+
2009-12-30 Janne Koskinen <janne.p.koskinen@digia.com>
Reviewed by Simon Hausmann.
diff --git a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.cpp b/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.cpp
index 3341901..848771b 100644
--- a/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.cpp
+++ b/src/3rdparty/webkit/WebCore/html/canvas/CanvasRenderingContext2D.cpp
@@ -42,7 +42,6 @@
#include "Document.h"
#include "ExceptionCode.h"
#include "FloatConversion.h"
-#include "Frame.h"
#include "GraphicsContext.h"
#include "HTMLCanvasElement.h"
#include "HTMLImageElement.h"
diff --git a/src/3rdparty/webkit/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp b/src/3rdparty/webkit/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp
index 9faa234..7a78391 100644
--- a/src/3rdparty/webkit/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp
+++ b/src/3rdparty/webkit/WebCore/platform/graphics/qt/MediaPlayerPrivatePhonon.cpp
@@ -38,12 +38,10 @@
#include <QUrl>
#include <QEvent>
-#if defined (__SYMBIAN32__)
#include <phonon/path.h>
-#endif
-#include <audiooutput.h>
-#include <mediaobject.h>
-#include <videowidget.h>
+#include <phonon/audiooutput.h>
+#include <phonon/mediaobject.h>
+#include <phonon/videowidget.h>
using namespace Phonon;
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 0c94482..dfe610c 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -1226,7 +1226,7 @@ bool qSharedBuild()
Defined on Mac OS X.
- \sa Q_WS_WIN, Q_WS_X11, Q_WS_QWS
+ \sa Q_WS_WIN, Q_WS_X11, Q_WS_QWS, Q_WS_S60
*/
/*!
@@ -1235,7 +1235,7 @@ bool qSharedBuild()
Defined on Windows.
- \sa Q_WS_MAC, Q_WS_X11, Q_WS_QWS
+ \sa Q_WS_MAC, Q_WS_X11, Q_WS_QWS, Q_WS_S60
*/
/*!
@@ -1244,7 +1244,7 @@ bool qSharedBuild()
Defined on X11.
- \sa Q_WS_MAC, Q_WS_WIN, Q_WS_QWS
+ \sa Q_WS_MAC, Q_WS_WIN, Q_WS_QWS, Q_WS_S60
*/
/*!
@@ -1253,7 +1253,7 @@ bool qSharedBuild()
Defined on Qt for Embedded Linux.
- \sa Q_WS_MAC, Q_WS_WIN, Q_WS_X11
+ \sa Q_WS_MAC, Q_WS_WIN, Q_WS_X11, Q_WS_S60
*/
/*!
@@ -1599,6 +1599,29 @@ bool qSharedBuild()
Optimizing C++ Compilers.
*/
+/*!
+ \macro Q_OS_MAC
+ \relates <QtGlobal>
+
+ Defined on MAC OS (synonym for Darwin).
+ */
+
+/*!
+ \macro Q_OS_SYMBIAN
+ \relates <QtGlobal>
+
+ Defined on Symbian.
+ */
+
+/*!
+ \macro Q_WS_S60
+ \relates <QtGlobal>
+
+ Defined on S60.
+
+ \sa Q_WS_MAC, Q_WS_WIN, Q_WS_X11, Q_WS_QWS
+ */
+
#if defined(QT_BUILD_QMAKE)
// needed to bootstrap qmake
static const unsigned int qt_one = 1;
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index 59db9a6..bac508a 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -1125,10 +1125,11 @@ QDir::Filters QDir::filter() const
execute access. The Executable value needs to be
combined with Dirs or Files.
\value Modified Only list files that have been modified (ignored
- under Unix).
- \value Hidden List hidden files (on Unix, files starting with a .).
+ on Unix).
+ \value Hidden List hidden files (on Unix, files starting with a ".").
\value System List system files (on Unix, FIFOs, sockets and
- device files)
+ device files are included; on Windows, \c {.lnk}
+ files are included)
\value CaseSensitive The filter should be case sensitive.
\omitvalue DefaultFilter
diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp
index e4c4e3f..c064d5a 100644
--- a/src/corelib/io/qfsfileengine.cpp
+++ b/src/corelib/io/qfsfileengine.cpp
@@ -144,7 +144,7 @@ QString QFSFileEnginePrivate::canonicalized(const QString &path)
return path;
#endif
// Mac OS X 10.5.x doesn't support the realpath(X,0) extenstion we use here.
-#if defined(Q_OS_LINIX) || defined(Q_OS_SYMBIAN)
+#if defined(Q_OS_LINUX) || defined(Q_OS_SYMBIAN)
char *ret = realpath(path.toLocal8Bit().constData(), (char*)0);
if (ret) {
QString canonicalPath = QDir::cleanPath(QString::fromLocal8Bit(ret));
diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp
index 0e5a2de..8dcccb4 100644
--- a/src/corelib/io/qiodevice.cpp
+++ b/src/corelib/io/qiodevice.cpp
@@ -965,7 +965,15 @@ QByteArray QIODevice::readAll()
QByteArray result;
qint64 readBytes = 0;
- if (d->isSequential() || (readBytes = size()) == 0) {
+
+ // flush internal read buffer
+ if (!(d->openMode & Text) && !d->buffer.isEmpty()) {
+ result = d->buffer.readAll();
+ readBytes = result.size();
+ }
+
+ qint64 theSize;
+ if (d->isSequential() || (theSize = size()) == 0) {
// Size is unknown, read incrementally.
qint64 readResult;
do {
@@ -977,7 +985,7 @@ QByteArray QIODevice::readAll()
} else {
// Read it all in one go.
// If resize fails, don't read anything.
- result.resize(int(readBytes - d->pos));
+ result.resize(int(theSize - d->pos));
readBytes = read(result.data(), result.size());
}
diff --git a/src/corelib/statemachine/qsignaltransition.cpp b/src/corelib/statemachine/qsignaltransition.cpp
index f55f634..d35c12e 100644
--- a/src/corelib/statemachine/qsignaltransition.cpp
+++ b/src/corelib/statemachine/qsignaltransition.cpp
@@ -76,7 +76,7 @@ QT_BEGIN_NAMESPACE
CheckedTransition(QCheckBox *check)
: QSignalTransition(check, SIGNAL(stateChanged(int))) {}
protected:
- bool eventTest(QEvent *e) const {
+ bool eventTest(QEvent *e) {
if (!QSignalTransition::eventTest(e))
return false;
QStateMachine::SignalEvent *se = static_cast<QStateMachine::SignalEvent*>(e);
diff --git a/src/gui/dialogs/qcolordialog_mac.mm b/src/gui/dialogs/qcolordialog_mac.mm
index 5753954..a350be1 100644
--- a/src/gui/dialogs/qcolordialog_mac.mm
+++ b/src/gui/dialogs/qcolordialog_mac.mm
@@ -347,6 +347,7 @@ QT_USE_NAMESPACE
}
}
+ QAbstractEventDispatcher::instance()->interrupt();
if (mResultCode == NSCancelButton)
mPriv->colorDialog()->reject();
else
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 182a3f5..c80b314 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -1561,7 +1561,10 @@ QGraphicsScene::QGraphicsScene(qreal x, qreal y, qreal width, qreal height, QObj
}
/*!
- Destroys the QGraphicsScene object.
+ Removes and deletes all items from the scene object
+ before destroying the scene object. The scene object
+ is removed from the application's global scene list,
+ and it is removed from all associated views.
*/
QGraphicsScene::~QGraphicsScene()
{
@@ -2443,23 +2446,26 @@ void QGraphicsScene::destroyItemGroup(QGraphicsItemGroup *group)
}
/*!
- Adds or moves the item \a item and all its childen to the scene.
+ Adds or moves the \a item and all its childen to this scene.
+ This scene takes ownership of the \a item.
If the item is visible (i.e., QGraphicsItem::isVisible() returns
true), QGraphicsScene will emit changed() once control goes back
to the event loop.
- If the item is already in a different scene, it will first be removed from
- its old scene, and then added to this scene as a top-level.
+ If the item is already in a different scene, it will first be
+ removed from its old scene, and then added to this scene as a
+ top-level.
- QGraphicsScene will send ItemSceneChange notifications to \a item while
- it is added to the scene. If item does not currently belong to a scene, only one
- notification is sent. If it does belong to scene already (i.e., it is
- moved to this scene), QGraphicsScene will send an addition notification as
- the item is removed from its previous scene.
+ QGraphicsScene will send ItemSceneChange notifications to \a item
+ while it is added to the scene. If item does not currently belong
+ to a scene, only one notification is sent. If it does belong to
+ scene already (i.e., it is moved to this scene), QGraphicsScene
+ will send an addition notification as the item is removed from its
+ previous scene.
- If the item is a panel, the scene is active, and there is no active panel
- in the scene, then the item will be activated.
+ If the item is a panel, the scene is active, and there is no
+ active panel in the scene, then the item will be activated.
\sa removeItem(), addEllipse(), addLine(), addPath(), addPixmap(),
addRect(), addText(), addWidget(), {QGraphicsItem#Sorting}{Sorting}
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index ec8dd88..be1190b 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -696,7 +696,9 @@ bool QImageData::checkForAlphaPixels() const
/*!
\enum QImage::Format
- The following image formats are available in all versions of Qt:
+ The following image formats are available in Qt. Values greater
+ than QImage::Format_RGB16 were added in Qt 4.4. See the notes
+ after the table.
\value Format_Invalid The image is invalid.
\value Format_Mono The image is stored using 1-bit per pixel. Bytes are
@@ -705,17 +707,12 @@ bool QImageData::checkForAlphaPixels() const
packed with the less significant bit (LSB) first.
\value Format_Indexed8 The image is stored using 8-bit indexes
- into a colormap. \warning Drawing into a
- QImage with Indexed8 format is not
- supported.
+ into a colormap.
\value Format_RGB32 The image is stored using a 32-bit RGB format (0xffRRGGBB).
\value Format_ARGB32 The image is stored using a 32-bit ARGB
- format (0xAARRGGBB). \warning Do not
- render into ARGB32 images using
- QPainter. Format_ARGB32_Premultiplied is
- significantly faster.
+ format (0xAARRGGBB).
\value Format_ARGB32_Premultiplied The image is stored using a premultiplied 32-bit
ARGB format (0xAARRGGBB), i.e. the red,
@@ -744,6 +741,12 @@ bool QImageData::checkForAlphaPixels() const
\value Format_ARGB4444_Premultiplied The image is stored using a
premultiplied 16-bit ARGB format (4-4-4-4).
+ \note Drawing into a QImage with QImage::Format_Indexed8 is not
+ supported.
+
+ \note Do not render into ARGB32 images using QPainter. Using
+ QImage::Format_ARGB32_Premultiplied is significantly faster.
+
\sa format(), convertToFormat()
*/
diff --git a/src/gui/itemviews/qtableview.cpp b/src/gui/itemviews/qtableview.cpp
index d27e693..26f5a20 100644
--- a/src/gui/itemviews/qtableview.cpp
+++ b/src/gui/itemviews/qtableview.cpp
@@ -2359,12 +2359,22 @@ void QTableView::setColumnHidden(int column, bool hide)
\property QTableView::sortingEnabled
\brief whether sorting is enabled
- If this property is true, sorting is enabled for the table; if the
- property is false, sorting is not enabled. The default value is false.
+ If this property is true, sorting is enabled for the table. If
+ this property is false, sorting is not enabled. The default value
+ is false.
+
+ \note. Setting the property to true with setSortingEnabled()
+ immediately triggers a call to sortByColumn() with the current
+ sort section and order.
\sa sortByColumn()
*/
+/*!
+ If \a enabled true enables sorting for the table and immediately
+ trigger a call to sortByColumn() with the current sort section and
+ order
+ */
void QTableView::setSortingEnabled(bool enable)
{
Q_D(QTableView);
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index 4165c95..cdd0c1b 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -5230,6 +5230,8 @@ QInputContext *QApplication::inputContext() const
{
Q_D(const QApplication);
Q_UNUSED(d);// only static members being used.
+ if (QApplicationPrivate::is_app_closing)
+ return d->inputContext;
#ifdef Q_WS_X11
if (!X11)
return 0;
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 81f38ec..5c4cc74 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -11871,16 +11871,20 @@ void QWidget::ungrabGesture(Qt::GestureType gesture)
mouse when a mouse button is pressed and keeps it until the last
button is released.
- Note that only visible widgets can grab mouse input. If
- isVisible() returns false for a widget, that widget cannot call
- grabMouse().
+ \note Only visible widgets can grab mouse input. If isVisible()
+ returns false for a widget, that widget cannot call grabMouse().
+
+ \note \bold{(Mac OS X developers)} For \e Cocoa, calling
+ grabMouse() on a widget only works when the mouse is inside the
+ frame of that widget. For \e Carbon, it works outside the widget's
+ frame as well, like for Windows and X11.
\sa releaseMouse() grabKeyboard() releaseKeyboard()
*/
/*!
\fn void QWidget::grabMouse(const QCursor &cursor)
- \overload
+ \overload grabMouse()
Grabs the mouse input and changes the cursor shape.
@@ -11890,6 +11894,8 @@ void QWidget::ungrabGesture(Qt::GestureType gesture)
\warning Grabbing the mouse might lock the terminal.
+ \note \bold{(Mac OS X developers)} See the note in QWidget::grabMouse().
+
\sa releaseMouse(), grabKeyboard(), releaseKeyboard(), setCursor()
*/
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index 0213af9..69f1353 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -3671,6 +3671,7 @@ void QWidgetPrivate::raise_sys()
return;
#if QT_MAC_USE_COCOA
+ QMacCocoaAutoReleasePool pool;
if (isRealWindow()) {
// Calling orderFront shows the window on Cocoa too.
if (!q->testAttribute(Qt::WA_DontShowOnScreen) && q->isVisible()) {
diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp
index 0bc9cbc..f9db485 100644
--- a/src/gui/kernel/qwidget_x11.cpp
+++ b/src/gui/kernel/qwidget_x11.cpp
@@ -1084,7 +1084,7 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
} else {
// release previous focus information participating with
// preedit preservation of qic
- QInputContext *qic = inputContext();
+ QInputContext *qic = QApplicationPrivate::inputContext;
if (qic)
qic->widgetDestroyed(this);
}
diff --git a/src/gui/statemachine/qguistatemachine.cpp b/src/gui/statemachine/qguistatemachine.cpp
index 4f7806f..c3a9228 100644
--- a/src/gui/statemachine/qguistatemachine.cpp
+++ b/src/gui/statemachine/qguistatemachine.cpp
@@ -186,8 +186,10 @@ static QEvent *cloneEvent(QEvent *e)
case QEvent::DeactivateControl:
return new QEvent(*e);
+#ifndef QT_NO_CONTEXTMENU
case QEvent::ContextMenu:
return new QContextMenuEvent(*static_cast<QContextMenuEvent*>(e));
+#endif
case QEvent::InputMethod:
return new QInputMethodEvent(*static_cast<QInputMethodEvent*>(e));
case QEvent::AccessibilityPrepare:
diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp
index ce62834..f1dbf23 100644
--- a/src/gui/text/qtextcursor.cpp
+++ b/src/gui/text/qtextcursor.cpp
@@ -862,27 +862,28 @@ QTextLayout *QTextCursorPrivate::blockLayout(QTextBlock &block) const{
\ingroup richtext-processing
\ingroup shared
-
- Text cursors are objects that are used to access and modify the contents
- and underlying structure of text documents via a programming interface
- that mimics the behavior of a cursor in a text editor. QTextCursor contains
- information about both the cursor's position within a QTextDocument and any
- selection that it has made.
+ Text cursors are objects that are used to access and modify the
+ contents and underlying structure of text documents via a
+ programming interface that mimics the behavior of a cursor in a
+ text editor. QTextCursor contains information about both the
+ cursor's position within a QTextDocument and any selection that it
+ has made.
QTextCursor is modeled on the way a text cursor behaves in a text
- editor, providing a programmatic means of performing standard actions
- through the user interface. A document can be thought of as a
- single string of characters with the cursor's position() being \e
- between any two characters (or at the very beginning or very end
- of the document). Documents can also contain tables, lists,
- images, and other objects in addition to text but, from the developer's
- point of view, the document can be treated as one long string.
- Some portions of that string can be considered to lie within particular
- blocks (e.g. paragraphs), or within a table's cell, or a list's item,
- or other structural elements. When we refer to "current character" we
- mean the character immediately after the cursor position() in the
- document; similarly the "current block" is the block that contains the
- cursor position().
+ editor, providing a programmatic means of performing standard
+ actions through the user interface. A document can be thought of
+ as a single string of characters. The cursor's current position()
+ then is always either \e between two consecutive characters in the
+ string, or else \e before the very first character or \e after the
+ very last character in the string. Documents can also contain
+ tables, lists, images, and other objects in addition to text but,
+ from the developer's point of view, the document can be treated as
+ one long string. Some portions of that string can be considered
+ to lie within particular blocks (e.g. paragraphs), or within a
+ table's cell, or a list's item, or other structural elements. When
+ we refer to "current character" we mean the character immediately
+ \e before the cursor position() in the document. Similarly, the
+ "current block" is the block that contains the cursor position().
A QTextCursor also has an anchor() position. The text that is
between the anchor() and the position() is the selection. If
@@ -940,11 +941,12 @@ QTextLayout *QTextCursorPrivate::blockLayout(QTextBlock &block) const{
undo/redo) using beginEditBlock() and endEditBlock().
Cursor movements are limited to valid cursor positions. In Latin
- writing this is usually after every character in the text. In some
- other writing systems cursor movements are limited to "clusters"
- (e.g. a syllable in Devanagari, or a base letter plus diacritics).
- Functions such as movePosition() and deleteChar() limit cursor
- movement to these valid positions.
+ writing this is between any two consecutive characters in the
+ text, before the first character, or after the last character. In
+ some other writing systems cursor movements are limited to
+ "clusters" (e.g. a syllable in Devanagari, or a base letter plus
+ diacritics). Functions such as movePosition() and deleteChar()
+ limit cursor movement to these valid positions.
\sa \link richtext.html Rich Text Processing\endlink
@@ -1739,8 +1741,9 @@ void QTextCursor::mergeBlockCharFormat(const QTextCharFormat &modifier)
}
/*!
- Returns the format of the character immediately before the cursor position(). If the cursor is
- positioned at the beginning of a text block that is not empty then the format of the character
+ Returns the format of the character immediately before the cursor
+ position(). If the cursor is positioned at the beginning of a text
+ block that is not empty then the format of the character
immediately after the cursor is returned.
\sa insertText(), blockFormat()
diff --git a/src/gui/widgets/qmdiarea.cpp b/src/gui/widgets/qmdiarea.cpp
index f3dbe34..a4a4cb2 100644
--- a/src/gui/widgets/qmdiarea.cpp
+++ b/src/gui/widgets/qmdiarea.cpp
@@ -1853,11 +1853,11 @@ void QMdiArea::closeAllSubWindows()
}
/*!
- Gives the keyboard focus to the next window in the list of child
- windows. The windows are activated in the order in which they are
- created (CreationOrder).
+ Gives the keyboard focus to another window in the list of child
+ windows. The window activated will be the next one determined
+ by the current \l{QMdiArea::WindowOrder} {activation order}.
- \sa activatePreviousSubWindow()
+ \sa activatePreviousSubWindow(), QMdiArea::WindowOrder
*/
void QMdiArea::activateNextSubWindow()
{
@@ -1871,11 +1871,11 @@ void QMdiArea::activateNextSubWindow()
}
/*!
- Gives the keyboard focus to the previous window in the list of
- child windows. The windows are activated in the order in which
- they are created (CreationOrder).
+ Gives the keyboard focus to another window in the list of child
+ windows. The window activated will be the previous one determined
+ by the current \l{QMdiArea::WindowOrder} {activation order}.
- \sa activateNextSubWindow()
+ \sa activateNextSubWindow(), QMdiArea::WindowOrder
*/
void QMdiArea::activatePreviousSubWindow()
{
diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp
index 8b4f364..fda47bd 100644
--- a/src/network/socket/qabstractsocket.cpp
+++ b/src/network/socket/qabstractsocket.cpp
@@ -520,13 +520,13 @@ bool QAbstractSocketPrivate::initSocketLayer(QAbstractSocket::NetworkLayerProtoc
Q_Q(QAbstractSocket);
#if defined (QABSTRACTSOCKET_DEBUG)
QString typeStr;
- if (q->socketType() == QAbstractSocket::TcpSocket) typeStr = "TcpSocket";
- else if (q->socketType() == QAbstractSocket::UdpSocket) typeStr = "UdpSocket";
- else typeStr = "UnknownSocketType";
+ if (q->socketType() == QAbstractSocket::TcpSocket) typeStr = QLatin1String("TcpSocket");
+ else if (q->socketType() == QAbstractSocket::UdpSocket) typeStr = QLatin1String("UdpSocket");
+ else typeStr = QLatin1String("UnknownSocketType");
QString protocolStr;
- if (protocol == QAbstractSocket::IPv4Protocol) protocolStr = "IPv4Protocol";
- else if (protocol == QAbstractSocket::IPv6Protocol) protocolStr = "IPv6Protocol";
- else protocolStr = "UnknownNetworkLayerProtocol";
+ if (protocol == QAbstractSocket::IPv4Protocol) protocolStr = QLatin1String("IPv4Protocol");
+ else if (protocol == QAbstractSocket::IPv6Protocol) protocolStr = QLatin1String("IPv6Protocol");
+ else protocolStr = QLatin1String("UnknownNetworkLayerProtocol");
#endif
resetSocketLayer();
@@ -873,15 +873,19 @@ void QAbstractSocketPrivate::_q_startConnecting(const QHostInfo &hostInfo)
if (state != QAbstractSocket::HostLookupState)
return;
+ if (hostLookupId != -1 && hostLookupId != hostInfo.lookupId()) {
+ qWarning("QAbstractSocketPrivate::_q_startConnecting() received hostInfo for wrong lookup ID %d expected %d", hostInfo.lookupId(), hostLookupId);
+ }
+
addresses = hostInfo.addresses();
#if defined(QABSTRACTSOCKET_DEBUG)
- QString s = "{";
+ QString s = QLatin1String("{");
for (int i = 0; i < addresses.count(); ++i) {
- if (i != 0) s += ", ";
+ if (i != 0) s += QLatin1String(", ");
s += addresses.at(i).toString();
}
- s += '}';
+ s += QLatin1Char('}');
qDebug("QAbstractSocketPrivate::_q_startConnecting(hostInfo == %s)", s.toLatin1().constData());
#endif
diff --git a/src/network/socket/qhttpsocketengine.cpp b/src/network/socket/qhttpsocketengine.cpp
index 5c28318..635a0c6 100644
--- a/src/network/socket/qhttpsocketengine.cpp
+++ b/src/network/socket/qhttpsocketengine.cpp
@@ -212,28 +212,14 @@ qint64 QHttpSocketEngine::bytesAvailable() const
qint64 QHttpSocketEngine::read(char *data, qint64 maxlen)
{
Q_D(QHttpSocketEngine);
- qint64 bytesRead = 0;
-
- if (!d->readBuffer.isEmpty()) {
- // Read as much from the buffer as we can.
- bytesRead = qMin((qint64)d->readBuffer.size(), maxlen);
- memcpy(data, d->readBuffer.constData(), bytesRead);
- data += bytesRead;
- maxlen -= bytesRead;
- d->readBuffer = d->readBuffer.mid(bytesRead);
- }
-
- qint64 bytesReadFromSocket = d->socket->read(data, maxlen);
+ qint64 bytesRead = d->socket->read(data, maxlen);
if (d->socket->state() == QAbstractSocket::UnconnectedState
&& d->socket->bytesAvailable() == 0) {
emitReadNotification();
}
- if (bytesReadFromSocket > 0) {
- // Add to what we read so far.
- bytesRead += bytesReadFromSocket;
- } else if (bytesRead == 0 && bytesReadFromSocket == -1) {
+ if (bytesRead == -1) {
// If nothing has been read so far, and the direct socket read
// failed, return the socket's error. Otherwise, fall through and
// return as much as we read so far.
@@ -560,7 +546,7 @@ void QHttpSocketEngine::slotSocketReadNotification()
}
QHttpResponseHeader responseHeader(QString::fromLatin1(d->readBuffer));
- d->readBuffer.clear();
+ d->readBuffer.clear(); // we parsed the proxy protocol response. from now on direct socket reading will be done
int statusCode = responseHeader.statusCode();
if (statusCode == 200) {
diff --git a/src/network/socket/qhttpsocketengine_p.h b/src/network/socket/qhttpsocketengine_p.h
index 76430db..1432bfb 100644
--- a/src/network/socket/qhttpsocketengine_p.h
+++ b/src/network/socket/qhttpsocketengine_p.h
@@ -162,7 +162,7 @@ public:
QNetworkProxy proxy;
QString peerName;
QTcpSocket *socket;
- QByteArray readBuffer;
+ QByteArray readBuffer; // only used for parsing the proxy response
QHttpSocketEngine::HttpState state;
QAuthenticator authenticator;
bool readNotificationEnabled;
diff --git a/src/s60main/qts60main.cpp b/src/s60main/qts60main.cpp
index 8923fb9..de7d0be 100644
--- a/src/s60main/qts60main.cpp
+++ b/src/s60main/qts60main.cpp
@@ -15,24 +15,25 @@
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in the
-** documentation and/or other materials provided with the distribution.
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
** the names of its contributors may be used to endorse or promote
** products derived from this software without specific prior written
** permission.
**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-** IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-** PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-** LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-** NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/s60main/qts60main_mcrt0.cpp b/src/s60main/qts60main_mcrt0.cpp
index b9a720b..18c09e5 100644
--- a/src/s60main/qts60main_mcrt0.cpp
+++ b/src/s60main/qts60main_mcrt0.cpp
@@ -15,24 +15,25 @@
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in the
-** documentation and/or other materials provided with the distribution.
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
** the names of its contributors may be used to endorse or promote
** products derived from this software without specific prior written
** permission.
**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-** IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-** PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-** LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-** NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/xmlpatterns/api/qcoloroutput.cpp b/src/xmlpatterns/api/qcoloroutput.cpp
index 4f27fd5..abfa656 100644
--- a/src/xmlpatterns/api/qcoloroutput.cpp
+++ b/src/xmlpatterns/api/qcoloroutput.cpp
@@ -153,51 +153,56 @@ const char *const ColorOutputPrivate::backgrounds[] =
};
/*!
- \since 4.4
- \nonreentrant
- \brief Outputs colored messages to \c stderr.
- \internal
-
- ColorOutput is a convenience class for outputting messages to \c stderr
- using color escape codes, as mandated in ECMA-48. ColorOutput will only
- color output when it is detected to be suitable. For instance, if \c stderr is
- detected to be attached to a file instead of a TTY, no coloring will be done.
-
- ColorOutput does its best attempt. but it is generally undefined what coloring
- or effect the various coloring flags has. It depends strongly on what terminal
- software that is being used.
-
- When using `echo -e 'my escape sequence'`, \033 works as an initiator but not
- when printing from a C++ program, despite having escaped the backslash.
- That's why we below use characters with value 0x1B.
-
- It can be convenient to subclass ColorOutput with a private scope, such that the
- functions are directly available in the class using it.
-
- \section1 Usage
-
- To output messages, call write() or writeUncolored(). write() takes as second
- argument an integer, which ColorOutput uses as a lookup key to find the color
- it should color the text in. The mapping from keys to colors is done using
- insertMapping(). Typically this is used by having enums for the various kinds
- of messages, which subsequently are registered.
-
- \code
- enum MyMessage
- {
+ \class ColorOutput
+ \since 4.4
+ \nonreentrant
+ \brief Outputs colored messages to \c stderr.
+ \internal
+
+ ColorOutput is a convenience class for outputting messages to \c
+ stderr using color escape codes, as mandated in ECMA-48. ColorOutput
+ will only color output when it is detected to be suitable. For
+ instance, if \c stderr is detected to be attached to a file instead
+ of a TTY, no coloring will be done.
+
+ ColorOutput does its best attempt. but it is generally undefined
+ what coloring or effect the various coloring flags has. It depends
+ strongly on what terminal software that is being used.
+
+ When using `echo -e 'my escape sequence'`, \c{\033} works as an
+ initiator but not when printing from a C++ program, despite having
+ escaped the backslash. That's why we below use characters with
+ value 0x1B.
+
+ It can be convenient to subclass ColorOutput with a private scope,
+ such that the functions are directly available in the class using
+ it.
+
+ \section1 Usage
+
+ To output messages, call write() or writeUncolored(). write() takes
+ as second argument an integer, which ColorOutput uses as a lookup
+ key to find the color it should color the text in. The mapping from
+ keys to colors is done using insertMapping(). Typically this is used
+ by having enums for the various kinds of messages, which
+ subsequently are registered.
+
+ \code
+ enum MyMessage
+ {
Error,
Important
- };
+ };
- ColorOutput output;
- output.insertMapping(Error, ColorOutput::RedForeground);
- output.insertMapping(Import, ColorOutput::BlueForeground);
+ ColorOutput output;
+ output.insertMapping(Error, ColorOutput::RedForeground);
+ output.insertMapping(Import, ColorOutput::BlueForeground);
- output.write("This is important", Important);
- output.write("Jack, I'm only the selected official!", Error);
- \endcode
+ output.write("This is important", Important);
+ output.write("Jack, I'm only the selected official!", Error);
+ \endcode
- \sa {http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html} {Bash Prompt HOWTO, 6.1. Colours}
+ \sa {http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html} {Bash Prompt HOWTO, 6.1. Colours}
{http://linuxgazette.net/issue51/livingston-blade.html} {Linux Gazette, Tweaking Eterm, Edward Livingston-Blade}
{http://www.ecma-international.org/publications/standards/Ecma-048.htm} {Standard ECMA-48, Control Functions for Coded Character Sets, ECMA International},
{http://en.wikipedia.org/wiki/ANSI_escape_code} {Wikipedia, ANSI escape code}
@@ -205,10 +210,34 @@ const char *const ColorOutputPrivate::backgrounds[] =
*/
/*!
- \enum ColorOutput::ColorCode
-
- \value DefaultColor ColorOutput performs no coloring. This typically means black on white
- or white on black, depending on the settings of the user's terminal.
+ \enum ColorOutput::ColorCodeComponent
+ \value BlackForeground
+ \value BlueForeground
+ \value GreenForeground
+ \value CyanForeground
+ \value RedForeground
+ \value PurpleForeground
+ \value BrownForeground
+ \value LightGrayForeground
+ \value DarkGrayForeground
+ \value LightBlueForeground
+ \value LightGreenForeground
+ \value LightCyanForeground
+ \value LightRedForeground
+ \value LightPurpleForeground
+ \value YellowForeground
+ \value WhiteForeground
+ \value BlackBackground
+ \value BlueBackground
+ \value GreenBackground
+ \value CyanBackground
+ \value RedBackground
+ \value PurpleBackground
+ \value BrownBackground
+
+ \value DefaultColor ColorOutput performs no coloring. This typically
+ means black on white or white on black, depending
+ on the settings of the user's terminal.
*/
/*!
diff --git a/tests/auto/qfile/tst_qfile.cpp b/tests/auto/qfile/tst_qfile.cpp
index 2b2f431..e88c222 100644
--- a/tests/auto/qfile/tst_qfile.cpp
+++ b/tests/auto/qfile/tst_qfile.cpp
@@ -129,6 +129,8 @@ private slots:
void readLine();
void readLine2();
void readLineNullInLine();
+ void readAll_data();
+ void readAll();
void readAllStdin();
void readLineStdin();
void readLineStdin_lineByLine();
@@ -752,6 +754,45 @@ void tst_QFile::readLineNullInLine()
QCOMPARE(file.readLine(), QByteArray());
}
+void tst_QFile::readAll_data()
+{
+ QTest::addColumn<bool>("textMode");
+ QTest::addColumn<QString>("fileName");
+ QTest::newRow( "TextMode unixfile" ) << true << SRCDIR "testfile.txt";
+ QTest::newRow( "BinaryMode unixfile" ) << false << SRCDIR "testfile.txt";
+ QTest::newRow( "TextMode dosfile" ) << true << SRCDIR "dosfile.txt";
+ QTest::newRow( "BinaryMode dosfile" ) << false << SRCDIR "dosfile.txt";
+ QTest::newRow( "TextMode bigfile" ) << true << SRCDIR "tst_qfile.cpp";
+ QTest::newRow( "BinaryMode bigfile" ) << false << SRCDIR "tst_qfile.cpp";
+ QVERIFY(QFile(SRCDIR "tst_qfile.cpp").size() > 64*1024);
+}
+
+void tst_QFile::readAll()
+{
+ QFETCH( bool, textMode );
+ QFETCH( QString, fileName );
+
+ QFile file(fileName);
+ if (textMode)
+ QVERIFY(file.open(QFile::Text | QFile::ReadOnly));
+ else
+ QVERIFY(file.open(QFile::ReadOnly));
+
+ QByteArray a = file.readAll();
+ file.reset();
+ QVERIFY(file.pos() == 0);
+
+ QVERIFY(file.bytesAvailable() > 7);
+ QByteArray b = file.read(1);
+ char x;
+ file.getChar(&x);
+ b.append(x);
+ b.append(file.read(5));
+ b.append(file.readAll());
+
+ QCOMPARE(a, b);
+}
+
void tst_QFile::readAllStdin()
{
#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
diff --git a/tests/auto/qftp/tst_qftp.cpp b/tests/auto/qftp/tst_qftp.cpp
index 27c2e13..9c1670d 100644
--- a/tests/auto/qftp/tst_qftp.cpp
+++ b/tests/auto/qftp/tst_qftp.cpp
@@ -51,9 +51,6 @@
#include <stdlib.h>
#include <QNetworkProxy>
-#ifndef TEST_QNETWORK_PROXY
-#define TEST_QNETWORK_PROXY
-#endif
#include "../network-settings.h"
//TESTED_CLASS=
@@ -202,11 +199,9 @@ void tst_QFtp::initTestCase_data()
QTest::addColumn<int>("proxyType");
QTest::newRow("WithoutProxy") << false << 0;
-#ifdef TEST_QNETWORK_PROXY
QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy);
//### doesn't work well yet.
//QTest::newRow("WithHttpProxy") << true << int(QNetworkProxy::HttpProxy);
-#endif
}
void tst_QFtp::initTestCase()
diff --git a/tests/auto/qhttp/tst_qhttp.cpp b/tests/auto/qhttp/tst_qhttp.cpp
index b4b6ceb..92ab3d8 100644
--- a/tests/auto/qhttp/tst_qhttp.cpp
+++ b/tests/auto/qhttp/tst_qhttp.cpp
@@ -57,9 +57,6 @@
# include <qsslsocket.h>
#endif
-#ifndef TEST_QNETWORK_PROXY
-#define TEST_QNETWORK_PROXY
-#endif
#include "../network-settings.h"
//TESTED_CLASS=
@@ -198,9 +195,7 @@ void tst_QHttp::initTestCase_data()
QTest::addColumn<int>("proxyType");
QTest::newRow("WithoutProxy") << false << 0;
-#ifdef TEST_QNETWORK_PROXY
QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy);
-#endif
}
void tst_QHttp::initTestCase()
diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp
index 169a688..09c8c5f 100644
--- a/tests/auto/qsslsocket/tst_qsslsocket.cpp
+++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp
@@ -51,13 +51,8 @@
#include <QtNetwork/qtcpserver.h>
#include <QtTest/QtTest>
-#ifndef TEST_QNETWORK_PROXY
-#define TEST_QNETWORK_PROXY
-#endif
-#ifdef TEST_QNETWORK_PROXY
#include <QNetworkProxy>
#include <QAuthenticator>
-#endif
#include "../network-settings.h"
@@ -253,7 +248,6 @@ void tst_QSslSocket::initTestCase_data()
QTest::addColumn<int>("proxyType");
QTest::newRow("WithoutProxy") << false << 0;
-#ifdef TEST_QNETWORK_PROXY
QTest::newRow("WithSocks5Proxy") << true << int(Socks5Proxy);
QTest::newRow("WithSocks5ProxyAuth") << true << int(Socks5Proxy | AuthBasic);
@@ -261,14 +255,12 @@ void tst_QSslSocket::initTestCase_data()
QTest::newRow("WithHttpProxyBasicAuth") << true << int(HttpProxy | AuthBasic);
// uncomment the line below when NTLM works
// QTest::newRow("WithHttpProxyNtlmAuth") << true << int(HttpProxy | AuthNtlm);
-#endif
}
void tst_QSslSocket::init()
{
QFETCH_GLOBAL(bool, setProxy);
if (setProxy) {
-#ifdef TEST_QNETWORK_PROXY
QFETCH_GLOBAL(int, proxyType);
QString fluke = QHostInfo::fromName(QtNetworkSettings::serverName()).addresses().first().toString();
QNetworkProxy proxy;
@@ -295,15 +287,12 @@ void tst_QSslSocket::init()
break;
}
QNetworkProxy::setApplicationProxy(proxy);
-#endif
}
}
void tst_QSslSocket::cleanup()
{
-#ifdef TEST_QNETWORK_PROXY
QNetworkProxy::setApplicationProxy(QNetworkProxy::DefaultProxy);
-#endif
}
#ifndef QT_NO_OPENSSL
diff --git a/tests/auto/qtcpserver/test/test.pro b/tests/auto/qtcpserver/test/test.pro
index bdeaa92..123c79e 100644
--- a/tests/auto/qtcpserver/test/test.pro
+++ b/tests/auto/qtcpserver/test/test.pro
@@ -32,7 +32,5 @@ QT = core network
MOC_DIR=tmp
-DEFINES += TEST_QNETWORK_PROXY
-
diff --git a/tests/auto/qtcpserver/tst_qtcpserver.cpp b/tests/auto/qtcpserver/tst_qtcpserver.cpp
index 8b86111..4567435 100644
--- a/tests/auto/qtcpserver/tst_qtcpserver.cpp
+++ b/tests/auto/qtcpserver/tst_qtcpserver.cpp
@@ -66,11 +66,9 @@
#include <qplatformdefs.h>
#include <qhostinfo.h>
-#ifdef TEST_QNETWORK_PROXY
-# include <QNetworkProxy>
+#include <QNetworkProxy>
Q_DECLARE_METATYPE(QNetworkProxy)
Q_DECLARE_METATYPE(QList<QNetworkProxy>)
-#endif
#include "../network-settings.h"
@@ -95,9 +93,6 @@ private slots:
void constructing();
void clientServerLoop();
void ipv6Server();
- void ipv4LoopbackPerformanceTest();
- void ipv6LoopbackPerformanceTest();
- void ipv4PerformanceTest();
void crashTests();
void maxPendingConnections();
void listenError();
@@ -106,12 +101,10 @@ private slots:
void listenWhileListening();
void addressReusable();
void setNewSocketDescriptorBlocking();
-#ifdef TEST_QNETWORK_PROXY
void invalidProxy_data();
void invalidProxy();
void proxyFactory_data();
void proxyFactory();
-#endif
};
// Testing get/set functions
@@ -143,29 +136,23 @@ void tst_QTcpServer::initTestCase_data()
QTest::addColumn<int>("proxyType");
QTest::newRow("WithoutProxy") << false << 0;
-#ifdef TEST_QNETWORK_PROXY
QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy);
-#endif
}
void tst_QTcpServer::init()
{
QFETCH_GLOBAL(bool, setProxy);
if (setProxy) {
-#ifdef TEST_QNETWORK_PROXY
QFETCH_GLOBAL(int, proxyType);
if (proxyType == QNetworkProxy::Socks5Proxy) {
QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1080));
}
-#endif
}
}
void tst_QTcpServer::cleanup()
{
-#ifdef TEST_QNETWORK_PROXY
QNetworkProxy::setApplicationProxy(QNetworkProxy::DefaultProxy);
-#endif
}
//----------------------------------------------------------------------------------
@@ -258,159 +245,6 @@ void tst_QTcpServer::ipv6Server()
}
//----------------------------------------------------------------------------------
-void tst_QTcpServer::ipv4LoopbackPerformanceTest()
-{
- QFETCH_GLOBAL(bool, setProxy);
- if (setProxy)
- return;
-
- QTcpServer server;
- QVERIFY(server.listen(QHostAddress::LocalHost));
-
- QVERIFY(server.isListening());
-
- QTcpSocket clientA;
- clientA.connectToHost(QHostAddress::LocalHost, server.serverPort());
- QVERIFY(clientA.waitForConnected(5000));
- QVERIFY(clientA.state() == QAbstractSocket::ConnectedState);
-
- QVERIFY(server.waitForNewConnection());
- QTcpSocket *clientB = server.nextPendingConnection();
- QVERIFY(clientB);
-
- QByteArray buffer(16384, '@');
- QTime stopWatch;
- stopWatch.start();
- qlonglong totalWritten = 0;
- while (stopWatch.elapsed() < 5000) {
- QVERIFY(clientA.write(buffer.data(), buffer.size()) > 0);
- clientA.flush();
- totalWritten += buffer.size();
- while (clientB->waitForReadyRead(100)) {
- if (clientB->bytesAvailable() == 16384)
- break;
- }
- clientB->read(buffer.data(), buffer.size());
- clientB->write(buffer.data(), buffer.size());
- clientB->flush();
- totalWritten += buffer.size();
- while (clientA.waitForReadyRead(100)) {
- if (clientA.bytesAvailable() == 16384)
- break;
- }
- clientA.read(buffer.data(), buffer.size());
- }
-
- qDebug("\t\t%s: %.1fMB/%.1fs: %.1fMB/s",
- server.serverAddress().toString().toLatin1().constData(),
- totalWritten / (1024.0 * 1024.0),
- stopWatch.elapsed() / 1000.0,
- (totalWritten / (stopWatch.elapsed() / 1000.0)) / (1024 * 1024));
-
- delete clientB;
-}
-
-//----------------------------------------------------------------------------------
-void tst_QTcpServer::ipv6LoopbackPerformanceTest()
-{
-#if defined(Q_OS_SYMBIAN)
- QSKIP("Symbian: IPv6 is not yet supported", SkipAll);
-#endif
- QTcpServer server;
- if (!server.listen(QHostAddress::LocalHostIPv6, 0)) {
- QVERIFY(server.serverError() == QAbstractSocket::UnsupportedSocketOperationError);
- } else {
- QTcpSocket clientA;
- clientA.connectToHost(server.serverAddress(), server.serverPort());
- QVERIFY(clientA.waitForConnected(5000));
-
- QVERIFY(server.waitForNewConnection(5000));
- QTcpSocket *clientB = server.nextPendingConnection();
- QVERIFY(clientB);
-
- QByteArray buffer(16384, '@');
- QTime stopWatch;
- stopWatch.start();
- qlonglong totalWritten = 0;
- while (stopWatch.elapsed() < 5000) {
- clientA.write(buffer.data(), buffer.size());
- clientA.flush();
- totalWritten += buffer.size();
- while (clientB->waitForReadyRead(100)) {
- if (clientB->bytesAvailable() == 16384)
- break;
- }
- clientB->read(buffer.data(), buffer.size());
- clientB->write(buffer.data(), buffer.size());
- clientB->flush();
- totalWritten += buffer.size();
- while (clientA.waitForReadyRead(100)) {
- if (clientA.bytesAvailable() == 16384)
- break;
- }
- clientA.read(buffer.data(), buffer.size());
- }
-
- qDebug("\t\t%s: %.1fMB/%.1fs: %.1fMB/s",
- server.serverAddress().toString().toLatin1().constData(),
- totalWritten / (1024.0 * 1024.0),
- stopWatch.elapsed() / 1000.0,
- (totalWritten / (stopWatch.elapsed() / 1000.0)) / (1024 * 1024));
- delete clientB;
- }
-}
-
-//----------------------------------------------------------------------------------
-void tst_QTcpServer::ipv4PerformanceTest()
-{
- QTcpSocket probeSocket;
- probeSocket.connectToHost(QtNetworkSettings::serverName(), 143);
- QVERIFY(probeSocket.waitForConnected(5000));
-
- QTcpServer server;
- QVERIFY(server.listen(probeSocket.localAddress(), 0));
-
- QTcpSocket clientA;
- clientA.connectToHost(server.serverAddress(), server.serverPort());
- QVERIFY(clientA.waitForConnected(5000));
-
- QVERIFY(server.waitForNewConnection(5000));
- QTcpSocket *clientB = server.nextPendingConnection();
- QVERIFY(clientB);
-
- QByteArray buffer(16384, '@');
- QTime stopWatch;
- stopWatch.start();
- qlonglong totalWritten = 0;
- while (stopWatch.elapsed() < 5000) {
- qlonglong writtenA = clientA.write(buffer.data(), buffer.size());
- clientA.flush();
- totalWritten += buffer.size();
- while (clientB->waitForReadyRead(100)) {
- if (clientB->bytesAvailable() == writtenA)
- break;
- }
- clientB->read(buffer.data(), buffer.size());
- qlonglong writtenB = clientB->write(buffer.data(), buffer.size());
- clientB->flush();
- totalWritten += buffer.size();
- while (clientA.waitForReadyRead(100)) {
- if (clientA.bytesAvailable() == writtenB)
- break;
- }
- clientA.read(buffer.data(), buffer.size());
- }
-
- qDebug("\t\t%s: %.1fMB/%.1fs: %.1fMB/s",
- probeSocket.localAddress().toString().toLatin1().constData(),
- totalWritten / (1024.0 * 1024.0),
- stopWatch.elapsed() / 1000.0,
- (totalWritten / (stopWatch.elapsed() / 1000.0)) / (1024 * 1024));
-
- delete clientB;
-}
-
-//----------------------------------------------------------------------------------
void tst_QTcpServer::crashTests()
{
QTcpServer server;
@@ -423,12 +257,10 @@ void tst_QTcpServer::maxPendingConnections()
{
QFETCH_GLOBAL(bool, setProxy);
if (setProxy) {
-#ifdef TEST_QNETWORK_PROXY
QFETCH_GLOBAL(int, proxyType);
if (proxyType == QNetworkProxy::Socks5Proxy) {
QSKIP("With socks5 only 1 connection is allowed ever", SkipAll);
}
-#endif
}
//### sees to fail sometimes ... a timing issue with the test on windows
QTcpServer server;
@@ -464,12 +296,10 @@ void tst_QTcpServer::listenError()
{
QFETCH_GLOBAL(bool, setProxy);
if (setProxy) {
-#ifdef TEST_QNETWORK_PROXY
QFETCH_GLOBAL(int, proxyType);
if (proxyType == QNetworkProxy::Socks5Proxy) {
QSKIP("With socks5 we can not make hard requirements on the address or port", SkipAll);
}
-#endif
}
QTcpServer server;
QVERIFY(!server.listen(QHostAddress("1.2.3.4"), 0));
@@ -513,12 +343,10 @@ void tst_QTcpServer::waitForConnectionTest()
QFETCH_GLOBAL(bool, setProxy);
if (setProxy) {
-#ifdef TEST_QNETWORK_PROXY
QFETCH_GLOBAL(int, proxyType);
if (proxyType == QNetworkProxy::Socks5Proxy) {
QSKIP("Localhost servers don't work well with SOCKS5", SkipAll);
}
-#endif
}
QTcpSocket findLocalIpSocket;
@@ -624,12 +452,10 @@ void tst_QTcpServer::addressReusable()
QFETCH_GLOBAL(bool, setProxy);
if (setProxy) {
-#ifdef TEST_QNETWORK_PROXY
QFETCH_GLOBAL(int, proxyType);
if (proxyType == QNetworkProxy::Socks5Proxy) {
QSKIP("With socks5 this test does not make senans at the momment", SkipAll);
}
-#endif
}
#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
QString signalName = QString::fromLatin1("/test_signal.txt");
@@ -667,12 +493,10 @@ void tst_QTcpServer::setNewSocketDescriptorBlocking()
{
QFETCH_GLOBAL(bool, setProxy);
if (setProxy) {
-#ifdef TEST_QNETWORK_PROXY
QFETCH_GLOBAL(int, proxyType);
if (proxyType == QNetworkProxy::Socks5Proxy) {
QSKIP("With socks5 we can not make the socket descripter blocking", SkipAll);
}
-#endif
}
SeverWithBlockingSockets server;
QVERIFY(server.listen());
@@ -683,7 +507,6 @@ void tst_QTcpServer::setNewSocketDescriptorBlocking()
QVERIFY(server.ok);
}
-#ifdef TEST_QNETWORK_PROXY
void tst_QTcpServer::invalidProxy_data()
{
QTest::addColumn<int>("type");
@@ -838,7 +661,6 @@ void tst_QTcpServer::proxyFactory()
// Sometimes, error codes change for the better
QTEST(int(server.serverError()), "expectedError");
}
-#endif
QTEST_MAIN(tst_QTcpServer)
#include "tst_qtcpserver.moc"
diff --git a/tests/auto/qtcpsocket/test/test.pro b/tests/auto/qtcpsocket/test/test.pro
index 0f93def..c4369df 100644
--- a/tests/auto/qtcpsocket/test/test.pro
+++ b/tests/auto/qtcpsocket/test/test.pro
@@ -13,8 +13,6 @@ vxworks:QT -= gui
symbian: TARGET.EPOCHEAPSIZE="0x100 0x1000000"
-#DEFINES += TEST_QNETWORK_PROXY
-
TARGET = tst_qtcpsocket
win32 {
diff --git a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp
index 863b8f5..c6d39ba 100644
--- a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp
+++ b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp
@@ -82,9 +82,6 @@
#include <QTime>
#include <QTimer>
#include <QDebug>
-#ifndef TEST_QNETWORK_PROXY
-#define TEST_QNETWORK_PROXY
-#endif
// RVCT compiles also unused inline methods
# include <QNetworkProxy>
@@ -194,12 +191,11 @@ private slots:
void increaseReadBufferSize();
void taskQtBug5799ConnectionErrorWaitForConnected();
void taskQtBug5799ConnectionErrorEventLoop();
-#ifdef TEST_QNETWORK_PROXY
+
void invalidProxy_data();
void invalidProxy();
void proxyFactory_data();
void proxyFactory();
-#endif
protected slots:
void nonBlockingIMAP_hostFound();
@@ -270,17 +266,15 @@ void tst_QTcpSocket::initTestCase_data()
qDebug() << QtNetworkSettings::serverName();
QTest::newRow("WithoutProxy") << false << 0 << false;
-#ifdef TEST_QNETWORK_PROXY
QTest::newRow("WithSocks5Proxy") << true << int(Socks5Proxy) << false;
QTest::newRow("WithSocks5ProxyAuth") << true << int(Socks5Proxy | AuthBasic) << false;
QTest::newRow("WithHttpProxy") << true << int(HttpProxy) << false;
QTest::newRow("WithHttpProxyBasicAuth") << true << int(HttpProxy | AuthBasic) << false;
// QTest::newRow("WithHttpProxyNtlmAuth") << true << int(HttpProxy | AuthNtlm) << false;
-#endif
+
#ifndef QT_NO_OPENSSL
QTest::newRow("WithoutProxy SSL") << false << 0 << true;
-#ifdef TEST_QNETWORK_PROXY
QTest::newRow("WithSocks5Proxy SSL") << true << int(Socks5Proxy) << true;
QTest::newRow("WithSocks5AuthProxy SSL") << true << int(Socks5Proxy | AuthBasic) << true;
@@ -288,14 +282,12 @@ void tst_QTcpSocket::initTestCase_data()
QTest::newRow("WithHttpProxyBasicAuth SSL") << true << int(HttpProxy | AuthBasic) << true;
// QTest::newRow("WithHttpProxyNtlmAuth SSL") << true << int(HttpProxy | AuthNtlm) << true;
#endif
-#endif
}
void tst_QTcpSocket::init()
{
QFETCH_GLOBAL(bool, setProxy);
if (setProxy) {
-#ifdef TEST_QNETWORK_PROXY
QFETCH_GLOBAL(int, proxyType);
QString fluke = QHostInfo::fromName(QtNetworkSettings::serverName()).addresses().first().toString();
QNetworkProxy proxy;
@@ -322,7 +314,6 @@ void tst_QTcpSocket::init()
break;
}
QNetworkProxy::setApplicationProxy(proxy);
-#endif
}
}
@@ -345,9 +336,7 @@ QTcpSocket *tst_QTcpSocket::newSocket() const
void tst_QTcpSocket::cleanup()
{
-#ifdef TEST_QNETWORK_PROXY
QNetworkProxy::setApplicationProxy(QNetworkProxy::DefaultProxy);
-#endif
}
void tst_QTcpSocket::proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *auth)
@@ -1322,9 +1311,7 @@ void tst_QTcpSocket::synchronousApi()
void tst_QTcpSocket::dontCloseOnTimeout()
{
QTcpServer server;
-#ifdef TEST_QNETWORK_PROXY
server.setProxy(QNetworkProxy(QNetworkProxy::NoProxy));
-#endif
QVERIFY(server.listen());
QHostAddress serverAddress = QHostAddress::LocalHost;
@@ -1793,9 +1780,6 @@ void tst_QTcpSocket::readyReadSignalsAfterWaitForReadyRead()
QCOMPARE(readyReadSpy.count(), 1);
QString s = socket->readLine();
-#ifdef TEST_QNETWORK_PROXY
- QNetworkProxy::ProxyType proxyType = QNetworkProxy::applicationProxy().type();
-#endif
QCOMPARE(s.toLatin1().constData(), QtNetworkSettings::expectedReplyIMAP().constData());
QCOMPARE(socket->bytesAvailable(), qint64(0));
@@ -2252,9 +2236,6 @@ void tst_QTcpSocket::taskQtBug5799ConnectionErrorEventLoop()
QString("Could not reach server: %1").arg(socket.errorString()).toLocal8Bit());
}
-
-
-#ifdef TEST_QNETWORK_PROXY
void tst_QTcpSocket::invalidProxy_data()
{
QTest::addColumn<int>("type");
@@ -2433,7 +2414,6 @@ void tst_QTcpSocket::proxyFactory()
delete socket;
}
-#endif
QTEST_MAIN(tst_QTcpSocket)
diff --git a/tests/auto/qudpsocket/test/test.pro b/tests/auto/qudpsocket/test/test.pro
index 2e0a020..44d3d30 100644
--- a/tests/auto/qudpsocket/test/test.pro
+++ b/tests/auto/qudpsocket/test/test.pro
@@ -3,7 +3,6 @@ SOURCES += ../tst_qudpsocket.cpp
QT = core network
MOC_DIR=tmp
-DEFINES += TEST_QNETWORK_PROXY
win32 {
CONFIG(debug, debug|release) {
diff --git a/tests/auto/qudpsocket/tst_qudpsocket.cpp b/tests/auto/qudpsocket/tst_qudpsocket.cpp
index 160d74c..e3ab9bc 100644
--- a/tests/auto/qudpsocket/tst_qudpsocket.cpp
+++ b/tests/auto/qudpsocket/tst_qudpsocket.cpp
@@ -49,10 +49,7 @@
#include <qhostaddress.h>
#include <qhostinfo.h>
#include <qmap.h>
-#ifdef TEST_QNETWORK_PROXY
-# include <QNetworkProxy>
-#endif
-
+#include <QNetworkProxy>
#include <qstringlist.h>
#include "../network-settings.h"
@@ -118,32 +115,23 @@ void tst_QUdpSocket::initTestCase_data()
QTest::addColumn<int>("proxyType");
QTest::newRow("WithoutProxy") << false << 0;
-#ifdef TEST_QNETWORK_PROXY
QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy);
-#endif
}
void tst_QUdpSocket::init()
{
QFETCH_GLOBAL(bool, setProxy);
if (setProxy) {
-#ifdef TEST_QNETWORK_PROXY
QFETCH_GLOBAL(int, proxyType);
if (proxyType == QNetworkProxy::Socks5Proxy) {
QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1080));
}
-#endif
}
}
void tst_QUdpSocket::cleanup()
{
- QFETCH_GLOBAL(bool, setProxy);
- if (setProxy) {
-#ifdef TEST_QNETWORK_PROXY
QNetworkProxy::setApplicationProxy(QNetworkProxy::DefaultProxy);
-#endif
- }
}
@@ -204,12 +192,10 @@ void tst_QUdpSocket::broadcasting()
{
QFETCH_GLOBAL(bool, setProxy);
if (setProxy) {
-#ifdef TEST_QNETWORK_PROXY
QFETCH_GLOBAL(int, proxyType);
if (proxyType == QNetworkProxy::Socks5Proxy) {
QSKIP("With socks5 Broadcast is not supported.", SkipSingle);
}
-#endif
}
#ifdef Q_OS_AIX
QSKIP("Broadcast does not work on darko", SkipAll);
@@ -539,12 +525,10 @@ void tst_QUdpSocket::bindMode()
{
QFETCH_GLOBAL(bool, setProxy);
if (setProxy) {
-#ifdef TEST_QNETWORK_PROXY
QFETCH_GLOBAL(int, proxyType);
if (proxyType == QNetworkProxy::Socks5Proxy) {
QSKIP("With socks5 explicit port binding is not supported.", SkipAll);
}
-#endif
}
QUdpSocket socket;
diff --git a/tests/benchmarks/benchmarks.pro b/tests/benchmarks/benchmarks.pro
index 0f760a1..7bb4bb1 100644
--- a/tests/benchmarks/benchmarks.pro
+++ b/tests/benchmarks/benchmarks.pro
@@ -37,6 +37,7 @@ SUBDIRS = containers-associative \
qstringbuilder \
qstylesheetstyle \
qsvgrenderer \
+ qtcpserver \
qtableview \
qthreadstorage
diff --git a/tests/benchmarks/qhostinfo/main.cpp b/tests/benchmarks/qhostinfo/main.cpp
index 389443b..80d0fd8 100644
--- a/tests/benchmarks/qhostinfo/main.cpp
+++ b/tests/benchmarks/qhostinfo/main.cpp
@@ -7,11 +7,11 @@
** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
-** Commercial Usage
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Nokia.
+** 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
@@ -25,19 +25,21 @@
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
+
+
#include <QDebug>
#include <QHostInfo>
#include <QStringList>
diff --git a/tests/benchmarks/qtcpserver/qtcpserver.pro b/tests/benchmarks/qtcpserver/qtcpserver.pro
new file mode 100644
index 0000000..e7bf13a
--- /dev/null
+++ b/tests/benchmarks/qtcpserver/qtcpserver.pro
@@ -0,0 +1,13 @@
+load(qttest_p4)
+TEMPLATE = app
+TARGET = tst_qtcpserver
+DEPENDPATH += .
+INCLUDEPATH += .
+
+QT -= gui
+QT += network
+
+CONFIG += release
+
+# Input
+SOURCES += tst_qtcpserver.cpp
diff --git a/tests/benchmarks/qtcpserver/tst_qtcpserver.cpp b/tests/benchmarks/qtcpserver/tst_qtcpserver.cpp
new file mode 100644
index 0000000..07640b8
--- /dev/null
+++ b/tests/benchmarks/qtcpserver/tst_qtcpserver.cpp
@@ -0,0 +1,277 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+// Just to get Q_OS_SYMBIAN
+#include <qglobal.h>
+
+#include <QtTest/QtTest>
+
+
+#include <qcoreapplication.h>
+#include <qtcpsocket.h>
+#include <qtcpserver.h>
+#include <qhostaddress.h>
+#include <qprocess.h>
+#include <qstringlist.h>
+#include <qplatformdefs.h>
+#include <qhostinfo.h>
+
+#include <QNetworkProxy>
+Q_DECLARE_METATYPE(QNetworkProxy)
+Q_DECLARE_METATYPE(QList<QNetworkProxy>)
+
+#include "../../auto/network-settings.h"
+
+//TESTED_CLASS=
+//TESTED_FILES=
+
+class tst_QTcpServer : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QTcpServer();
+ virtual ~tst_QTcpServer();
+
+
+public slots:
+ void initTestCase_data();
+ void init();
+ void cleanup();
+private slots:
+ void ipv4LoopbackPerformanceTest();
+ void ipv6LoopbackPerformanceTest();
+ void ipv4PerformanceTest();
+};
+
+tst_QTcpServer::tst_QTcpServer()
+{
+ Q_SET_DEFAULT_IAP
+}
+
+tst_QTcpServer::~tst_QTcpServer()
+{
+}
+
+void tst_QTcpServer::initTestCase_data()
+{
+ QTest::addColumn<bool>("setProxy");
+ QTest::addColumn<int>("proxyType");
+
+ QTest::newRow("WithoutProxy") << false << 0;
+ QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy);
+}
+
+void tst_QTcpServer::init()
+{
+ QFETCH_GLOBAL(bool, setProxy);
+ if (setProxy) {
+ QFETCH_GLOBAL(int, proxyType);
+ if (proxyType == QNetworkProxy::Socks5Proxy) {
+ QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1080));
+ }
+ }
+}
+
+void tst_QTcpServer::cleanup()
+{
+ QNetworkProxy::setApplicationProxy(QNetworkProxy::DefaultProxy);
+}
+
+//----------------------------------------------------------------------------------
+void tst_QTcpServer::ipv4LoopbackPerformanceTest()
+{
+ QFETCH_GLOBAL(bool, setProxy);
+ if (setProxy)
+ return;
+
+ QTcpServer server;
+ QVERIFY(server.listen(QHostAddress::LocalHost));
+
+ QVERIFY(server.isListening());
+
+ QTcpSocket clientA;
+ clientA.connectToHost(QHostAddress::LocalHost, server.serverPort());
+ QVERIFY(clientA.waitForConnected(5000));
+ QVERIFY(clientA.state() == QAbstractSocket::ConnectedState);
+
+ QVERIFY(server.waitForNewConnection());
+ QTcpSocket *clientB = server.nextPendingConnection();
+ QVERIFY(clientB);
+
+ QByteArray buffer(16384, '@');
+ QTime stopWatch;
+ stopWatch.start();
+ qlonglong totalWritten = 0;
+ while (stopWatch.elapsed() < 5000) {
+ QVERIFY(clientA.write(buffer.data(), buffer.size()) > 0);
+ clientA.flush();
+ totalWritten += buffer.size();
+ while (clientB->waitForReadyRead(100)) {
+ if (clientB->bytesAvailable() == 16384)
+ break;
+ }
+ clientB->read(buffer.data(), buffer.size());
+ clientB->write(buffer.data(), buffer.size());
+ clientB->flush();
+ totalWritten += buffer.size();
+ while (clientA.waitForReadyRead(100)) {
+ if (clientA.bytesAvailable() == 16384)
+ break;
+ }
+ clientA.read(buffer.data(), buffer.size());
+ }
+
+ qDebug("\t\t%s: %.1fMB/%.1fs: %.1fMB/s",
+ server.serverAddress().toString().toLatin1().constData(),
+ totalWritten / (1024.0 * 1024.0),
+ stopWatch.elapsed() / 1000.0,
+ (totalWritten / (stopWatch.elapsed() / 1000.0)) / (1024 * 1024));
+
+ delete clientB;
+}
+
+//----------------------------------------------------------------------------------
+void tst_QTcpServer::ipv6LoopbackPerformanceTest()
+{
+ QFETCH_GLOBAL(bool, setProxy);
+ if (setProxy)
+ return;
+
+#if defined(Q_OS_SYMBIAN)
+ QSKIP("Symbian: IPv6 is not yet supported", SkipAll);
+#endif
+ QTcpServer server;
+ if (!server.listen(QHostAddress::LocalHostIPv6, 0)) {
+ QVERIFY(server.serverError() == QAbstractSocket::UnsupportedSocketOperationError);
+ } else {
+ QTcpSocket clientA;
+ clientA.connectToHost(server.serverAddress(), server.serverPort());
+ QVERIFY(clientA.waitForConnected(5000));
+
+ QVERIFY(server.waitForNewConnection(5000));
+ QTcpSocket *clientB = server.nextPendingConnection();
+ QVERIFY(clientB);
+
+ QByteArray buffer(16384, '@');
+ QTime stopWatch;
+ stopWatch.start();
+ qlonglong totalWritten = 0;
+ while (stopWatch.elapsed() < 5000) {
+ clientA.write(buffer.data(), buffer.size());
+ clientA.flush();
+ totalWritten += buffer.size();
+ while (clientB->waitForReadyRead(100)) {
+ if (clientB->bytesAvailable() == 16384)
+ break;
+ }
+ clientB->read(buffer.data(), buffer.size());
+ clientB->write(buffer.data(), buffer.size());
+ clientB->flush();
+ totalWritten += buffer.size();
+ while (clientA.waitForReadyRead(100)) {
+ if (clientA.bytesAvailable() == 16384)
+ break;
+ }
+ clientA.read(buffer.data(), buffer.size());
+ }
+
+ qDebug("\t\t%s: %.1fMB/%.1fs: %.1fMB/s",
+ server.serverAddress().toString().toLatin1().constData(),
+ totalWritten / (1024.0 * 1024.0),
+ stopWatch.elapsed() / 1000.0,
+ (totalWritten / (stopWatch.elapsed() / 1000.0)) / (1024 * 1024));
+ delete clientB;
+ }
+}
+
+//----------------------------------------------------------------------------------
+void tst_QTcpServer::ipv4PerformanceTest()
+{
+ QTcpSocket probeSocket;
+ probeSocket.connectToHost(QtNetworkSettings::serverName(), 143);
+ QVERIFY(probeSocket.waitForConnected(5000));
+
+ QTcpServer server;
+ QVERIFY(server.listen(probeSocket.localAddress(), 0));
+
+ QTcpSocket clientA;
+ clientA.connectToHost(server.serverAddress(), server.serverPort());
+ QVERIFY(clientA.waitForConnected(5000));
+
+ QVERIFY(server.waitForNewConnection(5000));
+ QTcpSocket *clientB = server.nextPendingConnection();
+ QVERIFY(clientB);
+
+ QByteArray buffer(16384, '@');
+ QTime stopWatch;
+ stopWatch.start();
+ qlonglong totalWritten = 0;
+ while (stopWatch.elapsed() < 5000) {
+ qlonglong writtenA = clientA.write(buffer.data(), buffer.size());
+ clientA.flush();
+ totalWritten += buffer.size();
+ while (clientB->waitForReadyRead(100)) {
+ if (clientB->bytesAvailable() == writtenA)
+ break;
+ }
+ clientB->read(buffer.data(), buffer.size());
+ qlonglong writtenB = clientB->write(buffer.data(), buffer.size());
+ clientB->flush();
+ totalWritten += buffer.size();
+ while (clientA.waitForReadyRead(100)) {
+ if (clientA.bytesAvailable() == writtenB)
+ break;
+ }
+ clientA.read(buffer.data(), buffer.size());
+ }
+
+ qDebug("\t\t%s: %.1fMB/%.1fs: %.1fMB/s",
+ probeSocket.localAddress().toString().toLatin1().constData(),
+ totalWritten / (1024.0 * 1024.0),
+ stopWatch.elapsed() / 1000.0,
+ (totalWritten / (stopWatch.elapsed() / 1000.0)) / (1024 * 1024));
+
+ delete clientB;
+}
+
+QTEST_MAIN(tst_QTcpServer)
+#include "tst_qtcpserver.moc"