diff options
author | Jason McDonald <jason.mcdonald@nokia.com> | 2011-05-18 17:55:57 +1000 |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2011-05-19 14:54:16 +1000 |
commit | c5303517c3bc90ca39c30c064fc6e8df18eb3660 (patch) | |
tree | 0884819bcedf9a32a2ae9c47dcebe451e548ab04 /tests/benchmarks/gui/painting/qtbench | |
parent | e3dddbbd2ee9624386316de5949bea18b0937385 (diff) |
Remove redundant #ifdef's from benchmarks
Preprocessor directives that refer to QT_VERSION's less than Qt 5 are
redundant in the qt5 modules.
Change-Id: Id3a9c5f0ba07b72d1c99e51c12a240570bf0d58e
Reviewed-by: Rohan McGovern
Diffstat (limited to 'tests/benchmarks/gui/painting/qtbench')
-rw-r--r-- | tests/benchmarks/gui/painting/qtbench/benchmarktests.h | 30 | ||||
-rw-r--r-- | tests/benchmarks/gui/painting/qtbench/tst_qtbench.cpp | 2 |
2 files changed, 3 insertions, 29 deletions
diff --git a/tests/benchmarks/gui/painting/qtbench/benchmarktests.h b/tests/benchmarks/gui/painting/qtbench/benchmarktests.h index f5bc717cfb..c20cbfaef1 100644 --- a/tests/benchmarks/gui/painting/qtbench/benchmarktests.h +++ b/tests/benchmarks/gui/painting/qtbench/benchmarktests.h @@ -48,10 +48,7 @@ #include <QTextLayout> #include <QFontMetrics> #include <QDebug> - -#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0) -# include <QStaticText> -#endif +#include <QStaticText> class Benchmark { @@ -472,13 +469,10 @@ public: PainterQPointMode, LayoutMode, DocumentMode, - PixmapMode - -#if QT_VERSION >= 0x040700 - , StaticTextMode, + PixmapMode, + StaticTextMode, StaticTextWithMaximumSizeMode, StaticTextBackendOptimizations -#endif }; DrawText(const QString &text, Mode mode) @@ -487,12 +481,8 @@ public: } virtual void begin(QPainter *p, int iterations) { -#if QT_VERSION >= 0x040700 m_staticTexts.clear(); m_currentStaticText = 0; -#else - Q_UNUSED(iterations); -#endif m_pixmaps.clear(); m_currentPixmap = 0; QRect m_bounds = QRect(0,0,p->device()->width(), p->device()->height()); @@ -536,7 +526,6 @@ public: m_size = m_layout.boundingRect().toRect().size(); break; } -#if QT_VERSION >= 0x040700 case StaticTextWithMaximumSizeMode: { QStaticText staticText; m_size = (p->boundingRect(m_bounds, 0, m_text)).size(); @@ -570,8 +559,6 @@ public: break; } -#endif - case PainterQPointMode: { QFontMetrics fm(p->font()); m_size = QSize(fm.width(m_text, m_text.length()), fm.height()); @@ -602,8 +589,6 @@ public: case LayoutMode: m_layout.draw(p, rect.topLeft()); break; - -#if QT_VERSION >= 0x040700 case StaticTextWithMaximumSizeMode: case StaticTextMode: p->drawStaticText(rect.topLeft(), m_staticTexts.at(0)); @@ -612,7 +597,6 @@ public: p->drawStaticText(rect.topLeft(), m_staticTexts.at(m_currentStaticText)); m_currentStaticText = (m_currentStaticText + 1) % m_staticTexts.size(); break; -#endif } } @@ -628,12 +612,9 @@ public: case LayoutMode: type = "layout.draw()"; break; case DocumentMode: type = "doc.drawContents()"; break; case PixmapMode: type = "pixmap cached text"; break; - -#if QT_VERSION >= 0x040700 case StaticTextMode: type = "drawStaticText()"; break; case StaticTextWithMaximumSizeMode: type = "drawStaticText() w/ maxsize"; break; case StaticTextBackendOptimizations: type = "drawStaticText() w/ backend optimizations"; break; -#endif } return QString::fromLatin1("%3, len=%1, lines=%2") @@ -651,15 +632,10 @@ private: QList<QPixmap> m_pixmaps; int m_currentPixmap; -#if QT_VERSION >= 0x040700 int m_currentStaticText; QList<QStaticText> m_staticTexts; -#endif }; - - - class ClippedDrawRectBenchmark : public Benchmark { public: diff --git a/tests/benchmarks/gui/painting/qtbench/tst_qtbench.cpp b/tests/benchmarks/gui/painting/qtbench/tst_qtbench.cpp index d8082cc2e0..a61610786f 100644 --- a/tests/benchmarks/gui/painting/qtbench/tst_qtbench.cpp +++ b/tests/benchmarks/gui/painting/qtbench/tst_qtbench.cpp @@ -213,7 +213,6 @@ void tst_QtBench::qtBench_data() benchmarks << (new DrawText(longString, DrawText::PixmapMode)); benchmarks << (new DrawText(superLongString, DrawText::PixmapMode)); -#if QT_VERSION >= 0x040700 benchmarks << (new DrawText(shortString, DrawText::StaticTextMode)); benchmarks << (new DrawText(middleString, DrawText::StaticTextMode)); benchmarks << (new DrawText(longString, DrawText::StaticTextMode)); @@ -228,7 +227,6 @@ void tst_QtBench::qtBench_data() benchmarks << (new DrawText(middleString, DrawText::StaticTextBackendOptimizations)); benchmarks << (new DrawText(longString, DrawText::StaticTextBackendOptimizations)); benchmarks << (new DrawText(superLongString, DrawText::StaticTextBackendOptimizations)); -#endif foreach (Benchmark *benchmark, benchmarks) QTest::newRow(qPrintable(benchmark->name())) << reinterpret_cast<void *>(benchmark); |