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>
bb10
Andreas Buhr 2020-11-20 13:55:31 +01:00
parent 45a65cbeb2
commit 146a2a21b1
1 changed files with 2 additions and 4 deletions

View File

@ -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]);