From 146a2a21b1fd279e3f26690243db30fba89f9027 Mon Sep 17 00:00:00 2001 From: Andreas Buhr Date: Fri, 20 Nov 2020 13:55:31 +0100 Subject: Fit tst_qprinterinfo in case there are printers in local network tst_qprinterinfo compared the output of "lpstat -p" with the result of a call to "cupsGetDests". "lpstat -p" only returns local printers, "cupsGetDests" also returns printers on the local network. This patch fixes the test by using "lpstat -e", which also shows printers on the local network. Pick-to: 6.0 Change-Id: Ia70adad8b8467f4c738f769d34757786fc9645b2 Reviewed-by: Friedemann Kleint --- tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'tests/auto/printsupport/kernel/qprinterinfo') diff --git a/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp b/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp index efd9e77455..eb9772f5d3 100644 --- a/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp +++ b/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp @@ -115,12 +115,10 @@ QStringList tst_QPrinterInfo::getPrintersFromSystem() // TODO "cscript c:\windows\system32\prnmngr.vbs -l" #endif // Q_OS_WIN32 #ifdef Q_OS_UNIX - QStringList command; - command << "lpstat" << "-p"; - QString output = getOutputFromCommand(command); + QString output = getOutputFromCommand({ "lpstat", "-e" }); QStringList list = output.split(QChar::fromLatin1('\n')); - QRegularExpression reg("^[Pp]rinter ([.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]); -- cgit v1.2.3