summaryrefslogtreecommitdiffstats
path: root/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp')
-rw-r--r--tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp
index e4ce742e7c..d2ccf7b990 100644
--- a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp
+++ b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QTest>
@@ -903,7 +903,8 @@ void tst_QPrinter::duplex()
QPrinter::DuplexMode expected = printerInfo.defaultDuplexMode();
QCOMPARE(native.duplex(), expected);
// Test set/get (skipping Auto as that will return something different)
- foreach (QPrinter::DuplexMode mode, printerInfo.supportedDuplexModes()) {
+ const auto supported = printerInfo.supportedDuplexModes();
+ for (QPrinter::DuplexMode mode : supported) {
if (mode != expected && mode != QPrinter::DuplexAuto) {
expected = mode;
break;
@@ -1193,7 +1194,8 @@ void tst_QPrinter::paperSource()
QPrinter::PaperSource expected = QPrinter::Manual;
#ifdef Q_OS_WIN
expected = QPrinter::Auto;
- foreach (QPrinter::PaperSource supported, native.supportedPaperSources()) {
+ const auto sources = native.supportedPaperSources();
+ for (QPrinter::PaperSource supported : sources) {
if (supported != QPrinter::Auto) {
expected = supported;
break;
@@ -1315,7 +1317,8 @@ void tst_QPrinter::printerName()
// Test set/get
QString expected = QPrinterInfo::defaultPrinter().printerName();
- foreach (const QPrinterInfo &available, QPrinterInfo::availablePrinters()) {
+ const auto allAvailable = QPrinterInfo::availablePrinters();
+ for (const QPrinterInfo &available : allAvailable) {
if (available.printerName() != expected) {
expected = available.printerName();
break;
@@ -1408,7 +1411,7 @@ void tst_QPrinter::resolution()
#ifdef Q_OS_MAC
// QMacPrintEngine chooses the closest supported resolution.
const QList<int> all_supported = native.supportedResolutions();
- foreach (int supported, all_supported) {
+ for (int supported : all_supported) {
// Test setting a supported resolution
int requested = supported;
native.setResolution(requested);
@@ -1702,7 +1705,7 @@ void tst_QPrinter::reusePageMetrics()
QPrinter defaultP;
QPrinterInfo info(defaultP);
QString otherPrinterName;
- for (QPrinterInfo i : qAsConst(availablePrinters)) {
+ for (QPrinterInfo i : std::as_const(availablePrinters)) {
if (i.printerName() != defaultP.printerName()) {
otherPrinterName = i.printerName();
break;
@@ -1712,9 +1715,9 @@ void tst_QPrinter::reusePageMetrics()
QList<QPageSize> defaultPageSizes = info.supportedPageSizes();
QList<QPageSize> otherPageSizes = QPrinterInfo(otherP).supportedPageSizes();
QPageSize unavailableSizeToSet;
- for (QPageSize s : qAsConst(defaultPageSizes)) {
+ for (QPageSize s : std::as_const(defaultPageSizes)) {
bool found = false;
- for (QPageSize os : qAsConst(otherPageSizes)) {
+ for (QPageSize os : std::as_const(otherPageSizes)) {
if (os.isEquivalentTo(s)) {
found = true;
break;