diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2018-02-05 14:17:58 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2018-03-20 14:46:52 +0000 |
commit | 1b6792d3040e013acfa9fa5e39418d5b6a648f4b (patch) | |
tree | a6a13bafc10b40f2138d8a3ebebf7e39844be45c /tests | |
parent | 9477ba4e423276fe70e507ddbcc6e087def9f0ef (diff) |
QQmlDebugProcess: Add a method to return the ProcessState
We want a simple way to query the process state, without parsing the
state string. Rename the old state() method to stateString() to make
space for the new state() method.
Change-Id: I493b769a4ab31148f654c1b67bd95d93e3e3cba7
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests')
5 files changed, 12 insertions, 6 deletions
diff --git a/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/tst_qqmldebuggingenabler.cpp b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/tst_qqmldebuggingenabler.cpp index a76740a3f9..7d31940ee4 100644 --- a/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/tst_qqmldebuggingenabler.cpp +++ b/tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/tst_qqmldebuggingenabler.cpp @@ -125,7 +125,7 @@ void tst_QQmlDebuggingEnabler::qmlscene() QQmlDebugClient::Enabled : QQmlDebugClient::Unavailable); } - QCOMPARE(m_process->state(), QLatin1String("running")); + QCOMPARE(m_process->state(), QProcess::Running); if (!blockMode) QTRY_VERIFY(m_process->output().contains(QLatin1String("qml: Component.onCompleted"))); } @@ -170,7 +170,7 @@ void tst_QQmlDebuggingEnabler::custom() QQmlDebugClient::Enabled : QQmlDebugClient::Unavailable); } - QCOMPARE(m_process->state(), QLatin1String("running")); + QCOMPARE(m_process->state(), QProcess::Running); if (!blockMode) QTRY_VERIFY(m_process->output().contains(QLatin1String("QQmlEngine created"))); } diff --git a/tests/auto/qml/debugger/qqmldebugprocess/qqmldebugprocess/tst_qqmldebugprocess.cpp b/tests/auto/qml/debugger/qqmldebugprocess/qqmldebugprocess/tst_qqmldebugprocess.cpp index 993a1d5f63..35bd912d9b 100644 --- a/tests/auto/qml/debugger/qqmldebugprocess/qqmldebugprocess/tst_qqmldebugprocess.cpp +++ b/tests/auto/qml/debugger/qqmldebugprocess/qqmldebugprocess/tst_qqmldebugprocess.cpp @@ -118,7 +118,7 @@ void tst_QQmlDebugProcess::sessionStart() QTimer::singleShot(delay, process.data(), wait); QTRY_VERIFY(done); - QVERIFY(process->state().startsWith("not running")); + QCOMPARE(process->state(), QProcess::NotRunning); } QTEST_MAIN(tst_QQmlDebugProcess) diff --git a/tests/auto/qml/debugger/shared/debugutil.cpp b/tests/auto/qml/debugger/shared/debugutil.cpp index 8ecbe53822..b38e0bd731 100644 --- a/tests/auto/qml/debugger/shared/debugutil.cpp +++ b/tests/auto/qml/debugger/shared/debugutil.cpp @@ -205,7 +205,7 @@ void QQmlDebugTest::cleanup() if (QTest::currentTestFailed()) { const QString null = QStringLiteral("null"); - qDebug() << "Process State:" << (m_process ? m_process->state() : null); + qDebug() << "Process State:" << (m_process ? m_process->stateString() : null); qDebug() << "Application Output:" << (m_process ? m_process->output() : null); qDebug() << "Connection State:" << QQmlDebugTest::connectionStateString(m_connection); for (QQmlDebugClient *client : m_clients) { diff --git a/tests/auto/qml/debugger/shared/qqmldebugprocess.cpp b/tests/auto/qml/debugger/shared/qqmldebugprocess.cpp index 201a6b1a76..0ac8567956 100644 --- a/tests/auto/qml/debugger/shared/qqmldebugprocess.cpp +++ b/tests/auto/qml/debugger/shared/qqmldebugprocess.cpp @@ -61,7 +61,7 @@ QQmlDebugProcess::~QQmlDebugProcess() stop(); } -QString QQmlDebugProcess::state() +QString QQmlDebugProcess::stateString() const { QString stateStr; switch (m_process.state()) { @@ -157,6 +157,11 @@ bool QQmlDebugProcess::waitForFinished() return m_process.waitForFinished(); } +QProcess::ProcessState QQmlDebugProcess::state() const +{ + return m_process.state(); +} + QProcess::ExitStatus QQmlDebugProcess::exitStatus() const { return m_process.exitStatus(); diff --git a/tests/auto/qml/debugger/shared/qqmldebugprocess_p.h b/tests/auto/qml/debugger/shared/qqmldebugprocess_p.h index fd2c89bb41..7aa63cde41 100644 --- a/tests/auto/qml/debugger/shared/qqmldebugprocess_p.h +++ b/tests/auto/qml/debugger/shared/qqmldebugprocess_p.h @@ -52,7 +52,7 @@ public: QQmlDebugProcess(const QString &executable, QObject *parent = 0); ~QQmlDebugProcess(); - QString state(); + QString stateString() const; void addEnvironment(const QString &environment); @@ -61,6 +61,7 @@ public: int debugPort() const; bool waitForFinished(); + QProcess::ProcessState state() const; QProcess::ExitStatus exitStatus() const; QString output() const; |