diff options
83 files changed, 2903 insertions, 722 deletions
@@ -2495,6 +2495,9 @@ QNX/Blackberry options: -no-pps ............ Do not compile with pps support. -pps ............... Compile with pps support. + -no-imf ............ Do not compile with imf support. + -imf ............... Compile with imf support. + MacOS/iOS options: -Fstring ........... Add an explicit framework path. @@ -3759,8 +3762,6 @@ if [ "$CFG_COMPILE_EXAMPLES" = "yes" ]; then fi #------------------------------------------------------------------------------- - -no-imf ............ Do not compile with imf support. - -imf ............... Compile with imf support. # generate qconfig.cpp #------------------------------------------------------------------------------- [ -d "$outpath/src/corelib/global" ] || mkdir -p "$outpath/src/corelib/global" diff --git a/examples/network/bearermonitor/bearermonitor.cpp b/examples/network/bearermonitor/bearermonitor.cpp index 58421e52b1..4590a91f4f 100644 --- a/examples/network/bearermonitor/bearermonitor.cpp +++ b/examples/network/bearermonitor/bearermonitor.cpp @@ -84,10 +84,10 @@ BearerMonitor::BearerMonitor(QWidget *parent) this, SLOT(configurationChanged(const QNetworkConfiguration))); connect(&manager, SIGNAL(updateCompleted()), this, SLOT(updateConfigurations())); -#if defined(Q_OS_WIN) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) connect(registerButton, SIGNAL(clicked()), this, SLOT(registerNetwork())); connect(unregisterButton, SIGNAL(clicked()), this, SLOT(unregisterNetwork())); -#else +#else // Q_OS_WIN && !Q_OS_WINRT nlaGroup->hide(); #endif @@ -257,7 +257,7 @@ void BearerMonitor::onlineStateChanged(bool isOnline) onlineState->setText(tr("Offline")); } -#if defined(Q_OS_WIN) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) void BearerMonitor::registerNetwork() { QTreeWidgetItem *item = treeWidget->currentItem(); @@ -301,7 +301,7 @@ void BearerMonitor::unregisterNetwork() if (WSASetService(&networkInfo, RNRSERVICE_DELETE, 0) == SOCKET_ERROR) qDebug() << "WSASetService(RNRSERVICE_DELETE) returned" << WSAGetLastError(); } -#endif +#endif // Q_OS_WIN && !Q_OS_WINRT void BearerMonitor::showConfigurationFor(QTreeWidgetItem *item) { diff --git a/examples/network/bearermonitor/bearermonitor.h b/examples/network/bearermonitor/bearermonitor.h index aaa2c18424..307262c2b4 100644 --- a/examples/network/bearermonitor/bearermonitor.h +++ b/examples/network/bearermonitor/bearermonitor.h @@ -66,10 +66,10 @@ private slots: void onlineStateChanged(bool isOnline); -#if defined(Q_OS_WIN) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) void registerNetwork(); void unregisterNetwork(); -#endif +#endif // Q_OS_WIN && !Q_OS_WINRT void showConfigurationFor(QTreeWidgetItem *item); diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.cpp index 7ba183d250..39fd0f41f0 100644 --- a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.cpp +++ b/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.cpp @@ -29,12 +29,12 @@ #endif #ifndef D3DCOMPILER_DLL -#ifndef ANGLE_OS_WINPHONE #define D3DCOMPILER_DLL L"d3dcompiler_43.dll" // Lowest common denominator -#else -#define D3DCOMPILER_DLL L"qtd3dcompiler.dll" // Placeholder DLL for phone -#endif // ANGLE_OS_WINPHONE -#endif // D3DCOMPILER_DLL +#endif + +#ifndef QT_D3DCOMPILER_DLL +#define QT_D3DCOMPILER_DLL D3DCOMPILER_DLL +#endif #if defined(__MINGW32__) || defined(ANGLE_OS_WINPHONE) @@ -83,12 +83,40 @@ bool Renderer::initializeCompiler() } } #else - // Load the version of the D3DCompiler DLL associated with the Direct3D version ANGLE was built with. + // Load the compiler DLL specified by the environment, or default to QT_D3DCOMPILER_DLL +#if !defined(ANGLE_OS_WINRT) + const wchar_t *defaultCompiler = _wgetenv(L"QT_D3DCOMPILER_DLL"); + if (!defaultCompiler) + defaultCompiler = QT_D3DCOMPILER_DLL; +#else // !ANGLE_OS_WINRT +# ifdef _DEBUG + const wchar_t *defaultCompiler = L"d3dcompiler_qtd.dll"; +# else + const wchar_t *defaultCompiler = L"d3dcompiler_qt.dll"; +# endif +#endif // ANGLE_OS_WINRT + + const wchar_t *compilerDlls[] = { + defaultCompiler, + L"d3dcompiler_47.dll", + L"d3dcompiler_46.dll", + L"d3dcompiler_45.dll", + L"d3dcompiler_44.dll", + L"d3dcompiler_43.dll", + 0 + }; + + // Load the first available known compiler DLL + for (int i = 0; compilerDlls[i]; ++i) + { #if !defined(ANGLE_OS_WINRT) - mD3dCompilerModule = LoadLibrary(D3DCOMPILER_DLL); + mD3dCompilerModule = LoadLibrary(compilerDlls[i]); #else - mD3dCompilerModule = LoadPackagedLibrary(D3DCOMPILER_DLL, NULL); + mD3dCompilerModule = LoadPackagedLibrary(compilerDlls[i], NULL); #endif + if (mD3dCompilerModule) + break; + } #endif // ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES if (!mD3dCompilerModule) diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.cpp index 9770772194..2fe15ff5b8 100644 --- a/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.cpp +++ b/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.cpp @@ -519,7 +519,7 @@ EGLint SwapChain11::reset(int backbufferWidth, int backbufferHeight, EGLint swap swapChainDesc.SampleDesc.Quality = 0; #if !defined(ANGLE_OS_WINRT) - result = factory->CreateSwapChain(device, &swapChainDesc, &mSwapChain); + HRESULT result = factory->CreateSwapChain(device, &swapChainDesc, &mSwapChain); #else IDXGISwapChain1 *swapChain; result = factory->CreateSwapChainForCoreWindow(device, mWindow, &swapChainDesc, NULL, &swapChain); diff --git a/src/angle/patches/0015-ANGLE-Dynamically-load-D3D-compiler-from-a-list-of-k.patch b/src/angle/patches/0015-ANGLE-Dynamically-load-D3D-compiler-from-a-list-of-k.patch new file mode 100644 index 0000000000..1955e12bf3 --- /dev/null +++ b/src/angle/patches/0015-ANGLE-Dynamically-load-D3D-compiler-from-a-list-of-k.patch @@ -0,0 +1,85 @@ +From 806fbe22a3515792b6716b5072a2131e2ce3437a Mon Sep 17 00:00:00 2001 +From: Andrew Knight <andrew.knight@digia.com> +Date: Sat, 7 Dec 2013 23:57:39 +0200 +Subject: [PATCH] ANGLE: Dynamically load D3D compiler from a list or the + environment + +If the default compiler cannot be found, load it from a list of DLL names, +including a non-versioned proxy DLL provided by Qt. On Desktop Windows, +the default compiler can also be specified by an environment variable, +QT_D3DCOMPILER_DLL. + +Change-Id: I0d7a8a8a36cc571836f8fa59ea14513b9b19c19b +--- + .../angle/src/libGLESv2/renderer/Renderer.cpp | 44 ++++++++++++++++++---- + 1 file changed, 36 insertions(+), 8 deletions(-) + +diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.cpp +index 7ba183d..39fd0f4 100644 +--- a/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.cpp ++++ b/src/3rdparty/angle/src/libGLESv2/renderer/Renderer.cpp +@@ -29,12 +29,12 @@ + #endif + + #ifndef D3DCOMPILER_DLL +-#ifndef ANGLE_OS_WINPHONE + #define D3DCOMPILER_DLL L"d3dcompiler_43.dll" // Lowest common denominator +-#else +-#define D3DCOMPILER_DLL L"qtd3dcompiler.dll" // Placeholder DLL for phone +-#endif // ANGLE_OS_WINPHONE +-#endif // D3DCOMPILER_DLL ++#endif ++ ++#ifndef QT_D3DCOMPILER_DLL ++#define QT_D3DCOMPILER_DLL D3DCOMPILER_DLL ++#endif + + #if defined(__MINGW32__) || defined(ANGLE_OS_WINPHONE) + +@@ -83,12 +83,40 @@ bool Renderer::initializeCompiler() + } + } + #else +- // Load the version of the D3DCompiler DLL associated with the Direct3D version ANGLE was built with. ++ // Load the compiler DLL specified by the environment, or default to QT_D3DCOMPILER_DLL ++#if !defined(ANGLE_OS_WINRT) ++ const wchar_t *defaultCompiler = _wgetenv(L"QT_D3DCOMPILER_DLL"); ++ if (!defaultCompiler) ++ defaultCompiler = QT_D3DCOMPILER_DLL; ++#else // !ANGLE_OS_WINRT ++# ifdef _DEBUG ++ const wchar_t *defaultCompiler = L"d3dcompiler_qtd.dll"; ++# else ++ const wchar_t *defaultCompiler = L"d3dcompiler_qt.dll"; ++# endif ++#endif // ANGLE_OS_WINRT ++ ++ const wchar_t *compilerDlls[] = { ++ defaultCompiler, ++ L"d3dcompiler_47.dll", ++ L"d3dcompiler_46.dll", ++ L"d3dcompiler_45.dll", ++ L"d3dcompiler_44.dll", ++ L"d3dcompiler_43.dll", ++ 0 ++ }; ++ ++ // Load the first available known compiler DLL ++ for (int i = 0; compilerDlls[i]; ++i) ++ { + #if !defined(ANGLE_OS_WINRT) +- mD3dCompilerModule = LoadLibrary(D3DCOMPILER_DLL); ++ mD3dCompilerModule = LoadLibrary(compilerDlls[i]); + #else +- mD3dCompilerModule = LoadPackagedLibrary(D3DCOMPILER_DLL, NULL); ++ mD3dCompilerModule = LoadPackagedLibrary(compilerDlls[i], NULL); + #endif ++ if (mD3dCompilerModule) ++ break; ++ } + #endif // ANGLE_PRELOADED_D3DCOMPILER_MODULE_NAMES + + if (!mD3dCompilerModule) +-- +1.8.4.msysgit.0 + diff --git a/src/angle/patches/0016-ANGLE-D3D11-Fix-build-on-desktop-Windows.patch b/src/angle/patches/0016-ANGLE-D3D11-Fix-build-on-desktop-Windows.patch new file mode 100644 index 0000000000..99f458bc28 --- /dev/null +++ b/src/angle/patches/0016-ANGLE-D3D11-Fix-build-on-desktop-Windows.patch @@ -0,0 +1,28 @@ +From 8229b84ddf0134ac11412262d23515dfb7ddb177 Mon Sep 17 00:00:00 2001 +From: Andrew Knight <andrew.knight@digia.com> +Date: Sun, 8 Dec 2013 22:50:38 +0200 +Subject: [PATCH] ANGLE D3D11: Fix build on desktop Windows + +This fixes a missing declaration caused by 11a2226c + +Change-Id: I4b8092c6b9592e886353af9193686238105a1512 +--- + src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.cpp b/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.cpp +index 9770772..2fe15ff 100644 +--- a/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.cpp ++++ b/src/3rdparty/angle/src/libGLESv2/renderer/SwapChain11.cpp +@@ -519,7 +519,7 @@ EGLint SwapChain11::reset(int backbufferWidth, int backbufferHeight, EGLint swap + swapChainDesc.SampleDesc.Quality = 0; + + #if !defined(ANGLE_OS_WINRT) +- result = factory->CreateSwapChain(device, &swapChainDesc, &mSwapChain); ++ HRESULT result = factory->CreateSwapChain(device, &swapChainDesc, &mSwapChain); + #else + IDXGISwapChain1 *swapChain; + result = factory->CreateSwapChainForCoreWindow(device, mWindow, &swapChainDesc, NULL, &swapChain); +-- +1.8.4.msysgit.0 + diff --git a/src/corelib/arch/qatomic_x86.h b/src/corelib/arch/qatomic_x86.h index f8180ad9d6..608b3db0ff 100644 --- a/src/corelib/arch/qatomic_x86.h +++ b/src/corelib/arch/qatomic_x86.h @@ -339,6 +339,8 @@ T QBasicAtomicOps<1>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveTy #define Q_ATOMIC_INT16_FETCH_AND_ADD_IS_ALWAYS_NATIVE #define Q_ATOMIC_INT16_FETCH_AND_ADD_IS_WAIT_FREE +#ifdef Q_PROCESSOR_X86_64 + #define Q_ATOMIC_INT64_IS_SUPPORTED #define Q_ATOMIC_INT64_REFERENCE_COUNTING_IS_ALWAYS_NATIVE @@ -353,7 +355,6 @@ T QBasicAtomicOps<1>::fetchAndAddRelaxed(T &_q_value, typename QAtomicAdditiveTy #define Q_ATOMIC_INT64_FETCH_AND_ADD_IS_ALWAYS_NATIVE #define Q_ATOMIC_INT64_FETCH_AND_ADD_IS_WAIT_FREE -#ifdef Q_PROCESSOR_X86_64 // native support for 64-bit types template<> template<typename T> inline bool QBasicAtomicOps<8>::ref(T &_q_value) Q_DECL_NOTHROW diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index da5f65fafb..7dbe41aace 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -551,8 +551,12 @@ class QDataStream; #endif #if defined(Q_OS_WINRT) -# define QT_NO_PROCESS # define QT_NO_FILESYSTEMWATCHER +# define QT_NO_GETADDRINFO +# define QT_NO_NETWORKPROXY +# define QT_NO_PROCESS +# define QT_NO_SOCKETNOTIFIER +# define QT_NO_SOCKS5 #endif inline void qt_noop(void) {} diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h index 9ed5f6e951..b316c2866e 100644 --- a/src/corelib/io/qdebug.h +++ b/src/corelib/io/qdebug.h @@ -80,7 +80,9 @@ public: inline QDebug &operator=(const QDebug &other); inline ~QDebug() { if (!--stream->ref) { - if(stream->message_output) { + if (stream->space && stream->buffer.endsWith(QLatin1Char(' '))) + stream->buffer.chop(1); + if (stream->message_output) { QT_TRY { qt_message_output(stream->type, stream->context, diff --git a/src/corelib/io/qdiriterator.cpp b/src/corelib/io/qdiriterator.cpp index 5b48c4c7db..79cdec9674 100644 --- a/src/corelib/io/qdiriterator.cpp +++ b/src/corelib/io/qdiriterator.cpp @@ -477,7 +477,7 @@ QDirIterator::~QDirIterator() /*! Advances the iterator to the next entry, and returns the file path of this new entry. If hasNext() returns \c false, this function does nothing, and - returns a null QString. + returns an empty QString. You can call fileName() or filePath() to get the current entry file name or path, or fileInfo() to get a QFileInfo for the current entry. diff --git a/src/corelib/kernel/qeventdispatcher_winrt_p.h b/src/corelib/kernel/qeventdispatcher_winrt_p.h index 35b3faa771..c5bd39c2a3 100644 --- a/src/corelib/kernel/qeventdispatcher_winrt_p.h +++ b/src/corelib/kernel/qeventdispatcher_winrt_p.h @@ -115,7 +115,6 @@ protected: bool event(QEvent *); int activateTimers(); - int activateSocketNotifiers(); }; struct WinRTTimerInfo // internal timer info diff --git a/src/gui/util/qabstractlayoutstyleinfo.cpp b/src/gui/util/qabstractlayoutstyleinfo.cpp new file mode 100644 index 0000000000..4f7c635594 --- /dev/null +++ b/src/gui/util/qabstractlayoutstyleinfo.cpp @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** 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, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qabstractlayoutstyleinfo_p.h" + +QT_BEGIN_NAMESPACE + +bool QAbstractLayoutStyleInfo::hasChanged() const +{ + if (m_changed == Unknown) + m_changed = hasChangedCore() ? Changed : Unchanged; + return m_changed == Changed; +} + +QT_END_NAMESPACE diff --git a/src/gui/util/qabstractlayoutstyleinfo_p.h b/src/gui/util/qabstractlayoutstyleinfo_p.h new file mode 100644 index 0000000000..52f151c5d2 --- /dev/null +++ b/src/gui/util/qabstractlayoutstyleinfo_p.h @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** 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, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QABSTRACTLAYOUTSTYLEINFO_P_H +#define QABSTRACTLAYOUTSTYLEINFO_P_H + +#include <QtCore/qnamespace.h> +#include "qlayoutpolicy_p.h" + +QT_BEGIN_NAMESPACE + + +class Q_GUI_EXPORT QAbstractLayoutStyleInfo { +public: + typedef enum { + Unknown = 0, + Changed, + Unchanged + } ChangedState; + + QAbstractLayoutStyleInfo() : m_isWindow(false), m_changed(Changed) {} + virtual ~QAbstractLayoutStyleInfo() {} + virtual qreal combinedLayoutSpacing(QLayoutPolicy::ControlTypes /*controls1*/, + QLayoutPolicy::ControlTypes /*controls2*/, Qt::Orientation /*orientation*/) const { + return -1; + } + + virtual qreal perItemSpacing(QLayoutPolicy::ControlType /*control1*/, + QLayoutPolicy::ControlType /*control2*/, + Qt::Orientation /*orientation*/) const { + return -1; + } + + virtual qreal spacing(Qt::Orientation orientation) const = 0; + + virtual bool hasChangedCore() const = 0; + + void updateChanged(ChangedState change) { + m_changed = change; + } + + bool hasChanged() const; + + virtual void invalidate() { updateChanged(Changed);} + + virtual qreal windowMargin(Qt::Orientation orientation) const = 0; + + bool isWindow() const { + return m_isWindow; + } + +protected: + unsigned m_isWindow : 1; + mutable unsigned m_changed : 2; +}; + +QT_END_NAMESPACE + +#endif // QABSTRACTLAYOUTSTYLEINFO_P_H diff --git a/src/gui/util/qlayoutpolicy.cpp b/src/gui/util/qlayoutpolicy.cpp new file mode 100644 index 0000000000..9a154768eb --- /dev/null +++ b/src/gui/util/qlayoutpolicy.cpp @@ -0,0 +1,136 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Layouts module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** 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, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qlayoutpolicy_p.h" +#include <QtCore/qdebug.h> +#include <QtCore/qdatastream.h> + +QT_BEGIN_NAMESPACE + +void QLayoutPolicy::setControlType(ControlType type) +{ + /* + The control type is a flag type, with values 0x1, 0x2, 0x4, 0x8, 0x10, + etc. In memory, we pack it onto the available bits (CTSize) in + setControlType(), and unpack it here. + + Example: + + 0x00000001 maps to 0 + 0x00000002 maps to 1 + 0x00000004 maps to 2 + 0x00000008 maps to 3 + etc. + */ + + int i = 0; + while (true) { + if (type & (0x1 << i)) { + bits.ctype = i; + return; + } + ++i; + } +} + +QLayoutPolicy::ControlType QLayoutPolicy::controlType() const +{ + return QLayoutPolicy::ControlType(1 << bits.ctype); +} + +#ifndef QT_NO_DATASTREAM + +/*! + \relates QLayoutPolicy + + Writes the size \a policy to the data stream \a stream. + + \sa{Serializing Qt Data Types}{Format of the QDataStream operators} +*/ +QDataStream &operator<<(QDataStream &stream, const QLayoutPolicy &policy) +{ + // The order here is for historical reasons. (compatibility with Qt4) + quint32 data = (policy.bits.horPolicy | // [0, 3] + policy.bits.verPolicy << 4 | // [4, 7] + policy.bits.hfw << 8 | // [8] + policy.bits.ctype << 9 | // [9, 13] + policy.bits.wfh << 14 | // [14] + //policy.bits.padding << 15 | // [15] + policy.bits.verStretch << 16 | // [16, 23] + policy.bits.horStretch << 24); // [24, 31] + return stream << data; +} + +#define VALUE_OF_BITS(data, bitstart, bitcount) ((data >> bitstart) & ((1 << bitcount) -1)) + +/*! + \relates QLayoutPolicy + + Reads the size \a policy from the data stream \a stream. + + \sa{Serializing Qt Data Types}{Format of the QDataStream operators} +*/ +QDataStream &operator>>(QDataStream &stream, QLayoutPolicy &policy) +{ + quint32 data; + stream >> data; + policy.bits.horPolicy = VALUE_OF_BITS(data, 0, 4); + policy.bits.verPolicy = VALUE_OF_BITS(data, 4, 4); + policy.bits.hfw = VALUE_OF_BITS(data, 8, 1); + policy.bits.ctype = VALUE_OF_BITS(data, 9, 5); + policy.bits.wfh = VALUE_OF_BITS(data, 14, 1); + policy.bits.padding = 0; + policy.bits.verStretch = VALUE_OF_BITS(data, 16, 8); + policy.bits.horStretch = VALUE_OF_BITS(data, 24, 8); + return stream; +} +#endif // QT_NO_DATASTREAM + +#ifndef QT_NO_DEBUG_STREAM +QDebug operator<<(QDebug dbg, const QLayoutPolicy &p) +{ + dbg.nospace() << "QLayoutPolicy(horizontalPolicy = " << p.horizontalPolicy() + << ", verticalPolicy = " << p.verticalPolicy() << ')'; + return dbg.space(); +} +#endif + +QT_END_NAMESPACE diff --git a/src/gui/util/qlayoutpolicy_p.h b/src/gui/util/qlayoutpolicy_p.h new file mode 100644 index 0000000000..664afef1a4 --- /dev/null +++ b/src/gui/util/qlayoutpolicy_p.h @@ -0,0 +1,185 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Quick Layouts module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** 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, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QLAYOUTPOLICY_H +#define QLAYOUTPOLICY_H + +#include <QtCore/qobject.h> +#include <QtCore/qnamespace.h> + +#ifndef QT_NO_DATASTREAM +# include <QtCore/qdatastream.h> +#endif + +QT_BEGIN_NAMESPACE + + +class QVariant; + +class Q_GUI_EXPORT QLayoutPolicy +{ + Q_ENUMS(Policy) + +public: + enum PolicyFlag { + GrowFlag = 1, + ExpandFlag = 2, + ShrinkFlag = 4, + IgnoreFlag = 8 + }; + + enum Policy { + Fixed = 0, + Minimum = GrowFlag, + Maximum = ShrinkFlag, + Preferred = GrowFlag | ShrinkFlag, + MinimumExpanding = GrowFlag | ExpandFlag, + Expanding = GrowFlag | ShrinkFlag | ExpandFlag, + Ignored = ShrinkFlag | GrowFlag | IgnoreFlag + }; + + enum ControlType { + DefaultType = 0x00000001, + ButtonBox = 0x00000002, + CheckBox = 0x00000004, + ComboBox = 0x00000008, + Frame = 0x00000010, + GroupBox = 0x00000020, + Label = 0x00000040, + Line = 0x00000080, + LineEdit = 0x00000100, + PushButton = 0x00000200, + RadioButton = 0x00000400, + Slider = 0x00000800, + SpinBox = 0x00001000, + TabWidget = 0x00002000, + ToolButton = 0x00004000 + }; + Q_DECLARE_FLAGS(ControlTypes, ControlType) + + QLayoutPolicy() : data(0) { } + + QLayoutPolicy(Policy horizontal, Policy vertical, ControlType type = DefaultType) + : data(0) { + bits.horPolicy = horizontal; + bits.verPolicy = vertical; + setControlType(type); + } + Policy horizontalPolicy() const { return static_cast<Policy>(bits.horPolicy); } + Policy verticalPolicy() const { return static_cast<Policy>(bits.verPolicy); } + ControlType controlType() const; + + void setHorizontalPolicy(Policy d) { bits.horPolicy = d; } + void setVerticalPolicy(Policy d) { bits.verPolicy = d; } + void setControlType(ControlType type); + + Qt::Orientations expandingDirections() const { + Qt::Orientations result; + if (verticalPolicy() & ExpandFlag) + result |= Qt::Vertical; + if (horizontalPolicy() & ExpandFlag) + result |= Qt::Horizontal; + return result; + } + + void setHeightForWidth(bool b) { bits.hfw = b; } + bool hasHeightForWidth() const { return bits.hfw; } + void setWidthForHeight(bool b) { bits.wfh = b; } + bool hasWidthForHeight() const { return bits.wfh; } + + bool operator==(const QLayoutPolicy& s) const { return data == s.data; } + bool operator!=(const QLayoutPolicy& s) const { return data != s.data; } + + int horizontalStretch() const { return static_cast<int>(bits.horStretch); } + int verticalStretch() const { return static_cast<int>(bits.verStretch); } + void setHorizontalStretch(int stretchFactor) { bits.horStretch = static_cast<quint32>(qBound(0, stretchFactor, 255)); } + void setVerticalStretch(int stretchFactor) { bits.verStretch = static_cast<quint32>(qBound(0, stretchFactor, 255)); } + + void transpose(); + + +private: +#ifndef QT_NO_DATASTREAM + friend QDataStream &operator<<(QDataStream &, const QLayoutPolicy &); + friend QDataStream &operator>>(QDataStream &, QLayoutPolicy &); +#endif + QLayoutPolicy(int i) : data(i) { } + + union { + struct { + quint32 horStretch : 8; + quint32 verStretch : 8; + quint32 horPolicy : 4; + quint32 verPolicy : 4; + quint32 ctype : 5; + quint32 hfw : 1; + quint32 wfh : 1; + quint32 padding : 1; // feel free to use + } bits; + quint32 data; + }; +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(QLayoutPolicy::ControlTypes) + +#ifndef QT_NO_DATASTREAM +QDataStream &operator<<(QDataStream &, const QLayoutPolicy &); +QDataStream &operator>>(QDataStream &, QLayoutPolicy &); +#endif + +#ifndef QT_NO_DEBUG_STREAM +QDebug operator<<(QDebug dbg, const QLayoutPolicy &); +#endif + +inline void QLayoutPolicy::transpose() { + Policy hData = horizontalPolicy(); + Policy vData = verticalPolicy(); + int hStretch = horizontalStretch(); + int vStretch = verticalStretch(); + setHorizontalPolicy(vData); + setVerticalPolicy(hData); + setHorizontalStretch(vStretch); + setVerticalStretch(hStretch); +} + +QT_END_NAMESPACE + +#endif // QLAYOUTPOLICY_H diff --git a/src/gui/util/util.pri b/src/gui/util/util.pri index dfb221667e..96027dd954 100644 --- a/src/gui/util/util.pri +++ b/src/gui/util/util.pri @@ -3,8 +3,12 @@ HEADERS += \ util/qdesktopservices.h \ util/qhexstring_p.h \ - util/qvalidator.h + util/qvalidator.h \ + util/qabstractlayoutstyleinfo_p.h \ + util/qlayoutpolicy_p.h SOURCES += \ util/qdesktopservices.cpp \ - util/qvalidator.cpp + util/qvalidator.cpp \ + util/qabstractlayoutstyleinfo.cpp \ + util/qlayoutpolicy.cpp diff --git a/src/network/kernel/kernel.pri b/src/network/kernel/kernel.pri index 97f52fdb6e..9b584be206 100644 --- a/src/network/kernel/kernel.pri +++ b/src/network/kernel/kernel.pri @@ -33,9 +33,17 @@ android { } win32: { - HEADERS += kernel/qnetworkinterface_win_p.h - SOURCES += kernel/qdnslookup_win.cpp kernel/qhostinfo_win.cpp kernel/qnetworkinterface_win.cpp - LIBS_PRIVATE += -ldnsapi + !winrt { + HEADERS += kernel/qnetworkinterface_win_p.h + SOURCES += kernel/qdnslookup_win.cpp \ + kernel/qhostinfo_win.cpp \ + kernel/qnetworkinterface_win.cpp + LIBS_PRIVATE += -ldnsapi + } else { + SOURCES += kernel/qdnslookup_winrt.cpp \ + kernel/qhostinfo_winrt.cpp \ + kernel/qnetworkinterface_winrt.cpp + } } integrity:SOURCES += kernel/qdnslookup_unix.cpp kernel/qhostinfo_unix.cpp kernel/qnetworkinterface_unix.cpp diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp index 8c16486878..edbbbf5a75 100644 --- a/src/network/kernel/qauthenticator.cpp +++ b/src/network/kernel/qauthenticator.cpp @@ -55,9 +55,11 @@ #include <qmutex.h> #include <private/qmutexpool_p.h> #include <rpc.h> +#ifndef Q_OS_WINRT #define SECURITY_WIN32 1 #include <security.h> #endif +#endif //#define NTLMV1_CLIENT @@ -69,7 +71,7 @@ QT_BEGIN_NAMESPACE static QByteArray qNtlmPhase1(); static QByteArray qNtlmPhase3(QAuthenticatorPrivate *ctx, const QByteArray& phase2data); -#ifdef Q_OS_WIN +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) static QByteArray qNtlmPhase1_SSPI(QAuthenticatorPrivate *ctx); static QByteArray qNtlmPhase3_SSPI(QAuthenticatorPrivate *ctx, const QByteArray& phase2data); #endif @@ -328,7 +330,7 @@ bool QAuthenticator::isNull() const return !d; } -#ifdef Q_OS_WIN +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) class QNtlmWindowsHandles { public: @@ -340,7 +342,7 @@ public: QAuthenticatorPrivate::QAuthenticatorPrivate() : method(None) - #ifdef Q_OS_WIN + #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) , ntlmWindowsHandles(0) #endif , hasFailed(false) @@ -354,7 +356,7 @@ QAuthenticatorPrivate::QAuthenticatorPrivate() QAuthenticatorPrivate::~QAuthenticatorPrivate() { -#ifdef Q_OS_WIN +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) if (ntlmWindowsHandles) delete ntlmWindowsHandles; #endif @@ -485,7 +487,7 @@ QByteArray QAuthenticatorPrivate::calculateResponse(const QByteArray &requestMet case QAuthenticatorPrivate::Ntlm: methodString = "NTLM "; if (challenge.isEmpty()) { -#ifdef Q_OS_WIN +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) QByteArray phase1Token; if (user.isEmpty()) // Only pull from system if no user was specified in authenticator phase1Token = qNtlmPhase1_SSPI(this); @@ -502,7 +504,7 @@ QByteArray QAuthenticatorPrivate::calculateResponse(const QByteArray &requestMet phase = Phase2; } } else { -#ifdef Q_OS_WIN +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) QByteArray phase3Token; if (ntlmWindowsHandles) phase3Token = qNtlmPhase3_SSPI(this, QByteArray::fromBase64(challenge)); @@ -1475,7 +1477,7 @@ static QByteArray qNtlmPhase3(QAuthenticatorPrivate *ctx, const QByteArray& phas return rc; } -#ifdef Q_OS_WIN +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) // See http://davenport.sourceforge.net/ntlm.html // and libcurl http_ntlm.c @@ -1513,7 +1515,6 @@ static bool q_NTLM_SSPI_library_load() return true; } -#ifdef Q_OS_WIN // Phase 1: static QByteArray qNtlmPhase1_SSPI(QAuthenticatorPrivate *ctx) { @@ -1631,8 +1632,6 @@ static QByteArray qNtlmPhase3_SSPI(QAuthenticatorPrivate *ctx, const QByteArray& return result; } -#endif // Q_OS_WIN - -#endif +#endif // Q_OS_WIN && !Q_OS_WINRT QT_END_NAMESPACE diff --git a/src/network/kernel/qdnslookup_winrt.cpp b/src/network/kernel/qdnslookup_winrt.cpp new file mode 100644 index 0000000000..a5d16e4b63 --- /dev/null +++ b/src/network/kernel/qdnslookup_winrt.cpp @@ -0,0 +1,144 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** 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, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qdnslookup_p.h" + +#include <qurl.h> + +#include <wrl.h> +#include <windows.foundation.h> +#include <windows.foundation.collections.h> +#include <windows.networking.h> +#include <windows.networking.sockets.h> + +using namespace Microsoft::WRL; +using namespace Microsoft::WRL::Wrappers; +using namespace ABI::Windows::Foundation; +using namespace ABI::Windows::Foundation::Collections; +using namespace ABI::Windows::Networking; +using namespace ABI::Windows::Networking::Connectivity; +using namespace ABI::Windows::Networking::Sockets; + +QT_BEGIN_NAMESPACE + +void QDnsLookupRunnable::query(const int requestType, const QByteArray &requestName, QDnsLookupReply *reply) +{ + // TODO: is there any way to do "proper" dns lookup? + if (requestType != QDnsLookup::A && requestType != QDnsLookup::AAAA + && requestType != QDnsLookup::ANY) { + reply->error = QDnsLookup::InvalidRequestError; + reply->errorString = QLatin1String("WinRT only supports IPv4 and IPv6 requests"); + return; + } + + QString aceHostname = QUrl::fromAce(requestName); + if (aceHostname.isEmpty()) { + reply->error = QDnsLookup::InvalidRequestError; + reply->errorString = requestName.isEmpty() ? tr("No hostname given") : tr("Invalid hostname"); + return; + } + + IHostNameFactory *hostnameFactory; + + HStringReference classId(RuntimeClass_Windows_Networking_HostName); + if (FAILED(GetActivationFactory(classId.Get(), &hostnameFactory))) { + reply->error = QDnsLookup::ResolverError; + reply->errorString = QLatin1String("Could not obtain hostname factory"); + return; + } + IHostName *host; + HStringReference hostNameRef((const wchar_t*)aceHostname.utf16()); + hostnameFactory->CreateHostName(hostNameRef.Get(), &host); + hostnameFactory->Release(); + + IDatagramSocketStatics *datagramSocketStatics; + GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Networking_Sockets_DatagramSocket).Get(), &datagramSocketStatics); + + IAsyncOperation<IVectorView<EndpointPair*> *> *op; + HSTRING proto; + WindowsCreateString(L"0", 1, &proto); + datagramSocketStatics->GetEndpointPairsAsync(host, proto, &op); + datagramSocketStatics->Release(); + host->Release(); + + IVectorView<EndpointPair*> *endpointPairs = 0; + HRESULT hr = op->GetResults(&endpointPairs); + int waitCount = 0; + while (hr == E_ILLEGAL_METHOD_CALL) { + WaitForSingleObjectEx(GetCurrentThread(), 50, FALSE); + hr = op->GetResults(&endpointPairs); + if (++waitCount > 1200) // Wait for 1 minute max + return; + } + op->Release(); + + if (!endpointPairs) + return; + + unsigned int size; + endpointPairs->get_Size(&size); + for (unsigned int i = 0; i < size; ++i) { + IEndpointPair *endpointpair; + endpointPairs->GetAt(i, &endpointpair); + IHostName *remoteHost; + endpointpair->get_RemoteHostName(&remoteHost); + endpointpair->Release(); + HostNameType type; + remoteHost->get_Type(&type); + if (type == HostNameType_Bluetooth || type == HostNameType_DomainName + || (requestType != QDnsLookup::ANY + && ((type == HostNameType_Ipv4 && requestType == QDnsLookup::AAAA) + || (type == HostNameType_Ipv6 && requestType == QDnsLookup::A)))) + continue; + + HSTRING name; + remoteHost->get_CanonicalName(&name); + remoteHost->Release(); + UINT32 length; + PCWSTR rawString = WindowsGetStringRawBuffer(name, &length); + QDnsHostAddressRecord record; + record.d->name = aceHostname; + record.d->value = QHostAddress(QString::fromWCharArray(rawString, length)); + reply->hostAddressRecords.append(record); + } +} + +QT_END_NAMESPACE diff --git a/src/network/kernel/qhostaddress.cpp b/src/network/kernel/qhostaddress.cpp index 18fd6dee58..0ab72191dc 100644 --- a/src/network/kernel/qhostaddress.cpp +++ b/src/network/kernel/qhostaddress.cpp @@ -71,7 +71,7 @@ QT_BEGIN_NAMESPACE // sockaddr_in6 size changed between old and new SDK // Only the new version is the correct one, so always // use this structure. -#if defined(Q_OS_WINCE) +#if defined(Q_OS_WINCE) || defined(Q_OS_WINRT) # if !defined(u_char) # define u_char unsigned char # endif @@ -448,10 +448,12 @@ QHostAddress::QHostAddress(const QString &address) QHostAddress::QHostAddress(const struct sockaddr *sockaddr) : d(new QHostAddressPrivate) { +#ifndef Q_OS_WINRT if (sockaddr->sa_family == AF_INET) setAddress(htonl(((sockaddr_in *)sockaddr)->sin_addr.s_addr)); else if (sockaddr->sa_family == AF_INET6) setAddress(((qt_sockaddr_in6 *)sockaddr)->sin6_addr.qt_s6_addr); +#endif } /*! @@ -604,11 +606,13 @@ bool QHostAddress::setAddress(const QString &address) */ void QHostAddress::setAddress(const struct sockaddr *sockaddr) { +#ifndef Q_OS_WINRT clear(); if (sockaddr->sa_family == AF_INET) setAddress(htonl(((sockaddr_in *)sockaddr)->sin_addr.s_addr)); else if (sockaddr->sa_family == AF_INET6) setAddress(((qt_sockaddr_in6 *)sockaddr)->sin6_addr.qt_s6_addr); +#endif } /*! diff --git a/src/network/kernel/qhostinfo_winrt.cpp b/src/network/kernel/qhostinfo_winrt.cpp new file mode 100644 index 0000000000..928c9e4628 --- /dev/null +++ b/src/network/kernel/qhostinfo_winrt.cpp @@ -0,0 +1,194 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** 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, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qhostinfo_p.h" + +#include <qurl.h> + +#include <ppltasks.h> +#include <wrl.h> +#include <windows.networking.h> +#include <windows.networking.sockets.h> +#include <windows.networking.connectivity.h> +using namespace Microsoft::WRL; +using namespace Microsoft::WRL::Wrappers; +using namespace ABI::Windows::Foundation; +using namespace ABI::Windows::Foundation::Collections; +using namespace ABI::Windows::Networking; +using namespace ABI::Windows::Networking::Connectivity; +using namespace ABI::Windows::Networking::Sockets; + +QT_BEGIN_NAMESPACE + +//#define QHOSTINFO_DEBUG + +QHostInfo QHostInfoAgent::fromName(const QString &hostName) +{ + QHostInfo results; + + QHostAddress address; + if (address.setAddress(hostName)) { + // Reverse lookup + // TODO: is there a replacement for getnameinfo for winrt? + Q_UNIMPLEMENTED(); + return results; + } + + QByteArray aceHostname = QUrl::toAce(hostName); + results.setHostName(hostName); + if (aceHostname.isEmpty()) { + results.setError(QHostInfo::HostNotFound); + results.setErrorString(hostName.isEmpty() ? tr("No host name given") : tr("Invalid hostname")); + return results; + } + + IHostNameFactory *hostnameFactory; + + HStringReference classId(RuntimeClass_Windows_Networking_HostName); + if (FAILED(GetActivationFactory(classId.Get(), &hostnameFactory))) + Q_ASSERT(false, "Could not obtain hostname factory."); + + IHostName *host; + HStringReference hostNameRef((const wchar_t*)hostName.utf16()); + hostnameFactory->CreateHostName(hostNameRef.Get(), &host); + hostnameFactory->Release(); + + IDatagramSocketStatics *datagramSocketStatics; + GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Networking_Sockets_DatagramSocket).Get(), &datagramSocketStatics); + + IAsyncOperation<IVectorView<EndpointPair*> *> *op; + HSTRING proto; + WindowsCreateString(L"0", 1, &proto); + datagramSocketStatics->GetEndpointPairsAsync(host, proto, &op); + datagramSocketStatics->Release(); + host->Release(); + + IVectorView<EndpointPair*> *endpointPairs = 0; + HRESULT hr = op->GetResults(&endpointPairs); + int waitCount = 0; + while (hr == E_ILLEGAL_METHOD_CALL) { + WaitForSingleObjectEx(GetCurrentThread(), 50, FALSE); + hr = op->GetResults(&endpointPairs); + if (++waitCount > 1200) // Wait for 1 minute max + return results; + } + op->Release(); + + if (!endpointPairs) + return results; + + unsigned int size; + endpointPairs->get_Size(&size); + QList<QHostAddress> addresses; + for (unsigned int i = 0; i < size; ++i) { + IEndpointPair *endpointpair; + endpointPairs->GetAt(i, &endpointpair); + IHostName *remoteHost; + endpointpair->get_RemoteHostName(&remoteHost); + endpointpair->Release(); + if (!remoteHost) + continue; + HostNameType type; + remoteHost->get_Type(&type); + if (type == HostNameType_DomainName) + continue; + + HSTRING name; + remoteHost->get_CanonicalName(&name); + remoteHost->Release(); + UINT32 length; + PCWSTR rawString = WindowsGetStringRawBuffer(name, &length); + QHostAddress addr; + addr.setAddress(QString::fromWCharArray(rawString, length)); + if (!addresses.contains(addr)) + addresses.append(addr); + } + results.setAddresses(addresses); + + return results; +} + +QString QHostInfo::localHostName() +{ + INetworkInformationStatics *statics; + GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Networking_Connectivity_NetworkInformation).Get(), &statics); + + IVectorView<HostName*> *hostNames = 0; + statics->GetHostNames(&hostNames); + statics->Release(); + if (!hostNames) + return QString(); + + unsigned int size; + hostNames->get_Size(&size); + if (size == 0) + return QString(); + + for (unsigned int i = 0; i < size; ++i) { + IHostName *hostName; + hostNames->GetAt(i, &hostName); + HostNameType type; + hostName->get_Type(&type); + if (type != HostNameType_DomainName) + continue; + + HSTRING name; + hostName->get_CanonicalName(&name); + hostName->Release(); + UINT32 length; + PCWSTR rawString = WindowsGetStringRawBuffer(name, &length); + return QString::fromWCharArray(rawString, length); + } + IHostName *firstHost; + hostNames->GetAt(0, &firstHost); + hostNames->Release(); + + HSTRING name; + firstHost->get_CanonicalName(&name); + firstHost->Release(); + UINT32 length; + PCWSTR rawString = WindowsGetStringRawBuffer(name, &length); + return QString::fromWCharArray(rawString, length); +} + +// QString QHostInfo::localDomainName() defined in qnetworkinterface_win.cpp + +QT_END_NAMESPACE diff --git a/src/network/kernel/qnetworkinterface_winrt.cpp b/src/network/kernel/qnetworkinterface_winrt.cpp new file mode 100644 index 0000000000..6a814c85d4 --- /dev/null +++ b/src/network/kernel/qnetworkinterface_winrt.cpp @@ -0,0 +1,198 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** 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, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qnetworkinterface.h" +#include "qnetworkinterface_p.h" + +#ifndef QT_NO_NETWORKINTERFACE + +#include <wrl.h> +#include <windows.foundation.h> +#include <windows.foundation.collections.h> +#include <windows.networking.h> +#include <windows.networking.connectivity.h> + +using namespace Microsoft::WRL; +using namespace Microsoft::WRL::Wrappers; +using namespace ABI::Windows::Foundation; +using namespace ABI::Windows::Foundation::Collections; +using namespace ABI::Windows::Networking; +using namespace ABI::Windows::Networking::Connectivity; + +#include <qhostinfo.h> + +QT_BEGIN_NAMESPACE + +struct HostNameInfo { + GUID adapterId; + unsigned char prefixLength; + QString address; +}; + +static QList<QNetworkInterfacePrivate *> interfaceListing() +{ + QList<QNetworkInterfacePrivate *> interfaces; + + QList<HostNameInfo> hostList; + + INetworkInformationStatics *hostNameStatics; + GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Networking_Connectivity_NetworkInformation).Get(), &hostNameStatics); + + IVectorView<HostName*> *hostNames = 0; + hostNameStatics->GetHostNames(&hostNames); + hostNameStatics->Release(); + if (!hostNames) + return interfaces; + + unsigned int hostNameCount; + hostNames->get_Size(&hostNameCount); + for (unsigned i = 0; i < hostNameCount; ++i) { + HostNameInfo hostInfo; + IHostName *hostName; + hostNames->GetAt(i, &hostName); + + HostNameType type; + hostName->get_Type(&type); + if (type == HostNameType_DomainName) + continue; + + IIPInformation *ipInformation; + hostName->get_IPInformation(&ipInformation); + INetworkAdapter *currentAdapter; + ipInformation->get_NetworkAdapter(¤tAdapter); + + currentAdapter->get_NetworkAdapterId(&hostInfo.adapterId); + currentAdapter->Release(); + + IReference<unsigned char> *prefixLengthReference; + ipInformation->get_PrefixLength(&prefixLengthReference); + ipInformation->Release(); + + prefixLengthReference->get_Value(&hostInfo.prefixLength); + prefixLengthReference->Release(); + + // invalid prefixes + if ((type == HostNameType_Ipv4 && hostInfo.prefixLength > 32) + || (type == HostNameType_Ipv6 && hostInfo.prefixLength > 128)) + continue; + + HSTRING name; + hostName->get_CanonicalName(&name); + hostName->Release(); + UINT32 length; + PCWSTR rawString = WindowsGetStringRawBuffer(name, &length); + hostInfo.address = QString::fromWCharArray(rawString, length); + + hostList << hostInfo; + } + hostNames->Release(); + + INetworkInformationStatics *networkInfoStatics; + GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Networking_Connectivity_NetworkInformation).Get(), &networkInfoStatics); + IVectorView<ConnectionProfile *> *connectionProfiles = 0; + networkInfoStatics->GetConnectionProfiles(&connectionProfiles); + networkInfoStatics->Release(); + if (!connectionProfiles) + return interfaces; + + unsigned int size; + connectionProfiles->get_Size(&size); + for (unsigned int i = 0; i < size; ++i) { + QNetworkInterfacePrivate *iface = new QNetworkInterfacePrivate; + interfaces << iface; + + IConnectionProfile *profile; + connectionProfiles->GetAt(i, &profile); + + NetworkConnectivityLevel connectivityLevel; + profile->GetNetworkConnectivityLevel(&connectivityLevel); + if (connectivityLevel != NetworkConnectivityLevel_None) + iface->flags = QNetworkInterface::IsUp | QNetworkInterface::IsRunning; + + INetworkAdapter *adapter; + profile->get_NetworkAdapter(&adapter); + profile->Release(); + UINT32 type; + adapter->get_IanaInterfaceType(&type); + if (type == 23) + iface->flags |= QNetworkInterface::IsPointToPoint; + GUID id; + adapter->get_NetworkAdapterId(&id); + adapter->Release(); + OLECHAR adapterName[39]={0}; + StringFromGUID2(id, adapterName, 39); + iface->name = QString::fromWCharArray(adapterName); + + // According to http://stackoverflow.com/questions/12936193/how-unique-is-the-ethernet-network-adapter-id-in-winrt-it-is-derived-from-the-m + // obtaining the MAC address using WinRT API is impossible + // iface->hardwareAddress = ? + + for (int i = 0; i < hostList.length(); ++i) { + const HostNameInfo hostInfo = hostList.at(i); + if (id != hostInfo.adapterId) + continue; + + QNetworkAddressEntry entry; + entry.setIp(QHostAddress(hostInfo.address)); + entry.setPrefixLength(hostInfo.prefixLength); + iface->addressEntries << entry; + + hostList.takeAt(i); + --i; + } + } + connectionProfiles->Release(); + return interfaces; +} + +QList<QNetworkInterfacePrivate *> QNetworkInterfaceManager::scan() +{ + return interfaceListing(); +} + +QString QHostInfo::localDomainName() +{ + return QString(); +} + +QT_END_NAMESPACE + +#endif // QT_NO_NETWORKINTERFACE diff --git a/src/network/socket/qabstractsocketengine.cpp b/src/network/socket/qabstractsocketengine.cpp index 1275461d7d..d8abe01241 100644 --- a/src/network/socket/qabstractsocketengine.cpp +++ b/src/network/socket/qabstractsocketengine.cpp @@ -41,7 +41,11 @@ #include "qabstractsocketengine_p.h" +#ifndef Q_OS_WINRT #include "qnativesocketengine_p.h" +#else +#include "qnativesocketengine_winrt_p.h" +#endif #include "qmutex.h" #include "qnetworkproxy.h" diff --git a/src/network/socket/qnativesocketengine_winrt.cpp b/src/network/socket/qnativesocketengine_winrt.cpp new file mode 100644 index 0000000000..8550e0b0d1 --- /dev/null +++ b/src/network/socket/qnativesocketengine_winrt.cpp @@ -0,0 +1,327 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** 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, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qnativesocketengine_winrt_p.h" + +#include <qnetworkinterface.h> + +QT_BEGIN_NAMESPACE + +QNativeSocketEngine::QNativeSocketEngine(QObject *parent) + : QAbstractSocketEngine(*new QNativeSocketEnginePrivate(), parent) +{ +} + +QNativeSocketEngine::~QNativeSocketEngine() +{ + close(); +} + +bool QNativeSocketEngine::initialize(QAbstractSocket::SocketType type, QAbstractSocket::NetworkLayerProtocol protocol) +{ + Q_UNIMPLEMENTED(); + Q_UNUSED(type); + Q_UNUSED(protocol); + return false; +} + +bool QNativeSocketEngine::initialize(qintptr socketDescriptor, QAbstractSocket::SocketState socketState) +{ + Q_UNIMPLEMENTED(); + Q_UNUSED(socketDescriptor); + Q_UNUSED(socketState); + return false; +} + +qintptr QNativeSocketEngine::socketDescriptor() const +{ + Q_UNIMPLEMENTED(); + return -1; +} + +bool QNativeSocketEngine::isValid() const +{ + Q_UNIMPLEMENTED(); + return false; +} + +bool QNativeSocketEngine::connectToHost(const QHostAddress &address, quint16 port) +{ + Q_UNIMPLEMENTED(); + Q_UNUSED(address); + Q_UNUSED(port); + return false; +} + +bool QNativeSocketEngine::connectToHostByName(const QString &name, quint16 port) +{ + Q_UNIMPLEMENTED(); + Q_UNUSED(name); + Q_UNUSED(port); + return false; +} + +bool QNativeSocketEngine::bind(const QHostAddress &address, quint16 port) +{ + Q_UNIMPLEMENTED(); + Q_UNUSED(address); + Q_UNUSED(port); + return false; +} + +bool QNativeSocketEngine::listen() +{ + Q_UNIMPLEMENTED(); + return false; +} + +int QNativeSocketEngine::accept() +{ + Q_UNIMPLEMENTED(); + return -1; +} + +void QNativeSocketEngine::close() +{ +} + +bool QNativeSocketEngine::joinMulticastGroup(const QHostAddress &groupAddress, const QNetworkInterface &iface) +{ + Q_UNIMPLEMENTED(); + Q_UNUSED(groupAddress); + Q_UNUSED(iface); + return false; +} + +bool QNativeSocketEngine::leaveMulticastGroup(const QHostAddress &groupAddress, const QNetworkInterface &iface) +{ + Q_UNIMPLEMENTED(); + Q_UNUSED(groupAddress); + Q_UNUSED(iface); + return false; +} + +QNetworkInterface QNativeSocketEngine::multicastInterface() const +{ + Q_UNIMPLEMENTED(); + return QNetworkInterface(); +} + +bool QNativeSocketEngine::setMulticastInterface(const QNetworkInterface &iface) +{ + Q_UNIMPLEMENTED(); + Q_UNUSED(iface); + return false; +} + +qint64 QNativeSocketEngine::bytesAvailable() const +{ + Q_UNIMPLEMENTED(); + return -1; +} + +qint64 QNativeSocketEngine::read(char *data, qint64 maxlen) +{ + Q_UNIMPLEMENTED(); + Q_UNUSED(data); + Q_UNUSED(maxlen); + return -1; +} + +qint64 QNativeSocketEngine::write(const char *data, qint64 len) +{ + Q_UNIMPLEMENTED(); + Q_UNUSED(data); + Q_UNUSED(len); + return -1; +} + +qint64 QNativeSocketEngine::readDatagram(char *data, qint64 maxlen, QHostAddress *addr, quint16 *port) +{ + Q_UNIMPLEMENTED(); + Q_UNUSED(data); + Q_UNUSED(maxlen); + Q_UNUSED(addr); + Q_UNUSED(port); + return -1; +} + +qint64 QNativeSocketEngine::writeDatagram(const char *data, qint64 len, const QHostAddress &addr, quint16 port) +{ + Q_UNIMPLEMENTED(); + Q_UNUSED(data); + Q_UNUSED(len); + Q_UNUSED(addr); + Q_UNUSED(port); + return -1; +} + +bool QNativeSocketEngine::hasPendingDatagrams() const +{ + Q_UNIMPLEMENTED(); + return false; +} + +qint64 QNativeSocketEngine::pendingDatagramSize() const +{ + Q_UNIMPLEMENTED(); + return 0; +} + +qint64 QNativeSocketEngine::bytesToWrite() const +{ + Q_UNIMPLEMENTED(); + return 0; +} + +qint64 QNativeSocketEngine::receiveBufferSize() const +{ + Q_UNIMPLEMENTED(); + return 0; +} + +void QNativeSocketEngine::setReceiveBufferSize(qint64 bufferSize) +{ + Q_UNIMPLEMENTED(); + Q_UNUSED(bufferSize); +} + +qint64 QNativeSocketEngine::sendBufferSize() const +{ + Q_UNIMPLEMENTED(); + return 0; +} + +void QNativeSocketEngine::setSendBufferSize(qint64 bufferSize) +{ + Q_UNIMPLEMENTED(); + Q_UNUSED(bufferSize); +} + +int QNativeSocketEngine::option(QAbstractSocketEngine::SocketOption option) const +{ + Q_UNIMPLEMENTED(); + Q_UNUSED(option); + return -1; +} + +bool QNativeSocketEngine::setOption(QAbstractSocketEngine::SocketOption option, int value) +{ + Q_UNIMPLEMENTED(); + Q_UNUSED(option); + Q_UNUSED(value); + return false; +} + +bool QNativeSocketEngine::waitForRead(int msecs, bool *timedOut) +{ + Q_UNIMPLEMENTED(); + Q_UNUSED(msecs); + Q_UNUSED(timedOut); + return false; +} + +bool QNativeSocketEngine::waitForWrite(int msecs, bool *timedOut) +{ + Q_UNIMPLEMENTED(); + Q_UNUSED(msecs); + Q_UNUSED(timedOut); + return false; +} + +bool QNativeSocketEngine::waitForReadOrWrite(bool *readyToRead, bool *readyToWrite, bool checkRead, bool checkWrite, int msecs, bool *timedOut) +{ + Q_UNIMPLEMENTED(); + Q_UNUSED(readyToRead); + Q_UNUSED(readyToWrite); + Q_UNUSED(checkRead); + Q_UNUSED(checkWrite); + Q_UNUSED(msecs); + Q_UNUSED(timedOut); + return false; +} + +bool QNativeSocketEngine::isReadNotificationEnabled() const +{ + Q_UNIMPLEMENTED(); + return false; +} + +void QNativeSocketEngine::setReadNotificationEnabled(bool enable) +{ + Q_UNIMPLEMENTED(); + Q_UNUSED(enable); +} + +bool QNativeSocketEngine::isWriteNotificationEnabled() const +{ + Q_UNIMPLEMENTED(); + return false; +} + +void QNativeSocketEngine::setWriteNotificationEnabled(bool enable) +{ + Q_UNIMPLEMENTED(); + Q_UNUSED(enable); +} + +bool QNativeSocketEngine::isExceptionNotificationEnabled() const +{ + Q_UNIMPLEMENTED(); + return false; +} + +void QNativeSocketEngine::setExceptionNotificationEnabled(bool enable) +{ + Q_UNIMPLEMENTED(); + Q_UNUSED(enable); +} + +QNativeSocketEnginePrivate::QNativeSocketEnginePrivate() + : QAbstractSocketEnginePrivate() +{ +} + +QNativeSocketEnginePrivate::~QNativeSocketEnginePrivate() +{ +} + +QT_END_NAMESPACE diff --git a/src/network/socket/qnativesocketengine_winrt_p.h b/src/network/socket/qnativesocketengine_winrt_p.h new file mode 100644 index 0000000000..47ba3ecf91 --- /dev/null +++ b/src/network/socket/qnativesocketengine_winrt_p.h @@ -0,0 +1,145 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtNetwork module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** 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, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QNATIVESOCKETENGINE_WINRT_P_H +#define QNATIVESOCKETENGINE_WINRT_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of the QLibrary class. This header file may change from +// version to version without notice, or even be removed. +// +// We mean it. +// +#include "QtNetwork/qhostaddress.h" +#include "private/qabstractsocketengine_p.h" +#include <wrl.h> +#include <windows.networking.sockets.h> + +QT_BEGIN_NAMESPACE + +class QNativeSocketEnginePrivate; + +class Q_AUTOTEST_EXPORT QNativeSocketEngine : public QAbstractSocketEngine +{ + Q_OBJECT +public: + QNativeSocketEngine(QObject *parent = 0); + ~QNativeSocketEngine(); + + bool initialize(QAbstractSocket::SocketType type, QAbstractSocket::NetworkLayerProtocol protocol = QAbstractSocket::IPv4Protocol); + bool initialize(qintptr socketDescriptor, QAbstractSocket::SocketState socketState = QAbstractSocket::ConnectedState); + + qintptr socketDescriptor() const; + + bool isValid() const; + + bool connectToHost(const QHostAddress &address, quint16 port); + bool connectToHostByName(const QString &name, quint16 port); + bool bind(const QHostAddress &address, quint16 port); + bool listen(); + int accept(); + void close(); + +#ifndef QT_NO_NETWORKINTERFACE + bool joinMulticastGroup(const QHostAddress &groupAddress, + const QNetworkInterface &iface); + bool leaveMulticastGroup(const QHostAddress &groupAddress, + const QNetworkInterface &iface); + QNetworkInterface multicastInterface() const; + bool setMulticastInterface(const QNetworkInterface &iface); +#endif + + qint64 bytesAvailable() const; + + qint64 read(char *data, qint64 maxlen); + qint64 write(const char *data, qint64 len); + + qint64 readDatagram(char *data, qint64 maxlen, QHostAddress *addr = 0, + quint16 *port = 0); + qint64 writeDatagram(const char *data, qint64 len, const QHostAddress &addr, + quint16 port); + bool hasPendingDatagrams() const; + qint64 pendingDatagramSize() const; + + qint64 bytesToWrite() const; + + qint64 receiveBufferSize() const; + void setReceiveBufferSize(qint64 bufferSize); + + qint64 sendBufferSize() const; + void setSendBufferSize(qint64 bufferSize); + + int option(SocketOption option) const; + bool setOption(SocketOption option, int value); + + bool waitForRead(int msecs = 30000, bool *timedOut = 0); + bool waitForWrite(int msecs = 30000, bool *timedOut = 0); + bool waitForReadOrWrite(bool *readyToRead, bool *readyToWrite, + bool checkRead, bool checkWrite, + int msecs = 30000, bool *timedOut = 0); + + bool isReadNotificationEnabled() const; + void setReadNotificationEnabled(bool enable); + bool isWriteNotificationEnabled() const; + void setWriteNotificationEnabled(bool enable); + bool isExceptionNotificationEnabled() const; + void setExceptionNotificationEnabled(bool enable); + +private: + Q_DECLARE_PRIVATE(QNativeSocketEngine) + Q_DISABLE_COPY(QNativeSocketEngine) +}; + +class QNativeSocketEnginePrivate : public QAbstractSocketEnginePrivate +{ + Q_DECLARE_PUBLIC(QNativeSocketEngine) +public: + QNativeSocketEnginePrivate(); + ~QNativeSocketEnginePrivate(); +}; + +QT_END_NAMESPACE + +#endif // QNATIVESOCKETENGINE_WINRT_P_H diff --git a/src/network/socket/socket.pri b/src/network/socket/socket.pri index c0c6d750d9..7e3a54e303 100644 --- a/src/network/socket/socket.pri +++ b/src/network/socket/socket.pri @@ -24,8 +24,10 @@ SOURCES += socket/qabstractsocketengine.cpp \ socket/qlocalsocket.cpp \ socket/qlocalserver.cpp -SOURCES += socket/qnativesocketengine.cpp -HEADERS += socket/qnativesocketengine_p.h +!winrt { + SOURCES += socket/qnativesocketengine.cpp + HEADERS += socket/qnativesocketengine_p.h +} unix: { SOURCES += socket/qnativesocketengine_unix.cpp \ @@ -36,11 +38,20 @@ unix: { unix:HEADERS += \ socket/qnet_unix_p.h -win32:SOURCES += socket/qnativesocketengine_win.cpp \ +win32:!winrt:SOURCES += socket/qnativesocketengine_win.cpp \ socket/qlocalsocket_win.cpp \ socket/qlocalserver_win.cpp -win32:!wince*: LIBS_PRIVATE += -ladvapi32 +win32:!wince*:!winrt:LIBS_PRIVATE += -ladvapi32 + +winrt { + SOURCES += socket/qnativesocketengine_winrt.cpp \ + socket/qlocalsocket_tcp.cpp \ + socket/qlocalserver_tcp.cpp + HEADERS += socket/qnativesocketengine_winrt_p.h + + DEFINES += QT_LOCALSOCKET_TCP +} wince*: { SOURCES -= socket/qlocalsocket_win.cpp \ diff --git a/src/plugins/platforms/windows/qtwindowsglobal.h b/src/plugins/platforms/windows/qtwindowsglobal.h index 7b574b0a56..ee640224cf 100644 --- a/src/plugins/platforms/windows/qtwindowsglobal.h +++ b/src/plugins/platforms/windows/qtwindowsglobal.h @@ -73,6 +73,7 @@ enum WindowsEventType // Simplify event types ExposeEvent = WindowEventFlag + 1, ActivateWindowEvent = WindowEventFlag + 2, DeactivateWindowEvent = WindowEventFlag + 3, + MouseActivateWindowEvent = WindowEventFlag + 4, LeaveEvent = WindowEventFlag + 5, CloseEvent = WindowEventFlag + 6, ShowEvent = WindowEventFlag + 7, @@ -131,6 +132,8 @@ inline QtWindows::WindowsEventType windowsEventType(UINT message, WPARAM wParamI case WM_ACTIVATEAPP: return (int)wParamIn ? QtWindows::ActivateApplicationEvent : QtWindows::DeactivateApplicationEvent; + case WM_MOUSEACTIVATE: + return QtWindows::MouseActivateWindowEvent; case WM_ACTIVATE: return LOWORD(wParamIn) == WA_INACTIVE ? QtWindows::DeactivateWindowEvent : QtWindows::ActivateWindowEvent; diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 77cac647ba..a87dfe5f16 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -928,6 +928,10 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, return true; #ifndef Q_OS_WINCE case QtWindows::ActivateWindowEvent: + if (platformWindow->window()->flags() & Qt::WindowDoesNotAcceptFocus) { + *result = LRESULT(MA_NOACTIVATE); + return true; + } #ifndef QT_NO_TABLETEVENT if (!d->m_tabletSupport.isNull()) d->m_tabletSupport->notifyActivate(); @@ -936,6 +940,12 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, if (const QWindow *modalWindow = QGuiApplication::modalWindow()) QWindowsWindow::baseWindowOf(modalWindow)->alertWindow(); break; + case QtWindows::MouseActivateWindowEvent: + if (platformWindow->window()->flags() & Qt::WindowDoesNotAcceptFocus) { + *result = LRESULT(MA_NOACTIVATE); + return true; + } + break; #endif #ifndef QT_NO_CONTEXTMENU case QtWindows::ContextMenu: diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 58047124a1..006a2802c1 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -1188,7 +1188,7 @@ void QWindowsWindow::hide_sys() const if (flags & Qt::Popup) ShowWindow(m_data.hwnd, SW_HIDE); else - SetWindowPos(m_data.hwnd,0, 0,0,0,0, SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER); + SetWindowPos(m_data.hwnd,0, 0,0,0,0, SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE); } } diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro index 6f4bca63be..942db329ca 100644 --- a/src/plugins/plugins.pro +++ b/src/plugins/plugins.pro @@ -1,7 +1,7 @@ TEMPLATE = subdirs SUBDIRS *= sqldrivers -qtHaveModule(network): SUBDIRS += bearer +!winrt:qtHaveModule(network): SUBDIRS += bearer qtHaveModule(gui): SUBDIRS *= imageformats platforms platforminputcontexts platformthemes generic qtHaveModule(widgets): SUBDIRS += accessible diff --git a/src/src.pro b/src/src.pro index 74ca7fbf0b..63cbfacbf4 100644 --- a/src/src.pro +++ b/src/src.pro @@ -149,12 +149,6 @@ SUBDIRS += src_plugins src_tools_qdoc nacl: SUBDIRS -= src_network src_testlib -winrt { - src_platformsupport.depends -= src_network - src_plugins.depends -= src_network - SUBDIRS -= src_network -} - android:!android-no-sdk: SUBDIRS += src_android TR_EXCLUDE = \ diff --git a/src/widgets/graphicsview/graphicsview.pri b/src/widgets/graphicsview/graphicsview.pri index a0fc4bc8d3..f8cbe18493 100644 --- a/src/widgets/graphicsview/graphicsview.pri +++ b/src/widgets/graphicsview/graphicsview.pri @@ -24,6 +24,8 @@ HEADERS += graphicsview/qgraphicsgridlayout.h \ graphicsview/qgraphicswidget.h \ graphicsview/qgraphicswidget_p.h \ graphicsview/qgridlayoutengine_p.h \ + graphicsview/qgraphicslayoutstyleinfo_p.h \ + graphicsview/qgraphicsgridlayoutengine_p.h \ graphicsview/qgraph_p.h \ graphicsview/qsimplex_p.h \ graphicsview/qgraphicsanchorlayout_p.h \ @@ -48,6 +50,8 @@ SOURCES += graphicsview/qgraphicsgridlayout.cpp \ graphicsview/qgraphicswidget.cpp \ graphicsview/qgraphicswidget_p.cpp \ graphicsview/qgridlayoutengine.cpp \ + graphicsview/qgraphicslayoutstyleinfo.cpp \ + graphicsview/qgraphicsgridlayoutengine.cpp \ graphicsview/qsimplex_p.cpp \ graphicsview/qgraphicsanchorlayout_p.cpp \ graphicsview/qgraphicsanchorlayout.cpp diff --git a/src/widgets/graphicsview/qgraphicsgridlayout.cpp b/src/widgets/graphicsview/qgraphicsgridlayout.cpp index 6d9dd98839..59f3d891f2 100644 --- a/src/widgets/graphicsview/qgraphicsgridlayout.cpp +++ b/src/widgets/graphicsview/qgraphicsgridlayout.cpp @@ -89,30 +89,35 @@ #include "qgraphicslayoutitem.h" #include "qgraphicsgridlayout.h" #include "qgraphicswidget.h" -#include "qgridlayoutengine_p.h" -#include <QtCore/qdebug.h> +#include "qgraphicsgridlayoutengine_p.h" +#include "qgraphicslayoutstyleinfo_p.h" +#ifdef QT_DEBUG +# include <QtCore/qdebug.h> +#endif QT_BEGIN_NAMESPACE class QGraphicsGridLayoutPrivate : public QGraphicsLayoutPrivate { public: - QGraphicsGridLayoutPrivate() { } - QLayoutStyleInfo styleInfo() const; + QGraphicsGridLayoutPrivate(): m_styleInfo(0) { } + QGraphicsLayoutStyleInfo *styleInfo() const; + + mutable QGraphicsLayoutStyleInfo *m_styleInfo; + QGraphicsGridLayoutEngine engine; - QGridLayoutEngine engine; #ifdef QT_DEBUG void dump(int indent) const; #endif }; -Q_GLOBAL_STATIC(QWidget, globalStyleInfoWidget); -QLayoutStyleInfo QGraphicsGridLayoutPrivate::styleInfo() const +QGraphicsLayoutStyleInfo *QGraphicsGridLayoutPrivate::styleInfo() const { - QGraphicsItem *item = parentItem(); - QStyle *style = (item && item->isWidget()) ? static_cast<QGraphicsWidget*>(item)->style() : QApplication::style(); - return QLayoutStyleInfo(style, globalStyleInfoWidget()); + if (!m_styleInfo) + m_styleInfo = new QGraphicsLayoutStyleInfo(this); + m_styleInfo->updateChanged(QAbstractLayoutStyleInfo::Unknown); + return m_styleInfo; } /*! @@ -172,7 +177,8 @@ void QGraphicsGridLayout::addItem(QGraphicsLayoutItem *item, int row, int column d->addChildLayoutItem(item); - new QGridLayoutItem(&d->engine, item, row, column, rowSpan, columnSpan, alignment); + QGraphicsGridLayoutEngineItem *gridEngineItem = new QGraphicsGridLayoutEngineItem(item, row, column, rowSpan, columnSpan, alignment); + d->engine.insertItem(gridEngineItem, -1); invalidate(); } @@ -199,7 +205,7 @@ void QGraphicsGridLayout::setHorizontalSpacing(qreal spacing) qreal QGraphicsGridLayout::horizontalSpacing() const { Q_D(const QGraphicsGridLayout); - return d->engine.spacing(d->styleInfo(), Qt::Horizontal); + return d->engine.spacing(Qt::Horizontal, d->styleInfo()); } /*! @@ -218,7 +224,7 @@ void QGraphicsGridLayout::setVerticalSpacing(qreal spacing) qreal QGraphicsGridLayout::verticalSpacing() const { Q_D(const QGraphicsGridLayout); - return d->engine.spacing(d->styleInfo(), Qt::Vertical); + return d->engine.spacing(Qt::Vertical, d->styleInfo()); } /*! @@ -535,8 +541,8 @@ QGraphicsLayoutItem *QGraphicsGridLayout::itemAt(int row, int column) const qWarning("QGraphicsGridLayout::itemAt: invalid row, column %d, %d", row, column); return 0; } - if (QGridLayoutItem *item = d->engine.itemAt(row, column)) - return item->layoutItem(); + if (QGraphicsGridLayoutEngineItem *engineItem = static_cast<QGraphicsGridLayoutEngineItem*>(d->engine.itemAt(row, column))) + return engineItem->layoutItem(); return 0; } @@ -561,8 +567,8 @@ QGraphicsLayoutItem *QGraphicsGridLayout::itemAt(int index) const return 0; } QGraphicsLayoutItem *item = 0; - if (QGridLayoutItem *gridItem = d->engine.itemAt(index)) - item = gridItem->layoutItem(); + if (QGraphicsGridLayoutEngineItem *engineItem = static_cast<QGraphicsGridLayoutEngineItem*>(d->engine.itemAt(index))) + item = engineItem->layoutItem(); return item; } @@ -579,7 +585,8 @@ void QGraphicsGridLayout::removeAt(int index) qWarning("QGraphicsGridLayout::removeAt: invalid index %d", index); return; } - if (QGridLayoutItem *gridItem = d->engine.itemAt(index)) { + + if (QGraphicsGridLayoutEngineItem *gridItem = static_cast<QGraphicsGridLayoutEngineItem*>(d->engine.itemAt(index))) { if (QGraphicsLayoutItem *layoutItem = gridItem->layoutItem()) layoutItem->setParentLayoutItem(0); d->engine.removeItem(gridItem); @@ -619,6 +626,8 @@ void QGraphicsGridLayout::invalidate() { Q_D(QGraphicsGridLayout); d->engine.invalidate(); + if (d->m_styleInfo) + d->m_styleInfo->invalidate(); QGraphicsLayout::invalidate(); } @@ -646,7 +655,7 @@ void QGraphicsGridLayout::setGeometry(const QRectF &rect) if (visualDir == Qt::RightToLeft) qSwap(left, right); effectiveRect.adjust(+left, +top, -right, -bottom); - d->engine.setGeometries(d->styleInfo(), effectiveRect); + d->engine.setGeometries(effectiveRect, d->styleInfo()); #ifdef QT_DEBUG if (qt_graphicsLayoutDebug()) { static int counter = 0; @@ -666,7 +675,7 @@ QSizeF QGraphicsGridLayout::sizeHint(Qt::SizeHint which, const QSizeF &constrain qreal left, top, right, bottom; getContentsMargins(&left, &top, &right, &bottom); const QSizeF extraMargins(left + right, top + bottom); - return d->engine.sizeHint(d->styleInfo(), which , constraint - extraMargins) + extraMargins; + return d->engine.sizeHint(which , constraint - extraMargins, d->styleInfo()) + extraMargins; } diff --git a/src/widgets/graphicsview/qgraphicsgridlayoutengine.cpp b/src/widgets/graphicsview/qgraphicsgridlayoutengine.cpp new file mode 100644 index 0000000000..6de41c308b --- /dev/null +++ b/src/widgets/graphicsview/qgraphicsgridlayoutengine.cpp @@ -0,0 +1,101 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtWidgets module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** 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, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qgraphicsgridlayoutengine_p.h" +#include "qgraphicslayoutitem_p.h" +#include "qgraphicslayout_p.h" +#include "qgraphicswidget.h" + +QT_BEGIN_NAMESPACE + +/* + returns \c true if the size policy returns \c true for either hasHeightForWidth() + or hasWidthForHeight() + */ +bool QGraphicsGridLayoutEngineItem::hasDynamicConstraint() const +{ + return QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasHeightForWidth() + || QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasWidthForHeight(); +} + +Qt::Orientation QGraphicsGridLayoutEngineItem::dynamicConstraintOrientation() const +{ + if (QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasHeightForWidth()) + return Qt::Vertical; + else //if (QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasWidthForHeight()) + return Qt::Horizontal; +} + + +void QGraphicsGridLayoutEngine::setAlignment(QGraphicsLayoutItem *graphicsLayoutItem, Qt::Alignment alignment) +{ + if (QGraphicsGridLayoutEngineItem *gridEngineItem = findLayoutItem(graphicsLayoutItem)) { + gridEngineItem->setAlignment(alignment); + invalidate(); + } +} + +Qt::Alignment QGraphicsGridLayoutEngine::alignment(QGraphicsLayoutItem *graphicsLayoutItem) const +{ + if (QGraphicsGridLayoutEngineItem *gridEngineItem = findLayoutItem(graphicsLayoutItem)) + return gridEngineItem->alignment(); + return 0; +} + + +void QGraphicsGridLayoutEngine::setStretchFactor(QGraphicsLayoutItem *layoutItem, int stretch, + Qt::Orientation orientation) +{ + Q_ASSERT(stretch >= 0); + + if (QGraphicsGridLayoutEngineItem *item = findLayoutItem(layoutItem)) + item->setStretchFactor(stretch, orientation); +} + +int QGraphicsGridLayoutEngine::stretchFactor(QGraphicsLayoutItem *layoutItem, Qt::Orientation orientation) const +{ + if (QGraphicsGridLayoutEngineItem *item = findLayoutItem(layoutItem)) + return item->stretchFactor(orientation); + return 0; +} + + +QT_END_NAMESPACE diff --git a/src/widgets/graphicsview/qgraphicsgridlayoutengine_p.h b/src/widgets/graphicsview/qgraphicsgridlayoutengine_p.h new file mode 100644 index 0000000000..3d34f99977 --- /dev/null +++ b/src/widgets/graphicsview/qgraphicsgridlayoutengine_p.h @@ -0,0 +1,125 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtWidgets module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** 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, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSGRIDLAYOUTENGINE_P_H +#define QGRAPHICSGRIDLAYOUTENGINE_P_H + +#include "qgridlayoutengine_p.h" + +#include <QtWidgets/qsizepolicy.h> +#include <QtWidgets/qstyle.h> +#include <QtWidgets/qstyleoption.h> +#include "qgraphicslayoutitem.h" + +QT_BEGIN_NAMESPACE + +class QGraphicsLayoutPrivate; + +class QGraphicsGridLayoutEngineItem : public QGridLayoutItem { +public: + QGraphicsGridLayoutEngineItem(QGraphicsLayoutItem *item, int row, int columns, int rowSpan = 1, int columnSpan = 1, + Qt::Alignment alignment = 0) + : QGridLayoutItem(row, columns, rowSpan, columnSpan, alignment), q_layoutItem(item) {} + + virtual QLayoutPolicy::Policy sizePolicy(Qt::Orientation orientation) const Q_DECL_OVERRIDE + { + QSizePolicy sizePolicy(q_layoutItem->sizePolicy()); + return (QLayoutPolicy::Policy)((orientation == Qt::Horizontal) ? sizePolicy.horizontalPolicy() + : sizePolicy.verticalPolicy()); + } + + virtual QLayoutPolicy::ControlTypes controlTypes(LayoutSide) const Q_DECL_OVERRIDE + { + const QSizePolicy::ControlType ct = q_layoutItem->sizePolicy().controlType(); + return (QLayoutPolicy::ControlTypes)ct; + } + + virtual QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const Q_DECL_OVERRIDE + { + return q_layoutItem->effectiveSizeHint(which, constraint); + } + + virtual void setGeometry(const QRectF &rect) Q_DECL_OVERRIDE + { + q_layoutItem->setGeometry(rect); + } + + virtual bool hasDynamicConstraint() const Q_DECL_OVERRIDE; + virtual Qt::Orientation dynamicConstraintOrientation() const Q_DECL_OVERRIDE; + + QGraphicsLayoutItem *layoutItem() const { return q_layoutItem; } + +protected: + QGraphicsLayoutItem *q_layoutItem; +}; + + +class QGraphicsGridLayoutEngine : public QGridLayoutEngine +{ +public: + QGraphicsGridLayoutEngineItem *findLayoutItem(QGraphicsLayoutItem *layoutItem) const + { + const int index = indexOf(layoutItem); + if (index < 0) + return 0; + return static_cast<QGraphicsGridLayoutEngineItem*>(q_items.at(index)); + } + + int indexOf(QGraphicsLayoutItem *item) const + { + for (int i = 0; i < q_items.count(); ++i) { + if (item == static_cast<QGraphicsGridLayoutEngineItem*>(q_items.at(i))->layoutItem()) + return i; + } + return -1; + } + + void setAlignment(QGraphicsLayoutItem *graphicsLayoutItem, Qt::Alignment alignment); + Qt::Alignment alignment(QGraphicsLayoutItem *graphicsLayoutItem) const; + + void setStretchFactor(QGraphicsLayoutItem *layoutItem, int stretch, Qt::Orientation orientation); + int stretchFactor(QGraphicsLayoutItem *layoutItem, Qt::Orientation orientation) const; + +}; + +QT_END_NAMESPACE + +#endif // QGRAPHICSGRIDLAYOUTENGINE_P_H diff --git a/src/widgets/graphicsview/qgraphicslayoutstyleinfo.cpp b/src/widgets/graphicsview/qgraphicslayoutstyleinfo.cpp new file mode 100644 index 0000000000..3270fc20a3 --- /dev/null +++ b/src/widgets/graphicsview/qgraphicslayoutstyleinfo.cpp @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtWidgets module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** 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, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "qgraphicslayoutstyleinfo_p.h" +#include "qgraphicslayout_p.h" +#include "qgraphicswidget.h" +#include <QtWidgets/qstyle.h> +#include <QtWidgets/qwidget.h> +#include <QtWidgets/qapplication.h> + +QT_BEGIN_NAMESPACE + +QGraphicsLayoutStyleInfo::QGraphicsLayoutStyleInfo(const QGraphicsLayoutPrivate *layout) + : m_layout(layout), m_style(0) +{ + m_widget = new QWidget; // pixelMetric might need a widget ptr + if (m_widget) + m_styleOption.initFrom(m_widget); + m_isWindow = m_styleOption.state & QStyle::State_Window; +} + +QGraphicsLayoutStyleInfo::~QGraphicsLayoutStyleInfo() +{ + delete m_widget; +} + +qreal QGraphicsLayoutStyleInfo::combinedLayoutSpacing(QLayoutPolicy::ControlTypes controls1, + QLayoutPolicy::ControlTypes controls2, + Qt::Orientation orientation) const +{ + Q_ASSERT(style()); + return style()->combinedLayoutSpacing(QSizePolicy::ControlTypes(int(controls1)), QSizePolicy::ControlTypes(int(controls2)), + orientation, const_cast<QStyleOption*>(&m_styleOption), widget()); +} + +qreal QGraphicsLayoutStyleInfo::perItemSpacing(QLayoutPolicy::ControlType control1, + QLayoutPolicy::ControlType control2, + Qt::Orientation orientation) const +{ + Q_ASSERT(style()); + return style()->layoutSpacing(QSizePolicy::ControlType(control1), QSizePolicy::ControlType(control2), + orientation, const_cast<QStyleOption*>(&m_styleOption), widget()); +} + +qreal QGraphicsLayoutStyleInfo::spacing(Qt::Orientation orientation) const +{ + Q_ASSERT(style()); + return style()->pixelMetric(orientation == Qt::Horizontal ? QStyle::PM_LayoutHorizontalSpacing : QStyle::PM_LayoutVerticalSpacing); +} + +qreal QGraphicsLayoutStyleInfo::windowMargin(Qt::Orientation orientation) const +{ + return style()->pixelMetric(orientation == Qt::Vertical + ? QStyle::PM_LayoutBottomMargin + : QStyle::PM_LayoutRightMargin, + const_cast<QStyleOption*>(&m_styleOption), widget()); +} + +QWidget *QGraphicsLayoutStyleInfo::widget() const { return m_widget; } + +QStyle *QGraphicsLayoutStyleInfo::style() const +{ + if (!m_style) { + Q_ASSERT(m_layout); + QGraphicsItem *item = m_layout->parentItem(); + m_style = (item && item->isWidget()) ? static_cast<QGraphicsWidget*>(item)->style() : QApplication::style(); + } + return m_style; +} + +QT_END_NAMESPACE diff --git a/src/widgets/graphicsview/qgraphicslayoutstyleinfo_p.h b/src/widgets/graphicsview/qgraphicslayoutstyleinfo_p.h new file mode 100644 index 0000000000..275ebab6a1 --- /dev/null +++ b/src/widgets/graphicsview/qgraphicslayoutstyleinfo_p.h @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtWidgets module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** 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, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef QGRAPHICSLAYOUTSTYLEINFO_P_H +#define QGRAPHICSLAYOUTSTYLEINFO_P_H + +#include <QtGui/private/qabstractlayoutstyleinfo_p.h> +#include <QtWidgets/qstyleoption.h> + +QT_BEGIN_NAMESPACE + +class QStyle; +class QWidget; +class QGraphicsLayoutPrivate; + +class QGraphicsLayoutStyleInfo : public QAbstractLayoutStyleInfo +{ +public: + QGraphicsLayoutStyleInfo(const QGraphicsLayoutPrivate *layout); + ~QGraphicsLayoutStyleInfo(); + + virtual qreal combinedLayoutSpacing(QLayoutPolicy::ControlTypes controls1, + QLayoutPolicy::ControlTypes controls2, + Qt::Orientation orientation) const Q_DECL_OVERRIDE; + + virtual qreal perItemSpacing(QLayoutPolicy::ControlType control1, + QLayoutPolicy::ControlType control2, + Qt::Orientation orientation) const Q_DECL_OVERRIDE; + + virtual qreal spacing(Qt::Orientation orientation) const Q_DECL_OVERRIDE; + + virtual qreal windowMargin(Qt::Orientation orientation) const Q_DECL_OVERRIDE; + + virtual void invalidate() Q_DECL_OVERRIDE + { + m_style = 0; + QAbstractLayoutStyleInfo::invalidate(); + } + + virtual bool hasChangedCore() const Q_DECL_OVERRIDE + { + QStyle *s = m_style; + // Note that style() will change m_style + return s != style(); + } + + QWidget *widget() const; + QStyle *style() const; + +private: + const QGraphicsLayoutPrivate *m_layout; + mutable QStyle *m_style; + QStyleOption m_styleOption; + QWidget *m_widget; +}; + +QT_END_NAMESPACE + +#endif // QGRAPHICSLAYOUTSTYLEINFO_P_H
\ No newline at end of file diff --git a/src/widgets/graphicsview/qgraphicslinearlayout.cpp b/src/widgets/graphicsview/qgraphicslinearlayout.cpp index 00076502ea..f506148ea3 100644 --- a/src/widgets/graphicsview/qgraphicslinearlayout.cpp +++ b/src/widgets/graphicsview/qgraphicslinearlayout.cpp @@ -122,7 +122,8 @@ #include "qgraphicslayoutitem.h" #include "qgraphicslinearlayout.h" #include "qgraphicswidget.h" -#include "qgridlayoutengine_p.h" +#include "qgraphicsgridlayoutengine_p.h" +#include "qgraphicslayoutstyleinfo_p.h" #ifdef QT_DEBUG #include <QtCore/qdebug.h> #endif @@ -132,16 +133,20 @@ QT_BEGIN_NAMESPACE class QGraphicsLinearLayoutPrivate : public QGraphicsLayoutPrivate { public: - QGraphicsLinearLayoutPrivate(Qt::Orientation orientation) : orientation(orientation) { } + QGraphicsLinearLayoutPrivate(Qt::Orientation orientation) + : orientation(orientation), + m_styleInfo(0) + { } void removeGridItem(QGridLayoutItem *gridItem); - QLayoutStyleInfo styleInfo() const; + QGraphicsLayoutStyleInfo *styleInfo() const; void fixIndex(int *index) const; int gridRow(int index) const; int gridColumn(int index) const; Qt::Orientation orientation; - QGridLayoutEngine engine; + mutable QGraphicsLayoutStyleInfo *m_styleInfo; + QGraphicsGridLayoutEngine engine; }; void QGraphicsLinearLayoutPrivate::removeGridItem(QGridLayoutItem *gridItem) @@ -172,13 +177,12 @@ int QGraphicsLinearLayoutPrivate::gridColumn(int index) const return int(qMin(uint(index), uint(engine.columnCount()))); } -Q_GLOBAL_STATIC(QWidget, globalStyleInfoWidget) - -QLayoutStyleInfo QGraphicsLinearLayoutPrivate::styleInfo() const +QGraphicsLayoutStyleInfo *QGraphicsLinearLayoutPrivate::styleInfo() const { - QGraphicsItem *item = parentItem(); - QStyle *style = (item && item->isWidget()) ? static_cast<QGraphicsWidget*>(item)->style() : QApplication::style(); - return QLayoutStyleInfo(style, globalStyleInfoWidget()); + if (!m_styleInfo) + m_styleInfo = new QGraphicsLayoutStyleInfo(this); + m_styleInfo->updateChanged(QAbstractLayoutStyleInfo::Unknown); + return m_styleInfo; } /*! @@ -281,7 +285,8 @@ void QGraphicsLinearLayout::insertItem(int index, QGraphicsLayoutItem *item) Q_ASSERT(item); d->fixIndex(&index); d->engine.insertRow(index, d->orientation); - new QGridLayoutItem(&d->engine, item, d->gridRow(index), d->gridColumn(index), 1, 1, 0, index); + QGraphicsGridLayoutEngineItem *gridEngineItem = new QGraphicsGridLayoutEngineItem(item, d->gridRow(index), d->gridColumn(index), 1, 1, 0); + d->engine.insertItem(gridEngineItem, index); invalidate(); } @@ -309,7 +314,7 @@ void QGraphicsLinearLayout::insertStretch(int index, int stretch) void QGraphicsLinearLayout::removeItem(QGraphicsLayoutItem *item) { Q_D(QGraphicsLinearLayout); - if (QGridLayoutItem *gridItem = d->engine.findLayoutItem(item)) { + if (QGraphicsGridLayoutEngineItem *gridItem = d->engine.findLayoutItem(item)) { item->setParentLayoutItem(0); d->removeGridItem(gridItem); delete gridItem; @@ -330,7 +335,8 @@ void QGraphicsLinearLayout::removeAt(int index) qWarning("QGraphicsLinearLayout::removeAt: invalid index %d", index); return; } - if (QGridLayoutItem *gridItem = d->engine.itemAt(index)) { + + if (QGraphicsGridLayoutEngineItem *gridItem = static_cast<QGraphicsGridLayoutEngineItem*>(d->engine.itemAt(index))) { if (QGraphicsLayoutItem *layoutItem = gridItem->layoutItem()) layoutItem->setParentLayoutItem(0); d->removeGridItem(gridItem); @@ -365,7 +371,7 @@ void QGraphicsLinearLayout::setSpacing(qreal spacing) qreal QGraphicsLinearLayout::spacing() const { Q_D(const QGraphicsLinearLayout); - return d->engine.spacing(d->styleInfo(), d->orientation); + return d->engine.spacing(d->orientation, d->styleInfo()); } /*! @@ -485,7 +491,7 @@ QGraphicsLayoutItem *QGraphicsLinearLayout::itemAt(int index) const return 0; } QGraphicsLayoutItem *item = 0; - if (QGridLayoutItem *gridItem = d->engine.itemAt(index)) + if (QGraphicsGridLayoutEngineItem *gridItem = static_cast<QGraphicsGridLayoutEngineItem *>(d->engine.itemAt(index))) item = gridItem->layoutItem(); return item; } @@ -512,7 +518,7 @@ void QGraphicsLinearLayout::setGeometry(const QRectF &rect) dump(1); } #endif - d->engine.setGeometries(d->styleInfo(), effectiveRect); + d->engine.setGeometries(effectiveRect, d->styleInfo()); #ifdef QT_DEBUG if (qt_graphicsLayoutDebug()) { qDebug() << "post dump"; @@ -530,7 +536,7 @@ QSizeF QGraphicsLinearLayout::sizeHint(Qt::SizeHint which, const QSizeF &constra qreal left, top, right, bottom; getContentsMargins(&left, &top, &right, &bottom); const QSizeF extraMargins(left + right, top + bottom); - return d->engine.sizeHint(d->styleInfo(), which , constraint - extraMargins) + extraMargins; + return d->engine.sizeHint(which , constraint - extraMargins, d->styleInfo()) + extraMargins; } /*! @@ -540,6 +546,8 @@ void QGraphicsLinearLayout::invalidate() { Q_D(QGraphicsLinearLayout); d->engine.invalidate(); + if (d->m_styleInfo) + d->m_styleInfo->invalidate(); QGraphicsLayout::invalidate(); } diff --git a/src/widgets/graphicsview/qgridlayoutengine.cpp b/src/widgets/graphicsview/qgridlayoutengine.cpp index bac8d52c9a..2fabf98cf8 100644 --- a/src/widgets/graphicsview/qgridlayoutengine.cpp +++ b/src/widgets/graphicsview/qgridlayoutengine.cpp @@ -45,9 +45,7 @@ #include <math.h> -#include "qgraphicslayoutitem.h" #include "qgridlayoutengine_p.h" -#include "qstyleoption.h" #include "qvarlengtharray.h" #include <QtDebug> @@ -484,10 +482,9 @@ void QGridLayoutRowData::dump(int indent) const } #endif -QGridLayoutItem::QGridLayoutItem(QGridLayoutEngine *engine, QGraphicsLayoutItem *layoutItem, - int row, int column, int rowSpan, int columnSpan, - Qt::Alignment alignment, int itemAtIndex) - : q_engine(engine), q_layoutItem(layoutItem), q_alignment(alignment) +QGridLayoutItem::QGridLayoutItem(int row, int column, int rowSpan, int columnSpan, + Qt::Alignment alignment) + : q_alignment(alignment) { q_firstRows[Hor] = column; q_firstRows[Ver] = row; @@ -495,8 +492,6 @@ QGridLayoutItem::QGridLayoutItem(QGridLayoutEngine *engine, QGraphicsLayoutItem q_rowSpans[Ver] = rowSpan; q_stretches[Hor] = -1; q_stretches[Ver] = -1; - - q_engine->insertItem(this, itemAtIndex); } int QGridLayoutItem::firstRow(Qt::Orientation orientation) const @@ -545,11 +540,11 @@ int QGridLayoutItem::stretchFactor(Qt::Orientation orientation) const if (stretch >= 0) return stretch; - QSizePolicy::Policy policy = sizePolicy(orientation); + QLayoutPolicy::Policy policy = sizePolicy(orientation); - if (policy & QSizePolicy::ExpandFlag) { + if (policy & QLayoutPolicy::ExpandFlag) { return 1; - } else if (policy & QSizePolicy::GrowFlag) { + } else if (policy & QLayoutPolicy::GrowFlag) { return -1; // because we max it up } else { return 0; @@ -562,58 +557,28 @@ void QGridLayoutItem::setStretchFactor(int stretch, Qt::Orientation orientation) q_stretches[orientation == Qt::Vertical] = stretch; } -QSizePolicy::Policy QGridLayoutItem::sizePolicy(Qt::Orientation orientation) const -{ - QSizePolicy sizePolicy(q_layoutItem->sizePolicy()); - return (orientation == Qt::Horizontal) ? sizePolicy.horizontalPolicy() - : sizePolicy.verticalPolicy(); -} - -/* - returns \c true if the size policy returns \c true for either hasHeightForWidth() - or hasWidthForHeight() - */ -bool QGridLayoutItem::hasDynamicConstraint() const -{ - return QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasHeightForWidth() - || QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasWidthForHeight(); -} - -Qt::Orientation QGridLayoutItem::dynamicConstraintOrientation() const -{ - if (QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasHeightForWidth()) - return Qt::Vertical; - else //if (QGraphicsLayoutItemPrivate::get(q_layoutItem)->hasWidthForHeight()) - return Qt::Horizontal; -} - -QSizePolicy::ControlTypes QGridLayoutItem::controlTypes(LayoutSide /* side */) const +QLayoutPolicy::ControlTypes QGridLayoutItem::controlTypes(LayoutSide /*side*/) const { - return q_layoutItem->sizePolicy().controlType(); -} - -QSizeF QGridLayoutItem::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const -{ - return q_layoutItem->effectiveSizeHint(which, constraint); + return QLayoutPolicy::DefaultType; } QGridLayoutBox QGridLayoutItem::box(Qt::Orientation orientation, qreal constraint) const { QGridLayoutBox result; - QSizePolicy::Policy policy = sizePolicy(orientation); + QLayoutPolicy::Policy policy = sizePolicy(orientation); if (orientation == Qt::Horizontal) { QSizeF constraintSize(-1.0, constraint); result.q_preferredSize = sizeHint(Qt::PreferredSize, constraintSize).width(); - if (policy & QSizePolicy::ShrinkFlag) { + if (policy & QLayoutPolicy::ShrinkFlag) { result.q_minimumSize = sizeHint(Qt::MinimumSize, constraintSize).width(); } else { result.q_minimumSize = result.q_preferredSize; } - if (policy & (QSizePolicy::GrowFlag | QSizePolicy::ExpandFlag)) { + if (policy & (QLayoutPolicy::GrowFlag | QLayoutPolicy::ExpandFlag)) { result.q_maximumSize = sizeHint(Qt::MaximumSize, constraintSize).width(); } else { result.q_maximumSize = result.q_preferredSize; @@ -623,13 +588,13 @@ QGridLayoutBox QGridLayoutItem::box(Qt::Orientation orientation, qreal constrain result.q_preferredSize = sizeHint(Qt::PreferredSize, constraintSize).height(); - if (policy & QSizePolicy::ShrinkFlag) { + if (policy & QLayoutPolicy::ShrinkFlag) { result.q_minimumSize = sizeHint(Qt::MinimumSize, constraintSize).height(); } else { result.q_minimumSize = result.q_preferredSize; } - if (policy & (QSizePolicy::GrowFlag | QSizePolicy::ExpandFlag)) { + if (policy & (QLayoutPolicy::GrowFlag | QLayoutPolicy::ExpandFlag)) { result.q_maximumSize = sizeHint(Qt::MaximumSize, constraintSize).height(); } else { result.q_maximumSize = result.q_preferredSize; @@ -639,14 +604,14 @@ QGridLayoutBox QGridLayoutItem::box(Qt::Orientation orientation, qreal constrain if (result.q_minimumDescent >= 0.0) result.q_minimumAscent = result.q_minimumSize - result.q_minimumDescent; } - if (policy & QSizePolicy::IgnoreFlag) + if (policy & QLayoutPolicy::IgnoreFlag) result.q_preferredSize = result.q_minimumSize; return result; } QRectF QGridLayoutItem::geometryWithin(qreal x, qreal y, qreal width, qreal height, - qreal rowDescent) const + qreal rowDescent, Qt::Alignment align) const { rowDescent = -1.0; // ### This disables the descent @@ -669,7 +634,6 @@ QRectF QGridLayoutItem::geometryWithin(qreal x, qreal y, qreal width, qreal heig width = size.width(); height = size.height(); - Qt::Alignment align = q_engine->effectiveAlignment(this); switch (align & Qt::AlignHorizontal_Mask) { case Qt::AlignHCenter: x += (cellWidth - width)/2; @@ -698,11 +662,6 @@ QRectF QGridLayoutItem::geometryWithin(qreal x, qreal y, qreal width, qreal heig } } -void QGridLayoutItem::setGeometry(const QRectF &rect) -{ - q_layoutItem->setGeometry(rect); -} - void QGridLayoutItem::transpose() { qSwap(q_firstRows[Hor], q_firstRows[Ver]); @@ -722,7 +681,7 @@ void QGridLayoutItem::insertOrRemoveRows(int row, int delta, Qt::Orientation ori /*! \internal returns the effective maximumSize, will take the sizepolicy into - consideration. (i.e. if sizepolicy does not have QSizePolicy::Grow, then + consideration. (i.e. if sizepolicy does not have QLayoutPolicy::Grow, then maxSizeHint will be the preferredSize) Note that effectiveSizeHint does not take sizePolicy into consideration, (since it only evaluates the hints, as the name implies) @@ -730,10 +689,10 @@ void QGridLayoutItem::insertOrRemoveRows(int row, int delta, Qt::Orientation ori QSizeF QGridLayoutItem::effectiveMaxSize(const QSizeF &constraint) const { QSizeF size = constraint; - bool vGrow = (sizePolicy(Qt::Vertical) & QSizePolicy::GrowFlag) == QSizePolicy::GrowFlag; - bool hGrow = (sizePolicy(Qt::Horizontal) & QSizePolicy::GrowFlag) == QSizePolicy::GrowFlag; + bool vGrow = (sizePolicy(Qt::Vertical) & QLayoutPolicy::GrowFlag) == QLayoutPolicy::GrowFlag; + bool hGrow = (sizePolicy(Qt::Horizontal) & QLayoutPolicy::GrowFlag) == QLayoutPolicy::GrowFlag; if (!vGrow || !hGrow) { - QSizeF pref = layoutItem()->effectiveSizeHint(Qt::PreferredSize, constraint); + QSizeF pref = sizeHint(Qt::PreferredSize, constraint); if (!vGrow) size.setHeight(pref.height()); if (!hGrow) @@ -741,7 +700,7 @@ QSizeF QGridLayoutItem::effectiveMaxSize(const QSizeF &constraint) const } if (!size.isValid()) { - QSizeF maxSize = layoutItem()->effectiveSizeHint(Qt::MaximumSize, size); + QSizeF maxSize = sizeHint(Qt::MaximumSize, size); if (size.width() == -1) size.setWidth(maxSize.width()); if (size.height() == -1) @@ -753,7 +712,7 @@ QSizeF QGridLayoutItem::effectiveMaxSize(const QSizeF &constraint) const #ifdef QT_DEBUG void QGridLayoutItem::dump(int indent) const { - qDebug("%*s%p (%d, %d) %d x %d", indent, "", q_layoutItem, firstRow(), firstColumn(), + qDebug("%*s (%d, %d) %d x %d", indent, "", firstRow(), firstColumn(), //### rowSpan(), columnSpan()); if (q_stretches[Hor] >= 0) @@ -828,15 +787,6 @@ QGridLayoutItem *QGridLayoutEngine::itemAt(int index) const return q_items.at(index); } -int QGridLayoutEngine::indexOf(QGraphicsLayoutItem *item) const -{ - for (int i = 0; i < q_items.size(); ++i) { - if (item == q_items.at(i)->layoutItem()) - return i; - } - return -1; -} - int QGridLayoutEngine::effectiveFirstRow(Qt::Orientation orientation) const { ensureEffectiveFirstAndLastRows(); @@ -860,14 +810,10 @@ void QGridLayoutEngine::setSpacing(qreal spacing, Qt::Orientations orientations) invalidate(); } -qreal QGridLayoutEngine::spacing(const QLayoutStyleInfo &styleInfo, Qt::Orientation orientation) const +qreal QGridLayoutEngine::spacing(Qt::Orientation orientation, const QAbstractLayoutStyleInfo *styleInfo) const { - if (q_defaultSpacings[orientation == Qt::Vertical].isDefault()) { - QStyle *style = styleInfo.style(); - QStyleOption option; - option.initFrom(styleInfo.widget()); - qreal defaultSpacing = (qreal)style->pixelMetric(orientation == Qt::Vertical ? QStyle::PM_LayoutVerticalSpacing - : QStyle::PM_LayoutHorizontalSpacing, &option, styleInfo.widget()); + if (!q_defaultSpacings[orientation == Qt::Vertical].isUser()) { + qreal defaultSpacing = styleInfo->spacing(orientation); q_defaultSpacings[orientation == Qt::Vertical].setCachedValue(defaultSpacing); } return q_defaultSpacings[orientation == Qt::Vertical].value(); @@ -916,22 +862,6 @@ int QGridLayoutEngine::rowStretchFactor(int row, Qt::Orientation orientation) co return 0; } -void QGridLayoutEngine::setStretchFactor(QGraphicsLayoutItem *layoutItem, int stretch, - Qt::Orientation orientation) -{ - Q_ASSERT(stretch >= 0); - - if (QGridLayoutItem *item = findLayoutItem(layoutItem)) - item->setStretchFactor(stretch, orientation); -} - -int QGridLayoutEngine::stretchFactor(QGraphicsLayoutItem *layoutItem, Qt::Orientation orientation) const -{ - if (QGridLayoutItem *item = findLayoutItem(layoutItem)) - return item->stretchFactor(orientation); - return 0; -} - void QGridLayoutEngine::setRowSizeHint(Qt::SizeHint which, int row, qreal size, Qt::Orientation orientation) { @@ -970,20 +900,6 @@ Qt::Alignment QGridLayoutEngine::rowAlignment(int row, Qt::Orientation orientati return q_infos[orientation == Qt::Vertical].alignments.value(row); } -void QGridLayoutEngine::setAlignment(QGraphicsLayoutItem *layoutItem, Qt::Alignment alignment) -{ - if (QGridLayoutItem *item = findLayoutItem(layoutItem)) - item->setAlignment(alignment); - invalidate(); -} - -Qt::Alignment QGridLayoutEngine::alignment(QGraphicsLayoutItem *layoutItem) const -{ - if (QGridLayoutItem *item = findLayoutItem(layoutItem)) - return item->alignment(); - return 0; -} - Qt::Alignment QGridLayoutEngine::effectiveAlignment(const QGridLayoutItem *layoutItem) const { Qt::Alignment align = layoutItem->alignment(); @@ -999,6 +915,7 @@ Qt::Alignment QGridLayoutEngine::effectiveAlignment(const QGridLayoutItem *layou int x = layoutItem->firstColumn(); align |= (rowAlignment(x, Qt::Horizontal) & Qt::AlignHorizontal_Mask); } + return align; } @@ -1047,15 +964,6 @@ void QGridLayoutEngine::removeItem(QGridLayoutItem *item) q_items.removeAll(item); } -QGridLayoutItem *QGridLayoutEngine::findLayoutItem(QGraphicsLayoutItem *layoutItem) const -{ - for (int i = q_items.count() - 1; i >= 0; --i) { - QGridLayoutItem *item = q_items.at(i); - if (item->layoutItem() == layoutItem) - return item; - } - return 0; -} QGridLayoutItem *QGridLayoutEngine::itemAt(int row, int column, Qt::Orientation orientation) const { @@ -1072,7 +980,7 @@ void QGridLayoutEngine::invalidate() q_cachedEffectiveFirstRows[Ver] = -1; q_cachedEffectiveLastRows[Hor] = -1; q_cachedEffectiveLastRows[Ver] = -1; - q_cachedDataForStyleInfo.invalidate(); + q_totalBoxesValid = false; q_cachedSize = QSizeF(); q_cachedConstraintOrientation = UnknownConstraint; } @@ -1083,13 +991,12 @@ static void visualRect(QRectF *geom, Qt::LayoutDirection dir, const QRectF &cont geom->moveRight(contentsRect.right() - (geom->left() - contentsRect.left())); } -void QGridLayoutEngine::setGeometries(const QLayoutStyleInfo &styleInfo, - const QRectF &contentsGeometry) +void QGridLayoutEngine::setGeometries(const QRectF &contentsGeometry, const QAbstractLayoutStyleInfo *styleInfo) { if (rowCount() < 1 || columnCount() < 1) return; - ensureGeometries(styleInfo, contentsGeometry.size()); + ensureGeometries(contentsGeometry.size(), styleInfo); for (int i = q_items.count() - 1; i >= 0; --i) { QGridLayoutItem *item = q_items.at(i); @@ -1105,22 +1012,21 @@ void QGridLayoutEngine::setGeometries(const QLayoutStyleInfo &styleInfo, height += q_yy[item->lastRow()] - y; QRectF geom = item->geometryWithin(contentsGeometry.x() + x, contentsGeometry.y() + y, - width, height, q_descents[item->lastRow()]); + width, height, q_descents[item->lastRow()], effectiveAlignment(item)); visualRect(&geom, visualDirection(), contentsGeometry); item->setGeometry(geom); } } // ### candidate for deletion -QRectF QGridLayoutEngine::cellRect(const QLayoutStyleInfo &styleInfo, - const QRectF &contentsGeometry, int row, int column, int rowSpan, - int columnSpan) const +QRectF QGridLayoutEngine::cellRect(const QRectF &contentsGeometry, int row, int column, int rowSpan, + int columnSpan, const QAbstractLayoutStyleInfo *styleInfo) const { if (uint(row) >= uint(rowCount()) || uint(column) >= uint(columnCount()) || rowSpan < 1 || columnSpan < 1) return QRectF(); - ensureGeometries(styleInfo, contentsGeometry.size()); + ensureGeometries(contentsGeometry.size(), styleInfo); int lastColumn = qMax(column + columnSpan, columnCount()) - 1; int lastRow = qMax(row + rowSpan, rowCount()) - 1; @@ -1138,8 +1044,8 @@ QRectF QGridLayoutEngine::cellRect(const QLayoutStyleInfo &styleInfo, return QRectF(contentsGeometry.x() + x, contentsGeometry.y() + y, width, height); } -QSizeF QGridLayoutEngine::sizeHint(const QLayoutStyleInfo &styleInfo, Qt::SizeHint which, - const QSizeF &constraint) const +QSizeF QGridLayoutEngine::sizeHint(Qt::SizeHint which, const QSizeF &constraint, + const QAbstractLayoutStyleInfo *styleInfo) const { QGridLayoutBox sizehint_totalBoxes[NOrientations]; @@ -1149,8 +1055,8 @@ QSizeF QGridLayoutEngine::sizeHint(const QLayoutStyleInfo &styleInfo, Qt::SizeHi if (constraintOrientation() == Qt::Vertical) { //We have items whose height depends on their width if (constraint.width() >= 0) { - if (q_cachedDataForStyleInfo != styleInfo) - ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], styleInfo, NULL, NULL, Qt::Horizontal); + if (styleInfo->hasChanged() || !q_totalBoxesValid) + ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], NULL, NULL, Qt::Horizontal, styleInfo); else sizehint_totalBoxes[Hor] = q_totalBoxes[Hor]; QVector<qreal> sizehint_xx; @@ -1163,13 +1069,13 @@ QSizeF QGridLayoutEngine::sizeHint(const QLayoutStyleInfo &styleInfo, Qt::SizeHi //constraints to find the row heights q_columnData.calculateGeometries(0, columnCount(), width, sizehint_xx.data(), sizehint_widths.data(), 0, sizehint_totalBoxes[Hor], q_infos[Hor]); - ensureColumnAndRowData(&q_rowData, &sizehint_totalBoxes[Ver], styleInfo, sizehint_xx.data(), sizehint_widths.data(), Qt::Vertical); + ensureColumnAndRowData(&q_rowData, &sizehint_totalBoxes[Ver], sizehint_xx.data(), sizehint_widths.data(), Qt::Vertical, styleInfo); sizeHintCalculated = true; } } else { if (constraint.height() >= 0) { //We have items whose width depends on their height - ensureColumnAndRowData(&q_rowData, &sizehint_totalBoxes[Ver], styleInfo, NULL, NULL, Qt::Vertical); + ensureColumnAndRowData(&q_rowData, &sizehint_totalBoxes[Ver], NULL, NULL, Qt::Vertical, styleInfo); QVector<qreal> sizehint_yy; QVector<qreal> sizehint_heights; @@ -1180,7 +1086,7 @@ QSizeF QGridLayoutEngine::sizeHint(const QLayoutStyleInfo &styleInfo, Qt::SizeHi //constraints to find the column widths q_rowData.calculateGeometries(0, rowCount(), height, sizehint_yy.data(), sizehint_heights.data(), 0, sizehint_totalBoxes[Ver], q_infos[Ver]); - ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], styleInfo, sizehint_yy.data(), sizehint_heights.data(), Qt::Horizontal); + ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], sizehint_yy.data(), sizehint_heights.data(), Qt::Horizontal, styleInfo); sizeHintCalculated = true; } } @@ -1188,9 +1094,9 @@ QSizeF QGridLayoutEngine::sizeHint(const QLayoutStyleInfo &styleInfo, Qt::SizeHi if (!sizeHintCalculated) { //No items with height for width, so it doesn't matter which order we do these in - if (q_cachedDataForStyleInfo != styleInfo) { - ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], styleInfo, NULL, NULL, Qt::Horizontal); - ensureColumnAndRowData(&q_rowData, &sizehint_totalBoxes[Ver], styleInfo, NULL, NULL, Qt::Vertical); + if (styleInfo->hasChanged() || !q_totalBoxesValid) { + ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], NULL, NULL, Qt::Horizontal, styleInfo); + ensureColumnAndRowData(&q_rowData, &sizehint_totalBoxes[Ver], NULL, NULL, Qt::Vertical, styleInfo); } else { sizehint_totalBoxes[Hor] = q_totalBoxes[Hor]; sizehint_totalBoxes[Ver] = q_totalBoxes[Ver]; @@ -1212,12 +1118,12 @@ QSizeF QGridLayoutEngine::sizeHint(const QLayoutStyleInfo &styleInfo, Qt::SizeHi return QSizeF(); } -QSizePolicy::ControlTypes QGridLayoutEngine::controlTypes(LayoutSide side) const +QLayoutPolicy::ControlTypes QGridLayoutEngine::controlTypes(LayoutSide side) const { Qt::Orientation orientation = (side == Top || side == Bottom) ? Qt::Vertical : Qt::Horizontal; int row = (side == Top || side == Left) ? effectiveFirstRow(orientation) : effectiveLastRow(orientation); - QSizePolicy::ControlTypes result = 0; + QLayoutPolicy::ControlTypes result = 0; for (int column = columnCount(orientation) - 1; column >= 0; --column) { if (QGridLayoutItem *item = itemAt(row, column, orientation)) @@ -1380,26 +1286,19 @@ void QGridLayoutEngine::insertOrRemoveRows(int row, int delta, Qt::Orientation o regenerateGrid(); } -void QGridLayoutEngine::fillRowData(QGridLayoutRowData *rowData, const QLayoutStyleInfo &styleInfo, +void QGridLayoutEngine::fillRowData(QGridLayoutRowData *rowData, qreal *colPositions, qreal *colSizes, - Qt::Orientation orientation) const + Qt::Orientation orientation, + const QAbstractLayoutStyleInfo *styleInfo) const { - const int ButtonMask = QSizePolicy::ButtonBox | QSizePolicy::PushButton; + const int ButtonMask = QLayoutPolicy::ButtonBox | QLayoutPolicy::PushButton; const QGridLayoutRowInfo &rowInfo = q_infos[orientation == Qt::Vertical]; const QGridLayoutRowInfo &columnInfo = q_infos[orientation == Qt::Horizontal]; LayoutSide top = (orientation == Qt::Vertical) ? Top : Left; LayoutSide bottom = (orientation == Qt::Vertical) ? Bottom : Right; - QStyle *style = styleInfo.style(); - QStyleOption option; - option.initFrom(styleInfo.widget()); - const QLayoutParameter<qreal> &defaultSpacing = q_defaultSpacings[orientation == Qt::Vertical]; - qreal innerSpacing = 0.0; - if (style) - innerSpacing = (qreal)style->pixelMetric(orientation == Qt::Vertical ? QStyle::PM_LayoutVerticalSpacing - : QStyle::PM_LayoutHorizontalSpacing, - &option, styleInfo.widget()); + qreal innerSpacing = styleInfo->spacing(orientation); if (innerSpacing >= 0.0) defaultSpacing.setCachedValue(innerSpacing); @@ -1456,7 +1355,7 @@ void QGridLayoutEngine::fillRowData(QGridLayoutRowData *rowData, const QLayoutSt continue; QGridLayoutBox &rowBox = rowData->boxes[row]; - if (option.state & QStyle::State_Window) { + if (styleInfo->isWindow()) { nextToNextToLastRowAdHocData = nextToLastRowAdHocData; nextToLastRowAdHocData = lastRowAdHocData; lastRowAdHocData.init(row); @@ -1474,7 +1373,7 @@ void QGridLayoutEngine::fillRowData(QGridLayoutRowData *rowData, const QLayoutSt if (itemRow == row && itemColumn == column) { int itemStretch = item->stretchFactor(orientation); - if (!(item->sizePolicy(orientation) & QSizePolicy::IgnoreFlag)) + if (!(item->sizePolicy(orientation) & QLayoutPolicy::IgnoreFlag)) hasIgnoreFlag = false; int itemRowSpan = item->rowSpan(orientation); @@ -1512,7 +1411,7 @@ void QGridLayoutEngine::fillRowData(QGridLayoutRowData *rowData, const QLayoutSt } if (effectiveRowSpan == 1) { - QSizePolicy::ControlTypes controls = item->controlTypes(top); + QLayoutPolicy::ControlTypes controls = item->controlTypes(top); if (controls & ButtonMask) lastRowAdHocData.q_hasButtons = true; if (controls & ~ButtonMask) @@ -1537,7 +1436,7 @@ void QGridLayoutEngine::fillRowData(QGridLayoutRowData *rowData, const QLayoutSt } /* - Heuristic: Detect button boxes that don't use QSizePolicy::ButtonBox. + Heuristic: Detect button boxes that don't use QLayoutPolicy::ButtonBox. This is somewhat ad hoc but it usually does the trick. */ bool lastRowIsButtonBox = (lastRowAdHocData.hasOnlyButtons() @@ -1560,25 +1459,24 @@ void QGridLayoutEngine::fillRowData(QGridLayoutRowData *rowData, const QLayoutSt QGridLayoutItem *item2 = itemAt(row, column, orientation); if (item1 && item2 && item1 != item2) { - QSizePolicy::ControlTypes controls1 = item1->controlTypes(bottom); - QSizePolicy::ControlTypes controls2 = item2->controlTypes(top); + QLayoutPolicy::ControlTypes controls1 = item1->controlTypes(bottom); + QLayoutPolicy::ControlTypes controls2 = item2->controlTypes(top); - if (controls2 & QSizePolicy::PushButton) { + if (controls2 & QLayoutPolicy::PushButton) { if ((row == nextToLastRowAdHocData.q_row && lastTwoRowsIsButtonBox) || (row == lastRowAdHocData.q_row && lastRowIsButtonBox)) { - controls2 &= ~QSizePolicy::PushButton; - controls2 |= QSizePolicy::ButtonBox; + controls2 &= ~QLayoutPolicy::PushButton; + controls2 |= QLayoutPolicy::ButtonBox; } } - qreal spacing = style->combinedLayoutSpacing(controls1, controls2, - orientation, &option, - styleInfo.widget()); + qreal spacing = styleInfo->combinedLayoutSpacing(controls1, controls2, + orientation); if (orientation == Qt::Horizontal) { qreal width1 = rowData->boxes.at(prevRow).q_minimumSize; qreal width2 = rowData->boxes.at(row).q_minimumSize; - QRectF rect1 = item1->geometryWithin(0.0, 0.0, width1, FLT_MAX, -1.0); - QRectF rect2 = item2->geometryWithin(0.0, 0.0, width2, FLT_MAX, -1.0); + QRectF rect1 = item1->geometryWithin(0.0, 0.0, width1, FLT_MAX, -1.0, effectiveAlignment(item1)); + QRectF rect2 = item2->geometryWithin(0.0, 0.0, width2, FLT_MAX, -1.0, effectiveAlignment(item2)); spacing -= (width1 - (rect1.x() + rect1.width())) + rect2.x(); } else { const QGridLayoutBox &box1 = rowData->boxes.at(prevRow); @@ -1590,9 +1488,9 @@ void QGridLayoutEngine::fillRowData(QGridLayoutRowData *rowData, const QLayoutSt qreal rowDescent2 = fixedDescent(box2.q_minimumDescent, box2.q_minimumAscent, height2); QRectF rect1 = item1->geometryWithin(0.0, 0.0, FLT_MAX, height1, - rowDescent1); + rowDescent1, effectiveAlignment(item1)); QRectF rect2 = item2->geometryWithin(0.0, 0.0, FLT_MAX, height2, - rowDescent2); + rowDescent2, effectiveAlignment(item2)); spacing -= (height1 - (rect1.y() + rect1.height())) + rect2.y(); } rowSpacing = qMax(spacing, rowSpacing); @@ -1610,11 +1508,7 @@ void QGridLayoutEngine::fillRowData(QGridLayoutRowData *rowData, const QLayoutSt int prevRow = lastRowIsButtonBox ? nextToLastRowAdHocData.q_row : nextToNextToLastRowAdHocData.q_row; if (!defaultSpacing.isUser() && !rowInfo.spacings.value(prevRow).isUser()) { - qreal windowMargin = style->pixelMetric(orientation == Qt::Vertical - ? QStyle::PM_LayoutBottomMargin - : QStyle::PM_LayoutRightMargin, - &option, styleInfo.widget()); - + qreal windowMargin = styleInfo->windowMargin(orientation); qreal &rowSpacing = rowData->spacings[prevRow]; rowSpacing = qMax(windowMargin, rowSpacing); } @@ -1647,12 +1541,12 @@ void QGridLayoutEngine::ensureEffectiveFirstAndLastRows() const } void QGridLayoutEngine::ensureColumnAndRowData(QGridLayoutRowData *rowData, QGridLayoutBox *totalBox, - const QLayoutStyleInfo &styleInfo, - qreal *colPositions, qreal *colSizes, - Qt::Orientation orientation) const + qreal *colPositions, qreal *colSizes, + Qt::Orientation orientation, + const QAbstractLayoutStyleInfo *styleInfo) const { rowData->reset(rowCount(orientation)); - fillRowData(rowData, styleInfo, colPositions, colSizes, orientation); + fillRowData(rowData, colPositions, colSizes, orientation, styleInfo); const QGridLayoutRowInfo &rowInfo = q_infos[orientation == Qt::Vertical]; rowData->distributeMultiCells(rowInfo); *totalBox = rowData->totalBox(0, rowCount(orientation)); @@ -1660,7 +1554,7 @@ void QGridLayoutEngine::ensureColumnAndRowData(QGridLayoutRowData *rowData, QGri } /** - returns \c false if the layout has contradicting constraints (i.e. some items with a horizontal + returns false if the layout has contradicting constraints (i.e. some items with a horizontal constraint and other items with a vertical constraint) */ bool QGridLayoutEngine::ensureDynamicConstraint() const @@ -1702,13 +1596,13 @@ Qt::Orientation QGridLayoutEngine::constraintOrientation() const return (Qt::Orientation)q_cachedConstraintOrientation; } -void QGridLayoutEngine::ensureGeometries(const QLayoutStyleInfo &styleInfo, - const QSizeF &size) const +void QGridLayoutEngine::ensureGeometries(const QSizeF &size, + const QAbstractLayoutStyleInfo *styleInfo) const { - if (q_cachedDataForStyleInfo == styleInfo && q_cachedSize == size) + if (!styleInfo->hasChanged() && q_totalBoxesValid && q_cachedSize == size) return; - q_cachedDataForStyleInfo = styleInfo; + q_totalBoxesValid = true; q_cachedSize = size; q_xx.resize(columnCount()); @@ -1718,25 +1612,24 @@ void QGridLayoutEngine::ensureGeometries(const QLayoutStyleInfo &styleInfo, q_descents.resize(rowCount()); if (constraintOrientation() != Qt::Horizontal) { - // We might have items whose height depends on their width, - // or none of the items has a dynamic constraint. - ensureColumnAndRowData(&q_columnData, &q_totalBoxes[Hor], styleInfo, NULL, NULL, Qt::Horizontal); + //We might have items whose width depends on their height + ensureColumnAndRowData(&q_columnData, &q_totalBoxes[Hor], NULL, NULL, Qt::Horizontal, styleInfo); //Calculate column widths and positions, and put results in q_xx.data() and q_widths.data() so that we can use this information as //constraints to find the row heights q_columnData.calculateGeometries(0, columnCount(), size.width(), q_xx.data(), q_widths.data(), 0, q_totalBoxes[Hor], q_infos[Hor] ); - ensureColumnAndRowData(&q_rowData, &q_totalBoxes[Ver], styleInfo, q_xx.data(), q_widths.data(), Qt::Vertical); + ensureColumnAndRowData(&q_rowData, &q_totalBoxes[Ver], q_xx.data(), q_widths.data(), Qt::Vertical, styleInfo); //Calculate row heights and positions, and put results in q_yy.data() and q_heights.data() q_rowData.calculateGeometries(0, rowCount(), size.height(), q_yy.data(), q_heights.data(), q_descents.data(), q_totalBoxes[Ver], q_infos[Ver]); } else { - // We have items whose width depends on their height - ensureColumnAndRowData(&q_rowData, &q_totalBoxes[Ver], styleInfo, NULL, NULL, Qt::Vertical); + //We have items whose height depends on their width + ensureColumnAndRowData(&q_rowData, &q_totalBoxes[Ver], NULL, NULL, Qt::Vertical, styleInfo); //Calculate row heights and positions, and put results in q_yy.data() and q_heights.data() so that we can use this information as //constraints to find the column widths q_rowData.calculateGeometries(0, rowCount(), size.height(), q_yy.data(), q_heights.data(), q_descents.data(), q_totalBoxes[Ver], q_infos[Ver]); - ensureColumnAndRowData(&q_columnData, &q_totalBoxes[Hor], styleInfo, q_yy.data(), q_heights.data(), Qt::Horizontal); + ensureColumnAndRowData(&q_columnData, &q_totalBoxes[Hor], q_yy.data(), q_heights.data(), Qt::Horizontal, styleInfo); //Calculate row heights and positions, and put results in q_yy.data() and q_heights.data() q_columnData.calculateGeometries(0, columnCount(), size.width(), q_xx.data(), q_widths.data(), 0, q_totalBoxes[Hor], q_infos[Hor]); diff --git a/src/widgets/graphicsview/qgridlayoutengine_p.h b/src/widgets/graphicsview/qgridlayoutengine_p.h index 309b58b3d9..e864294a4a 100644 --- a/src/widgets/graphicsview/qgridlayoutengine_p.h +++ b/src/widgets/graphicsview/qgridlayoutengine_p.h @@ -59,12 +59,14 @@ #include "qmap.h" #include "qpair.h" #include "qvector.h" -#include "qgraphicslayout_p.h" +#include <QtCore/qsize.h> +#include <QtCore/qrect.h> #include <float.h> +#include <QtGui/private/qlayoutpolicy_p.h> +#include <QtGui/private/qabstractlayoutstyleinfo_p.h> QT_BEGIN_NAMESPACE -class QGraphicsLayoutItem; class QStyle; class QWidget; @@ -249,14 +251,31 @@ public: bool hasIgnoreFlag; }; -class QGridLayoutEngine; +class QGridLayoutRowInfo +{ +public: + inline QGridLayoutRowInfo() : count(0) {} + + void insertOrRemoveRows(int row, int delta); + +#ifdef QT_DEBUG + void dump(int indent = 0) const; +#endif + + int count; + QVector<QStretchParameter> stretches; + QVector<QLayoutParameter<qreal> > spacings; + QVector<Qt::Alignment> alignments; + QVector<QGridLayoutBox> boxes; +}; + class QGridLayoutItem { public: - QGridLayoutItem(QGridLayoutEngine *engine, QGraphicsLayoutItem *layoutItem, int row, int column, - int rowSpan = 1, int columnSpan = 1, Qt::Alignment alignment = 0, - int itemAtIndex = -1); + QGridLayoutItem(int row, int column, int rowSpan = 1, int columnSpan = 1, + Qt::Alignment alignment = 0); + virtual ~QGridLayoutItem() {} inline int firstRow() const { return q_firstRows[Ver]; } inline int firstColumn() const { return q_firstRows[Hor]; } @@ -280,19 +299,24 @@ public: inline Qt::Alignment alignment() const { return q_alignment; } inline void setAlignment(Qt::Alignment alignment) { q_alignment = alignment; } - QSizePolicy::Policy sizePolicy(Qt::Orientation orientation) const; + virtual QLayoutPolicy::Policy sizePolicy(Qt::Orientation orientation) const = 0; + virtual QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const = 0; + + virtual void setGeometry(const QRectF &rect) = 0; + /* + returns true if the size policy returns true for either hasHeightForWidth() + or hasWidthForHeight() + */ + virtual bool hasDynamicConstraint() const { return false; } + virtual Qt::Orientation dynamicConstraintOrientation() const { return Qt::Horizontal; } - bool hasDynamicConstraint() const; - Qt::Orientation dynamicConstraintOrientation() const; - QSizePolicy::ControlTypes controlTypes(LayoutSide side) const; - QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const; + virtual QLayoutPolicy::ControlTypes controlTypes(LayoutSide side) const; + + QRectF geometryWithin(qreal x, qreal y, qreal width, qreal height, qreal rowDescent, Qt::Alignment align) const; QGridLayoutBox box(Qt::Orientation orientation, qreal constraint = -1.0) const; - QRectF geometryWithin(qreal x, qreal y, qreal width, qreal height, qreal rowDescent) const; - QGraphicsLayoutItem *layoutItem() const { return q_layoutItem; } - void setGeometry(const QRectF &rect); void transpose(); void insertOrRemoveRows(int row, int delta, Qt::Orientation orientation = Qt::Vertical); QSizeF effectiveMaxSize(const QSizeF &constraint) const; @@ -302,30 +326,11 @@ public: #endif private: - QGridLayoutEngine *q_engine; // ### needed? - QGraphicsLayoutItem *q_layoutItem; int q_firstRows[NOrientations]; int q_rowSpans[NOrientations]; int q_stretches[NOrientations]; Qt::Alignment q_alignment; -}; -class QGridLayoutRowInfo -{ -public: - inline QGridLayoutRowInfo() : count(0) {} - - void insertOrRemoveRows(int row, int delta); - -#ifdef QT_DEBUG - void dump(int indent = 0) const; -#endif - - int count; - QVector<QStretchParameter> stretches; - QVector<QLayoutParameter<qreal> > spacings; - QVector<Qt::Alignment> alignments; - QVector<QGridLayoutBox> boxes; }; class QGridLayoutEngine @@ -341,13 +346,12 @@ public: // returns the number of items inserted, which may be less than (rowCount * columnCount) int itemCount() const; QGridLayoutItem *itemAt(int index) const; - int indexOf(QGraphicsLayoutItem *item) const; int effectiveFirstRow(Qt::Orientation orientation = Qt::Vertical) const; int effectiveLastRow(Qt::Orientation orientation = Qt::Vertical) const; void setSpacing(qreal spacing, Qt::Orientations orientations); - qreal spacing(const QLayoutStyleInfo &styleInfo, Qt::Orientation orientation) const; + qreal spacing(Qt::Orientation orientation, const QAbstractLayoutStyleInfo *styleInfo) const; // ### setSpacingAfterRow(), spacingAfterRow() void setRowSpacing(int row, qreal spacing, Qt::Orientation orientation = Qt::Vertical); qreal rowSpacing(int row, Qt::Orientation orientation = Qt::Vertical) const; @@ -355,10 +359,6 @@ public: void setRowStretchFactor(int row, int stretch, Qt::Orientation orientation = Qt::Vertical); int rowStretchFactor(int row, Qt::Orientation orientation = Qt::Vertical) const; - void setStretchFactor(QGraphicsLayoutItem *layoutItem, int stretch, - Qt::Orientation orientation); - int stretchFactor(QGraphicsLayoutItem *layoutItem, Qt::Orientation orientation) const; - void setRowSizeHint(Qt::SizeHint which, int row, qreal size, Qt::Orientation orientation = Qt::Vertical); qreal rowSizeHint(Qt::SizeHint which, int row, @@ -367,15 +367,12 @@ public: void setRowAlignment(int row, Qt::Alignment alignment, Qt::Orientation orientation); Qt::Alignment rowAlignment(int row, Qt::Orientation orientation) const; - void setAlignment(QGraphicsLayoutItem *layoutItem, Qt::Alignment alignment); - Qt::Alignment alignment(QGraphicsLayoutItem *layoutItem) const; Qt::Alignment effectiveAlignment(const QGridLayoutItem *layoutItem) const; void insertItem(QGridLayoutItem *item, int index); void addItem(QGridLayoutItem *item); void removeItem(QGridLayoutItem *item); - QGridLayoutItem *findLayoutItem(QGraphicsLayoutItem *layoutItem) const; QGridLayoutItem *itemAt(int row, int column, Qt::Orientation orientation = Qt::Vertical) const; inline void insertRow(int row, Qt::Orientation orientation = Qt::Vertical) { insertOrRemoveRows(row, +1, orientation); } @@ -383,11 +380,11 @@ public: { insertOrRemoveRows(row, -count, orientation); } void invalidate(); - void setGeometries(const QLayoutStyleInfo &styleInfo, const QRectF &contentsGeometry); - QRectF cellRect(const QLayoutStyleInfo &styleInfo, const QRectF &contentsGeometry, int row, - int column, int rowSpan, int columnSpan) const; - QSizeF sizeHint(const QLayoutStyleInfo &styleInfo, Qt::SizeHint which, - const QSizeF &constraint) const; + void setGeometries(const QRectF &contentsGeometry, const QAbstractLayoutStyleInfo *styleInfo); + QRectF cellRect(const QRectF &contentsGeometry, int row, int column, int rowSpan, int columnSpan, + const QAbstractLayoutStyleInfo *styleInfo) const; + QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint, + const QAbstractLayoutStyleInfo *styleInfo) const; // heightForWidth / widthForHeight support QSizeF dynamicallyConstrainedSizeHint(Qt::SizeHint which, const QSizeF &constraint) const; @@ -396,7 +393,7 @@ public: Qt::Orientation constraintOrientation() const; - QSizePolicy::ControlTypes controlTypes(LayoutSide side) const; + QLayoutPolicy::ControlTypes controlTypes(LayoutSide side) const; void transpose(); void setVisualDirection(Qt::LayoutDirection direction); Qt::LayoutDirection visualDirection() const; @@ -413,20 +410,22 @@ private: inline int internalGridColumnCount() const { return grossRoundUp(columnCount()); } void setItemAt(int row, int column, QGridLayoutItem *item); void insertOrRemoveRows(int row, int delta, Qt::Orientation orientation = Qt::Vertical); - void fillRowData(QGridLayoutRowData *rowData, const QLayoutStyleInfo &styleInfo, - qreal *colPositions, qreal *colSizes, - Qt::Orientation orientation = Qt::Vertical) const; + void fillRowData(QGridLayoutRowData *rowData, + qreal *colPositions, qreal *colSizes, + Qt::Orientation orientation, + const QAbstractLayoutStyleInfo *styleInfo) const; void ensureEffectiveFirstAndLastRows() const; void ensureColumnAndRowData(QGridLayoutRowData *rowData, QGridLayoutBox *totalBox, - const QLayoutStyleInfo &styleInfo, qreal *colPositions, qreal *colSizes, - Qt::Orientation orientation) const; - - void ensureGeometries(const QLayoutStyleInfo &styleInfo, const QSizeF &size) const; + Qt::Orientation orientation, + const QAbstractLayoutStyleInfo *styleInfo) const; + void ensureGeometries(const QSizeF &size, const QAbstractLayoutStyleInfo *styleInfo) const; +protected: + QList<QGridLayoutItem *> q_items; +private: // User input QVector<QGridLayoutItem *> q_grid; - QList<QGridLayoutItem *> q_items; QLayoutParameter<qreal> q_defaultSpacings[NOrientations]; QGridLayoutRowInfo q_infos[NOrientations]; Qt::LayoutDirection m_visualDirection; @@ -438,13 +437,13 @@ private: mutable quint8 q_cachedConstraintOrientation : 3; // Layout item input - mutable QLayoutStyleInfo q_cachedDataForStyleInfo; mutable QGridLayoutRowData q_columnData; mutable QGridLayoutRowData q_rowData; mutable QGridLayoutBox q_totalBoxes[NOrientations]; // Output mutable QSizeF q_cachedSize; + mutable bool q_totalBoxesValid; mutable QVector<qreal> q_xx; mutable QVector<qreal> q_yy; mutable QVector<qreal> q_widths; diff --git a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp index 31a4254344..21e07630e2 100644 --- a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp +++ b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp @@ -672,7 +672,7 @@ void tst_qmessagehandler::qMessagePattern() QVERIFY(output.contains("debug tst_qlogging 57 main qDebug")); QVERIFY(output.contains("warning tst_qlogging 58 main qWarning")); QVERIFY(output.contains("critical tst_qlogging 59 main qCritical")); - QVERIFY(output.contains("warning tst_qlogging 62 main qDebug with category ")); + QVERIFY(output.contains("warning tst_qlogging 62 main qDebug with category")); QVERIFY(output.contains("debug tst_qlogging 66 main qDebug2")); environment = m_baseEnvironment; @@ -712,7 +712,7 @@ void tst_qmessagehandler::qMessagePattern() "[debug] qDebug\n" "[warning] qWarning\n" "[critical] qCritical\n" - "[warning] qDebug with category \n"; + "[warning] qDebug with category\n"; #ifdef Q_OS_WIN output.replace("\r\n", "\n"); #endif diff --git a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp index f452efc1b3..29c7e6a81e 100644 --- a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp +++ b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp @@ -65,8 +65,8 @@ void tst_QDebug::assignment() const QDebug debug1(QtDebugMsg); QDebug debug2(QtWarningMsg); - QTest::ignoreMessage(QtDebugMsg, "foo "); - QTest::ignoreMessage(QtWarningMsg, "bar 1 2 "); + QTest::ignoreMessage(QtDebugMsg, "foo"); + QTest::ignoreMessage(QtWarningMsg, "bar 1 2"); debug1 << "foo"; debug2 << "bar"; @@ -118,7 +118,7 @@ void tst_QDebug::warningWithoutDebug() const { qWarning() << "A qWarning() message"; } QString file = __FILE__; int line = __LINE__ - 1; QString function = Q_FUNC_INFO; QCOMPARE(s_msgType, QtWarningMsg); - QCOMPARE(s_msg, QString::fromLatin1("A qWarning() message ")); + QCOMPARE(s_msg, QString::fromLatin1("A qWarning() message")); QCOMPARE(QString::fromLatin1(s_file), file); QCOMPARE(s_line, line); QCOMPARE(QString::fromLatin1(s_function), function); @@ -133,7 +133,7 @@ void tst_QDebug::criticalWithoutDebug() const { qCritical() << "A qCritical() message"; } QString file = __FILE__; int line = __LINE__ - 1; QString function = Q_FUNC_INFO; QCOMPARE(s_msgType, QtCriticalMsg); - QCOMPARE(s_msg, QString::fromLatin1("A qCritical() message ")); + QCOMPARE(s_msg, QString::fromLatin1("A qCritical() message")); QCOMPARE(QString::fromLatin1(s_file), file); QCOMPARE(s_line, line); QCOMPARE(QString::fromLatin1(s_function), function); @@ -145,7 +145,7 @@ void tst_QDebug::debugWithBool() const { qDebug() << false << true; } QString file = __FILE__; int line = __LINE__ - 1; QString function = Q_FUNC_INFO; QCOMPARE(s_msgType, QtDebugMsg); - QCOMPARE(s_msg, QString::fromLatin1("false true ")); + QCOMPARE(s_msg, QString::fromLatin1("false true")); QCOMPARE(QString::fromLatin1(s_file), file); QCOMPARE(s_line, line); QCOMPARE(QString::fromLatin1(s_function), function); @@ -215,7 +215,7 @@ void tst_QDebug::stateSaver() const } d.space() << 42; } - QCOMPARE(s_msg, QString::fromLatin1("02a 42 ")); + QCOMPARE(s_msg, QString::fromLatin1("02a 42")); } void tst_QDebug::veryLongWarningMessage() const @@ -247,7 +247,7 @@ void tst_QDebug::qDebugQStringRef() const { qDebug() << inRef; } QString file = __FILE__; int line = __LINE__ - 1; QString function = Q_FUNC_INFO; QCOMPARE(s_msgType, QtDebugMsg); - QCOMPARE(s_msg, QString::fromLatin1("\"input\" ")); + QCOMPARE(s_msg, QString::fromLatin1("\"input\"")); QCOMPARE(QString::fromLatin1(s_file), file); QCOMPARE(s_line, line); QCOMPARE(QString::fromLatin1(s_function), function); @@ -261,7 +261,7 @@ void tst_QDebug::qDebugQStringRef() const { qDebug() << inRef; } QString file = __FILE__; int line = __LINE__ - 1; QString function = Q_FUNC_INFO; QCOMPARE(s_msgType, QtDebugMsg); - QCOMPARE(s_msg, QString::fromLatin1("\"\" ")); + QCOMPARE(s_msg, QString::fromLatin1("\"\"")); QCOMPARE(QString::fromLatin1(s_file), file); QCOMPARE(s_line, line); QCOMPARE(QString::fromLatin1(s_function), function); @@ -274,7 +274,7 @@ void tst_QDebug::qDebugQLatin1String() const { qDebug() << QLatin1String("foo") << QLatin1String("") << QLatin1String("barbaz", 3); } QString file = __FILE__; int line = __LINE__ - 1; QString function = Q_FUNC_INFO; QCOMPARE(s_msgType, QtDebugMsg); - QCOMPARE(s_msg, QString::fromLatin1("\"foo\" \"\" \"bar\" ")); + QCOMPARE(s_msg, QString::fromLatin1("\"foo\" \"\" \"bar\"")); QCOMPARE(QString::fromLatin1(s_file), file); QCOMPARE(s_line, line); QCOMPARE(QString::fromLatin1(s_function), function); diff --git a/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp b/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp index 157e42b447..a516b762f7 100644 --- a/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp +++ b/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp @@ -68,8 +68,8 @@ void tst_QNoDebug::noDebugOutput() const qCDebug(cat) << "foo"; // qWarning still works, though - QTest::ignoreMessage(QtWarningMsg, "bar "); - QTest::ignoreMessage(QtWarningMsg, "custom-bar "); + QTest::ignoreMessage(QtWarningMsg, "bar"); + QTest::ignoreMessage(QtWarningMsg, "custom-bar"); qWarning() << "bar"; qCWarning(cat) << "custom-bar"; } @@ -79,7 +79,7 @@ void tst_QNoDebug::streaming() const QDateTime dt(QDate(1,2,3),QTime(4,5,6)); QString debugString = dt.toString(QStringLiteral("yyyy-MM-dd HH:mm:ss.zzz t")) + QStringLiteral(" Qt::LocalTime"); - QTest::ignoreMessage(QtWarningMsg, qPrintable(QString::fromLatin1("QDateTime(\"%1\") ").arg(debugString))); + QTest::ignoreMessage(QtWarningMsg, qPrintable(QString::fromLatin1("QDateTime(\"%1\")").arg(debugString))); qWarning() << dt; } diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp index 923b9a3a07..bb77ec54c5 100644 --- a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp +++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp @@ -2740,9 +2740,9 @@ void tst_QSortFilterProxyModel::mapFromToSource() QCOMPARE(proxy.mapToSource(QModelIndex()), QModelIndex()); #ifdef QT_NO_DEBUG //if Qt is compiled in debug mode, this will assert - QTest::ignoreMessage(QtWarningMsg, "QSortFilterProxyModel: index from wrong model passed to mapToSource "); + QTest::ignoreMessage(QtWarningMsg, "QSortFilterProxyModel: index from wrong model passed to mapToSource"); QCOMPARE(proxy.mapToSource(source.index(2, 3)), QModelIndex()); - QTest::ignoreMessage(QtWarningMsg, "QSortFilterProxyModel: index from wrong model passed to mapFromSource "); + QTest::ignoreMessage(QtWarningMsg, "QSortFilterProxyModel: index from wrong model passed to mapFromSource"); QCOMPARE(proxy.mapFromSource(proxy.index(6, 2)), QModelIndex()); #endif } diff --git a/tests/auto/corelib/json/tst_qtjson.cpp b/tests/auto/corelib/json/tst_qtjson.cpp index c79e7273c0..a8534bf6f0 100644 --- a/tests/auto/corelib/json/tst_qtjson.cpp +++ b/tests/auto/corelib/json/tst_qtjson.cpp @@ -1985,11 +1985,11 @@ void tst_QtJson::testDebugStream() // QJsonObject QJsonObject object; - QTest::ignoreMessage(QtDebugMsg, "QJsonObject() "); + QTest::ignoreMessage(QtDebugMsg, "QJsonObject()"); qDebug() << object; object.insert(QLatin1String("foo"), QLatin1String("bar")); - QTest::ignoreMessage(QtDebugMsg, "QJsonObject({\"foo\": \"bar\"}) "); + QTest::ignoreMessage(QtDebugMsg, "QJsonObject({\"foo\": \"bar\"})"); qDebug() << object; } @@ -1997,12 +1997,12 @@ void tst_QtJson::testDebugStream() // QJsonArray QJsonArray array; - QTest::ignoreMessage(QtDebugMsg, "QJsonArray() "); + QTest::ignoreMessage(QtDebugMsg, "QJsonArray()"); qDebug() << array; array.append(1); array.append(QLatin1String("foo")); - QTest::ignoreMessage(QtDebugMsg, "QJsonArray([1,\"foo\"]) "); + QTest::ignoreMessage(QtDebugMsg, "QJsonArray([1,\"foo\"])"); qDebug() << array; } @@ -2010,19 +2010,19 @@ void tst_QtJson::testDebugStream() // QJsonDocument QJsonDocument doc; - QTest::ignoreMessage(QtDebugMsg, "QJsonDocument() "); + QTest::ignoreMessage(QtDebugMsg, "QJsonDocument()"); qDebug() << doc; QJsonObject object; object.insert(QLatin1String("foo"), QLatin1String("bar")); doc.setObject(object); - QTest::ignoreMessage(QtDebugMsg, "QJsonDocument({\"foo\": \"bar\"}) "); + QTest::ignoreMessage(QtDebugMsg, "QJsonDocument({\"foo\": \"bar\"})"); qDebug() << doc; QJsonArray array; array.append(1); array.append(QLatin1String("foo")); - QTest::ignoreMessage(QtDebugMsg, "QJsonDocument([1,\"foo\"]) "); + QTest::ignoreMessage(QtDebugMsg, "QJsonDocument([1,\"foo\"])"); doc.setArray(array); qDebug() << doc; } @@ -2032,36 +2032,36 @@ void tst_QtJson::testDebugStream() QJsonValue value; - QTest::ignoreMessage(QtDebugMsg, "QJsonValue(null) "); + QTest::ignoreMessage(QtDebugMsg, "QJsonValue(null)"); qDebug() << value; value = QJsonValue(true); // bool - QTest::ignoreMessage(QtDebugMsg, "QJsonValue(bool, true) "); + QTest::ignoreMessage(QtDebugMsg, "QJsonValue(bool, true)"); qDebug() << value; value = QJsonValue((double)4.2); // double - QTest::ignoreMessage(QtDebugMsg, "QJsonValue(double, 4.2) "); + QTest::ignoreMessage(QtDebugMsg, "QJsonValue(double, 4.2)"); qDebug() << value; value = QJsonValue((int)42); // int - QTest::ignoreMessage(QtDebugMsg, "QJsonValue(double, 42) "); + QTest::ignoreMessage(QtDebugMsg, "QJsonValue(double, 42)"); qDebug() << value; value = QJsonValue(QLatin1String("foo")); // string - QTest::ignoreMessage(QtDebugMsg, "QJsonValue(string, \"foo\") "); + QTest::ignoreMessage(QtDebugMsg, "QJsonValue(string, \"foo\")"); qDebug() << value; QJsonArray array; array.append(1); array.append(QLatin1String("foo")); value = QJsonValue(array); // array - QTest::ignoreMessage(QtDebugMsg, "QJsonValue(array, QJsonArray([1,\"foo\"]) ) "); + QTest::ignoreMessage(QtDebugMsg, "QJsonValue(array, QJsonArray([1,\"foo\"]) )"); qDebug() << value; QJsonObject object; object.insert(QLatin1String("foo"), QLatin1String("bar")); value = QJsonValue(object); // object - QTest::ignoreMessage(QtDebugMsg, "QJsonValue(object, QJsonObject({\"foo\": \"bar\"}) ) "); + QTest::ignoreMessage(QtDebugMsg, "QJsonValue(object, QJsonObject({\"foo\": \"bar\"}) )"); qDebug() << value; } } diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp index a7edbc1665..c6fb1025ac 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -455,7 +455,7 @@ void tst_QObject::connectSlotsByName() sender.setObjectName("Sender"); QTest::ignoreMessage(QtWarningMsg, "QMetaObject::connectSlotsByName: No matching signal for on_child_signal()"); - QTest::ignoreMessage(QtWarningMsg, "QMetaObject::connectSlotsByName: Connecting slot on_Sender_signalManyParams() with the first of the following compatible signals: (\"signalManyParams(int,int,int,QString,bool)\", \"signalManyParams(int,int,int,QString,bool,bool)\") "); + QTest::ignoreMessage(QtWarningMsg, "QMetaObject::connectSlotsByName: Connecting slot on_Sender_signalManyParams() with the first of the following compatible signals: (\"signalManyParams(int,int,int,QString,bool)\", \"signalManyParams(int,int,int,QString,bool,bool)\")"); QMetaObject::connectSlotsByName(&receiver); receiver.called_slots.clear(); diff --git a/tests/auto/network/access/qftp/tst_qftp.cpp b/tests/auto/network/access/qftp/tst_qftp.cpp index 71af9690be..fffe663f0a 100644 --- a/tests/auto/network/access/qftp/tst_qftp.cpp +++ b/tests/auto/network/access/qftp/tst_qftp.cpp @@ -197,14 +197,18 @@ void tst_QFtp::initTestCase_data() QTest::addColumn<bool>("setSession"); QTest::newRow("WithoutProxy") << false << 0 << false; +#ifndef QT_NO_SOCKS5 QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy) << false; +#endif //### doesn't work well yet. //QTest::newRow("WithHttpProxy") << true << int(QNetworkProxy::HttpProxy); #ifndef QT_NO_BEARERMANAGEMENT QTest::newRow("WithoutProxyWithSession") << false << 0 << true; +#ifndef QT_NO_SOCKS5 QTest::newRow("WithSocks5ProxyAndSession") << true << int(QNetworkProxy::Socks5Proxy) << true; #endif +#endif } void tst_QFtp::initTestCase() @@ -232,11 +236,16 @@ void tst_QFtp::init() QFETCH_GLOBAL(int, proxyType); QFETCH_GLOBAL(bool, setSession); if (setProxy) { +#ifndef QT_NO_NETWORKPROXY if (proxyType == QNetworkProxy::Socks5Proxy) { QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1080)); } else if (proxyType == QNetworkProxy::HttpProxy) { QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::HttpProxy, QtNetworkSettings::serverName(), 3128)); } +#else // !QT_NO_NETWORKPROXY + Q_UNUSED(proxyType); + QSKIP("No proxy support"); +#endif // QT_NO_NETWORKPROXY } #ifndef QT_NO_BEARERMANAGEMENT if (setSession) { @@ -293,7 +302,11 @@ void tst_QFtp::cleanup() } QFETCH_GLOBAL(bool, setProxy); if (setProxy) { +#ifndef QT_NO_NETWORKPROXY QNetworkProxy::setApplicationProxy(QNetworkProxy::DefaultProxy); +#else + QSKIP("No proxy support"); +#endif } delete ftp; @@ -749,14 +762,14 @@ void tst_QFtp::put() QFETCH( QByteArray, fileData ); QFETCH( bool, useIODevice ); -#ifdef Q_OS_WIN +#if defined(Q_OS_WIN) && !defined(QT_NO_NETWORKPROXY) QFETCH_GLOBAL(bool, setProxy); if (setProxy) { QFETCH_GLOBAL(int, proxyType); if (proxyType == QNetworkProxy::Socks5Proxy) QSKIP("With socks5 the put() test takes too long time on Windows."); } -#endif +#endif // OS_WIN && !QT_NO_NETWORKPROXY const int timestep = 50; diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index 1837e8d665..b35c934680 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -97,7 +97,9 @@ Q_DECLARE_METATYPE(QSharedPointer<char>) #include "../../../network-settings.h" Q_DECLARE_METATYPE(QAuthenticator*) +#ifndef QT_NO_NETWORKPROXY Q_DECLARE_METATYPE(QNetworkProxyQuery) +#endif typedef QSharedPointer<QNetworkReply> QNetworkReplyPtr; @@ -106,6 +108,7 @@ class tst_QNetworkReply: public QObject { Q_OBJECT +#ifndef QT_NO_NETWORKPROXY struct ProxyData { ProxyData(const QNetworkProxy &p, const QByteArray &t, bool auth) : tag(t), proxy(p), requiresAuthentication(auth) @@ -114,6 +117,7 @@ class tst_QNetworkReply: public QObject QNetworkProxy proxy; bool requiresAuthentication; }; +#endif // !QT_NO_NETWORKPROXY static bool seedCreated; static QString createUniqueExtension() { @@ -134,7 +138,9 @@ class tst_QNetworkReply: public QObject QString wronlyFileName; #endif QString uniqueExtension; +#ifndef QT_NO_NETWORKPROXY QList<ProxyData> proxies; +#endif QNetworkAccessManager manager; MyCookieJar *cookieJar; #ifndef QT_NO_SSL @@ -203,8 +209,10 @@ private Q_SLOTS: void getFromHttp(); void getErrors_data(); void getErrors(); +#ifndef QT_NO_NETWORKPROXY void headFromHttp_data(); void headFromHttp(); +#endif // !QT_NO_NETWORKPROXY void putToFile_data(); void putToFile(); void putToFtp_data(); @@ -261,9 +269,11 @@ private Q_SLOTS: void ioGetFromHttpWithAuth_data(); void ioGetFromHttpWithAuth(); void ioGetFromHttpWithAuthSynchronous(); +#ifndef QT_NO_NETWORKPROXY void ioGetFromHttpWithProxyAuth(); void ioGetFromHttpWithProxyAuthSynchronous(); void ioGetFromHttpWithSocksProxy(); +#endif // !QT_NO_NETWORKPROXY #ifndef QT_NO_SSL void ioGetFromHttpsWithSslErrors(); void ioGetFromHttpsWithIgnoreSslErrors(); @@ -278,8 +288,10 @@ private Q_SLOTS: void ioGetFromHttpWithCache_data(); void ioGetFromHttpWithCache(); +#ifndef QT_NO_NETWORKPROXY void ioGetWithManyProxies_data(); void ioGetWithManyProxies(); +#endif // !QT_NO_NETWORKPROXY void ioPutToFileFromFile_data(); void ioPutToFileFromFile(); @@ -297,10 +309,12 @@ private Q_SLOTS: void ioPutToHttpFromFile(); void ioPostToHttpFromFile_data(); void ioPostToHttpFromFile(); +#ifndef QT_NO_NETWORKPROXY void ioPostToHttpFromSocket_data(); void ioPostToHttpFromSocket(); void ioPostToHttpFromSocketSynchronous(); void ioPostToHttpFromSocketSynchronous_data(); +#endif // !QT_NO_NETWORKPROXY void ioPostToHttpFromMiddleOfFileToEnd(); void ioPostToHttpFromMiddleOfFileFiveBytes(); void ioPostToHttpFromMiddleOfQBufferFiveBytes(); @@ -339,11 +353,13 @@ private Q_SLOTS: void nestedEventLoops(); +#ifndef QT_NO_NETWORKPROXY void httpProxyCommands_data(); void httpProxyCommands(); void httpProxyCommandsSynchronous_data(); void httpProxyCommandsSynchronous(); void proxyChange(); +#endif // !QT_NO_NETWORKPROXY void authorizationError_data(); void authorizationError(); @@ -419,9 +435,11 @@ private Q_SLOTS: void dontInsertPartialContentIntoTheCache(); void httpUserAgent(); +#ifndef QT_NO_NETWORKPROXY void authenticationCacheAfterCancel_data(); void authenticationCacheAfterCancel(); void authenticationWithDifferentRealm(); +#endif // !QT_NO_NETWORKPROXY void synchronousAuthenticationCache(); void pipelining(); @@ -638,6 +656,7 @@ public: { QNetworkCookieJar::setAllCookies(cookieList); } }; +#ifndef QT_NO_NETWORKPROXY class MyProxyFactory: public QNetworkProxyFactory { public: @@ -660,6 +679,7 @@ public: return toReturn; } }; +#endif // !QT_NO_NETWORKPROXY class MyMemoryCache: public QAbstractNetworkCache { @@ -1154,7 +1174,9 @@ tst_QNetworkReply::tst_QNetworkReply() { qRegisterMetaType<QNetworkReply *>(); // for QSignalSpy qRegisterMetaType<QAuthenticator *>(); +#ifndef QT_NO_NETWORKPROXY qRegisterMetaType<QNetworkProxy>(); +#endif #ifndef QT_NO_SSL qRegisterMetaType<QList<QSslError> >(); #endif @@ -1165,6 +1187,7 @@ tst_QNetworkReply::tst_QNetworkReply() cookieJar = new MyCookieJar; manager.setCookieJar(cookieJar); +#ifndef QT_NO_NETWORKPROXY QHostInfo hostInfo = QHostInfo::fromName(QtNetworkSettings::serverName()); proxies << ProxyData(QNetworkProxy::NoProxy, "", false); @@ -1178,10 +1201,13 @@ tst_QNetworkReply::tst_QNetworkReply() << ProxyData(QNetworkProxy(QNetworkProxy::Socks5Proxy, proxyserver, 1080), "+socks", false) << ProxyData(QNetworkProxy(QNetworkProxy::Socks5Proxy, proxyserver, 1081), "+socksauth", true); } else { +#endif // !QT_NO_NETWORKPROXY printf("==================================================================\n"); printf("Proxy could not be looked up. No proxy will be used while testing!\n"); printf("==================================================================\n"); +#ifndef QT_NO_NETWORKPROXY } +#endif // !QT_NO_NETWORKPROXY } tst_QNetworkReply::~tst_QNetworkReply() @@ -1438,7 +1464,9 @@ void tst_QNetworkReply::cleanup() // clear the internal cache manager.clearAccessCache(); +#ifndef QT_NO_NETWORKPROXY manager.setProxy(QNetworkProxy()); +#endif manager.setCache(0); // clear cookies @@ -1732,6 +1760,7 @@ void tst_QNetworkReply::getFromHttp() QCOMPARE(reply->readAll(), reference.readAll()); } +#ifndef QT_NO_NETWORKPROXY void tst_QNetworkReply::headFromHttp_data() { QTest::addColumn<qint64>("referenceSize"); @@ -1790,6 +1819,7 @@ void tst_QNetworkReply::headFromHttp() if (reply->header(QNetworkRequest::ContentTypeHeader).isValid()) QCOMPARE(reply->header(QNetworkRequest::ContentTypeHeader).toString(), contentType); } +#endif // !QT_NO_NETWORKPROXY void tst_QNetworkReply::getErrors_data() { @@ -3270,6 +3300,7 @@ void tst_QNetworkReply::ioGetFromHttpWithAuthSynchronous() QCOMPARE(replySync->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 401); } +#ifndef QT_NO_NETWORKPROXY void tst_QNetworkReply::ioGetFromHttpWithProxyAuth() { // This test sends three requests @@ -3432,6 +3463,7 @@ void tst_QNetworkReply::ioGetFromHttpWithSocksProxy() QCOMPARE(authspy.count(), 0); } } +#endif // !QT_NO_NETWORKPROXY #ifndef QT_NO_SSL void tst_QNetworkReply::ioGetFromHttpsWithSslErrors() @@ -3793,6 +3825,7 @@ void tst_QNetworkReply::ioGetFromHttpWithCache() QCOMPARE(reply->readAll().constData(), qPrintable(body)); } +#ifndef QT_NO_NETWORKPROXY void tst_QNetworkReply::ioGetWithManyProxies_data() { QTest::addColumn<QList<QNetworkProxy> >("proxyList"); @@ -4054,6 +4087,7 @@ void tst_QNetworkReply::ioGetWithManyProxies() QCOMPARE(authspy.count(), 0); } } +#endif // !QT_NO_NETWORKPROXY void tst_QNetworkReply::ioPutToFileFromFile_data() { @@ -4346,6 +4380,7 @@ void tst_QNetworkReply::ioPostToHttpFromFile() QCOMPARE(reply->readAll().trimmed(), md5sum(sourceFile.readAll()).toHex()); } +#ifndef QT_NO_NETWORKPROXY void tst_QNetworkReply::ioPostToHttpFromSocket_data() { QTest::addColumn<QByteArray>("data"); @@ -4496,6 +4531,7 @@ void tst_QNetworkReply::ioPostToHttpFromSocketSynchronous() QCOMPARE(reply->readAll().trimmed(), md5sum(data).toHex()); } +#endif // !QT_NO_NETWORKPROXY // this tests checks if rewinding the POST-data to some place in the middle // worked. @@ -5410,6 +5446,7 @@ void tst_QNetworkReply::nestedEventLoops() QCOMPARE(errorspy.count(), 0); } +#ifndef QT_NO_NETWORKPROXY void tst_QNetworkReply::httpProxyCommands_data() { QTest::addColumn<QUrl>("url"); @@ -5485,6 +5522,7 @@ void tst_QNetworkReply::httpProxyCommandsSynchronous_data() { httpProxyCommands_data(); } +#endif // !QT_NO_NETWORKPROXY struct QThreadCleanup { @@ -5506,6 +5544,7 @@ struct QDeleteLaterCleanup } }; +#ifndef QT_NO_NETWORKPROXY void tst_QNetworkReply::httpProxyCommandsSynchronous() { QFETCH(QUrl, url); @@ -5586,6 +5625,7 @@ void tst_QNetworkReply::proxyChange() QVERIFY(int(reply3->error()) > 0); } +#endif // !QT_NO_NETWORKPROXY void tst_QNetworkReply::authorizationError_data() { @@ -6502,6 +6542,7 @@ void tst_QNetworkReply::qtbug4121unknownAuthentication() QCOMPARE(reply->error(), QNetworkReply::AuthenticationRequiredError); } +#ifndef QT_NO_NETWORKPROXY void tst_QNetworkReply::authenticationCacheAfterCancel_data() { QTest::addColumn<QNetworkProxy>("proxy"); @@ -6716,6 +6757,7 @@ void tst_QNetworkReply::authenticationWithDifferentRealm() QVERIFY(!QTestEventLoop::instance().timeout()); QCOMPARE(reply->error(), QNetworkReply::NoError); } +#endif // !QT_NO_NETWORKPROXY class QtBug13431Helper : public QObject { Q_OBJECT diff --git a/tests/auto/network/kernel/kernel.pro b/tests/auto/network/kernel/kernel.pro index 14080a0548..8594ad5932 100644 --- a/tests/auto/network/kernel/kernel.pro +++ b/tests/auto/network/kernel/kernel.pro @@ -10,6 +10,10 @@ SUBDIRS=\ qnetworkaddressentry \ qhostaddress \ +winrt: SUBDIRS -= \ + qnetworkproxy \ + qnetworkproxyfactory \ + !contains(QT_CONFIG, private_tests): SUBDIRS -= \ qauthenticator \ qhostinfo \ diff --git a/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp b/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp index acb921b34a..c4d42206fe 100644 --- a/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp +++ b/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp @@ -339,12 +339,15 @@ void tst_QHostAddress::assignment() address = "::1"; QCOMPARE(address, QHostAddress("::1")); + // WinRT does not support sockaddr_in +#ifndef Q_OS_WINRT QHostAddress addr("4.2.2.1"); sockaddr_in sockAddr; sockAddr.sin_family = AF_INET; sockAddr.sin_addr.s_addr = htonl(addr.toIPv4Address()); address.setAddress((sockaddr *)&sockAddr); QCOMPARE(address, addr); +#endif // !Q_OS_WINRT } void tst_QHostAddress::scopeId() diff --git a/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp b/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp index f474f97f5d..35028735e2 100644 --- a/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp +++ b/tests/auto/network/socket/platformsocketengine/tst_platformsocketengine.cpp @@ -64,7 +64,11 @@ #define PLATFORMSOCKETENGINE QNativeSocketEngine #define PLATFORMSOCKETENGINESTRING "QNativeSocketEngine" -#include <private/qnativesocketengine_p.h> +#ifndef Q_OS_WINRT +# include <private/qnativesocketengine_p.h> +#else +# include <private/qnativesocketengine_winrt_p.h> +#endif #include <qstringlist.h> @@ -97,7 +101,9 @@ private slots: void networkError(); void setSocketDescriptor(); void invalidSend(); +#ifndef Q_OS_WINRT void receiveUrgentData(); +#endif void tooManySockets(); }; @@ -608,7 +614,9 @@ void tst_PlatformSocketEngine::networkError() QVERIFY(client.state() == QAbstractSocket::ConnectedState); // An unexpected network error! -#ifdef Q_OS_WIN +#ifdef Q_OS_WINRT + client.close(); +#elif defined(Q_OS_WIN) // could use shutdown to produce different errors ::closesocket(client.socketDescriptor()); #else @@ -641,6 +649,7 @@ void tst_PlatformSocketEngine::invalidSend() } //--------------------------------------------------------------------------- +#ifndef Q_OS_WINRT void tst_PlatformSocketEngine::receiveUrgentData() { PLATFORMSOCKETENGINE server; @@ -703,6 +712,7 @@ void tst_PlatformSocketEngine::receiveUrgentData() QCOMPARE(response.at(0), msg); #endif } +#endif // !Q_OS_WINRT QTEST_MAIN(tst_PlatformSocketEngine) #include "tst_platformsocketengine.moc" diff --git a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp index 9887acf7dd..6053021cf4 100644 --- a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp @@ -1026,7 +1026,7 @@ void tst_QLocalSocket::writeToClientAndDisconnect() void tst_QLocalSocket::debug() { // Make sure this compiles - QTest::ignoreMessage(QtDebugMsg, "QLocalSocket::ConnectionRefusedError QLocalSocket::UnconnectedState "); + QTest::ignoreMessage(QtDebugMsg, "QLocalSocket::ConnectionRefusedError QLocalSocket::UnconnectedState"); qDebug() << QLocalSocket::ConnectionRefusedError << QLocalSocket::UnconnectedState; } diff --git a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp index d838b463f7..10b41ced9e 100644 --- a/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp +++ b/tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp @@ -100,16 +100,20 @@ private slots: void maxPendingConnections(); void listenError(); void waitForConnectionTest(); +#ifndef Q_OS_WINRT void setSocketDescriptor(); +#endif void listenWhileListening(); #ifndef QT_NO_PROCESS void addressReusable(); #endif void setNewSocketDescriptorBlocking(); +#ifndef QT_NO_NETWORKPROXY void invalidProxy_data(); void invalidProxy(); void proxyFactory_data(); void proxyFactory(); +#endif // !QT_NO_NETWORKPROXY void qtbug14268_peek(); @@ -158,7 +162,9 @@ void tst_QTcpServer::initTestCase_data() QTest::addColumn<int>("proxyType"); QTest::newRow("WithoutProxy") << false << 0; +#ifndef QT_NO_SOCKS5 QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy); +#endif crashingServerDir = QFINDTESTDATA("crashingServer"); QVERIFY2(!crashingServerDir.isEmpty(), qPrintable( @@ -181,16 +187,22 @@ void tst_QTcpServer::init() { QFETCH_GLOBAL(bool, setProxy); if (setProxy) { +#ifndef QT_NO_NETWORKPROXY QFETCH_GLOBAL(int, proxyType); if (proxyType == QNetworkProxy::Socks5Proxy) { QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1080)); } +#else // !QT_NO_NETWORKPROXY + QSKIP("No proxy support"); +#endif // QT_NO_NETWORKPROXY } } void tst_QTcpServer::cleanup() { +#ifndef QT_NO_NETWORKPROXY QNetworkProxy::setApplicationProxy(QNetworkProxy::DefaultProxy); +#endif } //---------------------------------------------------------------------------------- @@ -369,9 +381,13 @@ void tst_QTcpServer::maxPendingConnections() { QFETCH_GLOBAL(bool, setProxy); if (setProxy) { +#ifndef QT_NO_NETWORKPROXY QFETCH_GLOBAL(int, proxyType); if (proxyType == QNetworkProxy::Socks5Proxy) QSKIP("With socks5 only 1 connection is allowed ever"); +#else // !QT_NO_NETWORKPROXY + QSKIP("No proxy support"); +#endif // QT_NO_NETWORKPROXY } //### sees to fail sometimes ... a timing issue with the test on windows QTcpServer server; @@ -407,9 +423,13 @@ void tst_QTcpServer::listenError() { QFETCH_GLOBAL(bool, setProxy); if (setProxy) { +#ifndef QT_NO_NETWORKPROXY QFETCH_GLOBAL(int, proxyType); if (proxyType == QNetworkProxy::Socks5Proxy) QSKIP("With socks5 we can not make hard requirements on the address or port"); +#else // !QT_NO_NETWORKPROXY + QSKIP("No proxy support"); +#endif //QT_NO_NETWORKPROXY } QTcpServer server; QVERIFY(!server.listen(QHostAddress("1.2.3.4"), 0)); @@ -453,9 +473,13 @@ void tst_QTcpServer::waitForConnectionTest() QFETCH_GLOBAL(bool, setProxy); if (setProxy) { +#ifndef QT_NO_NETWORKPROXY QFETCH_GLOBAL(int, proxyType); if (proxyType == QNetworkProxy::Socks5Proxy) QSKIP("Localhost servers don't work well with SOCKS5"); +#else // !QT_NO_NETWORKPROXY + QSKIP("No proxy support"); +#endif // QT_NO_NETWORKPROXY } QTcpSocket findLocalIpSocket; @@ -481,6 +505,7 @@ void tst_QTcpServer::waitForConnectionTest() } //---------------------------------------------------------------------------------- +#ifndef Q_OS_WINRT void tst_QTcpServer::setSocketDescriptor() { QTcpServer server; @@ -510,6 +535,7 @@ void tst_QTcpServer::setSocketDescriptor() WSACleanup(); #endif } +#endif // !Q_OS_WINRT //---------------------------------------------------------------------------------- void tst_QTcpServer::listenWhileListening() @@ -531,6 +557,7 @@ public: bool ok; protected: +#ifndef Q_OS_WINRT void incomingConnection(qintptr socketDescriptor) { // how a user woulddo it (qabstractsocketengine is not public) @@ -543,6 +570,7 @@ protected: ::close(socketDescriptor); #endif } +#endif // !Q_OS_WINRT }; #ifndef QT_NO_PROCESS @@ -550,9 +578,13 @@ void tst_QTcpServer::addressReusable() { QFETCH_GLOBAL(bool, setProxy); if (setProxy) { +#ifndef QT_NO_NETWORKPROXY QFETCH_GLOBAL(int, proxyType); if (proxyType == QNetworkProxy::Socks5Proxy) QSKIP("With socks5 this test does not make senans at the momment"); +#else // !QT_NO_NETWORKPROXY + QSKIP("No proxy support"); +#endif // QT_NO_NETWORKPROXY } #if defined(Q_OS_WINCE) QString signalName = QString::fromLatin1("/test_signal.txt"); @@ -596,9 +628,13 @@ void tst_QTcpServer::setNewSocketDescriptorBlocking() { QFETCH_GLOBAL(bool, setProxy); if (setProxy) { +#ifndef QT_NO_NETWORKPROXY QFETCH_GLOBAL(int, proxyType); if (proxyType == QNetworkProxy::Socks5Proxy) QSKIP("With socks5 we can not make the socket descripter blocking"); +#else // !QT_NO_NETWORKPROXY + QSKIP("No proxy support"); +#endif // QT_NO_NETWORKPROXY } SeverWithBlockingSockets server; QVERIFY(server.listen()); @@ -609,6 +645,7 @@ void tst_QTcpServer::setNewSocketDescriptorBlocking() QVERIFY(server.ok); } +#ifndef QT_NO_NETWORKPROXY void tst_QTcpServer::invalidProxy_data() { QTest::addColumn<int>("type"); @@ -763,6 +800,7 @@ void tst_QTcpServer::proxyFactory() // Sometimes, error codes change for the better QTEST(int(server.serverError()), "expectedError"); } +#endif // !QT_NO_NETWORKPROXY class Qtbug14268Helper : public QObject { diff --git a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp index b6df536b98..f4eac0d6b8 100644 --- a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp @@ -132,7 +132,9 @@ private slots: void bind_data(); void bind(); void setInvalidSocketDescriptor(); +#ifndef Q_OS_WINRT void setSocketDescriptor(); +#endif void socketDescriptor(); void blockingIMAP(); void nonBlockingIMAP(); @@ -191,10 +193,12 @@ private slots: void taskQtBug5799ConnectionErrorEventLoop(); void taskQtBug7054TimeoutErrorResetting(); +#ifndef QT_NO_NETWORKPROXY void invalidProxy_data(); void invalidProxy(); void proxyFactory_data(); void proxyFactory(); +#endif // !QT_NO_NETWORKPROXY void qtbug14268_peek(); @@ -216,7 +220,9 @@ protected slots: void hostLookupSlot(); void abortiveClose_abortSlot(); void remoteCloseErrorSlot(); +#ifndef QT_NO_NETWORKPROXY void proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *auth); +#endif void earlySocketBytesSent(qint64 bytes); void earlySocketReadyRead(); @@ -354,6 +360,7 @@ void tst_QTcpSocket::init() { QFETCH_GLOBAL(bool, setProxy); if (setProxy) { +#ifndef QT_NO_NETWORKPROXY QFETCH_GLOBAL(int, proxyType); QList<QHostAddress> addresses = QHostInfo::fromName(QtNetworkSettings::serverName()).addresses(); QVERIFY2(addresses.count() > 0, "failed to get ip address for test server"); @@ -382,6 +389,9 @@ void tst_QTcpSocket::init() break; } QNetworkProxy::setApplicationProxy(proxy); +#else // !QT_NO_NETWORKPROXY + QSKIP("No proxy support"); +#endif // QT_NO_NETWORKPROXY } qt_qhostinfo_clear_cache(); @@ -406,15 +416,19 @@ QTcpSocket *tst_QTcpSocket::newSocket() const void tst_QTcpSocket::cleanup() { +#ifndef QT_NO_NETWORKPROXY QNetworkProxy::setApplicationProxy(QNetworkProxy::DefaultProxy); +#endif } +#ifndef QT_NO_NETWORKPROXY void tst_QTcpSocket::proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *auth) { ++proxyAuthCalled; auth->setUser("qsockstest"); auth->setPassword("password"); } +#endif // !QT_NO_NETWORKPROXY //---------------------------------------------------------------------------------- @@ -552,6 +566,7 @@ void tst_QTcpSocket::setInvalidSocketDescriptor() //---------------------------------------------------------------------------------- +#ifndef Q_OS_WINRT void tst_QTcpSocket::setSocketDescriptor() { QFETCH_GLOBAL(bool, setProxy); @@ -596,6 +611,7 @@ void tst_QTcpSocket::setSocketDescriptor() delete dummy; #endif } +#endif // !Q_OS_WINRT //---------------------------------------------------------------------------------- @@ -1546,7 +1562,9 @@ void tst_QTcpSocket::synchronousApi() void tst_QTcpSocket::dontCloseOnTimeout() { QTcpServer server; +#ifndef QT_NO_NETWORKPROXY server.setProxy(QNetworkProxy(QNetworkProxy::NoProxy)); +#endif QVERIFY(server.listen()); QHostAddress serverAddress = QHostAddress::LocalHost; @@ -1673,11 +1691,13 @@ private slots: { quit(); } +#ifndef QT_NO_NETWORKPROXY inline void proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *auth) { auth->setUser("qsockstest"); auth->setPassword("password"); } +#endif // !QT_NO_NETWORKPROXY private: int exitCode; QTcpSocket *socket; @@ -1970,11 +1990,13 @@ public slots: tst_QTcpSocket::exitLoop(); } +#ifndef QT_NO_NETWORKPROXY inline void proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *auth) { auth->setUser("qsockstest"); auth->setPassword("password"); } +#endif // !QT_NO_NETWORKPROXY }; //---------------------------------------------------------------------------------- @@ -2500,6 +2522,7 @@ void tst_QTcpSocket::taskQtBug7054TimeoutErrorResetting() QVERIFY(socket->error() == QAbstractSocket::RemoteHostClosedError); } +#ifndef QT_NO_NETWORKPROXY void tst_QTcpSocket::invalidProxy_data() { QTest::addColumn<int>("type"); @@ -2676,6 +2699,7 @@ void tst_QTcpSocket::proxyFactory() delete socket; } +#endif // !QT_NO_NETWORKPROXY // there is a similar test inside tst_qtcpserver that uses the event loop instead void tst_QTcpSocket::qtbug14268_peek() diff --git a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp index 8de66f0f2c..776278a480 100644 --- a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp +++ b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp @@ -148,7 +148,9 @@ void tst_QUdpSocket::initTestCase_data() QTest::addColumn<int>("proxyType"); QTest::newRow("WithoutProxy") << false << 0; +#ifndef QT_NO_SOCKS5 QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy); +#endif #ifndef QT_NO_BEARERMANAGEMENT netConfMan = new QNetworkConfigurationManager(this); @@ -171,16 +173,22 @@ void tst_QUdpSocket::init() { QFETCH_GLOBAL(bool, setProxy); if (setProxy) { +#ifndef QT_NO_SOCKS5 QFETCH_GLOBAL(int, proxyType); if (proxyType == QNetworkProxy::Socks5Proxy) { QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1080)); } +#else + QSKIP("No proxy support"); +#endif // !QT_NO_SOCKS5 } } void tst_QUdpSocket::cleanup() { +#ifndef QT_NO_NETWORKPROXY QNetworkProxy::setApplicationProxy(QNetworkProxy::DefaultProxy); +#endif // !QT_NO_NETWORKPROXY } @@ -250,9 +258,13 @@ void tst_QUdpSocket::broadcasting() { QFETCH_GLOBAL(bool, setProxy); if (setProxy) { +#ifndef QT_NO_NETWORKPROXY QFETCH_GLOBAL(int, proxyType); if (proxyType == QNetworkProxy::Socks5Proxy) QSKIP("With socks5 Broadcast is not supported."); +#else // !QT_NO_NETWORKPROXY + QSKIP("No proxy support"); +#endif // QT_NO_NETWORKPROXY } #ifdef Q_OS_AIX QSKIP("Broadcast does not work on darko"); @@ -746,9 +758,13 @@ void tst_QUdpSocket::bindMode() { QFETCH_GLOBAL(bool, setProxy); if (setProxy) { +#ifndef QT_NO_NETWORKPROXY QFETCH_GLOBAL(int, proxyType); if (proxyType == QNetworkProxy::Socks5Proxy) QSKIP("With socks5 explicit port binding is not supported."); +#else // !QT_NO_NETWORKPROXY + QSKIP("No proxy support"); +#endif // QT_NO_NETWORKPROXY } QUdpSocket socket; diff --git a/tests/auto/network/socket/socket.pro b/tests/auto/network/socket/socket.pro index 6d86eab209..436ebe5c7f 100644 --- a/tests/auto/network/socket/socket.pro +++ b/tests/auto/network/socket/socket.pro @@ -14,3 +14,7 @@ SUBDIRS=\ qtcpsocket \ qhttpsocketengine \ qsocks5socketengine \ + +winrt: SUBDIRS -= \ + qhttpsocketengine \ + qsocks5socketengine \ diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp index a15daf660a..82543fbc91 100644 --- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp @@ -111,7 +111,9 @@ public slots: void initTestCase(); void init(); void cleanup(); +#ifndef QT_NO_NETWORKPROXY void proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *auth); +#endif #ifndef QT_NO_SSL private slots: @@ -276,6 +278,7 @@ void tst_QSslSocket::init() { QFETCH_GLOBAL(bool, setProxy); if (setProxy) { +#ifndef QT_NO_NETWORKPROXY QFETCH_GLOBAL(int, proxyType); QString fluke = QHostInfo::fromName(QtNetworkSettings::serverName()).addresses().first().toString(); QNetworkProxy proxy; @@ -302,6 +305,9 @@ void tst_QSslSocket::init() break; } QNetworkProxy::setApplicationProxy(proxy); +#else // !QT_NO_NETWORKPROXY + QSKIP("No proxy support"); +#endif // QT_NO_NETWORKPROXY } qt_qhostinfo_clear_cache(); @@ -309,7 +315,9 @@ void tst_QSslSocket::init() void tst_QSslSocket::cleanup() { +#ifndef QT_NO_NETWORKPROXY QNetworkProxy::setApplicationProxy(QNetworkProxy::DefaultProxy); +#endif } #ifndef QT_NO_SSL @@ -326,12 +334,14 @@ QSslSocketPtr tst_QSslSocket::newSocket() } #endif +#ifndef QT_NO_NETWORKPROXY void tst_QSslSocket::proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *auth) { ++proxyAuthCalled; auth->setUser("qsockstest"); auth->setPassword("password"); } +#endif // !QT_NO_NETWORKPROXY #ifndef QT_NO_SSL diff --git a/tests/auto/network/ssl/ssl.pro b/tests/auto/network/ssl/ssl.pro index 06f4a05241..0b8f269fac 100644 --- a/tests/auto/network/ssl/ssl.pro +++ b/tests/auto/network/ssl/ssl.pro @@ -12,3 +12,7 @@ contains(QT_CONFIG, openssl) | contains(QT_CONFIG, openssl-linked): qsslsocket_onDemandCertificates_member \ qsslsocket_onDemandCertificates_static \ } + +winrt: SUBDIRS -= \ + qsslsocket_onDemandCertificates_member \ + qsslsocket_onDemandCertificates_static \ diff --git a/tests/auto/other/qvariant_common/tst_qvariant_common.h b/tests/auto/other/qvariant_common/tst_qvariant_common.h index fc3eff4b91..7a34d7b0c2 100644 --- a/tests/auto/other/qvariant_common/tst_qvariant_common.h +++ b/tests/auto/other/qvariant_common/tst_qvariant_common.h @@ -107,7 +107,7 @@ protected: currentName.chop(1); ok &= (msg.contains(", " + currentName) || msg.contains(", 0x0")); } - ok &= msg.endsWith(") "); + ok &= msg.endsWith(")"); QVERIFY2(ok, (QString::fromLatin1("Message is not correctly finished: '") + msg + '\'').toLatin1().constData()); } diff --git a/tests/auto/testlib/selftests/expected_counting.lightxml b/tests/auto/testlib/selftests/expected_counting.lightxml index c49792fec4..799a7d7b17 100644 --- a/tests/auto/testlib/selftests/expected_counting.lightxml +++ b/tests/auto/testlib/selftests/expected_counting.lightxml @@ -107,7 +107,7 @@ </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[fail]]></DataTag> - <Description><![CDATA[This test function should execute and then QFAIL in cleanup() ]]></Description> + <Description><![CDATA[This test function should execute and then QFAIL in cleanup()]]></Description> </Message> <Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="242"> <DataTag><![CDATA[fail]]></DataTag> @@ -135,7 +135,7 @@ </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[skip]]></DataTag> - <Description><![CDATA[This test function should execute and then QSKIP in cleanup() ]]></Description> + <Description><![CDATA[This test function should execute and then QSKIP in cleanup()]]></Description> </Message> <Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="244"> <DataTag><![CDATA[skip]]></DataTag> diff --git a/tests/auto/testlib/selftests/expected_counting.txt b/tests/auto/testlib/selftests/expected_counting.txt index f413882c2a..51b9402d3a 100644 --- a/tests/auto/testlib/selftests/expected_counting.txt +++ b/tests/auto/testlib/selftests/expected_counting.txt @@ -36,7 +36,7 @@ FAIL! : tst_Counting::testFailInInit(fail) Fail in init() Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(234)] PASS : tst_Counting::testFailInInit(after) PASS : tst_Counting::testFailInCleanup(before) -QDEBUG : tst_Counting::testFailInCleanup(fail) This test function should execute and then QFAIL in cleanup() +QDEBUG : tst_Counting::testFailInCleanup(fail) This test function should execute and then QFAIL in cleanup() FAIL! : tst_Counting::testFailInCleanup(fail) Fail in cleanup() Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(242)] PASS : tst_Counting::testFailInCleanup(after) @@ -45,7 +45,7 @@ SKIP : tst_Counting::testSkipInInit(skip) Skip in init() Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(236)] PASS : tst_Counting::testSkipInInit(after) PASS : tst_Counting::testSkipInCleanup(before) -QDEBUG : tst_Counting::testSkipInCleanup(skip) This test function should execute and then QSKIP in cleanup() +QDEBUG : tst_Counting::testSkipInCleanup(skip) This test function should execute and then QSKIP in cleanup() SKIP : tst_Counting::testSkipInCleanup(skip) Skip in cleanup() Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(244)] PASS : tst_Counting::testSkipInCleanup(after) diff --git a/tests/auto/testlib/selftests/expected_counting.xml b/tests/auto/testlib/selftests/expected_counting.xml index 7caa915f65..8177a2dc7f 100644 --- a/tests/auto/testlib/selftests/expected_counting.xml +++ b/tests/auto/testlib/selftests/expected_counting.xml @@ -109,7 +109,7 @@ </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[fail]]></DataTag> - <Description><![CDATA[This test function should execute and then QFAIL in cleanup() ]]></Description> + <Description><![CDATA[This test function should execute and then QFAIL in cleanup()]]></Description> </Message> <Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="242"> <DataTag><![CDATA[fail]]></DataTag> @@ -137,7 +137,7 @@ </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[skip]]></DataTag> - <Description><![CDATA[This test function should execute and then QSKIP in cleanup() ]]></Description> + <Description><![CDATA[This test function should execute and then QSKIP in cleanup()]]></Description> </Message> <Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="244"> <DataTag><![CDATA[skip]]></DataTag> diff --git a/tests/auto/testlib/selftests/expected_counting.xunitxml b/tests/auto/testlib/selftests/expected_counting.xunitxml index f317ed5923..72bf047ba8 100644 --- a/tests/auto/testlib/selftests/expected_counting.xunitxml +++ b/tests/auto/testlib/selftests/expected_counting.xunitxml @@ -38,14 +38,14 @@ <failure tag="fail" message="Fail in init()" result="fail"/> </testcase> <testcase result="fail" name="testFailInCleanup"> - <!-- tag="fail" message="This test function should execute and then QFAIL in cleanup() " type="qdebug" --> + <!-- tag="fail" message="This test function should execute and then QFAIL in cleanup()" type="qdebug" --> <failure tag="fail" message="Fail in cleanup()" result="fail"/> </testcase> <testcase result="pass" name="testSkipInInit"> <!-- tag="skip" message="Skip in init()" type="skip" --> </testcase> <testcase result="pass" name="testSkipInCleanup"> - <!-- tag="skip" message="This test function should execute and then QSKIP in cleanup() " type="qdebug" --> + <!-- tag="skip" message="This test function should execute and then QSKIP in cleanup()" type="qdebug" --> <!-- tag="skip" message="Skip in cleanup()" type="skip" --> </testcase> <testcase result="pass" name="cleanupTestCase"/> @@ -56,9 +56,9 @@ <![CDATA[Skipping]]> <![CDATA[Skipping]]> <![CDATA[Skipping]]> -<![CDATA[This test function should execute and then QFAIL in cleanup() ]]> +<![CDATA[This test function should execute and then QFAIL in cleanup()]]> <![CDATA[Skip in init()]]> -<![CDATA[This test function should execute and then QSKIP in cleanup() ]]> +<![CDATA[This test function should execute and then QSKIP in cleanup()]]> <![CDATA[Skip in cleanup()]]> </system-err> </testsuite> diff --git a/tests/auto/testlib/selftests/expected_globaldata.lightxml b/tests/auto/testlib/selftests/expected_globaldata.lightxml index 6d68bfbdb5..0fc9d527fb 100644 --- a/tests/auto/testlib/selftests/expected_globaldata.lightxml +++ b/tests/auto/testlib/selftests/expected_globaldata.lightxml @@ -4,83 +4,83 @@ </Environment> <TestFunction name="initTestCase"> <Message type="qdebug" file="" line="0"> - <Description><![CDATA[initTestCase initTestCase (null) ]]></Description> + <Description><![CDATA[initTestCase initTestCase (null)]]></Description> </Message> <Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="testGlobal"> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 1]]></DataTag> - <Description><![CDATA[init testGlobal local 1 ]]></Description> + <Description><![CDATA[init testGlobal local 1]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 1]]></DataTag> - <Description><![CDATA[global: false ]]></Description> + <Description><![CDATA[global: false]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 1]]></DataTag> - <Description><![CDATA[local: false ]]></Description> + <Description><![CDATA[local: false]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 1]]></DataTag> - <Description><![CDATA[cleanup testGlobal local 1 ]]></Description> + <Description><![CDATA[cleanup testGlobal local 1]]></Description> </Message> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[1:local 1]]></DataTag> </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[init testGlobal local 2 ]]></Description> + <Description><![CDATA[init testGlobal local 2]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[global: false ]]></Description> + <Description><![CDATA[global: false]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[local: true ]]></Description> + <Description><![CDATA[local: true]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[cleanup testGlobal local 2 ]]></Description> + <Description><![CDATA[cleanup testGlobal local 2]]></Description> </Message> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[1:local 2]]></DataTag> </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 1]]></DataTag> - <Description><![CDATA[init testGlobal local 1 ]]></Description> + <Description><![CDATA[init testGlobal local 1]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 1]]></DataTag> - <Description><![CDATA[global: true ]]></Description> + <Description><![CDATA[global: true]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 1]]></DataTag> - <Description><![CDATA[local: false ]]></Description> + <Description><![CDATA[local: false]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 1]]></DataTag> - <Description><![CDATA[cleanup testGlobal local 1 ]]></Description> + <Description><![CDATA[cleanup testGlobal local 1]]></Description> </Message> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[2:local 1]]></DataTag> </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 2]]></DataTag> - <Description><![CDATA[init testGlobal local 2 ]]></Description> + <Description><![CDATA[init testGlobal local 2]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 2]]></DataTag> - <Description><![CDATA[global: true ]]></Description> + <Description><![CDATA[global: true]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 2]]></DataTag> - <Description><![CDATA[local: true ]]></Description> + <Description><![CDATA[local: true]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 2]]></DataTag> - <Description><![CDATA[cleanup testGlobal local 2 ]]></Description> + <Description><![CDATA[cleanup testGlobal local 2]]></Description> </Message> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[2:local 2]]></DataTag> @@ -95,7 +95,7 @@ <TestFunction name="skipLocal"> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 1]]></DataTag> - <Description><![CDATA[init skipLocal local 1 ]]></Description> + <Description><![CDATA[init skipLocal local 1]]></Description> </Message> <Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp" line="149"> <DataTag><![CDATA[1:local 1]]></DataTag> @@ -103,11 +103,11 @@ </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 1]]></DataTag> - <Description><![CDATA[cleanup skipLocal local 1 ]]></Description> + <Description><![CDATA[cleanup skipLocal local 1]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[init skipLocal local 2 ]]></Description> + <Description><![CDATA[init skipLocal local 2]]></Description> </Message> <Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp" line="149"> <DataTag><![CDATA[1:local 2]]></DataTag> @@ -115,43 +115,43 @@ </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[cleanup skipLocal local 2 ]]></Description> + <Description><![CDATA[cleanup skipLocal local 2]]></Description> </Message> </TestFunction> <TestFunction name="skipSingle"> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 1]]></DataTag> - <Description><![CDATA[init skipSingle local 1 ]]></Description> + <Description><![CDATA[init skipSingle local 1]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 1]]></DataTag> - <Description><![CDATA[global: false local: false ]]></Description> + <Description><![CDATA[global: false local: false]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 1]]></DataTag> - <Description><![CDATA[cleanup skipSingle local 1 ]]></Description> + <Description><![CDATA[cleanup skipSingle local 1]]></Description> </Message> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[1:local 1]]></DataTag> </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[init skipSingle local 2 ]]></Description> + <Description><![CDATA[init skipSingle local 2]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[global: false local: true ]]></Description> + <Description><![CDATA[global: false local: true]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[cleanup skipSingle local 2 ]]></Description> + <Description><![CDATA[cleanup skipSingle local 2]]></Description> </Message> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[1:local 2]]></DataTag> </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 1]]></DataTag> - <Description><![CDATA[init skipSingle local 1 ]]></Description> + <Description><![CDATA[init skipSingle local 1]]></Description> </Message> <Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp" line="143"> <DataTag><![CDATA[2:local 1]]></DataTag> @@ -159,19 +159,19 @@ </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 1]]></DataTag> - <Description><![CDATA[cleanup skipSingle local 1 ]]></Description> + <Description><![CDATA[cleanup skipSingle local 1]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 2]]></DataTag> - <Description><![CDATA[init skipSingle local 2 ]]></Description> + <Description><![CDATA[init skipSingle local 2]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 2]]></DataTag> - <Description><![CDATA[global: true local: true ]]></Description> + <Description><![CDATA[global: true local: true]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 2]]></DataTag> - <Description><![CDATA[cleanup skipSingle local 2 ]]></Description> + <Description><![CDATA[cleanup skipSingle local 2]]></Description> </Message> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[2:local 2]]></DataTag> @@ -179,7 +179,7 @@ </TestFunction> <TestFunction name="cleanupTestCase"> <Message type="qdebug" file="" line="0"> - <Description><![CDATA[cleanupTestCase cleanupTestCase (null) ]]></Description> + <Description><![CDATA[cleanupTestCase cleanupTestCase (null)]]></Description> </Message> <Incident type="pass" file="" line="0" /> </TestFunction> diff --git a/tests/auto/testlib/selftests/expected_globaldata.txt b/tests/auto/testlib/selftests/expected_globaldata.txt index e5d9cacc9c..4e3544dbe0 100644 --- a/tests/auto/testlib/selftests/expected_globaldata.txt +++ b/tests/auto/testlib/selftests/expected_globaldata.txt @@ -1,54 +1,54 @@ ********* Start testing of tst_globaldata ********* Config: Using QtTest library @INSERT_QT_VERSION_HERE@, Qt @INSERT_QT_VERSION_HERE@ -QDEBUG : tst_globaldata::initTestCase() initTestCase initTestCase (null) +QDEBUG : tst_globaldata::initTestCase() initTestCase initTestCase (null) PASS : tst_globaldata::initTestCase() -QDEBUG : tst_globaldata::testGlobal(1:local 1) init testGlobal local 1 -QDEBUG : tst_globaldata::testGlobal(1:local 1) global: false -QDEBUG : tst_globaldata::testGlobal(1:local 1) local: false -QDEBUG : tst_globaldata::testGlobal(1:local 1) cleanup testGlobal local 1 +QDEBUG : tst_globaldata::testGlobal(1:local 1) init testGlobal local 1 +QDEBUG : tst_globaldata::testGlobal(1:local 1) global: false +QDEBUG : tst_globaldata::testGlobal(1:local 1) local: false +QDEBUG : tst_globaldata::testGlobal(1:local 1) cleanup testGlobal local 1 PASS : tst_globaldata::testGlobal(1:local 1) -QDEBUG : tst_globaldata::testGlobal(1:local 2) init testGlobal local 2 -QDEBUG : tst_globaldata::testGlobal(1:local 2) global: false -QDEBUG : tst_globaldata::testGlobal(1:local 2) local: true -QDEBUG : tst_globaldata::testGlobal(1:local 2) cleanup testGlobal local 2 +QDEBUG : tst_globaldata::testGlobal(1:local 2) init testGlobal local 2 +QDEBUG : tst_globaldata::testGlobal(1:local 2) global: false +QDEBUG : tst_globaldata::testGlobal(1:local 2) local: true +QDEBUG : tst_globaldata::testGlobal(1:local 2) cleanup testGlobal local 2 PASS : tst_globaldata::testGlobal(1:local 2) -QDEBUG : tst_globaldata::testGlobal(2:local 1) init testGlobal local 1 -QDEBUG : tst_globaldata::testGlobal(2:local 1) global: true -QDEBUG : tst_globaldata::testGlobal(2:local 1) local: false -QDEBUG : tst_globaldata::testGlobal(2:local 1) cleanup testGlobal local 1 +QDEBUG : tst_globaldata::testGlobal(2:local 1) init testGlobal local 1 +QDEBUG : tst_globaldata::testGlobal(2:local 1) global: true +QDEBUG : tst_globaldata::testGlobal(2:local 1) local: false +QDEBUG : tst_globaldata::testGlobal(2:local 1) cleanup testGlobal local 1 PASS : tst_globaldata::testGlobal(2:local 1) -QDEBUG : tst_globaldata::testGlobal(2:local 2) init testGlobal local 2 -QDEBUG : tst_globaldata::testGlobal(2:local 2) global: true -QDEBUG : tst_globaldata::testGlobal(2:local 2) local: true -QDEBUG : tst_globaldata::testGlobal(2:local 2) cleanup testGlobal local 2 +QDEBUG : tst_globaldata::testGlobal(2:local 2) init testGlobal local 2 +QDEBUG : tst_globaldata::testGlobal(2:local 2) global: true +QDEBUG : tst_globaldata::testGlobal(2:local 2) local: true +QDEBUG : tst_globaldata::testGlobal(2:local 2) cleanup testGlobal local 2 PASS : tst_globaldata::testGlobal(2:local 2) SKIP : tst_globaldata::skip(1) skipping Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp(129)] -QDEBUG : tst_globaldata::skipLocal(1:local 1) init skipLocal local 1 +QDEBUG : tst_globaldata::skipLocal(1:local 1) init skipLocal local 1 SKIP : tst_globaldata::skipLocal(1:local 1) skipping Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp(149)] -QDEBUG : tst_globaldata::skipLocal(1:local 1) cleanup skipLocal local 1 -QDEBUG : tst_globaldata::skipLocal(1:local 2) init skipLocal local 2 +QDEBUG : tst_globaldata::skipLocal(1:local 1) cleanup skipLocal local 1 +QDEBUG : tst_globaldata::skipLocal(1:local 2) init skipLocal local 2 SKIP : tst_globaldata::skipLocal(1:local 2) skipping Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp(149)] -QDEBUG : tst_globaldata::skipLocal(1:local 2) cleanup skipLocal local 2 -QDEBUG : tst_globaldata::skipSingle(1:local 1) init skipSingle local 1 -QDEBUG : tst_globaldata::skipSingle(1:local 1) global: false local: false -QDEBUG : tst_globaldata::skipSingle(1:local 1) cleanup skipSingle local 1 +QDEBUG : tst_globaldata::skipLocal(1:local 2) cleanup skipLocal local 2 +QDEBUG : tst_globaldata::skipSingle(1:local 1) init skipSingle local 1 +QDEBUG : tst_globaldata::skipSingle(1:local 1) global: false local: false +QDEBUG : tst_globaldata::skipSingle(1:local 1) cleanup skipSingle local 1 PASS : tst_globaldata::skipSingle(1:local 1) -QDEBUG : tst_globaldata::skipSingle(1:local 2) init skipSingle local 2 -QDEBUG : tst_globaldata::skipSingle(1:local 2) global: false local: true -QDEBUG : tst_globaldata::skipSingle(1:local 2) cleanup skipSingle local 2 +QDEBUG : tst_globaldata::skipSingle(1:local 2) init skipSingle local 2 +QDEBUG : tst_globaldata::skipSingle(1:local 2) global: false local: true +QDEBUG : tst_globaldata::skipSingle(1:local 2) cleanup skipSingle local 2 PASS : tst_globaldata::skipSingle(1:local 2) -QDEBUG : tst_globaldata::skipSingle(2:local 1) init skipSingle local 1 +QDEBUG : tst_globaldata::skipSingle(2:local 1) init skipSingle local 1 SKIP : tst_globaldata::skipSingle(2:local 1) skipping Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp(143)] -QDEBUG : tst_globaldata::skipSingle(2:local 1) cleanup skipSingle local 1 -QDEBUG : tst_globaldata::skipSingle(2:local 2) init skipSingle local 2 -QDEBUG : tst_globaldata::skipSingle(2:local 2) global: true local: true -QDEBUG : tst_globaldata::skipSingle(2:local 2) cleanup skipSingle local 2 +QDEBUG : tst_globaldata::skipSingle(2:local 1) cleanup skipSingle local 1 +QDEBUG : tst_globaldata::skipSingle(2:local 2) init skipSingle local 2 +QDEBUG : tst_globaldata::skipSingle(2:local 2) global: true local: true +QDEBUG : tst_globaldata::skipSingle(2:local 2) cleanup skipSingle local 2 PASS : tst_globaldata::skipSingle(2:local 2) -QDEBUG : tst_globaldata::cleanupTestCase() cleanupTestCase cleanupTestCase (null) +QDEBUG : tst_globaldata::cleanupTestCase() cleanupTestCase cleanupTestCase (null) PASS : tst_globaldata::cleanupTestCase() Totals: 9 passed, 0 failed, 4 skipped ********* Finished testing of tst_globaldata ********* diff --git a/tests/auto/testlib/selftests/expected_globaldata.xml b/tests/auto/testlib/selftests/expected_globaldata.xml index 906e66ca68..cf2534e34a 100644 --- a/tests/auto/testlib/selftests/expected_globaldata.xml +++ b/tests/auto/testlib/selftests/expected_globaldata.xml @@ -6,83 +6,83 @@ </Environment> <TestFunction name="initTestCase"> <Message type="qdebug" file="" line="0"> - <Description><![CDATA[initTestCase initTestCase (null) ]]></Description> + <Description><![CDATA[initTestCase initTestCase (null)]]></Description> </Message> <Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="testGlobal"> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 1]]></DataTag> - <Description><![CDATA[init testGlobal local 1 ]]></Description> + <Description><![CDATA[init testGlobal local 1]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 1]]></DataTag> - <Description><![CDATA[global: false ]]></Description> + <Description><![CDATA[global: false]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 1]]></DataTag> - <Description><![CDATA[local: false ]]></Description> + <Description><![CDATA[local: false]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 1]]></DataTag> - <Description><![CDATA[cleanup testGlobal local 1 ]]></Description> + <Description><![CDATA[cleanup testGlobal local 1]]></Description> </Message> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[1:local 1]]></DataTag> </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[init testGlobal local 2 ]]></Description> + <Description><![CDATA[init testGlobal local 2]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[global: false ]]></Description> + <Description><![CDATA[global: false]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[local: true ]]></Description> + <Description><![CDATA[local: true]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[cleanup testGlobal local 2 ]]></Description> + <Description><![CDATA[cleanup testGlobal local 2]]></Description> </Message> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[1:local 2]]></DataTag> </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 1]]></DataTag> - <Description><![CDATA[init testGlobal local 1 ]]></Description> + <Description><![CDATA[init testGlobal local 1]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 1]]></DataTag> - <Description><![CDATA[global: true ]]></Description> + <Description><![CDATA[global: true]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 1]]></DataTag> - <Description><![CDATA[local: false ]]></Description> + <Description><![CDATA[local: false]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 1]]></DataTag> - <Description><![CDATA[cleanup testGlobal local 1 ]]></Description> + <Description><![CDATA[cleanup testGlobal local 1]]></Description> </Message> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[2:local 1]]></DataTag> </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 2]]></DataTag> - <Description><![CDATA[init testGlobal local 2 ]]></Description> + <Description><![CDATA[init testGlobal local 2]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 2]]></DataTag> - <Description><![CDATA[global: true ]]></Description> + <Description><![CDATA[global: true]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 2]]></DataTag> - <Description><![CDATA[local: true ]]></Description> + <Description><![CDATA[local: true]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 2]]></DataTag> - <Description><![CDATA[cleanup testGlobal local 2 ]]></Description> + <Description><![CDATA[cleanup testGlobal local 2]]></Description> </Message> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[2:local 2]]></DataTag> @@ -97,7 +97,7 @@ <TestFunction name="skipLocal"> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 1]]></DataTag> - <Description><![CDATA[init skipLocal local 1 ]]></Description> + <Description><![CDATA[init skipLocal local 1]]></Description> </Message> <Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp" line="149"> <DataTag><![CDATA[1:local 1]]></DataTag> @@ -105,11 +105,11 @@ </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 1]]></DataTag> - <Description><![CDATA[cleanup skipLocal local 1 ]]></Description> + <Description><![CDATA[cleanup skipLocal local 1]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[init skipLocal local 2 ]]></Description> + <Description><![CDATA[init skipLocal local 2]]></Description> </Message> <Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp" line="149"> <DataTag><![CDATA[1:local 2]]></DataTag> @@ -117,43 +117,43 @@ </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[cleanup skipLocal local 2 ]]></Description> + <Description><![CDATA[cleanup skipLocal local 2]]></Description> </Message> </TestFunction> <TestFunction name="skipSingle"> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 1]]></DataTag> - <Description><![CDATA[init skipSingle local 1 ]]></Description> + <Description><![CDATA[init skipSingle local 1]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 1]]></DataTag> - <Description><![CDATA[global: false local: false ]]></Description> + <Description><![CDATA[global: false local: false]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 1]]></DataTag> - <Description><![CDATA[cleanup skipSingle local 1 ]]></Description> + <Description><![CDATA[cleanup skipSingle local 1]]></Description> </Message> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[1:local 1]]></DataTag> </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[init skipSingle local 2 ]]></Description> + <Description><![CDATA[init skipSingle local 2]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[global: false local: true ]]></Description> + <Description><![CDATA[global: false local: true]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[1:local 2]]></DataTag> - <Description><![CDATA[cleanup skipSingle local 2 ]]></Description> + <Description><![CDATA[cleanup skipSingle local 2]]></Description> </Message> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[1:local 2]]></DataTag> </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 1]]></DataTag> - <Description><![CDATA[init skipSingle local 1 ]]></Description> + <Description><![CDATA[init skipSingle local 1]]></Description> </Message> <Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp" line="143"> <DataTag><![CDATA[2:local 1]]></DataTag> @@ -161,19 +161,19 @@ </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 1]]></DataTag> - <Description><![CDATA[cleanup skipSingle local 1 ]]></Description> + <Description><![CDATA[cleanup skipSingle local 1]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 2]]></DataTag> - <Description><![CDATA[init skipSingle local 2 ]]></Description> + <Description><![CDATA[init skipSingle local 2]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 2]]></DataTag> - <Description><![CDATA[global: true local: true ]]></Description> + <Description><![CDATA[global: true local: true]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[2:local 2]]></DataTag> - <Description><![CDATA[cleanup skipSingle local 2 ]]></Description> + <Description><![CDATA[cleanup skipSingle local 2]]></Description> </Message> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[2:local 2]]></DataTag> @@ -181,7 +181,7 @@ </TestFunction> <TestFunction name="cleanupTestCase"> <Message type="qdebug" file="" line="0"> - <Description><![CDATA[cleanupTestCase cleanupTestCase (null) ]]></Description> + <Description><![CDATA[cleanupTestCase cleanupTestCase (null)]]></Description> </Message> <Incident type="pass" file="" line="0" /> </TestFunction> diff --git a/tests/auto/testlib/selftests/expected_globaldata.xunitxml b/tests/auto/testlib/selftests/expected_globaldata.xunitxml index 9e0cd149dc..e8cd03a59c 100644 --- a/tests/auto/testlib/selftests/expected_globaldata.xunitxml +++ b/tests/auto/testlib/selftests/expected_globaldata.xunitxml @@ -5,91 +5,91 @@ <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> </properties> <testcase result="pass" name="initTestCase"> - <!-- message="initTestCase initTestCase (null) " type="qdebug" --> + <!-- message="initTestCase initTestCase (null)" type="qdebug" --> </testcase> <testcase result="pass" name="testGlobal"> - <!-- tag="1:local 1" message="init testGlobal local 1 " type="qdebug" --> - <!-- tag="1:local 1" message="global: false " type="qdebug" --> - <!-- tag="1:local 1" message="local: false " type="qdebug" --> - <!-- tag="1:local 1" message="cleanup testGlobal local 1 " type="qdebug" --> - <!-- tag="1:local 2" message="init testGlobal local 2 " type="qdebug" --> - <!-- tag="1:local 2" message="global: false " type="qdebug" --> - <!-- tag="1:local 2" message="local: true " type="qdebug" --> - <!-- tag="1:local 2" message="cleanup testGlobal local 2 " type="qdebug" --> - <!-- tag="2:local 1" message="init testGlobal local 1 " type="qdebug" --> - <!-- tag="2:local 1" message="global: true " type="qdebug" --> - <!-- tag="2:local 1" message="local: false " type="qdebug" --> - <!-- tag="2:local 1" message="cleanup testGlobal local 1 " type="qdebug" --> - <!-- tag="2:local 2" message="init testGlobal local 2 " type="qdebug" --> - <!-- tag="2:local 2" message="global: true " type="qdebug" --> - <!-- tag="2:local 2" message="local: true " type="qdebug" --> - <!-- tag="2:local 2" message="cleanup testGlobal local 2 " type="qdebug" --> + <!-- tag="1:local 1" message="init testGlobal local 1" type="qdebug" --> + <!-- tag="1:local 1" message="global: false" type="qdebug" --> + <!-- tag="1:local 1" message="local: false" type="qdebug" --> + <!-- tag="1:local 1" message="cleanup testGlobal local 1" type="qdebug" --> + <!-- tag="1:local 2" message="init testGlobal local 2" type="qdebug" --> + <!-- tag="1:local 2" message="global: false" type="qdebug" --> + <!-- tag="1:local 2" message="local: true" type="qdebug" --> + <!-- tag="1:local 2" message="cleanup testGlobal local 2" type="qdebug" --> + <!-- tag="2:local 1" message="init testGlobal local 1" type="qdebug" --> + <!-- tag="2:local 1" message="global: true" type="qdebug" --> + <!-- tag="2:local 1" message="local: false" type="qdebug" --> + <!-- tag="2:local 1" message="cleanup testGlobal local 1" type="qdebug" --> + <!-- tag="2:local 2" message="init testGlobal local 2" type="qdebug" --> + <!-- tag="2:local 2" message="global: true" type="qdebug" --> + <!-- tag="2:local 2" message="local: true" type="qdebug" --> + <!-- tag="2:local 2" message="cleanup testGlobal local 2" type="qdebug" --> </testcase> <testcase name="skip"> <!-- tag="1" message="skipping" type="skip" --> </testcase> <testcase name="skipLocal"> - <!-- tag="1:local 1" message="init skipLocal local 1 " type="qdebug" --> + <!-- tag="1:local 1" message="init skipLocal local 1" type="qdebug" --> <!-- tag="1:local 1" message="skipping" type="skip" --> - <!-- tag="1:local 1" message="cleanup skipLocal local 1 " type="qdebug" --> - <!-- tag="1:local 2" message="init skipLocal local 2 " type="qdebug" --> + <!-- tag="1:local 1" message="cleanup skipLocal local 1" type="qdebug" --> + <!-- tag="1:local 2" message="init skipLocal local 2" type="qdebug" --> <!-- tag="1:local 2" message="skipping" type="skip" --> - <!-- tag="1:local 2" message="cleanup skipLocal local 2 " type="qdebug" --> + <!-- tag="1:local 2" message="cleanup skipLocal local 2" type="qdebug" --> </testcase> <testcase result="pass" name="skipSingle"> - <!-- tag="1:local 1" message="init skipSingle local 1 " type="qdebug" --> - <!-- tag="1:local 1" message="global: false local: false " type="qdebug" --> - <!-- tag="1:local 1" message="cleanup skipSingle local 1 " type="qdebug" --> - <!-- tag="1:local 2" message="init skipSingle local 2 " type="qdebug" --> - <!-- tag="1:local 2" message="global: false local: true " type="qdebug" --> - <!-- tag="1:local 2" message="cleanup skipSingle local 2 " type="qdebug" --> - <!-- tag="2:local 1" message="init skipSingle local 1 " type="qdebug" --> + <!-- tag="1:local 1" message="init skipSingle local 1" type="qdebug" --> + <!-- tag="1:local 1" message="global: false local: false" type="qdebug" --> + <!-- tag="1:local 1" message="cleanup skipSingle local 1" type="qdebug" --> + <!-- tag="1:local 2" message="init skipSingle local 2" type="qdebug" --> + <!-- tag="1:local 2" message="global: false local: true" type="qdebug" --> + <!-- tag="1:local 2" message="cleanup skipSingle local 2" type="qdebug" --> + <!-- tag="2:local 1" message="init skipSingle local 1" type="qdebug" --> <!-- tag="2:local 1" message="skipping" type="skip" --> - <!-- tag="2:local 1" message="cleanup skipSingle local 1 " type="qdebug" --> - <!-- tag="2:local 2" message="init skipSingle local 2 " type="qdebug" --> - <!-- tag="2:local 2" message="global: true local: true " type="qdebug" --> - <!-- tag="2:local 2" message="cleanup skipSingle local 2 " type="qdebug" --> + <!-- tag="2:local 1" message="cleanup skipSingle local 1" type="qdebug" --> + <!-- tag="2:local 2" message="init skipSingle local 2" type="qdebug" --> + <!-- tag="2:local 2" message="global: true local: true" type="qdebug" --> + <!-- tag="2:local 2" message="cleanup skipSingle local 2" type="qdebug" --> </testcase> <testcase result="pass" name="cleanupTestCase"> - <!-- message="cleanupTestCase cleanupTestCase (null) " type="qdebug" --> + <!-- message="cleanupTestCase cleanupTestCase (null)" type="qdebug" --> </testcase> <system-err> -<![CDATA[initTestCase initTestCase (null) ]]> -<![CDATA[init testGlobal local 1 ]]> -<![CDATA[global: false ]]> -<![CDATA[local: false ]]> -<![CDATA[cleanup testGlobal local 1 ]]> -<![CDATA[init testGlobal local 2 ]]> -<![CDATA[global: false ]]> -<![CDATA[local: true ]]> -<![CDATA[cleanup testGlobal local 2 ]]> -<![CDATA[init testGlobal local 1 ]]> -<![CDATA[global: true ]]> -<![CDATA[local: false ]]> -<![CDATA[cleanup testGlobal local 1 ]]> -<![CDATA[init testGlobal local 2 ]]> -<![CDATA[global: true ]]> -<![CDATA[local: true ]]> -<![CDATA[cleanup testGlobal local 2 ]]> +<![CDATA[initTestCase initTestCase (null)]]> +<![CDATA[init testGlobal local 1]]> +<![CDATA[global: false]]> +<![CDATA[local: false]]> +<![CDATA[cleanup testGlobal local 1]]> +<![CDATA[init testGlobal local 2]]> +<![CDATA[global: false]]> +<![CDATA[local: true]]> +<![CDATA[cleanup testGlobal local 2]]> +<![CDATA[init testGlobal local 1]]> +<![CDATA[global: true]]> +<![CDATA[local: false]]> +<![CDATA[cleanup testGlobal local 1]]> +<![CDATA[init testGlobal local 2]]> +<![CDATA[global: true]]> +<![CDATA[local: true]]> +<![CDATA[cleanup testGlobal local 2]]> <![CDATA[skipping]]> -<![CDATA[init skipLocal local 1 ]]> +<![CDATA[init skipLocal local 1]]> <![CDATA[skipping]]> -<![CDATA[cleanup skipLocal local 1 ]]> -<![CDATA[init skipLocal local 2 ]]> +<![CDATA[cleanup skipLocal local 1]]> +<![CDATA[init skipLocal local 2]]> <![CDATA[skipping]]> -<![CDATA[cleanup skipLocal local 2 ]]> -<![CDATA[init skipSingle local 1 ]]> -<![CDATA[global: false local: false ]]> -<![CDATA[cleanup skipSingle local 1 ]]> -<![CDATA[init skipSingle local 2 ]]> -<![CDATA[global: false local: true ]]> -<![CDATA[cleanup skipSingle local 2 ]]> -<![CDATA[init skipSingle local 1 ]]> +<![CDATA[cleanup skipLocal local 2]]> +<![CDATA[init skipSingle local 1]]> +<![CDATA[global: false local: false]]> +<![CDATA[cleanup skipSingle local 1]]> +<![CDATA[init skipSingle local 2]]> +<![CDATA[global: false local: true]]> +<![CDATA[cleanup skipSingle local 2]]> +<![CDATA[init skipSingle local 1]]> <![CDATA[skipping]]> -<![CDATA[cleanup skipSingle local 1 ]]> -<![CDATA[init skipSingle local 2 ]]> -<![CDATA[global: true local: true ]]> -<![CDATA[cleanup skipSingle local 2 ]]> -<![CDATA[cleanupTestCase cleanupTestCase (null) ]]> +<![CDATA[cleanup skipSingle local 1]]> +<![CDATA[init skipSingle local 2]]> +<![CDATA[global: true local: true]]> +<![CDATA[cleanup skipSingle local 2]]> +<![CDATA[cleanupTestCase cleanupTestCase (null)]]> </system-err> </testsuite> diff --git a/tests/auto/testlib/selftests/expected_subtest.lightxml b/tests/auto/testlib/selftests/expected_subtest.lightxml index 5adbb771af..45d0a71a3e 100644 --- a/tests/auto/testlib/selftests/expected_subtest.lightxml +++ b/tests/auto/testlib/selftests/expected_subtest.lightxml @@ -4,82 +4,82 @@ </Environment> <TestFunction name="initTestCase"> <Message type="qdebug" file="" line="0"> - <Description><![CDATA[initTestCase initTestCase (null) ]]></Description> + <Description><![CDATA[initTestCase initTestCase (null)]]></Description> </Message> <Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="test1"> <Message type="qdebug" file="" line="0"> - <Description><![CDATA[init test1 (null) ]]></Description> + <Description><![CDATA[init test1 (null)]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <Description><![CDATA[test1 test1 (null) ]]></Description> + <Description><![CDATA[test1 test1 (null)]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <Description><![CDATA[cleanup test1 (null) ]]></Description> + <Description><![CDATA[cleanup test1 (null)]]></Description> </Message> <Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="test2"> <Message type="qdebug" file="" line="0"> - <Description><![CDATA[test2_data test2 (null) ]]></Description> + <Description><![CDATA[test2_data test2 (null)]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <Description><![CDATA[test2_data end ]]></Description> + <Description><![CDATA[test2_data end]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data0]]></DataTag> - <Description><![CDATA[init test2 data0 ]]></Description> + <Description><![CDATA[init test2 data0]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data0]]></DataTag> - <Description><![CDATA[test2 test2 data0 ]]></Description> + <Description><![CDATA[test2 test2 data0]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data0]]></DataTag> - <Description><![CDATA[test2 end ]]></Description> + <Description><![CDATA[test2 end]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data0]]></DataTag> - <Description><![CDATA[cleanup test2 data0 ]]></Description> + <Description><![CDATA[cleanup test2 data0]]></Description> </Message> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[data0]]></DataTag> </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data1]]></DataTag> - <Description><![CDATA[init test2 data1 ]]></Description> + <Description><![CDATA[init test2 data1]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data1]]></DataTag> - <Description><![CDATA[test2 test2 data1 ]]></Description> + <Description><![CDATA[test2 test2 data1]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data1]]></DataTag> - <Description><![CDATA[test2 end ]]></Description> + <Description><![CDATA[test2 end]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data1]]></DataTag> - <Description><![CDATA[cleanup test2 data1 ]]></Description> + <Description><![CDATA[cleanup test2 data1]]></Description> </Message> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[data1]]></DataTag> </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data2]]></DataTag> - <Description><![CDATA[init test2 data2 ]]></Description> + <Description><![CDATA[init test2 data2]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data2]]></DataTag> - <Description><![CDATA[test2 test2 data2 ]]></Description> + <Description><![CDATA[test2 test2 data2]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data2]]></DataTag> - <Description><![CDATA[test2 end ]]></Description> + <Description><![CDATA[test2 end]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data2]]></DataTag> - <Description><![CDATA[cleanup test2 data2 ]]></Description> + <Description><![CDATA[cleanup test2 data2]]></Description> </Message> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[data2]]></DataTag> @@ -87,37 +87,37 @@ </TestFunction> <TestFunction name="test3"> <Message type="qdebug" file="" line="0"> - <Description><![CDATA[test3_data test3 (null) ]]></Description> + <Description><![CDATA[test3_data test3 (null)]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <Description><![CDATA[test3_data end ]]></Description> + <Description><![CDATA[test3_data end]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data0]]></DataTag> - <Description><![CDATA[init test3 data0 ]]></Description> + <Description><![CDATA[init test3 data0]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data0]]></DataTag> - <Description><![CDATA[test2 test3 data0 ]]></Description> + <Description><![CDATA[test2 test3 data0]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data0]]></DataTag> - <Description><![CDATA[test2 end ]]></Description> + <Description><![CDATA[test2 end]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data0]]></DataTag> - <Description><![CDATA[cleanup test3 data0 ]]></Description> + <Description><![CDATA[cleanup test3 data0]]></Description> </Message> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[data0]]></DataTag> </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data1]]></DataTag> - <Description><![CDATA[init test3 data1 ]]></Description> + <Description><![CDATA[init test3 data1]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data1]]></DataTag> - <Description><![CDATA[test2 test3 data1 ]]></Description> + <Description><![CDATA[test2 test3 data1]]></Description> </Message> <Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/subtest/tst_subtest.cpp" line="154"> <DataTag><![CDATA[data1]]></DataTag> @@ -127,15 +127,15 @@ </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data1]]></DataTag> - <Description><![CDATA[cleanup test3 data1 ]]></Description> + <Description><![CDATA[cleanup test3 data1]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data2]]></DataTag> - <Description><![CDATA[init test3 data2 ]]></Description> + <Description><![CDATA[init test3 data2]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data2]]></DataTag> - <Description><![CDATA[test2 test3 data2 ]]></Description> + <Description><![CDATA[test2 test3 data2]]></Description> </Message> <Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/subtest/tst_subtest.cpp" line="154"> <DataTag><![CDATA[data2]]></DataTag> @@ -145,12 +145,12 @@ </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data2]]></DataTag> - <Description><![CDATA[cleanup test3 data2 ]]></Description> + <Description><![CDATA[cleanup test3 data2]]></Description> </Message> </TestFunction> <TestFunction name="cleanupTestCase"> <Message type="qdebug" file="" line="0"> - <Description><![CDATA[cleanupTestCase cleanupTestCase (null) ]]></Description> + <Description><![CDATA[cleanupTestCase cleanupTestCase (null)]]></Description> </Message> <Incident type="pass" file="" line="0" /> </TestFunction> diff --git a/tests/auto/testlib/selftests/expected_subtest.txt b/tests/auto/testlib/selftests/expected_subtest.txt index bb88f189ec..bb496bf33c 100644 --- a/tests/auto/testlib/selftests/expected_subtest.txt +++ b/tests/auto/testlib/selftests/expected_subtest.txt @@ -1,50 +1,50 @@ ********* Start testing of tst_Subtest ********* Config: Using QtTest library @INSERT_QT_VERSION_HERE@, Qt @INSERT_QT_VERSION_HERE@ -QDEBUG : tst_Subtest::initTestCase() initTestCase initTestCase (null) +QDEBUG : tst_Subtest::initTestCase() initTestCase initTestCase (null) PASS : tst_Subtest::initTestCase() -QDEBUG : tst_Subtest::test1() init test1 (null) -QDEBUG : tst_Subtest::test1() test1 test1 (null) -QDEBUG : tst_Subtest::test1() cleanup test1 (null) +QDEBUG : tst_Subtest::test1() init test1 (null) +QDEBUG : tst_Subtest::test1() test1 test1 (null) +QDEBUG : tst_Subtest::test1() cleanup test1 (null) PASS : tst_Subtest::test1() -QDEBUG : tst_Subtest::test2() test2_data test2 (null) -QDEBUG : tst_Subtest::test2() test2_data end -QDEBUG : tst_Subtest::test2(data0) init test2 data0 -QDEBUG : tst_Subtest::test2(data0) test2 test2 data0 -QDEBUG : tst_Subtest::test2(data0) test2 end -QDEBUG : tst_Subtest::test2(data0) cleanup test2 data0 +QDEBUG : tst_Subtest::test2() test2_data test2 (null) +QDEBUG : tst_Subtest::test2() test2_data end +QDEBUG : tst_Subtest::test2(data0) init test2 data0 +QDEBUG : tst_Subtest::test2(data0) test2 test2 data0 +QDEBUG : tst_Subtest::test2(data0) test2 end +QDEBUG : tst_Subtest::test2(data0) cleanup test2 data0 PASS : tst_Subtest::test2(data0) -QDEBUG : tst_Subtest::test2(data1) init test2 data1 -QDEBUG : tst_Subtest::test2(data1) test2 test2 data1 -QDEBUG : tst_Subtest::test2(data1) test2 end -QDEBUG : tst_Subtest::test2(data1) cleanup test2 data1 +QDEBUG : tst_Subtest::test2(data1) init test2 data1 +QDEBUG : tst_Subtest::test2(data1) test2 test2 data1 +QDEBUG : tst_Subtest::test2(data1) test2 end +QDEBUG : tst_Subtest::test2(data1) cleanup test2 data1 PASS : tst_Subtest::test2(data1) -QDEBUG : tst_Subtest::test2(data2) init test2 data2 -QDEBUG : tst_Subtest::test2(data2) test2 test2 data2 -QDEBUG : tst_Subtest::test2(data2) test2 end -QDEBUG : tst_Subtest::test2(data2) cleanup test2 data2 +QDEBUG : tst_Subtest::test2(data2) init test2 data2 +QDEBUG : tst_Subtest::test2(data2) test2 test2 data2 +QDEBUG : tst_Subtest::test2(data2) test2 end +QDEBUG : tst_Subtest::test2(data2) cleanup test2 data2 PASS : tst_Subtest::test2(data2) -QDEBUG : tst_Subtest::test3() test3_data test3 (null) -QDEBUG : tst_Subtest::test3() test3_data end -QDEBUG : tst_Subtest::test3(data0) init test3 data0 -QDEBUG : tst_Subtest::test3(data0) test2 test3 data0 -QDEBUG : tst_Subtest::test3(data0) test2 end -QDEBUG : tst_Subtest::test3(data0) cleanup test3 data0 +QDEBUG : tst_Subtest::test3() test3_data test3 (null) +QDEBUG : tst_Subtest::test3() test3_data end +QDEBUG : tst_Subtest::test3(data0) init test3 data0 +QDEBUG : tst_Subtest::test3(data0) test2 test3 data0 +QDEBUG : tst_Subtest::test3(data0) test2 end +QDEBUG : tst_Subtest::test3(data0) cleanup test3 data0 PASS : tst_Subtest::test3(data0) -QDEBUG : tst_Subtest::test3(data1) init test3 data1 -QDEBUG : tst_Subtest::test3(data1) test2 test3 data1 +QDEBUG : tst_Subtest::test3(data1) init test3 data1 +QDEBUG : tst_Subtest::test3(data1) test2 test3 data1 FAIL! : tst_Subtest::test3(data1) Compared values are not the same Actual (str) : hello1 Expected (QString("hello0")): hello0 Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/subtest/tst_subtest.cpp(154)] -QDEBUG : tst_Subtest::test3(data1) cleanup test3 data1 -QDEBUG : tst_Subtest::test3(data2) init test3 data2 -QDEBUG : tst_Subtest::test3(data2) test2 test3 data2 +QDEBUG : tst_Subtest::test3(data1) cleanup test3 data1 +QDEBUG : tst_Subtest::test3(data2) init test3 data2 +QDEBUG : tst_Subtest::test3(data2) test2 test3 data2 FAIL! : tst_Subtest::test3(data2) Compared values are not the same Actual (str) : hello2 Expected (QString("hello0")): hello0 Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/subtest/tst_subtest.cpp(154)] -QDEBUG : tst_Subtest::test3(data2) cleanup test3 data2 -QDEBUG : tst_Subtest::cleanupTestCase() cleanupTestCase cleanupTestCase (null) +QDEBUG : tst_Subtest::test3(data2) cleanup test3 data2 +QDEBUG : tst_Subtest::cleanupTestCase() cleanupTestCase cleanupTestCase (null) PASS : tst_Subtest::cleanupTestCase() Totals: 7 passed, 2 failed, 0 skipped ********* Finished testing of tst_Subtest ********* diff --git a/tests/auto/testlib/selftests/expected_subtest.xml b/tests/auto/testlib/selftests/expected_subtest.xml index 094e22383d..b0a5c8a810 100644 --- a/tests/auto/testlib/selftests/expected_subtest.xml +++ b/tests/auto/testlib/selftests/expected_subtest.xml @@ -6,82 +6,82 @@ </Environment> <TestFunction name="initTestCase"> <Message type="qdebug" file="" line="0"> - <Description><![CDATA[initTestCase initTestCase (null) ]]></Description> + <Description><![CDATA[initTestCase initTestCase (null)]]></Description> </Message> <Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="test1"> <Message type="qdebug" file="" line="0"> - <Description><![CDATA[init test1 (null) ]]></Description> + <Description><![CDATA[init test1 (null)]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <Description><![CDATA[test1 test1 (null) ]]></Description> + <Description><![CDATA[test1 test1 (null)]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <Description><![CDATA[cleanup test1 (null) ]]></Description> + <Description><![CDATA[cleanup test1 (null)]]></Description> </Message> <Incident type="pass" file="" line="0" /> </TestFunction> <TestFunction name="test2"> <Message type="qdebug" file="" line="0"> - <Description><![CDATA[test2_data test2 (null) ]]></Description> + <Description><![CDATA[test2_data test2 (null)]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <Description><![CDATA[test2_data end ]]></Description> + <Description><![CDATA[test2_data end]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data0]]></DataTag> - <Description><![CDATA[init test2 data0 ]]></Description> + <Description><![CDATA[init test2 data0]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data0]]></DataTag> - <Description><![CDATA[test2 test2 data0 ]]></Description> + <Description><![CDATA[test2 test2 data0]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data0]]></DataTag> - <Description><![CDATA[test2 end ]]></Description> + <Description><![CDATA[test2 end]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data0]]></DataTag> - <Description><![CDATA[cleanup test2 data0 ]]></Description> + <Description><![CDATA[cleanup test2 data0]]></Description> </Message> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[data0]]></DataTag> </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data1]]></DataTag> - <Description><![CDATA[init test2 data1 ]]></Description> + <Description><![CDATA[init test2 data1]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data1]]></DataTag> - <Description><![CDATA[test2 test2 data1 ]]></Description> + <Description><![CDATA[test2 test2 data1]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data1]]></DataTag> - <Description><![CDATA[test2 end ]]></Description> + <Description><![CDATA[test2 end]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data1]]></DataTag> - <Description><![CDATA[cleanup test2 data1 ]]></Description> + <Description><![CDATA[cleanup test2 data1]]></Description> </Message> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[data1]]></DataTag> </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data2]]></DataTag> - <Description><![CDATA[init test2 data2 ]]></Description> + <Description><![CDATA[init test2 data2]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data2]]></DataTag> - <Description><![CDATA[test2 test2 data2 ]]></Description> + <Description><![CDATA[test2 test2 data2]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data2]]></DataTag> - <Description><![CDATA[test2 end ]]></Description> + <Description><![CDATA[test2 end]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data2]]></DataTag> - <Description><![CDATA[cleanup test2 data2 ]]></Description> + <Description><![CDATA[cleanup test2 data2]]></Description> </Message> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[data2]]></DataTag> @@ -89,37 +89,37 @@ </TestFunction> <TestFunction name="test3"> <Message type="qdebug" file="" line="0"> - <Description><![CDATA[test3_data test3 (null) ]]></Description> + <Description><![CDATA[test3_data test3 (null)]]></Description> </Message> <Message type="qdebug" file="" line="0"> - <Description><![CDATA[test3_data end ]]></Description> + <Description><![CDATA[test3_data end]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data0]]></DataTag> - <Description><![CDATA[init test3 data0 ]]></Description> + <Description><![CDATA[init test3 data0]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data0]]></DataTag> - <Description><![CDATA[test2 test3 data0 ]]></Description> + <Description><![CDATA[test2 test3 data0]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data0]]></DataTag> - <Description><![CDATA[test2 end ]]></Description> + <Description><![CDATA[test2 end]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data0]]></DataTag> - <Description><![CDATA[cleanup test3 data0 ]]></Description> + <Description><![CDATA[cleanup test3 data0]]></Description> </Message> <Incident type="pass" file="" line="0"> <DataTag><![CDATA[data0]]></DataTag> </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data1]]></DataTag> - <Description><![CDATA[init test3 data1 ]]></Description> + <Description><![CDATA[init test3 data1]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data1]]></DataTag> - <Description><![CDATA[test2 test3 data1 ]]></Description> + <Description><![CDATA[test2 test3 data1]]></Description> </Message> <Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/subtest/tst_subtest.cpp" line="154"> <DataTag><![CDATA[data1]]></DataTag> @@ -129,15 +129,15 @@ </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data1]]></DataTag> - <Description><![CDATA[cleanup test3 data1 ]]></Description> + <Description><![CDATA[cleanup test3 data1]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data2]]></DataTag> - <Description><![CDATA[init test3 data2 ]]></Description> + <Description><![CDATA[init test3 data2]]></Description> </Message> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data2]]></DataTag> - <Description><![CDATA[test2 test3 data2 ]]></Description> + <Description><![CDATA[test2 test3 data2]]></Description> </Message> <Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/subtest/tst_subtest.cpp" line="154"> <DataTag><![CDATA[data2]]></DataTag> @@ -147,12 +147,12 @@ </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[data2]]></DataTag> - <Description><![CDATA[cleanup test3 data2 ]]></Description> + <Description><![CDATA[cleanup test3 data2]]></Description> </Message> </TestFunction> <TestFunction name="cleanupTestCase"> <Message type="qdebug" file="" line="0"> - <Description><![CDATA[cleanupTestCase cleanupTestCase (null) ]]></Description> + <Description><![CDATA[cleanupTestCase cleanupTestCase (null)]]></Description> </Message> <Incident type="pass" file="" line="0" /> </TestFunction> diff --git a/tests/auto/testlib/selftests/expected_subtest.xunitxml b/tests/auto/testlib/selftests/expected_subtest.xunitxml index 6f8fc3db45..5f7024e8ba 100644 --- a/tests/auto/testlib/selftests/expected_subtest.xunitxml +++ b/tests/auto/testlib/selftests/expected_subtest.xunitxml @@ -5,83 +5,83 @@ <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> </properties> <testcase result="pass" name="initTestCase"> - <!-- message="initTestCase initTestCase (null) " type="qdebug" --> + <!-- message="initTestCase initTestCase (null)" type="qdebug" --> </testcase> <testcase result="pass" name="test1"> - <!-- message="init test1 (null) " type="qdebug" --> - <!-- message="test1 test1 (null) " type="qdebug" --> - <!-- message="cleanup test1 (null) " type="qdebug" --> + <!-- message="init test1 (null)" type="qdebug" --> + <!-- message="test1 test1 (null)" type="qdebug" --> + <!-- message="cleanup test1 (null)" type="qdebug" --> </testcase> <testcase result="pass" name="test2"> - <!-- message="test2_data test2 (null) " type="qdebug" --> - <!-- message="test2_data end " type="qdebug" --> - <!-- tag="data0" message="init test2 data0 " type="qdebug" --> - <!-- tag="data0" message="test2 test2 data0 " type="qdebug" --> - <!-- tag="data0" message="test2 end " type="qdebug" --> - <!-- tag="data0" message="cleanup test2 data0 " type="qdebug" --> - <!-- tag="data1" message="init test2 data1 " type="qdebug" --> - <!-- tag="data1" message="test2 test2 data1 " type="qdebug" --> - <!-- tag="data1" message="test2 end " type="qdebug" --> - <!-- tag="data1" message="cleanup test2 data1 " type="qdebug" --> - <!-- tag="data2" message="init test2 data2 " type="qdebug" --> - <!-- tag="data2" message="test2 test2 data2 " type="qdebug" --> - <!-- tag="data2" message="test2 end " type="qdebug" --> - <!-- tag="data2" message="cleanup test2 data2 " type="qdebug" --> + <!-- message="test2_data test2 (null)" type="qdebug" --> + <!-- message="test2_data end" type="qdebug" --> + <!-- tag="data0" message="init test2 data0" type="qdebug" --> + <!-- tag="data0" message="test2 test2 data0" type="qdebug" --> + <!-- tag="data0" message="test2 end" type="qdebug" --> + <!-- tag="data0" message="cleanup test2 data0" type="qdebug" --> + <!-- tag="data1" message="init test2 data1" type="qdebug" --> + <!-- tag="data1" message="test2 test2 data1" type="qdebug" --> + <!-- tag="data1" message="test2 end" type="qdebug" --> + <!-- tag="data1" message="cleanup test2 data1" type="qdebug" --> + <!-- tag="data2" message="init test2 data2" type="qdebug" --> + <!-- tag="data2" message="test2 test2 data2" type="qdebug" --> + <!-- tag="data2" message="test2 end" type="qdebug" --> + <!-- tag="data2" message="cleanup test2 data2" type="qdebug" --> </testcase> <testcase result="fail" name="test3"> - <!-- message="test3_data test3 (null) " type="qdebug" --> - <!-- message="test3_data end " type="qdebug" --> - <!-- tag="data0" message="init test3 data0 " type="qdebug" --> - <!-- tag="data0" message="test2 test3 data0 " type="qdebug" --> - <!-- tag="data0" message="test2 end " type="qdebug" --> - <!-- tag="data0" message="cleanup test3 data0 " type="qdebug" --> - <!-- tag="data1" message="init test3 data1 " type="qdebug" --> - <!-- tag="data1" message="test2 test3 data1 " type="qdebug" --> + <!-- message="test3_data test3 (null)" type="qdebug" --> + <!-- message="test3_data end" type="qdebug" --> + <!-- tag="data0" message="init test3 data0" type="qdebug" --> + <!-- tag="data0" message="test2 test3 data0" type="qdebug" --> + <!-- tag="data0" message="test2 end" type="qdebug" --> + <!-- tag="data0" message="cleanup test3 data0" type="qdebug" --> + <!-- tag="data1" message="init test3 data1" type="qdebug" --> + <!-- tag="data1" message="test2 test3 data1" type="qdebug" --> <failure tag="data1" message="Compared values are not the same Actual (str) : hello1 Expected (QString("hello0")): hello0" result="fail"/> - <!-- tag="data1" message="cleanup test3 data1 " type="qdebug" --> - <!-- tag="data2" message="init test3 data2 " type="qdebug" --> - <!-- tag="data2" message="test2 test3 data2 " type="qdebug" --> + <!-- tag="data1" message="cleanup test3 data1" type="qdebug" --> + <!-- tag="data2" message="init test3 data2" type="qdebug" --> + <!-- tag="data2" message="test2 test3 data2" type="qdebug" --> <failure tag="data2" message="Compared values are not the same Actual (str) : hello2 Expected (QString("hello0")): hello0" result="fail"/> - <!-- tag="data2" message="cleanup test3 data2 " type="qdebug" --> + <!-- tag="data2" message="cleanup test3 data2" type="qdebug" --> </testcase> <testcase result="pass" name="cleanupTestCase"> - <!-- message="cleanupTestCase cleanupTestCase (null) " type="qdebug" --> + <!-- message="cleanupTestCase cleanupTestCase (null)" type="qdebug" --> </testcase> <system-err> -<![CDATA[initTestCase initTestCase (null) ]]> -<![CDATA[init test1 (null) ]]> -<![CDATA[test1 test1 (null) ]]> -<![CDATA[cleanup test1 (null) ]]> -<![CDATA[test2_data test2 (null) ]]> -<![CDATA[test2_data end ]]> -<![CDATA[init test2 data0 ]]> -<![CDATA[test2 test2 data0 ]]> -<![CDATA[test2 end ]]> -<![CDATA[cleanup test2 data0 ]]> -<![CDATA[init test2 data1 ]]> -<![CDATA[test2 test2 data1 ]]> -<![CDATA[test2 end ]]> -<![CDATA[cleanup test2 data1 ]]> -<![CDATA[init test2 data2 ]]> -<![CDATA[test2 test2 data2 ]]> -<![CDATA[test2 end ]]> -<![CDATA[cleanup test2 data2 ]]> -<![CDATA[test3_data test3 (null) ]]> -<![CDATA[test3_data end ]]> -<![CDATA[init test3 data0 ]]> -<![CDATA[test2 test3 data0 ]]> -<![CDATA[test2 end ]]> -<![CDATA[cleanup test3 data0 ]]> -<![CDATA[init test3 data1 ]]> -<![CDATA[test2 test3 data1 ]]> -<![CDATA[cleanup test3 data1 ]]> -<![CDATA[init test3 data2 ]]> -<![CDATA[test2 test3 data2 ]]> -<![CDATA[cleanup test3 data2 ]]> -<![CDATA[cleanupTestCase cleanupTestCase (null) ]]> +<![CDATA[initTestCase initTestCase (null)]]> +<![CDATA[init test1 (null)]]> +<![CDATA[test1 test1 (null)]]> +<![CDATA[cleanup test1 (null)]]> +<![CDATA[test2_data test2 (null)]]> +<![CDATA[test2_data end]]> +<![CDATA[init test2 data0]]> +<![CDATA[test2 test2 data0]]> +<![CDATA[test2 end]]> +<![CDATA[cleanup test2 data0]]> +<![CDATA[init test2 data1]]> +<![CDATA[test2 test2 data1]]> +<![CDATA[test2 end]]> +<![CDATA[cleanup test2 data1]]> +<![CDATA[init test2 data2]]> +<![CDATA[test2 test2 data2]]> +<![CDATA[test2 end]]> +<![CDATA[cleanup test2 data2]]> +<![CDATA[test3_data test3 (null)]]> +<![CDATA[test3_data end]]> +<![CDATA[init test3 data0]]> +<![CDATA[test2 test3 data0]]> +<![CDATA[test2 end]]> +<![CDATA[cleanup test3 data0]]> +<![CDATA[init test3 data1]]> +<![CDATA[test2 test3 data1]]> +<![CDATA[cleanup test3 data1]]> +<![CDATA[init test3 data2]]> +<![CDATA[test2 test3 data2]]> +<![CDATA[cleanup test3 data2]]> +<![CDATA[cleanupTestCase cleanupTestCase (null)]]> </system-err> </testsuite> diff --git a/tests/auto/testlib/selftests/expected_verbose1.lightxml b/tests/auto/testlib/selftests/expected_verbose1.lightxml index c49792fec4..799a7d7b17 100644 --- a/tests/auto/testlib/selftests/expected_verbose1.lightxml +++ b/tests/auto/testlib/selftests/expected_verbose1.lightxml @@ -107,7 +107,7 @@ </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[fail]]></DataTag> - <Description><![CDATA[This test function should execute and then QFAIL in cleanup() ]]></Description> + <Description><![CDATA[This test function should execute and then QFAIL in cleanup()]]></Description> </Message> <Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="242"> <DataTag><![CDATA[fail]]></DataTag> @@ -135,7 +135,7 @@ </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[skip]]></DataTag> - <Description><![CDATA[This test function should execute and then QSKIP in cleanup() ]]></Description> + <Description><![CDATA[This test function should execute and then QSKIP in cleanup()]]></Description> </Message> <Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="244"> <DataTag><![CDATA[skip]]></DataTag> diff --git a/tests/auto/testlib/selftests/expected_verbose1.txt b/tests/auto/testlib/selftests/expected_verbose1.txt index 4ba42c1c8e..23962a0ff6 100644 --- a/tests/auto/testlib/selftests/expected_verbose1.txt +++ b/tests/auto/testlib/selftests/expected_verbose1.txt @@ -48,7 +48,7 @@ FAIL! : tst_Counting::testFailInInit(fail) Fail in init() PASS : tst_Counting::testFailInInit(after) INFO : tst_Counting::testFailInCleanup() entering PASS : tst_Counting::testFailInCleanup(before) -QDEBUG : tst_Counting::testFailInCleanup(fail) This test function should execute and then QFAIL in cleanup() +QDEBUG : tst_Counting::testFailInCleanup(fail) This test function should execute and then QFAIL in cleanup() FAIL! : tst_Counting::testFailInCleanup(fail) Fail in cleanup() Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(242)] PASS : tst_Counting::testFailInCleanup(after) @@ -59,7 +59,7 @@ SKIP : tst_Counting::testSkipInInit(skip) Skip in init() PASS : tst_Counting::testSkipInInit(after) INFO : tst_Counting::testSkipInCleanup() entering PASS : tst_Counting::testSkipInCleanup(before) -QDEBUG : tst_Counting::testSkipInCleanup(skip) This test function should execute and then QSKIP in cleanup() +QDEBUG : tst_Counting::testSkipInCleanup(skip) This test function should execute and then QSKIP in cleanup() SKIP : tst_Counting::testSkipInCleanup(skip) Skip in cleanup() Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(244)] PASS : tst_Counting::testSkipInCleanup(after) diff --git a/tests/auto/testlib/selftests/expected_verbose1.xml b/tests/auto/testlib/selftests/expected_verbose1.xml index 7caa915f65..8177a2dc7f 100644 --- a/tests/auto/testlib/selftests/expected_verbose1.xml +++ b/tests/auto/testlib/selftests/expected_verbose1.xml @@ -109,7 +109,7 @@ </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[fail]]></DataTag> - <Description><![CDATA[This test function should execute and then QFAIL in cleanup() ]]></Description> + <Description><![CDATA[This test function should execute and then QFAIL in cleanup()]]></Description> </Message> <Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="242"> <DataTag><![CDATA[fail]]></DataTag> @@ -137,7 +137,7 @@ </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[skip]]></DataTag> - <Description><![CDATA[This test function should execute and then QSKIP in cleanup() ]]></Description> + <Description><![CDATA[This test function should execute and then QSKIP in cleanup()]]></Description> </Message> <Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="244"> <DataTag><![CDATA[skip]]></DataTag> diff --git a/tests/auto/testlib/selftests/expected_verbose1.xunitxml b/tests/auto/testlib/selftests/expected_verbose1.xunitxml index f317ed5923..72bf047ba8 100644 --- a/tests/auto/testlib/selftests/expected_verbose1.xunitxml +++ b/tests/auto/testlib/selftests/expected_verbose1.xunitxml @@ -38,14 +38,14 @@ <failure tag="fail" message="Fail in init()" result="fail"/> </testcase> <testcase result="fail" name="testFailInCleanup"> - <!-- tag="fail" message="This test function should execute and then QFAIL in cleanup() " type="qdebug" --> + <!-- tag="fail" message="This test function should execute and then QFAIL in cleanup()" type="qdebug" --> <failure tag="fail" message="Fail in cleanup()" result="fail"/> </testcase> <testcase result="pass" name="testSkipInInit"> <!-- tag="skip" message="Skip in init()" type="skip" --> </testcase> <testcase result="pass" name="testSkipInCleanup"> - <!-- tag="skip" message="This test function should execute and then QSKIP in cleanup() " type="qdebug" --> + <!-- tag="skip" message="This test function should execute and then QSKIP in cleanup()" type="qdebug" --> <!-- tag="skip" message="Skip in cleanup()" type="skip" --> </testcase> <testcase result="pass" name="cleanupTestCase"/> @@ -56,9 +56,9 @@ <![CDATA[Skipping]]> <![CDATA[Skipping]]> <![CDATA[Skipping]]> -<![CDATA[This test function should execute and then QFAIL in cleanup() ]]> +<![CDATA[This test function should execute and then QFAIL in cleanup()]]> <![CDATA[Skip in init()]]> -<![CDATA[This test function should execute and then QSKIP in cleanup() ]]> +<![CDATA[This test function should execute and then QSKIP in cleanup()]]> <![CDATA[Skip in cleanup()]]> </system-err> </testsuite> diff --git a/tests/auto/testlib/selftests/expected_verbose2.lightxml b/tests/auto/testlib/selftests/expected_verbose2.lightxml index 2937adbe01..4e5f9952b8 100644 --- a/tests/auto/testlib/selftests/expected_verbose2.lightxml +++ b/tests/auto/testlib/selftests/expected_verbose2.lightxml @@ -179,7 +179,7 @@ </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[fail]]></DataTag> - <Description><![CDATA[This test function should execute and then QFAIL in cleanup() ]]></Description> + <Description><![CDATA[This test function should execute and then QFAIL in cleanup()]]></Description> </Message> <Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="242"> <DataTag><![CDATA[fail]]></DataTag> @@ -207,7 +207,7 @@ </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[skip]]></DataTag> - <Description><![CDATA[This test function should execute and then QSKIP in cleanup() ]]></Description> + <Description><![CDATA[This test function should execute and then QSKIP in cleanup()]]></Description> </Message> <Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="244"> <DataTag><![CDATA[skip]]></DataTag> diff --git a/tests/auto/testlib/selftests/expected_verbose2.txt b/tests/auto/testlib/selftests/expected_verbose2.txt index e9c7838f6d..d8c6e4a218 100644 --- a/tests/auto/testlib/selftests/expected_verbose2.txt +++ b/tests/auto/testlib/selftests/expected_verbose2.txt @@ -84,7 +84,7 @@ FAIL! : tst_Counting::testFailInInit(fail) Fail in init() PASS : tst_Counting::testFailInInit(after) INFO : tst_Counting::testFailInCleanup() entering PASS : tst_Counting::testFailInCleanup(before) -QDEBUG : tst_Counting::testFailInCleanup(fail) This test function should execute and then QFAIL in cleanup() +QDEBUG : tst_Counting::testFailInCleanup(fail) This test function should execute and then QFAIL in cleanup() FAIL! : tst_Counting::testFailInCleanup(fail) Fail in cleanup() Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(242)] PASS : tst_Counting::testFailInCleanup(after) @@ -95,7 +95,7 @@ SKIP : tst_Counting::testSkipInInit(skip) Skip in init() PASS : tst_Counting::testSkipInInit(after) INFO : tst_Counting::testSkipInCleanup() entering PASS : tst_Counting::testSkipInCleanup(before) -QDEBUG : tst_Counting::testSkipInCleanup(skip) This test function should execute and then QSKIP in cleanup() +QDEBUG : tst_Counting::testSkipInCleanup(skip) This test function should execute and then QSKIP in cleanup() SKIP : tst_Counting::testSkipInCleanup(skip) Skip in cleanup() Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(244)] PASS : tst_Counting::testSkipInCleanup(after) diff --git a/tests/auto/testlib/selftests/expected_verbose2.xml b/tests/auto/testlib/selftests/expected_verbose2.xml index bbdca567d3..bf5e7c7570 100644 --- a/tests/auto/testlib/selftests/expected_verbose2.xml +++ b/tests/auto/testlib/selftests/expected_verbose2.xml @@ -181,7 +181,7 @@ </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[fail]]></DataTag> - <Description><![CDATA[This test function should execute and then QFAIL in cleanup() ]]></Description> + <Description><![CDATA[This test function should execute and then QFAIL in cleanup()]]></Description> </Message> <Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="242"> <DataTag><![CDATA[fail]]></DataTag> @@ -209,7 +209,7 @@ </Incident> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[skip]]></DataTag> - <Description><![CDATA[This test function should execute and then QSKIP in cleanup() ]]></Description> + <Description><![CDATA[This test function should execute and then QSKIP in cleanup()]]></Description> </Message> <Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="244"> <DataTag><![CDATA[skip]]></DataTag> diff --git a/tests/auto/testlib/selftests/expected_verbose2.xunitxml b/tests/auto/testlib/selftests/expected_verbose2.xunitxml index a774cb9d9f..6dabbd34fc 100644 --- a/tests/auto/testlib/selftests/expected_verbose2.xunitxml +++ b/tests/auto/testlib/selftests/expected_verbose2.xunitxml @@ -57,14 +57,14 @@ <failure tag="fail" message="Fail in init()" result="fail"/> </testcase> <testcase result="fail" name="testFailInCleanup"> - <!-- tag="fail" message="This test function should execute and then QFAIL in cleanup() " type="qdebug" --> + <!-- tag="fail" message="This test function should execute and then QFAIL in cleanup()" type="qdebug" --> <failure tag="fail" message="Fail in cleanup()" result="fail"/> </testcase> <testcase result="pass" name="testSkipInInit"> <!-- tag="skip" message="Skip in init()" type="skip" --> </testcase> <testcase result="pass" name="testSkipInCleanup"> - <!-- tag="skip" message="This test function should execute and then QSKIP in cleanup() " type="qdebug" --> + <!-- tag="skip" message="This test function should execute and then QSKIP in cleanup()" type="qdebug" --> <!-- tag="skip" message="Skip in cleanup()" type="skip" --> </testcase> <testcase result="pass" name="cleanupTestCase"/> @@ -93,9 +93,9 @@ <![CDATA[Skipping]]> <![CDATA[QVERIFY(false)]]> <![CDATA[QVERIFY(false)]]> -<![CDATA[This test function should execute and then QFAIL in cleanup() ]]> +<![CDATA[This test function should execute and then QFAIL in cleanup()]]> <![CDATA[Skip in init()]]> -<![CDATA[This test function should execute and then QSKIP in cleanup() ]]> +<![CDATA[This test function should execute and then QSKIP in cleanup()]]> <![CDATA[Skip in cleanup()]]> </system-err> </testsuite> diff --git a/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp index 19e8819a7b..8f7a3a3255 100644 --- a/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp @@ -971,7 +971,6 @@ void tst_QGraphicsLinearLayout::defaultSpacing() layout->invalidate(); styleSpacing = (qreal)style->pixelMetric(QStyle::PM_LayoutHorizontalSpacing); QCOMPARE(styleSpacing, qreal(15)); - QSKIP("invalidating the layout does not reevaluate the default spacing (QTBUG-35099)"); QCOMPARE(styleSpacing, layout->spacing()); QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize).width(), qreal(115)); widget->setStyle(style2); @@ -991,7 +990,6 @@ void tst_QGraphicsLinearLayout::defaultSpacing() layout->invalidate(); styleSpacing = (qreal)style->pixelMetric(QStyle::PM_LayoutVerticalSpacing); QCOMPARE(styleSpacing, qreal(13)); - QSKIP("invalidating the layout does not reevaluate the default spacing (QTBUG-35099)"); QCOMPARE(styleSpacing, layout->spacing()); QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize).height(), qreal(113)); widget->setStyle(style2); diff --git a/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp b/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp index 5ed6651052..fb95ecb5b4 100644 --- a/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp +++ b/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp @@ -88,7 +88,9 @@ void tst_QTcpServer::initTestCase_data() QTest::addColumn<int>("proxyType"); QTest::newRow("WithoutProxy") << false << 0; +#ifndef QT_NO_NETWORKPROXY QTest::newRow("WithSocks5Proxy") << true << int(QNetworkProxy::Socks5Proxy); +#endif } void tst_QTcpServer::initTestCase() @@ -100,16 +102,22 @@ void tst_QTcpServer::init() { QFETCH_GLOBAL(bool, setProxy); if (setProxy) { +#ifndef QT_NO_NETWORKPROXY QFETCH_GLOBAL(int, proxyType); if (proxyType == QNetworkProxy::Socks5Proxy) { QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, QtNetworkSettings::serverName(), 1080)); } +#else // !QT_NO_NETWORKPROXY + QSKIP("No proxy support"); +#endif // QT_NO_NETWORKPROXY } } void tst_QTcpServer::cleanup() { +#ifndef QT_NO_NETWORKPROXY QNetworkProxy::setApplicationProxy(QNetworkProxy::DefaultProxy); +#endif } //---------------------------------------------------------------------------------- diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index d237228812..e1295c6370 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -1604,7 +1604,7 @@ void Configure::applySpecSpecifics() dictionary[ "OPENGL" ] = "yes"; dictionary[ "OPENGL_ES_2" ] = "yes"; dictionary[ "OPENVG" ] = "no"; - dictionary[ "OPENSSL" ] = "auto"; + dictionary[ "OPENSSL" ] = "no"; dictionary[ "DBUS" ] = "no"; dictionary[ "ZLIB" ] = "qt"; dictionary[ "PCRE" ] = "qt"; |