summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorCorentin Jabot <corentinjabot@gmail.com>2013-02-17 14:05:57 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-03-05 18:39:35 +0100
commit866a5d0c28f458d50ab9e4f011fc7a94822ce6eb (patch)
tree7175b57b18498c49c40ebccd3b573c0065615433 /tests
parent27597618244f6baf7a86fec2459f20ca6dd1edf6 (diff)
Make QProcess startable with open()
Add setProgram() and setArguments() methods to the QProcess api. Add a convenient start(QIODevice::OpenMode) method. Move the implementation of QProcess::start() to QProcess::open() unifying the QProcess api with other QIODevice subclasses. Change-Id: Id1af57da05f750fe8d526d391589c05ee8037bca Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/io/qprocess/tst_qprocess.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
index 11824f4ab6..f01e319872 100644
--- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
+++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
@@ -81,6 +81,7 @@ private slots:
void getSetCheck();
void constructing();
void simpleStart();
+ void startWithOpen();
void execute();
void startDetached();
void crashTest();
@@ -283,6 +284,25 @@ void tst_QProcess::simpleStart()
QCOMPARE(qvariant_cast<QProcess::ProcessState>(spy.at(1).at(0)), QProcess::Running);
QCOMPARE(qvariant_cast<QProcess::ProcessState>(spy.at(2).at(0)), QProcess::NotRunning);
}
+
+//-----------------------------------------------------------------------------
+void tst_QProcess::startWithOpen()
+{
+ QProcess p;
+ QTest::ignoreMessage(QtWarningMsg, "QProcess::start: program not set");
+ QCOMPARE(p.open(QIODevice::ReadOnly), false);
+
+ p.setProgram("testProcessNormal/testProcessNormal");
+ QCOMPARE(p.program(), QString("testProcessNormal/testProcessNormal"));
+
+ p.setArguments(QStringList() << "arg1" << "arg2");
+ QCOMPARE(p.arguments().size(), 2);
+
+ QVERIFY(p.open(QIODevice::ReadOnly));
+ QCOMPARE(p.openMode(), QIODevice::ReadOnly);
+ QVERIFY(p.waitForFinished(5000));
+}
+
//-----------------------------------------------------------------------------
void tst_QProcess::execute()
{