summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@theqtcompany.com>2016-04-06 13:44:13 +0200
committerUlf Hermann <ulf.hermann@theqtcompany.com>2016-04-18 08:07:17 +0000
commit382aac3e7877c151eaef5f7bb3fedefc10a8f284 (patch)
tree3123ddc4f55b37ad9c6b924345f667520eceb421 /tests
parent8dee4c71a563c39fb622e054f5cdacdd797f41fb (diff)
Don't crash when trying to execute things in the null data model
Rather raise error.execution, as mandated by the standard (in most of those cases). Change-Id: If2e200693198b70b4bf067011318f0d78c44653b Reviewed-by: Jarek Kobus <jaroslaw.kobus@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/compiled/compiled.pro3
-rw-r--r--tests/auto/compiled/datainnulldatamodel.scxml7
-rw-r--r--tests/auto/compiled/tst_compiled.cpp8
3 files changed, 17 insertions, 1 deletions
diff --git a/tests/auto/compiled/compiled.pro b/tests/auto/compiled/compiled.pro
index 7dc62ba..53dcd8c 100644
--- a/tests/auto/compiled/compiled.pro
+++ b/tests/auto/compiled/compiled.pro
@@ -16,6 +16,7 @@ STATECHARTS = \
eventnames2.scxml \
statemachineunicodename.scxml \
anonymousstate.scxml \
- submachineunicodename.scxml
+ submachineunicodename.scxml \
+ datainnulldatamodel.scxml
load(qscxmlc)
diff --git a/tests/auto/compiled/datainnulldatamodel.scxml b/tests/auto/compiled/datainnulldatamodel.scxml
new file mode 100644
index 0000000..c8cc7fb
--- /dev/null
+++ b/tests/auto/compiled/datainnulldatamodel.scxml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scxml name="DataInNullDataModel" xmlns="http://www.w3.org/2005/07/scxml" version="1.0" initial="a">
+ <datamodel>
+ <data id="x" expr="2"/>
+ </datamodel>
+ <state id="a"></state>
+</scxml>
diff --git a/tests/auto/compiled/tst_compiled.cpp b/tests/auto/compiled/tst_compiled.cpp
index 9c4c1e4..ca9b7b3 100644
--- a/tests/auto/compiled/tst_compiled.cpp
+++ b/tests/auto/compiled/tst_compiled.cpp
@@ -33,6 +33,7 @@
#include <QtScxml/qscxmlstatemachine.h>
#include "ids1.h"
#include "statemachineunicodename.h"
+#include "datainnulldatamodel.h"
Q_DECLARE_METATYPE(QScxmlError);
@@ -44,6 +45,7 @@ class tst_Compiled: public QObject
private Q_SLOTS:
void stateNames();
+ void nullDataInit();
};
void tst_Compiled::stateNames()
@@ -81,6 +83,12 @@ void tst_Compiled::stateNames()
QCOMPARE(stateMachine3.stateNames(false), calculatorStates);
}
+void tst_Compiled::nullDataInit()
+{
+ DataInNullDataModel nullData;
+ QVERIFY(!nullData.init()); // raises an error, but doesn't crash
+}
+
QTEST_MAIN(tst_Compiled)
#include "tst_compiled.moc"