Merge 5.14 into 5.14.0

Change-Id: I64f2657cb7c4671cab1a20c8f4a7e4dc2b1cb83a
bb10
Frederik Gladhorn 2019-11-21 11:30:20 +01:00
commit 578a020e65
31 changed files with 341 additions and 123 deletions

3
configure vendored
View File

@ -446,8 +446,7 @@ while [ "$#" -gt 0 ]; do
-android-ndk| \
-android-ndk-platform| \
-android-ndk-host| \
-android-arch| \
-android-toolchain-version)
-android-arch)
VAR=`echo $1 | sed 's,^-\(.*\),\1,'`
shift
VAL="$1"

View File

@ -0,0 +1,129 @@
/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** 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 The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
//! [displayName]
Returns a localized display name for the given location \a type
or an empty QString if no relevant location can be found.
//! [displayName]
//! [findExecutable]
Finds the executable named \a executableName in the specified
\a paths, or the system paths if paths is empty.
On most operating systems the system path is determined by the
\c PATH environment variable. The directories where to search for
the executable can be set in the paths argument. To search in
both your own paths and the system paths, call findExecutable
twice, once with paths set and once with paths empty.
Symlinks are not resolved in order to preserve behavior for the
case of executables whose behavior depends on the name they are
invoked with
.
\note On Windows, the usual executable extensions (from the PATHEXT
environment variable) are automatically appended. For example, the
findExecutable("foo") call finds \c foo.exe or \c foo.bat if
present.
Returns the absolute file path to the executable, or an empty
string if not found.
//! [findExecutable]
//! [locate]
Finds a file or directory called \a fileName in the standard
locations for \a type.
The \a options flag lets you specify whether to look for files
or directories. By default, this flag is set to \c LocateFile.
Returns the absolute path to the first file or directory found,
otherwise returns an empty string.
//! [locate]
//! [locateAll]
Finds all files or directories by the name, \a fileName, in the
standard locations for \a type.
The \a options flag lets you specify whether to look for files
or directories. By default, this flag is set to \c LocateFile.
Returns the list of all the files that were found.
//! [locateAll]
//! [setTestModeEnabled]
If \a testMode is \c true, this enables a special "test mode" in
QStandardPaths, which changes writable locations to point to
test directories. This prevents auto tests from reading
or writing to the current user's configuration.
It affects the locations into which test programs might write
files: \c GenericDataLocation, \c DataLocation, \c ConfigLocation,
\c GenericConfigLocation, \c AppConfigLocation,
\c GenericCacheLocation, and \c CacheLocation. Other locations
are not affected.
On Unix, \c XDG_DATA_HOME is set to \c{~/.qttest/share},
\c XDG_CONFIG_HOME is set to \c{~/.qttest/config}, and
\c XDG_CACHE_HOME is set to \c{~/.qttest/cache}.
On macOS, data goes to \c{~/.qttest/Application Support},
cache goes to \c{~/.qttest/Cache}, and config goes to
\c{~/.qttest/Preferences}.
On Windows, everything goes to a "qttest" directory under
\c{%APPDATA%}.
//! [setTestModeEnabled]
//! [standardLocations]
Returns all the directories where files of \a type belong.
The list of directories is sorted from high to low priority,
starting with writableLocation() if it can be determined.
This list is empty if no locations for type are defined.
//! [standardLocations]
//! [writableLocation]
Returns the directory where files of \a type should be written to,
or an empty string if the location cannot be determined.
\note The storage location returned may not exist; that is,
it may need to be created by the system or the user.
//! [writableLocation]

View File

@ -56,6 +56,7 @@
#include <QGraphicsView>
#include <QApplication>
#include <QMenu>
#include <QMenuBar>
#include <QLayout>
#ifndef QT_NO_OPENGL

View File

@ -13,7 +13,7 @@ QMKSRC = $(SOURCE_PATH)\qmake
!if "$(QMAKESPEC)" == "win32-icc"
CXX = icl
LINKER = xilink
CFLAGS_EXTRA = /Zc:forScope /Qstd=c++11 /O3
CFLAGS_EXTRA = /Zc:forScope /Qstd=c++11
!elseif "$(QMAKESPEC)" == "win32-clang-msvc"
CXX = clang-cl
LINKER = lld-link

View File

