summaryrefslogtreecommitdiffstats
path: root/tests/auto/qlocale/tst_qlocale.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2009-08-03 11:33:34 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2009-08-03 11:33:34 (GMT)
commit5e05bafa229b645bf30a90975bfc57e458e081e5 (patch)
tree54606401f955891574cbcc589ae2558cb2a5b748 /tests/auto/qlocale/tst_qlocale.cpp
parent128717b171f01c82e5f0fb83f5923d4f7b9cfc10 (diff)
parent463df7e4a6dc7c11716e27ca5de9ebeb61940990 (diff)
downloadQt-5e05bafa229b645bf30a90975bfc57e458e081e5.zip
Qt-5e05bafa229b645bf30a90975bfc57e458e081e5.tar.gz
Qt-5e05bafa229b645bf30a90975bfc57e458e081e5.tar.bz2
Merge branch '4.5'
Conflicts: src/corelib/tools/qsharedpointer.cpp src/corelib/tools/qsharedpointer_impl.h src/gui/dialogs/qcolordialog.cpp src/gui/painting/qwindowsurface_raster.cpp src/network/access/qnetworkaccessmanager.cpp tests/auto/qsharedpointer/externaltests.cpp
Diffstat (limited to 'tests/auto/qlocale/tst_qlocale.cpp')
-rw-r--r--tests/auto/qlocale/tst_qlocale.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/tests/auto/qlocale/tst_qlocale.cpp b/tests/auto/qlocale/tst_qlocale.cpp
index 9ef7f1d..9a5c549 100644
--- a/tests/auto/qlocale/tst_qlocale.cpp
+++ b/tests/auto/qlocale/tst_qlocale.cpp
@@ -327,9 +327,8 @@ void tst_QLocale::emptyCtor()
{ \
/* Test constructor without arguments. Needs separate process */ \
/* because of caching of the system locale. */ \
- QString oldEnv = QString::fromLocal8Bit(qgetenv("LANG")); \
- qputenv("LANG", QString(req_lc).toLocal8Bit()); \
QProcess process; \
+ process.setEnvironment(QStringList(env) << QString("LANG=%1").arg(req_lc)); \
process.start("syslocaleapp/syslocaleapp"); \
process.waitForReadyRead(); \
QString ret = QString(process.readAll()); \
@@ -337,18 +336,23 @@ void tst_QLocale::emptyCtor()
QVERIFY2(!ret.isEmpty(), "Cannot launch external process"); \
QVERIFY2(QString(exp_str) == ret, QString("Expected: " + QString(exp_str) + ", got: " \
+ ret + ". Requested: " + QString(req_lc)).toLatin1().constData()); \
- qputenv("LANG", oldEnv.toLocal8Bit()); \
+ }
+
+ // Get an environment free of any locale-related variables
+ QStringList env;
+ foreach (QString const& entry, QProcess::systemEnvironment()) {
+ if (entry.startsWith("LANG=") || entry.startsWith("LC_"))
+ continue;
+ env << entry;
}
// Get default locale.
- QString old = QString::fromLocal8Bit(qgetenv("LANG"));
- qputenv("LANG", "");
QProcess p;
+ p.setEnvironment(env);
p.start("syslocaleapp/syslocaleapp");
p.waitForReadyRead();
QString defaultLoc = QString(p.readAll());
p.waitForFinished();
- qputenv("LANG", old.toLocal8Bit());
TEST_CTOR("C", "C")
TEST_CTOR("bla", "C")