summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/dialogs
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2023-08-05 10:43:43 +0200
committerAhmad Samir <a.samirh78@gmail.com>2023-08-14 23:11:54 +0300
commit40afcb9d01713c02737f6f83a59437fc8320ef0b (patch)
tree531e6f9a1c07b34179f631606a612d6712cdd979 /tests/auto/widgets/dialogs
parent6f5f10bea80eb9439a1498e7a19d8631fc791ed3 (diff)
QtWidgets tests: port remaining users away from Q_FOREACH
These are all trivial: all are over (already or newly-made) const local variables. As a drive-by, replace a QList legacy left-shift-based- with initializer_list-construction. Pick-to: 6.6 6.5 Task-number: QTBUG-115803 Change-Id: I453e24272c4c4b7dce5b91a0bd04481d833c50bb Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Diffstat (limited to 'tests/auto/widgets/dialogs')
-rw-r--r--tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
index a7d4992c07..3af657744e 100644
--- a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
+++ b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
@@ -565,9 +565,9 @@ void tst_QWizard::addPage()
#define CHECK_VISITED(wizard, list) \
do { \
- QList<int> myList = list; \
+ const QList<int> myList = list; \
QCOMPARE((wizard).visitedIds(), myList); \
- Q_FOREACH(int id, myList) \
+ for (int id : myList) \
QVERIFY((wizard).hasVisitedPage(id)); \
} while (0)
@@ -1837,7 +1837,8 @@ public:
#define OPT(option, on) OptionInfo::instance().operation(option, on)
#define CLROPT(option) OPT(option, false)
#define SETOPT(option) OPT(option, true)
- foreach (QWizard::WizardOption option, OptionInfo::instance().options()) {
+ const auto options = OptionInfo::instance().options();
+ for (QWizard::WizardOption option : options) {
setAllOptions[false] << CLROPT(option);
setAllOptions[true] << SETOPT(option);
}
@@ -1924,7 +1925,8 @@ public:
testGroup.add() << pageOp << optionOps;
testGroup.createTestRows();
- foreach (QWizard::WizardOption option, OptionInfo::instance().options()) {
+ const auto options = OptionInfo::instance().options();
+ for (QWizard::WizardOption option : options) {
QSharedPointer<Operation> optionOp = OPT(option, i == 1);
testGroup.reset("testAll 4.3");
testGroup.add() << optionOp << pageOp;
@@ -1947,7 +1949,8 @@ public:
testGroup.add() << styleOp << optionOps;
testGroup.createTestRows();
- foreach (QWizard::WizardOption option, OptionInfo::instance().options()) {
+ const auto options = OptionInfo::instance().options();
+ for (QWizard::WizardOption option : options) {
QSharedPointer<Operation> optionOp = OPT(option, i == 1);
testGroup.reset("testAll 5.3");
testGroup.add() << optionOp << styleOp;
@@ -1986,7 +1989,8 @@ public:
testGroup.add() << styleOp << pageOp << optionOps;
testGroup.createTestRows();
- foreach (QWizard::WizardOption option, OptionInfo::instance().options()) {
+ const auto options = OptionInfo::instance().options();
+ for (QWizard::WizardOption option : options) {
QSharedPointer<Operation> optionOp = OPT(option, i == 1);
testGroup.reset("testAll 6.5");
testGroup.add() << optionOp << pageOp << styleOp;
@@ -2570,7 +2574,8 @@ void tst_QWizard::task161658_alignments()
wizard.show();
QVERIFY(QTest::qWaitForWindowExposed(&wizard));
- foreach (QLabel *subtitleLabel, wizard.findChildren<QLabel *>()) {
+ const auto subtitleLabels = wizard.findChildren<QLabel *>();
+ for (QLabel *subtitleLabel : subtitleLabels) {
if (subtitleLabel->text().startsWith("SUBTITLE#")) {
QCOMPARE(lineEdit1.mapToGlobal(lineEdit1.contentsRect().bottomRight()).x(),
subtitleLabel->mapToGlobal(subtitleLabel->contentsRect().bottomRight()).x());