Merge "Merge remote-tracking branch 'origin/5.6' into 5.7" into refs/staging/5.7

This commit is contained in:
Timur Pocheptsov 2016-07-05 19:20:05 +00:00 committed by The Qt Project
commit 6c935dc74f
33 changed files with 237 additions and 118 deletions

View File

@ -174,7 +174,7 @@
*/
/*!
\externalpage http://code.google.com/p/angleproject/
\externalpage https://chromium.googlesource.com/angle/angle/+/master/README.md
\title ANGLE
*/

View File

@ -88,7 +88,7 @@ QByteArray ConnectionManager::clientId() const
// Generate peer id
int startupTime = int(QDateTime::currentDateTime().toTime_t());
id += QString::asprintf("-QT%04x-", (QT_VERSION % 0xffff00) >> 8).toLatin1();
id += QString::asprintf("-QT%04x-", QT_VERSION >> 8).toLatin1();
id += QByteArray::number(startupTime, 10);
id += QByteArray(20 - id.size(), '-');
}

View File

@ -40,5 +40,5 @@ QMAKE_LFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG
# Wrapper tools that understand .o/.a files with LLVM bytecode instead of machine code
QMAKE_AR_LTCG = llvm-ar cqs
QMAKE_NM_LTCG = gcc-nm -P
QMAKE_NM_LTCG = llvm-nm -P
QMAKE_RANLIB_LTCG = true # No need to run, since llvm-ar has "s"

View File

@ -22,7 +22,7 @@
</Properties>
<Dependencies>
<TargetDeviceFamily Name=\"Windows.Universal\" MinVersion=\"10.0.10240.0\" MaxVersionTested=\"10.0.10586.0\" />$${WINRT_MANIFEST.dependencies}
<TargetDeviceFamily Name=\"Windows.Universal\" MinVersion=\"10.0.10586.0\" MaxVersionTested=\"10.0.10586.0\" />$${WINRT_MANIFEST.dependencies}
</Dependencies>
<Resources>

View File

@ -17,6 +17,9 @@ QMAKE_LIBDIR_X11 = /usr/X11R7/lib
QMAKE_INCDIR_OPENGL = /usr/X11R7/include
QMAKE_LIBDIR_OPENGL = /usr/X11R7/lib
# NetBSD requires rpath to be used for all lib dirs, see http://www.netbsd.org/docs/elf.html
QMAKE_RPATHDIR += $$QMAKE_LIBDIR $$QMAKE_LIBDIR_X11
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)
load(qt_config)

View File

@ -177,7 +177,6 @@ public:
void setTemplate();
ProStringList split_value_list(const QString &vals, const ProFile *source = 0);
ProStringList expandVariableReferences(const ProString &value, int *pos = 0, bool joined = false);
ProStringList expandVariableReferences(const ushort *&tokPtr, int sizeHint = 0, bool joined = false);
QString currentFileName() const;

View File

@ -1,6 +1,6 @@
This is the ANGLE project from:
http://code.google.com/p/angleproject/
https://chromium.googlesource.com/angle/angle/+/master/README.md
The upstream version used here can be found in:

View File

