Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts: src/gui/kernel/qwindow.cpp src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/windows/qwindowssystemtrayicon.cpp src/plugins/platforms/xcb/qxcbconnection_xi2.cpp tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp tests/auto/widgets/kernel/qaction/tst_qaction.cpp Change-Id: Ifa515dc0ece7eb1471b00c1214149629a7e6a233
This commit is contained in:
commit
88cf044580
@ -48,15 +48,10 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
#include "imagescaling.h"
|
||||
|
||||
#include <qmath.h>
|
||||
|
||||
const int imageSize = 100;
|
||||
|
||||
QImage scale(const QString &imageFileName)
|
||||
{
|
||||
QImage image(imageFileName);
|
||||
return image.scaled(QSize(imageSize, imageSize), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
||||
}
|
||||
#include <functional>
|
||||
|
||||
Images::Images(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
@ -65,19 +60,19 @@ Images::Images(QWidget *parent)
|
||||
resize(800, 600);
|
||||
|
||||
imageScaling = new QFutureWatcher<QImage>(this);
|
||||
connect(imageScaling, SIGNAL(resultReadyAt(int)), SLOT(showImage(int)));
|
||||
connect(imageScaling, SIGNAL(finished()), SLOT(finished()));
|
||||
connect(imageScaling, &QFutureWatcher<QImage>::resultReadyAt, this, &Images::showImage);
|
||||
connect(imageScaling, &QFutureWatcher<QImage>::finished, this, &Images::finished);
|
||||
|
||||
openButton = new QPushButton(tr("Open Images"));
|
||||
connect(openButton, SIGNAL(clicked()), SLOT(open()));
|
||||
connect(openButton, &QPushButton::clicked, this, &Images::open);
|
||||
|
||||
cancelButton = new QPushButton(tr("Cancel"));
|
||||
cancelButton->setEnabled(false);
|
||||
connect(cancelButton, SIGNAL(clicked()), imageScaling, SLOT(cancel()));
|
||||
connect(cancelButton, &QPushButton::clicked, imageScaling, &QFutureWatcher<QImage>::cancel);
|
||||
|
||||
pauseButton = new QPushButton(tr("Pause/Resume"));
|
||||
pauseButton->setEnabled(false);
|
||||
connect(pauseButton, SIGNAL(clicked()), imageScaling, SLOT(togglePaused()));
|
||||
connect(pauseButton, &QPushButton::clicked, imageScaling, &QFutureWatcher<QImage>::togglePaused);
|
||||
|
||||
QHBoxLayout *buttonLayout = new QHBoxLayout();
|
||||
buttonLayout->addWidget(openButton);
|
||||
@ -113,9 +108,11 @@ void Images::open()
|
||||
QStandardPaths::writableLocation(QStandardPaths::PicturesLocation),
|
||||
"*.jpg *.png");
|
||||
|
||||
if (files.count() == 0)
|
||||
if (files.isEmpty())
|
||||
return;
|
||||
|
||||
const int imageSize = 100;
|
||||
|
||||
// Do a simple layout.
|
||||
qDeleteAll(labels);
|
||||
labels.clear();
|
||||
@ -130,6 +127,11 @@ void Images::open()
|
||||
}
|
||||
}
|
||||
|
||||
std::function<QImage(const QString&)> scale = [imageSize](const QString &imageFileName) {
|
||||
QImage image(imageFileName);
|
||||
return image.scaled(QSize(imageSize, imageSize), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
||||
};
|
||||
|
||||
// Use mapped to run the thread safe scale function on the files.
|
||||
imageScaling->setFuture(QtConcurrent::mapped(files, scale));
|
||||
|
||||
|
@ -57,9 +57,9 @@ class Images : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Images(QWidget *parent = 0);
|
||||
Images(QWidget *parent = nullptr);
|
||||
~Images();
|
||||
public Q_SLOTS:
|
||||
public slots:
|
||||
void open();
|
||||
void showImage(int num);
|
||||
void finished();
|
||||
|
@ -55,11 +55,7 @@
|
||||
#include <QGuiApplication>
|
||||
#include <qtconcurrentmap.h>
|
||||
|
||||
QImage scale(const QImage &image)
|
||||
{
|
||||
qDebug() << "Scaling image in thread" << QThread::currentThread();
|
||||
return image.scaled(QSize(100, 100), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
||||
}
|
||||
#include <functional>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@ -72,6 +68,12 @@ int main(int argc, char *argv[])
|
||||
for (int i = 0; i < imageCount; ++i)
|
||||
images.append(QImage(1600, 1200, QImage::Format_ARGB32_Premultiplied));
|
||||
|
||||
std::function<QImage(const QImage&)> scale = [](const QImage &image) -> QImage
|
||||
{
|
||||
qDebug() << "Scaling image in thread" << QThread::currentThread();
|
||||
return image.scaled(QSize(100, 100), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
||||
};
|
||||
|
||||
// Use QtConcurrentBlocking::mapped to apply the scale function to all the
|
||||
// images in the list.
|
||||
QList<QImage> thumbnails = QtConcurrent::blockingMapped(images, scale);
|
||||
|
@ -51,24 +51,16 @@
|
||||
#include <QtWidgets>
|
||||
#include <QtConcurrent>
|
||||
|
||||
#include <functional>
|
||||
|
||||
using namespace QtConcurrent;
|
||||
|
||||
const int iterations = 20;
|
||||
|
||||
void spin(int &iteration)
|
||||
{
|
||||
const int work = 1000 * 1000 * 40;
|
||||
volatile int v = 0;
|
||||
for (int j = 0; j < work; ++j)
|
||||
++v;
|
||||
|
||||
qDebug() << "iteration" << iteration << "in thread" << QThread::currentThreadId();
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
|
||||
const int iterations = 20;
|
||||
|
||||
// Prepare the vector.
|
||||
QVector<int> vector;
|
||||
for (int i = 0; i < iterations; ++i)
|
||||
@ -80,10 +72,20 @@ int main(int argc, char **argv)
|
||||
|
||||
// Create a QFutureWatcher and connect signals and slots.
|
||||
QFutureWatcher<void> futureWatcher;
|
||||
QObject::connect(&futureWatcher, SIGNAL(finished()), &dialog, SLOT(reset()));
|
||||
QObject::connect(&dialog, SIGNAL(canceled()), &futureWatcher, SLOT(cancel()));
|
||||
QObject::connect(&futureWatcher, SIGNAL(progressRangeChanged(int,int)), &dialog, SLOT(setRange(int,int)));
|
||||
QObject::connect(&futureWatcher, SIGNAL(progressValueChanged(int)), &dialog, SLOT(setValue(int)));
|
||||
QObject::connect(&futureWatcher, &QFutureWatcher<void>::finished, &dialog, &QProgressDialog::reset);
|
||||
QObject::connect(&dialog, &QProgressDialog::canceled, &futureWatcher, &QFutureWatcher<void>::cancel);
|
||||
QObject::connect(&futureWatcher, &QFutureWatcher<void>::progressRangeChanged, &dialog, &QProgressDialog::setRange);
|
||||
QObject::connect(&futureWatcher, &QFutureWatcher<void>::progressValueChanged, &dialog, &QProgressDialog::setValue);
|
||||
|
||||
// Our function to compute
|
||||
std::function<void(int&)> spin = [](int &iteration) {
|
||||
const int work = 1000 * 1000 * 40;
|
||||
volatile int v = 0;
|
||||
for (int j = 0; j < work; ++j)
|
||||
++v;
|
||||
|
||||
qDebug() << "iteration" << iteration << "in thread" << QThread::currentThreadId();
|
||||
};
|
||||
|
||||
// Start the computation.
|
||||
futureWatcher.setFuture(QtConcurrent::map(vector, spin));
|
||||
|
@ -65,15 +65,17 @@ using namespace QtConcurrent;
|
||||
/*
|
||||
Utility function that recursivily searches for files.
|
||||
*/
|
||||
QStringList findFiles(const QString &startDir, QStringList filters)
|
||||
QStringList findFiles(const QString &startDir, const QStringList &filters)
|
||||
{
|
||||
QStringList names;
|
||||
QDir dir(startDir);
|
||||
|
||||
foreach (QString file, dir.entryList(filters, QDir::Files))
|
||||
const auto files = dir.entryList(filters, QDir::Files);
|
||||
for (const QString &file : files)
|
||||
names += startDir + '/' + file;
|
||||
|
||||
foreach (QString subdir, dir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot))
|
||||
const auto subdirs = dir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot);
|
||||
for (const QString &subdir : subdirs)
|
||||
names += findFiles(startDir + '/' + subdir, filters);
|
||||
return names;
|
||||
}
|
||||
@ -83,17 +85,18 @@ typedef QMap<QString, int> WordCount;
|
||||
/*
|
||||
Single threaded word counter function.
|
||||
*/
|
||||
WordCount singleThreadedWordCount(QStringList files)
|
||||
WordCount singleThreadedWordCount(const QStringList &files)
|
||||
{
|
||||
WordCount wordCount;
|
||||
foreach (QString file, files) {
|
||||
for (const QString &file : files) {
|
||||
QFile f(file);
|
||||
f.open(QIODevice::ReadOnly);
|
||||
QTextStream textStream(&f);
|
||||
while (textStream.atEnd() == false)
|
||||
foreach (const QString &word, textStream.readLine().split(' '))
|
||||
while (!textStream.atEnd()) {
|
||||
const auto words = textStream.readLine().split(' ');
|
||||
for (const QString &word : words)
|
||||
wordCount[word] += 1;
|
||||
|
||||
}
|
||||
}
|
||||
return wordCount;
|
||||
}
|
||||
@ -109,9 +112,11 @@ WordCount countWords(const QString &file)
|
||||
QTextStream textStream(&f);
|
||||
WordCount wordCount;
|
||||
|
||||
while (textStream.atEnd() == false)
|
||||
foreach (const QString &word, textStream.readLine().split(' '))
|
||||
while (!textStream.atEnd()) {
|
||||
const auto words = textStream.readLine().split(' ');
|
||||
for (const QString &word : words)
|
||||
wordCount[word] += 1;
|
||||
}
|
||||
|
||||
return wordCount;
|
||||
}
|
||||
@ -137,8 +142,6 @@ int main(int argc, char** argv)
|
||||
|
||||
qDebug() << "warmup";
|
||||
{
|
||||
QTime time;
|
||||
time.start();
|
||||
WordCount total = singleThreadedWordCount(files);
|
||||
}
|
||||
|
||||
|
@ -1,40 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the FOO module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:BSD-OLD$
|
||||
** You may use this file under the terms of the BSD license as follows:
|
||||
**
|
||||
** "Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in
|
||||
** the documentation and/or other materials provided with the
|
||||
** distribution.
|
||||
** * Neither the name of The Qt Company Ltd nor the names of its
|
||||
** contributors may be used to endorse or promote products derived
|
||||
** from this software without specific prior written permission.
|
||||
**
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
@ -1,27 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the documentation of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:FDL-OLD$
|
||||
** 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 http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://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: http://www.gnu.org/copyleft/fdl.html.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
@ -62,6 +62,7 @@
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Debug"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
disableMainThreadChecker = "YES"
|
||||
debugDocumentVersioning = "NO"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable>
|
||||
|
77
src/3rdparty/libpng/ANNOUNCE
vendored
77
src/3rdparty/libpng/ANNOUNCE
vendored
@ -1,4 +1,4 @@
|
||||
Libpng 1.6.32 - August 24, 2017
|
||||
Libpng 1.6.34 - September 29, 2017
|
||||
|
||||
This is a public release of libpng, intended for use in production codes.
|
||||
|
||||
@ -7,79 +7,24 @@ Files available for download:
|
||||
Source files with LF line endings (for Unix/Linux) and with a
|
||||
"configure" script
|
||||
|
||||
libpng-1.6.32.tar.xz (LZMA-compressed, recommended)
|
||||
libpng-1.6.32.tar.gz
|
||||
libpng-1.6.34.tar.xz (LZMA-compressed, recommended)
|
||||
libpng-1.6.34.tar.gz
|
||||
|
||||
Source files with CRLF line endings (for Windows), without the
|
||||
"configure" script
|
||||
|
||||
lpng1632.7z (LZMA-compressed, recommended)
|
||||
lpng1632.zip
|
||||
lpng1634.7z (LZMA-compressed, recommended)
|
||||
lpng1634.zip
|
||||
|
||||
Other information:
|
||||
|
||||
libpng-1.6.32-README.txt
|
||||
libpng-1.6.32-LICENSE.txt
|
||||
libpng-1.6.32-*.asc (armored detached GPG signatures)
|
||||
libpng-1.6.34-README.txt
|
||||
libpng-1.6.34-LICENSE.txt
|
||||
libpng-1.6.34-*.asc (armored detached GPG signatures)
|
||||
|
||||
Changes since the last public release (1.6.31):
|
||||
Avoid possible NULL dereference in png_handle_eXIf when benign_errors
|
||||
are allowed. Avoid leaking the input buffer "eXIf_buf".
|
||||
Eliminated png_ptr->num_exif member from pngstruct.h and added num_exif
|
||||
to arguments for png_get_eXIf() and png_set_eXIf().
|
||||
Added calls to png_handle_eXIf(() in pngread.c and png_write_eXIf() in
|
||||
pngwrite.c, and made various other fixes to png_write_eXIf().
|
||||
Changed name of png_get_eXIF and png_set_eXIf() to png_get_eXIf_1() and
|
||||
png_set_eXIf_1(), respectively, to avoid breaking API compatibility
|
||||
with libpng-1.6.31.
|
||||
Updated contrib/libtests/pngunknown.c with eXIf chunk.
|
||||
Initialized btoa[] in pngstest.c
|
||||
Stop memory leak when returning from png_handle_eXIf() with an error
|
||||
(Bug report from the OSS-fuzz project).
|
||||
Replaced local eXIf_buf with info_ptr-eXIf_buf in png_handle_eXIf().
|
||||
Update libpng.3 and libpng-manual.txt about eXIf functions.
|
||||
Restored png_get_eXIf() and png_set_eXIf() to maintain API compatability.
|
||||
Removed png_get_eXIf_1() and png_set_eXIf_1().
|
||||
Check length of all chunks except IDAT against user limit to fix an
|
||||
OSS-fuzz issue.
|
||||
Check length of IDAT against maximum possible IDAT size, accounting
|
||||
for height, rowbytes, interlacing and zlib/deflate overhead.
|
||||
Restored png_get_eXIf_1() and png_set_eXIf_1(), because strlen(eXIf_buf)
|
||||
does not work (the eXIf chunk data can contain zeroes).
|
||||
Require cmake-2.8.8 in CMakeLists.txt. Revised symlink creation,
|
||||
no longer using deprecated cmake LOCATION feature (Clifford Yapp).
|
||||
Fixed five-byte error in the calculation of IDAT maximum possible size.
|
||||
Moved chunk-length check into a png_check_chunk_length() private
|
||||
function (Suggested by Max Stepin).
|
||||
Moved bad pngs from tests to contrib/libtests/crashers
|
||||
Moved testing of bad pngs into a separate tests/pngtest-badpngs script
|
||||
Added the --xfail (expected FAIL) option to pngtest.c. It writes XFAIL
|
||||
in the output but PASS for the libpng test.
|
||||
Require cmake-3.0.2 in CMakeLists.txt (Clifford Yapp).
|
||||
Fix "const" declaration info_ptr argument to png_get_eXIf_1() and the
|
||||
num_exif argument to png_get_eXIf_1() (Github Issue 171).
|
||||
Added "eXIf" to "chunks_to_ignore[]" in png_set_keep_unknown_chunks().
|
||||
Added huge_IDAT.png and empty_ancillary_chunks.png to testpngs/crashers.
|
||||
Make pngtest --strict, --relax, --xfail options imply -m (multiple).
|
||||
Removed unused chunk_name parameter from png_check_chunk_length().
|
||||
Relocated setting free_me for eXIf data, to stop an OSS-fuzz leak.
|
||||
Initialize profile_header[] in png_handle_iCCP() to fix OSS-fuzz issue.
|
||||
Initialize png_ptr->row_buf[0] to 255 in png_read_row() to fix OSS-fuzz UMR.
|
||||
Attempt to fix a UMR in png_set_text_2() to fix OSS-fuzz issue.
|
||||
Increase minimum zlib stream from 9 to 14 in png_handle_iCCP(), to account
|
||||
for the minimum 'deflate' stream, and relocate the test to a point
|
||||
after the keyword has been read.
|
||||
Check that the eXIf chunk has at least 2 bytes and begins with "II" or "MM".
|
||||
Added a set of "huge_xxxx_chunk.png" files to contrib/testpngs/crashers,
|
||||
one for each known chunk type, with length = 2GB-1.
|
||||
Check for 0 return from png_get_rowbytes() and added some (size_t) typecasts
|
||||
in contrib/pngminus/*.c to stop some Coverity issues (162705, 162706,
|
||||
and 162707).
|
||||
Renamed chunks in contrib/testpngs/crashers to avoid having files whose
|
||||
names differ only in case; this causes problems with some platforms
|
||||
(github issue #172).
|
||||
Added contrib/oss-fuzz directory which contains files used by the oss-fuzz
|
||||
project (https://github.com/google/oss-fuzz/tree/master/projects/libpng).
|
||||
Changes since the last public release (1.6.33):
|
||||
Removed contrib/pngsuite/i*.png; some of these were incorrect and caused
|
||||
test failures.
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
|
51
src/3rdparty/libpng/CHANGES
vendored
51
src/3rdparty/libpng/CHANGES
vendored
@ -833,7 +833,7 @@ Version 1.0.7beta11 [May 7, 2000]
|
||||
Removed the new PNG_CREATED_READ_STRUCT and PNG_CREATED_WRITE_STRUCT modes
|
||||
which are no longer used.
|
||||
Eliminated the three new members of png_text when PNG_LEGACY_SUPPORTED is
|
||||
defined or when neither PNG_READ_iTXt_SUPPORTED nor PNG_WRITE_iTXT_SUPPORTED
|
||||
defined or when neither PNG_READ_iTXt_SUPPORTED nor PNG_WRITE_iTXt_SUPPORTED
|
||||
is defined.
|
||||
Made PNG_NO_READ|WRITE_iTXt the default setting, to avoid memory
|
||||
overrun when old applications fill the info_ptr->text structure directly.
|
||||
@ -5939,7 +5939,7 @@ Version 1.6.32beta06 [August 2, 2017]
|
||||
|
||||
Version 1.6.32beta07 [August 3, 2017]
|
||||
Check length of all chunks except IDAT against user limit to fix an
|
||||
OSS-fuzz issue.
|
||||
OSS-fuzz issue (Fixes CVE-2017-12652).
|
||||
|
||||
Version 1.6.32beta08 [August 3, 2017]
|
||||
Check length of IDAT against maximum possible IDAT size, accounting
|
||||
@ -5994,6 +5994,53 @@ Version 1.6.32rc02 [August 22, 2017]
|
||||
Version 1.6.32 [August 24, 2017]
|
||||
No changes.
|
||||
|
||||
Version 1.6.33beta01 [August 28, 2017]
|
||||
Added PNGMINUS_UNUSED macro to contrib/pngminus/p*.c and added missing
|
||||
parenthesis in contrib/pngminus/pnm2png.c (bug report by Christian Hesse).
|
||||
Fixed off-by-one error in png_do_check_palette_indexes() (Bug report
|
||||
by Mick P., Source Forge Issue #269).
|
||||
|
||||
Version 1.6.33beta02 [September 3, 2017]
|
||||
Initialize png_handler.row_ptr in contrib/oss-fuzz/libpng_read_fuzzer.cc
|
||||
to fix shortlived oss-fuzz issue 3234.
|
||||
Compute a larger limit on IDAT because some applications write a deflate
|
||||
buffer for each row (Bug report by Andrew Church).
|
||||
Use current date (DATE) instead of release-date (RDATE) in last
|
||||
changed date of contrib/oss-fuzz files.
|
||||
Enabled ARM support in CMakeLists.txt (Bernd Kuhls).
|
||||
|
||||
Version 1.6.33beta03 [September 14, 2017]
|
||||
Fixed incorrect typecast of some arguments to png_malloc() and
|
||||
png_calloc() that were png_uint_32 instead of png_alloc_size_t
|
||||
(Bug report by "irwir" in Github libpng issue #175).
|
||||
Use pnglibconf.h.prebuilt when building for ANDROID with cmake (Github
|
||||
issue 162, by rcdailey).
|
||||
|
||||
Version 1.6.33rc01 [September 20, 2017]
|
||||
Initialize memory allocated by png_inflate to zero, using memset, to
|
||||
stop an oss-fuzz "use of uninitialized value" detection in png_set_text_2()
|
||||
due to truncated iTXt or zTXt chunk.
|
||||
Initialize memory allocated by png_read_buffer to zero, using memset, to
|
||||
stop an oss-fuzz "use of uninitialized value" detection in
|
||||
png_icc_check_tag_table() due to truncated iCCP chunk.
|
||||
Removed a redundant test (suggested by "irwir" in Github issue #180).
|
||||
|
||||
Version 1.6.33rc02 [September 23, 2017]
|
||||
Added an interlaced version of each file in contrib/pngsuite.
|
||||
Relocate new memset() call in pngrutil.c.
|
||||
Removed more redundant tests (suggested by "irwir" in Github issue #180).
|
||||
Add support for loading images with associated alpha in the Simplified
|
||||
API (Samuel Williams).
|
||||
|
||||
Version 1.6.33 [September 28, 2017]
|
||||
Revert contrib/oss-fuzz/libpng_read_fuzzer.cc to libpng-1.6.32 state.
|
||||
Initialize png_handler.row_ptr in contrib/oss-fuzz/libpng_read_fuzzer.cc
|
||||
Add end_info structure and png_read_end() to the libpng fuzzer.
|
||||
|
||||
Version 1.6.34 [September 29, 2017]
|
||||
Removed contrib/pngsuite/i*.png; some of these were incorrect and caused
|
||||
test failures.
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
||||
|
4
src/3rdparty/libpng/LICENSE
vendored
4
src/3rdparty/libpng/LICENSE
vendored
@ -10,7 +10,7 @@ this sentence.
|
||||
|
||||
This code is released under the libpng license.
|
||||
|
||||
libpng versions 1.0.7, July 1, 2000 through 1.6.32, August 24, 2017 are
|
||||
libpng versions 1.0.7, July 1, 2000 through 1.6.34, September 29, 2017 are
|
||||
Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are
|
||||
derived from libpng-1.0.6, and are distributed according to the same
|
||||
disclaimer and license as libpng-1.0.6 with the following individuals
|
||||
@ -130,4 +130,4 @@ any encryption software. See the EAR, paragraphs 734.3(b)(3) and
|
||||
|
||||
Glenn Randers-Pehrson
|
||||
glennrp at users.sourceforge.net
|
||||
April 1, 2017
|
||||
September 29, 2017
|
||||
|
2
src/3rdparty/libpng/README
vendored
2
src/3rdparty/libpng/README
vendored
@ -1,4 +1,4 @@
|
||||
README for libpng version 1.6.32 - August 24, 2017 (shared library 16.0)
|
||||
README for libpng version 1.6.34 - September 29, 2017 (shared library 16.0)
|
||||
See the note about version numbers near the top of png.h
|
||||
|
||||
See INSTALL for instructions on how to install libpng.
|
||||
|
21
src/3rdparty/libpng/libpng-manual.txt
vendored
21
src/3rdparty/libpng/libpng-manual.txt
vendored
@ -1,6 +1,6 @@
|
||||
libpng-manual.txt - A description on how to use and modify libpng
|
||||
|
||||
libpng version 1.6.32 - August 24, 2017
|
||||
libpng version 1.6.34 - September 29, 2017
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
<glennrp at users.sourceforge.net>
|
||||
Copyright (c) 1998-2017 Glenn Randers-Pehrson
|
||||
@ -11,7 +11,7 @@ libpng-manual.txt - A description on how to use and modify libpng
|
||||
|
||||
Based on:
|
||||
|
||||
libpng versions 0.97, January 1998, through 1.6.32 - August 24, 2017
|
||||
libpng versions 0.97, January 1998, through 1.6.34 - September 29, 2017
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
Copyright (c) 1998-2017 Glenn Randers-Pehrson
|
||||
|
||||
@ -986,8 +986,17 @@ premultiplication.
|
||||
|
||||
png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_DEFAULT_sRGB);
|
||||
|
||||
This is the default libpng handling of the alpha channel - it is not
|
||||
pre-multiplied into the color components. In addition the call states
|
||||
Choices for the alpha_mode are
|
||||
|
||||
PNG_ALPHA_PNG 0 /* according to the PNG standard */
|
||||
PNG_ALPHA_STANDARD 1 /* according to Porter/Duff */
|
||||
PNG_ALPHA_ASSOCIATED 1 /* as above; this is the normal practice */
|
||||
PNG_ALPHA_PREMULTIPLIED 1 /* as above */
|
||||
PNG_ALPHA_OPTIMIZED 2 /* 'PNG' for opaque pixels, else 'STANDARD' */
|
||||
PNG_ALPHA_BROKEN 3 /* the alpha channel is gamma encoded */
|
||||
|
||||
PNG_ALPHA_PNG is the default libpng handling of the alpha channel. It is not
|
||||
pre-multiplied into the color components. In addition the call states
|
||||
that the output is for a sRGB system and causes all PNG files without gAMA
|
||||
chunks to be assumed to be encoded using sRGB.
|
||||
|
||||
@ -1002,7 +1011,7 @@ early Mac systems behaved.
|
||||
This is the classic Jim Blinn approach and will work in academic
|
||||
environments where everything is done by the book. It has the shortcoming
|
||||
of assuming that input PNG data with no gamma information is linear - this
|
||||
is unlikely to be correct unless the PNG files where generated locally.
|
||||
is unlikely to be correct unless the PNG files were generated locally.
|
||||
Most of the time the output precision will be so low as to show
|
||||
significant banding in dark areas of the image.
|
||||
|
||||
@ -5405,7 +5414,7 @@ Since the PNG Development group is an ad-hoc body, we can't make
|
||||
an official declaration.
|
||||
|
||||
This is your unofficial assurance that libpng from version 0.71 and
|
||||
upward through 1.6.32 are Y2K compliant. It is my belief that earlier
|
||||
upward through 1.6.34 are Y2K compliant. It is my belief that earlier
|
||||
versions were also Y2K compliant.
|
||||
|
||||
Libpng only has two year fields. One is a 2-byte unsigned integer
|
||||
|
34
src/3rdparty/libpng/png.c
vendored
34
src/3rdparty/libpng/png.c
vendored
@ -1,7 +1,7 @@
|
||||
|
||||
/* png.c - location for general purpose libpng functions
|
||||
*
|
||||
* Last changed in libpng 1.6.32 [August 24, 2017]
|
||||
* Last changed in libpng 1.6.33 [September 28, 2017]
|
||||
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
@ -14,7 +14,7 @@
|
||||
#include "pngpriv.h"
|
||||
|
||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||
typedef png_libpng_version_1_6_32 Your_png_h_is_not_version_1_6_32;
|
||||
typedef png_libpng_version_1_6_34 Your_png_h_is_not_version_1_6_34;
|
||||
|
||||
#ifdef __GNUC__
|
||||
/* The version tests may need to be added to, but the problem warning has
|
||||
@ -816,14 +816,14 @@ png_get_copyright(png_const_structrp png_ptr)
|
||||
#else
|
||||
# ifdef __STDC__
|
||||
return PNG_STRING_NEWLINE \
|
||||
"libpng version 1.6.32 - August 24, 2017" PNG_STRING_NEWLINE \
|
||||
"libpng version 1.6.34 - September 29, 2017" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson" \
|
||||
PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
|
||||
PNG_STRING_NEWLINE;
|
||||
# else
|
||||
return "libpng version 1.6.32 - August 24, 2017\
|
||||
return "libpng version 1.6.34 - September 29, 2017\
|
||||
Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson\
|
||||
Copyright (c) 1996-1997 Andreas Dilger\
|
||||
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
|
||||
@ -1913,12 +1913,12 @@ png_colorspace_set_sRGB(png_const_structrp png_ptr, png_colorspacerp colorspace,
|
||||
*/
|
||||
if (intent < 0 || intent >= PNG_sRGB_INTENT_LAST)
|
||||
return png_icc_profile_error(png_ptr, colorspace, "sRGB",
|
||||
(unsigned)intent, "invalid sRGB rendering intent");
|
||||
(png_alloc_size_t)intent, "invalid sRGB rendering intent");
|
||||
|
||||
if ((colorspace->flags & PNG_COLORSPACE_HAVE_INTENT) != 0 &&
|
||||
colorspace->rendering_intent != intent)
|
||||
return png_icc_profile_error(png_ptr, colorspace, "sRGB",
|
||||
(unsigned)intent, "inconsistent rendering intents");
|
||||
(png_alloc_size_t)intent, "inconsistent rendering intents");
|
||||
|
||||
if ((colorspace->flags & PNG_COLORSPACE_FROM_sRGB) != 0)
|
||||
{
|
||||
@ -1979,7 +1979,6 @@ icc_check_length(png_const_structrp png_ptr, png_colorspacerp colorspace,
|
||||
if (profile_length < 132)
|
||||
return png_icc_profile_error(png_ptr, colorspace, name, profile_length,
|
||||
"too short");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -2224,15 +2223,6 @@ png_icc_check_tag_table(png_const_structrp png_ptr, png_colorspacerp colorspace,
|
||||
* being in range. All defined tag types have an 8 byte header - a 4 byte
|
||||
* type signature then 0.
|
||||
*/
|
||||
if ((tag_start & 3) != 0)
|
||||
{
|
||||
/* CNHP730S.icc shipped with Microsoft Windows 64 violates this, it is
|
||||
* only a warning here because libpng does not care about the
|
||||
* alignment.
|
||||
*/
|
||||
(void)png_icc_profile_error(png_ptr, NULL, name, tag_id,
|
||||
"ICC profile tag start not a multiple of 4");
|
||||
}
|
||||
|
||||
/* This is a hard error; potentially it can cause read outside the
|
||||
* profile.
|
||||
@ -2240,6 +2230,16 @@ png_icc_check_tag_table(png_const_structrp png_ptr, png_colorspacerp colorspace,
|
||||
if (tag_start > profile_length || tag_length > profile_length - tag_start)
|
||||
return png_icc_profile_error(png_ptr, colorspace, name, tag_id,
|
||||
"ICC profile tag outside profile");
|
||||
|
||||
if ((tag_start & 3) != 0)
|
||||
{
|
||||
/* CNHP730S.icc shipped with Microsoft Windows 64 violates this; it is
|
||||
* only a warning here because libpng does not care about the
|
||||
* alignment.
|
||||
*/
|
||||
(void)png_icc_profile_error(png_ptr, NULL, name, tag_id,
|
||||
"ICC profile tag start not a multiple of 4");
|
||||
}
|
||||
}
|
||||
|
||||
return 1; /* success, maybe with warnings */
|
||||
@ -3761,7 +3761,7 @@ png_log16bit(png_uint_32 x)
|
||||
* of getting this accuracy in practice.
|
||||
*
|
||||
* To deal with this the following exp() function works out the exponent of the
|
||||
* frational part of the logarithm by using an accurate 32-bit value from the
|
||||
* fractional part of the logarithm by using an accurate 32-bit value from the
|
||||
* top four fractional bits then multiplying in the remaining bits.
|
||||
*/
|
||||
static const png_uint_32
|
||||
|
28
src/3rdparty/libpng/png.h
vendored
28
src/3rdparty/libpng/png.h
vendored
@ -1,7 +1,7 @@
|
||||
|
||||
/* png.h - header file for PNG reference library
|
||||
*
|
||||
* libpng version 1.6.32, August 24, 2017
|
||||
* libpng version 1.6.34, September 29, 2017
|
||||
*
|
||||
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
@ -12,7 +12,7 @@
|
||||
* Authors and maintainers:
|
||||
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
|
||||
* libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
|
||||
* libpng versions 0.97, January 1998, through 1.6.32, August 24, 2017:
|
||||
* libpng versions 0.97, January 1998, through 1.6.34, September 29, 2017:
|
||||
* Glenn Randers-Pehrson.
|
||||
* See also "Contributing Authors", below.
|
||||
*/
|
||||
@ -25,7 +25,7 @@
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
*
|
||||
* libpng versions 1.0.7, July 1, 2000 through 1.6.32, August 24, 2017 are
|
||||
* libpng versions 1.0.7, July 1, 2000 through 1.6.34, September 29, 2017 are
|
||||
* Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are
|
||||
* derived from libpng-1.0.6, and are distributed according to the same
|
||||
* disclaimer and license as libpng-1.0.6 with the following individuals
|
||||
@ -209,11 +209,11 @@
|
||||
* ...
|
||||
* 1.0.19 10 10019 10.so.0.19[.0]
|
||||
* ...
|
||||
* 1.2.57 13 10257 12.so.0.57[.0]
|
||||
* 1.2.59 13 10257 12.so.0.59[.0]
|
||||
* ...
|
||||
* 1.5.28 15 10527 15.so.15.28[.0]
|
||||
* 1.5.30 15 10527 15.so.15.30[.0]
|
||||
* ...
|
||||
* 1.6.32 16 10632 16.so.16.32[.0]
|
||||
* 1.6.34 16 10633 16.so.16.34[.0]
|
||||
*
|
||||
* Henceforth the source version will match the shared-library major
|
||||
* and minor numbers; the shared-library major version number will be
|
||||
@ -241,13 +241,13 @@
|
||||
* Y2K compliance in libpng:
|
||||
* =========================
|
||||
*
|
||||
* August 24, 2017
|
||||
* September 29, 2017
|
||||
*
|
||||
* Since the PNG Development group is an ad-hoc body, we can't make
|
||||
* an official declaration.
|
||||
*
|
||||
* This is your unofficial assurance that libpng from version 0.71 and
|
||||
* upward through 1.6.32 are Y2K compliant. It is my belief that
|
||||
* upward through 1.6.34 are Y2K compliant. It is my belief that
|
||||
* earlier versions were also Y2K compliant.
|
||||
*
|
||||
* Libpng only has two year fields. One is a 2-byte unsigned integer
|
||||
@ -309,8 +309,8 @@
|
||||
*/
|
||||
|
||||
/* Version information for png.h - this should match the version in png.c */
|
||||
#define PNG_LIBPNG_VER_STRING "1.6.32"
|
||||
#define PNG_HEADER_VERSION_STRING " libpng version 1.6.32 - August 24, 2017\n"
|
||||
#define PNG_LIBPNG_VER_STRING "1.6.34"
|
||||
#define PNG_HEADER_VERSION_STRING " libpng version 1.6.34 - September 29, 2017\n"
|
||||
|
||||
#define PNG_LIBPNG_VER_SONUM 16
|
||||
#define PNG_LIBPNG_VER_DLLNUM 16
|
||||
@ -318,7 +318,7 @@
|
||||
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
|
||||
#define PNG_LIBPNG_VER_MAJOR 1
|
||||
#define PNG_LIBPNG_VER_MINOR 6
|
||||
#define PNG_LIBPNG_VER_RELEASE 32
|
||||
#define PNG_LIBPNG_VER_RELEASE 34
|
||||
|
||||
/* This should match the numeric part of the final component of
|
||||
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
|
||||
@ -349,7 +349,7 @@
|
||||
* version 1.0.0 was mis-numbered 100 instead of 10000). From
|
||||
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release
|
||||
*/
|
||||
#define PNG_LIBPNG_VER 10632 /* 1.6.32 */
|
||||
#define PNG_LIBPNG_VER 10634 /* 1.6.34 */
|
||||
|
||||
/* Library configuration: these options cannot be changed after
|
||||
* the library has been built.
|
||||
@ -459,7 +459,7 @@ extern "C" {
|
||||
/* This triggers a compiler error in png.c, if png.c and png.h
|
||||
* do not agree upon the version number.
|
||||
*/
|
||||
typedef char* png_libpng_version_1_6_32;
|
||||
typedef char* png_libpng_version_1_6_34;
|
||||
|
||||
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
|
||||
*
|
||||
@ -2819,6 +2819,8 @@ typedef struct
|
||||
# define PNG_FORMAT_FLAG_AFIRST 0x20U /* alpha channel comes first */
|
||||
#endif
|
||||
|
||||
#define PNG_FORMAT_FLAG_ASSOCIATED_ALPHA 0x40U /* alpha channel is associated */
|
||||
|
||||
/* Commonly used formats have predefined macros.
|
||||
*
|
||||
* First the single byte (sRGB) formats:
|
||||
|
2
src/3rdparty/libpng/pngconf.h
vendored
2
src/3rdparty/libpng/pngconf.h
vendored
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngconf.h - machine configurable file for libpng
|
||||
*
|
||||
* libpng version 1.6.32, August 24, 2017
|
||||
* libpng version 1.6.34, September 29, 2017
|
||||
*
|
||||
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
|
4
src/3rdparty/libpng/pnglibconf.h
vendored
4
src/3rdparty/libpng/pnglibconf.h
vendored
@ -1,8 +1,8 @@
|
||||
/* libpng 1.6.32 STANDARD API DEFINITION */
|
||||
/* libpng 1.6.34 STANDARD API DEFINITION */
|
||||
|
||||
/* pnglibconf.h - library build configuration */
|
||||
|
||||
/* Libpng version 1.6.32 - August 24, 2017 */
|
||||
/* Libpng version 1.6.34 - September 29, 2017 */
|
||||
|
||||
/* Copyright (c) 1998-2017 Glenn Randers-Pehrson */
|
||||
|
||||
|
14
src/3rdparty/libpng/pngread.c
vendored
14
src/3rdparty/libpng/pngread.c
vendored
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngread.c - read a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.6.32 [August 24, 2017]
|
||||
* Last changed in libpng 1.6.33 [September 28, 2017]
|
||||
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
@ -3759,7 +3759,13 @@ png_image_read_direct(png_voidp argument)
|
||||
mode = PNG_ALPHA_PNG;
|
||||
output_gamma = PNG_DEFAULT_sRGB;
|
||||
}
|
||||
|
||||
|
||||
if ((change & PNG_FORMAT_FLAG_ASSOCIATED_ALPHA) != 0)
|
||||
{
|
||||
mode = PNG_ALPHA_OPTIMIZED;
|
||||
change &= ~PNG_FORMAT_FLAG_ASSOCIATED_ALPHA;
|
||||
}
|
||||
|
||||
/* If 'do_local_background' is set check for the presence of gamma
|
||||
* correction; this is part of the work-round for the libpng bug
|
||||
* described above.
|
||||
@ -3985,6 +3991,10 @@ png_image_read_direct(png_voidp argument)
|
||||
else if (do_local_compose != 0) /* internal error */
|
||||
png_error(png_ptr, "png_image_read: alpha channel lost");
|
||||
|
||||
if ((format & PNG_FORMAT_FLAG_ASSOCIATED_ALPHA) != 0) {
|
||||
info_format |= PNG_FORMAT_FLAG_ASSOCIATED_ALPHA;
|
||||
}
|
||||
|
||||
if (info_ptr->bit_depth == 16)
|
||||
info_format |= PNG_FORMAT_FLAG_LINEAR;
|
||||
|
||||
|
22
src/3rdparty/libpng/pngrtran.c
vendored
22
src/3rdparty/libpng/pngrtran.c
vendored
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngrtran.c - transforms the data in a row for PNG readers
|
||||
*
|
||||
* Last changed in libpng 1.6.31 [July 27, 2017]
|
||||
* Last changed in libpng 1.6.33 [September 28, 2017]
|
||||
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
@ -430,7 +430,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
|
||||
int i;
|
||||
|
||||
png_ptr->quantize_index = (png_bytep)png_malloc(png_ptr,
|
||||
(png_uint_32)((png_uint_32)num_palette * (sizeof (png_byte))));
|
||||
(png_alloc_size_t)((png_uint_32)num_palette * (sizeof (png_byte))));
|
||||
for (i = 0; i < num_palette; i++)
|
||||
png_ptr->quantize_index[i] = (png_byte)i;
|
||||
}
|
||||
@ -447,7 +447,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
|
||||
|
||||
/* Initialize an array to sort colors */
|
||||
png_ptr->quantize_sort = (png_bytep)png_malloc(png_ptr,
|
||||
(png_uint_32)((png_uint_32)num_palette * (sizeof (png_byte))));
|
||||
(png_alloc_size_t)((png_uint_32)num_palette * (sizeof (png_byte))));
|
||||
|
||||
/* Initialize the quantize_sort array */
|
||||
for (i = 0; i < num_palette; i++)
|
||||
@ -581,9 +581,11 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
|
||||
|
||||
/* Initialize palette index arrays */
|
||||
png_ptr->index_to_palette = (png_bytep)png_malloc(png_ptr,
|
||||
(png_uint_32)((png_uint_32)num_palette * (sizeof (png_byte))));
|
||||
(png_alloc_size_t)((png_uint_32)num_palette *
|
||||
(sizeof (png_byte))));
|
||||
png_ptr->palette_to_index = (png_bytep)png_malloc(png_ptr,
|
||||
(png_uint_32)((png_uint_32)num_palette * (sizeof (png_byte))));
|
||||
(png_alloc_size_t)((png_uint_32)num_palette *
|
||||
(sizeof (png_byte))));
|
||||
|
||||
/* Initialize the sort array */
|
||||
for (i = 0; i < num_palette; i++)
|
||||
@ -592,7 +594,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
|
||||
png_ptr->palette_to_index[i] = (png_byte)i;
|
||||
}
|
||||
|
||||
hash = (png_dsortpp)png_calloc(png_ptr, (png_uint_32)(769 *
|
||||
hash = (png_dsortpp)png_calloc(png_ptr, (png_alloc_size_t)(769 *
|
||||
(sizeof (png_dsortp))));
|
||||
|
||||
num_new_palette = num_palette;
|
||||
@ -623,7 +625,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
|
||||
{
|
||||
|
||||
t = (png_dsortp)png_malloc_warn(png_ptr,
|
||||
(png_uint_32)(sizeof (png_dsort)));
|
||||
(png_alloc_size_t)(sizeof (png_dsort)));
|
||||
|
||||
if (t == NULL)
|
||||
break;
|
||||
@ -748,9 +750,9 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
|
||||
png_size_t num_entries = ((png_size_t)1 << total_bits);
|
||||
|
||||
png_ptr->palette_lookup = (png_bytep)png_calloc(png_ptr,
|
||||
(png_uint_32)(num_entries * (sizeof (png_byte))));
|
||||
(png_alloc_size_t)(num_entries * (sizeof (png_byte))));
|
||||
|
||||
distance = (png_bytep)png_malloc(png_ptr, (png_uint_32)(num_entries *
|
||||
distance = (png_bytep)png_malloc(png_ptr, (png_alloc_size_t)(num_entries *
|
||||
(sizeof (png_byte))));
|
||||
|
||||
memset(distance, 0xff, num_entries * (sizeof (png_byte)));
|
||||
@ -3322,7 +3324,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
||||
== png_ptr->trans_color.gray)
|
||||
{
|
||||
unsigned int tmp = *sp & (0x0f0f >> (4 - shift));
|
||||
tmp |=
|
||||
tmp |=
|
||||
(unsigned int)(png_ptr->background.gray << shift);
|
||||
*sp = (png_byte)(tmp & 0xff);
|
||||
}
|
||||
|
47
src/3rdparty/libpng/pngrutil.c
vendored
47
src/3rdparty/libpng/pngrutil.c
vendored
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngrutil.c - utilities to read a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.6.32 [August 24, 2017]
|
||||
* Last changed in libpng 1.6.33 [September 28, 2017]
|
||||
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
@ -314,6 +314,7 @@ png_read_buffer(png_structrp png_ptr, png_alloc_size_t new_size, int warn)
|
||||
|
||||
if (buffer != NULL)
|
||||
{
|
||||
memset(buffer, 0, new_size); /* just in case */
|
||||
png_ptr->read_buffer = buffer;
|
||||
png_ptr->read_buffer_size = new_size;
|
||||
}
|
||||
@ -673,6 +674,8 @@ png_decompress_chunk(png_structrp png_ptr,
|
||||
|
||||
if (text != NULL)
|
||||
{
|
||||
memset(text, 0, buffer_size);
|
||||
|
||||
ret = png_inflate(png_ptr, png_ptr->chunk_name, 1/*finish*/,
|
||||
png_ptr->read_buffer + prefix_size, &lzsize,
|
||||
text + prefix_size, newlength);
|
||||
@ -736,9 +739,7 @@ png_decompress_chunk(png_structrp png_ptr,
|
||||
{
|
||||
/* inflateReset failed, store the error message */
|
||||
png_zstream_error(png_ptr, ret);
|
||||
|
||||
if (ret == Z_STREAM_END)
|
||||
ret = PNG_UNEXPECTED_ZLIB_RETURN;
|
||||
ret = PNG_UNEXPECTED_ZLIB_RETURN;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1476,7 +1477,7 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||
/* Now read the tag table; a variable size buffer is
|
||||
* needed at this point, allocate one for the whole
|
||||
* profile. The header check has already validated
|
||||
* that none of these stuff will overflow.
|
||||
* that none of this stuff will overflow.
|
||||
*/
|
||||
const png_uint_32 tag_count = png_get_uint_32(
|
||||
profile_header+128);
|
||||
@ -1583,19 +1584,11 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
else if (size > 0)
|
||||
errmsg = "truncated";
|
||||
|
||||
#ifndef __COVERITY__
|
||||
else
|
||||
if (errmsg == NULL)
|
||||
errmsg = png_ptr->zstream.msg;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* else png_icc_check_tag_table output an error */
|
||||
}
|
||||
|
||||
else /* profile truncated */
|
||||
errmsg = png_ptr->zstream.msg;
|
||||
}
|
||||
@ -3144,28 +3137,28 @@ png_check_chunk_length(png_const_structrp png_ptr, const png_uint_32 length)
|
||||
{
|
||||
png_alloc_size_t limit = PNG_UINT_31_MAX;
|
||||
|
||||
if (png_ptr->chunk_name != png_IDAT)
|
||||
{
|
||||
# ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
||||
if (png_ptr->user_chunk_malloc_max > 0 &&
|
||||
png_ptr->user_chunk_malloc_max < limit)
|
||||
limit = png_ptr->user_chunk_malloc_max;
|
||||
if (png_ptr->user_chunk_malloc_max > 0 &&
|
||||
png_ptr->user_chunk_malloc_max < limit)
|
||||
limit = png_ptr->user_chunk_malloc_max;
|
||||
# elif PNG_USER_CHUNK_MALLOC_MAX > 0
|
||||
if (PNG_USER_CHUNK_MALLOC_MAX < limit)
|
||||
limit = PNG_USER_CHUNK_MALLOC_MAX;
|
||||
if (PNG_USER_CHUNK_MALLOC_MAX < limit)
|
||||
limit = PNG_USER_CHUNK_MALLOC_MAX;
|
||||
# endif
|
||||
}
|
||||
else
|
||||
if (png_ptr->chunk_name == png_IDAT)
|
||||
{
|
||||
png_alloc_size_t idat_limit = PNG_UINT_31_MAX;
|
||||
size_t row_factor =
|
||||
(png_ptr->width * png_ptr->channels * (png_ptr->bit_depth > 8? 2: 1)
|
||||
+ 1 + (png_ptr->interlaced? 6: 0));
|
||||
if (png_ptr->height > PNG_UINT_32_MAX/row_factor)
|
||||
limit=PNG_UINT_31_MAX;
|
||||
idat_limit=PNG_UINT_31_MAX;
|
||||
else
|
||||
limit = png_ptr->height * row_factor;
|
||||
limit += 6 + 5*(limit/32566+1); /* zlib+deflate overhead */
|
||||
limit=limit < PNG_UINT_31_MAX? limit : PNG_UINT_31_MAX;
|
||||
idat_limit = png_ptr->height * row_factor;
|
||||
row_factor = row_factor > 32566? 32566 : row_factor;
|
||||
idat_limit += 6 + 5*(idat_limit/row_factor+1); /* zlib+deflate overhead */
|
||||
idat_limit=idat_limit < PNG_UINT_31_MAX? idat_limit : PNG_UINT_31_MAX;
|
||||
limit = limit < idat_limit? idat_limit : limit;
|
||||
}
|
||||
|
||||
if (length > limit)
|
||||
|
6
src/3rdparty/libpng/pngtrans.c
vendored
6
src/3rdparty/libpng/pngtrans.c
vendored
@ -1,7 +1,7 @@
|
||||
|
||||
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
||||
*
|
||||
* Last changed in libpng 1.6.30 [June 28, 2017]
|
||||
* Last changed in libpng 1.6.33 [September 28, 2017]
|
||||
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
@ -609,7 +609,7 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
|
||||
return; /* The filler channel has gone already */
|
||||
|
||||
/* Fix the rowbytes value. */
|
||||
row_info->rowbytes = (unsigned int)(dp-row);
|
||||
row_info->rowbytes = (png_size_t)(dp-row);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -708,7 +708,7 @@ png_do_check_palette_indexes(png_structrp png_ptr, png_row_infop row_info)
|
||||
* forms produced on either GCC or MSVC.
|
||||
*/
|
||||
int padding = PNG_PADBITS(row_info->pixel_depth, row_info->width);
|
||||
png_bytep rp = png_ptr->row_buf + row_info->rowbytes;
|
||||
png_bytep rp = png_ptr->row_buf + row_info->rowbytes - 1;
|
||||
|
||||
switch (row_info->bit_depth)
|
||||
{
|
||||
|
2
src/3rdparty/libpng/pngwrite.c
vendored
2
src/3rdparty/libpng/pngwrite.c
vendored
@ -1940,7 +1940,7 @@ png_image_write_main(png_voidp argument)
|
||||
int colormap = (format & PNG_FORMAT_FLAG_COLORMAP);
|
||||
int linear = !colormap && (format & PNG_FORMAT_FLAG_LINEAR); /* input */
|
||||
int alpha = !colormap && (format & PNG_FORMAT_FLAG_ALPHA);
|
||||
int write_16bit = linear && !colormap && (display->convert_to_8bit == 0);
|
||||
int write_16bit = linear && (display->convert_to_8bit == 0);
|
||||
|
||||
# ifdef PNG_BENIGN_ERRORS_SUPPORTED
|
||||
/* Make sure we error out on any bad situation */
|
||||
|
2
src/3rdparty/libpng/qt_attribution.json
vendored
2
src/3rdparty/libpng/qt_attribution.json
vendored
@ -6,7 +6,7 @@
|
||||
|
||||
"Description": "libpng is the official PNG reference library.",
|
||||
"Homepage": "http://www.libpng.org/pub/png/libpng.html",
|
||||
"Version": "1.6.32",
|
||||
"Version": "1.6.34",
|
||||
"License": "libpng License",
|
||||
"LicenseId": "Libpng",
|
||||
"LicenseFile": "LICENSE",
|
||||
|
@ -1347,12 +1347,12 @@
|
||||
} while (false)
|
||||
|
||||
#if defined(__cplusplus)
|
||||
#if QT_HAS_CPP_ATTRIBUTE(fallthrough)
|
||||
# define Q_FALLTHROUGH() [[fallthrough]]
|
||||
#elif QT_HAS_CPP_ATTRIBUTE(clang::fallthrough)
|
||||
#if QT_HAS_CPP_ATTRIBUTE(clang::fallthrough)
|
||||
# define Q_FALLTHROUGH() [[clang::fallthrough]]
|
||||
#elif QT_HAS_CPP_ATTRIBUTE(gnu::fallthrough)
|
||||
# define Q_FALLTHROUGH() [[gnu::fallthrough]]
|
||||
#elif QT_HAS_CPP_ATTRIBUTE(fallthrough)
|
||||
# define Q_FALLTHROUGH() [[fallthrough]]
|
||||
#endif
|
||||
#endif
|
||||
#ifndef Q_FALLTHROUGH
|
||||
|
@ -308,7 +308,7 @@ void QWindowsRemovableDriveListener::addPath(const QString &p)
|
||||
notify.dbch_size = sizeof(notify);
|
||||
notify.dbch_devicetype = DBT_DEVTYP_HANDLE;
|
||||
notify.dbch_handle = volumeHandle;
|
||||
QEventDispatcherWin32 *winEventDispatcher = static_cast<QEventDispatcherWin32 *>(QCoreApplication::eventDispatcher());
|
||||
QEventDispatcherWin32 *winEventDispatcher = static_cast<QEventDispatcherWin32 *>(QAbstractEventDispatcher::instance());
|
||||
re.devNotify = RegisterDeviceNotification(winEventDispatcher->internalHwnd(),
|
||||
¬ify, DEVICE_NOTIFY_WINDOW_HANDLE);
|
||||
// Empirically found: The notifications also work when the handle is immediately
|
||||
@ -336,7 +336,7 @@ QWindowsFileSystemWatcherEngine::QWindowsFileSystemWatcherEngine(QObject *parent
|
||||
: QFileSystemWatcherEngine(parent)
|
||||
{
|
||||
#ifndef Q_OS_WINRT
|
||||
if (QAbstractEventDispatcher *eventDispatcher = QCoreApplication::eventDispatcher()) {
|
||||
if (QAbstractEventDispatcher *eventDispatcher = QAbstractEventDispatcher::instance()) {
|
||||
m_driveListener = new QWindowsRemovableDriveListener(this);
|
||||
eventDispatcher->installNativeEventFilter(m_driveListener);
|
||||
parent->setProperty("_q_driveListener",
|
||||
|
@ -544,6 +544,38 @@ void QStorageInfoPrivate::initRootPath()
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
// udev encodes the labels with ID_LABEL_FS_ENC which is done with
|
||||
// blkid_encode_string(). Within this function some 1-byte utf-8
|
||||
// characters not considered safe (e.g. '\' or ' ') are encoded as hex
|
||||
static QString decodeFsEncString(const QString &str)
|
||||
{
|
||||
QString decoded;
|
||||
decoded.reserve(str.size());
|
||||
|
||||
int i = 0;
|
||||
while (i < str.size()) {
|
||||
if (i <= str.size() - 4) { // we need at least four characters \xAB
|
||||
if (str.at(i) == QLatin1Char('\\') &&
|
||||
str.at(i+1) == QLatin1Char('x')) {
|
||||
bool bOk;
|
||||
const int code = str.midRef(i+2, 2).toInt(&bOk, 16);
|
||||
// only decode characters between 0x20 and 0x7f but not
|
||||
// the backslash to prevent collisions
|
||||
if (bOk && code >= 0x20 && code < 0x80 && code != '\\') {
|
||||
decoded += QChar(code);
|
||||
i += 4;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
decoded += str.at(i);
|
||||
++i;
|
||||
}
|
||||
return decoded;
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline QString retrieveLabel(const QByteArray &device)
|
||||
{
|
||||
#ifdef Q_OS_LINUX
|
||||
@ -557,7 +589,7 @@ static inline QString retrieveLabel(const QByteArray &device)
|
||||
it.next();
|
||||
QFileInfo fileInfo(it.fileInfo());
|
||||
if (fileInfo.isSymLink() && fileInfo.symLinkTarget() == devicePath)
|
||||
return fileInfo.fileName();
|
||||
return decodeFsEncString(fileInfo.fileName());
|
||||
}
|
||||
#elif defined Q_OS_HAIKU
|
||||
fs_info fsInfo;
|
||||
|
@ -339,6 +339,7 @@ static void qt_initialize_qhash_seed()
|
||||
*/
|
||||
int qGlobalQHashSeed()
|
||||
{
|
||||
qt_initialize_qhash_seed();
|
||||
return qt_qhash_seed.load();
|
||||
}
|
||||
|
||||
|
@ -388,7 +388,7 @@ QVersionNumber QVersionNumber::commonPrefix(const QVersionNumber &v1,
|
||||
/*!
|
||||
\fn QString QVersionNumber::toString() const
|
||||
|
||||
Returns a string with all of the segments delimited by a '.'.
|
||||
Returns a string with all of the segments delimited by a period (\c{.}).
|
||||
|
||||
\sa majorVersion(), minorVersion(), microVersion(), segments()
|
||||
*/
|
||||
@ -409,7 +409,7 @@ QString QVersionNumber::toString() const
|
||||
#if QT_STRINGVIEW_LEVEL < 2
|
||||
/*!
|
||||
Constructs a QVersionNumber from a specially formatted \a string of
|
||||
non-negative decimal numbers delimited by '.'.
|
||||
non-negative decimal numbers delimited by a period (\c{.}).
|
||||
|
||||
Once the numerical segments have been parsed, the remainder of the string
|
||||
is considered to be the suffix string. The start index of that string will be
|
||||
|
@ -402,7 +402,8 @@ inline QRegion fromNativeLocalExposedRegion(const QRegion &pixelRegion, const QW
|
||||
const QPointF topLeftP = rect.topLeft() / scaleFactor;
|
||||
const QSizeF sizeP = rect.size() / scaleFactor;
|
||||
pointRegion += QRect(QPoint(qFloor(topLeftP.x()), qFloor(topLeftP.y())),
|
||||
QSize(qCeil(sizeP.width()), qCeil(sizeP.height())));
|
||||
QPoint(qCeil(topLeftP.x() + sizeP.width() - 1.0),
|
||||
qCeil(topLeftP.y() + sizeP.height() - 1.0)));
|
||||
}
|
||||
return pointRegion;
|
||||
}
|
||||
|
@ -1008,6 +1008,7 @@ bool QOpenGLContext::makeCurrent(QSurface *surface)
|
||||
|| qstrncmp(rendererString, "Adreno 4xx", 8) == 0 // Same as above but without the '(TM)'
|
||||
|| qstrcmp(rendererString, "GC800 core") == 0
|
||||
|| qstrcmp(rendererString, "GC1000 core") == 0
|
||||
|| strstr(rendererString, "GC2000") != 0
|
||||
|| qstrcmp(rendererString, "Immersion.16") == 0;
|
||||
}
|
||||
needsWorkaroundSet = true;
|
||||
|
@ -55,6 +55,7 @@
|
||||
# include "qaccessible.h"
|
||||
#endif
|
||||
#include "qhighdpiscaling_p.h"
|
||||
#include "qshapedpixmapdndwindow_p.h"
|
||||
|
||||
#include <private/qevent_p.h>
|
||||
|
||||
@ -379,7 +380,9 @@ void QWindowPrivate::setVisible(bool visible)
|
||||
QGuiApplicationPrivate::showModalWindow(q);
|
||||
else
|
||||
QGuiApplicationPrivate::hideModalWindow(q);
|
||||
} else if (visible && QGuiApplication::modalWindow()) {
|
||||
// QShapedPixmapWindow is used on some platforms for showing a drag pixmap, so don't block
|
||||
// input to this window as it is performing a drag - QTBUG-63846
|
||||
} else if (visible && QGuiApplication::modalWindow() && !qobject_cast<QShapedPixmapWindow *>(q)) {
|
||||
QGuiApplicationPrivate::updateBlockedStatus(q);
|
||||
}
|
||||
|
||||
|
@ -318,11 +318,12 @@ void QImageTextureGlyphCache::fillTexture(const Coord &c, glyph_t g, QFixed subP
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
Q_ASSERT(mask.width() <= c.w && mask.height() <= c.h);
|
||||
|
||||
if (m_format == QFontEngine::Format_A32
|
||||
|| m_format == QFontEngine::Format_ARGB) {
|
||||
QImage ref(m_image.bits() + (c.x * 4 + c.y * m_image.bytesPerLine()),
|
||||
qMax(mask.width(), c.w), qMax(mask.height(), c.h), m_image.bytesPerLine(),
|
||||
qMin(mask.width(), c.w), qMin(mask.height(), c.h), m_image.bytesPerLine(),
|
||||
m_image.format());
|
||||
QPainter p(&ref);
|
||||
p.setCompositionMode(QPainter::CompositionMode_Source);
|
||||
|
@ -6,7 +6,7 @@ INCLUDEPATH += $$PWD
|
||||
HEADERS += kernel/qtnetworkglobal.h \
|
||||
kernel/qtnetworkglobal_p.h \
|
||||
kernel/qauthenticator.h \
|
||||
kernel/qauthenticator_p.h \
|
||||
kernel/qauthenticator_p.h \
|
||||
kernel/qdnslookup.h \
|
||||
kernel/qdnslookup_p.h \
|
||||
kernel/qhostaddress.h \
|
||||
|
@ -408,13 +408,13 @@ bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType soc
|
||||
// get the pointer to sendmsg and recvmsg
|
||||
DWORD bytesReturned;
|
||||
GUID recvmsgguid = WSAID_WSARECVMSG;
|
||||
if (WSAIoctl(socketDescriptor, SIO_GET_EXTENSION_FUNCTION_POINTER,
|
||||
if (WSAIoctl(socket, SIO_GET_EXTENSION_FUNCTION_POINTER,
|
||||
&recvmsgguid, sizeof(recvmsgguid),
|
||||
&recvmsg, sizeof(recvmsg), &bytesReturned, NULL, NULL) == SOCKET_ERROR)
|
||||
recvmsg = 0;
|
||||
|
||||
GUID sendmsgguid = WSAID_WSASENDMSG;
|
||||
if (WSAIoctl(socketDescriptor, SIO_GET_EXTENSION_FUNCTION_POINTER,
|
||||
if (WSAIoctl(socket, SIO_GET_EXTENSION_FUNCTION_POINTER,
|
||||
&sendmsgguid, sizeof(sendmsgguid),
|
||||
&sendmsg, sizeof(sendmsg), &bytesReturned, NULL, NULL) == SOCKET_ERROR)
|
||||
sendmsg = 0;
|
||||
@ -1255,26 +1255,28 @@ qint64 QNativeSocketEnginePrivate::nativeReceiveDatagram(char *data, qint64 maxL
|
||||
qt_socket_getPortAndAddress(socketDescriptor, &aa, &header->senderPort, &header->senderAddress);
|
||||
}
|
||||
|
||||
if (ret != -1 && recvmsg) {
|
||||
if (ret != -1 && recvmsg && options != QAbstractSocketEngine::WantNone) {
|
||||
// get the ancillary data
|
||||
header->destinationPort = localPort;
|
||||
WSACMSGHDR *cmsgptr;
|
||||
for (cmsgptr = WSA_CMSG_FIRSTHDR(&msg); cmsgptr != NULL;
|
||||
cmsgptr = WSA_CMSG_NXTHDR(&msg, cmsgptr)) {
|
||||
if (cmsgptr->cmsg_level == IPPROTO_IPV6 && cmsgptr->cmsg_type == IPV6_PKTINFO
|
||||
&& cmsgptr->cmsg_len >= WSA_CMSG_LEN(sizeof(in6_pktinfo))) {
|
||||
in6_pktinfo *info = reinterpret_cast<in6_pktinfo *>(WSA_CMSG_DATA(cmsgptr));
|
||||
QHostAddress target(reinterpret_cast<quint8 *>(&info->ipi6_addr));
|
||||
if (info->ipi6_ifindex)
|
||||
target.setScopeId(QString::number(info->ipi6_ifindex));
|
||||
|
||||
header->destinationAddress.setAddress(reinterpret_cast<quint8 *>(&info->ipi6_addr));
|
||||
header->ifindex = info->ipi6_ifindex;
|
||||
if (header->ifindex)
|
||||
header->destinationAddress.setScopeId(QString::number(info->ipi6_ifindex));
|
||||
}
|
||||
if (cmsgptr->cmsg_level == IPPROTO_IP && cmsgptr->cmsg_type == IP_PKTINFO
|
||||
&& cmsgptr->cmsg_len >= WSA_CMSG_LEN(sizeof(in_pktinfo))) {
|
||||
in_pktinfo *info = reinterpret_cast<in_pktinfo *>(WSA_CMSG_DATA(cmsgptr));
|
||||
u_long addr;
|
||||
WSANtohl(socketDescriptor, info->ipi_addr.s_addr, &addr);
|
||||
QHostAddress target(addr);
|
||||
if (info->ipi_ifindex)
|
||||
target.setScopeId(QString::number(info->ipi_ifindex));
|
||||
header->destinationAddress.setAddress(addr);
|
||||
header->ifindex = info->ipi_ifindex;
|
||||
}
|
||||
|
||||
if (cmsgptr->cmsg_len == WSA_CMSG_LEN(sizeof(int))
|
||||
|
@ -1771,15 +1771,25 @@ QFixed QFontEngineFT::scaledBitmapMetrics(QFixed m) const
|
||||
return m * scalableBitmapScaleFactor;
|
||||
}
|
||||
|
||||
glyph_metrics_t QFontEngineFT::scaledBitmapMetrics(const glyph_metrics_t &m) const
|
||||
glyph_metrics_t QFontEngineFT::scaledBitmapMetrics(const glyph_metrics_t &m, const QTransform &t) const
|
||||
{
|
||||
QTransform trans(t);
|
||||
const qreal scaleFactor = scalableBitmapScaleFactor.toReal();
|
||||
trans.scale(scaleFactor, scaleFactor);
|
||||
|
||||
QRectF rect(m.x.toReal(), m.y.toReal(), m.width.toReal(), m.height.toReal());
|
||||
QPointF offset(m.xoff.toReal(), m.yoff.toReal());
|
||||
|
||||
rect = trans.mapRect(rect);
|
||||
offset = trans.map(offset);
|
||||
|
||||
glyph_metrics_t metrics;
|
||||
metrics.x = scaledBitmapMetrics(m.x);
|
||||
metrics.y = scaledBitmapMetrics(m.y);
|
||||
metrics.width = scaledBitmapMetrics(m.width);
|
||||
metrics.height = scaledBitmapMetrics(m.height);
|
||||
metrics.xoff = scaledBitmapMetrics(m.xoff);
|
||||
metrics.yoff = scaledBitmapMetrics(m.yoff);
|
||||
metrics.x = QFixed::fromReal(rect.x());
|
||||
metrics.y = QFixed::fromReal(rect.y());
|
||||
metrics.width = QFixed::fromReal(rect.width());
|
||||
metrics.height = QFixed::fromReal(rect.height());
|
||||
metrics.xoff = QFixed::fromReal(offset.x());
|
||||
metrics.yoff = QFixed::fromReal(offset.y());
|
||||
return metrics;
|
||||
}
|
||||
|
||||
@ -1873,7 +1883,7 @@ glyph_metrics_t QFontEngineFT::boundingBox(const QGlyphLayout &glyphs)
|
||||
unlockFace();
|
||||
|
||||
if (isScalableBitmap())
|
||||
overall = scaledBitmapMetrics(overall);
|
||||
overall = scaledBitmapMetrics(overall, QTransform());
|
||||
return overall;
|
||||
}
|
||||
|
||||
@ -1912,7 +1922,7 @@ glyph_metrics_t QFontEngineFT::boundingBox(glyph_t glyph)
|
||||
unlockFace();
|
||||
|
||||
if (isScalableBitmap())
|
||||
overall = scaledBitmapMetrics(overall);
|
||||
overall = scaledBitmapMetrics(overall, QTransform());
|
||||
return overall;
|
||||
}
|
||||
|
||||
@ -1950,7 +1960,7 @@ glyph_metrics_t QFontEngineFT::alphaMapBoundingBox(glyph_t glyph, QFixed subPixe
|
||||
}
|
||||
|
||||
if (isScalableBitmap())
|
||||
overall = scaledBitmapMetrics(overall);
|
||||
overall = scaledBitmapMetrics(overall, matrix);
|
||||
return overall;
|
||||
}
|
||||
|
||||
|
@ -321,7 +321,7 @@ private:
|
||||
int loadFlags(QGlyphSet *set, GlyphFormat format, int flags, bool &hsubpixel, int &vfactor) const;
|
||||
bool shouldUseDesignMetrics(ShaperFlags flags) const;
|
||||
QFixed scaledBitmapMetrics(QFixed m) const;
|
||||
glyph_metrics_t scaledBitmapMetrics(const glyph_metrics_t &m) const;
|
||||
glyph_metrics_t scaledBitmapMetrics(const glyph_metrics_t &m, const QTransform &matrix) const;
|
||||
|
||||
GlyphFormat defaultFormat;
|
||||
FT_Matrix matrix;
|
||||
|
@ -93,6 +93,8 @@ public:
|
||||
|
||||
void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE;
|
||||
|
||||
void syncMenuItem_helper(QPlatformMenuItem *menuItem, bool menubarUpdate);
|
||||
|
||||
private:
|
||||
QCocoaMenuItem *itemOrNull(int index) const;
|
||||
void insertNative(QCocoaMenuItem *item, QCocoaMenuItem *beforeItem);
|
||||
|
@ -433,6 +433,11 @@ void QCocoaMenu::timerEvent(QTimerEvent *e)
|
||||
}
|
||||
|
||||
void QCocoaMenu::syncMenuItem(QPlatformMenuItem *menuItem)
|
||||
{
|
||||
syncMenuItem_helper(menuItem, false /*menubarUpdate*/);
|
||||
}
|
||||
|
||||
void QCocoaMenu::syncMenuItem_helper(QPlatformMenuItem *menuItem, bool menubarUpdate)
|
||||
{
|
||||
QMacAutoReleasePool pool;
|
||||
QCocoaMenuItem *cocoaItem = static_cast<QCocoaMenuItem *>(menuItem);
|
||||
@ -443,8 +448,9 @@ void QCocoaMenu::syncMenuItem(QPlatformMenuItem *menuItem)
|
||||
|
||||
const bool wasMerged = cocoaItem->isMerged();
|
||||
NSMenuItem *oldItem = cocoaItem->nsItem();
|
||||
NSMenuItem *syncedItem = cocoaItem->sync();
|
||||
|
||||
if (cocoaItem->sync() != oldItem) {
|
||||
if (syncedItem != oldItem) {
|
||||
// native item was changed for some reason
|
||||
if (oldItem) {
|
||||
if (wasMerged) {
|
||||
@ -462,6 +468,14 @@ void QCocoaMenu::syncMenuItem(QPlatformMenuItem *menuItem)
|
||||
// when an item's enabled state changes after menuWillOpen:
|
||||
scheduleUpdate();
|
||||
}
|
||||
|
||||
// This may be a good moment to attach this item's eventual submenu to the
|
||||
// synced item, but only on the condition we're all currently hooked to the
|
||||
// menunbar. A good indicator of this being the right moment is knowing that
|
||||
// we got called from QCocoaMenuBar::updateMenuBarImmediately().
|
||||
if (menubarUpdate)
|
||||
if (QCocoaMenu *submenu = cocoaItem->menu())
|
||||
submenu->setAttachedItem(syncedItem);
|
||||
}
|
||||
|
||||
void QCocoaMenu::syncSeparatorsCollapsible(bool enable)
|
||||
|
@ -72,6 +72,8 @@ public:
|
||||
QList<QCocoaMenuItem*> merged() const;
|
||||
NSMenuItem *itemForRole(QPlatformMenuItem::MenuRole r);
|
||||
|
||||
void syncMenu_helper(QPlatformMenu *menu, bool menubarUpdate);
|
||||
|
||||
private:
|
||||
static QCocoaWindow *findWindowForMenubar();
|
||||
static QCocoaMenuBar *findGlobalMenubar();
|
||||
|
@ -155,7 +155,7 @@ void QCocoaMenuBar::insertMenu(QPlatformMenu *platformMenu, QPlatformMenu *befor
|
||||
}
|
||||
}
|
||||
|
||||
syncMenu(menu);
|
||||
syncMenu_helper(menu, false /*internaCall*/);
|
||||
|
||||
if (needsImmediateUpdate())
|
||||
updateMenuBarImmediately();
|
||||
@ -182,12 +182,17 @@ void QCocoaMenuBar::removeMenu(QPlatformMenu *platformMenu)
|
||||
}
|
||||
|
||||
void QCocoaMenuBar::syncMenu(QPlatformMenu *menu)
|
||||
{
|
||||
syncMenu_helper(menu, false /*internaCall*/);
|
||||
}
|
||||
|
||||
void QCocoaMenuBar::syncMenu_helper(QPlatformMenu *menu, bool menubarUpdate)
|
||||
{
|
||||
QMacAutoReleasePool pool;
|
||||
|
||||
QCocoaMenu *cocoaMenu = static_cast<QCocoaMenu *>(menu);
|
||||
Q_FOREACH (QCocoaMenuItem *item, cocoaMenu->items())
|
||||
cocoaMenu->syncMenuItem(item);
|
||||
cocoaMenu->syncMenuItem_helper(item, menubarUpdate);
|
||||
|
||||
BOOL shouldHide = YES;
|
||||
if (cocoaMenu->isVisible()) {
|
||||
@ -357,7 +362,7 @@ void QCocoaMenuBar::updateMenuBarImmediately()
|
||||
menu->setAttachedItem(item);
|
||||
menu->setMenuParent(mb);
|
||||
// force a sync?
|
||||
mb->syncMenu(menu);
|
||||
mb->syncMenu_helper(menu, true /*menubarUpdate*/);
|
||||
menu->propagateEnabledState(!disableForModal);
|
||||
}
|
||||
|
||||
|
@ -149,10 +149,6 @@ void QCocoaMenuItem::setMenu(QPlatformMenu *menu)
|
||||
QMacAutoReleasePool pool;
|
||||
m_menu = static_cast<QCocoaMenu *>(menu);
|
||||
if (m_menu) {
|
||||
if (m_native) {
|
||||
// Skip automatic menu item validation
|
||||
m_native.action = nil;
|
||||
}
|
||||
m_menu->setMenuParent(this);
|
||||
m_menu->propagateEnabledState(isEnabled());
|
||||
} else {
|
||||
|
@ -1442,6 +1442,21 @@ QCocoaNSWindow *QCocoaWindow::createNSWindow(bool shouldBePanel)
|
||||
|
||||
applyContentBorderThickness(nsWindow);
|
||||
|
||||
// Prevent CoreGraphics RGB32 -> RGB64 backing store conversions on deep color
|
||||
// displays by forcing 8-bit components, unless a deep color format has been
|
||||
// requested. This conversion uses significant CPU time.
|
||||
QSurface::SurfaceType surfaceType = QPlatformWindow::window()->surfaceType();
|
||||
bool usesCoreGraphics = surfaceType == QSurface::RasterSurface || surfaceType == QSurface::RasterGLSurface;
|
||||
QSurfaceFormat surfaceFormat = QPlatformWindow::window()->format();
|
||||
bool usesDeepColor = surfaceFormat.redBufferSize() > 8 ||
|
||||
surfaceFormat.greenBufferSize() > 8 ||
|
||||
surfaceFormat.blueBufferSize() > 8;
|
||||
bool usesLayer = view().layer;
|
||||
if (usesCoreGraphics && !usesDeepColor && !usesLayer) {
|
||||
[nsWindow setDynamicDepthLimit:NO];
|
||||
[nsWindow setDepthLimit:NSWindowDepthTwentyfourBitRGB];
|
||||
}
|
||||
|
||||
return nsWindow;
|
||||
}
|
||||
|
||||
|
@ -992,7 +992,9 @@ void QWindowsNativeFileDialogBase::setMode(QFileDialogOptions::FileMode mode,
|
||||
break;
|
||||
case QFileDialogOptions::Directory:
|
||||
case QFileDialogOptions::DirectoryOnly:
|
||||
flags |= FOS_PICKFOLDERS | FOS_FILEMUSTEXIST;
|
||||
// QTBUG-63645: Restrict to file system items, as Qt cannot deal with
|
||||
// places like 'Network', etc.
|
||||
flags |= FOS_PICKFOLDERS | FOS_FILEMUSTEXIST | FOS_FORCEFILESYSTEM;
|
||||
break;
|
||||
case QFileDialogOptions::ExistingFiles:
|
||||
flags |= FOS_FILEMUSTEXIST | FOS_ALLOWMULTISELECT;
|
||||
@ -1201,6 +1203,8 @@ void QWindowsNativeFileDialogBase::onSelectionChange()
|
||||
{
|
||||
const QList<QUrl> current = selectedFiles();
|
||||
m_data.setSelectedFiles(current);
|
||||
qDebug() << __FUNCTION__ << current << current.size();
|
||||
|
||||
if (current.size() == 1)
|
||||
emit currentChanged(current.front());
|
||||
}
|
||||
@ -1397,7 +1401,7 @@ QList<QUrl> QWindowsNativeOpenFileDialog::dialogResult() const
|
||||
for (IShellItem *item : QWindowsShellItem::itemsFromItemArray(items)) {
|
||||
QWindowsShellItem qItem(item);
|
||||
const QString path = qItem.path();
|
||||
if (path.isEmpty()) {
|
||||
if (path.isEmpty() && !qItem.isDir()) {
|
||||
const QString temporaryCopy = createTemporaryItemCopy(qItem);
|
||||
if (temporaryCopy.isEmpty())
|
||||
qWarning() << "Unable to create a local copy of" << qItem;
|
||||
|
@ -354,7 +354,7 @@ HICON QWindowsSystemTrayIcon::createIcon(const QIcon &icon)
|
||||
m_hIcon = nullptr;
|
||||
if (icon.isNull())
|
||||
return oldIcon;
|
||||
const QSize requestedSize(GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON));
|
||||
const QSize requestedSize = QSize(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON));
|
||||
const QSize size = icon.actualSize(requestedSize);
|
||||
const QPixmap pm = icon.pixmap(size);
|
||||
if (!pm.isNull())
|
||||
|
@ -249,7 +249,7 @@ void QXcbConnection::xi2SetupDevice(void *info, bool removeExisting)
|
||||
isTablet = true;
|
||||
tabletData.pointerType = QTabletEvent::Eraser;
|
||||
dbgType = QLatin1String("eraser");
|
||||
} else if (name.contains("cursor")) {
|
||||
} else if (name.contains("cursor") && !(name.contains("cursor controls") && name.contains("trackball"))) {
|
||||
isTablet = true;
|
||||
tabletData.pointerType = QTabletEvent::Cursor;
|
||||
dbgType = QLatin1String("cursor");
|
||||
|
@ -181,13 +181,14 @@ public:
|
||||
QPSQLDriver::Protocol getPSQLVersion();
|
||||
bool setEncodingUtf8();
|
||||
void setDatestyle();
|
||||
void setByteaOutput();
|
||||
void detectBackslashEscape();
|
||||
};
|
||||
|
||||
void QPSQLDriverPrivate::appendTables(QStringList &tl, QSqlQuery &t, QChar type)
|
||||
{
|
||||
QString query;
|
||||
if (pro >= QPSQLDriver::Version73) {
|
||||
if (pro >= QPSQLDriver::Version7_3) {
|
||||
query = QString::fromLatin1("select pg_class.relname, pg_namespace.nspname from pg_class "
|
||||
"left join pg_namespace on (pg_class.relnamespace = pg_namespace.oid) "
|
||||
"where (pg_class.relkind = '%1') and (pg_class.relname !~ '^Inv') "
|
||||
@ -525,7 +526,7 @@ int QPSQLResult::numRowsAffected()
|
||||
QVariant QPSQLResult::lastInsertId() const
|
||||
{
|
||||
Q_D(const QPSQLResult);
|
||||
if (d->drv_d_func()->pro >= QPSQLDriver::Version81) {
|
||||
if (d->drv_d_func()->pro >= QPSQLDriver::Version8_1) {
|
||||
QSqlQuery qry(driver()->createResult());
|
||||
// Most recent sequence value obtained from nextval
|
||||
if (qry.exec(QLatin1String("SELECT lastval();")) && qry.next())
|
||||
@ -698,11 +699,25 @@ void QPSQLDriverPrivate::setDatestyle()
|
||||
PQclear(result);
|
||||
}
|
||||
|
||||
void QPSQLDriverPrivate::setByteaOutput()
|
||||
{
|
||||
if (pro >= QPSQLDriver::Version9) {
|
||||
// Server version before QPSQLDriver::Version9 only supports escape mode for bytea type,
|
||||
// but bytea format is set to hex by default in PSQL 9 and above. So need to force the
|
||||
// server to use the old escape mode when connects to the new server.
|
||||
PGresult *result = exec("SET bytea_output TO escape");
|
||||
int status = PQresultStatus(result);
|
||||
if (status != PGRES_COMMAND_OK)
|
||||
qWarning("%s", PQerrorMessage(connection));
|
||||
PQclear(result);
|
||||
}
|
||||
}
|
||||
|
||||
void QPSQLDriverPrivate::detectBackslashEscape()
|
||||
{
|
||||
// standard_conforming_strings option introduced in 8.2
|
||||
// http://www.postgresql.org/docs/8.2/static/runtime-config-compatible.html
|
||||
if (pro < QPSQLDriver::Version82) {
|
||||
if (pro < QPSQLDriver::Version8_2) {
|
||||
hasBackslashEscape = true;
|
||||
} else {
|
||||
hasBackslashEscape = false;
|
||||
@ -724,11 +739,11 @@ static QPSQLDriver::Protocol qMakePSQLVersion(int vMaj, int vMin)
|
||||
{
|
||||
switch (vMin) {
|
||||
case 1:
|
||||
return QPSQLDriver::Version71;
|
||||
return QPSQLDriver::Version7_1;
|
||||
case 3:
|
||||
return QPSQLDriver::Version73;
|
||||
return QPSQLDriver::Version7_3;
|
||||
case 4:
|
||||
return QPSQLDriver::Version74;
|
||||
return QPSQLDriver::Version7_4;
|
||||
default:
|
||||
return QPSQLDriver::Version7;
|
||||
}
|
||||
@ -738,24 +753,68 @@ static QPSQLDriver::Protocol qMakePSQLVersion(int vMaj, int vMin)
|
||||
{
|
||||
switch (vMin) {
|
||||
case 1:
|
||||
return QPSQLDriver::Version81;
|
||||
return QPSQLDriver::Version8_1;
|
||||
case 2:
|
||||
return QPSQLDriver::Version82;
|
||||
return QPSQLDriver::Version8_2;
|
||||
case 3:
|
||||
return QPSQLDriver::Version83;
|
||||
return QPSQLDriver::Version8_3;
|
||||
case 4:
|
||||
return QPSQLDriver::Version84;
|
||||
return QPSQLDriver::Version8_4;
|
||||
default:
|
||||
return QPSQLDriver::Version8;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 9:
|
||||
return QPSQLDriver::Version9;
|
||||
break;
|
||||
default:
|
||||
{
|
||||
switch (vMin) {
|
||||
case 1:
|
||||
return QPSQLDriver::Version9_1;
|
||||
case 2:
|
||||
return QPSQLDriver::Version9_2;
|
||||
case 3:
|
||||
return QPSQLDriver::Version9_3;
|
||||
case 4:
|
||||
return QPSQLDriver::Version9_4;
|
||||
case 5:
|
||||
return QPSQLDriver::Version9_5;
|
||||
case 6:
|
||||
return QPSQLDriver::Version9_6;
|
||||
default:
|
||||
return QPSQLDriver::Version9;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 10:
|
||||
return QPSQLDriver::Version10;
|
||||
default:
|
||||
if (vMaj > 10)
|
||||
return QPSQLDriver::UnknownLaterVersion;
|
||||
break;
|
||||
}
|
||||
return QPSQLDriver::VersionUnknown;
|
||||
}
|
||||
|
||||
static QPSQLDriver::Protocol qFindPSQLVersion(const QString &versionString)
|
||||
{
|
||||
const QRegExp rx(QStringLiteral("(\\d+)(?:\\.(\\d+))?"));
|
||||
if (rx.indexIn(versionString) != -1) {
|
||||
// Beginning with PostgreSQL version 10, a major release is indicated by
|
||||
// increasing the first part of the version, e.g. 10 to 11.
|
||||
// Before version 10, a major release was indicated by increasing either
|
||||
// the first or second part of the version number, e.g. 9.5 to 9.6.
|
||||
int vMaj = rx.cap(1).toInt();
|
||||
int vMin;
|
||||
if (vMaj >= 10) {
|
||||
vMin = 0;
|
||||
} else {
|
||||
if (rx.cap(2).isEmpty())
|
||||
return QPSQLDriver::VersionUnknown;
|
||||
vMin = rx.cap(2).toInt();
|
||||
}
|
||||
return qMakePSQLVersion(vMaj, vMin);
|
||||
}
|
||||
|
||||
return QPSQLDriver::VersionUnknown;
|
||||
}
|
||||
|
||||
@ -765,49 +824,31 @@ QPSQLDriver::Protocol QPSQLDriverPrivate::getPSQLVersion()
|
||||
PGresult* result = exec("select version()");
|
||||
int status = PQresultStatus(result);
|
||||
if (status == PGRES_COMMAND_OK || status == PGRES_TUPLES_OK) {
|
||||
QString val = QString::fromLatin1(PQgetvalue(result, 0, 0));
|
||||
|
||||
QRegExp rx(QLatin1String("(\\d+)\\.(\\d+)"));
|
||||
rx.setMinimal(true); // enforce non-greedy RegExp
|
||||
|
||||
if (rx.indexIn(val) != -1) {
|
||||
int vMaj = rx.cap(1).toInt();
|
||||
int vMin = rx.cap(2).toInt();
|
||||
serverVersion = qMakePSQLVersion(vMaj, vMin);
|
||||
#if defined(PG_MAJORVERSION)
|
||||
if (rx.indexIn(QLatin1String(PG_MAJORVERSION)) != -1)
|
||||
#elif defined(PG_VERSION)
|
||||
if (rx.indexIn(QLatin1String(PG_VERSION)) != -1)
|
||||
#else
|
||||
if (0)
|
||||
#endif
|
||||
{
|
||||
vMaj = rx.cap(1).toInt();
|
||||
vMin = rx.cap(2).toInt();
|
||||
QPSQLDriver::Protocol clientVersion = qMakePSQLVersion(vMaj, vMin);
|
||||
|
||||
if (serverVersion >= QPSQLDriver::Version9 && clientVersion < QPSQLDriver::Version9) {
|
||||
//Client version before QPSQLDriver::Version9 only supports escape mode for bytea type,
|
||||
//but bytea format is set to hex by default in PSQL 9 and above. So need to force the
|
||||
//server use the old escape mode when connects to the new server with old client library.
|
||||
PQclear(result);
|
||||
result = exec("SET bytea_output=escape; ");
|
||||
status = PQresultStatus(result);
|
||||
} else if (serverVersion == QPSQLDriver::VersionUnknown) {
|
||||
serverVersion = clientVersion;
|
||||
if (serverVersion != QPSQLDriver::VersionUnknown)
|
||||
qWarning("The server version of this PostgreSQL is unknown, falling back to the client version.");
|
||||
}
|
||||
}
|
||||
}
|
||||
serverVersion = qFindPSQLVersion(
|
||||
QString::fromLatin1(PQgetvalue(result, 0, 0)));
|
||||
}
|
||||
PQclear(result);
|
||||
|
||||
//keep the old behavior unchanged
|
||||
QPSQLDriver::Protocol clientVersion =
|
||||
#if defined(PG_MAJORVERSION)
|
||||
qFindPSQLVersion(QLatin1String(PG_MAJORVERSION));
|
||||
#elif defined(PG_VERSION)
|
||||
qFindPSQLVersion(QLatin1String(PG_VERSION));
|
||||
#else
|
||||
QPSQLDriver::VersionUnknown;
|
||||
#endif
|
||||
|
||||
if (serverVersion == QPSQLDriver::VersionUnknown) {
|
||||
serverVersion = clientVersion;
|
||||
if (serverVersion != QPSQLDriver::VersionUnknown)
|
||||
qWarning("The server version of this PostgreSQL is unknown, falling back to the client version.");
|
||||
}
|
||||
|
||||
// Keep the old behavior unchanged
|
||||
if (serverVersion == QPSQLDriver::VersionUnknown)
|
||||
serverVersion = QPSQLDriver::Version6;
|
||||
|
||||
if (serverVersion < QPSQLDriver::Version71) {
|
||||
if (serverVersion < QPSQLDriver::Version7_3) {
|
||||
qWarning("This version of PostgreSQL is not supported and may not work.");
|
||||
}
|
||||
|
||||
@ -857,7 +898,7 @@ bool QPSQLDriver::hasFeature(DriverFeature f) const
|
||||
return true;
|
||||
case PreparedQueries:
|
||||
case PositionalPlaceholders:
|
||||
return d->pro >= QPSQLDriver::Version82;
|
||||
return d->pro >= QPSQLDriver::Version8_2;
|
||||
case BatchOperations:
|
||||
case NamedPlaceholders:
|
||||
case SimpleLocking:
|
||||
@ -866,7 +907,7 @@ bool QPSQLDriver::hasFeature(DriverFeature f) const
|
||||
case CancelQuery:
|
||||
return false;
|
||||
case BLOB:
|
||||
return d->pro >= QPSQLDriver::Version71;
|
||||
return d->pro >= QPSQLDriver::Version7_1;
|
||||
case Unicode:
|
||||
return d->isUtf8;
|
||||
}
|
||||
@ -929,6 +970,7 @@ bool QPSQLDriver::open(const QString & db,
|
||||
d->detectBackslashEscape();
|
||||
d->isUtf8 = d->setEncodingUtf8();
|
||||
d->setDatestyle();
|
||||
d->setByteaOutput();
|
||||
|
||||
setOpen(true);
|
||||
setOpenError(false);
|
||||
@ -993,12 +1035,7 @@ bool QPSQLDriver::commitTransaction()
|
||||
// This hack is used to tell if the transaction has succeeded for the protocol versions of
|
||||
// PostgreSQL below. For 7.x and other protocol versions we are left in the dark.
|
||||
// This hack can dissapear once there is an API to query this sort of information.
|
||||
if (d->pro == QPSQLDriver::Version8 ||
|
||||
d->pro == QPSQLDriver::Version81 ||
|
||||
d->pro == QPSQLDriver::Version82 ||
|
||||
d->pro == QPSQLDriver::Version83 ||
|
||||
d->pro == QPSQLDriver::Version84 ||
|
||||
d->pro == QPSQLDriver::Version9) {
|
||||
if (d->pro >= QPSQLDriver::Version8) {
|
||||
transaction_failed = qstrcmp(PQcmdStatus(res), "ROLLBACK") == 0;
|
||||
}
|
||||
|
||||
@ -1085,8 +1122,7 @@ QSqlIndex QPSQLDriver::primaryIndex(const QString& tablename) const
|
||||
else
|
||||
schema = std::move(schema).toLower();
|
||||
|
||||
switch(d->pro) {
|
||||
case QPSQLDriver::Version6:
|
||||
if (d->pro == QPSQLDriver::Version6) {
|
||||
stmt = QLatin1String("select pg_att1.attname, int(pg_att1.atttypid), pg_cl.relname "
|
||||
"from pg_attribute pg_att1, pg_attribute pg_att2, pg_class pg_cl, pg_index pg_ind "
|
||||
"where pg_cl.relname = '%1_pkey' "
|
||||
@ -1095,9 +1131,7 @@ QSqlIndex QPSQLDriver::primaryIndex(const QString& tablename) const
|
||||
"and pg_att1.attrelid = pg_ind.indrelid "
|
||||
"and pg_att1.attnum = pg_ind.indkey[pg_att2.attnum-1] "
|
||||
"order by pg_att2.attnum");
|
||||
break;
|
||||
case QPSQLDriver::Version7:
|
||||
case QPSQLDriver::Version71:
|
||||
} else if (d->pro == QPSQLDriver::Version7 || d->pro == QPSQLDriver::Version7_1) {
|
||||
stmt = QLatin1String("select pg_att1.attname, pg_att1.atttypid::int, pg_cl.relname "
|
||||
"from pg_attribute pg_att1, pg_attribute pg_att2, pg_class pg_cl, pg_index pg_ind "
|
||||
"where pg_cl.relname = '%1_pkey' "
|
||||
@ -1106,15 +1140,7 @@ QSqlIndex QPSQLDriver::primaryIndex(const QString& tablename) const
|
||||
"and pg_att1.attrelid = pg_ind.indrelid "
|
||||
"and pg_att1.attnum = pg_ind.indkey[pg_att2.attnum-1] "
|
||||
"order by pg_att2.attnum");
|
||||
break;
|
||||
case QPSQLDriver::Version73:
|
||||
case QPSQLDriver::Version74:
|
||||
case QPSQLDriver::Version8:
|
||||
case QPSQLDriver::Version81:
|
||||
case QPSQLDriver::Version82:
|
||||
case QPSQLDriver::Version83:
|
||||
case QPSQLDriver::Version84:
|
||||
case QPSQLDriver::Version9:
|
||||
} else if (d->pro >= QPSQLDriver::Version7_3) {
|
||||
stmt = QLatin1String("SELECT pg_attribute.attname, pg_attribute.atttypid::int, "
|
||||
"pg_class.relname "
|
||||
"FROM pg_attribute, pg_class "
|
||||
@ -1129,10 +1155,8 @@ QSqlIndex QPSQLDriver::primaryIndex(const QString& tablename) const
|
||||
else
|
||||
stmt = stmt.arg(QString::fromLatin1("pg_class.relnamespace = (select oid from "
|
||||
"pg_namespace where pg_namespace.nspname = '%1') AND ").arg(schema));
|
||||
break;
|
||||
case QPSQLDriver::VersionUnknown:
|
||||
qFatal("PSQL version is unknown");
|
||||
break;
|
||||
} else {
|
||||
qFatal("QPSQLDriver::primaryIndex(tablename): unknown PSQL version, query statement not set");
|
||||
}
|
||||
|
||||
i.exec(stmt.arg(tbl));
|
||||
@ -1166,8 +1190,7 @@ QSqlRecord QPSQLDriver::record(const QString& tablename) const
|
||||
schema = std::move(schema).toLower();
|
||||
|
||||
QString stmt;
|
||||
switch(d->pro) {
|
||||
case QPSQLDriver::Version6:
|
||||
if (d->pro == QPSQLDriver::Version6) {
|
||||
stmt = QLatin1String("select pg_attribute.attname, int(pg_attribute.atttypid), "
|
||||
"pg_attribute.attnotnull, pg_attribute.attlen, pg_attribute.atttypmod, "
|
||||
"int(pg_attribute.attrelid), pg_attribute.attnum "
|
||||
@ -1175,8 +1198,7 @@ QSqlRecord QPSQLDriver::record(const QString& tablename) const
|
||||
"where pg_class.relname = '%1' "
|
||||
"and pg_attribute.attnum > 0 "
|
||||
"and pg_attribute.attrelid = pg_class.oid ");
|
||||
break;
|
||||
case QPSQLDriver::Version7:
|
||||
} else if (d->pro == QPSQLDriver::Version7) {
|
||||
stmt = QLatin1String("select pg_attribute.attname, pg_attribute.atttypid::int, "
|
||||
"pg_attribute.attnotnull, pg_attribute.attlen, pg_attribute.atttypmod, "
|
||||
"pg_attribute.attrelid::int, pg_attribute.attnum "
|
||||
@ -1184,8 +1206,7 @@ QSqlRecord QPSQLDriver::record(const QString& tablename) const
|
||||
"where pg_class.relname = '%1' "
|
||||
"and pg_attribute.attnum > 0 "
|
||||
"and pg_attribute.attrelid = pg_class.oid ");
|
||||
break;
|
||||
case QPSQLDriver::Version71:
|
||||
} else if (d->pro == QPSQLDriver::Version7_1) {
|
||||
stmt = QLatin1String("select pg_attribute.attname, pg_attribute.atttypid::int, "
|
||||
"pg_attribute.attnotnull, pg_attribute.attlen, pg_attribute.atttypmod, "
|
||||
"pg_attrdef.adsrc "
|
||||
@ -1196,15 +1217,7 @@ QSqlRecord QPSQLDriver::record(const QString& tablename) const
|
||||
"and pg_attribute.attnum > 0 "
|
||||
"and pg_attribute.attrelid = pg_class.oid "
|
||||
"order by pg_attribute.attnum ");
|
||||
break;
|
||||
case QPSQLDriver::Version73:
|
||||
case QPSQLDriver::Version74:
|
||||
case QPSQLDriver::Version8:
|
||||
case QPSQLDriver::Version81:
|
||||
case QPSQLDriver::Version82:
|
||||
case QPSQLDriver::Version83:
|
||||
case QPSQLDriver::Version84:
|
||||
case QPSQLDriver::Version9:
|
||||
} else if (d->pro >= QPSQLDriver::Version7_3) {
|
||||
stmt = QLatin1String("select pg_attribute.attname, pg_attribute.atttypid::int, "
|
||||
"pg_attribute.attnotnull, pg_attribute.attlen, pg_attribute.atttypmod, "
|
||||
"pg_attrdef.adsrc "
|
||||
@ -1222,15 +1235,13 @@ QSqlRecord QPSQLDriver::record(const QString& tablename) const
|
||||
else
|
||||
stmt = stmt.arg(QString::fromLatin1("pg_class.relnamespace = (select oid from "
|
||||
"pg_namespace where pg_namespace.nspname = '%1')").arg(schema));
|
||||
break;
|
||||
case QPSQLDriver::VersionUnknown:
|
||||
qFatal("PSQL version is unknown");
|
||||
break;
|
||||
} else {
|
||||
qFatal("QPSQLDriver::record(tablename): unknown PSQL version, query statement not set");
|
||||
}
|
||||
|
||||
QSqlQuery query(createResult());
|
||||
query.exec(stmt.arg(tbl));
|
||||
if (d->pro >= QPSQLDriver::Version71) {
|
||||
if (d->pro >= QPSQLDriver::Version7_1) {
|
||||
while (query.next()) {
|
||||
int len = query.value(3).toInt();
|
||||
int precision = query.value(4).toInt();
|
||||
|
@ -76,15 +76,23 @@ public:
|
||||
VersionUnknown = -1,
|
||||
Version6 = 6,
|
||||
Version7 = 7,
|
||||
Version71 = 8,
|
||||
Version73 = 9,
|
||||
Version74 = 10,
|
||||
Version7_1 = 8,
|
||||
Version7_3 = 9,
|
||||
Version7_4 = 10,
|
||||
Version8 = 11,
|
||||
Version81 = 12,
|
||||
Version82 = 13,
|
||||
Version83 = 14,
|
||||
Version84 = 15,
|
||||
Version9 = 16
|
||||
Version8_1 = 12,
|
||||
Version8_2 = 13,
|
||||
Version8_3 = 14,
|
||||
Version8_4 = 15,
|
||||
Version9 = 16,
|
||||
Version9_1 = 17,
|
||||
Version9_2 = 18,
|
||||
Version9_3 = 19,
|
||||
Version9_4 = 20,
|
||||
Version9_5 = 21,
|
||||
Version9_6 = 22,
|
||||
Version10 = 23,
|
||||
UnknownLaterVersion = 100000
|
||||
};
|
||||
|
||||
explicit QPSQLDriver(QObject *parent=0);
|
||||
|
112
src/testlib/qtesthelpers_p.h
Normal file
112
src/testlib/qtesthelpers_p.h
Normal file
@ -0,0 +1,112 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2017 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the QtTest 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 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 Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 3 requirements
|
||||
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 2.0 or (at your option) the GNU General
|
||||
** Public license version 3 or any later version approved by the KDE Free
|
||||
** Qt Foundation. The licenses are as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
||||
** https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QTESTHELPERS_P_H
|
||||
#define QTESTHELPERS_P_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QtCore/QFile>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QChar>
|
||||
#include <QtCore/QPoint>
|
||||
|
||||
#ifdef QT_GUI_LIB
|
||||
#include <QtGui/QGuiApplication>
|
||||
#include <QtGui/QScreen>
|
||||
#endif
|
||||
|
||||
#ifdef QT_WIDGETS_LIB
|
||||
#include <QtWidgets/QWidget>
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
namespace QTestPrivate {
|
||||
|
||||
static inline bool canHandleUnicodeFileNames()
|
||||
{
|
||||
#if defined(Q_OS_WIN)
|
||||
return true;
|
||||
#else
|
||||
// Check for UTF-8 by converting the Euro symbol (see tst_utf8)
|
||||
return QFile::encodeName(QString(QChar(0x20AC))) == QByteArrayLiteral("\342\202\254");
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef QT_WIDGETS_LIB
|
||||
static inline void centerOnScreen(QWidget *w, const QSize &size)
|
||||
{
|
||||
const QPoint offset = QPoint(size.width() / 2, size.height() / 2);
|
||||
w->move(QGuiApplication::primaryScreen()->availableGeometry().center() - offset);
|
||||
}
|
||||
|
||||
static inline void centerOnScreen(QWidget *w)
|
||||
{
|
||||
centerOnScreen(w, w->geometry().size());
|
||||
}
|
||||
|
||||
/*! \internal
|
||||
|
||||
Make a widget frameless to prevent size constraints of title bars from interfering (Windows).
|
||||
*/
|
||||
static inline void setFrameless(QWidget *w)
|
||||
{
|
||||
Qt::WindowFlags flags = w->windowFlags();
|
||||
flags |= Qt::FramelessWindowHint;
|
||||
flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint
|
||||
| Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
|
||||
w->setWindowFlags(flags);
|
||||
}
|
||||
#endif // QT_WIDGETS_LIB
|
||||
|
||||
} // namespace QTestPrivate
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QTESTHELPERS_P_H
|
@ -37,7 +37,8 @@ HEADERS = qbenchmark.h \
|
||||
qtestspontaneevent.h \
|
||||
qtestsystem.h \
|
||||
qtesttouch.h \
|
||||
qtestblacklist_p.h
|
||||
qtestblacklist_p.h \
|
||||
qtesthelpers_p.h
|
||||
|
||||
SOURCES = qtestcase.cpp \
|
||||
qtestlog.cpp \
|
||||
|
@ -3376,7 +3376,7 @@ void QHeaderViewPrivate::resizeSections(QHeaderView::ResizeMode globalMode, bool
|
||||
// because it isn't stretch, determine its width and remove that from lengthToStretch
|
||||
int sectionSize = 0;
|
||||
if (resizeMode == QHeaderView::Interactive || resizeMode == QHeaderView::Fixed) {
|
||||
sectionSize = headerSectionSize(i);
|
||||
sectionSize = qBound(q->minimumSectionSize(), headerSectionSize(i), q->maximumSectionSize());
|
||||
} else { // resizeMode == QHeaderView::ResizeToContents
|
||||
int logicalIndex = q->logicalIndex(i);
|
||||
sectionSize = qMax(viewSectionSizeHint(logicalIndex),
|
||||
@ -3551,6 +3551,8 @@ void QHeaderViewPrivate::cascadingResize(int visual, int newSize)
|
||||
|
||||
// cascade the section size change
|
||||
for (int i = visual + 1; i < sectionCount(); ++i) {
|
||||
if (isVisualIndexHidden(i))
|
||||
continue;
|
||||
if (!sectionIsCascadable(i))
|
||||
continue;
|
||||
int currentSectionSize = headerSectionSize(i);
|
||||
@ -3593,6 +3595,8 @@ void QHeaderViewPrivate::cascadingResize(int visual, int newSize)
|
||||
// cascade the section size change
|
||||
if (delta < 0 && newSize < minimumSize) {
|
||||
for (int i = visual - 1; i >= 0; --i) {
|
||||
if (isVisualIndexHidden(i))
|
||||
continue;
|
||||
if (!sectionIsCascadable(i))
|
||||
continue;
|
||||
int sectionSize = headerSectionSize(i);
|
||||
@ -3607,6 +3611,8 @@ void QHeaderViewPrivate::cascadingResize(int visual, int newSize)
|
||||
// let the next section get the space from the resized section
|
||||
if (!sectionResized) {
|
||||
for (int i = visual + 1; i < sectionCount(); ++i) {
|
||||
if (isVisualIndexHidden(i))
|
||||
continue;
|
||||
if (!sectionIsCascadable(i))
|
||||
continue;
|
||||
int currentSectionSize = headerSectionSize(i);
|
||||
|
@ -2873,10 +2873,19 @@ void QIconModeViewBase::scrollContentsBy(int dx, int dy, bool scrollElasticBand)
|
||||
void QIconModeViewBase::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
|
||||
{
|
||||
if (column() >= topLeft.column() && column() <= bottomRight.column()) {
|
||||
QStyleOptionViewItem option = viewOptions();
|
||||
int bottom = qMin(items.count(), bottomRight.row() + 1);
|
||||
const QStyleOptionViewItem option = viewOptions();
|
||||
const int bottom = qMin(items.count(), bottomRight.row() + 1);
|
||||
const bool useItemSize = !dd->grid.isValid();
|
||||
for (int row = topLeft.row(); row < bottom; ++row)
|
||||
items[row].resize(itemSize(option, modelIndex(row)));
|
||||
{
|
||||
QSize s = itemSize(option, modelIndex(row));
|
||||
if (!useItemSize)
|
||||
{
|
||||
s.setWidth(qMin(dd->grid.width(), s.width()));
|
||||
s.setHeight(qMin(dd->grid.height(), s.height()));
|
||||
}
|
||||
items[row].resize(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -205,7 +205,7 @@ static bool correctWidgetContext(Qt::ShortcutContext context, QWidget *w, QWidge
|
||||
#if defined(DEBUG_QSHORTCUTMAP)
|
||||
qDebug().nospace() << "..true [Pass-through]";
|
||||
#endif
|
||||
return true;
|
||||
return QApplicationPrivate::tryModalHelper(w, nullptr);
|
||||
}
|
||||
|
||||
#if QT_CONFIG(graphicsview)
|
||||
|
@ -1374,6 +1374,8 @@ void QWidget::create(WId window, bool initializeWindow, bool destroyOldWindow)
|
||||
d->setWindowIconText_helper(d->topData()->iconText);
|
||||
if (isWindow() && !d->topData()->caption.isEmpty())
|
||||
d->setWindowTitle_helper(d->topData()->caption);
|
||||
if (isWindow() && !d->topData()->filePath.isEmpty())
|
||||
d->setWindowFilePath_helper(d->topData()->filePath);
|
||||
if (windowType() != Qt::Desktop) {
|
||||
d->updateSystemBackground();
|
||||
|
||||
|
@ -545,6 +545,7 @@ void QMainWindow::setMenuBar(QMenuBar *menuBar)
|
||||
menuBar->setCornerWidget(cornerWidget, Qt::TopRightCorner);
|
||||
}
|
||||
oldMenuBar->hide();
|
||||
oldMenuBar->setParent(nullptr);
|
||||
oldMenuBar->deleteLater();
|
||||
}
|
||||
topLayout->setMenuBar(menuBar);
|
||||
|
@ -91,19 +91,10 @@ class QMenuSloppyState
|
||||
Q_DISABLE_COPY(QMenuSloppyState)
|
||||
public:
|
||||
QMenuSloppyState()
|
||||
: m_menu(Q_NULLPTR)
|
||||
, m_enabled(false)
|
||||
: m_enabled(false)
|
||||
, m_uni_directional(false)
|
||||
, m_select_other_actions(false)
|
||||
, m_first_mouse(true)
|
||||
, m_init_guard(false)
|
||||
, m_use_reset_action(true)
|
||||
, m_uni_dir_discarded_count(0)
|
||||
, m_uni_dir_fail_at_count(0)
|
||||
, m_timeout(0)
|
||||
, m_reset_action(Q_NULLPTR)
|
||||
, m_origin_action(Q_NULLPTR)
|
||||
, m_parent(Q_NULLPTR)
|
||||
{ }
|
||||
|
||||
~QMenuSloppyState() { reset(); }
|
||||
@ -252,44 +243,45 @@ public:
|
||||
QMenu *subMenu() const { return m_sub_menu; }
|
||||
|
||||
private:
|
||||
QMenu *m_menu;
|
||||
bool m_enabled;
|
||||
bool m_uni_directional;
|
||||
bool m_select_other_actions;
|
||||
bool m_first_mouse;
|
||||
bool m_init_guard;
|
||||
bool m_discard_state_when_entering_parent;
|
||||
bool m_dont_start_time_on_leave;
|
||||
bool m_use_reset_action;
|
||||
short m_uni_dir_discarded_count;
|
||||
short m_uni_dir_fail_at_count;
|
||||
short m_timeout;
|
||||
QBasicTimer m_time;
|
||||
QAction *m_reset_action;
|
||||
QAction *m_origin_action;
|
||||
QMenu *m_menu = nullptr;
|
||||
QAction *m_reset_action = nullptr;
|
||||
QAction *m_origin_action = nullptr;
|
||||
QRectF m_action_rect;
|
||||
QPointF m_previous_point;
|
||||
QPointer<QMenu> m_sub_menu;
|
||||
QMenuSloppyState *m_parent;
|
||||
QMenuSloppyState *m_parent = nullptr;
|
||||
QBasicTimer m_time;
|
||||
short m_uni_dir_discarded_count = 0;
|
||||
short m_uni_dir_fail_at_count = 0;
|
||||
short m_timeout = 0;
|
||||
bool m_init_guard = false;
|
||||
bool m_first_mouse = true;
|
||||
|
||||
bool m_enabled : 1;
|
||||
bool m_uni_directional : 1;
|
||||
bool m_select_other_actions : 1;
|
||||
bool m_discard_state_when_entering_parent : 1;
|
||||
bool m_dont_start_time_on_leave : 1;
|
||||
bool m_use_reset_action : 1;
|
||||
};
|
||||
|
||||
class QMenuPrivate : public QWidgetPrivate
|
||||
{
|
||||
Q_DECLARE_PUBLIC(QMenu)
|
||||
public:
|
||||
QMenuPrivate() : itemsDirty(0), maxIconWidth(0), tabWidth(0), ncols(0),
|
||||
collapsibleSeparators(true), toolTipsVisible(false),
|
||||
activationRecursionGuard(false), delayedPopupGuard(false),
|
||||
hasReceievedEnter(false),
|
||||
hasHadMouse(0), aboutToHide(0), motions(0),
|
||||
currentAction(0),
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
selectAction(0),
|
||||
cancelAction(0),
|
||||
#endif
|
||||
scroll(0), eventLoop(0), tearoff(0), tornoff(0), tearoffHighlighted(0),
|
||||
hasCheckableItems(0), doChildEffects(false), platformMenu(0),
|
||||
scrollUpTearOffItem(nullptr), scrollDownItem(nullptr)
|
||||
QMenuPrivate() :
|
||||
itemsDirty(false),
|
||||
hasCheckableItems(false),
|
||||
collapsibleSeparators(true),
|
||||
toolTipsVisible(false),
|
||||
delayedPopupGuard(false),
|
||||
hasReceievedEnter(false),
|
||||
hasHadMouse(false),
|
||||
aboutToHide(false),
|
||||
tearoff(false),
|
||||
tornoff(false),
|
||||
tearoffHighlighted(false),
|
||||
doChildEffects(false)
|
||||
{ }
|
||||
|
||||
~QMenuPrivate()
|
||||
@ -312,8 +304,6 @@ public:
|
||||
bool isContextMenu() const;
|
||||
|
||||
//item calculations
|
||||
mutable uint itemsDirty : 1;
|
||||
mutable uint maxIconWidth, tabWidth;
|
||||
QRect actionRect(QAction *) const;
|
||||
|
||||
mutable QVector<QRect> actionRects;
|
||||
@ -322,31 +312,19 @@ public:
|
||||
void updateActionRects(const QRect &screen) const;
|
||||
QRect popupGeometry() const;
|
||||
QRect popupGeometry(int screen) const;
|
||||
mutable uint ncols : 4; //4 bits is probably plenty
|
||||
uint collapsibleSeparators : 1;
|
||||
uint toolTipsVisible : 1;
|
||||
int getLastVisibleAction() const;
|
||||
|
||||
bool activationRecursionGuard;
|
||||
bool delayedPopupGuard;
|
||||
bool hasReceievedEnter;
|
||||
|
||||
//selection
|
||||
static QMenu *mouseDown;
|
||||
QPoint mousePopupPos;
|
||||
uint hasHadMouse : 1;
|
||||
uint aboutToHide : 1;
|
||||
int motions;
|
||||
int mousePopupDelay;
|
||||
QAction *currentAction;
|
||||
|
||||
QAction *currentAction = nullptr;
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
QAction *selectAction;
|
||||
QAction *cancelAction;
|
||||
QAction *selectAction = nullptr;
|
||||
QAction *cancelAction = nullptr;
|
||||
#endif
|
||||
struct DelayState {
|
||||
DelayState()
|
||||
: parent(0)
|
||||
, action(0)
|
||||
{ }
|
||||
void initialize(QMenu *parent)
|
||||
{
|
||||
@ -366,9 +344,9 @@ public:
|
||||
timer.stop();
|
||||
}
|
||||
|
||||
QMenu *parent;
|
||||
QMenu *parent = nullptr;
|
||||
QAction *action = nullptr;
|
||||
QBasicTimer timer;
|
||||
QAction *action;
|
||||
} delayState;
|
||||
enum SelectionReason {
|
||||
SelectedFromKeyboard,
|
||||
@ -385,19 +363,20 @@ public:
|
||||
struct QMenuScroller {
|
||||
enum ScrollLocation { ScrollStay, ScrollBottom, ScrollTop, ScrollCenter };
|
||||
enum ScrollDirection { ScrollNone=0, ScrollUp=0x01, ScrollDown=0x02 };
|
||||
uint scrollFlags : 2, scrollDirection : 2;
|
||||
int scrollOffset;
|
||||
int scrollOffset = 0;
|
||||
QBasicTimer scrollTimer;
|
||||
quint8 scrollFlags = ScrollNone;
|
||||
quint8 scrollDirection = ScrollNone;
|
||||
|
||||
QMenuScroller() : scrollFlags(ScrollNone), scrollDirection(ScrollNone), scrollOffset(0) { }
|
||||
QMenuScroller() { }
|
||||
~QMenuScroller() { }
|
||||
} *scroll;
|
||||
} *scroll = nullptr;
|
||||
void scrollMenu(QMenuScroller::ScrollLocation location, bool active=false);
|
||||
void scrollMenu(QMenuScroller::ScrollDirection direction, bool page=false, bool active=false);
|
||||
void scrollMenu(QAction *action, QMenuScroller::ScrollLocation location, bool active=false);
|
||||
|
||||
//synchronous operation (ie exec())
|
||||
QEventLoop *eventLoop;
|
||||
QEventLoop *eventLoop = nullptr;
|
||||
QPointer<QAction> syncAction;
|
||||
|
||||
//search buffer
|
||||
@ -423,18 +402,15 @@ public:
|
||||
inline int indexOf(QAction *act) const { return q_func()->actions().indexOf(act); }
|
||||
|
||||
//tear off support
|
||||
uint tearoff : 1, tornoff : 1, tearoffHighlighted : 1;
|
||||
QPointer<QTornOffMenu> tornPopup;
|
||||
|
||||
mutable bool hasCheckableItems;
|
||||
|
||||
QMenuSloppyState sloppyState;
|
||||
|
||||
//default action
|
||||
QPointer<QAction> defaultAction;
|
||||
|
||||
QAction *menuAction;
|
||||
QAction *defaultMenuAction;
|
||||
QAction *menuAction = nullptr;
|
||||
QAction *defaultMenuAction = nullptr;
|
||||
|
||||
void setOverrideMenuAction(QAction *);
|
||||
void _q_overrideMenuActionDestroyed();
|
||||
@ -452,9 +428,6 @@ public:
|
||||
void adjustMenuScreen(const QPoint &p);
|
||||
void updateLayoutDirection();
|
||||
|
||||
//menu fading/scrolling effects
|
||||
bool doChildEffects;
|
||||
|
||||
QPointer<QPlatformMenu> platformMenu;
|
||||
|
||||
QPointer<QAction> actionAboutToTrigger;
|
||||
@ -473,12 +446,37 @@ public:
|
||||
QMenuPrivate *menuPrivate;
|
||||
Type scrollType;
|
||||
};
|
||||
ScrollerTearOffItem *scrollUpTearOffItem;
|
||||
ScrollerTearOffItem *scrollDownItem;
|
||||
ScrollerTearOffItem *scrollUpTearOffItem = nullptr;
|
||||
ScrollerTearOffItem *scrollDownItem = nullptr;
|
||||
|
||||
void drawScroller(QPainter *painter, ScrollerTearOffItem::Type type, const QRect &rect);
|
||||
void drawTearOff(QPainter *painter, const QRect &rect);
|
||||
QRect rect() const;
|
||||
|
||||
mutable uint maxIconWidth = 0;
|
||||
mutable uint tabWidth = 0;
|
||||
int motions = 0;
|
||||
int mousePopupDelay = 0;
|
||||
|
||||
bool activationRecursionGuard = false;
|
||||
|
||||
mutable quint8 ncols = 0; // "255cols ought to be enough for anybody."
|
||||
|
||||
mutable bool itemsDirty : 1;
|
||||
mutable bool hasCheckableItems : 1;
|
||||
bool collapsibleSeparators : 1;
|
||||
bool toolTipsVisible : 1;
|
||||
bool delayedPopupGuard : 1;
|
||||
bool hasReceievedEnter : 1;
|
||||
// Selection
|
||||
bool hasHadMouse : 1;
|
||||
bool aboutToHide : 1;
|
||||
// Tear-off menus
|
||||
bool tearoff : 1;
|
||||
bool tornoff : 1;
|
||||
bool tearoffHighlighted : 1;
|
||||
//menu fading/scrolling effects
|
||||
bool doChildEffects : 1;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -1188,7 +1188,7 @@ void QMenuBar::leaveEvent(QEvent *)
|
||||
d->setCurrentAction(0);
|
||||
}
|
||||
|
||||
QPlatformMenu *QMenuBarPrivate::getPlatformMenu(QAction *action)
|
||||
QPlatformMenu *QMenuBarPrivate::getPlatformMenu(const QAction *action)
|
||||
{
|
||||
if (!action || !action->menu())
|
||||
return 0;
|
||||
@ -1203,6 +1203,29 @@ QPlatformMenu *QMenuBarPrivate::getPlatformMenu(QAction *action)
|
||||
return platformMenu;
|
||||
}
|
||||
|
||||
QPlatformMenu *QMenuBarPrivate::findInsertionPlatformMenu(const QAction *action)
|
||||
{
|
||||
Q_Q(QMenuBar);
|
||||
QPlatformMenu *beforeMenu = nullptr;
|
||||
for (int beforeIndex = indexOf(const_cast<QAction *>(action)) + 1;
|
||||
!beforeMenu && (beforeIndex < q->actions().size());
|
||||
++beforeIndex) {
|
||||
beforeMenu = getPlatformMenu(q->actions().at(beforeIndex));
|
||||
}
|
||||
|
||||
return beforeMenu;
|
||||
}
|
||||
|
||||
void QMenuBarPrivate::copyActionToPlatformMenu(const QAction *action, QPlatformMenu *menu)
|
||||
{
|
||||
const auto tag = reinterpret_cast<quintptr>(action);
|
||||
if (menu->tag() != tag)
|
||||
menu->setTag(tag);
|
||||
menu->setText(action->text());
|
||||
menu->setVisible(action->isVisible());
|
||||
menu->setEnabled(action->isEnabled());
|
||||
}
|
||||
|
||||
/*!
|
||||
\reimp
|
||||
*/
|
||||
@ -1219,16 +1242,9 @@ void QMenuBar::actionEvent(QActionEvent *e)
|
||||
if (e->type() == QEvent::ActionAdded) {
|
||||
QPlatformMenu *menu = d->getPlatformMenu(e->action());
|
||||
if (menu) {
|
||||
QPlatformMenu* beforeMenu = NULL;
|
||||
for (int beforeIndex = d->indexOf(e->action()) + 1;
|
||||
!beforeMenu && (beforeIndex < actions().size());
|
||||
++beforeIndex)
|
||||
{
|
||||
beforeMenu = d->getPlatformMenu(actions().at(beforeIndex));
|
||||
}
|
||||
d->copyActionToPlatformMenu(e->action(), menu);
|
||||
|
||||
menu->setTag(reinterpret_cast<quintptr>(e->action()));
|
||||
menu->setText(e->action()->text());
|
||||
QPlatformMenu *beforeMenu = d->findInsertionPlatformMenu(e->action());
|
||||
d->platformMenuBar->insertMenu(menu, beforeMenu);
|
||||
}
|
||||
} else if (e->type() == QEvent::ActionRemoved) {
|
||||
@ -1236,7 +1252,7 @@ void QMenuBar::actionEvent(QActionEvent *e)
|
||||
if (menu)
|
||||
d->platformMenuBar->removeMenu(menu);
|
||||
} else if (e->type() == QEvent::ActionChanged) {
|
||||
QPlatformMenu* cur = d->platformMenuBar->menuForTag(reinterpret_cast<quintptr>(e->action()));
|
||||
QPlatformMenu *cur = d->platformMenuBar->menuForTag(reinterpret_cast<quintptr>(e->action()));
|
||||
QPlatformMenu *menu = d->getPlatformMenu(e->action());
|
||||
|
||||
// the menu associated with the action can change, need to
|
||||
@ -1245,21 +1261,13 @@ void QMenuBar::actionEvent(QActionEvent *e)
|
||||
if (cur)
|
||||
d->platformMenuBar->removeMenu(cur);
|
||||
if (menu) {
|
||||
menu->setTag(reinterpret_cast<quintptr>(e->action()));
|
||||
d->copyActionToPlatformMenu(e->action(), menu);
|
||||
|
||||
QPlatformMenu* beforeMenu = NULL;
|
||||
for (int beforeIndex = d->indexOf(e->action()) + 1;
|
||||
!beforeMenu && (beforeIndex < actions().size());
|
||||
++beforeIndex)
|
||||
{
|
||||
beforeMenu = d->getPlatformMenu(actions().at(beforeIndex));
|
||||
}
|
||||
QPlatformMenu *beforeMenu = d->findInsertionPlatformMenu(e->action());
|
||||
d->platformMenuBar->insertMenu(menu, beforeMenu);
|
||||
}
|
||||
} else if (menu) {
|
||||
menu->setText(e->action()->text());
|
||||
menu->setVisible(e->action()->isVisible());
|
||||
menu->setEnabled(e->action()->isEnabled());
|
||||
d->copyActionToPlatformMenu(e->action(), menu);
|
||||
d->platformMenuBar->syncMenu(menu);
|
||||
}
|
||||
}
|
||||
|
@ -132,7 +132,9 @@ public:
|
||||
|
||||
QBasicTimer autoReleaseTimer;
|
||||
QPlatformMenuBar *platformMenuBar;
|
||||
QPlatformMenu *getPlatformMenu(QAction *action);
|
||||
QPlatformMenu *getPlatformMenu(const QAction *action);
|
||||
QPlatformMenu *findInsertionPlatformMenu(const QAction *action);
|
||||
void copyActionToPlatformMenu(const QAction *e, QPlatformMenu *menu);
|
||||
|
||||
inline int indexOf(QAction *act) const { return q_func()->actions().indexOf(act); }
|
||||
};
|
||||
|
@ -46,5 +46,5 @@ else:!qtConfig(process): SUBDIRS -= tools
|
||||
|
||||
# QTBUG-63915
|
||||
boot2qt: {
|
||||
contains(QT_ARCH, arm64): SUBDIRS -= dbus
|
||||
SUBDIRS -= dbus
|
||||
}
|
||||
|
@ -3,3 +3,5 @@ windows
|
||||
[finishWithUncontrolledAnimation]
|
||||
windows
|
||||
osx-10.12
|
||||
[groupWithZeroDurationAnimations]
|
||||
osx
|
||||
|
@ -405,6 +405,8 @@ void tst_QFile::cleanup()
|
||||
QDir remainingDir(absoluteFilePath);
|
||||
QVERIFY2(remainingDir.removeRecursively(), qPrintable(absoluteFilePath));
|
||||
} else {
|
||||
if (!(QFile::permissions(absoluteFilePath) & QFile::WriteUser))
|
||||
QVERIFY2(QFile::setPermissions(absoluteFilePath, QFile::WriteUser), qPrintable(absoluteFilePath));
|
||||
QVERIFY2(QFile::remove(absoluteFilePath), qPrintable(absoluteFilePath));
|
||||
}
|
||||
}
|
||||
@ -443,8 +445,6 @@ void tst_QFile::initTestCase()
|
||||
m_stdinProcessDir = QFINDTESTDATA("stdinprocess");
|
||||
QVERIFY(!m_stdinProcessDir.isEmpty());
|
||||
#endif
|
||||
m_testSourceFile = QFINDTESTDATA("tst_qfile.cpp");
|
||||
QVERIFY(!m_testSourceFile.isEmpty());
|
||||
m_testLogFile = QFINDTESTDATA("testlog.txt");
|
||||
QVERIFY(!m_testLogFile.isEmpty());
|
||||
m_dosFile = QFINDTESTDATA("dosfile.txt");
|
||||
@ -457,15 +457,19 @@ void tst_QFile::initTestCase()
|
||||
QVERIFY(!m_twoDotsFile.isEmpty());
|
||||
|
||||
#ifndef BUILTIN_TESTDATA
|
||||
m_testSourceFile = QFINDTESTDATA("tst_qfile.cpp");
|
||||
QVERIFY(!m_testSourceFile.isEmpty());
|
||||
m_testFile = QFINDTESTDATA("testfile.txt");
|
||||
QVERIFY(!m_testFile.isEmpty());
|
||||
m_resourcesDir = QFINDTESTDATA("resources");
|
||||
QVERIFY(!m_resourcesDir.isEmpty());
|
||||
#else
|
||||
m_dataDir = QEXTRACTTESTDATA("/");
|
||||
QVERIFY2(!m_dataDir.isNull(), qPrintable("Could not extract test data"));
|
||||
m_testFile = m_dataDir->path() + "/testfile.txt";
|
||||
m_testSourceFile = m_dataDir->path() + "/tst_qfile.cpp";
|
||||
m_resourcesDir = m_dataDir->path() + "/resources";
|
||||
#endif
|
||||
m_resourcesDir = QFINDTESTDATA("resources");
|
||||
QVERIFY(!m_resourcesDir.isEmpty());
|
||||
m_noEndOfLineFile = QFINDTESTDATA("noendofline.txt");
|
||||
QVERIFY(!m_noEndOfLineFile.isEmpty());
|
||||
|
||||
@ -2189,12 +2193,20 @@ public:
|
||||
if (fileName.startsWith(":!")) {
|
||||
QDir dir;
|
||||
|
||||
QString realFile = QFINDTESTDATA(fileName.mid(2));
|
||||
#ifndef BUILTIN_TESTDATA
|
||||
const QString realFile = QFINDTESTDATA(fileName.mid(2));
|
||||
#else
|
||||
const QString realFile = m_dataDir->filePath(fileName.mid(2));
|
||||
#endif
|
||||
if (dir.exists(realFile))
|
||||
return new QFSFileEngine(realFile);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef BUILTIN_TESTDATA
|
||||
QSharedPointer<QTemporaryDir> m_dataDir;
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -2203,6 +2215,9 @@ void tst_QFile::useQFileInAFileHandler()
|
||||
{
|
||||
// This test should not dead-lock
|
||||
MyRecursiveHandler handler;
|
||||
#ifdef BUILTIN_TESTDATA
|
||||
handler.m_dataDir = m_dataDir;
|
||||
#endif
|
||||
QFile file(":!tst_qfile.cpp");
|
||||
QVERIFY(file.exists());
|
||||
}
|
||||
|
@ -4,4 +4,4 @@ SOURCES += tst_qtemporarydir.cpp
|
||||
INCLUDEPATH += ../../../../shared/
|
||||
HEADERS += ../../../../shared/emulationdetector.h
|
||||
|
||||
QT = core testlib
|
||||
QT = core testlib testlib-private
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include <qdir.h>
|
||||
#include <qset.h>
|
||||
#include <qtextcodec.h>
|
||||
#include <QtTest/private/qtesthelpers_p.h>
|
||||
#ifdef Q_OS_WIN
|
||||
# include <windows.h>
|
||||
#endif
|
||||
@ -112,16 +113,6 @@ void tst_QTemporaryDir::getSetCheck()
|
||||
QCOMPARE(true, obj1.autoRemove());
|
||||
}
|
||||
|
||||
static inline bool canHandleUnicodeFileNames()
|
||||
{
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
|
||||
return true;
|
||||
#else
|
||||
// Check for UTF-8 by converting the Euro symbol (see tst_utf8)
|
||||
return QFile::encodeName(QString(QChar(0x20AC))) == QByteArrayLiteral("\342\202\254");
|
||||
#endif
|
||||
}
|
||||
|
||||
static QString hanTestText()
|
||||
{
|
||||
QString text;
|
||||
@ -159,7 +150,7 @@ void tst_QTemporaryDir::fileTemplate_data()
|
||||
QTest::newRow("4Xsuffix") << "qt_XXXXXX_XXXX" << "qt_" << "_XXXX";
|
||||
QTest::newRow("4Xprefix") << "qt_XXXX" << "qt_XXXX" << "";
|
||||
QTest::newRow("5Xprefix") << "qt_XXXXX" << "qt_XXXXX" << "";
|
||||
if (canHandleUnicodeFileNames()) {
|
||||
if (QTestPrivate::canHandleUnicodeFileNames()) {
|
||||
// Test Umlauts (contained in Latin1)
|
||||
QString prefix = "qt_" + umlautTestText();
|
||||
QTest::newRow("Umlauts") << (prefix + "XXXXXX") << prefix << "";
|
||||
|
@ -1,6 +1,6 @@
|
||||
CONFIG += testcase
|
||||
TARGET = tst_qtemporaryfile
|
||||
QT = core testlib
|
||||
QT = core testlib testlib-private
|
||||
SOURCES = tst_qtemporaryfile.cpp
|
||||
TESTDATA += tst_qtemporaryfile.cpp
|
||||
RESOURCES += qtemporaryfile.qrc
|
||||
|
@ -38,6 +38,8 @@
|
||||
#include <qset.h>
|
||||
#include <qtextcodec.h>
|
||||
|
||||
#include <QtTest/private/qtesthelpers_p.h>
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
# include <windows.h>
|
||||
#endif
|
||||
@ -143,16 +145,6 @@ void tst_QTemporaryFile::getSetCheck()
|
||||
QCOMPARE(true, obj1.autoRemove());
|
||||
}
|
||||
|
||||
static inline bool canHandleUnicodeFileNames()
|
||||
{
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
|
||||
return true;
|
||||
#else
|
||||
// Check for UTF-8 by converting the Euro symbol (see tst_utf8)
|
||||
return QFile::encodeName(QString(QChar(0x20AC))) == QByteArrayLiteral("\342\202\254");
|
||||
#endif
|
||||
}
|
||||
|
||||
static QString hanTestText()
|
||||
{
|
||||
QString text;
|
||||
@ -201,7 +193,7 @@ void tst_QTemporaryFile::fileTemplate_data()
|
||||
QTest::newRow("set template, with xxx") << "" << "qt_" << ".xxx" << "qt_XXXXXX.xxx";
|
||||
QTest::newRow("set template, with >6 X's") << "" << "qt_" << ".xxx" << "qt_XXXXXXXXXXXXXX.xxx";
|
||||
QTest::newRow("set template, with >6 X's, no suffix") << "" << "qt_" << "" << "qt_XXXXXXXXXXXXXX";
|
||||
if (canHandleUnicodeFileNames()) {
|
||||
if (QTestPrivate::canHandleUnicodeFileNames()) {
|
||||
// Test Umlauts (contained in Latin1)
|
||||
QString prefix = "qt_" + umlautTestText();
|
||||
QTest::newRow("Umlauts") << (prefix + "XXXXXX") << prefix << QString() << QString();
|
||||
@ -824,7 +816,7 @@ void tst_QTemporaryFile::QTBUG_4796_data()
|
||||
QTest::newRow("XXXXXXbla") << QString() << QString("bla") << true;
|
||||
QTest::newRow("does-not-exist/qt_temp.XXXXXX") << QString("does-not-exist/qt_temp") << QString() << false;
|
||||
|
||||
if (canHandleUnicodeFileNames()) {
|
||||
if (QTestPrivate::canHandleUnicodeFileNames()) {
|
||||
QTest::newRow("XXXXXX<unicode>") << QString() << unicode << true;
|
||||
QTest::newRow("<unicode>XXXXXX") << unicode << QString() << true;
|
||||
QTest::newRow("<unicode>XXXXXX<unicode>") << unicode << unicode << true;
|
||||
|
@ -1,5 +1,7 @@
|
||||
# See qtbase/src/testlib/qtestblacklist.cpp for format
|
||||
osx
|
||||
[authenticationCacheAfterCancel]
|
||||
windows
|
||||
[ioGetFromBuiltinHttp:http+limited]
|
||||
ubuntu-14.04
|
||||
[ioGetFromBuiltinHttp:https+limited]
|
||||
@ -8,3 +10,29 @@ ubuntu-14.04
|
||||
*
|
||||
[backgroundRequestInterruption:ftp, bg, nobg]
|
||||
*
|
||||
[getErrors:ftp-host]
|
||||
linux
|
||||
[getFromHttpIntoBuffer]
|
||||
windows
|
||||
[getFromHttpIntoBuffer2]
|
||||
windows
|
||||
[headFromHttp]
|
||||
windows
|
||||
[ioGetFromHttpWithSocksProxy]
|
||||
windows
|
||||
[ioPostToHttpFromSocket]
|
||||
windows
|
||||
[ioHttpRedirectMultipartPost]
|
||||
linux
|
||||
[ioHttpRedirectPolicy]
|
||||
b2qt 64bit
|
||||
linux
|
||||
[ioHttpRedirectPostPut]
|
||||
linux
|
||||
windows
|
||||
[putWithServerClosingConnectionImmediately]
|
||||
windows
|
||||
[qtbug28035browserDoesNotLoadQtProjectOrgCorrectly]
|
||||
windows
|
||||
[getFromUnreachableIp]
|
||||
windows msvc-2017
|
||||
|
@ -13,7 +13,4 @@ RESOURCES += ../qnetworkreply.qrc
|
||||
TESTDATA += ../empty ../rfc3252.txt ../resource ../bigfile ../*.jpg ../certs \
|
||||
../index.html ../smb-file.txt
|
||||
|
||||
qtConfig(xcb): CONFIG+=insignificant_test # unstable, QTBUG-21102
|
||||
win32:CONFIG += insignificant_test # QTBUG-24226
|
||||
|
||||
!winrt: TEST_HELPER_INSTALLS = ../echo/echo
|
||||
|
@ -1994,6 +1994,16 @@ void tst_QNetworkReply::getErrors_data()
|
||||
<< int(QNetworkReply::AuthenticationRequiredError) << 401 << false;
|
||||
}
|
||||
|
||||
static QByteArray msgGetErrors(int waitResult, const QNetworkReplyPtr &reply)
|
||||
{
|
||||
QByteArray result ="waitResult=" + QByteArray::number(waitResult);
|
||||
if (reply->isFinished())
|
||||
result += ", finished";
|
||||
if (reply->error() != QNetworkReply::NoError)
|
||||
result += ", error: " + QByteArray::number(int(reply->error()));
|
||||
return result;
|
||||
}
|
||||
|
||||
void tst_QNetworkReply::getErrors()
|
||||
{
|
||||
QFETCH(QString, url);
|
||||
@ -2023,7 +2033,8 @@ void tst_QNetworkReply::getErrors()
|
||||
QCOMPARE(reply->error(), QNetworkReply::NoError);
|
||||
|
||||
// now run the request:
|
||||
QVERIFY(waitForFinish(reply) != Timeout);
|
||||
const int waitResult = waitForFinish(reply);
|
||||
QVERIFY2(waitResult != Timeout, msgGetErrors(waitResult, reply));
|
||||
|
||||
QFETCH(int, error);
|
||||
QEXPECT_FAIL("ftp-is-dir", "QFtp cannot provide enough detail", Abort);
|
||||
@ -6755,6 +6766,48 @@ void tst_QNetworkReply::getFromUnreachableIp()
|
||||
{
|
||||
QNetworkAccessManager manager;
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
// This test assumes that attempt to connect to 255.255.255.255 fails more
|
||||
// or less fast/immediately. This is not what we observe on Windows x86:
|
||||
// WSAConnect on non-blocking socket returns SOCKET_ERROR, WSAGetLastError
|
||||
// returns WSAEWOULDBLOCK (expected) and getsockopt most of the time returns
|
||||
// NOERROR; so socket engine starts a timer (30 s.) and waits for a timeout/
|
||||
// error/success. Unfortunately, the test itself is waiting only for 5 s.
|
||||
// So we have to adjust the connection timeout or skip the test completely
|
||||
// if the 'bearermanagement' feature is not available.
|
||||
#if QT_CONFIG(bearermanagement)
|
||||
class ConfigurationGuard
|
||||
{
|
||||
public:
|
||||
explicit ConfigurationGuard(QNetworkAccessManager *m)
|
||||
: manager(m)
|
||||
{
|
||||
Q_ASSERT(m);
|
||||
auto conf = manager->configuration();
|
||||
previousTimeout = conf.connectTimeout();
|
||||
conf.setConnectTimeout(1500);
|
||||
manager->setConfiguration(conf);
|
||||
}
|
||||
~ConfigurationGuard()
|
||||
{
|
||||
Q_ASSERT(manager);
|
||||
auto conf = manager->configuration();
|
||||
conf.setConnectTimeout(previousTimeout);
|
||||
manager->setConfiguration(conf);
|
||||
}
|
||||
private:
|
||||
QNetworkAccessManager *manager = nullptr;
|
||||
int previousTimeout = 0;
|
||||
|
||||
Q_DISABLE_COPY(ConfigurationGuard)
|
||||
};
|
||||
|
||||
const ConfigurationGuard restorer(&manager);
|
||||
#else // bearermanagement
|
||||
QSKIP("This test is non-deterministic on Windows x86");
|
||||
#endif // !bearermanagement
|
||||
#endif // Q_OS_WIN32
|
||||
|
||||
QNetworkRequest request(QUrl("http://255.255.255.255/42/23/narf/narf/narf"));
|
||||
QNetworkReplyPtr reply(manager.get(request));
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
TEMPLATE = subdirs
|
||||
|
||||
SUBDIRS = test
|
||||
!vxworks: SUBDIRS += stressTest
|
||||
|
||||
!vxworks{
|
||||
SUBDIRS += stressTest
|
||||
test.depends = stressTest
|
||||
}
|
||||
requires(qtConfig(private_tests))
|
||||
|
@ -1,4 +1,3 @@
|
||||
TEMPLATE = subdirs
|
||||
SUBDIRS = test clientserver
|
||||
|
||||
|
||||
test.depends = clientserver
|
||||
|
@ -1,6 +1,7 @@
|
||||
CONFIG += testcase
|
||||
testcase.timeout = 800 # this test is slow
|
||||
SOURCES += ../tst_qudpsocket.cpp
|
||||
INCLUDEPATH += ../../../../../shared/
|
||||
QT = core network testlib
|
||||
|
||||
MOC_DIR=tmp
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Copyright (C) 2016 Intel Corporation.
|
||||
** Copyright (C) 2017 Intel Corporation.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the test suite of the Qt Toolkit.
|
||||
@ -45,6 +45,7 @@
|
||||
|
||||
#include <qstringlist.h>
|
||||
#include "../../../network-settings.h"
|
||||
#include "emulationdetector.h"
|
||||
|
||||
#ifndef QT_NO_BEARERMANAGEMENT
|
||||
#include <QtNetwork/qnetworkconfigmanager.h>
|
||||
@ -227,6 +228,9 @@ void tst_QUdpSocket::initTestCase()
|
||||
QSKIP("No network test server available");
|
||||
allAddresses = QNetworkInterface::allAddresses();
|
||||
m_skipUnsupportedIPv6Tests = shouldSkipIpv6TestsForBrokenSetsockopt();
|
||||
|
||||
if (EmulationDetector::isRunningArmOnX86())
|
||||
QSKIP("This test is unreliable due to QEMU emulation shortcomings.");
|
||||
}
|
||||
|
||||
void tst_QUdpSocket::init()
|
||||
@ -445,31 +449,58 @@ void tst_QUdpSocket::loop()
|
||||
paul.setProperty("_q_networksession", QVariant::fromValue(networkSession));
|
||||
#endif
|
||||
|
||||
QVERIFY2(peter.bind(), peter.errorString().toLatin1().constData());
|
||||
QVERIFY2(paul.bind(), paul.errorString().toLatin1().constData());
|
||||
// make sure we bind to IPv4
|
||||
QHostAddress localhost = QHostAddress::LocalHost;
|
||||
QVERIFY2(peter.bind(localhost), peter.errorString().toLatin1().constData());
|
||||
QVERIFY2(paul.bind(localhost), paul.errorString().toLatin1().constData());
|
||||
|
||||
QHostAddress peterAddress = makeNonAny(peter.localAddress());
|
||||
QHostAddress pualAddress = makeNonAny(paul.localAddress());
|
||||
QHostAddress paulAddress = makeNonAny(paul.localAddress());
|
||||
|
||||
QCOMPARE(peter.writeDatagram(peterMessage.data(), peterMessage.length(),
|
||||
pualAddress, paul.localPort()), qint64(peterMessage.length()));
|
||||
paulAddress, paul.localPort()), qint64(peterMessage.length()));
|
||||
QCOMPARE(paul.writeDatagram(paulMessage.data(), paulMessage.length(),
|
||||
peterAddress, peter.localPort()), qint64(paulMessage.length()));
|
||||
|
||||
QVERIFY2(peter.waitForReadyRead(9000), QtNetworkSettings::msgSocketError(peter).constData());
|
||||
QVERIFY2(paul.waitForReadyRead(9000), QtNetworkSettings::msgSocketError(paul).constData());
|
||||
char peterBuffer[16*1024];
|
||||
char paulBuffer[16*1024];
|
||||
|
||||
QNetworkDatagram peterDatagram = peter.receiveDatagram(paulMessage.length() * 2);
|
||||
QNetworkDatagram paulDatagram = paul.receiveDatagram(peterMessage.length() * 2);
|
||||
if (success) {
|
||||
QCOMPARE(peter.readDatagram(peterBuffer, sizeof(peterBuffer)), qint64(paulMessage.length()));
|
||||
QCOMPARE(paul.readDatagram(paulBuffer, sizeof(peterBuffer)), qint64(peterMessage.length()));
|
||||
QCOMPARE(peterDatagram.data().length(), qint64(paulMessage.length()));
|
||||
QCOMPARE(paulDatagram.data().length(), qint64(peterMessage.length()));
|
||||
} else {
|
||||
QVERIFY(peter.readDatagram(peterBuffer, sizeof(peterBuffer)) != paulMessage.length());
|
||||
QVERIFY(paul.readDatagram(paulBuffer, sizeof(peterBuffer)) != peterMessage.length());
|
||||
// this code path seems to never be executed
|
||||
QVERIFY(peterDatagram.data().length() != paulMessage.length());
|
||||
QVERIFY(paulDatagram.data().length() != peterMessage.length());
|
||||
}
|
||||
|
||||
QCOMPARE(QByteArray(peterBuffer, paulMessage.length()), paulMessage);
|
||||
QCOMPARE(QByteArray(paulBuffer, peterMessage.length()), peterMessage);
|
||||
QCOMPARE(peterDatagram.data().left(paulMessage.length()), paulMessage);
|
||||
QCOMPARE(paulDatagram.data().left(peterMessage.length()), peterMessage);
|
||||
|
||||
QCOMPARE(peterDatagram.senderAddress(), paulAddress);
|
||||
QCOMPARE(paulDatagram.senderAddress(), peterAddress);
|
||||
QCOMPARE(paulDatagram.senderPort(), int(peter.localPort()));
|
||||
QCOMPARE(peterDatagram.senderPort(), int(paul.localPort()));
|
||||
|
||||
// Unlike for IPv6 with IPV6_PKTINFO, IPv4 has no standardized way of
|
||||
// obtaining the packet's destination addresses. The destinationAddress and
|
||||
// destinationPort calls could fail, so whitelist the OSes for which we
|
||||
// know we have an implementation.
|
||||
#if defined(Q_OS_LINUX) || defined(Q_OS_BSD4) || defined(Q_OS_WIN)
|
||||
QVERIFY(peterDatagram.destinationPort() != -1);
|
||||
QVERIFY(paulDatagram.destinationPort() != -1);
|
||||
#endif
|
||||
if (peterDatagram.destinationPort() == -1) {
|
||||
QCOMPARE(peterDatagram.destinationAddress().protocol(), QAbstractSocket::UnknownNetworkLayerProtocol);
|
||||
QCOMPARE(paulDatagram.destinationAddress().protocol(), QAbstractSocket::UnknownNetworkLayerProtocol);
|
||||
} else {
|
||||
QCOMPARE(peterDatagram.destinationAddress(), makeNonAny(peter.localAddress()));
|
||||
QCOMPARE(paulDatagram.destinationAddress(), makeNonAny(paul.localAddress()));
|
||||
QVERIFY(peterDatagram.destinationAddress().isEqual(makeNonAny(peter.localAddress())));
|
||||
QVERIFY(paulDatagram.destinationAddress().isEqual(makeNonAny(paul.localAddress())));
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
@ -492,8 +523,8 @@ void tst_QUdpSocket::ipv6Loop()
|
||||
paul.setProperty("_q_networksession", QVariant::fromValue(networkSession));
|
||||
#endif
|
||||
|
||||
quint16 peterPort;
|
||||
quint16 paulPort;
|
||||
int peterPort;
|
||||
int paulPort;
|
||||
|
||||
if (!peter.bind(QHostAddress(QHostAddress::LocalHostIPv6), 0)) {
|
||||
QCOMPARE(peter.error(), QUdpSocket::UnsupportedSocketOperationError);
|
||||
@ -502,6 +533,8 @@ void tst_QUdpSocket::ipv6Loop()
|
||||
|
||||
QVERIFY(paul.bind(QHostAddress(QHostAddress::LocalHostIPv6), 0));
|
||||
|
||||
QHostAddress peterAddress = makeNonAny(peter.localAddress());
|
||||
QHostAddress paulAddress = makeNonAny(paul.localAddress());
|
||||
peterPort = peter.localPort();
|
||||
paulPort = paul.localPort();
|
||||
|
||||
@ -510,20 +543,33 @@ void tst_QUdpSocket::ipv6Loop()
|
||||
QCOMPARE(paul.writeDatagram(paulMessage.data(), paulMessage.length(),
|
||||
QHostAddress("::1"), peterPort), qint64(paulMessage.length()));
|
||||
|
||||
char peterBuffer[16*1024];
|
||||
char paulBuffer[16*1024];
|
||||
QVERIFY(peter.waitForReadyRead(5000));
|
||||
QVERIFY(paul.waitForReadyRead(5000));
|
||||
QNetworkDatagram peterDatagram = peter.receiveDatagram(paulMessage.length() * 2);
|
||||
QNetworkDatagram paulDatagram = paul.receiveDatagram(peterMessage.length() * 2);
|
||||
|
||||
if (success) {
|
||||
QCOMPARE(peter.readDatagram(peterBuffer, sizeof(peterBuffer)), qint64(paulMessage.length()));
|
||||
QCOMPARE(paul.readDatagram(paulBuffer, sizeof(peterBuffer)), qint64(peterMessage.length()));
|
||||
QCOMPARE(peterDatagram.data().length(), qint64(paulMessage.length()));
|
||||
QCOMPARE(paulDatagram.data().length(), qint64(peterMessage.length()));
|
||||
} else {
|
||||
QVERIFY(peter.readDatagram(peterBuffer, sizeof(peterBuffer)) != paulMessage.length());
|
||||
QVERIFY(paul.readDatagram(paulBuffer, sizeof(peterBuffer)) != peterMessage.length());
|
||||
// this code path seems to never be executed
|
||||
QVERIFY(peterDatagram.data().length() != paulMessage.length());
|
||||
QVERIFY(paulDatagram.data().length() != peterMessage.length());
|
||||
}
|
||||
|
||||
QCOMPARE(QByteArray(peterBuffer, paulMessage.length()), paulMessage);
|
||||
QCOMPARE(QByteArray(paulBuffer, peterMessage.length()), peterMessage);
|
||||
QCOMPARE(peterDatagram.data().left(paulMessage.length()), paulMessage);
|
||||
QCOMPARE(paulDatagram.data().left(peterMessage.length()), peterMessage);
|
||||
|
||||
QCOMPARE(peterDatagram.senderAddress(), paulAddress);
|
||||
QCOMPARE(paulDatagram.senderAddress(), peterAddress);
|
||||
QCOMPARE(paulDatagram.senderPort(), peterPort);
|
||||
QCOMPARE(peterDatagram.senderPort(), paulPort);
|
||||
|
||||
// For IPv6, IPV6_PKTINFO is a mandatory feature (RFC 3542).
|
||||
QCOMPARE(peterDatagram.destinationAddress(), makeNonAny(peter.localAddress()));
|
||||
QCOMPARE(paulDatagram.destinationAddress(), makeNonAny(paul.localAddress()));
|
||||
QCOMPARE(peterDatagram.destinationPort(), peterPort);
|
||||
QCOMPARE(paulDatagram.destinationPort(), paulPort);
|
||||
}
|
||||
|
||||
void tst_QUdpSocket::dualStack()
|
||||
@ -539,17 +585,23 @@ void tst_QUdpSocket::dualStack()
|
||||
QByteArray v4Data("v4");
|
||||
QVERIFY(v4Sock.bind(QHostAddress(QHostAddress::AnyIPv4), 0));
|
||||
|
||||
QHostAddress from;
|
||||
quint16 port;
|
||||
QByteArray buffer;
|
||||
//test v4 -> dual
|
||||
QCOMPARE((int)v4Sock.writeDatagram(v4Data.constData(), v4Data.length(), QHostAddress(QHostAddress::LocalHost), dualSock.localPort()), v4Data.length());
|
||||
QVERIFY2(dualSock.waitForReadyRead(5000), QtNetworkSettings::msgSocketError(dualSock).constData());
|
||||
buffer.reserve(100);
|
||||
qint64 size = dualSock.readDatagram(buffer.data(), 100, &from, &port);
|
||||
QCOMPARE((int)size, v4Data.length());
|
||||
buffer.resize(size);
|
||||
QCOMPARE(buffer, v4Data);
|
||||
QNetworkDatagram dgram = dualSock.receiveDatagram(100);
|
||||
QVERIFY(dgram.isValid());
|
||||
QCOMPARE(dgram.data(), v4Data);
|
||||
QCOMPARE(dgram.senderPort(), int(v4Sock.localPort()));
|
||||
// receiving v4 on dual stack will receive as IPv6, so use isEqual()
|
||||
QVERIFY(dgram.senderAddress().isEqual(makeNonAny(v4Sock.localAddress(), QHostAddress::Null)));
|
||||
if (dualSock.localAddress().protocol() == QAbstractSocket::IPv4Protocol)
|
||||
QCOMPARE(dgram.senderAddress(), makeNonAny(v4Sock.localAddress(), QHostAddress::Null));
|
||||
if (dgram.destinationPort() != -1) {
|
||||
QCOMPARE(dgram.destinationPort(), int(dualSock.localPort()));
|
||||
QVERIFY(dgram.destinationAddress().isEqual(dualSock.localAddress()));
|
||||
} else {
|
||||
qInfo("Getting IPv4 destination address failed.");
|
||||
}
|
||||
|
||||
if (QtNetworkSettings::hasIPv6()) {
|
||||
QUdpSocket v6Sock;
|
||||
@ -559,30 +611,41 @@ void tst_QUdpSocket::dualStack()
|
||||
//test v6 -> dual
|
||||
QCOMPARE((int)v6Sock.writeDatagram(v6Data.constData(), v6Data.length(), QHostAddress(QHostAddress::LocalHostIPv6), dualSock.localPort()), v6Data.length());
|
||||
QVERIFY2(dualSock.waitForReadyRead(5000), QtNetworkSettings::msgSocketError(dualSock).constData());
|
||||
buffer.reserve(100);
|
||||
size = dualSock.readDatagram(buffer.data(), 100, &from, &port);
|
||||
QCOMPARE((int)size, v6Data.length());
|
||||
buffer.resize(size);
|
||||
QCOMPARE(buffer, v6Data);
|
||||
dgram = dualSock.receiveDatagram(100);
|
||||
QVERIFY(dgram.isValid());
|
||||
QCOMPARE(dgram.data(), v6Data);
|
||||
QCOMPARE(dgram.senderPort(), int(v6Sock.localPort()));
|
||||
QCOMPARE(dgram.senderAddress(), makeNonAny(v6Sock.localAddress(), QHostAddress::LocalHostIPv6));
|
||||
QCOMPARE(dgram.destinationPort(), int(dualSock.localPort()));
|
||||
QCOMPARE(dgram.destinationAddress(), makeNonAny(dualSock.localAddress(), QHostAddress::LocalHostIPv6));
|
||||
|
||||
//test dual -> v6
|
||||
QCOMPARE((int)dualSock.writeDatagram(dualData.constData(), dualData.length(), QHostAddress(QHostAddress::LocalHostIPv6), v6Sock.localPort()), dualData.length());
|
||||
QVERIFY2(v6Sock.waitForReadyRead(5000), QtNetworkSettings::msgSocketError(v6Sock).constData());
|
||||
buffer.reserve(100);
|
||||
size = v6Sock.readDatagram(buffer.data(), 100, &from, &port);
|
||||
QCOMPARE((int)size, dualData.length());
|
||||
buffer.resize(size);
|
||||
QCOMPARE(buffer, dualData);
|
||||
dgram = v6Sock.receiveDatagram(100);
|
||||
QVERIFY(dgram.isValid());
|
||||
QCOMPARE(dgram.data(), dualData);
|
||||
QCOMPARE(dgram.senderPort(), int(dualSock.localPort()));
|
||||
QCOMPARE(dgram.senderAddress(), makeNonAny(dualSock.localAddress(), QHostAddress::LocalHostIPv6));
|
||||
QCOMPARE(dgram.destinationPort(), int(v6Sock.localPort()));
|
||||
QCOMPARE(dgram.destinationAddress(), makeNonAny(v6Sock.localAddress(), QHostAddress::LocalHostIPv6));
|
||||
}
|
||||
|
||||
//test dual -> v4
|
||||
QCOMPARE((int)dualSock.writeDatagram(dualData.constData(), dualData.length(), QHostAddress(QHostAddress::LocalHost), v4Sock.localPort()), dualData.length());
|
||||
QVERIFY2(v4Sock.waitForReadyRead(5000), QtNetworkSettings::msgSocketError(v4Sock).constData());
|
||||
buffer.reserve(100);
|
||||
size = v4Sock.readDatagram(buffer.data(), 100, &from, &port);
|
||||
QCOMPARE((int)size, dualData.length());
|
||||
buffer.resize(size);
|
||||
QCOMPARE(buffer, dualData);
|
||||
dgram = v4Sock.receiveDatagram(100);
|
||||
QVERIFY(dgram.isValid());
|
||||
QCOMPARE(dgram.data(), dualData);
|
||||
QCOMPARE(dgram.senderPort(), int(dualSock.localPort()));
|
||||
QCOMPARE(dgram.senderAddress(), makeNonAny(dualSock.localAddress(), QHostAddress::LocalHost));
|
||||
#if defined(Q_OS_LINUX) || defined(Q_OS_BSD4) || defined(Q_OS_WIN)
|
||||
QVERIFY(dgram.destinationPort() != -1);
|
||||
#endif
|
||||
if (dgram.destinationPort() != -1) {
|
||||
QCOMPARE(dgram.destinationPort(), int(v4Sock.localPort()));
|
||||
QCOMPARE(dgram.destinationAddress(), makeNonAny(v4Sock.localAddress(), QHostAddress::LocalHost));
|
||||
}
|
||||
}
|
||||
|
||||
void tst_QUdpSocket::dualStackAutoBinding()
|
||||
@ -1603,6 +1666,8 @@ void tst_QUdpSocket::linkLocalIPv6()
|
||||
QVERIFY(dgram.isValid());
|
||||
QCOMPARE(dgram.senderAddress(), s->localAddress());
|
||||
QCOMPARE(dgram.senderPort(), int(s->localPort()));
|
||||
QCOMPARE(dgram.destinationAddress(), s->localAddress());
|
||||
QCOMPARE(dgram.destinationPort(), int(neutral.localPort()));
|
||||
QCOMPARE(dgram.data().length(), testData.length());
|
||||
QCOMPARE(dgram.data(), testData);
|
||||
|
||||
@ -1684,6 +1749,20 @@ void tst_QUdpSocket::linkLocalIPv4()
|
||||
QCOMPARE(dgram.data().length(), testData.length());
|
||||
QCOMPARE(dgram.data(), testData);
|
||||
|
||||
// Unlike for IPv6 with IPV6_PKTINFO, IPv4 has no standardized way of
|
||||
// obtaining the packet's destination addresses. The destinationAddress
|
||||
// and destinationPort calls could fail, so whitelist the OSes we know
|
||||
// we have an implementation.
|
||||
#if defined(Q_OS_LINUX) || defined(Q_OS_BSD4) || defined(Q_OS_WIN)
|
||||
QVERIFY(dgram.destinationPort() != -1);
|
||||
#endif
|
||||
if (dgram.destinationPort() == -1) {
|
||||
QCOMPARE(dgram.destinationAddress().protocol(), QAbstractSocket::UnknownNetworkLayerProtocol);
|
||||
} else {
|
||||
QCOMPARE(dgram.destinationAddress(), s->localAddress());
|
||||
QCOMPARE(dgram.destinationPort(), int(neutral.localPort()));
|
||||
}
|
||||
|
||||
QVERIFY(neutral.writeDatagram(dgram.makeReply(testData)));
|
||||
|
||||
dgram = s->receiveDatagram(testData.length() * 2);
|
||||
|
@ -1,7 +1,7 @@
|
||||
CONFIG += testcase
|
||||
TARGET = tst_qaccessibility
|
||||
requires(qtConfig(accessibility))
|
||||
QT += testlib core-private gui-private widgets-private
|
||||
QT += testlib core-private gui-private widgets-private testlib-private
|
||||
SOURCES += tst_qaccessibility.cpp
|
||||
HEADERS += accessiblewidgets.h
|
||||
|
||||
|
@ -59,15 +59,9 @@
|
||||
|
||||
#include "accessiblewidgets.h"
|
||||
|
||||
// Make a widget frameless to prevent size constraints of title bars
|
||||
// from interfering (Windows).
|
||||
static inline void setFrameless(QWidget *w)
|
||||
{
|
||||
Qt::WindowFlags flags = w->windowFlags();
|
||||
flags |= Qt::FramelessWindowHint;
|
||||
flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
|
||||
w->setWindowFlags(flags);
|
||||
}
|
||||
#include <QtTest/private/qtesthelpers_p.h>
|
||||
|
||||
using namespace QTestPrivate;
|
||||
|
||||
static inline bool verifyChild(QWidget *child, QAccessibleInterface *interface,
|
||||
int index, const QRect &domain)
|
||||
|
@ -77,6 +77,8 @@ void tst_QSqlDriver::recreateTestTables(QSqlDatabase db)
|
||||
doubleField = "more_data double";
|
||||
else if (dbType == QSqlDriver::Oracle)
|
||||
doubleField = "more_data number(8,7)";
|
||||
else if (dbType == QSqlDriver::PostgreSQL)
|
||||
doubleField = "more_data double precision";
|
||||
else
|
||||
doubleField = "more_data double(8,7)";
|
||||
QVERIFY_SQL( q, exec("create table " + relTEST1 +
|
||||
|
@ -146,7 +146,7 @@ private slots:
|
||||
void batchExec();
|
||||
void QTBUG_43874_data() { generic_data(); }
|
||||
void QTBUG_43874();
|
||||
void oraArrayBind_data() { generic_data(); }
|
||||
void oraArrayBind_data() { generic_data("QOCI"); }
|
||||
void oraArrayBind();
|
||||
void lastInsertId_data() { generic_data(); }
|
||||
void lastInsertId();
|
||||
|
@ -1,6 +1,6 @@
|
||||
CONFIG += testcase
|
||||
TARGET = tst_qgraphicsitem
|
||||
QT += widgets widgets-private testlib
|
||||
QT += widgets widgets-private testlib testlib-private
|
||||
QT += core-private gui-private
|
||||
SOURCES += tst_qgraphicsitem.cpp
|
||||
DEFINES += QT_NO_CAST_TO_ASCII
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
|
||||
#include <QtTest/QtTest>
|
||||
#include <QtTest/private/qtesthelpers_p.h>
|
||||
|
||||
#include <private/qgraphicsitem_p.h>
|
||||
#include <private/qgraphicsview_p.h>
|
||||
@ -128,17 +129,6 @@ static void sendKeyClick(QGraphicsScene *scene, Qt::Key key)
|
||||
sendKeyRelease(scene, key);
|
||||
}
|
||||
|
||||
static inline void centerOnScreen(QWidget *w, const QSize &size)
|
||||
{
|
||||
const QPoint offset = QPoint(size.width() / 2, size.height() / 2);
|
||||
w->move(QGuiApplication::primaryScreen()->availableGeometry().center() - offset);
|
||||
}
|
||||
|
||||
static inline void centerOnScreen(QWidget *w)
|
||||
{
|
||||
centerOnScreen(w, w->geometry().size());
|
||||
}
|
||||
|
||||
class EventSpy : public QGraphicsWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -4212,7 +4202,7 @@ void tst_QGraphicsItem::cursor()
|
||||
|
||||
QWidget topLevel;
|
||||
topLevel.resize(250, 150);
|
||||
centerOnScreen(&topLevel);
|
||||
QTestPrivate::centerOnScreen(&topLevel);
|
||||
QGraphicsView view(&scene,&topLevel);
|
||||
view.setFixedSize(200, 100);
|
||||
topLevel.show();
|
||||
|
@ -3,7 +3,7 @@ testcase.timeout = 500 # this test is slow
|
||||
TARGET = tst_qgraphicsview
|
||||
|
||||
QT += widgets widgets-private testlib
|
||||
QT += core-private gui-private
|
||||
QT += core-private gui-private testlib-private
|
||||
|
||||
SOURCES += tst_qgraphicsview.cpp tst_qgraphicsview_2.cpp
|
||||
HEADERS += tst_qgraphicsview.h
|
||||
|
@ -61,6 +61,10 @@
|
||||
|
||||
#include "tst_qgraphicsview.h"
|
||||
|
||||
#include <QtTest/private/qtesthelpers_p.h>
|
||||
|
||||
using namespace QTestPrivate;
|
||||
|
||||
Q_DECLARE_METATYPE(ExpectedValueDescription)
|
||||
Q_DECLARE_METATYPE(QList<int>)
|
||||
Q_DECLARE_METATYPE(QList<QRectF>)
|
||||
@ -130,14 +134,6 @@ class FriendlyGraphicsScene : public QGraphicsScene
|
||||
};
|
||||
#endif
|
||||
|
||||
static inline void setFrameless(QWidget *w)
|
||||
{
|
||||
Qt::WindowFlags flags = w->windowFlags();
|
||||
flags |= Qt::FramelessWindowHint;
|
||||
flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
|
||||
w->setWindowFlags(flags);
|
||||
}
|
||||
|
||||
class tst_QGraphicsView : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -1,4 +1,4 @@
|
||||
CONFIG += testcase
|
||||
TARGET = tst_qabstractitemview
|
||||
QT += widgets testlib
|
||||
QT += widgets testlib testlib-private
|
||||
SOURCES += tst_qabstractitemview.cpp
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
|
||||
#include <QtTest/QtTest>
|
||||
#include <QtTest/private/qtesthelpers_p.h>
|
||||
|
||||
#include <qabstractitemview.h>
|
||||
#include <qstandarditemmodel.h>
|
||||
@ -57,19 +58,7 @@
|
||||
|
||||
Q_DECLARE_METATYPE(Qt::ItemFlags);
|
||||
|
||||
static inline void setFrameless(QWidget *w)
|
||||
{
|
||||
Qt::WindowFlags flags = w->windowFlags();
|
||||
flags |= Qt::FramelessWindowHint;
|
||||
flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
|
||||
w->setWindowFlags(flags);
|
||||
}
|
||||
|
||||
static inline void centerOnScreen(QWidget *w)
|
||||
{
|
||||
const QPoint offset = QPoint(w->width() / 2, w->height() / 2);
|
||||
w->move(QGuiApplication::primaryScreen()->availableGeometry().center() - offset);
|
||||
}
|
||||
using namespace QTestPrivate;
|
||||
|
||||
// Move cursor out of widget area to avoid undesired interaction on Mac.
|
||||
static inline void moveCursorAway(const QWidget *topLevel)
|
||||
|
@ -1,6 +1,6 @@
|
||||
CONFIG += testcase
|
||||
QT += widgets widgets-private
|
||||
QT += gui-private core-private testlib
|
||||
QT += gui-private core-private testlib testlib-private
|
||||
|
||||
SOURCES += tst_qcolumnview.cpp
|
||||
HEADERS += ../../../../shared/fakedirmodel.h
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
#include "../../../../shared/fakedirmodel.h"
|
||||
#include <QtTest/QtTest>
|
||||
#include <QtTest/private/qtesthelpers_p.h>
|
||||
#include <qitemdelegate.h>
|
||||
#include <qcolumnview.h>
|
||||
#include <private/qcolumnviewgrip_p.h>
|
||||
@ -369,12 +370,6 @@ void tst_QColumnView::scrollTo_data()
|
||||
QTest::newRow("reverse") << true << false;
|
||||
}
|
||||
|
||||
static inline void centerOnScreen(QWidget *w)
|
||||
{
|
||||
const QPoint offset = QPoint(w->width() / 2, w->height() / 2);
|
||||
w->move(QGuiApplication::primaryScreen()->availableGeometry().center() - offset);
|
||||
}
|
||||
|
||||
void tst_QColumnView::scrollTo()
|
||||
{
|
||||
QFETCH(bool, reverse);
|
||||
@ -386,7 +381,7 @@ void tst_QColumnView::scrollTo()
|
||||
view.resize(200, 200);
|
||||
topLevel.show();
|
||||
topLevel.activateWindow();
|
||||
centerOnScreen(&topLevel);
|
||||
QTestPrivate::centerOnScreen(&topLevel);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&topLevel));
|
||||
|
||||
view.scrollTo(QModelIndex(), QAbstractItemView::EnsureVisible);
|
||||
@ -1004,7 +999,7 @@ void tst_QColumnView::dynamicModelChanges()
|
||||
ColumnView view;
|
||||
view.setModel(&model);
|
||||
view.setItemDelegate(&delegate);
|
||||
centerOnScreen(&view);
|
||||
QTestPrivate::centerOnScreen(&view);
|
||||
view.show();
|
||||
|
||||
QStandardItem *item = new QStandardItem(QLatin1String("item"));
|
||||
|
@ -3006,6 +3006,7 @@ void tst_QHeaderView::stretchAndRestoreLastSection()
|
||||
tv.setModel(&m);
|
||||
tv.showMaximized();
|
||||
|
||||
const int minimumSectionSize = 20;
|
||||
const int defaultSectionSize = 30;
|
||||
const int someOtherSectionSize = 40;
|
||||
const int biggerSizeThanAnySection = 50;
|
||||
@ -3013,6 +3014,9 @@ void tst_QHeaderView::stretchAndRestoreLastSection()
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&tv));
|
||||
|
||||
QHeaderView &header = *tv.horizontalHeader();
|
||||
// set minimum size before resizeSections() is called
|
||||
// which is done inside setStretchLastSection
|
||||
header.setMinimumSectionSize(minimumSectionSize);
|
||||
header.setDefaultSectionSize(defaultSectionSize);
|
||||
header.resizeSection(9, someOtherSectionSize);
|
||||
header.setStretchLastSection(true);
|
||||
|
@ -1,6 +1,6 @@
|
||||
CONFIG += testcase
|
||||
TARGET = tst_qlistview
|
||||
QT += widgets gui-private widgets-private core-private testlib
|
||||
QT += widgets gui-private widgets-private core-private testlib testlib-private
|
||||
SOURCES += tst_qlistview.cpp
|
||||
win32:!winrt: LIBS += -luser32
|
||||
linux*: CONFIG += insignificant_test # Crashes
|
||||
|
@ -46,6 +46,10 @@
|
||||
#include <QtWidgets/QStyleFactory>
|
||||
#include <QtWidgets/QVBoxLayout>
|
||||
|
||||
#include <QtTest/private/qtesthelpers_p.h>
|
||||
|
||||
using namespace QTestPrivate;
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
# include <windows.h>
|
||||
# include <QtGui/QGuiApplication>
|
||||
@ -64,16 +68,6 @@ Q_DECLARE_METATYPE(QAbstractItemView::ScrollMode)
|
||||
Q_DECLARE_METATYPE(QMargins)
|
||||
Q_DECLARE_METATYPE(QSize)
|
||||
|
||||
// Make a widget frameless to prevent size constraints of title bars
|
||||
// from interfering (Windows).
|
||||
static inline void setFrameless(QWidget *w)
|
||||
{
|
||||
Qt::WindowFlags flags = w->windowFlags();
|
||||
flags |= Qt::FramelessWindowHint;
|
||||
flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
|
||||
w->setWindowFlags(flags);
|
||||
}
|
||||
|
||||
static QStringList generateList(const QString &prefix, int size)
|
||||
{
|
||||
QStringList result;
|
||||
|
@ -1,6 +1,6 @@
|
||||
CONFIG += testcase
|
||||
TARGET = tst_qtableview
|
||||
QT += widgets widgets-private testlib
|
||||
QT += core-private gui-private
|
||||
QT += core-private gui-private testlib-private
|
||||
|
||||
SOURCES += tst_qtableview.cpp
|
||||
|
@ -35,6 +35,10 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <QtTest/private/qtesthelpers_p.h>
|
||||
|
||||
using namespace QTestPrivate;
|
||||
|
||||
#ifdef QT_BUILD_INTERNAL
|
||||
#define VERIFY_SPANS_CONSISTENCY(TEST_VIEW_) \
|
||||
QVERIFY(static_cast<QTableViewPrivate*>(QObjectPrivate::get(TEST_VIEW_))->spans.checkConsistency())
|
||||
@ -46,16 +50,6 @@ typedef QList<int> IntList;
|
||||
|
||||
typedef QList<bool> BoolList;
|
||||
|
||||
// Make a widget frameless to prevent size constraints of title bars
|
||||
// from interfering (Windows).
|
||||
static inline void setFrameless(QWidget *w)
|
||||
{
|
||||
Qt::WindowFlags flags = w->windowFlags();
|
||||
flags |= Qt::FramelessWindowHint;
|
||||
flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
|
||||
w->setWindowFlags(flags);
|
||||
}
|
||||
|
||||
class tst_QTableView : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -1,6 +1,6 @@
|
||||
CONFIG += testcase
|
||||
TARGET = tst_qtreeview
|
||||
QT += widgets testlib
|
||||
QT += widgets-private gui-private core-private
|
||||
QT += widgets-private gui-private core-private testlib-private
|
||||
SOURCES += tst_qtreeview.cpp
|
||||
HEADERS += ../../../../shared/fakedirmodel.h
|
||||
|
@ -33,6 +33,10 @@
|
||||
#include <QtWidgets/QtWidgets>
|
||||
#include <private/qtreeview_p.h>
|
||||
|
||||
#include <QtTest/private/qtesthelpers_p.h>
|
||||
|
||||
using namespace QTestPrivate;
|
||||
|
||||
#ifndef QT_NO_DRAGANDDROP
|
||||
Q_DECLARE_METATYPE(QAbstractItemView::DragDropMode)
|
||||
#endif
|
||||
@ -57,16 +61,6 @@ static void initStandardTreeModel(QStandardItemModel *model)
|
||||
model->insertRow(2, item);
|
||||
}
|
||||
|
||||
// Make a widget frameless to prevent size constraints of title bars
|
||||
// from interfering (Windows).
|
||||
static inline void setFrameless(QWidget *w)
|
||||
{
|
||||
Qt::WindowFlags flags = w->windowFlags();
|
||||
flags |= Qt::FramelessWindowHint;
|
||||
flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
|
||||
w->setWindowFlags(flags);
|
||||
}
|
||||
|
||||
class tst_QTreeView : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -26,7 +26,8 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#include <QDialog>
|
||||
#include <QMainWindow>
|
||||
#include <QtTest/QtTest>
|
||||
|
||||
#include <qapplication.h>
|
||||
@ -64,6 +65,8 @@ private slots:
|
||||
void repeat();
|
||||
void setData();
|
||||
void keysequence(); // QTBUG-53381
|
||||
void disableShortcutsWithBlockedWidgets_data();
|
||||
void disableShortcutsWithBlockedWidgets();
|
||||
|
||||
private:
|
||||
int m_lastEventType;
|
||||
@ -459,5 +462,52 @@ void tst_QAction::setData() // QTBUG-62006
|
||||
QCOMPARE(spy.count(), 1);
|
||||
}
|
||||
|
||||
void tst_QAction::disableShortcutsWithBlockedWidgets_data()
|
||||
{
|
||||
QTest::addColumn<Qt::ShortcutContext>("shortcutContext");
|
||||
QTest::addColumn<Qt::WindowModality>("windowModality");
|
||||
|
||||
QTest::newRow("application modal dialog should block window shortcut.")
|
||||
<< Qt::WindowShortcut << Qt::ApplicationModal;
|
||||
|
||||
QTest::newRow("application modal dialog should block application shortcut.")
|
||||
<< Qt::ApplicationShortcut << Qt::ApplicationModal;
|
||||
|
||||
QTest::newRow("window modal dialog should block application shortcut.")
|
||||
<< Qt::ApplicationShortcut << Qt::WindowModal;
|
||||
|
||||
QTest::newRow("window modal dialog should block window shortcut.")
|
||||
<< Qt::WindowShortcut << Qt::WindowModal;
|
||||
}
|
||||
|
||||
|
||||
void tst_QAction::disableShortcutsWithBlockedWidgets()
|
||||
{
|
||||
QMainWindow window;
|
||||
|
||||
QFETCH(Qt::ShortcutContext, shortcutContext);
|
||||
QAction action(&window);
|
||||
window.addAction(&action);
|
||||
action.setShortcut(QKeySequence(Qt::Key_1));
|
||||
action.setShortcutContext(shortcutContext);
|
||||
|
||||
window.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&window));
|
||||
|
||||
QDialog dialog(&window);
|
||||
QFETCH(Qt::WindowModality, windowModality);
|
||||
dialog.setWindowModality(windowModality);
|
||||
|
||||
dialog.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&dialog));
|
||||
|
||||
QApplication::setActiveWindow(&window);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&window));
|
||||
|
||||
QSignalSpy spy(&action, &QAction::triggered);
|
||||
QTest::keyPress(&window, Qt::Key_1);
|
||||
QCOMPARE(spy.count(), 0);
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_QAction)
|
||||
#include "tst_qaction.moc"
|
||||
|
@ -1,6 +1,6 @@
|
||||
CONFIG += testcase
|
||||
TARGET = tst_qboxlayout
|
||||
QT += widgets testlib
|
||||
QT += widgets testlib testlib-private
|
||||
SOURCES += tst_qboxlayout.cpp
|
||||
|
||||
|
||||
|
@ -31,13 +31,9 @@
|
||||
#include <QtGui>
|
||||
#include <QtWidgets>
|
||||
|
||||
static inline void setFrameless(QWidget *w)
|
||||
{
|
||||
Qt::WindowFlags flags = w->windowFlags();
|
||||
flags |= Qt::FramelessWindowHint;
|
||||
flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
|
||||
w->setWindowFlags(flags);
|
||||
}
|
||||
#include <QtTest/private/qtesthelpers_p.h>
|
||||
|
||||
using namespace QTestPrivate;
|
||||
|
||||
class tst_QBoxLayout : public QObject
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
CONFIG += testcase
|
||||
TARGET = tst_qformlayout
|
||||
QT += widgets testlib
|
||||
QT += widgets testlib testlib-private
|
||||
SOURCES += tst_qformlayout.cpp
|
||||
|
@ -41,20 +41,16 @@
|
||||
#include <QStyleFactory>
|
||||
#include <QSharedPointer>
|
||||
|
||||
#include <QtTest/private/qtesthelpers_p.h>
|
||||
|
||||
using namespace QTestPrivate;
|
||||
|
||||
#include <qformlayout.h>
|
||||
|
||||
// ItemRole has enumerators for numerical values 0..2, thus the only
|
||||
// valid numerical values for storing into an ItemRole variable are 0..3:
|
||||
Q_CONSTEXPR QFormLayout::ItemRole invalidRole = QFormLayout::ItemRole(3);
|
||||
|
||||
static inline void setFrameless(QWidget *w)
|
||||
{
|
||||
Qt::WindowFlags flags = w->windowFlags();
|
||||
flags |= Qt::FramelessWindowHint;
|
||||
flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
|
||||
w->setWindowFlags(flags);
|
||||
}
|
||||
|
||||
struct QFormLayoutTakeRowResultHolder {
|
||||
QFormLayoutTakeRowResultHolder(QFormLayout::TakeRowResult result) Q_DECL_NOTHROW
|
||||
: labelItem(result.labelItem),
|
||||
|
@ -2,7 +2,7 @@ CONFIG += testcase
|
||||
TARGET = tst_qgridlayout
|
||||
|
||||
QT += widgets widgets-private testlib
|
||||
QT += core-private gui-private
|
||||
QT += core-private gui-private testlib-private
|
||||
|
||||
SOURCES += tst_qgridlayout.cpp
|
||||
FORMS += sortdialog.ui
|
||||
|
@ -41,15 +41,9 @@
|
||||
#include <QStyleFactory>
|
||||
#include <QSharedPointer>
|
||||
|
||||
// Make a widget frameless to prevent size constraints of title bars
|
||||
// from interfering (Windows).
|
||||
static inline void setFrameless(QWidget *w)
|
||||
{
|
||||
Qt::WindowFlags flags = w->windowFlags();
|
||||
flags |= Qt::FramelessWindowHint;
|
||||
flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
|
||||
w->setWindowFlags(flags);
|
||||
}
|
||||
#include <QtTest/private/qtesthelpers_p.h>
|
||||
|
||||
using namespace QTestPrivate;
|
||||
|
||||
class tst_QGridLayout : public QObject
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
CONFIG += testcase
|
||||
TARGET = tst_qlayout
|
||||
|
||||
QT += widgets widgets-private testlib
|
||||
QT += widgets widgets-private testlib testlib-private
|
||||
|
||||
SOURCES += tst_qlayout.cpp
|
||||
TESTDATA += baseline/*
|
||||
|
@ -44,13 +44,9 @@
|
||||
#include <QRadioButton>
|
||||
#include <private/qlayoutengine_p.h>
|
||||
|
||||
static inline void setFrameless(QWidget *w)
|
||||
{
|
||||
Qt::WindowFlags flags = w->windowFlags();
|
||||
flags |= Qt::FramelessWindowHint;
|
||||
flags &= ~(Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
|
||||
w->setWindowFlags(flags);
|
||||
}
|
||||
#include <QtTest/private/qtesthelpers_p.h>
|
||||
|
||||
using namespace QTestPrivate;
|
||||
|
||||
class tst_QLayout : public QObject
|
||||
{
|
||||
|
@ -2,7 +2,7 @@ CONFIG += testcase
|
||||
testcase.timeout = 600 # this test is slow
|
||||
TARGET = tst_qwidget
|
||||
|
||||
QT += widgets core-private gui-private widgets-private testlib
|
||||
QT += widgets core-private gui-private widgets-private testlib testlib-private
|
||||
|
||||
SOURCES += tst_qwidget.cpp
|
||||
RESOURCES = qwidget.qrc
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user