@ -208,15 +208,15 @@ UnixMakefileGenerator::init()
escapeFilePath(pchBaseName + language + headerSuffix));
const ProStringList pchArchs = project->values("QMAKE_PCH_ARCHS");
for (const ProString &arch : pchArchs) {
QString suffix = headerSuffix;
suffix.replace(QLatin1String("${QMAKE_PCH_ARCH}"), arch.toQString());
QString file = pchBaseName + language + headerSuffix;
file.replace(QLatin1String("${QMAKE_PCH_ARCH}"), arch.toQString());
if (project->isActiveConfig("clang_pch_style")
&& (suffix.endsWith(QLatin1String(".pch"))
|| suffix.endsWith(QLatin1String(".gch")))) {
suffix.chop(4); // must omit header suffix for -include to recognize the PCH
&& (file.endsWith(QLatin1String(".pch"))
|| file.endsWith(QLatin1String(".gch")))) {
file.chop(4); // must omit header suffix for -include to recognize the PCH
}
pchFlags.replace(QLatin1String("${QMAKE_PCH_OUTPUT_") + arch + QLatin1Char('}'),
escapeFilePath(pchBaseName + language + suffix));
escapeFilePath(file));
}
}
}
@ -363,10 +363,11 @@ QStringList
if (pchArchs.isEmpty())
pchArchs << ProString(); // normal single-arch PCH
for (const ProString &arch : qAsConst(pchArchs)) {
QString suffix = header_suffix;
if (!arch.isEmpty())
suffix.replace(QLatin1String("${QMAKE_PCH_ARCH}"), arch.toQString());
QString precompiledHeader = header_prefix + language + suffix;
QString precompiledHeader = header_prefix + language + header_suffix;
if (!arch.isEmpty()) {
precompiledHeader.replace(QLatin1String("${QMAKE_PCH_ARCH}"),
arch.toQString());
}
if (!ret.contains(precompiledHeader))
ret += precompiledHeader;
}

View File

@ -1017,10 +1017,10 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
if (pchArchs.isEmpty())
pchArchs << ProString(); // normal single-arch PCH
for (const ProString &arch : qAsConst(pchArchs)) {
auto suffix = header_suffix.toQString();
QString file = precomph_out_dir + header_prefix + language + header_suffix;
if (!arch.isEmpty())
suffix.replace(QStringLiteral("${QMAKE_PCH_ARCH}"), arch.toQString());
precomp_files += precomph_out_dir + header_prefix + language + suffix;
file.replace(QStringLiteral("${QMAKE_PCH_ARCH}"), arch.toQString());
precomp_files += file;
}
}
}
@ -1140,7 +1140,10 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
t << "\n\techo \"// Automatically generated, do not modify\" > " << sourceFile_f
<< "\n\trm -f " << escapeFilePath(pchArchOutput);
} else {
t << "\n\t" << mkdir_p_asstring(pchOutputDir);
QString outDir = pchOutputDir;
if (!arch.isEmpty())
outDir.replace(QStringLiteral("${QMAKE_PCH_ARCH}"), arch.toQString());
t << "\n\t" << mkdir_p_asstring(outDir);
}
auto pchArchFlags = pchFlags;

View File

@ -68,6 +68,7 @@
( ( __clang_major__ >= 4 ) || \
( ( __clang_major__ == 3 ) && ( __clang_minor__ >= 2 ) ) ) ) ) && \
defined( __OPTIMIZE__ ) && \
!defined( __EMSCRIPTEN__ ) && \
__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#ifdef __clang__

View File

@ -887,10 +887,10 @@ void qt_core_boilerplate()
"\n"
"Installation prefix: %s\n"
"Library path: %s\n"
"Include path: %s\n",
"Plugin path: %s\n",
qt_configure_prefix_path_str + 12,
qt_configure_strs + qt_configure_str_offsets[QT_PREPEND_NAMESPACE(QLibraryInfo)::LibrariesPath - 1],
qt_configure_strs + qt_configure_str_offsets[QT_PREPEND_NAMESPACE(QLibraryInfo)::HeadersPath - 1]);
qt_configure_strs + qt_configure_str_offsets[QT_PREPEND_NAMESPACE(QLibraryInfo)::PluginsPath - 1]);
QT_PREPEND_NAMESPACE(qDumpCPUFeatures)();

