Fix some compiler errors caused by bit-rot in manual tests

Two methods that have gone away or been renamed,
an enum that now doesn't support being assigned from int.
QTime should no longer be used as a timer.
Removed a test of deprecated code that's gone away.

Task-number: QTBUG-85700
Change-Id: Idc6d59542625d22b9937084411b54b0d8aa87f00
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Edward Welbourne 2020-07-23 13:54:47 +02:00
parent 2059170b33
commit 02c2c930f0
12 changed files with 39 additions and 137 deletions

View File

@ -233,7 +233,7 @@ int main(int argc, char *argv[])
parser.process(QCoreApplication::arguments());
QtDiag::EventFilter::EventCategories eventCategories = 0;
QtDiag::EventFilter::EventCategories eventCategories = {};
for (int i = 0; i < eventFilterOptionCount; ++i) {
if (parser.isSet(QLatin1String(eventFilterOptions[i].name)))
eventCategories |= eventFilterOptions[i].categories;

View File

@ -203,7 +203,7 @@ public:
QWidget *w = new QWidget;
w->setMinimumWidth(700);
QVBoxLayout *l = new QVBoxLayout(w);
l->setMargin(20);
l->setContentsMargins(20, 20, 20, 20);
for (int i = 0; i < 100; ++i) {
QWidget *w = new QWidget;
QHBoxLayout *ll = new QHBoxLayout(w);

View File

@ -286,7 +286,7 @@ DemoController::DemoController(DemoContainerList demos, QCommandLineParser *pars
button->setChecked(true);
}
}
connect(m_group, QOverload<int,bool>::of(&QButtonGroup::buttonToggled),
connect(m_group, &QButtonGroup::idToggled,
this, &DemoController::handleButton);
}

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@ -41,7 +41,7 @@ void SlowWidget::setGeometry(const QRectF &rect)
qDebug() << "currentBenchmarkIteration:" << stats.currentBenchmarkIteration;
if (stats.currentBenchmarkIteration == m_window->m_benchmarkIterationsSpinBox->value()) {
if (stats.output)
stats.output->setText(tr("DONE. Elapsed: %1, setGeometryCount: %2").arg(stats.time.elapsed()).arg(stats.setGeometryCount));
stats.output->setText(tr("DONE. Elapsed: %1, setGeometryCount: %2").arg(stats.timer.elapsed()).arg(stats.setGeometryCount));
} else {
reiterate = true;
}
@ -57,4 +57,3 @@ void SlowWidget::setGeometry(const QRectF &rect)
//QTimer::singleShot(0, m_window, SLOT(doAgain()));
}
}

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@ -43,7 +43,7 @@
#include <QApplication>
#include <QThread>
#include <QMap>
#include <QTime>
#include <QElapsedTimer>
#include <QDebug>
struct Statistics {
@ -52,7 +52,7 @@ struct Statistics {
{
}
QMap<QGraphicsWidget*, int> setGeometryTracker;
QTime time;
QElapsedTimer timer;
int setGeometryCount;
int sleepMsecs;
QLabel *output;
@ -227,7 +227,7 @@ private slots:
m_stats.setGeometryCount = 0;
m_stats.setGeometryTracker.clear();
m_stats.sleepMsecs = m_sleepSpinBox->value();
m_stats.time.start();
m_stats.timer.start();
m_stats.currentBenchmarkIteration = 0;
m_leaf->setMinimumSize(sz);
m_leaf->setMaximumSize(sz);

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@ -33,6 +33,7 @@
#include <QtNetwork/qnetworkreply.h>
#include <QtNetwork/qnetworkrequest.h>
#include <QtNetwork/qnetworkaccessmanager.h>
#include <QtCore/QElapsedTimer>
class tst_qhttpnetworkconnection : public QObject
{
@ -48,7 +49,7 @@ void tst_qhttpnetworkconnection::bigRemoteFile()
{
QNetworkAccessManager manager;
qint64 size;
QTime t;
QElapsedTimer t;
QNetworkRequest request(QUrl(QString::fromLatin1(urlC)));
QNetworkReply* reply = manager.get(request);
connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()), Qt::QueuedConnection);

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2020 The Qt Company Ltd.
** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
** Contact: https://www.qt.io/licensing/
**
@ -37,6 +37,7 @@
#include <QtNetwork/qsslconfiguration.h>
#include <QtNetwork/qhttpmultipart.h>
#include <QtNetwork/qauthenticator.h>
#include <QtCore/QElapsedTimer>
#include <QtCore/QJsonDocument>
#include "../../auto/network-settings.h"
@ -99,7 +100,7 @@ class HttpReceiver : public QObject
}
protected:
QTimer *timer;
QTime stopwatch;
QElapsedTimer stopwatch;
};
void tst_qnetworkreply::initTestCase()

View File

