tst_QImage: replace QList with constexpr array

"Never use a dynamically-sized container for statically-sized data."

Port the loop from Q_FOREACH (which can't deal with arrays) to ranged
for (which can).

Pick-to: 6.6 6.5
Task-number: QTBUG-115839
Change-Id: I40773a0397b83cce0c803967ee3fd7ae274933d3
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
This commit is contained in:
Marc Mutz 2023-08-08 07:37:03 +02:00
parent 29f911ab92
commit 11c2a5b477

View File

@ -1133,10 +1133,9 @@ void tst_QImage::rotate_data()
QTest::addColumn<QImage::Format>("format");
QTest::addColumn<int>("degrees");
QList<int> degrees;
degrees << 0 << 90 << 180 << 270;
constexpr int degrees[] = {0, 90, 180, 270};
foreach (int d, degrees) {
for (int d : degrees) {
const QString dB = QString::number(d);
for (int i = QImage::Format_Indexed8; i < QImage::NImageFormats; i++) {
QImage::Format format = static_cast<QImage::Format>(i);