Fix the test for non-English based setups

Unsetting the SOFTWARE environment variable will force lpstat to use
English for the output, so we can ensure that the test will pass
regardless of the language used for the machine.

Change-Id: Iddf5e8aadaa546ae3e0dd172df84e4e43ee02c2a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
Andy Shaw 2017-08-21 15:54:24 +02:00
parent 82e7bd689a
commit c1cd8df84e

View File

@ -136,7 +136,7 @@ QStringList tst_QPrinterInfo::getPrintersFromSystem()
#ifdef Q_OS_UNIX
// This function does roughly the same as the `command substitution` in
// the shell.
QString tst_QPrinterInfo::getOutputFromCommand(const QStringList& command)
QString getOutputFromCommandInternal(const QStringList &command)
{
// The command execution does nothing on non-unix systems.
int pid;
@ -194,6 +194,16 @@ QString tst_QPrinterInfo::getOutputFromCommand(const QStringList& command)
return QString(array);
}
}
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());
QString output = getOutputFromCommandInternal(command);
qputenv("SOFTWARE", origSoftwareEnv);
return output;
}
#endif
// Windows test support not yet implemented