summaryrefslogtreecommitdiffstats
path: root/tests/auto/printsupport/kernel/qprinterinfo
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/printsupport/kernel/qprinterinfo')
-rw-r--r--tests/auto/printsupport/kernel/qprinterinfo/CMakeLists.txt11
-rw-r--r--tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp16
2 files changed, 19 insertions, 8 deletions
diff --git a/tests/auto/printsupport/kernel/qprinterinfo/CMakeLists.txt b/tests/auto/printsupport/kernel/qprinterinfo/CMakeLists.txt
index 18a093c4e3..84d0de4d5e 100644
--- a/tests/auto/printsupport/kernel/qprinterinfo/CMakeLists.txt
+++ b/tests/auto/printsupport/kernel/qprinterinfo/CMakeLists.txt
@@ -1,15 +1,22 @@
-# Generated from qprinterinfo.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_qprinterinfo Test:
#####################################################################
+if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_qprinterinfo LANGUAGES CXX)
+ find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
+endif()
+
qt_internal_add_test(tst_qprinterinfo
SOURCES
tst_qprinterinfo.cpp
DEFINES
QT_USE_USING_NAMESPACE
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::Gui
Qt::PrintSupport
)
diff --git a/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp b/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp
index 15af4c899b..110f2996fd 100644
--- a/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp
+++ b/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.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>
#include <QtGlobal>
@@ -8,7 +8,7 @@
#include <algorithm>
-#if defined(Q_OS_UNIX) && !defined(Q_OS_INTEGRITY)
+#if defined(Q_OS_UNIX) && !defined(Q_OS_INTEGRITY) && !defined(Q_OS_VXWORKS)
# include <unistd.h>
# include <sys/types.h>
# include <sys/wait.h>
@@ -49,6 +49,10 @@ private:
#ifdef QT_NO_PRINTER
void tst_QPrinterInfo::initTestCase()
{
+#ifdef Q_OS_ANDROID
+ if (QNativeInterface::QAndroidApplication::sdkVersion() == 33)
+ QSKIP("Is flaky on Android 13 / RHEL 8.6 and 8.8 (QTQAINFRA-5606)");
+#endif
QSKIP("This test requires printing support");
}
@@ -94,7 +98,7 @@ QStringList tst_QPrinterInfo::getPrintersFromSystem()
QString output = getOutputFromCommand({ "lpstat", "-e" });
QStringList list = output.split(QChar::fromLatin1('\n'));
- QRegularExpression reg("^([.a-zA-Z0-9-_@]+)");
+ QRegularExpression reg("^([.a-zA-Z0-9-_@/]+)");
QRegularExpressionMatch match;
for (int c = 0; c < list.size(); ++c) {
match = reg.match(list[c]);
@@ -174,7 +178,7 @@ QString tst_QPrinterInfo::getOutputFromCommand(const QStringList &command)
{
// Forces the ouptut from the command to be in English
const QByteArray origSoftwareEnv = qgetenv("SOFTWARE");
- qputenv("SOFTWARE", QByteArray());
+ qputenv("SOFTWARE", nullptr);
QString output = getOutputFromCommandInternal(command);
qputenv("SOFTWARE", origSoftwareEnv);
return output;
@@ -336,11 +340,11 @@ void tst_QPrinterInfo::testAssignment()
void tst_QPrinterInfo::namedPrinter()
{
- QList<QPrinterInfo> printers = QPrinterInfo::availablePrinters();
+ const QList<QPrinterInfo> printers = QPrinterInfo::availablePrinters();
QStringList printerNames;
- foreach (const QPrinterInfo &pi, printers) {
+ for (const QPrinterInfo &pi : printers) {
QPrinterInfo pi2 = QPrinterInfo::printerInfo(pi.printerName());
QCOMPARE(pi2.printerName(), pi.printerName());
QCOMPARE(pi2.description(), pi.description());