summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks/gui
diff options
context:
space:
mode:
Diffstat (limited to 'tests/benchmarks/gui')
-rw-r--r--tests/benchmarks/gui/kernel/kernel.pro4
-rw-r--r--tests/benchmarks/gui/kernel/qapplication/main.cpp2
-rw-r--r--tests/benchmarks/gui/kernel/qguimetatype/tst_qguimetatype.cpp60
-rw-r--r--tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp4
-rw-r--r--tests/benchmarks/gui/painting/qtbench/tst_qtbench.cpp2
-rw-r--r--tests/benchmarks/gui/text/qfontmetrics/main.cpp1
6 files changed, 13 insertions, 60 deletions
diff --git a/tests/benchmarks/gui/kernel/kernel.pro b/tests/benchmarks/gui/kernel/kernel.pro
index cd7235cff8..607e58b6c0 100644
--- a/tests/benchmarks/gui/kernel/kernel.pro
+++ b/tests/benchmarks/gui/kernel/kernel.pro
@@ -1,4 +1,6 @@
TEMPLATE = subdirs
qtHaveModule(widgets): SUBDIRS = \
qapplication \
- qwidget
+ qwidget \
+ qguimetatype \
+ qguivariant
diff --git a/tests/benchmarks/gui/kernel/qapplication/main.cpp b/tests/benchmarks/gui/kernel/qapplication/main.cpp
index c319b2bcc6..dcf3ca75b6 100644
--- a/tests/benchmarks/gui/kernel/qapplication/main.cpp
+++ b/tests/benchmarks/gui/kernel/qapplication/main.cpp
@@ -60,7 +60,7 @@ void tst_qapplication::ctor()
{
// simulate reasonable argc, argv
int argc = 1;
- char *argv[] = { "tst_qapplication" };
+ char *argv[] = { const_cast<char*>("tst_qapplication") };
QBENCHMARK {
QApplication app(argc, argv);
}
diff --git a/tests/benchmarks/gui/kernel/qguimetatype/tst_qguimetatype.cpp b/tests/benchmarks/gui/kernel/qguimetatype/tst_qguimetatype.cpp
index 8f987470f5..ec587707c3 100644
--- a/tests/benchmarks/gui/kernel/qguimetatype/tst_qguimetatype.cpp
+++ b/tests/benchmarks/gui/kernel/qguimetatype/tst_qguimetatype.cpp
@@ -46,77 +46,27 @@ class tst_QGuiMetaType : public QObject
{
Q_OBJECT
-public:
- tst_QGuiMetaType();
- virtual ~tst_QGuiMetaType();
-
private slots:
- void constructGuiType_data();
- void constructGuiType();
- void constructGuiTypeCopy_data();
- void constructGuiTypeCopy();
-
void constructInPlace_data();
void constructInPlace();
void constructInPlaceCopy_data();
void constructInPlaceCopy();
+private:
+ void constructableGuiTypes();
};
-tst_QGuiMetaType::tst_QGuiMetaType()
-{
-}
-
-tst_QGuiMetaType::~tst_QGuiMetaType()
-{
-}
-void tst_QGuiMetaType::constructGuiType_data()
+void tst_QGuiMetaType::constructableGuiTypes()
{
QTest::addColumn<int>("typeId");
for (int i = QMetaType::FirstGuiType; i <= QMetaType::LastGuiType; ++i)
QTest::newRow(QMetaType::typeName(i)) << i;
}
-// Tests how fast QMetaType can default-construct and destroy a Qt GUI
-// type. The purpose of this benchmark is to measure the overhead of
-// using type id-based creation compared to creating the type directly
-// (i.e. "T *t = new T(); delete t;").
-void tst_QGuiMetaType::constructGuiType()
-{
- QFETCH(int, typeId);
- QBENCHMARK {
- for (int i = 0; i < 100000; ++i) {
- void *data = QMetaType::create(typeId, (void *)0);
- QMetaType::destroy(typeId, data);
- }
- }
-}
-
-void tst_QGuiMetaType::constructGuiTypeCopy_data()
-{
- constructGuiType_data();
-}
-
-// Tests how fast QMetaType can copy-construct and destroy a Qt GUI
-// type. The purpose of this benchmark is to measure the overhead of
-// using type id-based creation compared to creating the type directly
-// (i.e. "T *t = new T(other); delete t;").
-void tst_QGuiMetaType::constructGuiTypeCopy()
-{
- QFETCH(int, typeId);
- QVariant other(typeId, (void *)0);
- const void *copy = other.constData();
- QBENCHMARK {
- for (int i = 0; i < 100000; ++i) {
- void *data = QMetaType::create(typeId, copy);
- QMetaType::destroy(typeId, data);
- }
- }
-}
void tst_QGuiMetaType::constructInPlace_data()
{
- constructGuiType_data();
+ constructableGuiTypes();
}
void tst_QGuiMetaType::constructInPlace()
@@ -137,7 +87,7 @@ void tst_QGuiMetaType::constructInPlace()
void tst_QGuiMetaType::constructInPlaceCopy_data()
{
- constructGuiType_data();
+ constructableGuiTypes();
}
void tst_QGuiMetaType::constructInPlaceCopy()
diff --git a/tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp b/tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp
index 4b2781e9ea..a6f144ea8a 100644
--- a/tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp
+++ b/tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp
@@ -1290,7 +1290,7 @@ void tst_QPainter::drawScaledAntialiasedRoundedRect_data()
{
QTest::addColumn<float>("scale");
- for (float i = 0; i < 3; i += .1)
+ for (float i = 0; i < 3; i += .1f)
QTest::newRow(QString(QLatin1String("scale=%1")).arg(i).toLatin1()) << i;
}
@@ -1471,7 +1471,7 @@ void tst_QPainter::drawScaledBorderPixmapRoundedRect_data()
QTest::addColumn<float>("scale");
QTest::addColumn<int>("imageType");
- for (float i = 0; i < 3; i += .1)
+ for (float i = 0; i < 3; i += .1f)
QTest::newRow(QString(QLatin1String("scale=%1; imagetype=ARGB32_Pre")).arg(i).toLatin1()) << i << (int)QImage::Format_ARGB32_Premultiplied;
//for (float i = 0; i < 3; i += .1)
// QTest::newRow(QString(QLatin1String("scale=%1; imagetype=ARGB8565_Pre")).arg(i).toLatin1()) << i << (int)QImage::Format_ARGB8565_Premultiplied;
diff --git a/tests/benchmarks/gui/painting/qtbench/tst_qtbench.cpp b/tests/benchmarks/gui/painting/qtbench/tst_qtbench.cpp
index 823eb404e2..e17f8c6436 100644
--- a/tests/benchmarks/gui/painting/qtbench/tst_qtbench.cpp
+++ b/tests/benchmarks/gui/painting/qtbench/tst_qtbench.cpp
@@ -152,7 +152,7 @@ private slots:
QString makeString(int length)
{
const char chars[] = "abcd efgh ijkl mnop qrst uvwx yz!$. ABCD 1234";
- int len = strlen(chars);
+ const int len = int(strlen(chars));
QString ret;
for (int j = 0; j < length; j++) {
diff --git a/tests/benchmarks/gui/text/qfontmetrics/main.cpp b/tests/benchmarks/gui/text/qfontmetrics/main.cpp
index f7515abd89..7df8e9407a 100644
--- a/tests/benchmarks/gui/text/qfontmetrics/main.cpp
+++ b/tests/benchmarks/gui/text/qfontmetrics/main.cpp
@@ -66,6 +66,7 @@ private:
void tst_QFontMetrics::testQFontMetrics( const QFontMetrics &fm )
{
int fontHeight = fm.height();
+ Q_UNUSED(fontHeight)
}
void tst_QFontMetrics::fontmetrics_create()