diff options
Diffstat (limited to 'tests/auto/printsupport/kernel/qprintdevice')
-rw-r--r-- | tests/auto/printsupport/kernel/qprintdevice/CMakeLists.txt | 6 | ||||
-rw-r--r-- | tests/auto/printsupport/kernel/qprintdevice/tst_qprintdevice.cpp | 9 |
2 files changed, 11 insertions, 4 deletions
diff --git a/tests/auto/printsupport/kernel/qprintdevice/CMakeLists.txt b/tests/auto/printsupport/kernel/qprintdevice/CMakeLists.txt index 1ac8a5cb6c..3df4d6e135 100644 --- a/tests/auto/printsupport/kernel/qprintdevice/CMakeLists.txt +++ b/tests/auto/printsupport/kernel/qprintdevice/CMakeLists.txt @@ -5,6 +5,12 @@ ## tst_qprintdevice Test: ##################################################################### +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_qprintdevice LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + qt_internal_add_test(tst_qprintdevice SOURCES tst_qprintdevice.cpp diff --git a/tests/auto/printsupport/kernel/qprintdevice/tst_qprintdevice.cpp b/tests/auto/printsupport/kernel/qprintdevice/tst_qprintdevice.cpp index a496b5bfb9..81b50c1084 100644 --- a/tests/auto/printsupport/kernel/qprintdevice/tst_qprintdevice.cpp +++ b/tests/auto/printsupport/kernel/qprintdevice/tst_qprintdevice.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2014 John Layt <jlayt@kde.org> -// 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> #include <QMimeType> @@ -25,16 +25,17 @@ void tst_QPrintDevice::basics() QSKIP("Could not load platform plugin"); QString defaultId = ps->defaultPrintDeviceId(); + const QStringList availableIds = ps->availablePrintDeviceIds(); if (defaultId.isEmpty()) { qDebug() << "No default printer found"; } else { - QVERIFY(ps->availablePrintDeviceIds().contains(defaultId)); + QVERIFY(availableIds.contains(defaultId)); } - qDebug() << "Available Printer IDs :" << ps->availablePrintDeviceIds(); + qDebug() << "Available Printer IDs :" << availableIds; // Just exercise the api for now as we don't know what is installed - foreach (const QString id, ps->availablePrintDeviceIds()) { + for (const QString &id : availableIds) { QPrintDevice printDevice = ps->createPrintDevice(id); const char quote = id == defaultId ? '*' : '"'; qDebug().noquote().nospace() << "\nCreated printer " << quote << id |