@ -32,107 +32,6 @@
#include <stdio.h>
#if QT_DEPRECATED_SINCE(5, 9)
#define CASE_VERSION(v) case QSysInfo::v: return QT_STRINGIFY(v)
QByteArray windowsVersionToString(QSysInfo::WinVersion v)
{
switch (v) {
CASE_VERSION(WV_None);
CASE_VERSION(WV_32s);
CASE_VERSION(WV_95);
CASE_VERSION(WV_98);
CASE_VERSION(WV_Me);
case QSysInfo::WV_DOS_based: // shouldn't happen
break;
CASE_VERSION(WV_NT);
CASE_VERSION(WV_2000);
CASE_VERSION(WV_XP);
CASE_VERSION(WV_2003);
CASE_VERSION(WV_VISTA);
CASE_VERSION(WV_WINDOWS7);
CASE_VERSION(WV_WINDOWS8);
CASE_VERSION(WV_WINDOWS8_1);
CASE_VERSION(WV_WINDOWS10);
case QSysInfo::WV_NT_based: // shouldn't happen
case QSysInfo::WV_CE:
case QSysInfo::WV_CENET:
case QSysInfo::WV_CE_5:
case QSysInfo::WV_CE_6:
case QSysInfo::WV_CE_based:
break;
}
return "WinVersion(0x" + QByteArray::number(v, 16) + ')';
}
QByteArray macVersionToString(QSysInfo::MacVersion v)
{
switch (v) {
CASE_VERSION(MV_None);
CASE_VERSION(MV_Unknown);
CASE_VERSION(MV_9);
CASE_VERSION(MV_10_0);
CASE_VERSION(MV_10_1);
CASE_VERSION(MV_10_2);
CASE_VERSION(MV_10_3);
CASE_VERSION(MV_10_4);
CASE_VERSION(MV_10_5);
CASE_VERSION(MV_10_6);
CASE_VERSION(MV_10_7);
CASE_VERSION(MV_10_8);
CASE_VERSION(MV_10_9);
CASE_VERSION(MV_10_10);
CASE_VERSION(MV_10_11);
CASE_VERSION(MV_10_12);
CASE_VERSION(MV_IOS_4_3);
CASE_VERSION(MV_IOS_5_0);
CASE_VERSION(MV_IOS_5_1);
CASE_VERSION(MV_IOS_6_0);
CASE_VERSION(MV_IOS_6_1);
CASE_VERSION(MV_IOS_7_0);
CASE_VERSION(MV_IOS_7_1);
CASE_VERSION(MV_IOS_8_0);
CASE_VERSION(MV_IOS_8_1);
CASE_VERSION(MV_IOS_8_2);
CASE_VERSION(MV_IOS_8_3);
CASE_VERSION(MV_IOS_8_4);
CASE_VERSION(MV_IOS_9_0);
CASE_VERSION(MV_IOS_9_1);
CASE_VERSION(MV_IOS_9_2);
CASE_VERSION(MV_IOS_9_3);
CASE_VERSION(MV_IOS_10_0);
case QSysInfo::MV_IOS: // shouldn't happen:
case QSysInfo::MV_TVOS:
case QSysInfo::MV_WATCHOS:
break;
CASE_VERSION(MV_TVOS_9_0);
CASE_VERSION(MV_TVOS_9_1);
CASE_VERSION(MV_TVOS_9_2);
CASE_VERSION(MV_TVOS_10_0);
CASE_VERSION(MV_WATCHOS_2_0);
CASE_VERSION(MV_WATCHOS_2_1);
CASE_VERSION(MV_WATCHOS_2_2);
CASE_VERSION(MV_WATCHOS_3_0);
}
if (v & QSysInfo::MV_IOS) {
int major = (v >> 4) & 0xf;
int minor = v & 0xf;
return "MacVersion(Q_MV_IOS("
+ QByteArray::number(major) + ", "
+ QByteArray::number(minor) + "))";
}
return "MacVersion(Q_MV_OSX(10, " + QByteArray::number(v - 2) + "))";
}
#endif
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
@ -140,12 +39,6 @@ int main(int argc, char *argv[])
printf("QSysInfo::WordSize = %d\n", QSysInfo::WordSize);
printf("QSysInfo::ByteOrder = QSysInfo::%sEndian\n",
QSysInfo::ByteOrder == QSysInfo::LittleEndian ? "Little" : "Big");
#if QT_DEPRECATED_SINCE(5, 9)
printf("QSysInfo::WindowsVersion = QSysInfo::%s\n",
windowsVersionToString(QSysInfo::WindowsVersion).constData());
printf("QSysInfo::MacintoshVersion = QSysInfo::%s\n",
macVersionToString(QSysInfo::MacintoshVersion).constData());
#endif
printf("QSysInfo::buildCpuArchitecture() = %s\n", qPrintable(QSysInfo::buildCpuArchitecture()));
printf("QSysInfo::currentCpuArchitecture() = %s\n", qPrintable(QSysInfo::currentCpuArchitecture()));
printf("QSysInfo::buildAbi() = %s\n", qPrintable(QSysInfo::buildAbi()));

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@ -231,7 +231,7 @@ int main(int argc, char *argv[])
QApplication::sendEvent(&tabBar, new QEvent(QEvent::StyleChange));
});
layout->setMargin(12);
layout->setContentsMargins(12, 12, 12, 12);
widget.show();
return app.exec();

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@ -31,7 +31,7 @@
#include <QFontDatabase>
#include <QPainter>
#include <QRandomGenerator>
#include <QTime>
#include <QElapsedTimer>
#include <QTimer>
static const int lastMeasurementsCount = 50;
@ -53,7 +53,7 @@ public:
Q_UNUSED(event);
QPainter p(this);
if (!m_timer.isNull())
if (m_timer.isValid())
m_lastMeasurements.append(m_timer.elapsed());
m_timer.start();
@ -195,7 +195,7 @@ private:
int m_currentMode;
QList<int> m_lastMeasurements;
QTime m_timer;
QElapsedTimer m_timer;
};
const struct FontBlaster::mode FontBlaster::m_modes[] = {

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@ -72,7 +72,8 @@ HintControl::HintControl(QWidget *parent)
connect(transparentForInputCheckBox, SIGNAL(clicked()), this, SLOT(slotCheckBoxChanged()));
QGridLayout *layout = new QGridLayout(this);
layout->setSpacing(0);
layout->setMargin(ControlLayoutMargin);
layout->setContentsMargins(ControlLayoutMargin, ControlLayoutMargin,
ControlLayoutMargin, ControlLayoutMargin);
layout->addWidget(msWindowsFixedSizeDialogCheckBox, 0, 0);
layout->addWidget(x11BypassWindowManagerCheckBox, 1, 0);
layout->addWidget(framelessWindowCheckBox, 2, 0);
@ -171,7 +172,8 @@ WindowStateControl::WindowStateControl(QWidget *parent)
{
QHBoxLayout *layout = new QHBoxLayout(this);
group->setExclusive(false);
layout->setMargin(ControlLayoutMargin);
layout->setContentsMargins(ControlLayoutMargin, ControlLayoutMargin,
ControlLayoutMargin, ControlLayoutMargin);
group->addButton(restoreButton, Qt::WindowNoState);
restoreButton->setEnabled(false);
layout->addWidget(restoreButton);
@ -214,7 +216,8 @@ WindowStatesControl::WindowStatesControl(QWidget *parent)
{
QHBoxLayout *layout = new QHBoxLayout(this);
layout->setSpacing(0);
layout->setMargin(ControlLayoutMargin);
layout->setContentsMargins(ControlLayoutMargin, ControlLayoutMargin,
ControlLayoutMargin, ControlLayoutMargin);
connect(visibleCheckBox, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
layout->addWidget(visibleCheckBox);
connect(activeCheckBox, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
@ -280,7 +283,8 @@ TypeControl::TypeControl(QWidget *parent)
group->setExclusive(true);
QGridLayout *layout = new QGridLayout(this);
layout->setSpacing(0);
layout->setMargin(ControlLayoutMargin);
layout->setContentsMargins(ControlLayoutMargin, ControlLayoutMargin,
ControlLayoutMargin, ControlLayoutMargin);
group->addButton(windowRadioButton, Qt::Window);
layout->addWidget(windowRadioButton, 0, 0);
group->addButton(dialogRadioButton, Qt::Dialog);

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@ -85,7 +85,8 @@ RectControl::RectControl()
{
QHBoxLayout *l = new QHBoxLayout(this);
l->setSpacing(0);
l->setMargin(ControlLayoutMargin);
l->setContentsMargins(ControlLayoutMargin, ControlLayoutMargin,
ControlLayoutMargin, ControlLayoutMargin);
connect(m_point, SIGNAL(pointValueChanged(QPoint)), this, SLOT(handleChanged()));
connect(m_point, SIGNAL(pointValueChanged(QPoint)), this, SIGNAL(positionChanged(QPoint)));
l->addWidget(m_point);
@ -128,11 +129,13 @@ BaseWindowControl::BaseWindowControl(QObject *w)
m_geometry->setTitle(tr("Geometry"));
int row = 0;
m_layout->addWidget(m_geometry, row, 0, 1, 2);
m_layout->setMargin(ControlLayoutMargin);
m_layout->setContentsMargins(ControlLayoutMargin, ControlLayoutMargin,
ControlLayoutMargin, ControlLayoutMargin);
QGroupBox *frameGB = new QGroupBox(tr("Frame"));
QVBoxLayout *frameL = new QVBoxLayout(frameGB);
frameL->setSpacing(0);
frameL->setMargin(ControlLayoutMargin);
frameL->setContentsMargins(ControlLayoutMargin, ControlLayoutMargin,
ControlLayoutMargin, ControlLayoutMargin);
frameL->addWidget(m_framePosition);
m_layout->addWidget(frameGB, row, 2);
@ -144,7 +147,8 @@ BaseWindowControl::BaseWindowControl(QObject *w)
QGroupBox *eventGroupBox = new QGroupBox(tr("Events"));
QVBoxLayout *l = new QVBoxLayout(eventGroupBox);
l->setSpacing(0);
l->setMargin(ControlLayoutMargin);
l->setContentsMargins(ControlLayoutMargin, ControlLayoutMargin,
ControlLayoutMargin, ControlLayoutMargin);
l->addWidget(m_moveEventLabel);
l->addWidget(m_resizeEventLabel);
l->addWidget(m_mouseEventLabel);