summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2012-10-05 15:31:26 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2012-10-05 15:31:26 (GMT)
commit0ae6c27d9322208053033d9b19c0ffffed3d99eb (patch)
tree0794b4df38568e03fb01e7fa91e6d4a625db859e /test
parent64cc2ce105cf57fcba637b309664b4bc74ae7d82 (diff)
downloaduscxml-0ae6c27d9322208053033d9b19c0ffffed3d99eb.zip
uscxml-0ae6c27d9322208053033d9b19c0ffffed3d99eb.tar.gz
uscxml-0ae6c27d9322208053033d9b19c0ffffed3d99eb.tar.bz2
Implemented DOM
Diffstat (limited to 'test')
-rw-r--r--test/src/audio/click.wavbin0 -> 5058 bytes
-rw-r--r--test/src/scxml-gui-test.scxml13
-rw-r--r--test/src/test-completion.cpp4
-rw-r--r--test/src/test-dom.scxml20
-rw-r--r--test/src/test-spatial-audio.scxml68
5 files changed, 105 insertions, 0 deletions
diff --git a/test/src/audio/click.wav b/test/src/audio/click.wav
new file mode 100644
index 0000000..e11b0b7
--- /dev/null
+++ b/test/src/audio/click.wav
Binary files differ
diff --git a/test/src/scxml-gui-test.scxml b/test/src/scxml-gui-test.scxml
new file mode 100644
index 0000000..adf93b8
--- /dev/null
+++ b/test/src/scxml-gui-test.scxml
@@ -0,0 +1,13 @@
+<scxml initial="start" version="0.9" xmlns="http://www.w3.org/2005/07/scxml"><!-- node-size-and-position x=0.0 y=0.0 w=280.0 h=320.0 -->
+ <state id="start"><!-- node-size-and-position x=30.000000000000004 y=30.000000000000004 w=80.0 h=70.0 -->
+ <onentry>
+ <log expr="Starting"></log>
+ </onentry>
+ <transition target="final"></transition>
+ </state>
+ <final id="final"><!-- node-size-and-position x=160.0 y=30.000000000000004 w=100.0 h=100.0 -->
+ <onentry>
+ <log expr="final entered"></log>
+ </onentry>
+ </final>
+</scxml> \ No newline at end of file
diff --git a/test/src/test-completion.cpp b/test/src/test-completion.cpp
index 33056f3..619bdef 100644
--- a/test/src/test-completion.cpp
+++ b/test/src/test-completion.cpp
@@ -1,4 +1,5 @@
#include "uscxml/Interpreter.h"
+#include "uscxml/debug/SCXMLDotWriter.h"
#include <DOM/io/Stream.hpp>
int main(int argc, char** argv) {
@@ -10,7 +11,10 @@ int main(int argc, char** argv) {
using namespace uscxml;
Interpreter* interpreter = Interpreter::fromURI(argv[1]);
+ SCXMLDotWriter::toDot("output.dot", interpreter);
+
interpreter->interpret();
+
return EXIT_SUCCESS;
} \ No newline at end of file
diff --git a/test/src/test-dom.scxml b/test/src/test-dom.scxml
new file mode 100644
index 0000000..4624209
--- /dev/null
+++ b/test/src/test-dom.scxml
@@ -0,0 +1,20 @@
+<scxml datamodel="ecmascript">
+ <state id="start">
+ <onentry>
+ <script>
+ <!-- Add the missing transition to final -->
+ var transition = document.createElement("transition");
+ transition.setAttribute("target", "final");
+ transition.setAttribute("event", "quit");
+ var nodeSet = document.evaluate("//state[@id='start']").asNodeSet();
+ nodeSet[0].appendChild(transition);
+ </script>
+ <raise event="quit" />
+ </onentry>
+ </state>
+ <final id="final">
+ <onentry>
+ <log expr="'Quitting!'" />
+ </onentry>
+ </final>
+</scxml> \ No newline at end of file
diff --git a/test/src/test-spatial-audio.scxml b/test/src/test-spatial-audio.scxml
new file mode 100644
index 0000000..f800c82
--- /dev/null
+++ b/test/src/test-spatial-audio.scxml
@@ -0,0 +1,68 @@
+<scxml datamodel="ecmascript" name="spatial.audio.test">
+ <datamodel>
+ <!-- Alternative to the JSON notation
+ <data id="spatialAudio" expr="{}" />
+ <data id="spatialAudio.id2" expr="{}" />
+ <data id="spatialAudio.id2.degree" expr="90" />
+ -->
+ <data id="spatialAudio">
+ {
+ 'id2': {
+ 'degree': 90
+ }
+ }
+ </data>
+ </datamodel>
+ <state id="click.continuously">
+ <initial>
+ <transition target="ready" />
+ </initial>
+ <invoke type="http://www.smartvortex.eu/mmi/spatial-audio/" src="audio/click.wav" id="spatial-audio.id1">
+ <!--
+ Explicitly set the start position of an audio source.
+ Keep in mind that the coordinate system is the same as in OpenGL:
+ y
+ |
+ |___x
+ /
+ z
+ -->
+ <param name="x" expr="-1.0" /> <!-- leftmost -->
+ <param name="y" expr="0" />
+ <param name="z" expr="0" />
+ </invoke>
+ <invoke type="http://www.smartvortex.eu/mmi/spatial-audio/" src="audio/click.wav" id="spatial-audio.id2">
+ <!--
+ Set position on a circle.
+ Unit for circle is "deg" in clockwise order with 0 being directly in front,
+ or "rad" in counter-clockwise with zero being the rightmost position.
+ "right", "height" and "front" are aliases for x, y and z respectively.
+ -->
+ <param name="circle" expr="spatialAudio.id2.degree + 'deg'" /> <!-- rightmost -->
+ <param name="height" expr="0.0" />
+ </invoke>
+ <state id="ready">
+ <onentry>
+ <!-- trigger transition in 1 second -->
+ <send event="spatial-audio.play" delay="1s" />
+ </onentry>
+ <transition target="click" event="spatial-audio.play" />
+ <transition target="final" event="quit" />
+ </state>
+ <state id="click">
+ <onentry>
+ <send target="#_spatial-audio.id1" event="play" delay="0ms" />
+ <!--
+ move position of audio 2 in a circle
+ -->
+ <send target="#_spatial-audio.id2" event="play" delay="200ms">
+ <param name="circle" expr="spatialAudio.id2.degree + 'deg'" />
+ </send>
+ <script>spatialAudio.id2.degree += 10;</script>
+ </onentry>
+ <transition target="ready" />
+ </state>
+ </state>
+
+ <final id="final" />
+</scxml> \ No newline at end of file