Rename QImageReader benchmark to tst_bench_

Helps finding it, e.g. in QtCreator, as it's now disambiguated from
tst_QImageReader, the auto-test.

As a drive-by, remove all empty functions.

Pick-to: 6.6 6.5 6.2 5.15
Task-number: QTBUG-114253
Change-Id: Icb0a3627488bbf4cb0c9d6bc9890f31a88096afd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Marc Mutz 2023-11-08 17:18:42 +01:00
parent 54c25c7c31
commit 47325e01b7
2 changed files with 17 additions and 30 deletions

View File

@ -7,7 +7,7 @@
qt_internal_add_benchmark(tst_bench_qimagereader qt_internal_add_benchmark(tst_bench_qimagereader
SOURCES SOURCES
tst_qimagereader.cpp tst_bench_qimagereader.cpp
LIBRARIES LIBRARIES
Qt::Gui Qt::Gui
Qt::Test Qt::Test

View File

@ -2,6 +2,7 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <qtest.h> #include <qtest.h>
#include <QBuffer> #include <QBuffer>
#include <QDebug> #include <QDebug>
#include <QFile> #include <QFile>
@ -9,6 +10,7 @@
#include <QImageReader> #include <QImageReader>
#include <QImageWriter> #include <QImageWriter>
#include <QPixmap> #include <QPixmap>
#include <QSet> #include <QSet>
#include <QTimer> #include <QTimer>
@ -17,18 +19,15 @@ typedef QList<int> QIntList;
Q_DECLARE_METATYPE(QStringMap) Q_DECLARE_METATYPE(QStringMap)
Q_DECLARE_METATYPE(QIntList) Q_DECLARE_METATYPE(QIntList)
class tst_QImageReader : public QObject class tst_bench_QImageReader : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
tst_QImageReader(); tst_bench_QImageReader();
virtual ~tst_QImageReader();
public slots: public slots:
void initTestCase(); void initTestCase();
void init();
void cleanup();
private slots: private slots:
void readImage_data(); void readImage_data();
@ -48,7 +47,7 @@ private:
QString prefix; QString prefix;
}; };
tst_QImageReader::tst_QImageReader() tst_bench_QImageReader::tst_bench_QImageReader()
{ {
images << QPair<QString, QByteArray>(QLatin1String("colorful.bmp"), QByteArray("bmp")); images << QPair<QString, QByteArray>(QLatin1String("colorful.bmp"), QByteArray("bmp"));
images << QPair<QString, QByteArray>(QLatin1String("font.bmp"), QByteArray("bmp")); images << QPair<QString, QByteArray>(QLatin1String("font.bmp"), QByteArray("bmp"));
@ -75,26 +74,14 @@ tst_QImageReader::tst_QImageReader()
#endif #endif
} }
tst_QImageReader::~tst_QImageReader() void tst_bench_QImageReader::initTestCase()
{
}
void tst_QImageReader::initTestCase()
{ {
prefix = QFINDTESTDATA("images/"); prefix = QFINDTESTDATA("images/");
if (prefix.isEmpty()) if (prefix.isEmpty())
QFAIL("Can't find images directory!"); QFAIL("Can't find images directory!");
} }
void tst_QImageReader::init() void tst_bench_QImageReader::readImage_data()
{
}
void tst_QImageReader::cleanup()
{
}
void tst_QImageReader::readImage_data()
{ {
QTest::addColumn<QString>("fileName"); QTest::addColumn<QString>("fileName");
QTest::addColumn<QByteArray>("format"); QTest::addColumn<QByteArray>("format");
@ -106,7 +93,7 @@ void tst_QImageReader::readImage_data()
} }
} }
void tst_QImageReader::readImage() void tst_bench_QImageReader::readImage()
{ {
QFETCH(QString, fileName); QFETCH(QString, fileName);
QFETCH(QByteArray, format); QFETCH(QByteArray, format);
@ -118,7 +105,7 @@ void tst_QImageReader::readImage()
} }
} }
void tst_QImageReader::setScaledSize_data() void tst_bench_QImageReader::setScaledSize_data()
{ {
QTest::addColumn<QString>("fileName"); QTest::addColumn<QString>("fileName");
QTest::addColumn<QByteArray>("format"); QTest::addColumn<QByteArray>("format");
@ -136,7 +123,7 @@ void tst_QImageReader::setScaledSize_data()
} }
} }
void tst_QImageReader::setScaledSize() void tst_bench_QImageReader::setScaledSize()
{ {
QFETCH(QString, fileName); QFETCH(QString, fileName);
QFETCH(QSize, newSize); QFETCH(QSize, newSize);
@ -150,7 +137,7 @@ void tst_QImageReader::setScaledSize()
} }
} }
void tst_QImageReader::setClipRect_data() void tst_bench_QImageReader::setClipRect_data()
{ {
QTest::addColumn<QString>("fileName"); QTest::addColumn<QString>("fileName");
QTest::addColumn<QByteArray>("format"); QTest::addColumn<QByteArray>("format");
@ -163,7 +150,7 @@ void tst_QImageReader::setClipRect_data()
} }
} }
void tst_QImageReader::setClipRect() void tst_bench_QImageReader::setClipRect()
{ {
QFETCH(QString, fileName); QFETCH(QString, fileName);
QFETCH(QRect, newRect); QFETCH(QRect, newRect);
@ -177,12 +164,12 @@ void tst_QImageReader::setClipRect()
} }
} }
void tst_QImageReader::setScaledClipRect_data() void tst_bench_QImageReader::setScaledClipRect_data()
{ {
setClipRect_data(); setClipRect_data();
} }
void tst_QImageReader::setScaledClipRect() void tst_bench_QImageReader::setScaledClipRect()
{ {
QFETCH(QString, fileName); QFETCH(QString, fileName);
QFETCH(QRect, newRect); QFETCH(QRect, newRect);
@ -197,5 +184,5 @@ void tst_QImageReader::setScaledClipRect()
} }
} }
QTEST_MAIN(tst_QImageReader) QTEST_MAIN(tst_bench_QImageReader)
#include "tst_qimagereader.moc" #include "tst_bench_qimagereader.moc"