View File

@ -357,22 +357,14 @@ QT_BEGIN_NAMESPACE
/*!
\fn QString QStandardPaths::writableLocation(StandardLocation type)
Returns the directory where files of \a type should be written to, or an empty string
if the location cannot be determined.
\note The storage location returned can be a directory that does not exist; i.e., it
may need to be created by the system or the user.
\include standardpath/functiondoc.qdocinc writableLocation
*/
/*!
\fn QStringList QStandardPaths::standardLocations(StandardLocation type)
Returns all the directories where files of \a type belong.
The list of directories is sorted from high to low priority, starting with
writableLocation() if it can be determined. This list is empty if no locations
for \a type are defined.
\include standardpath/functiondoc.qdocinc standardLocations
\sa writableLocation()
*/
@ -396,11 +388,7 @@ static bool existsAsSpecified(const QString &path, QStandardPaths::LocateOptions
}
/*!
Tries to find a file or directory called \a fileName in the standard locations
for \a type.
The full path to the first file or directory (depending on \a options) found is returned.
If no such file or directory can be found, an empty string is returned.
\include standardpath/functiondoc.qdocinc locate
*/
QString QStandardPaths::locate(StandardLocation type, const QString &fileName, LocateOptions options)
{
@ -414,12 +402,7 @@ QString QStandardPaths::locate(StandardLocation type, const QString &fileName, L
}
/*!
Tries to find all files or directories called \a fileName in the standard locations
for \a type.
The \a options flag allows to specify whether to look for files or directories.
Returns the list of all the files that were found.
\include standardpath/functiondoc.qdocinc locateAll
*/
QStringList QStandardPaths::locateAll(StandardLocation type, const QString &fileName, LocateOptions options)
{
@ -492,23 +475,7 @@ static inline QString
#endif // Q_OS_WIN
/*!
Finds the executable named \a executableName in the paths specified by \a paths,
or the system paths if \a paths is empty.
On most operating systems the system path is determined by the PATH environment variable.
The directories where to search for the executable can be set in the \a paths argument.
To search in both your own paths and the system paths, call findExecutable twice, once with
\a paths set and once with \a paths empty.
Symlinks are not resolved, in order to preserve behavior for the case of executables
whose behavior depends on the name they are invoked with.
\note On Windows, the usual executable extensions (from the PATHEXT environment variable)
are automatically appended, so that for instance findExecutable("foo") will find foo.exe
or foo.bat if present.
Returns the absolute file path to the executable, or an empty string if not found.
\include standardpath/functiondoc.qdocinc findExecutable
*/
QString QStandardPaths::findExecutable(const QString &executableName, const QStringList &paths)
{
@ -566,10 +533,7 @@ QString QStandardPaths::findExecutable(const QString &executableName, const QStr
}
/*!
\fn QString QStandardPaths::displayName(StandardLocation type)
Returns a localized display name for the given location \a type or
an empty QString if no relevant location can be found.
\include standardpath/functiondoc.qdocinc displayName
*/
#if !defined(Q_OS_MAC) && !defined(QT_BOOTSTRAPPED)
@ -626,23 +590,7 @@ QString QStandardPaths::displayName(StandardLocation type)
/*!
\fn void QStandardPaths::setTestModeEnabled(bool testMode)
If \a testMode is true, this enables a special "test mode" in
QStandardPaths, which changes writable locations
to point to test directories, in order to prevent auto tests from reading from
or writing to the current user's configuration.
This affects the locations into which test programs might write files:
GenericDataLocation, DataLocation, ConfigLocation, GenericConfigLocation,
AppConfigLocation, GenericCacheLocation, CacheLocation.
Other locations are not affected.
On Unix, \c XDG_DATA_HOME is set to \e ~/.qttest/share, \c XDG_CONFIG_HOME is
set to \e ~/.qttest/config, and \c XDG_CACHE_HOME is set to \e ~/.qttest/cache.
On \macos, data goes to \e ~/.qttest/Application Support, cache goes to
\e ~/.qttest/Cache, and config goes to \e ~/.qttest/Preferences.
On Windows, everything goes to a "qttest" directory under Application Data.
\include standardpath/functiondoc.qdocinc setTestModeEnabled
*/
static bool qsp_testMode = false;

View File

@ -631,6 +631,12 @@ QString QTemporaryFilePrivate::defaultTemplateName()
case sensitive. If the template is not present in the filename,
QTemporaryFile appends the generated part to the filename given.
\note On Linux, QTemporaryFile will attempt to create unnamed temporary
files. If that succeeds, open() will return true but exists() will be
false. If you call fileName() or any function that calls it,
QTemporaryFile will give the file a name, so most applications will
not see a difference.
\sa QDir::tempPath(), QFile
*/

View File

@ -632,7 +632,13 @@ bool QTimeZonePrivate::isValidId(const QByteArray &ianaId)
// Somewhat slack hand-rolled version:
const int MinSectionLength = 1;
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
// Android has its own naming of zones.
// "Canada/East-Saskatchewan" has a 17-character second component.
const int MaxSectionLength = 17;
#else
const int MaxSectionLength = 14;
#endif
int sectionLength = 0;
for (const char *it = ianaId.begin(), * const end = ianaId.end(); it != end; ++it, ++sectionLength) {
const char ch = *it;

View File

@ -79,6 +79,14 @@ qtConfig(png) {
HEADERS += image/qpnghandler_p.h
SOURCES += image/qpnghandler.cpp
QMAKE_USE_PRIVATE += libpng
win32:mingw {
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86048
GCC_VERSION = "$${QMAKE_GCC_MAJOR_VERSION}.$${QMAKE_GCC_MINOR_VERSION}.$${QMAKE_GCC_PATCH_VERSION}"
equals(GCC_VERSION, "8.1.0") {
QMAKE_CXXFLAGS += -fno-reorder-blocks-and-partition
}
}
}
# SIMD

View File

@ -165,6 +165,11 @@ QIconPrivate::QIconPrivate(QIconEngine *e)
qreal QIconPrivate::pixmapDevicePixelRatio(qreal displayDevicePixelRatio, const QSize &requestedSize, const QSize &actualSize)
{
QSize targetSize = requestedSize * displayDevicePixelRatio;
if ((actualSize.width() == targetSize.width() && actualSize.height() <= targetSize.height()) ||
(actualSize.width() <= targetSize.width() && actualSize.height() == targetSize.height())) {
// Correctly scaled for dpr, just having different aspect ratio
return displayDevicePixelRatio;
}
qreal scale = 0.5 * (qreal(actualSize.width()) / qreal(targetSize.width()) +
qreal(actualSize.height() / qreal(targetSize.height())));
return qMax(qreal(1.0), displayDevicePixelRatio *scale);
@ -185,7 +190,12 @@ QPixmapIconEngine::~QPixmapIconEngine()
void QPixmapIconEngine::paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state)
{
QSize pixmapSize = rect.size() * qt_effective_device_pixel_ratio(0);
qreal dpr = 1.0;
if (QCoreApplication::testAttribute(Qt::AA_UseHighDpiPixmaps)) {
auto paintDevice = painter->device();
dpr = paintDevice ? paintDevice->devicePixelRatioF() : qApp->devicePixelRatio();
}
const QSize pixmapSize = rect.size() * dpr;
QPixmap px = pixmap(pixmapSize, mode, state);
painter->drawPixmap(rect, px);
}

View File

@ -846,6 +846,7 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,
/*!
Constructs a wheel event object.
\since 5.12
The \a pos provides the location of the mouse cursor
within the window. The position in global coordinates is specified
by \a globalPos.

View File

@ -56,6 +56,9 @@ Q_LOGGING_CATEGORY(lcScaling, "qt.scaling");
#ifndef QT_NO_HIGHDPISCALING
static const char legacyDevicePixelEnvVar[] = "QT_DEVICE_PIXEL_RATIO";
// Note: QT_AUTO_SCREEN_SCALE_FACTOR is Done on X11, and should be kept
// working as-is. It's Deprecated on all other platforms.
static const char legacyAutoScreenEnvVar[] = "QT_AUTO_SCREEN_SCALE_FACTOR";
static const char enableHighDpiScalingEnvVar[] = "QT_ENABLE_HIGHDPI_SCALING";
@ -104,12 +107,6 @@ static inline qreal initialGlobalScaleFactor()
if (dpr > 0)
result = dpr;
}
if (qEnvironmentVariableIsSet(legacyAutoScreenEnvVar)) {
qWarning("Warning: %s is deprecated. Instead use:\n"
" %s to enable platform plugin controlled per-screen factors.",
legacyAutoScreenEnvVar, enableHighDpiScalingEnvVar);
}
}
return result;
}

View File

@ -348,10 +348,10 @@ void QShader::removeShader(const QShaderKey &key)
static void writeShaderKey(QDataStream *ds, const QShaderKey &k)
{
*ds << k.source();
*ds << int(k.source());
*ds << k.sourceVersion().version();
*ds << k.sourceVersion().flags();
*ds << k.sourceVariant();
*ds << int(k.sourceVariant());
}
/*!
@ -369,7 +369,7 @@ QByteArray QShader::serialized() const
return QByteArray();
ds << QSB_VERSION;
ds << d->stage;
ds << int(d->stage);
ds << d->desc.toBinaryJson();
ds << d->shaders.count();
for (auto it = d->shaders.cbegin(), itEnd = d->shaders.cend(); it != itEnd; ++it) {

View File

@ -17,9 +17,10 @@ qtConfig(freetype) {
unix {
include($$PWD/genericunix/genericunix.pri)
qtConfig(fontconfig) {
include($$PWD/fontconfig/fontconfig.pri)
}
}
qtConfig(fontconfig) {
include($$PWD/fontconfig/fontconfig.pri)
}
win32:!winrt {

View File

@ -317,8 +317,7 @@ bool QXcbIntegration::hasCapability(QPlatformIntegration::Capability cap) const
case OpenGL:
case ThreadedOpenGL:
{
const auto *connection = qAsConst(m_connections).first();
if (const auto *integration = connection->glIntegration())
if (const auto *integration = defaultConnection()->glIntegration())
return cap != ThreadedOpenGL || integration->supportsThreadedOpenGL();
return false;
}

View File

@ -182,6 +182,9 @@ QSqlQueryPrivate::~QSqlQueryPrivate()
You can retrieve the values of all the fields in a single variable
(a map) using boundValues().
\note Not all SQL operations support binding values. Refer to your database
system's documentation to check their availability.
\section1 Approaches to Binding Values
Below we present the same example using each of the four

View File

@ -79,8 +79,11 @@ int main(int argc, char *argv[])
//! [0]
QFileSystemModel *model = new QFileSystemModel;
QModelIndex parentIndex = model->index(QDir::currentPath());
int numRows = model->rowCount(parentIndex);
connect(model, &QFileSystemModel::directoryLoaded, [model](const QString &directory) {
QModelIndex parentIndex = model->index(directory);
int numRows = model->rowCount(parentIndex);
});
model->setRootPath(QDir::currentPath);
//! [0]
//! [1]

View File

@ -465,14 +465,19 @@
Although this does not show a normal way of using a model, it demonstrates
the conventions used by models when dealing with model indexes.
QFileSystemModel loading is asynchronous to minimize system resource use.
We have to take that into account when dealing with this model.
We construct a file system model in the following way:
\snippet simplemodel-use/main.cpp 0
In this case, we set up a default QFileSystemModel, obtain a parent index
using a specific implementation of \l{QFileSystemModel::}{index()}
provided by that model, and we count the number of rows in the model using
the \l{QFileSystemModel::}{rowCount()} function.
In this case, we start by setting up a default QFileSystemModel. We connect
it to a lambda, in which we will obtain a parent index using a specific
implementation of \l{QFileSystemModel::}{index()} provided by that model.
In the lambda, we count the number of rows in the model using the
\l{QFileSystemModel::}{rowCount()} function. Finally, we set the root path
of the QFileSystemModel so it starts loading data and triggers the lambda.
For simplicity, we are only interested in the items in the first column
of the model. We examine each row in turn, obtaining a model index for

View File

@ -233,7 +233,9 @@ void QTreeView::setModel(QAbstractItemModel *model)
d->viewItems.clear();
d->expandedIndexes.clear();
d->hiddenIndexes.clear();
d->geometryRecursionBlock = true; // do not update geometries due to signals from the headers
d->header->setModel(model);
d->geometryRecursionBlock = false;
QAbstractItemView::setModel(model);
// QAbstractItemView connects to a private slot

View File

@ -217,7 +217,7 @@ public:
void cursorWordBackward(bool mark) { moveCursor(m_textLayout.previousCursorPosition(m_cursor, QTextLayout::SkipWords), mark); }
void home(bool mark) { moveCursor(0, mark); }
void end(bool mark) { moveCursor(text().length(), mark); }
void end(bool mark) { moveCursor(m_text.length(), mark); }
int xToPos(int x, QTextLine::CursorPosition = QTextLine::CursorBetweenCharacters) const;
QRect rectForPos(int pos) const;

View File

@ -4818,20 +4818,20 @@ void QDomElement::setAttribute(const QString& name, const QString& value)
\fn void QDomElement::setAttribute(const QString& name, int value)
\overload
The number is formatted according to the current locale.
The formatting always uses QLocale::C.
*/
/*!
\fn void QDomElement::setAttribute(const QString& name, uint value)
\overload
The number is formatted according to the current locale.
The formatting always uses QLocale::C.
*/
/*!
\overload
The number is formatted according to the current locale.
The formatting always uses QLocale::C.
*/
void QDomElement::setAttribute(const QString& name, qlonglong value)
{
@ -4845,7 +4845,7 @@ void QDomElement::setAttribute(const QString& name, qlonglong value)
/*!
\overload
The number is formatted according to the current locale.
The formatting always uses QLocale::C.
*/
void QDomElement::setAttribute(const QString& name, qulonglong value)
{
@ -4859,7 +4859,7 @@ void QDomElement::setAttribute(const QString& name, qulonglong value)
/*!
\overload
The number is formatted according to the current locale.
The formatting always uses QLocale::C.
*/
void QDomElement::setAttribute(const QString& name, float value)
{
@ -4873,19 +4873,14 @@ void QDomElement::setAttribute(const QString& name, float value)
/*!
\overload
The number is formatted according to the current locale.
The formatting always uses QLocale::C.
*/
void QDomElement::setAttribute(const QString& name, double value)
{
if (!impl)
return;
QString x;
char buf[256];
int count = qsnprintf(buf, sizeof(buf), "%.16g", value);
if (count > 0)
x = QString::fromLatin1(buf, count);
else
x.setNum(value); // Fallback
x.setNum(value);
IMPL->setAttribute(name, x);
}

View File

@ -595,10 +595,7 @@ void tst_QLocale::emptyCtor_data()
ADD_CTOR_TEST("zz_zz", "C");
ADD_CTOR_TEST("zz...", "C");
ADD_CTOR_TEST("en.bla", "en_US");
#if !(defined(Q_OS_DARWIN) && QT_HAS_FEATURE(address_sanitizer))
// See QTBUG-69875
ADD_CTOR_TEST("en@bla", "en_US");
#endif
ADD_CTOR_TEST("en_blaaa", "en_US");
ADD_CTOR_TEST("en_zz", "en_US");
ADD_CTOR_TEST("en_GB.bla", "en_GB");
@ -607,10 +604,7 @@ void tst_QLocale::emptyCtor_data()
// Empty optional fields, but with punctuators supplied
ADD_CTOR_TEST("en.", "en_US");
#if !(defined(Q_OS_DARWIN) && QT_HAS_FEATURE(address_sanitizer))
// See QTBUG-69875
ADD_CTOR_TEST("en@", "en_US");
#endif
ADD_CTOR_TEST("en.@", "en_US");
ADD_CTOR_TEST("en_", "en_US");
ADD_CTOR_TEST("en_.", "en_US");

View File

@ -2,10 +2,6 @@
[dataStreamTest]
android
# QTBUG-69128
[isTimeZoneIdAvailable]
android
# QTBUG-69129
[specificTransition]
android
@ -75,10 +71,14 @@ android
android
[transitionEachZone:Asia/Chita@1970]
android
[transitionEachZone:Asia/Choibalsan@1970]
android
[transitionEachZone:Asia/Dushanbe@1970]
android
[transitionEachZone:Asia/Ho_Chi_Minh@1970]
android
[transitionEachZone:Asia/Hovd@1970]
android
[transitionEachZone:Asia/Kathmandu@1970]
android
[transitionEachZone:Asia/Katmandu@1970]
@ -109,6 +109,10 @@ android
android
[transitionEachZone:Asia/Thimphu@1970]
android
[transitionEachZone:Asia/Ulaanbaatar@1970]
android
[transitionEachZone:Asia/Ulan_Bator@1970]
android
[transitionEachZone:Asia/Ust-Nera@1970]
android
[transitionEachZone:Atlantic/Cape_Verde@1970]

View File

@ -706,6 +706,7 @@ void tst_QTimeZone::isValidId_data()
// a-z, A-Z, 0-9, '.', '-', '_' are valid chars
// Can't start with '-'
// Parts separated by '/', each part min 1 and max of 14 chars
// (Android has parts with lengths up to 17, so tolerates this as a special case.)
#define TESTSET(name, section, valid) \
QTest::newRow(name " front") << QByteArray(section "/xyz/xyz") << valid; \
QTest::newRow(name " middle") << QByteArray("xyz/" section "/xyz") << valid; \
@ -713,8 +714,13 @@ void tst_QTimeZone::isValidId_data()
TESTSET("empty", "", false);
TESTSET("minimal", "m", true);
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
TESTSET("maximal", "East-Saskatchewan", true); // Android actually uses this
TESTSET("too long", "North-Saskatchewan", false); // ... but thankfully not this.
#else
TESTSET("maximal", "12345678901234", true);
TESTSET("too long", "123456789012345", false);
#endif
TESTSET("bad hyphen", "-hyphen", false);
TESTSET("good hyphen", "hy-phen", true);
@ -759,8 +765,13 @@ void tst_QTimeZone::isValidId_data()
QTest::newRow("a,z alone") << QByteArray("a,z") << false;
QTest::newRow("/z alone") << QByteArray("/z") << false;
QTest::newRow("-z alone") << QByteArray("-z") << false;
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED)
QTest::newRow("long alone") << QByteArray("12345678901234567") << true;
QTest::newRow("over-long alone") << QByteArray("123456789012345678") << false;
#else
QTest::newRow("long alone") << QByteArray("12345678901234") << true;
QTest::newRow("over-long alone") << QByteArray("123456789012345") << false;
#endif
#else
QSKIP("This test requires a Qt -developer-build.");

View File

@ -67,7 +67,7 @@ void tst_QScopedGuard::exceptions()
bool caught = false;
QT_TRY
{
auto cleanup = qScopeGuard([&caught] { s_globalState++; });
auto cleanup = qScopeGuard([] { s_globalState++; });
QT_THROW(std::bad_alloc()); //if Qt compiled without exceptions this is noop
s_globalState = 100;
}

View File

@ -2862,6 +2862,7 @@ public:
};
Node *root;
bool crash = false;
EvilModel(QObject *parent = nullptr): QAbstractItemModel(parent), root(new Node)
{}
@ -2870,6 +2871,11 @@ public:
delete root;
}
void setCrash()
{
crash = true;
}
void change()
{
emit layoutAboutToBeChanged();
@ -2938,6 +2944,10 @@ public:
QVariant data(const QModelIndex &idx, int role) const override
{
if (crash) {
QTest::qFail("Should not get here...", __FILE__, __LINE__);
return QVariant();
}
if (idx.isValid() && role == Qt::DisplayRole) {
Node *parentNode = root;
if (idx.isValid()) {
@ -2957,6 +2967,7 @@ void tst_QTreeView::evilModel_data()
{
QTest::addColumn<bool>("visible");
QTest::newRow("visible") << false;
QTest::newRow("visible") << true;
}
void tst_QTreeView::evilModel()
@ -3126,6 +3137,9 @@ void tst_QTreeView::evilModel()
model.change();
view.setRootIndex(secondLevel);
model.setCrash();
view.setModel(nullptr);
}
void tst_QTreeView::indexRowSizeHint()

View File

@ -760,6 +760,14 @@ void tst_QLineEdit::keypress_inputMask_data()
keys.addKeyClick(Qt::Key_Delete);
QTest::newRow("deleting all") << QString("000.000;_") << keys << QString(".") << QString("___.___");
}
{
QTestEventList keys;
// inserting at end
addKeySequenceStandardKey(keys, QKeySequence::MoveToEndOfLine);
keys.addKeyClick(Qt::Key_Left);
keys.addKeyClick(Qt::Key_0);
QTest::newRow("insert at end") << QString("9-9-9") << keys << QString("--0") << QString(" - -0");
}
{
QTestEventList keys;
// inserting '12.12' then two backspaces

View File

@ -57,6 +57,7 @@ private slots:
void toString_02();
void hasAttributes_data();
void hasAttributes();
void setGetAttributes();
void save_data();
void save();
void saveWithSerialization() const;
@ -392,6 +393,74 @@ void tst_QDom::hasAttributes()
QTEST( visitedNodes, "visitedNodes" );
}
void tst_QDom::setGetAttributes()
{
QDomDocument doc;
QDomElement rootNode = doc.createElement("Root");
doc.appendChild(rootNode);
const QLocale oldLocale = QLocale();
QLocale::setDefault(QLocale::German); // decimal separator != '.'
const QString qstringVal("QString");
const qlonglong qlonglongVal = std::numeric_limits<qlonglong>::min();
const qulonglong qulonglongVal = std::numeric_limits<qulonglong>::max();
const int intVal = std::numeric_limits<int>::min();
const uint uintVal = std::numeric_limits<uint>::max();
const float floatVal = 0.1234f;
const double doubleVal = 0.1234;
rootNode.setAttribute("qstringVal", qstringVal);
rootNode.setAttribute("qlonglongVal", qlonglongVal);
rootNode.setAttribute("qulonglongVal", qulonglongVal);
rootNode.setAttribute("intVal", intVal);
rootNode.setAttribute("uintVal", uintVal);
rootNode.setAttribute("floatVal", floatVal);
rootNode.setAttribute("doubleVal", doubleVal);
QDomElement nsNode = doc.createElement("NS");
rootNode.appendChild(nsNode);
nsNode.setAttributeNS("namespace", "qstringVal", qstringVal);
nsNode.setAttributeNS("namespace", "qlonglongVal", qlonglongVal);
nsNode.setAttributeNS("namespace", "qulonglongVal", qulonglongVal);
nsNode.setAttributeNS("namespace", "intVal", intVal);
nsNode.setAttributeNS("namespace", "uintVal", uintVal);
nsNode.setAttributeNS("namespace", "floatVal", floatVal); // not available atm
nsNode.setAttributeNS("namespace", "doubleVal", doubleVal);
bool bOk;
QCOMPARE(rootNode.attribute("qstringVal"), qstringVal);
QCOMPARE(rootNode.attribute("qlonglongVal").toLongLong(&bOk), qlonglongVal);
QVERIFY(bOk);
QCOMPARE(rootNode.attribute("qulonglongVal").toULongLong(&bOk), qulonglongVal);
QVERIFY(bOk);
QCOMPARE(rootNode.attribute("intVal").toInt(&bOk), intVal);
QVERIFY(bOk);
QCOMPARE(rootNode.attribute("uintVal").toUInt(&bOk), uintVal);
QVERIFY(bOk);
QCOMPARE(rootNode.attribute("floatVal").toFloat(&bOk), floatVal);
QVERIFY(bOk);
QCOMPARE(rootNode.attribute("doubleVal").toDouble(&bOk), doubleVal);
QVERIFY(bOk);
QCOMPARE(nsNode.attributeNS("namespace", "qstringVal"), qstringVal);
QCOMPARE(nsNode.attributeNS("namespace", "qlonglongVal").toLongLong(&bOk), qlonglongVal);
QVERIFY(bOk);
QCOMPARE(nsNode.attributeNS("namespace", "qulonglongVal").toULongLong(&bOk), qulonglongVal);
QVERIFY(bOk);
QCOMPARE(nsNode.attributeNS("namespace", "intVal").toInt(&bOk), intVal);
QVERIFY(bOk);
QCOMPARE(nsNode.attributeNS("namespace", "uintVal").toUInt(&bOk), uintVal);
QVERIFY(bOk);
QCOMPARE(nsNode.attributeNS("namespace", "floatVal").toFloat(&bOk), floatVal);
QVERIFY(bOk);
QCOMPARE(nsNode.attributeNS("namespace", "doubleVal").toDouble(&bOk), doubleVal);
QVERIFY(bOk);
QLocale::setDefault(oldLocale);
}
int tst_QDom::hasAttributesHelper( const QDomNode& node )
{
int visitedNodes = 1;