From ed6f1290262af7a5e64c732d91df52e5968e1067 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Fri, 25 Nov 2016 13:52:55 +0300 Subject: [PATCH] QtTest: Add missing override Change-Id: Ibb924f11b82577fb67aa7a1a30b81f4d8d7d36fc Reviewed-by: hjk --- src/testlib/qbenchmarkevent_p.h | 18 +++++++------- src/testlib/qbenchmarktimemeasurers_p.h | 32 ++++++++++++------------- src/testlib/qbenchmarkvalgrind_p.h | 16 ++++++------- src/testlib/qplaintestlogger_p.h | 14 +++++------ src/testlib/qteamcitylogger_p.h | 14 +++++------ src/testlib/qtestcase.cpp | 2 +- src/testlib/qtestevent.h | 16 ++++++------- src/testlib/qtesteventloop.h | 2 +- src/testlib/qxmltestlogger_p.h | 14 +++++------ src/testlib/qxunittestlogger_p.h | 14 +++++------ 10 files changed, 71 insertions(+), 71 deletions(-) diff --git a/src/testlib/qbenchmarkevent_p.h b/src/testlib/qbenchmarkevent_p.h index 8231b57127..af42a17141 100644 --- a/src/testlib/qbenchmarkevent_p.h +++ b/src/testlib/qbenchmarkevent_p.h @@ -63,15 +63,15 @@ class QBenchmarkEvent : public QBenchmarkMeasurerBase, public QAbstractNativeEve public: QBenchmarkEvent(); ~QBenchmarkEvent(); - void start(); - qint64 checkpoint(); - qint64 stop(); - bool isMeasurementAccepted(qint64 measurement); - int adjustIterationCount(int suggestion); - int adjustMedianCount(int suggestion); - bool repeatCount() { return 1; } - QTest::QBenchmarkMetric metricType(); - virtual bool nativeEventFilter(const QByteArray &eventType, void *message, long *result); + void start() override; + qint64 checkpoint() override; + qint64 stop() override; + bool isMeasurementAccepted(qint64 measurement) override; + int adjustIterationCount(int suggestion) override; + int adjustMedianCount(int suggestion) override; + bool repeatCount() override { return 1; } + QTest::QBenchmarkMetric metricType() override; + bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) override; qint64 eventCounter; }; diff --git a/src/testlib/qbenchmarktimemeasurers_p.h b/src/testlib/qbenchmarktimemeasurers_p.h index e5ffb1157d..f268669e2f 100644 --- a/src/testlib/qbenchmarktimemeasurers_p.h +++ b/src/testlib/qbenchmarktimemeasurers_p.h @@ -60,14 +60,14 @@ QT_BEGIN_NAMESPACE class QBenchmarkTimeMeasurer : public QBenchmarkMeasurerBase { public: - void start(); - qint64 checkpoint(); - qint64 stop(); - bool isMeasurementAccepted(qint64 measurement); - int adjustIterationCount(int sugestion); - int adjustMedianCount(int suggestion); - bool needsWarmupIteration(); - QTest::QBenchmarkMetric metricType(); + void start() override; + qint64 checkpoint() override; + qint64 stop() override; + bool isMeasurementAccepted(qint64 measurement) override; + int adjustIterationCount(int sugestion) override; + int adjustMedianCount(int suggestion) override; + bool needsWarmupIteration() override; + QTest::QBenchmarkMetric metricType() override; private: QElapsedTimer time; }; @@ -77,14 +77,14 @@ private: class QBenchmarkTickMeasurer : public QBenchmarkMeasurerBase { public: - void start(); - qint64 checkpoint(); - qint64 stop(); - bool isMeasurementAccepted(qint64 measurement); - int adjustIterationCount(int); - int adjustMedianCount(int suggestion); - bool needsWarmupIteration(); - QTest::QBenchmarkMetric metricType(); + void start() override; + qint64 checkpoint() override; + qint64 stop() override; + bool isMeasurementAccepted(qint64 measurement) override; + int adjustIterationCount(int) override; + int adjustMedianCount(int suggestion) override; + bool needsWarmupIteration() override; + QTest::QBenchmarkMetric metricType() override; private: CycleCounterTicks startTicks; }; diff --git a/src/testlib/qbenchmarkvalgrind_p.h b/src/testlib/qbenchmarkvalgrind_p.h index dd7e7381c1..69219b9a65 100644 --- a/src/testlib/qbenchmarkvalgrind_p.h +++ b/src/testlib/qbenchmarkvalgrind_p.h @@ -76,14 +76,14 @@ public: class QBenchmarkCallgrindMeasurer : public QBenchmarkMeasurerBase { public: - void start(); - qint64 checkpoint(); - qint64 stop(); - bool isMeasurementAccepted(qint64 measurement); - int adjustIterationCount(int); - int adjustMedianCount(int); - bool needsWarmupIteration(); - QTest::QBenchmarkMetric metricType(); + void start() override; + qint64 checkpoint() override; + qint64 stop() override; + bool isMeasurementAccepted(qint64 measurement) override; + int adjustIterationCount(int) override; + int adjustMedianCount(int) override; + bool needsWarmupIteration() override; + QTest::QBenchmarkMetric metricType() override; }; QT_END_NAMESPACE diff --git a/src/testlib/qplaintestlogger_p.h b/src/testlib/qplaintestlogger_p.h index efa79e550d..93d3c7143a 100644 --- a/src/testlib/qplaintestlogger_p.h +++ b/src/testlib/qplaintestlogger_p.h @@ -61,18 +61,18 @@ public: QPlainTestLogger(const char *filename); ~QPlainTestLogger(); - void startLogging(); - void stopLogging(); + void startLogging() override; + void stopLogging() override; - void enterTestFunction(const char *function); - void leaveTestFunction(); + void enterTestFunction(const char *function) override; + void leaveTestFunction() override; void addIncident(IncidentTypes type, const char *description, - const char *file = 0, int line = 0); - void addBenchmarkResult(const QBenchmarkResult &result); + const char *file = 0, int line = 0) override; + void addBenchmarkResult(const QBenchmarkResult &result) override; void addMessage(MessageTypes type, const QString &message, - const char *file = 0, int line = 0); + const char *file = 0, int line = 0) override; private: void printMessage(const char *type, const char *msg, const char *file = 0, int line = 0); diff --git a/src/testlib/qteamcitylogger_p.h b/src/testlib/qteamcitylogger_p.h index b8fad3ae34..219aeb5ceb 100644 --- a/src/testlib/qteamcitylogger_p.h +++ b/src/testlib/qteamcitylogger_p.h @@ -63,18 +63,18 @@ public: QTeamCityLogger(const char *filename); ~QTeamCityLogger(); - void startLogging(); - void stopLogging(); + void startLogging() override; + void stopLogging() override; - void enterTestFunction(const char *function); - void leaveTestFunction(); + void enterTestFunction(const char *function) override; + void leaveTestFunction() override; void addIncident(IncidentTypes type, const char *description, - const char *file = 0, int line = 0); - void addBenchmarkResult(const QBenchmarkResult &result); + const char *file = 0, int line = 0) override; + void addBenchmarkResult(const QBenchmarkResult &result) override; void addMessage(MessageTypes type, const QString &message, - const char *file = 0, int line = 0); + const char *file = 0, int line = 0) override; private: QString currTestFuncName; diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 1c13f8edc2..f2a962408e 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -925,7 +925,7 @@ public: waitCondition.wakeAll(); } - void run() { + void run() override { QMutexLocker locker(&mutex); waitCondition.wakeAll(); while (1) { diff --git a/src/testlib/qtestevent.h b/src/testlib/qtestevent.h index 63b7401e6f..159e3e01ff 100644 --- a/src/testlib/qtestevent.h +++ b/src/testlib/qtestevent.h @@ -79,10 +79,10 @@ public: inline QTestKeyEvent(QTest::KeyAction action, char ascii, Qt::KeyboardModifiers modifiers, int delay) : _action(action), _delay(delay), _modifiers(modifiers), _ascii(ascii), _key(Qt::Key_unknown) {} - inline QTestEvent *clone() const { return new QTestKeyEvent(*this); } + inline QTestEvent *clone() const override { return new QTestKeyEvent(*this); } #ifdef QT_WIDGETS_LIB - inline void simulate(QWidget *w) + inline void simulate(QWidget *w) override { if (_ascii == 0) QTest::keyEvent(_action, w, _key, _modifiers, _delay); @@ -104,10 +104,10 @@ class QTestKeyClicksEvent: public QTestEvent public: inline QTestKeyClicksEvent(const QString &keys, Qt::KeyboardModifiers modifiers, int delay) : _keys(keys), _modifiers(modifiers), _delay(delay) {} - inline QTestEvent *clone() const { return new QTestKeyClicksEvent(*this); } + inline QTestEvent *clone() const override { return new QTestKeyClicksEvent(*this); } #ifdef QT_WIDGETS_LIB - inline void simulate(QWidget *w) + inline void simulate(QWidget *w) override { QTest::keyClicks(w, _keys, _modifiers, _delay); } @@ -125,10 +125,10 @@ public: inline QTestMouseEvent(QTest::MouseAction action, Qt::MouseButton button, Qt::KeyboardModifiers modifiers, QPoint position, int delay) : _action(action), _button(button), _modifiers(modifiers), _pos(position), _delay(delay) {} - inline QTestEvent *clone() const { return new QTestMouseEvent(*this); } + inline QTestEvent *clone() const override { return new QTestMouseEvent(*this); } #ifdef QT_WIDGETS_LIB - inline void simulate(QWidget *w) + inline void simulate(QWidget *w) override { QTest::mouseEvent(_action, w, _button, _modifiers, _pos, _delay); } @@ -148,10 +148,10 @@ class QTestDelayEvent: public QTestEvent { public: inline QTestDelayEvent(int msecs): _delay(msecs) {} - inline QTestEvent *clone() const { return new QTestDelayEvent(*this); } + inline QTestEvent *clone() const override { return new QTestDelayEvent(*this); } #ifdef QT_WIDGETS_LIB - inline void simulate(QWidget * /*w*/) { QTest::qWait(_delay); } + inline void simulate(QWidget * /*w*/) override { QTest::qWait(_delay); } #endif private: diff --git a/src/testlib/qtesteventloop.h b/src/testlib/qtesteventloop.h index 032c95d692..bcf4a4be2d 100644 --- a/src/testlib/qtesteventloop.h +++ b/src/testlib/qtesteventloop.h @@ -80,7 +80,7 @@ public Q_SLOTS: inline void exitLoop(); protected: - inline void timerEvent(QTimerEvent *e); + inline void timerEvent(QTimerEvent *e) override; private: bool inLoop; diff --git a/src/testlib/qxmltestlogger_p.h b/src/testlib/qxmltestlogger_p.h index c6461387b2..b85742f939 100644 --- a/src/testlib/qxmltestlogger_p.h +++ b/src/testlib/qxmltestlogger_p.h @@ -64,18 +64,18 @@ public: QXmlTestLogger(XmlMode mode, const char *filename); ~QXmlTestLogger(); - void startLogging(); - void stopLogging(); + void startLogging() override; + void stopLogging() override; - void enterTestFunction(const char *function); - void leaveTestFunction(); + void enterTestFunction(const char *function) override; + void leaveTestFunction() override; void addIncident(IncidentTypes type, const char *description, - const char *file = 0, int line = 0); - void addBenchmarkResult(const QBenchmarkResult &result); + const char *file = 0, int line = 0) override; + void addBenchmarkResult(const QBenchmarkResult &result) override; void addMessage(MessageTypes type, const QString &message, - const char *file = 0, int line = 0); + const char *file = 0, int line = 0) override; static int xmlCdata(QTestCharBuffer *dest, char const* src); static int xmlQuote(QTestCharBuffer *dest, char const* src); diff --git a/src/testlib/qxunittestlogger_p.h b/src/testlib/qxunittestlogger_p.h index 50f26c317b..8fb01fbe61 100644 --- a/src/testlib/qxunittestlogger_p.h +++ b/src/testlib/qxunittestlogger_p.h @@ -64,19 +64,19 @@ class QXunitTestLogger : public QAbstractTestLogger QXunitTestLogger(const char *filename); ~QXunitTestLogger(); - void startLogging(); - void stopLogging(); + void startLogging() override; + void stopLogging() override; - void enterTestFunction(const char *function); - void leaveTestFunction(); + void enterTestFunction(const char *function) override; + void leaveTestFunction() override; void addIncident(IncidentTypes type, const char *description, - const char *file = 0, int line = 0); - void addBenchmarkResult(const QBenchmarkResult &result); + const char *file = 0, int line = 0) override; + void addBenchmarkResult(const QBenchmarkResult &result) override; void addTag(QTestElement* element); void addMessage(MessageTypes type, const QString &message, - const char *file = 0, int line = 0); + const char *file = 0, int line = 0) override; private: QTestElement *listOfTestcases;