diff options
author | axis <qt-info@nokia.com> | 2009-08-21 13:23:42 (GMT) |
---|---|---|
committer | axis <qt-info@nokia.com> | 2009-08-21 13:23:42 (GMT) |
commit | 044680951401487590c0ed554092dd9b7e0ee783 (patch) | |
tree | ed2492ad2fd49481148fdd7a1486cbf197c9bfe7 /tests/auto/qprocess/tst_qprocess.cpp | |
parent | ab1df6dea670a60bfef5efd81d6687f9534cfc5d (diff) | |
parent | 00ba962d428dcdff70fcde74a9e5cb316545cef6 (diff) | |
download | Qt-044680951401487590c0ed554092dd9b7e0ee783.zip Qt-044680951401487590c0ed554092dd9b7e0ee783.tar.gz Qt-044680951401487590c0ed554092dd9b7e0ee783.tar.bz2 |
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt
Conflicts:
src/corelib/io/qprocess.h
Diffstat (limited to 'tests/auto/qprocess/tst_qprocess.cpp')
-rw-r--r-- | tests/auto/qprocess/tst_qprocess.cpp | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/tests/auto/qprocess/tst_qprocess.cpp b/tests/auto/qprocess/tst_qprocess.cpp index 368b2a0..9ea5e99 100644 --- a/tests/auto/qprocess/tst_qprocess.cpp +++ b/tests/auto/qprocess/tst_qprocess.cpp @@ -134,6 +134,8 @@ private slots: void exitCodeTest(); void setEnvironment_data(); void setEnvironment(); + void setProcessEnvironment_data(); + void setProcessEnvironment(); void systemEnvironment(); void spaceInName(); void lockupsInStartDetached(); @@ -1872,16 +1874,39 @@ void tst_QProcess::setEnvironment() QCOMPARE(process.readAll(), value.toLocal8Bit()); } +#endif +} + +//----------------------------------------------------------------------------- +void tst_QProcess::setProcessEnvironment_data() +{ + setEnvironment_data(); +} + +void tst_QProcess::setProcessEnvironment() +{ +#if !defined (Q_OS_WINCE) + // there is no concept of system variables on Windows CE as there is no console + + // make sure our environment variables are correct + QVERIFY(qgetenv("tst_QProcess").isEmpty()); + QVERIFY(!qgetenv("PATH").isEmpty()); +#ifdef Q_OS_WIN + QVERIFY(!qgetenv("PROMPT").isEmpty()); +#endif + + QFETCH(QString, name); + QFETCH(QString, value); + QString executable = QDir::currentPath() + "/testProcessEnvironment/testProcessEnvironment"; - // use the hash variant now { QProcess process; - QHash<QString, QString> environment = QProcess::systemEnvironmentHash(); + QProcessEnvironment environment = QProcessEnvironment::systemEnvironment(); if (value.isNull()) environment.remove(name); else environment.insert(name, value); - process.setEnvironmentHash(environment); + process.setProcessEnvironment(environment); process.start(executable, QStringList() << name); QVERIFY(process.waitForFinished()); @@ -1899,12 +1924,12 @@ void tst_QProcess::systemEnvironment() #if defined (Q_OS_WINCE) || defined(Q_OS_SYMBIAN) // there is no concept of system variables on Windows CE as there is no console QVERIFY(QProcess::systemEnvironment().isEmpty()); - QVERIFY(QProcess::systemEnvironmentHash().isEmpty()); + QVERIFY(QProcessEnvironment::systemEnvironment().isEmpty()); #else QVERIFY(!QProcess::systemEnvironment().isEmpty()); - QVERIFY(!QProcess::systemEnvironmentHash().isEmpty()); + QVERIFY(!QProcessEnvironment::systemEnvironment().isEmpty()); - QVERIFY(QProcess::systemEnvironmentHash().contains("PATH")); + QVERIFY(QProcessEnvironment::systemEnvironment().contains("PATH")); QVERIFY(!QProcess::systemEnvironment().filter(QRegExp("^PATH=", Qt::CaseInsensitive)).isEmpty()); #endif } |