commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbe...@apache.org
Subject svn commit: r984129 [3/3] - in /commons/sandbox/gsoc/2010/scxml-js/trunk: demo/hierarchical-layout-drag-and-drop/ demo/hierarchical_layout/ src/javascript/scxml/cgf/ src/javascript/scxml/cgf/backends/js/ src/javascript/scxml/cgf/layout/ src/javascript/...
Date Tue, 10 Aug 2010 17:13:06 GMT
Added: commons/sandbox/gsoc/2010/scxml-js/trunk/test/testBrowserTransformAndGraphicalSimulator.html
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/test/testBrowserTransformAndGraphicalSimulator.html?rev=984129&view=auto
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/test/testBrowserTransformAndGraphicalSimulator.html
(added)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/test/testBrowserTransformAndGraphicalSimulator.html
Tue Aug 10 17:13:04 2010
@@ -0,0 +1,129 @@
+<html>
+  <head>
+    <script src="../lib/js/requirejs/require.js" type="text/javascript">true;</script>
+    <script src="../lib/js/requirejs/require/xml.js" type="text/javascript">true;</script>
+    <script src="../test/testHelpers.js" type="text/javascript">true;</script>
+    <script>
+	var resultText;
+
+	require(
+		{
+			"baseUrl":"/"
+		},
+		[ "src/javascript/scxml/cgf/SCXMLCompiler",
+			"xml!test/kitchen_sink/KitchenSink.xml",
+			"src/javascript/scxml/cgf/listener/GraphicalSimulator",
+
+			"src/javascript/scxml/cgf/layout"],
+
+		function(compiler,scxmlDoc,Simulator,layout){
+
+			var layoutInfo = layout.applyHierarchicalLayout(scxmlDoc);
+			var svgDoc = layoutInfo.svgDoc;
+
+			//enough graphical stuff, let's do some compilation
+			compiler.compile({
+				inFiles:[scxmlDoc],
+				backend:"state",
+				beautify:true,
+				verbose:false,
+				log:false,
+				ie:false,
+				genListenerHooks:true
+			}, function(scArr){
+				var transformedJs = scArr[0];
+
+				console.log(transformedJs);
+
+				//eval
+				eval(transformedJs);
+	
+				var simulator = new Simulator(svgDoc);
+
+				var sc = new StatechartExecutionContext();
+
+				sc.addListener(simulator);
+
+				sc.initialize();
+
+				var conf0 = sc.getCurrentConfiguration();
+				//console.log(conf0);
+				//doh.assertTrue(setwiseEqual(conf0,[sc._states.Basic1]));
+
+				//doh.assertEqual(sc.x,0);
+				//doh.assertEqual(sc.y,0);
+
+				console.info("sending event t1")
+				sc.t1()
+				var conf1 = sc.getCurrentConfiguration();
+				//console.log(conf1);
+				//doh.assertTrue(setwiseEqual(conf1,[sc._states.Basic2]));
+
+				//doh.assertEqual(sc.x,1);
+				//doh.assertEqual(sc.y,0);
+
+
+				console.info("sending event t2_7")
+				sc.t2_7()
+				var conf2 = sc.getCurrentConfiguration();
+				//console.log(conf2);
+				//doh.assertTrue(setwiseEqual(conf2,[sc._states.Basic4,sc._states.Basic6]));
+
+				//doh.assertEqual(sc.x,9);
+				//doh.assertEqual(sc.y,0);
+
+				console.info("sending event t3")
+				sc.t3()
+				var conf3 = sc.getCurrentConfiguration();
+				//console.log(conf3);
+				//doh.assertTrue(setwiseEqual(conf3,[sc._states.Basic5,sc._states.Basic7]));
+
+				//doh.assertEqual(sc.x,9);
+				//doh.assertEqual(sc.y,1);
+
+				console.info("sending event t4_9")
+				sc.t4_9()
+				var conf4 = sc.getCurrentConfiguration();
+				//console.log(conf4);
+				//doh.assertTrue(setwiseEqual(conf4,[sc._states.Basic2]));
+
+				//doh.assertEqual(sc.x,3);
+				//doh.assertEqual(sc.y,3);
+
+				console.info("sending event t5")
+				sc.t5()
+				var conf5 = sc.getCurrentConfiguration();
+				//console.log(conf5);
+				//doh.assertTrue(setwiseEqual(conf5,[sc._states.Basic1]));
+
+				console.info("sending event t2_7")
+				sc.t2_7()
+				var conf6 = sc.getCurrentConfiguration();
+				//console.log(conf6);
+				//doh.assertTrue(setwiseEqual(conf6,[sc._states.Basic5,sc._states.Basic7]));
+
+				//doh.assertEqual(sc.x,81);
+				//doh.assertEqual(sc.y,3);
+
+				console.info("sending event t8")
+				sc.t8()
+				var conf7 = sc.getCurrentConfiguration();
+				//console.log(conf7);
+				//doh.assertTrue(setwiseEqual(conf7,[sc._states.Basic4,sc._states.Basic7]));
+
+				console.info("sending event t4_9")
+				sc.t4_9()
+				var conf8 = sc.getCurrentConfiguration();
+				//console.log(conf8);
+				//doh.assertTrue(setwiseEqual(conf8,[sc._states.Basic3]));
+
+				//doh.assertEqual(sc.x,9);
+				//doh.assertEqual(sc.y,9);
+			});
+		}
+	);
+</script>
+  </head>
+  <body/>
+</html>
+