@ -692,7 +692,7 @@ QString QDir::filePath(const QString &fileName) const
{
const QDirPrivate* d = d_ptr.constData();
if (isAbsolutePath(fileName))
return QString(fileName);
return fileName;
QString ret = d->dirEntry.filePath();
if (!fileName.isEmpty()) {

View File

@ -92,7 +92,7 @@ static IApplicationDataContainer *subContainer(IApplicationDataContainer *parent
if (FAILED(hr))
return 0;
while (SUCCEEDED(S_OK) && current) {
while (SUCCEEDED(hr) && current) {
ComPtr<ContainerItem> item;
hr = iterator->get_Current(&item);
if (FAILED(hr))

View File

@ -984,10 +984,12 @@ inline bool QUrlPrivate::setScheme(const QString &value, int len, bool doSetErro
needsLowercasing = i;
continue;
}
if (p[i] >= '0' && p[i] <= '9' && i > 0)
continue;
if (p[i] == '+' || p[i] == '-' || p[i] == '.')
continue;
if (i) {
if (p[i] >= '0' && p[i] <= '9')
continue;
if (p[i] == '+' || p[i] == '-' || p[i] == '.')
continue;
}
// found something else
// don't call setError needlessly:

View File

@ -357,16 +357,14 @@ QByteArray QJsonDocument::toJson(JsonFormat format) const
#endif
/*!
Parses a UTF-8 encoded JSON document and creates a QJsonDocument
Parses \a json as a UTF-8 encoded JSON document, and creates a QJsonDocument
from it.
\a json contains the json document to be parsed.
Returns a valid (non-null) QJsonDocument if the parsing succeeds. If it fails,
the returned document will be null, and the optional \a error variable will contain
further details about the error.
The optional \a error variable can be used to pass in a QJsonParseError data
structure that will contain information about possible errors encountered during
parsing.
\sa toJson(), QJsonParseError
\sa toJson(), QJsonParseError, isNull()
*/
QJsonDocument QJsonDocument::fromJson(const QByteArray &json, QJsonParseError *error)
{

View File

@ -79,6 +79,10 @@
#include <errno.h>
#include <fcntl.h>
#if !defined(QT_POSIX_IPC) && !defined(QT_NO_SHAREDMEMORY) && !defined(Q_OS_ANDROID)
# include <sys/ipc.h>
#endif
#if defined(Q_OS_VXWORKS)
# include <ioLib.h>
#endif

View File

@ -188,8 +188,10 @@ int QEventLoop::exec(ProcessEventsFlags flags)
{
if (exceptionCaught) {
qWarning("Qt has caught an exception thrown from an event handler. Throwing\n"
"exceptions from an event handler is not supported in Qt. You must\n"
"reimplement QApplication::notify() and catch all exceptions there.\n");
"exceptions from an event handler is not supported in Qt.\n"
"You must not let any exception whatsoever propagate through Qt code.\n"
"If that is not possible, in Qt 5 you must at least reimplement\n"
"QCoreApplication::notify() and catch all exceptions there.\n");
}
locker.relock();
QEventLoop *eventLoop = d->threadData->eventLoops.pop();

View File

@ -2721,7 +2721,7 @@ qint64 QDateTimePrivate::toMSecsSinceEpoch() const
case Qt::TimeZone:
#ifdef QT_BOOTSTRAPPED
break;
return 0;
#else
return zoneMSecsToEpochMSecs(m_msecs, m_timeZone);
#endif
@ -4782,7 +4782,12 @@ QDataStream &operator>>(QDataStream &in, QDate &date)
QDataStream &operator<<(QDataStream &out, const QTime &time)
{
return out << quint32(time.mds);
if (out.version() >= QDataStream::Qt_4_0) {
return out << quint32(time.mds);
} else {
// Qt3 had no support for reading -1, QTime() was valid and serialized as 0
return out << quint32(time.isNull() ? 0 : time.mds);
}
}
/*!
@ -4797,7 +4802,12 @@ QDataStream &operator>>(QDataStream &in, QTime &time)
{
quint32 ds;
in >> ds;
time.mds = int(ds);
if (in.version() >= QDataStream::Qt_4_0) {
time.mds = int(ds);
} else {
// Qt3 would write 0 for a null time
time.mds = (ds == 0) ? QTime::NullTime : int(ds);
}
return in;
}

View File

@ -902,10 +902,7 @@ qint64 QNativeSocketEnginePrivate::nativeReceiveDatagram(char *data, qint64 maxS
if (cmsgptr->cmsg_level == IPPROTO_IP && cmsgptr->cmsg_type == IP_RECVIF
&& cmsgptr->cmsg_len >= CMSG_LEN(sizeof(sockaddr_dl))) {
sockaddr_dl *sdl = reinterpret_cast<sockaddr_dl *>(CMSG_DATA(cmsgptr));
# if defined(Q_OS_OPENBSD)
# define LLINDEX(s) ((s)->sdl_index)
# endif
header->ifindex = LLINDEX(sdl);
header->ifindex = sdl->sdl_index;
}
# endif
#endif

View File

@ -55,7 +55,8 @@
QSslSocket establishes a secure, encrypted TCP connection you can
use for transmitting encrypted data. It can operate in both client
and server mode, and it supports modern SSL protocols, including
SSLv3 and TLSv1_0. By default, QSslSocket uses TLSv1_0, but you can
SSL 3 and TLS 1.2. By default, QSslSocket uses only SSL protocols
which are considered to be secure (QSsl::SecureProtocols), but you can
change the SSL protocol by calling setProtocol() as long as you do
it before the handshake has started.

View File

@ -617,7 +617,7 @@ void QSslSocketBackendPrivate::transmit()
if (connectionEncrypted && !writeBuffer.isEmpty()) {
qint64 totalBytesWritten = 0;
while (writeBuffer.nextDataBlockSize() > 0) {
while (writeBuffer.nextDataBlockSize() > 0 && context) {
const size_t nextDataBlockSize = writeBuffer.nextDataBlockSize();
size_t writtenBytes = 0;
const OSStatus err = SSLWrite(context, writeBuffer.readPointer(), nextDataBlockSize, &writtenBytes);
@ -652,7 +652,7 @@ void QSslSocketBackendPrivate::transmit()
if (connectionEncrypted) {
QVarLengthArray<char, 4096> data;
while (true) {
while (context) {
size_t readBytes = 0;
data.resize(4096);
const OSStatus err = SSLRead(context, data.data(), data.size(), &readBytes);
@ -1296,7 +1296,10 @@ bool QSslSocketBackendPrivate::verifyPeerTrust()
// report errors
if (!errors.isEmpty() && !canIgnoreVerify) {
sslErrors = errors;
if (!checkSslErrors())
// checkSslErrors unconditionally emits sslErrors:
// a user's slot can abort/close/disconnect on this
// signal, so we also test the socket's state:
if (!checkSslErrors() || q->state() != QAbstractSocket::ConnectedState)
return false;
} else {
sslErrors.clear();

View File

@ -415,7 +415,9 @@ void QWindowsContext::setProcessDpiAwareness(QtWindows::ProcessDpiAwareness dpiA
qCDebug(lcQpaWindows) << __FUNCTION__ << dpiAwareness;
if (QWindowsContext::shcoredll.isValid()) {
const HRESULT hr = QWindowsContext::shcoredll.setProcessDpiAwareness(dpiAwareness);
if (FAILED(hr)) {
// E_ACCESSDENIED means set externally (MSVC manifest or external app loading Qt plugin).
// Silence warning in that case unless debug is enabled.
if (FAILED(hr) && (hr != E_ACCESSDENIED || lcQpaWindows().isDebugEnabled())) {
qWarning().noquote().nospace() << "SetProcessDpiAwareness("
<< dpiAwareness << ") failed: " << QWindowsContext::comErrorString(hr)
<< ", using " << QWindowsContext::processDpiAwareness();
@ -849,6 +851,9 @@ QByteArray QWindowsContext::comErrorString(HRESULT hr)
case E_UNEXPECTED:
result += QByteArrayLiteral("E_UNEXPECTED");
break;
case E_ACCESSDENIED:
result += QByteArrayLiteral("E_ACCESSDENIED");
break;
case CO_E_ALREADYINITIALIZED:
result += QByteArrayLiteral("CO_E_ALREADYINITIALIZED");
break;

View File

@ -371,7 +371,7 @@ QSurfaceFormat QWindowsEGLStaticContext::formatFromConfig(EGLDisplay display, EG
\list
\o Install the Direct X SDK
\o Checkout and build ANGLE (SVN repository) as explained here:
\l{http://code.google.com/p/angleproject/wiki/DevSetup}{ANGLE-Project}.
\l{https://chromium.googlesource.com/angle/angle/+/master/README.md}
When building for 64bit, de-activate the "WarnAsError" option
in every project file (as otherwise integer conversion
warnings will break the build).

View File

@ -504,8 +504,8 @@ static HRESULT qt_drop(IInspectable *sender, ABI::Windows::UI::Xaml::IDragEventA
class QtDragEventHandler##name : public IDragEventHandler \
{ \
public: \
virtual HRESULT STDMETHODCALLTYPE Invoke(IInspectable *sender, \
ABI::Windows::UI::Xaml::IDragEventArgs *e) \
STDMETHODIMP Invoke(IInspectable *sender, \
ABI::Windows::UI::Xaml::IDragEventArgs *e) \
{ \
return qt_##func(sender, e);\
} \

View File

@ -979,10 +979,21 @@ QList<int> QXcbKeyboard::possibleKeys(const QKeyEvent *event) const
xkb_layout_index_t lockedLayout = xkb_state_serialize_layout(xkb_state, XKB_STATE_LAYOUT_LOCKED);
xkb_mod_mask_t latchedMods = xkb_state_serialize_mods(xkb_state, XKB_STATE_MODS_LATCHED);
xkb_mod_mask_t lockedMods = xkb_state_serialize_mods(xkb_state, XKB_STATE_MODS_LOCKED);
xkb_mod_mask_t depressedMods = xkb_state_serialize_mods(xkb_state, XKB_STATE_MODS_DEPRESSED);
xkb_state_update_mask(kb_state, 0, latchedMods, lockedMods, 0, 0, lockedLayout);
xkb_state_update_mask(kb_state, depressedMods, latchedMods, lockedMods, 0, 0, lockedLayout);
quint32 keycode = event->nativeScanCode();
// handle shortcuts for level three and above
xkb_layout_index_t layoutIndex = xkb_state_key_get_layout(kb_state, keycode);
xkb_level_index_t levelIndex = 0;
if (layoutIndex != XKB_LAYOUT_INVALID) {
levelIndex = xkb_state_key_get_level(kb_state, keycode, layoutIndex);
if (levelIndex == XKB_LEVEL_INVALID)
levelIndex = 0;
}
if (levelIndex <= 1)
xkb_state_update_mask(kb_state, 0, latchedMods, lockedMods, 0, 0, lockedLayout);
xkb_keysym_t sym = xkb_state_key_get_one_sym(kb_state, keycode);
if (sym == XKB_KEY_NoSymbol) {
xkb_state_unref(kb_state);

View File

@ -131,6 +131,11 @@ bool QXcbMime::mimeDataForAtom(QXcbConnection *connection, xcb_atom_t a, QMimeDa
ret = true;
} else if ((a == XCB_ATOM_PIXMAP || a == XCB_ATOM_BITMAP) && mimeData->hasImage()) {
ret = true;
} else if (atomName == QLatin1String("text/plain")
&& mimeData->hasFormat(QLatin1String("text/uri-list"))) {
// Return URLs also as plain text.
*data = QInternalMimeData::renderDataHelper(atomName, mimeData);
ret = true;
}
return ret;
}
@ -149,8 +154,10 @@ QVector<xcb_atom_t> QXcbMime::mimeAtomsForFormat(QXcbConnection *connection, con
}
// special cases for uris
if (format == QLatin1String("text/uri-list"))
if (format == QLatin1String("text/uri-list")) {
atoms.append(connection->internAtom("text/x-moz-url"));
atoms.append(connection->internAtom("text/plain"));
}
//special cases for images
if (format == QLatin1String("image/ppm"))

View File

@ -394,6 +394,9 @@ int QWin32PrintEngine::metric(QPaintDevice::PaintDeviceMetric m) const
case QPaintDevice::PdmDevicePixelRatio:
val = 1;
break;
case QPaintDevice::PdmDevicePixelRatioScaled:
val = 1 * QPaintDevice::devicePixelRatioFScale();
break;
default:
qWarning("QPrinter::metric: Invalid metric command");
return 0;

View File

@ -87,7 +87,7 @@ QT_BEGIN_NAMESPACE
about the underlying files and directories related to items in the model.
Directories can be created and removed using mkdir(), rmdir().
\note QFileSystemModel requires an instance of a GUI application.
\note QFileSystemModel requires an instance of \l QApplication.
\section1 Example Usage

View File

@ -212,7 +212,7 @@ void QDirModelPrivate::invalidate()
Directories can be created and removed using mkdir(), rmdir(), and the
model will be automatically updated to take the changes into account.
\note QDirModel requires an instance of a GUI application.
\note QDirModel requires an instance of \l QApplication.
\sa nameFilters(), setFilter(), filter(), QListView, QTreeView, QFileSystemModel,
{Dir View Example}, {Model Classes}

View File

@ -5237,6 +5237,13 @@ static QPixmap cachedPixmapFromXPM(const char * const *xpm)
return result;
}
#ifndef QT_NO_IMAGEFORMAT_PNG
static inline QString clearText16IconPath()
{
return QStringLiteral(":/qt-project.org/styles/commonstyle/images/cleartext-16.png");
}
#endif // !QT_NO_IMAGEFORMAT_PNG
static QIcon clearTextIcon(bool rtl)
{
const QString directionalThemeName = rtl
@ -5249,7 +5256,7 @@ static QIcon clearTextIcon(bool rtl)
QIcon icon;
#ifndef QT_NO_IMAGEFORMAT_PNG
QPixmap clearText16(QStringLiteral(":/qt-project.org/styles/commonstyle/images/cleartext-16.png"));
QPixmap clearText16(clearText16IconPath());
Q_ASSERT(!clearText16.size().isEmpty());
icon.addPixmap(clearText16);
QPixmap clearText32(QStringLiteral(":/qt-project.org/styles/commonstyle/images/cleartext-32.png"));
@ -5564,6 +5571,8 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti
return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-volume-16.png"));
case SP_MediaVolumeMuted:
return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-volume-muted-16.png"));
case SP_LineEditClearButton:
return QPixmap(clearText16IconPath());
#endif // QT_NO_IMAGEFORMAT_PNG
default:
break;

View File

@ -811,7 +811,8 @@ void QDockWidgetPrivate::endDrag(bool abort)
} else {
setResizerActive(false);
}
undockedGeometry = q->geometry();
if (q->isFloating()) // Might not be floating when dragging a QDockWidgetGroupWindow
undockedGeometry = q->geometry();
q->activateWindow();
} else {
// The tab was not plugged back in the QMainWindow but the QDockWidget cannot

View File

@ -1717,10 +1717,20 @@ QMenu *QMainWindow::createPopupMenu()
menu = new QMenu(this);
for (int i = 0; i < dockwidgets.size(); ++i) {
QDockWidget *dockWidget = dockwidgets.at(i);
if (dockWidget->parentWidget() == this
&& !d->layout->layoutState.dockAreaLayout.indexOf(dockWidget).isEmpty()) {
menu->addAction(dockwidgets.at(i)->toggleViewAction());
// filter to find out if we own this QDockWidget
if (dockWidget->parentWidget() == this) {
if (d->layout->layoutState.dockAreaLayout.indexOf(dockWidget).isEmpty())
continue;
} else if (QDockWidgetGroupWindow *dwgw =
qobject_cast<QDockWidgetGroupWindow *>(dockWidget->parentWidget())) {
if (dwgw->parentWidget() != this)
continue;
if (dwgw->layoutInfo()->indexOf(dockWidget).isEmpty())
continue;
} else {
continue;
}
menu->addAction(dockwidgets.at(i)->toggleViewAction());
}
menu->addSeparator();
}

View File

@ -2380,13 +2380,10 @@ void QMainWindowLayout::hover(QLayoutItem *widgetItem, const QPoint &mousePos)
QWidget *w = qobject_cast<QWidget*>(c);
if (!w)
continue;
if (w == widget)
continue;
if (!w->isTopLevel() || !w->isVisible() || w->isMinimized())
continue;
if (!qobject_cast<QDockWidget*>(w) && !qobject_cast<QDockWidgetGroupWindow *>(w))
continue;
candidates << w;
if (w != widget && w->isTopLevel() && w->isVisible() && !w->isMinimized())
candidates << w;
if (QDockWidgetGroupWindow *group = qobject_cast<QDockWidgetGroupWindow *>(w)) {
// Sometimes, there are floating QDockWidget that have a QDockWidgetGroupWindow as a parent.
foreach (QObject *c, group->children()) {

View File

@ -1203,10 +1203,11 @@ static QTime qTimeData(int index)
case 57: return QTime(23, 59, 59, 99);
case 58: return QTime(23, 59, 59, 100);
case 59: return QTime(23, 59, 59, 999);
case 60: return QTime();
}
return QTime(0, 0, 0);
}
#define MAX_QTIME_DATA 60
#define MAX_QTIME_DATA 61
void tst_QDataStream::stream_QTime_data()
{
@ -3132,6 +3133,30 @@ void tst_QDataStream::compatibility_Qt3()
QCOMPARE(in_palette.brush(QPalette::Button).style(), Qt::NoBrush);
QCOMPARE(in_palette.color(QPalette::Light), QColor(Qt::green));
}
// QTime() was serialized to (0, 0, 0, 0) in Qt3, not (0xFF, 0xFF, 0xFF, 0xFF)
// This is because in Qt3 a null time was valid, and there was no support for deserializing a value of -1.
{
QByteArray stream;
{
QDataStream out(&stream, QIODevice::WriteOnly);
out.setVersion(QDataStream::Qt_3_3);
out << QTime();
}
QTime in_time;
{
QDataStream in(stream);
in.setVersion(QDataStream::Qt_3_3);
in >> in_time;
}
QVERIFY(in_time.isNull());
quint32 rawValue;
QDataStream in(stream);
in.setVersion(QDataStream::Qt_3_3);
in >> rawValue;
QCOMPARE(rawValue, quint32(0));
}
}
void tst_QDataStream::compatibility_Qt2()

View File

@ -120,7 +120,8 @@ private slots:
void isValid();
void schemeValidator_data();
void schemeValidator();
void invalidSchemeValidator();
void setScheme_data();
void setScheme();
void strictParser_data();
void strictParser();
void tolerantParser();
@ -2077,85 +2078,112 @@ void tst_QUrl::isValid()
void tst_QUrl::schemeValidator_data()
{
QTest::addColumn<QByteArray>("encodedUrl");
QTest::addColumn<QString>("input");
QTest::addColumn<bool>("result");
QTest::addColumn<QString>("toString");
QTest::addColumn<QString>("scheme");
QTest::newRow("empty") << QByteArray() << false << QString();
// scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
// ftp
QTest::newRow("ftp:") << QByteArray("ftp:") << true << QString("ftp:");
QTest::newRow("ftp://ftp.qt-project.org")
<< QByteArray("ftp://ftp.qt-project.org")
<< true << QString("ftp://ftp.qt-project.org");
QTest::newRow("ftp://ftp.qt-project.org/")
<< QByteArray("ftp://ftp.qt-project.org/")
<< true << QString("ftp://ftp.qt-project.org/");
QTest::newRow("ftp:/index.html")
<< QByteArray("ftp:/index.html")
<< false << QString();
QTest::newRow("empty") << QString() << false << QString();
// mailto
QTest::newRow("mailto:") << QByteArray("mailto:") << true << QString("mailto:");
QTest::newRow("mailto://smtp.trolltech.com/ole@bull.name")
<< QByteArray("mailto://smtp.trolltech.com/ole@bull.name") << false << QString();
QTest::newRow("mailto:") << QByteArray("mailto:") << true << QString("mailto:");
QTest::newRow("mailto:ole@bull.name")
<< QByteArray("mailto:ole@bull.name") << true << QString("mailto:ole@bull.name");
// uncontroversial ones
QTest::newRow("ftp") << "ftp://ftp.example.com/" << true << "ftp";
QTest::newRow("http") << "http://www.example.com/" << true << "http";
QTest::newRow("mailto") << "mailto:smith@example.com" << true << "mailto";
QTest::newRow("file-1slash") << "file:/etc/passwd" << true << "file";
QTest::newRow("file-2slashes") << "file://server/etc/passwd" << true << "file";
QTest::newRow("file-3slashes") << "file:///etc/passwd" << true << "file";
// file
QTest::newRow("file:") << QByteArray("file:/etc/passwd") << true << QString("file:///etc/passwd");
QTest::newRow("mailto+subject") << "mailto:smith@example.com?subject=Hello%20World" << true << "mailto";
QTest::newRow("mailto+host") << "mailto://smtp.example.com/smith@example.com" << true << "mailto";
// valid, but unexpected
QTest::newRow("ftp-nohost") << "ftp:/etc/passwd" << true << "ftp";
QTest::newRow("http-nohost") << "http:/etc/passwd" << true << "http";
QTest::newRow("mailto-nomail") << "mailto://smtp.example.com" << true << "mailto";
// schemes with numbers
QTest::newRow("digits") << "proto2://" << true << "proto2";
// schemes with dots, dashes, and pluses
QTest::newRow("svn+ssh") << "svn+ssh://svn.example.com" << true << "svn+ssh";
QTest::newRow("withdash") << "svn-ssh://svn.example.com" << true << "svn-ssh";
QTest::newRow("withdots") << "org.qt-project://qt-project.org" << true << "org.qt-project";
// lowercasing
QTest::newRow("FTP") << "FTP://ftp.example.com/" << true << "ftp";
QTest::newRow("HTTP") << "HTTP://www.example.com/" << true << "http";
QTest::newRow("MAILTO") << "MAILTO:smith@example.com" << true << "mailto";
QTest::newRow("FILE") << "FILE:/etc/passwd" << true << "file";
QTest::newRow("SVN+SSH") << "SVN+SSH://svn.example.com" << true << "svn+ssh";
QTest::newRow("WITHDASH") << "SVN-SSH://svn.example.com" << true << "svn-ssh";
QTest::newRow("WITHDOTS") << "ORG.QT-PROJECT://qt-project.org" << true << "org.qt-project";
// invalid entries
QTest::newRow("start-digit") << "1http://example.com" << false << "1http";
QTest::newRow("start-plus") << "+ssh://user@example.com" << false << "+ssh";
QTest::newRow("start-dot") << ".org.example:///" << false << ".org.example";
QTest::newRow("with-space") << "a b://" << false << "a b";
QTest::newRow("with-non-ascii") << "\304\245\305\243\305\245\321\200://example.com" << false << "\304\245\305\243\305\245\321\200";
QTest::newRow("with-control1") << "http\1://example.com" << false << "http\1";
QTest::newRow("with-control127") << "http\177://example.com" << false << "http\177";
QTest::newRow("with-null") << QString::fromLatin1("http\0://example.com", 19) << false << QString::fromLatin1("http\0", 5);
QTest::newRow("percent-encoded") << "%68%74%%74%70://example.com" << false << "%68%74%%74%70";
static const char controls[] = "!\"$&'()*,;<=>[\\]^_`{|}~";
for (size_t i = 0; i < sizeof(controls) - 1; ++i)
QTest::newRow(("with-" + QByteArray(1, controls[i])).constData())
<< QString("pre%1post://example.com/").arg(QLatin1Char(controls[i]))
<< false << QString("pre%1post").arg(QLatin1Char(controls[i]));
}
void tst_QUrl::schemeValidator()
{
QFETCH(QByteArray, encodedUrl);
QFETCH(QString, input);
QFETCH(bool, result);
QFETCH(QString, toString);
QUrl url = QUrl::fromEncoded(encodedUrl);
QEXPECT_FAIL("ftp:/index.html", "high-level URL validation not reimplemented yet", Abort);
QEXPECT_FAIL("mailto://smtp.trolltech.com/ole@bull.name", "high-level URL validation not reimplemented yet", Abort);
QUrl url(input);
QCOMPARE(url.isValid(), result);
if (!result)
if (result) {
QFETCH(QString, scheme);
QCOMPARE(url.scheme(), scheme);
// reconstruct with just the scheme:
url.setUrl(scheme + ':');
QVERIFY(url.isValid());
QCOMPARE(url.scheme(), scheme);
} else {
QVERIFY(url.toString().isEmpty());
}
}
void tst_QUrl::invalidSchemeValidator()
void tst_QUrl::setScheme_data()
{
// test that if scheme does not start with an ALPHA, QUrl::isValid() returns false
{
QUrl url("1http://qt-project.org");
QVERIFY(url.scheme().isEmpty());
QVERIFY(url.path().startsWith("1http"));
}
{
QUrl url("http://qt-project.org");
url.setScheme("111http://qt-project.org");
QCOMPARE(url.isValid(), false);
QVERIFY(url.toString().isEmpty());
}
// non-ALPHA character at other positions in the scheme are ok
{
QUrl url("ht111tp://qt-project.org", QUrl::StrictMode);
QVERIFY(url.isValid());
QCOMPARE(url.scheme(), QString("ht111tp"));
QVERIFY(!url.toString().isEmpty());
}
{
QUrl url("http://qt-project.org");
url.setScheme("ht123tp://qt-project.org");
QVERIFY(!url.isValid());
QVERIFY(url.toString().isEmpty());
url.setScheme("http");
QVERIFY(url.isValid());
QVERIFY(!url.toString().isEmpty());
}
{
QUrl url = QUrl::fromEncoded("ht321tp://qt-project.org", QUrl::StrictMode);
QVERIFY(url.isValid());
QVERIFY(!url.toString().isEmpty());
}
schemeValidator_data();
// a couple more which wouldn't work in parsing a full URL
QTest::newRow("with-slash") << QString() << false << "http/";
QTest::newRow("with-question") << QString() << false << "http?";
QTest::newRow("with-hash") << QString() << false << "http#";
}
void tst_QUrl::setScheme()
{
QFETCH(QString, scheme);
QFETCH(bool, result);
QString expectedScheme;
if (result)
expectedScheme = scheme;
QUrl url;
url.setScheme(scheme);
QCOMPARE(url.isValid(), result);
QCOMPARE(url.scheme(), expectedScheme);
url.setScheme(scheme.toUpper());
QCOMPARE(url.isValid(), result);
QCOMPARE(url.scheme(), expectedScheme);
}
void tst_QUrl::strictParser_data()

View File

@ -7310,7 +7310,11 @@ void tst_QNetworkReply::qtbug45581WrongReplyStatusCode()
const QByteArray expectedContent =
"<root attr=\"value\" attr2=\"value2\">"
"<person /><fruit /></root>\n";
"<person /><fruit /></root>"
#ifdef Q_OS_WIN
"\r"
#endif
"\n";
QCOMPARE(reply->readAll(), expectedContent);

View File

@ -1926,7 +1926,7 @@ bool Configure::displayHelp()
}
desc("ANGLE", "yes", "-angle", "Use the ANGLE implementation of OpenGL ES 2.0.");
desc("ANGLE", "no", "-no-angle", "Do not use ANGLE.\nSee http://code.google.com/p/angleproject/\n");
desc("ANGLE", "no", "-no-angle", "Do not use ANGLE.\nSee https://chromium.googlesource.com/angle/angle/+/master/README.md\n");
// Qt\Windows only options go below here --------------------------------------------------------------------------------
desc("\nQt for Windows only:\n\n");