From e297f68e336535c5ddb2c0375d2fffa0d7564b1e Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Fri, 3 May 2024 02:51:02 +0300 Subject: [PATCH] remove redundant metatype registrations among other things Signed-off-by: Ivailo Monev --- .../qabstractslider/tst_qabstractslider.cpp | 1 - tests/auto/qbitarray/tst_qbitarray.cpp | 17 +------- tests/auto/qbrush/tst_qbrush.cpp | 9 ---- tests/auto/qcolor/tst_qcolor.cpp | 10 ----- tests/auto/qcssparser/tst_qcssparser.cpp | 2 - tests/auto/qdatastream/tst_qdatastream.cpp | 7 +-- tests/auto/qdate/tst_qdate.cpp | 32 +------------- tests/auto/qdatetime/tst_qdatetime.cpp | 22 +--------- tests/auto/qdbusinterface/myobject.h | 2 - tests/auto/qdialog/tst_qdialog.cpp | 6 +-- tests/auto/qlistwidget/tst_qlistwidget.cpp | 14 +----- tests/auto/qlocale/tst_qlocale.cpp | 4 -- tests/auto/qpainterpath/tst_qpainterpath.cpp | 2 - tests/auto/qpen/tst_qpen.cpp | 11 ----- tests/auto/qrect/tst_qrect.cpp | 10 ++--- tests/auto/qregion/tst_qregion.cpp | 9 ---- tests/auto/qsize/tst_qsize.cpp | 6 +-- tests/auto/qsizef/tst_qsizef.cpp | 6 +-- tests/auto/qtime/tst_qtime.cpp | 43 ------------------- tests/auto/qtransform/tst_qtransform.cpp | 35 +-------------- tests/auto/qvariant/tst_qvariant.cpp | 26 ----------- .../gui/painting/qpainter/tst_qpainter.cpp | 4 -- 22 files changed, 18 insertions(+), 260 deletions(-) diff --git a/tests/auto/qabstractslider/tst_qabstractslider.cpp b/tests/auto/qabstractslider/tst_qabstractslider.cpp index 0d99068f1..9a08691aa 100644 --- a/tests/auto/qabstractslider/tst_qabstractslider.cpp +++ b/tests/auto/qabstractslider/tst_qabstractslider.cpp @@ -92,7 +92,6 @@ private: }; Q_DECLARE_METATYPE(QList) -Q_DECLARE_METATYPE(QPoint) void tst_QAbstractSlider::initTestCase() { diff --git a/tests/auto/qbitarray/tst_qbitarray.cpp b/tests/auto/qbitarray/tst_qbitarray.cpp index c06930d28..8bc4b6669 100644 --- a/tests/auto/qbitarray/tst_qbitarray.cpp +++ b/tests/auto/qbitarray/tst_qbitarray.cpp @@ -51,11 +51,7 @@ static QBitArray QStringToQBitArray(const QString &str) class tst_QBitArray : public QObject { -Q_OBJECT - -public: - tst_QBitArray(); - virtual ~tst_QBitArray(); + Q_OBJECT private slots: void size_data(); @@ -89,17 +85,6 @@ private slots: void resize(); }; -Q_DECLARE_METATYPE(QBitArray) - -tst_QBitArray::tst_QBitArray() -{ -} - -tst_QBitArray::~tst_QBitArray() -{ - -} - void tst_QBitArray::size_data() { //create the testtable instance and define the elements diff --git a/tests/auto/qbrush/tst_qbrush.cpp b/tests/auto/qbrush/tst_qbrush.cpp index bc865d662..21837e49b 100644 --- a/tests/auto/qbrush/tst_qbrush.cpp +++ b/tests/auto/qbrush/tst_qbrush.cpp @@ -35,9 +35,6 @@ class tst_QBrush : public QObject { Q_OBJECT -public: - tst_QBrush(); - private slots: void operator_eq_eq(); void operator_eq_eq_data(); @@ -61,12 +58,6 @@ private slots: void debug(); }; -Q_DECLARE_METATYPE(QBrush) - -tst_QBrush::tst_QBrush() -{ -} - void tst_QBrush::operator_eq_eq_data() { QTest::addColumn("brush1"); diff --git a/tests/auto/qcolor/tst_qcolor.cpp b/tests/auto/qcolor/tst_qcolor.cpp index 71bd40e8d..1c62e1783 100644 --- a/tests/auto/qcolor/tst_qcolor.cpp +++ b/tests/auto/qcolor/tst_qcolor.cpp @@ -34,9 +34,6 @@ class tst_QColor : public QObject { Q_OBJECT -public: - tst_QColor(); - private slots: void getSetCheck(); void isValid_data(); @@ -215,13 +212,6 @@ void tst_QColor::getSetCheck() QCOMPARE(obj1.rgb(), qRgb(0, 0, 0)); } -Q_DECLARE_METATYPE(QColor) - - -tst_QColor::tst_QColor() -{ -} - void tst_QColor::isValid_data() { QTest::addColumn("color"); diff --git a/tests/auto/qcssparser/tst_qcssparser.cpp b/tests/auto/qcssparser/tst_qcssparser.cpp index 81a202af3..2faa77af9 100644 --- a/tests/auto/qcssparser/tst_qcssparser.cpp +++ b/tests/auto/qcssparser/tst_qcssparser.cpp @@ -800,8 +800,6 @@ void tst_QCssParser::invalidAtKeywords() QCOMPARE(rule.declarations.at(0).d->values.at(0).variant.toString(), QString("blue")); } -Q_DECLARE_METATYPE(QColor) - void tst_QCssParser::colorValue_data() { QTest::addColumn("css"); diff --git a/tests/auto/qdatastream/tst_qdatastream.cpp b/tests/auto/qdatastream/tst_qdatastream.cpp index 70535ca43..0998019a9 100644 --- a/tests/auto/qdatastream/tst_qdatastream.cpp +++ b/tests/auto/qdatastream/tst_qdatastream.cpp @@ -29,11 +29,8 @@ #define SVGFILE "tests2.svg" -Q_DECLARE_METATYPE(QBitArray) -Q_DECLARE_METATYPE(qint64) - -//TESTED_CLASS= -//TESTED_FILES= +// TESTED_CLASS= +// TESTED_FILES= class tst_QDataStream : public QObject { diff --git a/tests/auto/qdate/tst_qdate.cpp b/tests/auto/qdate/tst_qdate.cpp index 2924e909f..89e5320be 100644 --- a/tests/auto/qdate/tst_qdate.cpp +++ b/tests/auto/qdate/tst_qdate.cpp @@ -29,15 +29,8 @@ class tst_QDate : public QObject { -Q_OBJECT + Q_OBJECT -public: - tst_QDate(); - virtual ~tst_QDate(); - -public slots: - void init(); - void cleanup(); private slots: void toString(); void isValid_data(); @@ -82,29 +75,6 @@ private slots: void roundtrip() const; }; -Q_DECLARE_METATYPE(QDate) - -tst_QDate::tst_QDate() -{ -} - -tst_QDate::~tst_QDate() -{ - -} - -void tst_QDate::init() -{ -// This will be executed immediately before each test is run. -// TODO: Add initialization code here. -} - -void tst_QDate::cleanup() -{ -// This will be executed immediately after each test is run. -// TODO: Add cleanup code here. -} - void tst_QDate::isValid_data() { QTest::addColumn("year"); diff --git a/tests/auto/qdatetime/tst_qdatetime.cpp b/tests/auto/qdatetime/tst_qdatetime.cpp index a5663a443..e38752952 100644 --- a/tests/auto/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/qdatetime/tst_qdatetime.cpp @@ -36,13 +36,10 @@ class tst_QDateTime : public QObject public: tst_QDateTime(); - virtual ~tst_QDateTime(); static QString str( int y, int month, int d, int h, int min, int s ); static QDateTime dt( const QString& str ); -public slots: - void init(); - void cleanup(); + private slots: void ctor(); void operator_eq(); @@ -123,11 +120,6 @@ private: QTime invalidTime() const { return QTime(-1, -1, -1); } }; -Q_DECLARE_METATYPE(QDateTime) -Q_DECLARE_METATYPE(QDate) -Q_DECLARE_METATYPE(QTime) - - tst_QDateTime::tst_QDateTime() { uint x1 = QDateTime(QDate(1990, 1, 1), QTime()).toTime_t(); @@ -135,18 +127,6 @@ tst_QDateTime::tst_QDateTime() europeanTimeZone = (x1 == 631148400 && x2 == 644191200); } -tst_QDateTime::~tst_QDateTime() -{ -} - -void tst_QDateTime::init() -{ -} - -void tst_QDateTime::cleanup() -{ -} - QString tst_QDateTime::str( int y, int month, int d, int h, int min, int s ) { return QDateTime( QDate(y, month, d), QTime(h, min, s) ).toString( Qt::ISODate ); diff --git a/tests/auto/qdbusinterface/myobject.h b/tests/auto/qdbusinterface/myobject.h index b14f595db..d7905f687 100644 --- a/tests/auto/qdbusinterface/myobject.h +++ b/tests/auto/qdbusinterface/myobject.h @@ -25,8 +25,6 @@ #include #include -Q_DECLARE_METATYPE(QVariantList) - class MyObject: public QObject { Q_OBJECT diff --git a/tests/auto/qdialog/tst_qdialog.cpp b/tests/auto/qdialog/tst_qdialog.cpp index 28fb1da49..cdb36516e 100644 --- a/tests/auto/qdialog/tst_qdialog.cpp +++ b/tests/auto/qdialog/tst_qdialog.cpp @@ -32,10 +32,8 @@ #include "../../shared/util.h" -Q_DECLARE_METATYPE(QSize) - -//TESTED_CLASS= -//TESTED_FILES= +// TESTED_CLASS= +// TESTED_FILES= class tst_QDialog : public QObject { diff --git a/tests/auto/qlistwidget/tst_qlistwidget.cpp b/tests/auto/qlistwidget/tst_qlistwidget.cpp index 0ec60f33a..e3be12694 100644 --- a/tests/auto/qlistwidget/tst_qlistwidget.cpp +++ b/tests/auto/qlistwidget/tst_qlistwidget.cpp @@ -37,7 +37,6 @@ class tst_QListWidget : public QObject public: tst_QListWidget(); - ~tst_QListWidget(); enum ModelChanged { RowsAboutToBeInserted, @@ -54,7 +53,6 @@ public slots: void initTestCase(); void cleanupTestCase(); void init(); - void cleanup(); private slots: void addItem(); @@ -147,13 +145,9 @@ private: typedef QList IntList; Q_DECLARE_METATYPE(IntList) -Q_DECLARE_METATYPE(QVariantList) -tst_QListWidget::tst_QListWidget(): testWidget(0), rcParent(8), rcFirst(8,0), rcLast(8,0) -{ -} - -tst_QListWidget::~tst_QListWidget() +tst_QListWidget::tst_QListWidget() + : testWidget(0), rcParent(8), rcFirst(8,0), rcLast(8,0) { } @@ -208,10 +202,6 @@ void tst_QListWidget::checkDefaultValues() QCOMPARE(testWidget->count(), 0); } -void tst_QListWidget::cleanup() -{ -} - void tst_QListWidget::populate() { addItem(); diff --git a/tests/auto/qlocale/tst_qlocale.cpp b/tests/auto/qlocale/tst_qlocale.cpp index fee3890b3..f83597d44 100644 --- a/tests/auto/qlocale/tst_qlocale.cpp +++ b/tests/auto/qlocale/tst_qlocale.cpp @@ -37,8 +37,6 @@ QT_USE_NAMESPACE -Q_DECLARE_METATYPE(qlonglong) -Q_DECLARE_METATYPE(QDate) Q_DECLARE_METATYPE(QLocale::FormatType) //TESTED_CLASS= @@ -792,8 +790,6 @@ void tst_QLocale::formatDate() QCOMPARE(l.toString(date, format), result); } -Q_DECLARE_METATYPE(QTime) - void tst_QLocale::formatTime_data() { QTest::addColumn("time"); diff --git a/tests/auto/qpainterpath/tst_qpainterpath.cpp b/tests/auto/qpainterpath/tst_qpainterpath.cpp index 33506129a..9f2342f1d 100644 --- a/tests/auto/qpainterpath/tst_qpainterpath.cpp +++ b/tests/auto/qpainterpath/tst_qpainterpath.cpp @@ -136,8 +136,6 @@ void tst_QPainterPath::swap() } Q_DECLARE_METATYPE(QPainterPath) -Q_DECLARE_METATYPE(QPointF) -Q_DECLARE_METATYPE(QRectF) void tst_QPainterPath::currentPosition() { diff --git a/tests/auto/qpen/tst_qpen.cpp b/tests/auto/qpen/tst_qpen.cpp index ae3a33ec4..90e880d38 100644 --- a/tests/auto/qpen/tst_qpen.cpp +++ b/tests/auto/qpen/tst_qpen.cpp @@ -33,9 +33,6 @@ class tst_QPen : public QObject { Q_OBJECT -public: - tst_QPen(); - private slots: void getSetCheck(); void swap(); @@ -83,14 +80,6 @@ void tst_QPen::swap() QCOMPARE(p2.color(), QColor(Qt::black)); } -Q_DECLARE_METATYPE(QPen) -Q_DECLARE_METATYPE(QBrush) - -tst_QPen::tst_QPen() - -{ -} - void tst_QPen::operator_eq_eq_data() { QTest::addColumn("pen1"); diff --git a/tests/auto/qrect/tst_qrect.cpp b/tests/auto/qrect/tst_qrect.cpp index 15f35f192..eedfa0902 100644 --- a/tests/auto/qrect/tst_qrect.cpp +++ b/tests/auto/qrect/tst_qrect.cpp @@ -22,16 +22,12 @@ #include #include -#include #include -Q_DECLARE_METATYPE(QRectF) -Q_DECLARE_METATYPE(QPointF) -Q_DECLARE_METATYPE(QRect) -Q_DECLARE_METATYPE(QPoint) +#include -//TESTED_CLASS= -//TESTED_FILES= +// TESTED_CLASS= +// TESTED_FILES= class tst_QRect : public QObject { diff --git a/tests/auto/qregion/tst_qregion.cpp b/tests/auto/qregion/tst_qregion.cpp index b504aad90..50b2a2415 100644 --- a/tests/auto/qregion/tst_qregion.cpp +++ b/tests/auto/qregion/tst_qregion.cpp @@ -39,9 +39,6 @@ class tst_QRegion : public QObject { Q_OBJECT -public: - tst_QRegion(); - private slots: void boundingRect(); void rects(); @@ -85,13 +82,7 @@ private slots: void regionToPath(); }; -Q_DECLARE_METATYPE(QPolygon) Q_DECLARE_METATYPE(QVector) -Q_DECLARE_METATYPE(QRegion) - -tst_QRegion::tst_QRegion() -{ -} void tst_QRegion::boundingRect() { diff --git a/tests/auto/qsize/tst_qsize.cpp b/tests/auto/qsize/tst_qsize.cpp index 26afeb7fc..4cf556ed5 100644 --- a/tests/auto/qsize/tst_qsize.cpp +++ b/tests/auto/qsize/tst_qsize.cpp @@ -25,10 +25,8 @@ #include -Q_DECLARE_METATYPE(QSize) - -//TESTED_CLASS= -//TESTED_FILES= +// TESTED_CLASS= +// TESTED_FILES= class tst_QSize : public QObject { diff --git a/tests/auto/qsizef/tst_qsizef.cpp b/tests/auto/qsizef/tst_qsizef.cpp index 7e8662c9c..4477b16d8 100644 --- a/tests/auto/qsizef/tst_qsizef.cpp +++ b/tests/auto/qsizef/tst_qsizef.cpp @@ -23,10 +23,8 @@ #include #include -Q_DECLARE_METATYPE(QSizeF) - -//TESTED_CLASS= -//TESTED_FILES=corelib/tools/qsize.h corelib/tools/qsize.cpp +// TESTED_CLASS= +// TESTED_FILES=corelib/tools/qsize.h corelib/tools/qsize.cpp class tst_QSizeF : public QObject { Q_OBJECT diff --git a/tests/auto/qtime/tst_qtime.cpp b/tests/auto/qtime/tst_qtime.cpp index 50a57a772..5cb102665 100644 --- a/tests/auto/qtime/tst_qtime.cpp +++ b/tests/auto/qtime/tst_qtime.cpp @@ -28,16 +28,6 @@ class tst_QTime : public QObject { Q_OBJECT -public: - tst_QTime(); - virtual ~tst_QTime(); - - -public slots: - void initTestCase(); - void cleanupTestCase(); - void init(); - void cleanup(); private slots: void toStringLocale(); void toString(); @@ -73,39 +63,6 @@ private slots: void toString_format(); }; -Q_DECLARE_METATYPE(QTime) - -tst_QTime::tst_QTime() -{ -} - -tst_QTime::~tst_QTime() -{ - -} - -// initTestCase will be executed once before the first testfunction is executed. -void tst_QTime::initTestCase() -{ -} - -// cleanupTestCase will be executed once after the last testfunction is executed. -void tst_QTime::cleanupTestCase() -{ -} - -// init() will be executed immediately before each testfunction is run. -void tst_QTime::init() -{ -// TODO: Add testfunction specific initialization code here. -} - -// cleanup() will be executed immediately after each testfunction is run. -void tst_QTime::cleanup() -{ -// TODO: Add testfunction specific cleanup code here. -} - void tst_QTime::addSecs_data() { QTest::addColumn("t1"); diff --git a/tests/auto/qtransform/tst_qtransform.cpp b/tests/auto/qtransform/tst_qtransform.cpp index 2a4f3bae2..c05888445 100644 --- a/tests/auto/qtransform/tst_qtransform.cpp +++ b/tests/auto/qtransform/tst_qtransform.cpp @@ -26,23 +26,13 @@ #include "qpolygon.h" #include "qdebug.h" -Q_DECLARE_METATYPE(QRect) - -//TESTED_CLASS= -//TESTED_FILES= +// TESTED_CLASS= +// TESTED_FILES= class tst_QTransform : public QObject { Q_OBJECT -public: - tst_QTransform(); - virtual ~tst_QTransform(); - - -public slots: - void init(); - void cleanup(); private slots: void mapRect_data(); void operator_star_qrect_data(); @@ -71,27 +61,6 @@ private: void mapping_data(); }; -Q_DECLARE_METATYPE(QTransform) -Q_DECLARE_METATYPE(QPolygon) - -tst_QTransform::tst_QTransform() -{ -} - -tst_QTransform::~tst_QTransform() -{ -} - -void tst_QTransform::init() -{ - // No initialisation is required -} - -void tst_QTransform::cleanup() -{ - // No cleanup is required. -} - void tst_QTransform::mapRect_data() { mapping_data(); diff --git a/tests/auto/qvariant/tst_qvariant.cpp b/tests/auto/qvariant/tst_qvariant.cpp index 508f9ec0e..40b8ad29e 100644 --- a/tests/auto/qvariant/tst_qvariant.cpp +++ b/tests/auto/qvariant/tst_qvariant.cpp @@ -47,22 +47,6 @@ #include -Q_DECLARE_METATYPE(qlonglong) -Q_DECLARE_METATYPE(qulonglong) -Q_DECLARE_METATYPE(QPointF) -Q_DECLARE_METATYPE(QRectF) -Q_DECLARE_METATYPE(QSize) -Q_DECLARE_METATYPE(QSizeF) -Q_DECLARE_METATYPE(QLine) -Q_DECLARE_METATYPE(QLineF) -Q_DECLARE_METATYPE(QPoint) -Q_DECLARE_METATYPE(QRect) -Q_DECLARE_METATYPE(QPixmap) -Q_DECLARE_METATYPE(QBrush) -Q_DECLARE_METATYPE(QFont) -Q_DECLARE_METATYPE(QColor) -Q_DECLARE_METATYPE(QKeySequence) - //TESTED_CLASS= //TESTED_FILES= @@ -70,9 +54,6 @@ class tst_QVariant : public QObject { Q_OBJECT -public: - tst_QVariant(); - private slots: void constructor(); void copy_constructor(); @@ -245,18 +226,11 @@ private slots: void forwardDeclare(); }; -Q_DECLARE_METATYPE(QDate) -Q_DECLARE_METATYPE(QTime) -Q_DECLARE_METATYPE(QDateTime) Q_DECLARE_METATYPE(QVariant) const qlonglong intMax1 = (qlonglong)INT_MAX + 1; const qulonglong uintMax1 = (qulonglong)UINT_MAX + 1; -tst_QVariant::tst_QVariant() -{ -} - void tst_QVariant::constructor() { QVariant variant; diff --git a/tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp b/tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp index 642a28abd..8fe12ca98 100644 --- a/tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp +++ b/tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp @@ -29,10 +29,6 @@ #include #include -Q_DECLARE_METATYPE(QLine) -Q_DECLARE_METATYPE(QRect) -Q_DECLARE_METATYPE(QSize) -Q_DECLARE_METATYPE(QPoint) Q_DECLARE_METATYPE(QPainterPath) Q_DECLARE_METATYPE(QPainter::RenderHint) Q_DECLARE_METATYPE(QPainter::CompositionMode)