Fix a few compiler warnings in tests
Change-Id: I22f6ac8ed02dd4ef4083ce3c781552623a0b08da Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
parent
fce1019133
commit
bde773ec6a
@ -421,7 +421,7 @@ public:
|
||||
this->blockThread = blockThread;
|
||||
}
|
||||
|
||||
ThreadFunctionResult threadFunction()
|
||||
ThreadFunctionResult threadFunction() override
|
||||
{
|
||||
QTest::qSleep(50);
|
||||
throw QException();
|
||||
@ -439,7 +439,7 @@ public:
|
||||
this->blockThread = blockThread;
|
||||
}
|
||||
|
||||
ThreadFunctionResult threadFunction()
|
||||
ThreadFunctionResult threadFunction() override
|
||||
{
|
||||
QTest::qSleep(50);
|
||||
throw int();
|
||||
|
@ -204,9 +204,9 @@ bool tst_qfileopenevent::event(QEvent *event)
|
||||
|
||||
void tst_qfileopenevent::sendAndReceive()
|
||||
{
|
||||
QScopedPointer<QFileOpenEvent> event(createFileAndEvent(QLatin1String("testSendAndReceive"), QByteArray("sending")));
|
||||
std::unique_ptr<QFileOpenEvent> event(createFileAndEvent(QLatin1String("testSendAndReceive"), QByteArray("sending")));
|
||||
|
||||
QCoreApplication::instance()->postEvent(this, event.take());
|
||||
QCoreApplication::instance()->postEvent(this, event.release());
|
||||
QCoreApplication::instance()->processEvents();
|
||||
|
||||
// QTBUG-17468: On Mac, processEvents doesn't always process posted events
|
||||
|
@ -839,7 +839,7 @@ class Client : public QThread
|
||||
{
|
||||
|
||||
public:
|
||||
void run()
|
||||
void run() override
|
||||
{
|
||||
QString testLine = "test";
|
||||
LocalSocket socket;
|
||||
@ -864,7 +864,7 @@ public:
|
||||
int clients;
|
||||
QMutex mutex;
|
||||
QWaitCondition wc;
|
||||
void run()
|
||||
void run() override
|
||||
{
|
||||
QString testLine = "test";
|
||||
LocalServer server;
|
||||
@ -1219,7 +1219,8 @@ class WriteThread : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
void run() {
|
||||
void run() override
|
||||
{
|
||||
QLocalSocket socket;
|
||||
socket.connectToServer("qlocalsocket_readyread");
|
||||
|
||||
|
@ -99,7 +99,7 @@ class DBTestModel: public QSqlQueryModel
|
||||
{
|
||||
public:
|
||||
DBTestModel(QObject *parent = nullptr): QSqlQueryModel(parent) {}
|
||||
QModelIndex indexInQuery(const QModelIndex &item) const { return QSqlQueryModel::indexInQuery(item); }
|
||||
QModelIndex indexInQuery(const QModelIndex &item) const override { return QSqlQueryModel::indexInQuery(item); }
|
||||
};
|
||||
|
||||
tst_QSqlQueryModel::tst_QSqlQueryModel()
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
void resetCounter() {m_counter = 100;}
|
||||
|
||||
protected:
|
||||
bool event(QEvent *e);
|
||||
bool event(QEvent *e) override;
|
||||
|
||||
private:
|
||||
QObject *m_peer;
|
||||
@ -68,7 +68,7 @@ public:
|
||||
int foo(int bar);
|
||||
|
||||
protected:
|
||||
bool event(QEvent *e);
|
||||
bool event(QEvent *e) override;
|
||||
};
|
||||
|
||||
bool EventTester::event(QEvent *e)
|
||||
|
@ -260,7 +260,8 @@ public:
|
||||
NativeMutexThread(NativeMutexType *mutex1, NativeMutexType *mutex2, int iterations, int msleepDuration, bool use2mutexes)
|
||||
: mutex1(mutex1), mutex2(mutex2), iterations(iterations), msleepDuration(msleepDuration), use2mutexes(use2mutexes), done(false)
|
||||
{ }
|
||||
void run() {
|
||||
void run() override
|
||||
{
|
||||
forever {
|
||||
tst_QMutex::semaphore1.release();
|
||||
tst_QMutex::semaphore2.acquire();
|
||||
@ -329,7 +330,8 @@ public:
|
||||
QMutexThread(QMutex *mutex1, QMutex *mutex2, int iterations, int msleepDuration, bool use2mutexes)
|
||||
: mutex1(mutex1), mutex2(mutex2), iterations(iterations), msleepDuration(msleepDuration), use2mutexes(use2mutexes), done(false)
|
||||
{ }
|
||||
void run() {
|
||||
void run() override
|
||||
{
|
||||
forever {
|
||||
tst_QMutex::semaphore1.release();
|
||||
tst_QMutex::semaphore2.acquire();
|
||||
@ -393,7 +395,8 @@ public:
|
||||
QMutexLockerThread(QMutex *mutex1, QMutex *mutex2, int iterations, int msleepDuration, bool use2mutexes)
|
||||
: mutex1(mutex1), mutex2(mutex2), iterations(iterations), msleepDuration(msleepDuration), use2mutexes(use2mutexes), done(false)
|
||||
{ }
|
||||
void run() {
|
||||
void run() override
|
||||
{
|
||||
forever {
|
||||
tst_QMutex::semaphore1.release();
|
||||
tst_QMutex::semaphore2.acquire();
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
int m_threadid;
|
||||
int timeout;
|
||||
|
||||
void run()
|
||||
void run() override
|
||||
{
|
||||
for (int count = 0; count < 5000; ++count) {
|
||||
|
||||
|
@ -70,13 +70,12 @@ public slots:
|
||||
int size(const QDBusVariant &data)
|
||||
{
|
||||
QVariant v = data.variant();
|
||||
switch (v.type())
|
||||
{
|
||||
case QVariant::ByteArray:
|
||||
switch (v.typeId()) {
|
||||
case QMetaType::QByteArray:
|
||||
return v.toByteArray().size();
|
||||
case QVariant::StringList:
|
||||
case QMetaType::QStringList:
|
||||
return v.toStringList().size();
|
||||
case QVariant::String:
|
||||
case QMetaType::QString:
|
||||
default:
|
||||
return v.toString().size();
|
||||
}
|
||||
|
@ -43,9 +43,9 @@ public:
|
||||
void setStartValue(const QRect &rect);
|
||||
|
||||
void setDuration(int d);
|
||||
int duration() const;
|
||||
int duration() const override;
|
||||
|
||||
virtual void updateCurrentTime(int currentTime);
|
||||
void updateCurrentTime(int currentTime) override;
|
||||
|
||||
private:
|
||||
DummyObject *m_object;
|
||||
|
@ -81,7 +81,7 @@ private slots:
|
||||
}
|
||||
|
||||
protected:
|
||||
void run()
|
||||
void run() override
|
||||
{
|
||||
QTcpServer server;
|
||||
server.listen();
|
||||
@ -176,7 +176,7 @@ public:
|
||||
inline int serverPort() const { return port; }
|
||||
|
||||
protected:
|
||||
void run()
|
||||
void run() override
|
||||
{
|
||||
QTcpServer server;
|
||||
server.listen();
|
||||
@ -216,7 +216,7 @@ public slots:
|
||||
void stop() { state = Stopped; emit readyRead(); }
|
||||
|
||||
protected:
|
||||
virtual qint64 readData(char *data, qint64 maxlen)
|
||||
qint64 readData(char *data, qint64 maxlen) override
|
||||
{
|
||||
if (state == Stopped)
|
||||
return -1; // EOF
|
||||
@ -225,8 +225,7 @@ protected:
|
||||
memset(data, '@', maxlen);
|
||||
return maxlen;
|
||||
}
|
||||
virtual qint64 writeData(const char *, qint64)
|
||||
{ return -1; }
|
||||
qint64 writeData(const char *, qint64) override { return -1; }
|
||||
};
|
||||
|
||||
class ThreadedDataReaderHttpServer: public QThread
|
||||
@ -248,7 +247,7 @@ public:
|
||||
inline int serverPort() const { return port; }
|
||||
|
||||
protected:
|
||||
void run()
|
||||
void run() override
|
||||
{
|
||||
QTcpServer server;
|
||||
server.listen();
|
||||
@ -303,28 +302,22 @@ public:
|
||||
toBeGeneratedTotalCount = toBeGeneratedCount = size;
|
||||
}
|
||||
|
||||
virtual qint64 bytesAvailable() const
|
||||
qint64 bytesAvailable() const override
|
||||
{
|
||||
return state == Started ? toBeGeneratedCount + QIODevice::bytesAvailable() : 0;
|
||||
}
|
||||
|
||||
virtual bool isSequential() const{
|
||||
return false;
|
||||
}
|
||||
bool isSequential() const override { return false; }
|
||||
|
||||
virtual bool reset() {
|
||||
return false;
|
||||
}
|
||||
bool reset() override { return false; }
|
||||
|
||||
qint64 size() const {
|
||||
return toBeGeneratedTotalCount;
|
||||
}
|
||||
qint64 size() const override { return toBeGeneratedTotalCount; }
|
||||
|
||||
public slots:
|
||||
void start() { state = Started; emit readyRead(); }
|
||||
|
||||
protected:
|
||||
virtual qint64 readData(char *data, qint64 maxlen)
|
||||
qint64 readData(char *data, qint64 maxlen) override
|
||||
{
|
||||
memset(data, '@', maxlen);
|
||||
|
||||
@ -342,8 +335,7 @@ protected:
|
||||
|
||||
return n;
|
||||
}
|
||||
virtual qint64 writeData(const char *, qint64)
|
||||
{ return -1; }
|
||||
qint64 writeData(const char *, qint64) override { return -1; }
|
||||
|
||||
qint64 toBeGeneratedCount;
|
||||
qint64 toBeGeneratedTotalCount;
|
||||
|
@ -165,9 +165,9 @@ private:
|
||||
{
|
||||
if (m_temporaryDir.isValid()) {
|
||||
const QString absName = absoluteFilePath(fileName);
|
||||
QScopedPointer<QFile> file(new QFile(absName));
|
||||
std::unique_ptr<QFile> file(new QFile(absName));
|
||||
if (file->open(QIODevice::WriteOnly))
|
||||
return file.take();
|
||||
return file.release();
|
||||
qWarning("Cannot open '%s' for writing: %s", qPrintable(absName), qPrintable(file->errorString()));
|
||||
}
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user