summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJarek Kobus <jaroslaw.kobus@theqtcompany.com>2016-05-19 15:07:31 +0200
committerJarek Kobus <jaroslaw.kobus@qt.io>2016-05-20 11:58:36 +0000
commitfcfcea0ba6c34c769e98b6e6116fca7905bffe8a (patch)
tree20ab6ce9bf11b39cf109da72840d4088c31f101f
parent3da30ee8928ab27249a74966ed4981766d62ff25 (diff)
Don't bind NULL events to _event variable.
This fixes test329. According to scxml documentation: "NULL has no name and is used only in these definitions. It never occurs in the event queues of an SCXML Processor". "In the case of <transition> elements that do not contain an 'event' attribute [...], the _event variable will not have a easily predictable value since the transition is not being driven by an event. In these cases, _event will be bound to the last event that was matched against a transition." Analysis of test329: We enter the s1 state, raise event "foo" (which binds the _event variable into "foo" event) and transition into s2 state. When entering s2 we assign the _event variable (which is still bound to "foo") to the Var2. Next, we select eventless transitions for s2. In current implementation, selecting eventless transitions bind _event variable to the empty event. Now we omit it, according to docs. Change-Id: Ib393d4465f9a3ff4afc152aee2c334a80ee5fe66 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
-rw-r--r--src/scxml/qscxmlcppdatamodel.cpp3
-rw-r--r--src/scxml/qscxmlecmascriptdatamodel.cpp3
-rw-r--r--tests/auto/scion/tst_scion.cpp2
3 files changed, 6 insertions, 2 deletions
diff --git a/src/scxml/qscxmlcppdatamodel.cpp b/src/scxml/qscxmlcppdatamodel.cpp
index 9efc1c3..15be429 100644
--- a/src/scxml/qscxmlcppdatamodel.cpp
+++ b/src/scxml/qscxmlcppdatamodel.cpp
@@ -184,6 +184,9 @@ bool QScxmlCppDataModel::evaluateForeach(EvaluatorId id, bool *ok, ForeachLoopBo
void QScxmlCppDataModel::setScxmlEvent(const QScxmlEvent &event)
{
Q_D(QScxmlCppDataModel);
+ if (event.name().isEmpty())
+ return;
+
d->event = event;
}
diff --git a/src/scxml/qscxmlecmascriptdatamodel.cpp b/src/scxml/qscxmlecmascriptdatamodel.cpp
index ef64e48..ceba661 100644
--- a/src/scxml/qscxmlecmascriptdatamodel.cpp
+++ b/src/scxml/qscxmlecmascriptdatamodel.cpp
@@ -147,6 +147,9 @@ public:
void assignEvent(const QScxmlEvent &event)
{
+ if (event.name().isEmpty())
+ return;
+
QJSValue _event = engine()->newObject();
QJSValue dataValue = eventDataAsJSValue(event.data());
_event.setProperty(QStringLiteral("data"), dataValue.isUndefined() ? QJSValue(QJSValue::UndefinedValue)
diff --git a/tests/auto/scion/tst_scion.cpp b/tests/auto/scion/tst_scion.cpp
index c2c2706..7b039ae 100644
--- a/tests/auto/scion/tst_scion.cpp
+++ b/tests/auto/scion/tst_scion.cpp
@@ -66,8 +66,6 @@ static QSet<QString> testFailOnRun = QSet<QString>()
;
static QSet<QString> testUseDifferentSemantics = QSet<QString>()
- // FIXME: looks like a bug in internal event ordering when writing to read-only variables.
- << QLatin1String("w3c-ecma/test329.txml")
// Qt does not support forcing initial states that are not marked as such.
<< QLatin1String("w3c-ecma/test413.txml") // FIXME: verify initial state setting...
<< QLatin1String("w3c-ecma/test576.txml") // FIXME: verify initial state setting...