Propchange: commons/sandbox/gsoc/2010/scxml-js/trunk/test/testBrowserTransformAndGraphicalSimulator.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/gsoc/2010/scxml-js/trunk/test/testBrowserTransformAndLayoutWithDragAndDropBehaviour.html
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/test/testBrowserTransformAndLayoutWithDragAndDropBehaviour.html?rev=984129&view=auto
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/test/testBrowserTransformAndLayoutWithDragAndDropBehaviour.html
(added)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/test/testBrowserTransformAndLayoutWithDragAndDropBehaviour.html
Tue Aug 10 17:13:04 2010
@@ -0,0 +1,84 @@
+<html>
+  <head>
+    <script src="../lib/js/requirejs/require.js" type="text/javascript">true;</script>
+    <script src="../lib/js/requirejs/require/xml.js" type="text/javascript">true;</script>
+    <script src="../test/testHelpers.js" type="text/javascript">true;</script>
+    <script>
+	var resultText;
+
+	require(
+		{
+			"baseUrl":"/"
+		},
+		[ "src/javascript/scxml/cgf/SCXMLCompiler",
+			"xml!test/kitchen_sink/KitchenSink.xml",
+			"src/javascript/scxml/cgf/layout",
+			"xml!demo/drag-and-drop/drag-and-drop2.xml",
+			"src/javascript/scxml/cgf/util/xpath",
+			"src/javascript/scxml/cgf/layout/LinkOptimizer"],
+
+
+
+		function(compiler,scxmlDoc,layout,dragAndDropBehaviourSCXMLDoc,xpath,LinkOptimizer){
+
+			var layoutInfo = layout.applyHierarchicalLayout(scxmlDoc);
+			var svgDoc = layoutInfo.svgDoc, 
+				linkNodeList = layoutInfo.linkNodeList, 
+				entityNodeList = layoutInfo.entityNodeList;
+
+			//enough graphical stuff, let's do some compilation
+			compiler.compile({
+				inFiles:[dragAndDropBehaviourSCXMLDoc],
+				backend:"state",
+				beautify:true,
+				verbose:false,
+				log:false,
+				ie:false,
+				genListenerHooks:true
+			}, function(scArr){
+				var dragAndDropBehaviourTransformedJs = scArr[0];
+
+			//	console.log(dragAndDropBehaviourTransformedJs);
+
+				//hook up graphical node drag and drop behaviour
+				eval(dragAndDropBehaviourTransformedJs);
+
+				DragAndDropStatechartExecutionContext = StatechartExecutionContext;
+
+				var graphEntityNodes = xpath.query("//svg:g[@c:graphEntity = 'true']",svgDoc.documentElement)
+				graphEntityNodes.forEach(function(groupNode){
+					var compiledStatechartInstance = new DragAndDropStatechartExecutionContext();
+					
+					//initialize
+					compiledStatechartInstance.initialize();
+
+					console.log(groupNode);
+					
+					var svgNS = "http://www.w3.org/2000/svg";
+					//create dummy textnode just for compatibility
+					var textElement = document.createElementNS(null,"text");
+
+					//pass in reference to rect
+					compiledStatechartInstance.init({rawNode:groupNode,textNode:textElement}); 
+
+					//hook up DOM events
+					["mousedown","mouseup","mousemove"].forEach(function(eventName){
+						groupNode.addEventListener(eventName,
+						function(e){
+							e.preventDefault();
+							compiledStatechartInstance[eventName](e);
+							e.stopPropagation();
+						},
+						false);
+					});
+				});
+
+				linkNodeList.forEach(function(ln){LinkOptimizer.optimizeConnectionPorts(ln)});
+			});
+		}
+	);
+</script>
+  </head>
+  <body/>
+</html>
+

