diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2019-07-11 09:54:15 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2019-07-11 09:15:13 +0000 |
commit | 940306f134ded0a323821526d09f12670495b29c (patch) | |
tree | bacd1bfdcb689810739f3b2eb0fc1402d38434d1 /tests/auto/unit/qpaintervideosurface | |
parent | 962371cbe3f01f3c30991522de1d03c8dfd77164 (diff) |
Eradicate all but one Q_FOREACH loop
Q_FOREACH is going to be deprecated, or at the very least banned from
use in Qt code.
All these are trivial in the sense that the loop body clearly doesn't
modify the container over which we iterate, and that the container is
const, or trivially marked as such.
In one case, replaced Q_FOREACH + delete + clear() with
qDeleteAll(qExchange()), in three others, replaced Qt containers with
statically-known content with plain C arrays.
Change-Id: I718821811370f0cfefac3893283572d39a7d957d
Reviewed-by: VaL Doroshchuk <valentyn.doroshchuk@qt.io>
Diffstat (limited to 'tests/auto/unit/qpaintervideosurface')
-rw-r--r-- | tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp b/tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp index 43dc52022..7ba631e58 100644 --- a/tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp +++ b/tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp @@ -730,16 +730,14 @@ void tst_QPainterVideoSurface::shaderSupportedFormat_data() QTest::addColumn<bool>("supportedPixelFormat"); QTest::addColumn<bool>("supportedFormat"); - QList<QPair<QPainterVideoSurface::ShaderType, QByteArray> > types; - - + const QPair<QPainterVideoSurface::ShaderType, QByteArray> types[] = { #if !defined(QT_OPENGL_ES) - types << qMakePair(QPainterVideoSurface::FragmentProgramShader, QByteArray("ARBfp: ")); + qMakePair(QPainterVideoSurface::FragmentProgramShader, QByteArray("ARBfp: ")), #endif - types << qMakePair(QPainterVideoSurface::GlslShader, QByteArray("GLSL: ")); + qMakePair(QPainterVideoSurface::GlslShader, QByteArray("GLSL: ")), + }; - QPair<QPainterVideoSurface::ShaderType, QByteArray> type; - foreach (type, types) { + for (const auto &type : types) { QTest::newRow((type.second + "rgb32 640x480").constData()) << type.first << QAbstractVideoBuffer::NoHandle @@ -952,14 +950,14 @@ void tst_QPainterVideoSurface::shaderPresent_data() QTest::addColumn<int>("bytesB"); QTest::addColumn<int>("bytesPerLineB"); - QList<QPair<QPainterVideoSurface::ShaderType, QByteArray> > types; + const QPair<QPainterVideoSurface::ShaderType, QByteArray> types[] = { #if !defined(QT_OPENGL_ES) - types << qMakePair(QPainterVideoSurface::FragmentProgramShader, QByteArray("ARBfp: ")); + qMakePair(QPainterVideoSurface::FragmentProgramShader, QByteArray("ARBfp: ")), #endif - types << qMakePair(QPainterVideoSurface::GlslShader, QByteArray("GLSL: ")); + qMakePair(QPainterVideoSurface::GlslShader, QByteArray("GLSL: ")), + }; - QPair<QPainterVideoSurface::ShaderType, QByteArray> type; - foreach (type, types) { + for (const auto &type : types) { QTest::newRow((type.second + "rgb32 -> argb32").constData()) << type.first << QVideoFrame::Format_RGB32 |