diff options
Diffstat (limited to 'tests')
11 files changed, 37 insertions, 42 deletions
diff --git a/tests/auto/concurrent/qtconcurrentthreadengine/tst_qtconcurrentthreadengine.cpp b/tests/auto/concurrent/qtconcurrentthreadengine/tst_qtconcurrentthreadengine.cpp index e58eb68cea..c365ec4837 100644 --- a/tests/auto/concurrent/qtconcurrentthreadengine/tst_qtconcurrentthreadengine.cpp +++ b/tests/auto/concurrent/qtconcurrentthreadengine/tst_qtconcurrentthreadengine.cpp @@ -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(); diff --git a/tests/auto/gui/kernel/qfileopenevent/test/tst_qfileopenevent.cpp b/tests/auto/gui/kernel/qfileopenevent/test/tst_qfileopenevent.cpp index 0e5c7927e0..31cb036515 100644 --- a/tests/auto/gui/kernel/qfileopenevent/test/tst_qfileopenevent.cpp +++ b/tests/auto/gui/kernel/qfileopenevent/test/tst_qfileopenevent.cpp @@ -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 diff --git a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp index a5559cab70..68beef7d68 100644 --- a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp @@ -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"); diff --git a/tests/auto/sql/models/qsqlquerymodel/tst_qsqlquerymodel.cpp b/tests/auto/sql/models/qsqlquerymodel/tst_qsqlquerymodel.cpp index ac94961a84..f323c8b984 100644 --- a/tests/auto/sql/models/qsqlquerymodel/tst_qsqlquerymodel.cpp +++ b/tests/auto/sql/models/qsqlquerymodel/tst_qsqlquerymodel.cpp @@ -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() diff --git a/tests/benchmarks/corelib/kernel/events/main.cpp b/tests/benchmarks/corelib/kernel/events/main.cpp index 9998eeee4e..973d96261c 100644 --- a/tests/benchmarks/corelib/kernel/events/main.cpp +++ b/tests/benchmarks/corelib/kernel/events/main.cpp @@ -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) diff --git a/tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp b/tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp index f010b05e54..9cea995433 100644 --- a/tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp +++ b/tests/benchmarks/corelib/thread/qmutex/tst_qmutex.cpp @@ -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(); diff --git a/tests/benchmarks/corelib/thread/qwaitcondition/tst_qwaitcondition.cpp b/tests/benchmarks/corelib/thread/qwaitcondition/tst_qwaitcondition.cpp index 4e31dd4009..b87da463dc 100644 --- a/tests/benchmarks/corelib/thread/qwaitcondition/tst_qwaitcondition.cpp +++ b/tests/benchmarks/corelib/thread/qwaitcondition/tst_qwaitcondition.cpp @@ -61,7 +61,7 @@ public: int m_threadid; int timeout; - void run() + void run() override { for (int count = 0; count < 5000; ++count) { diff --git a/tests/benchmarks/dbus/qdbusperformance/serverobject.h b/tests/benchmarks/dbus/qdbusperformance/serverobject.h index b7ef2991c2..ea499f32ec 100644 --- a/tests/benchmarks/dbus/qdbusperformance/serverobject.h +++ b/tests/benchmarks/dbus/qdbusperformance/serverobject.h @@ -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(); } diff --git a/tests/benchmarks/gui/animation/qanimation/rectanimation.h b/tests/benchmarks/gui/animation/qanimation/rectanimation.h index 8d7de89eaa..9528b6c16d 100644 --- a/tests/benchmarks/gui/animation/qanimation/rectanimation.h +++ b/tests/benchmarks/gui/animation/qanimation/rectanimation.h @@ -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; diff --git a/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp index 6d55cb4306..5e590c7d13 100644 --- a/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -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; diff --git a/tests/shared/filesystem.h b/tests/shared/filesystem.h index 76ebc485ff..03f2bb42fd 100644 --- a/tests/shared/filesystem.h +++ b/tests/shared/filesystem.h @@ -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; |