diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2016-08-30 14:39:51 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2016-08-30 12:51:08 +0000 |
commit | 1db438735f7a3033b8a3ce6ef2b36aee1d725197 (patch) | |
tree | a127b1acd8f3009b3b7478ba9f49a9fb4ff9329e /tests | |
parent | a34e5cda67c92021d6999b3544669cdbbd9655f8 (diff) |
Replace runningSubStateMachines() with invokableServices()
SCXML allows for different kinds of services, not only other state
machines. We might add support for them in the future. From invoked
state machines you can always get the actual state machine via the
respective property. To make this easily accessible, we make the
invoked services QObjects.
Change-Id: Idd07783730bc98bded404dc2c2c3bd241180c1f4
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/compiled/tst_compiled.cpp | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/tests/auto/compiled/tst_compiled.cpp b/tests/auto/compiled/tst_compiled.cpp index 47463af..0e4bb02 100644 --- a/tests/auto/compiled/tst_compiled.cpp +++ b/tests/auto/compiled/tst_compiled.cpp @@ -31,6 +31,7 @@ #include <QXmlStreamReader> #include <QtScxml/qscxmlparser.h> #include <QtScxml/qscxmlstatemachine.h> +#include <QtScxml/qscxmlinvokableservice.h> #include "ids1.h" #include "statemachineunicodename.h" #include "datainnulldatamodel.h" @@ -107,9 +108,9 @@ void tst_Compiled::subMachineUnicodeName() QSignalSpy stableStateSpy(&directions, SIGNAL(reachedStableState())); directions.start(); stableStateSpy.wait(5000); - QScxmlStateMachine *subMachine = directions.runningSubStateMachines().value(0); - QVERIFY(subMachine); - QCOMPARE(subMachine->name(), QString("änywhere")); + QScxmlInvokableService *service = directions.invokedServices().value(0); + QVERIFY(service); + QCOMPARE(service->name(), QString("änywhere")); } void tst_Compiled::unicodeEventName() @@ -225,23 +226,23 @@ void tst_Compiled::topMachine() { TopMachine stateMachine; int doneCounter = 0; - int runningSubMachinesCount = 0; + int invokableServicesCount = 0; stateMachine.connectToEvent("done.invoke.submachine", [&doneCounter](const QScxmlEvent &) { ++doneCounter; }); - QObject::connect(&stateMachine, &QScxmlStateMachine::runningSubStateMachinesChanged, - [&runningSubMachinesCount](const QVector<QScxmlStateMachine *> &subMachines) { - runningSubMachinesCount = subMachines.count(); + QObject::connect(&stateMachine, &QScxmlStateMachine::invokedServicesChanged, + [&invokableServicesCount](const QVector<QScxmlInvokableService *> &services) { + invokableServicesCount = services.count(); }); stateMachine.start(); - QTRY_COMPARE(runningSubMachinesCount, 3); + QTRY_COMPARE(invokableServicesCount, 3); QTRY_COMPARE(doneCounter, 3); - QCOMPARE(stateMachine.runningSubStateMachines().count(), 3); - QTRY_COMPARE(runningSubMachinesCount, 0); + QCOMPARE(stateMachine.invokedServices().count(), 3); + QTRY_COMPARE(invokableServicesCount, 0); } void tst_Compiled::topMachineDynamic() @@ -250,23 +251,23 @@ void tst_Compiled::topMachineDynamic() QScxmlStateMachine::fromFile(QString(":/topmachine.scxml"))); QVERIFY(!stateMachine.isNull()); int doneCounter = 0; - int runningSubMachinesCount = 0; + int invokableServicesCount = 0; stateMachine->connectToEvent("done.invoke.submachine", [&doneCounter](const QScxmlEvent &) { ++doneCounter; }); - QObject::connect(stateMachine.data(), &QScxmlStateMachine::runningSubStateMachinesChanged, - [&runningSubMachinesCount](const QVector<QScxmlStateMachine *> &subMachines) { - runningSubMachinesCount = subMachines.count(); + QObject::connect(stateMachine.data(), &QScxmlStateMachine::invokedServicesChanged, + [&invokableServicesCount](const QVector<QScxmlInvokableService *> &services) { + invokableServicesCount = services.count(); }); stateMachine->start(); - QTRY_COMPARE(runningSubMachinesCount, 3); + QTRY_COMPARE(invokableServicesCount, 3); QTRY_COMPARE(doneCounter, 3); - QCOMPARE(stateMachine->runningSubStateMachines().count(), 3); - QTRY_COMPARE(runningSubMachinesCount, 0); + QCOMPARE(stateMachine->invokedServices().count(), 3); + QTRY_COMPARE(invokableServicesCount, 0); } void tst_Compiled::publicSignals() |