Propchange: commons/sandbox/gsoc/2010/scxml-js/trunk/test/testBrowserTransformAndLayoutWithDragAndDropBehaviour.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/sandbox/gsoc/2010/scxml-js/trunk/test/testBrowserTransformAndLogListener.html
URL: http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/trunk/test/testBrowserTransformAndLogListener.html?rev=984129&view=auto
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/trunk/test/testBrowserTransformAndLogListener.html
(added)
+++ commons/sandbox/gsoc/2010/scxml-js/trunk/test/testBrowserTransformAndLogListener.html
Tue Aug 10 17:13:04 2010
@@ -0,0 +1,123 @@
+<html>
+  <head>
+    <script src="../lib/js/requirejs/require.js" type="text/javascript">true;</script>
+    <script src="../lib/js/requirejs/require/xml.js" type="text/javascript">true;</script>
+    <script djConfig="isDebug:true" src="../lib/test-js/dojo-release-1.4.2-src/dojo/dojo.js"
type="text/javascript">true;</script>
+    <script src="../test/testHelpers.js" type="text/javascript">true;</script>
+    <script>
+	var resultText;
+
+	require(
+		{
+			"baseUrl":"/"
+		},
+		[ "src/javascript/scxml/cgf/SCXMLCompiler",
+			"xml!test/kitchen_sink/KitchenSink_executableContent.xml",
+			"src/javascript/scxml/cgf/listener/Logger"],
+
+		function(compiler,KitchenSink_executableContent,Logger){
+
+			compiler.compile({
+				inFiles:[KitchenSink_executableContent],
+				backend:"state",
+				beautify:true,
+				verbose:false,
+				log:false,
+				ie:false,
+				genListenerHooks:true
+			}, function(scArr){
+				var transformedJs = scArr[0];
+
+				console.log(transformedJs);
+
+				//eval
+				eval(transformedJs);
+	
+				var logger = new Logger();
+
+				var sc = new StatechartExecutionContext();
+
+				sc.addListener(logger);
+
+				sc.initialize();
+
+				var conf0 = sc.getCurrentConfiguration();
+				//console.log(conf0);
+				//doh.assertTrue(setwiseEqual(conf0,[sc._states.Basic1]));
+
+				//doh.assertEqual(sc.x,0);
+				//doh.assertEqual(sc.y,0);
+
+				console.info("sending event t1")
+				sc.t1()
+				var conf1 = sc.getCurrentConfiguration();
+				//console.log(conf1);
+				//doh.assertTrue(setwiseEqual(conf1,[sc._states.Basic2]));
+
+				//doh.assertEqual(sc.x,1);
+				//doh.assertEqual(sc.y,0);
+
+
+				console.info("sending event t2_7")
+				sc.t2_7()
+				var conf2 = sc.getCurrentConfiguration();
+				//console.log(conf2);
+				//doh.assertTrue(setwiseEqual(conf2,[sc._states.Basic4,sc._states.Basic6]));
+
+				//doh.assertEqual(sc.x,9);
+				//doh.assertEqual(sc.y,0);
+
+				console.info("sending event t3")
+				sc.t3()
+				var conf3 = sc.getCurrentConfiguration();
+				//console.log(conf3);
+				//doh.assertTrue(setwiseEqual(conf3,[sc._states.Basic5,sc._states.Basic7]));
+
+				//doh.assertEqual(sc.x,9);
+				//doh.assertEqual(sc.y,1);
+
+				console.info("sending event t4_9")
+				sc.t4_9()
+				var conf4 = sc.getCurrentConfiguration();
+				//console.log(conf4);
+				//doh.assertTrue(setwiseEqual(conf4,[sc._states.Basic2]));
+
+				//doh.assertEqual(sc.x,3);
+				//doh.assertEqual(sc.y,3);
+
+				console.info("sending event t5")
+				sc.t5()
+				var conf5 = sc.getCurrentConfiguration();
+				//console.log(conf5);
+				//doh.assertTrue(setwiseEqual(conf5,[sc._states.Basic1]));
+
+				console.info("sending event t2_7")
+				sc.t2_7()
+				var conf6 = sc.getCurrentConfiguration();
+				//console.log(conf6);
+				//doh.assertTrue(setwiseEqual(conf6,[sc._states.Basic5,sc._states.Basic7]));
+
+				//doh.assertEqual(sc.x,81);
+				//doh.assertEqual(sc.y,3);
+
+				console.info("sending event t8")
+				sc.t8()
+				var conf7 = sc.getCurrentConfiguration();
+				//console.log(conf7);
+				//doh.assertTrue(setwiseEqual(conf7,[sc._states.Basic4,sc._states.Basic7]));
+
+				console.info("sending event t4_9")
+				sc.t4_9()
+				var conf8 = sc.getCurrentConfiguration();
+				//console.log(conf8);
+				//doh.assertTrue(setwiseEqual(conf8,[sc._states.Basic3]));
+
+				//doh.assertEqual(sc.x,9);
+				//doh.assertEqual(sc.y,9);
+			});
+		}
+	);
+</script>
+  </head>
+  <body/>
+</html>

Propchange: commons/sandbox/gsoc/2010/scxml-js/trunk/test/testBrowserTransformAndLogListener.html
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message