summaryrefslogtreecommitdiffstats
path: root/tests/auto/printsupport/kernel/qprinterinfo
diff options
context:
space:
mode:
authorAndreas Buhr <andreas.buhr@qt.io>2020-11-20 13:55:31 +0100
committerAndreas Buhr <andreas.buhr@qt.io>2020-11-21 06:11:37 +0100
commit146a2a21b1fd279e3f26690243db30fba89f9027 (patch)
tree8974ba8cdf315ce8a7043220537a58b1931f58ed /tests/auto/printsupport/kernel/qprinterinfo
parent45a65cbeb2775da71d4e7b417b45d54341a3ee7f (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. Pick-to: 6.0 Change-Id: Ia70adad8b8467f4c738f769d34757786fc9645b2 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'tests/auto/printsupport/kernel/qprinterinfo')
-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]);