summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib')
-rw-r--r--tests/auto/corelib/io/qprocess/testForwarding/main.cpp9
-rw-r--r--tests/auto/corelib/io/qprocess/tst_qprocess.cpp17
2 files changed, 19 insertions, 7 deletions
diff --git a/tests/auto/corelib/io/qprocess/testForwarding/main.cpp b/tests/auto/corelib/io/qprocess/testForwarding/main.cpp
index deff2b95ad..42394f6414 100644
--- a/tests/auto/corelib/io/qprocess/testForwarding/main.cpp
+++ b/tests/auto/corelib/io/qprocess/testForwarding/main.cpp
@@ -48,7 +48,7 @@ int main(int argc, char **argv)
{
QCoreApplication app(argc, argv);
- if (argc < 2)
+ if (argc < 3)
return 13;
#ifndef QT_NO_PROCESS
@@ -59,12 +59,17 @@ int main(int argc, char **argv)
if (process.processChannelMode() != mode)
return 1;
+ QProcess::InputChannelMode inmode = (QProcess::InputChannelMode)atoi(argv[2]);
+ process.setInputChannelMode(inmode);
+ if (process.inputChannelMode() != inmode)
+ return 11;
+
process.start("testProcessEcho2/testProcessEcho2");
if (!process.waitForStarted(5000))
return 2;
- if (process.write("forwarded") != 9)
+ if (inmode == QProcess::ManagedInputChannel && process.write("forwarded") != 9)
return 3;
process.closeWriteChannel();
diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
index e03c1fb75e..d248f022ed 100644
--- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
+++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
@@ -1094,33 +1094,40 @@ void tst_QProcess::mergedChannels()
void tst_QProcess::forwardedChannels_data()
{
QTest::addColumn<int>("mode");
+ QTest::addColumn<int>("inmode");
QTest::addColumn<QByteArray>("outdata");
QTest::addColumn<QByteArray>("errdata");
- QTest::newRow("separate") << int(QProcess::SeparateChannels)
+ QTest::newRow("separate") << int(QProcess::SeparateChannels) << int(QProcess::ManagedInputChannel)
<< QByteArray() << QByteArray();
- QTest::newRow("forwarded") << int(QProcess::ForwardedChannels)
+ QTest::newRow("forwarded") << int(QProcess::ForwardedChannels) << int(QProcess::ManagedInputChannel)
<< QByteArray("forwarded") << QByteArray("forwarded");
- QTest::newRow("stdout") << int(QProcess::ForwardedOutputChannel)
+ QTest::newRow("stdout") << int(QProcess::ForwardedOutputChannel) << int(QProcess::ManagedInputChannel)
<< QByteArray("forwarded") << QByteArray();
- QTest::newRow("stderr") << int(QProcess::ForwardedErrorChannel)
+ QTest::newRow("stderr") << int(QProcess::ForwardedErrorChannel) << int(QProcess::ManagedInputChannel)
<< QByteArray() << QByteArray("forwarded");
+ QTest::newRow("fwdinput") << int(QProcess::ForwardedErrorChannel) << int(QProcess::ForwardedInputChannel)
+ << QByteArray() << QByteArray("input");
}
void tst_QProcess::forwardedChannels()
{
QFETCH(int, mode);
+ QFETCH(int, inmode);
QFETCH(QByteArray, outdata);
QFETCH(QByteArray, errdata);
QProcess process;
- process.start("testForwarding/testForwarding", QStringList() << QString::number(mode));
+ process.start("testForwarding/testForwarding", QStringList() << QString::number(mode) << QString::number(inmode));
QVERIFY(process.waitForStarted(5000));
+ QCOMPARE(process.write("input"), 5);
+ process.closeWriteChannel();
QVERIFY(process.waitForFinished(5000));
const char *err;
switch (process.exitCode()) {
case 0: err = "ok"; break;
case 1: err = "processChannelMode is wrong"; break;
+ case 11: err = "inputChannelMode is wrong"; break;
case 2: err = "failed to start"; break;
case 3: err = "failed to write"; break;
case 4: err = "did not finish"; break;