tst_QTextLayout: compile with QT_NO_FOREACH

The container is local, and it's not changed in the loop body; port to
ranged-for and use std::as_const.

Task-number: QTBUG-115839
Change-Id: If4d46f55e7aae8c87f6d7b3c4e78da7e51e128c0
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
Ahmad Samir 2023-08-14 03:16:20 +03:00
parent 56d2a65a33
commit 25fcb413cf

View File

@ -1,8 +1,6 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses
/*
!!!!!! Warning !!!!!
Please don't save this file in emacs. It contains utf8 text sequences emacs will
@ -2466,7 +2464,7 @@ void tst_QTextLayout::superscriptCrash_qtbug53911()
}
// This loop would crash before fix for QTBUG-53911
foreach (QTextLayout *textLayout, textLayouts) {
for (QTextLayout *textLayout : std::as_const(textLayouts)) {
textLayout->beginLayout();
while (textLayout->createLine().isValid());
textLayout->endLayout();