diff options
author | Jarek Kobus <jaroslaw.kobus@theqtcompany.com> | 2016-07-26 13:15:40 +0200 |
---|---|---|
committer | Jarek Kobus <jaroslaw.kobus@qt.io> | 2016-07-27 15:32:06 +0000 |
commit | 07eeac08a42f481fb3e599e212d032e1983f4f63 (patch) | |
tree | a914874e1d082fb675c5232fa8051fb09acb8aca /tests | |
parent | df8ee0d650a807abf46d2eff2366d066a5ce24f4 (diff) |
Add a test for the state machine with a few sub machines
The top state machine refers twice to the same sub machine file.
Change-Id: I113740cff544179e3b518d40ef9af21092508622
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/compiled/compiled.pro | 3 | ||||
-rw-r--r-- | tests/auto/compiled/submachineA.scxml | 4 | ||||
-rw-r--r-- | tests/auto/compiled/submachineB.scxml | 4 | ||||
-rw-r--r-- | tests/auto/compiled/topmachine.scxml | 8 | ||||
-rw-r--r-- | tests/auto/compiled/tst_compiled.cpp | 14 |
5 files changed, 32 insertions, 1 deletions
diff --git a/tests/auto/compiled/compiled.pro b/tests/auto/compiled/compiled.pro index fdf1364..e621ee4 100644 --- a/tests/auto/compiled/compiled.pro +++ b/tests/auto/compiled/compiled.pro @@ -19,5 +19,6 @@ STATECHARTS = \ submachineunicodename.scxml \ datainnulldatamodel.scxml \ initialhistory.scxml \ - connection.scxml + connection.scxml \ + topmachine.scxml diff --git a/tests/auto/compiled/submachineA.scxml b/tests/auto/compiled/submachineA.scxml new file mode 100644 index 0000000..b72a048 --- /dev/null +++ b/tests/auto/compiled/submachineA.scxml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0"> + <final id="topState"/> +</scxml> diff --git a/tests/auto/compiled/submachineB.scxml b/tests/auto/compiled/submachineB.scxml new file mode 100644 index 0000000..b72a048 --- /dev/null +++ b/tests/auto/compiled/submachineB.scxml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0"> + <final id="topState"/> +</scxml> diff --git a/tests/auto/compiled/topmachine.scxml b/tests/auto/compiled/topmachine.scxml new file mode 100644 index 0000000..0040144 --- /dev/null +++ b/tests/auto/compiled/topmachine.scxml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" name="TopMachine"> + <state id="topState"> + <invoke type="scxml" id="submachine.1" src="file:submachineA.scxml"/> + <invoke type="scxml" id="submachine.2" src="file:submachineA.scxml"/> + <invoke type="scxml" id="submachine.3" src="file:submachineB.scxml"/> + </state> +</scxml> diff --git a/tests/auto/compiled/tst_compiled.cpp b/tests/auto/compiled/tst_compiled.cpp index 6ad8e47..6e1b4bf 100644 --- a/tests/auto/compiled/tst_compiled.cpp +++ b/tests/auto/compiled/tst_compiled.cpp @@ -37,6 +37,7 @@ #include "submachineunicodename.h" #include "eventnames1.h" #include "connection.h" +#include "topmachine.h" Q_DECLARE_METATYPE(QScxmlError); @@ -53,6 +54,7 @@ private Q_SLOTS: void unicodeEventName(); void connection(); void myConnection(); + void topMachine(); }; void tst_Compiled::stateNames() @@ -215,6 +217,18 @@ void tst_Compiled::myConnection() QVERIFY(disconnect(conFinal)); } +void tst_Compiled::topMachine() +{ + TopMachine stateMachine; + int doneCounter = 0; + + stateMachine.connectToEvent("done.invoke.submachine", [&doneCounter](const QScxmlEvent &) { + ++doneCounter; + }); + stateMachine.start(); + + QTRY_COMPARE(doneCounter, 3); +} QTEST_MAIN(tst_Compiled) |