From c1cd8df84ea1180536509d3caa2c1fe802b188ab Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 21 Aug 2017 15:54:24 +0200 Subject: 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 --- .../printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'tests/auto/printsupport') diff --git a/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp b/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp index c20fafe158..92a06cda00 100644 --- a/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp +++ b/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp @@ -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 -- cgit v1.2.3