summaryrefslogtreecommitdiffstats
path: root/tests/auto/printsupport/kernel
diff options
context:
space:
mode:
authorAndreas Buhr <andreas.buhr@qt.io>2020-11-20 13:55:31 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2020-11-21 15:57:21 +0000
commit33f85891dc6c8b547f1564d97825d9fd707273bd (patch)
tree6f2341ffbc627761c4cace7d0d3e7ff65de0477f /tests/auto/printsupport/kernel
parent628ce898fa609e98db057472280b6ff3369669b9 (diff)
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. Change-Id: Ia70adad8b8467f4c738f769d34757786fc9645b2 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 146a2a21b1fd279e3f26690243db30fba89f9027) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests/auto/printsupport/kernel')
-rw-r--r--tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp6
1 files changed, 2 insertions, 4 deletions
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]);