summaryrefslogtreecommitdiffstats
path: root/tests/auto/printsupport/kernel/qprintdevice
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/printsupport/kernel/qprintdevice')
-rw-r--r--tests/auto/printsupport/kernel/qprintdevice/CMakeLists.txt11
-rw-r--r--tests/auto/printsupport/kernel/qprintdevice/tst_qprintdevice.cpp9
2 files changed, 14 insertions, 6 deletions
diff --git a/tests/auto/printsupport/kernel/qprintdevice/CMakeLists.txt b/tests/auto/printsupport/kernel/qprintdevice/CMakeLists.txt
index 8cdd82068e..3df4d6e135 100644
--- a/tests/auto/printsupport/kernel/qprintdevice/CMakeLists.txt
+++ b/tests/auto/printsupport/kernel/qprintdevice/CMakeLists.txt
@@ -1,15 +1,22 @@
-# Generated from qprintdevice.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## 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
DEFINES
QT_USE_USING_NAMESPACE
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::PrintSupportPrivate
)
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