Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts: src/widgets/dialogs/qcolordialog.cpp src/widgets/dialogs/qfiledialog.cpp tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp Change-Id: I34bc8a990f8f526889a95a5c7099ef557b9681ad
This commit is contained in:
commit
e918334045
@ -231,7 +231,7 @@ sub classNames {
|
||||
}
|
||||
if($line) {
|
||||
$line =~ s,//.*$,,; #remove c++ comments
|
||||
$line .= ";" if($line =~ m/^Q_[A-Z_]*\(.*\)[\r\n]*$/); #qt macro
|
||||
$line .= ";" if($line =~ m/^Q_[A-Z_0-9]*\(.*\)[\r\n]*$/); #qt macro
|
||||
$line .= ";" if($line =~ m/^QT_(BEGIN|END)_HEADER[\r\n]*$/); #qt macro
|
||||
$line .= ";" if($line =~ m/^QT_(BEGIN|END)_NAMESPACE(_[A-Z]+)*[\r\n]*$/); #qt macro
|
||||
$line .= ";" if($line =~ m/^QT_MODULE\(.*\)[\r\n]*$/); # QT_MODULE macro
|
||||
@ -362,7 +362,7 @@ sub check_header {
|
||||
$include = 0;
|
||||
}
|
||||
if ($include && $public_header) {
|
||||
print STDERR "$lib: ERROR: $iheader includes private header $include\n" if ($include =~ /_p.h$/);
|
||||
print STDERR "$lib: ERROR: $iheader includes private header $include\n" if ($include =~ /_p\.h$/);
|
||||
for my $trylib (keys(%modules)) {
|
||||
if (-e "$out_basedir/include/$trylib/$include") {
|
||||
print STDERR "$lib: WARNING: $iheader includes $include when it should include $trylib/$include\n";
|
||||
@ -989,7 +989,7 @@ foreach my $lib (@modules_to_sync) {
|
||||
my $header_dirname = "";
|
||||
foreach my $header (@headers) {
|
||||
my $shadow = ($header =~ s/^\*//);
|
||||
$header = 0 if($header =~ /^ui_.*.h/);
|
||||
$header = 0 if ($header =~ /^ui_.*\.h$/);
|
||||
foreach (@ignore_headers) {
|
||||
$header = 0 if($header eq $_);
|
||||
}
|
||||
@ -1001,7 +1001,7 @@ foreach my $lib (@modules_to_sync) {
|
||||
if(isQpaHeader($public_header)) {
|
||||
$public_header = 0;
|
||||
$qpa_header = 1;
|
||||
} elsif($allheadersprivate || $thisprivate || $public_header =~ /_p.h$/ || $public_header =~ /_pch.h$/) {
|
||||
} elsif ($allheadersprivate || $thisprivate || $public_header =~ /_p(ch)?\.h$/) {
|
||||
$public_header = 0;
|
||||
} else {
|
||||
foreach (@ignore_for_master_contents) {
|
||||
|
47
dist/changes-5.6.2
vendored
47
dist/changes-5.6.2
vendored
@ -41,6 +41,11 @@ information about a particular change.
|
||||
* Library *
|
||||
******************************************************************************
|
||||
|
||||
General
|
||||
-------
|
||||
|
||||
- [QTBUG-45291] Qt headers are now gcc -Wzero-as-null-pointer-constant clean.
|
||||
|
||||
QtCore
|
||||
------
|
||||
|
||||
@ -335,5 +340,47 @@ Windows
|
||||
|
||||
moc
|
||||
---
|
||||
|
||||
- [QTBUG-53441] Fixed crash on file ending with a backslash followed by
|
||||
carriage return
|
||||
|
||||
configure & build system
|
||||
------------------------
|
||||
|
||||
- [QTBUG-35886][QTBUG-51417] Fixed Fontconfig vs. system FreeType
|
||||
configuration.
|
||||
- [QTBUG-43784][X11] Fixed detection of GLX with -qt-xcb.
|
||||
- [QTBUG-52951] Fixed dynamic library support detection for platforms
|
||||
without libdl.
|
||||
- [QTBUG-53038] Fixed running of configure tests outside qtbase when
|
||||
cross compiling on Windows (for example for Android).
|
||||
- [QTBUG-53312] The flags supplied by the configure -D/-I/-L/-l options
|
||||
are now applied after Qt's own flags. This helps in some cases when
|
||||
the provided paths contain files which conflict with the Qt build.
|
||||
- [QTBUG-55011][Unix] Fixed -no-pkg-config being ignored by some
|
||||
configure tests, which led to build failures later on.
|
||||
- Fixed configure tests outside qtbase when $MAKEFLAGS contains the
|
||||
-i flag.
|
||||
- [Android] Some unused plugins are not built anymore.
|
||||
- [MinGW] Added support for -separate-debug-info.
|
||||
- [Unix] Added configure -no-opengles3 option.
|
||||
- [Unix] Fixed MySQL detection/use on RHEL 6.6.
|
||||
|
||||
qmake
|
||||
-----
|
||||
|
||||
- [QTBUG-41830] Fixed nested custom functions inheriting their callers'
|
||||
arguments.
|
||||
- [QTBUG-53895][MSVC] Started using separate PDB files for compiling
|
||||
and linking.
|
||||
- [QTBUG-54036][Darwin] Fixed installation of debug symbols.
|
||||
- [QTBUG-54550] Fixed access to freed memory in $$absolute_path().
|
||||
- [QTBUG-55183][nmake] _WINDLL is now automatically defined when building
|
||||
a DLL, consistently with Visual Studio.
|
||||
- [QTBUG-55649][QTBUG-55915][Xcode] Fixed support for Xcode 8.
|
||||
- Fixed several cases where the error() function would not abort qmake.
|
||||
- Interrupting a command run via system() will now abort qmake as well.
|
||||
- The packagesExist() function will now warn when used when Qt was
|
||||
configured with -no-pkg-config.
|
||||
- [Android] The default compiler flags were adjusted to match newer
|
||||
NDK versions.
|
||||
|
@ -522,16 +522,26 @@ bool QOpenGLShader::compileSourceCode(const char *source)
|
||||
|
||||
QVarLengthArray<const char *, 5> sourceChunks;
|
||||
QVarLengthArray<GLint, 5> sourceChunkLengths;
|
||||
QOpenGLContext *ctx = QOpenGLContext::currentContext();
|
||||
|
||||
if (versionDirectivePosition.hasPosition()) {
|
||||
// Append source up to #version directive
|
||||
// Append source up to and including the #version directive
|
||||
sourceChunks.append(source);
|
||||
sourceChunkLengths.append(GLint(versionDirectivePosition.position));
|
||||
} else {
|
||||
// QTBUG-55733: Intel on Windows with Compatibility profile requires a #version always
|
||||
if (ctx->format().profile() == QSurfaceFormat::CompatibilityProfile) {
|
||||
const char *vendor = reinterpret_cast<const char *>(ctx->functions()->glGetString(GL_VENDOR));
|
||||
if (vendor && !strcmp(vendor, "Intel")) {
|
||||
static const char version110[] = "#version 110\n";
|
||||
sourceChunks.append(version110);
|
||||
sourceChunkLengths.append(GLint(sizeof(version110)) - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The precision qualifiers are useful on OpenGL/ES systems,
|
||||
// but usually not present on desktop systems.
|
||||
QOpenGLContext *ctx = QOpenGLContext::currentContext();
|
||||
const QSurfaceFormat currentSurfaceFormat = ctx->format();
|
||||
QOpenGLContextPrivate *ctx_d = QOpenGLContextPrivate::get(QOpenGLContext::currentContext());
|
||||
if (currentSurfaceFormat.renderableType() == QSurfaceFormat::OpenGL
|
||||
|
@ -404,6 +404,9 @@ static QList<QNetworkInterfacePrivate *> createInterfaces(ifaddrs *rawList)
|
||||
if (seenIndexes.contains(ifindex))
|
||||
continue;
|
||||
|
||||
seenInterfaces.insert(name);
|
||||
seenIndexes.append(ifindex);
|
||||
|
||||
QNetworkInterfacePrivate *iface = new QNetworkInterfacePrivate;
|
||||
interfaces << iface;
|
||||
iface->name = name;
|
||||
|
@ -652,7 +652,7 @@ void QSslSocketBackendPrivate::transmit()
|
||||
|
||||
if (connectionEncrypted) {
|
||||
QVarLengthArray<char, 4096> data;
|
||||
while (context) {
|
||||
while (context && (!readBufferMaxSize || buffer.size() < readBufferMaxSize)) {
|
||||
size_t readBytes = 0;
|
||||
data.resize(4096);
|
||||
const OSStatus err = SSLRead(context, data.data(), data.size(), &readBytes);
|
||||
|
@ -1868,12 +1868,14 @@ void QColorDialogPrivate::retranslateStrings()
|
||||
|
||||
bool QColorDialogPrivate::canBeNativeDialog() const
|
||||
{
|
||||
Q_Q(const QColorDialog);
|
||||
// Don't use Q_Q here! This function is called from ~QDialog,
|
||||
// so Q_Q calling q_func() invokes undefined behavior (invalid cast in q_func()).
|
||||
const QDialog * const q = static_cast<const QDialog*>(q_ptr);
|
||||
if (nativeDialogInUse)
|
||||
return true;
|
||||
if (QCoreApplication::testAttribute(Qt::AA_DontUseNativeDialogs)
|
||||
|| q->testAttribute(Qt::WA_DontShowOnScreen)
|
||||
|| (q->options() & QColorDialog::DontUseNativeDialog)) {
|
||||
|| (options->options() & QColorDialog::DontUseNativeDialog)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -700,12 +700,14 @@ void QFileDialogPrivate::emitFilesSelected(const QStringList &files)
|
||||
|
||||
bool QFileDialogPrivate::canBeNativeDialog() const
|
||||
{
|
||||
Q_Q(const QFileDialog);
|
||||
// Don't use Q_Q here! This function is called from ~QDialog,
|
||||
// so Q_Q calling q_func() invokes undefined behavior (invalid cast in q_func()).
|
||||
const QDialog * const q = static_cast<const QDialog*>(q_ptr);
|
||||
if (nativeDialogInUse)
|
||||
return true;
|
||||
if (QCoreApplication::testAttribute(Qt::AA_DontUseNativeDialogs)
|
||||
|| q->testAttribute(Qt::WA_DontShowOnScreen)
|
||||
|| (q->options() & QFileDialog::DontUseNativeDialog)) {
|
||||
|| (options->options() & QFileDialog::DontUseNativeDialog)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2096,7 +2096,7 @@ QList<AnchorData *> getVariables(const QList<QSimplexConstraint *> &constraints)
|
||||
void QGraphicsAnchorLayoutPrivate::calculateGraphs(
|
||||
QGraphicsAnchorLayoutPrivate::Orientation orientation)
|
||||
{
|
||||
#if defined(QT_DEBUG) || defined(Q_AUTOTEST_EXPORT)
|
||||
#if defined(QT_DEBUG) || defined(QT_BUILD_INTERNAL)
|
||||
lastCalculationUsedSimplex[orientation] = false;
|
||||
#endif
|
||||
|
||||
@ -2249,7 +2249,7 @@ bool QGraphicsAnchorLayoutPrivate::calculateTrunk(Orientation orientation, const
|
||||
sizeHints[orientation][Qt::MaximumSize] = ad->sizeAtMaximum;
|
||||
}
|
||||
|
||||
#if defined(QT_DEBUG) || defined(Q_AUTOTEST_EXPORT)
|
||||
#if defined(QT_DEBUG) || defined(QT_BUILD_INTERNAL)
|
||||
lastCalculationUsedSimplex[orientation] = needsSimplex;
|
||||
#endif
|
||||
|
||||
|
@ -578,7 +578,7 @@ public:
|
||||
bool graphHasConflicts[2];
|
||||
QSet<QGraphicsLayoutItem *> m_floatItems[2];
|
||||
|
||||
#if defined(QT_DEBUG) || defined(Q_AUTOTEST_EXPORT)
|
||||
#if defined(QT_DEBUG) || defined(QT_BUILD_INTERNAL)
|
||||
bool lastCalculationUsedSimplex[2];
|
||||
#endif
|
||||
|
||||
|
@ -717,10 +717,11 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item)
|
||||
++it;
|
||||
}
|
||||
|
||||
QGraphicsObject *dummy = item->toGraphicsObject();
|
||||
cachedTargetItems.removeOne(dummy);
|
||||
cachedItemGestures.remove(dummy);
|
||||
cachedAlreadyDeliveredGestures.remove(dummy);
|
||||
if (QGraphicsObject *dummy = item->toGraphicsObject()) {
|
||||
cachedTargetItems.removeOne(dummy);
|
||||
cachedItemGestures.remove(dummy);
|
||||
cachedAlreadyDeliveredGestures.remove(dummy);
|
||||
}
|
||||
|
||||
foreach (Qt::GestureType gesture, item->d_ptr->gestureContext.keys())
|
||||
ungrabGesture(item, gesture);
|
||||
|
@ -3174,11 +3174,11 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
|
||||
key->accept();
|
||||
else
|
||||
key->ignore();
|
||||
res = d->notify_helper(receiver, e);
|
||||
QWidget *w = isWidget ? static_cast<QWidget *>(receiver) : 0;
|
||||
#ifndef QT_NO_GRAPHICSVIEW
|
||||
QGraphicsWidget *gw = isGraphicsWidget ? static_cast<QGraphicsWidget *>(receiver) : 0;
|
||||
#endif
|
||||
res = d->notify_helper(receiver, e);
|
||||
|
||||
if ((res && key->isAccepted())
|
||||
/*
|
||||
|
@ -546,7 +546,7 @@ void QLayout::invalidate()
|
||||
update();
|
||||
}
|
||||
|
||||
static bool removeWidgetRecursively(QLayoutItem *li, QWidget *w)
|
||||
static bool removeWidgetRecursively(QLayoutItem *li, QObject *w)
|
||||
{
|
||||
QLayout *lay = li->layout();
|
||||
if (!lay)
|
||||
@ -609,12 +609,11 @@ void QLayout::widgetEvent(QEvent *e)
|
||||
{
|
||||
QChildEvent *c = (QChildEvent *)e;
|
||||
if (c->child()->isWidgetType()) {
|
||||
QWidget *w = (QWidget *)c->child();
|
||||
#ifndef QT_NO_MENUBAR
|
||||
if (w == d->menubar)
|
||||
if (c->child() == d->menubar)
|
||||
d->menubar = 0;
|
||||
#endif
|
||||
removeWidgetRecursively(this, w);
|
||||
removeWidgetRecursively(this, c->child());
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -41,7 +41,7 @@
|
||||
#include "qlayout_p.h"
|
||||
|
||||
#include <qlist.h>
|
||||
#include <qwidget.h>
|
||||
#include "private/qwidget_p.h"
|
||||
#include "private/qlayoutengine_p.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -251,14 +251,10 @@ QLayoutItem *QStackedLayout::itemAt(int index) const
|
||||
// Code that enables proper handling of the case that takeAt() is
|
||||
// called somewhere inside QObject destructor (can't call hide()
|
||||
// on the object then)
|
||||
|
||||
class QtFriendlyLayoutWidget : public QWidget
|
||||
static bool qt_wasDeleted(const QWidget *w)
|
||||
{
|
||||
public:
|
||||
inline bool wasDeleted() const { return d_ptr->wasDeleted; }
|
||||
};
|
||||
|
||||
static bool qt_wasDeleted(const QWidget *w) { return static_cast<const QtFriendlyLayoutWidget*>(w)->wasDeleted(); }
|
||||
return QWidgetPrivate::get(w)->wasDeleted;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -508,45 +508,46 @@ QTapAndHoldGestureRecognizer::recognize(QGesture *state, QObject *object,
|
||||
return QGestureRecognizer::FinishGesture | QGestureRecognizer::ConsumeEventHint;
|
||||
}
|
||||
|
||||
const QTouchEvent *ev = static_cast<const QTouchEvent *>(event);
|
||||
const QMouseEvent *me = static_cast<const QMouseEvent *>(event);
|
||||
#ifndef QT_NO_GRAPHICSVIEW
|
||||
const QGraphicsSceneMouseEvent *gsme = static_cast<const QGraphicsSceneMouseEvent *>(event);
|
||||
#endif
|
||||
|
||||
enum { TapRadius = 40 };
|
||||
|
||||
switch (event->type()) {
|
||||
#ifndef QT_NO_GRAPHICSVIEW
|
||||
case QEvent::GraphicsSceneMousePress:
|
||||
case QEvent::GraphicsSceneMousePress: {
|
||||
const QGraphicsSceneMouseEvent *gsme = static_cast<const QGraphicsSceneMouseEvent *>(event);
|
||||
d->position = gsme->screenPos();
|
||||
q->setHotSpot(d->position);
|
||||
if (d->timerId)
|
||||
q->killTimer(d->timerId);
|
||||
d->timerId = q->startTimer(QTapAndHoldGesturePrivate::Timeout);
|
||||
return QGestureRecognizer::MayBeGesture; // we don't show a sign of life until the timeout
|
||||
}
|
||||
#endif
|
||||
case QEvent::MouseButtonPress:
|
||||
case QEvent::MouseButtonPress: {
|
||||
const QMouseEvent *me = static_cast<const QMouseEvent *>(event);
|
||||
d->position = me->globalPos();
|
||||
q->setHotSpot(d->position);
|
||||
if (d->timerId)
|
||||
q->killTimer(d->timerId);
|
||||
d->timerId = q->startTimer(QTapAndHoldGesturePrivate::Timeout);
|
||||
return QGestureRecognizer::MayBeGesture; // we don't show a sign of life until the timeout
|
||||
case QEvent::TouchBegin:
|
||||
}
|
||||
case QEvent::TouchBegin: {
|
||||
const QTouchEvent *ev = static_cast<const QTouchEvent *>(event);
|
||||
d->position = ev->touchPoints().at(0).startScreenPos();
|
||||
q->setHotSpot(d->position);
|
||||
if (d->timerId)
|
||||
q->killTimer(d->timerId);
|
||||
d->timerId = q->startTimer(QTapAndHoldGesturePrivate::Timeout);
|
||||
return QGestureRecognizer::MayBeGesture; // we don't show a sign of life until the timeout
|
||||
}
|
||||
#ifndef QT_NO_GRAPHICSVIEW
|
||||
case QEvent::GraphicsSceneMouseRelease:
|
||||
#endif
|
||||
case QEvent::MouseButtonRelease:
|
||||
case QEvent::TouchEnd:
|
||||
return QGestureRecognizer::CancelGesture; // get out of the MayBeGesture state
|
||||
case QEvent::TouchUpdate:
|
||||
case QEvent::TouchUpdate: {
|
||||
const QTouchEvent *ev = static_cast<const QTouchEvent *>(event);
|
||||
if (d->timerId && ev->touchPoints().size() == 1) {
|
||||
QTouchEvent::TouchPoint p = ev->touchPoints().at(0);
|
||||
QPoint delta = p.pos().toPoint() - p.startPos().toPoint();
|
||||
@ -554,7 +555,9 @@ QTapAndHoldGestureRecognizer::recognize(QGesture *state, QObject *object,
|
||||
return QGestureRecognizer::MayBeGesture;
|
||||
}
|
||||
return QGestureRecognizer::CancelGesture;
|
||||
}
|
||||
case QEvent::MouseMove: {
|
||||
const QMouseEvent *me = static_cast<const QMouseEvent *>(event);
|
||||
QPoint delta = me->globalPos() - d->position.toPoint();
|
||||
if (d->timerId && delta.manhattanLength() <= TapRadius)
|
||||
return QGestureRecognizer::MayBeGesture;
|
||||
@ -562,6 +565,7 @@ QTapAndHoldGestureRecognizer::recognize(QGesture *state, QObject *object,
|
||||
}
|
||||
#ifndef QT_NO_GRAPHICSVIEW
|
||||
case QEvent::GraphicsSceneMouseMove: {
|
||||
const QGraphicsSceneMouseEvent *gsme = static_cast<const QGraphicsSceneMouseEvent *>(event);
|
||||
QPoint delta = gsme->screenPos() - d->position.toPoint();
|
||||
if (d->timerId && delta.manhattanLength() <= TapRadius)
|
||||
return QGestureRecognizer::MayBeGesture;
|
||||
|
@ -5231,8 +5231,10 @@ static void sendResizeEvents(QWidget *target)
|
||||
|
||||
const QObjectList children = target->children();
|
||||
for (int i = 0; i < children.size(); ++i) {
|
||||
if (!children.at(i)->isWidgetType())
|
||||
continue;
|
||||
QWidget *child = static_cast<QWidget*>(children.at(i));
|
||||
if (child->isWidgetType() && !child->isWindow() && child->testAttribute(Qt::WA_PendingResizeEvent))
|
||||
if (!child->isWindow() && child->testAttribute(Qt::WA_PendingResizeEvent))
|
||||
sendResizeEvents(child);
|
||||
}
|
||||
}
|
||||
|
@ -329,6 +329,7 @@ public:
|
||||
~QWidgetPrivate();
|
||||
|
||||
static QWidgetPrivate *get(QWidget *w) { return w->d_func(); }
|
||||
static const QWidgetPrivate *get(const QWidget *w) { return w->d_func(); }
|
||||
|
||||
QWExtra *extraData() const;
|
||||
QTLWExtra *topData() const;
|
||||
|
@ -2394,18 +2394,21 @@ void QDateTimeEditPrivate::init(const QVariant &var)
|
||||
switch (var.type()) {
|
||||
case QVariant::Date:
|
||||
value = QDateTime(var.toDate(), QDATETIMEEDIT_TIME_MIN);
|
||||
updateTimeSpec();
|
||||
q->setDisplayFormat(defaultDateFormat);
|
||||
if (sectionNodes.isEmpty()) // ### safeguard for broken locale
|
||||
q->setDisplayFormat(QLatin1String("dd/MM/yyyy"));
|
||||
break;
|
||||
case QVariant::DateTime:
|
||||
value = var;
|
||||
updateTimeSpec();
|
||||
q->setDisplayFormat(defaultDateTimeFormat);
|
||||
if (sectionNodes.isEmpty()) // ### safeguard for broken locale
|
||||
q->setDisplayFormat(QLatin1String("dd/MM/yyyy hh:mm:ss"));
|
||||
break;
|
||||
case QVariant::Time:
|
||||
value = QDateTime(QDATETIMEEDIT_DATE_INITIAL, var.toTime());
|
||||
updateTimeSpec();
|
||||
q->setDisplayFormat(defaultTimeFormat);
|
||||
if (sectionNodes.isEmpty()) // ### safeguard for broken locale
|
||||
q->setDisplayFormat(QLatin1String("hh:mm:ss"));
|
||||
@ -2418,7 +2421,6 @@ void QDateTimeEditPrivate::init(const QVariant &var)
|
||||
if (QApplication::keypadNavigationEnabled())
|
||||
q->setCalendarPopup(true);
|
||||
#endif
|
||||
updateTimeSpec();
|
||||
q->setInputMethodHints(Qt::ImhPreferNumbers);
|
||||
setLayoutItemMargins(QStyle::SE_DateTimeEditLayoutItem);
|
||||
}
|
||||
|
@ -6532,6 +6532,29 @@ signals:
|
||||
CountedStruct mySignal(const CountedStruct &s1, CountedStruct s2);
|
||||
};
|
||||
|
||||
class CountedExceptionThrower : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CountedExceptionThrower(bool throwException, QObject *parent = Q_NULLPTR)
|
||||
: QObject(parent)
|
||||
{
|
||||
if (throwException)
|
||||
throw ObjectException();
|
||||
++counter;
|
||||
}
|
||||
|
||||
~CountedExceptionThrower()
|
||||
{
|
||||
--counter;
|
||||
}
|
||||
|
||||
static int counter;
|
||||
};
|
||||
|
||||
int CountedExceptionThrower::counter = 0;
|
||||
|
||||
void tst_QObject::exceptions()
|
||||
{
|
||||
#ifndef QT_NO_EXCEPTIONS
|
||||
@ -6593,6 +6616,59 @@ void tst_QObject::exceptions()
|
||||
}
|
||||
QCOMPARE(countedStructObjectsCount, 0);
|
||||
|
||||
// Child object reaping in case of exceptions thrown by constructors
|
||||
{
|
||||
QCOMPARE(CountedExceptionThrower::counter, 0);
|
||||
|
||||
try {
|
||||
class ParentObject : public QObject {
|
||||
public:
|
||||
explicit ParentObject(QObject *parent = Q_NULLPTR)
|
||||
: QObject(parent)
|
||||
{
|
||||
new CountedExceptionThrower(false, this);
|
||||
new CountedExceptionThrower(false, this);
|
||||
new CountedExceptionThrower(true, this); // throws
|
||||
}
|
||||
};
|
||||
|
||||
ParentObject p;
|
||||
QFAIL("Exception not thrown");
|
||||
} catch (const ObjectException &) {
|
||||
} catch (...) {
|
||||
QFAIL("Wrong exception thrown");
|
||||
}
|
||||
|
||||
QCOMPARE(CountedExceptionThrower::counter, 0);
|
||||
|
||||
try {
|
||||
QObject o;
|
||||
new CountedExceptionThrower(false, &o);
|
||||
new CountedExceptionThrower(false, &o);
|
||||
new CountedExceptionThrower(true, &o); // throws
|
||||
|
||||
QFAIL("Exception not thrown");
|
||||
} catch (const ObjectException &) {
|
||||
} catch (...) {
|
||||
QFAIL("Wrong exception thrown");
|
||||
}
|
||||
|
||||
QCOMPARE(CountedExceptionThrower::counter, 0);
|
||||
|
||||
try {
|
||||
QObject o;
|
||||
CountedExceptionThrower c1(false, &o);
|
||||
CountedExceptionThrower c2(false, &o);
|
||||
CountedExceptionThrower c3(true, &o); // throws
|
||||
|
||||
QFAIL("Exception not thrown");
|
||||
} catch (const ObjectException &) {
|
||||
} catch (...) {
|
||||
QFAIL("Wrong exception thrown");
|
||||
}
|
||||
|
||||
QCOMPARE(CountedExceptionThrower::counter, 0);
|
||||
}
|
||||
|
||||
#else
|
||||
QSKIP("Needs exceptions");
|
||||
|
@ -223,6 +223,7 @@ private slots:
|
||||
void ecdhServer();
|
||||
void verifyClientCertificate_data();
|
||||
void verifyClientCertificate();
|
||||
void readBufferMaxSize();
|
||||
|
||||
#ifndef QT_NO_OPENSSL
|
||||
void simplePskConnect_data();
|
||||
@ -3037,6 +3038,68 @@ void tst_QSslSocket::verifyClientCertificate()
|
||||
QCOMPARE(client->isEncrypted(), works);
|
||||
}
|
||||
|
||||
void tst_QSslSocket::readBufferMaxSize()
|
||||
{
|
||||
#ifdef QT_SECURETRANSPORT
|
||||
// QTBUG-55170:
|
||||
// SecureTransport back-end was ignoring read-buffer
|
||||
// size limit, resulting (potentially) in a constantly
|
||||
// growing internal buffer.
|
||||
// The test's logic is: we set a small read buffer size on a client
|
||||
// socket (to some ridiculously small value), server sends us
|
||||
// a bunch of bytes , we ignore readReady signal so
|
||||
// that socket's internal buffer size stays
|
||||
// >= readBufferMaxSize, we wait for a quite long time
|
||||
// (which previously would be enough to read completely)
|
||||
// and we check socket's bytesAvaiable to be less than sent.
|
||||
QFETCH_GLOBAL(bool, setProxy);
|
||||
if (setProxy)
|
||||
return;
|
||||
|
||||
SslServer server;
|
||||
QVERIFY(server.listen());
|
||||
|
||||
QEventLoop loop;
|
||||
|
||||
QSslSocketPtr client(new QSslSocket);
|
||||
socket = client.data();
|
||||
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), &loop, SLOT(quit()));
|
||||
connect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(ignoreErrorSlot()));
|
||||
connect(socket, SIGNAL(encrypted()), &loop, SLOT(quit()));
|
||||
|
||||
client->connectToHostEncrypted(QHostAddress(QHostAddress::LocalHost).toString(),
|
||||
server.serverPort());
|
||||
|
||||
// Wait for 'encrypted' first:
|
||||
QTimer::singleShot(5000, &loop, SLOT(quit()));
|
||||
loop.exec();
|
||||
|
||||
QCOMPARE(client->state(), QAbstractSocket::ConnectedState);
|
||||
QCOMPARE(client->mode(), QSslSocket::SslClientMode);
|
||||
|
||||
client->setReadBufferSize(10);
|
||||
const QByteArray message(int(0xffff), 'a');
|
||||
server.socket->write(message);
|
||||
|
||||
QTimer::singleShot(5000, &loop, SLOT(quit()));
|
||||
loop.exec();
|
||||
|
||||
int readSoFar = client->bytesAvailable();
|
||||
QVERIFY(readSoFar > 0 && readSoFar < message.size());
|
||||
// Now, let's check that we still can read the rest of it:
|
||||
QCOMPARE(client->readAll().size(), readSoFar);
|
||||
|
||||
client->setReadBufferSize(0);
|
||||
|
||||
QTimer::singleShot(1500, &loop, SLOT(quit()));
|
||||
loop.exec();
|
||||
|
||||
QCOMPARE(client->bytesAvailable() + readSoFar, message.size());
|
||||
#else
|
||||
// Not needed, QSslSocket works correctly with other back-ends.
|
||||
#endif
|
||||
}
|
||||
|
||||
void tst_QSslSocket::setEmptyDefaultConfiguration() // this test should be last, as it has some side effects
|
||||
{
|
||||
// used to produce a crash in QSslConfigurationPrivate::deepCopyDefaultConfiguration, QTBUG-13265
|
||||
|
@ -71,6 +71,10 @@ private slots:
|
||||
void testRasterRGB32();
|
||||
void testRasterRGB16_data();
|
||||
void testRasterRGB16();
|
||||
void testRasterARGB8565PM_data();
|
||||
void testRasterARGB8565PM();
|
||||
void testRasterGrayscale8_data();
|
||||
void testRasterGrayscale8();
|
||||
|
||||
#ifndef QT_NO_OPENGL
|
||||
void testOpenGL_data();
|
||||
@ -150,6 +154,28 @@ void tst_Lancelot::testRasterRGB16()
|
||||
}
|
||||
|
||||
|
||||
void tst_Lancelot::testRasterARGB8565PM_data()
|
||||
{
|
||||
setupTestSuite();
|
||||
}
|
||||
|
||||
void tst_Lancelot::testRasterARGB8565PM()
|
||||
{
|
||||
runTestSuite(Raster, QImage::Format_ARGB8565_Premultiplied);
|
||||
}
|
||||
|
||||
|
||||
void tst_Lancelot::testRasterGrayscale8_data()
|
||||
{
|
||||
setupTestSuite();
|
||||
}
|
||||
|
||||
void tst_Lancelot::testRasterGrayscale8()
|
||||
{
|
||||
runTestSuite(Raster, QImage::Format_Grayscale8);
|
||||
}
|
||||
|
||||
|
||||
#ifndef QT_NO_OPENGL
|
||||
bool tst_Lancelot::checkSystemGLSupport()
|
||||
{
|
||||
|
@ -1755,25 +1755,6 @@ void tst_QApplication::focusOut()
|
||||
QTest::qWait(2000);
|
||||
}
|
||||
|
||||
class SpontaneousEvent
|
||||
{
|
||||
Q_GADGET
|
||||
QDOC_PROPERTY(bool accepted READ isAccepted WRITE setAccepted)
|
||||
Q_ENUMS(Type)
|
||||
public:
|
||||
enum Type {
|
||||
Void
|
||||
};
|
||||
|
||||
virtual ~SpontaneousEvent() {}
|
||||
|
||||
QEventPrivate *d;
|
||||
ushort t;
|
||||
|
||||
ushort posted : 1;
|
||||
ushort spont : 1;
|
||||
};
|
||||
|
||||
void tst_QApplication::focusMouseClick()
|
||||
{
|
||||
int argc = 1;
|
||||
@ -1791,14 +1772,14 @@ void tst_QApplication::focusMouseClick()
|
||||
// now send a mouse button press event and check what happens with the focus
|
||||
// it should be given to the parent widget
|
||||
QMouseEvent ev(QEvent::MouseButtonPress, QPointF(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
|
||||
reinterpret_cast<SpontaneousEvent *>(&ev)->spont = 1;
|
||||
QSpontaneKeyEvent::setSpontaneous(&ev);
|
||||
QVERIFY(ev.spontaneous());
|
||||
qApp->notify(&w2, &ev);
|
||||
QCOMPARE(QApplication::focusWidget(), &w);
|
||||
|
||||
// then we give the inner widget strong focus -> it should get focus
|
||||
w2.setFocusPolicy(Qt::StrongFocus);
|
||||
reinterpret_cast<SpontaneousEvent *>(&ev)->spont = 1;
|
||||
QSpontaneKeyEvent::setSpontaneous(&ev);
|
||||
QVERIFY(ev.spontaneous());
|
||||
qApp->notify(&w2, &ev);
|
||||
QTRY_COMPARE(QApplication::focusWidget(), &w2);
|
||||
@ -1806,7 +1787,7 @@ void tst_QApplication::focusMouseClick()
|
||||
// now back to tab focus and click again (it already had focus) -> focus should stay
|
||||
// (focus was revoked as of QTBUG-34042)
|
||||
w2.setFocusPolicy(Qt::TabFocus);
|
||||
reinterpret_cast<SpontaneousEvent *>(&ev)->spont = 1;
|
||||
QSpontaneKeyEvent::setSpontaneous(&ev);
|
||||
QVERIFY(ev.spontaneous());
|
||||
qApp->notify(&w2, &ev);
|
||||
QCOMPARE(QApplication::focusWidget(), &w2);
|
||||
|
@ -183,7 +183,7 @@ void tst_QBoxLayout::sizeConstraints()
|
||||
window.show();
|
||||
QTest::qWaitForWindowExposed(&window);
|
||||
QSize sh = window.sizeHint();
|
||||
lay->takeAt(1);
|
||||
delete lay->takeAt(1);
|
||||
QVERIFY(sh.width() >= window.sizeHint().width() &&
|
||||
sh.height() >= window.sizeHint().height());
|
||||
|
||||
@ -512,7 +512,7 @@ void tst_QBoxLayout::replaceWidget()
|
||||
|
||||
QCOMPARE(boxLayout->indexOf(replaceFrom), 1);
|
||||
QCOMPARE(boxLayout->indexOf(replaceTo), -1);
|
||||
boxLayout->replaceWidget(replaceFrom, replaceTo);
|
||||
delete boxLayout->replaceWidget(replaceFrom, replaceTo);
|
||||
|
||||
QCOMPARE(boxLayout->indexOf(replaceFrom), -1);
|
||||
QCOMPARE(boxLayout->indexOf(replaceTo), 1);
|
||||
|
@ -348,6 +348,8 @@ void tst_QGridLayout::setMinAndMaxSize()
|
||||
|
||||
|
||||
layout.removeItem(spacer);
|
||||
delete spacer;
|
||||
spacer = Q_NULLPTR;
|
||||
|
||||
rightChild.hide();
|
||||
QApplication::sendPostedEvents(0, 0);
|
||||
@ -1598,10 +1600,10 @@ void tst_QGridLayout::contentsRect()
|
||||
void tst_QGridLayout::distributeMultiCell()
|
||||
{
|
||||
QWidget w;
|
||||
Qt42Style *style = new Qt42Style();
|
||||
style->spacing = 9;
|
||||
Qt42Style style;
|
||||
style.spacing = 9;
|
||||
|
||||
w.setStyle(style);
|
||||
w.setStyle(&style);
|
||||
QGridLayout grid;
|
||||
w.setLayout(&grid);
|
||||
|
||||
|
@ -5130,7 +5130,8 @@ void tst_QWidget::moveChild()
|
||||
|
||||
ColorWidget parent(0, Qt::Window | Qt::WindowStaysOnTopHint);
|
||||
// prevent custom styles
|
||||
parent.setStyle(QStyleFactory::create(QLatin1String("Windows")));
|
||||
const QScopedPointer<QStyle> style(QStyleFactory::create(QLatin1String("Windows")));
|
||||
parent.setStyle(style.data());
|
||||
ColorWidget child(&parent, Qt::Widget, Qt::blue);
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
@ -5179,7 +5180,8 @@ void tst_QWidget::showAndMoveChild()
|
||||
QSKIP("Wayland: This fails. Figure out why.");
|
||||
QWidget parent(0, Qt::Window | Qt::WindowStaysOnTopHint);
|
||||
// prevent custom styles
|
||||
parent.setStyle(QStyleFactory::create(QLatin1String("Windows")));
|
||||
const QScopedPointer<QStyle> style(QStyleFactory::create(QLatin1String("Windows")));
|
||||
parent.setStyle(style.data());
|
||||
|
||||
QDesktopWidget desktop;
|
||||
QRect desktopDimensions = desktop.availableGeometry(&parent);
|
||||
@ -6675,7 +6677,9 @@ void tst_QWidget::renderWithPainter()
|
||||
{
|
||||
QWidget widget(0, Qt::Tool);
|
||||
// prevent custom styles
|
||||
widget.setStyle(QStyleFactory::create(QLatin1String("Windows")));
|
||||
|
||||
const QScopedPointer<QStyle> style(QStyleFactory::create(QLatin1String("Windows")));
|
||||
widget.setStyle(style.data());
|
||||
widget.show();
|
||||
widget.resize(70, 50);
|
||||
widget.setAutoFillBackground(true);
|
||||
|
@ -245,6 +245,7 @@ private slots:
|
||||
void timeSpec_data();
|
||||
void timeSpec();
|
||||
void timeSpecBug();
|
||||
void timeSpecInit();
|
||||
|
||||
void monthEdgeCase();
|
||||
void setLocale();
|
||||
@ -3200,6 +3201,13 @@ void tst_QDateTimeEdit::timeSpecBug()
|
||||
QCOMPARE(oldText, testWidget->text());
|
||||
}
|
||||
|
||||
void tst_QDateTimeEdit::timeSpecInit()
|
||||
{
|
||||
QDateTime utc(QDate(2000, 1, 1), QTime(12, 0, 0), Qt::UTC);
|
||||
QDateTimeEdit widget(utc);
|
||||
QCOMPARE(widget.dateTime(), utc);
|
||||
}
|
||||
|
||||
void tst_QDateTimeEdit::cachedDayTest()
|
||||
{
|
||||
testWidget->setDisplayFormat("MM/dd");
|
||||
|
Loading…
Reference in New Issue
Block a user