summaryrefslogtreecommitdiffstats
path: root/tests/auto/printsupport/kernel
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2017-08-21 15:54:24 +0200
committerAndy Shaw <andy.shaw@qt.io>2017-08-23 08:07:37 +0000
commitc1cd8df84ea1180536509d3caa2c1fe802b188ab (patch)
treea37bde1b9d8ca3a216fa7927eafe7d0a8d563cbb /tests/auto/printsupport/kernel
parent82e7bd689ace5e07e195db6514cec85ff9bc7688 (diff)
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>
Diffstat (limited to 'tests/auto/printsupport/kernel')
-rw-r--r--tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp12
1 files changed, 11 insertions, 1 deletions
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