当前位置: 首页>>代码示例>>C#>>正文


C# GraphController.GetVisualNodes方法代码示例

本文整理汇总了C#中DesignScriptStudio.Graph.Core.GraphController.GetVisualNodes方法的典型用法代码示例。如果您正苦于以下问题:C# GraphController.GetVisualNodes方法的具体用法?C# GraphController.GetVisualNodes怎么用?C# GraphController.GetVisualNodes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DesignScriptStudio.Graph.Core.GraphController的用法示例。


在下文中一共展示了GraphController.GetVisualNodes方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Defect_IDE_1464

        public void Defect_IDE_1464()
        {
            // IDE-1464 Implicit connection line is going way while doing undo for explicit connection line.
            // Create two CBN with values "a=1;" and "b=a;".
            // Now drag and drop identifier node.
            // Now connect first CBN to Identifier node.
            // Now do Undo.
            // After undo DSS removing explicit connection line (which is correct), along with implicit connection line. (which is wrong.)

            string commands = @"
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                CreateCodeBlockNode|d:10444.0|d:10171.0|s:
                BeginNodeEdit|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,NorthWest|i:-1|e:System.Windows.Input.ModifierKeys,None
                EndNodeEdit|u:0x10000001|s:a=1;|b:True
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                CreateCodeBlockNode|d:10464.28571429|d:10239.9047619|s:
                BeginNodeEdit|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,Text
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,NorthWest|i:-1|e:System.Windows.Input.ModifierKeys,None
                EndNodeEdit|u:0x10000002|s:b=a;|b:True
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                CreateIdentifierNode|d:10572.28571429|d:10192.47619048
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None
                BeginDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:10488.85714286|d:10184.47619048
                EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:10573.42857143|d:10214.19047619
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None
                UndoOperation";

            GraphController controller = new GraphController(null);
            bool result = controller.RunCommands(commands);
            Assert.AreEqual(true, result);

            ISlot outputSlot = controller.GetSlot(0x30000001); // Output slot of CB Node.
            Assert.IsNotNull(outputSlot);
            ISlot inputSlot = controller.GetSlot(0x30000002); // Input slot of CB node.
            Assert.IsNotNull(inputSlot);
            // Output slot of first CB Node should connect to Input slot second CB node.
            uint[] connecting = outputSlot.ConnectingSlots;
            Assert.IsNotNull(connecting);
            Assert.IsTrue(connecting.Contains((uint)0x30000002));

            Assert.AreEqual(3, controller.GetVisualNodes().Count);
        }
开发者ID:samuto,项目名称:designscript,代码行数:51,代码来源:UndoRedoOperationTests.cs

示例2: Defect_IDE_1556

        public void Defect_IDE_1556()
        {
            // Load the LinesToGrid.bin file. It should give exception, but no crash

            Assert.Throws<InvalidDataException>(() =>
            {
                IStorage s2 = new FileStorage();
                string testPath = "..\\..\\..\\..\\Studio\\DesignScriptStudio.Tests\\UnitTests\\testfiles\\";
                string filePath = testPath + "LinesToGrid.bin";
                ((FileStorage)s2).Load(filePath);

                GraphController graphController = new GraphController(null, filePath);

                Assert.AreEqual(0, graphController.GetVisualNodes().Count);
            });
        }
开发者ID:samuto,项目名称:designscript,代码行数:16,代码来源:FileStorageTests.cs

示例3: TestHandleBeginAndEndDrag

        public void TestHandleBeginAndEndDrag()
        {
            string commands = @"
                CreateFunctionNode|d:323.0|d:150.0|s:Math.dll|s:Math.Sin|s:double
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None
                BeginDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None|d:432.0|d:167.0
                EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None|d:955.0|d:422.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None";

            GraphController graphController = new GraphController(null);
            bool result = graphController.RunCommands(commands);
            Assert.AreEqual(true, result);

            IVisualNode node = graphController.GetVisualNodes().ElementAt(0);
            Assert.AreNotEqual(323.0, node.X);
            Assert.AreNotEqual(150.0, node.Y);
        }
开发者ID:samuto,项目名称:designscript,代码行数:17,代码来源:GraphController.CommandHandlersTests.cs

示例4: Defect_IDE_1705

        public void Defect_IDE_1705()
        {
            // create six codeblock nodes and connect it to a function node with six slots
            // save and load it
            //IDE-1213
            IStorage s2 = new FileStorage();
            string testPath = Path.GetFullPath("..\\..\\..\\..\\Studio\\DesignScriptStudio.Tests\\UnitTests\\testfiles\\");
            string filePath = testPath + "Defect_1705.bin";
            ((FileStorage)s2).Load(filePath);

            GraphController graphController = new GraphController(null, filePath);

            Assert.AreEqual(3, graphController.GetVisualNodes().Count);

            //IVisualNode node01 = graphController.GetVisualNode(0x10000002);// Code Block Node
            //Assert.AreEqual("1", node01.PreviewValue);
        }
开发者ID:samuto,项目名称:designscript,代码行数:17,代码来源:FileStorageTests.cs

示例5: TestHandleBeginAndEndNodeEdit

        public void TestHandleBeginAndEndNodeEdit()
        {
            string commands = @"
                CreateFunctionNode|d:521.0|d:273.0|s:Math.dll|s:Math.Sin|s:double
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None
                BeginNodeEdit|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None
                EndNodeEdit|u:0x10000001|s:abc|b:True";

            GraphController graphController = new GraphController(null);
            bool result = graphController.RunCommands(commands);
            Assert.AreEqual(true, result);

            IVisualNode node = graphController.GetVisualNodes().ElementAt(0);
            Assert.AreEqual("abc", ((VisualNode)node).Text);
        }
开发者ID:samuto,项目名称:designscript,代码行数:18,代码来源:GraphController.CommandHandlersTests.cs

示例6: Defect_IDE_1239

        public void Defect_IDE_1239()
        {
            // * [CRASH] Deleting a Node while in edit mode DSS is crashing.*
            // Double click to start Code Block node. ( No need to type anything.)
            // Now click on left side of Code Block node (inside node), to select it.
            // You will observe that node is still in edit mode but you can select the node as well.
            // Now press delete button or backspace key.
            // Now click outside or else where in canvas.
            // Above action will produces a crash.

            string commands = @"
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                CreateCodeBlockNode|d:10502.0|d:10245.0|s:
                BeginNodeEdit|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,NorthWest|i:-1|e:System.Windows.Input.ModifierKeys,None
                EndNodeEdit|u:0x10000001|s:1|b:True
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None";

            GraphController controller = new GraphController(null);
            bool result = controller.RunCommands(commands);
            Assert.AreEqual(true, result);

            IVisualNode node = controller.GetVisualNode(0x10000001);

            commands = @"
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None
                BeginNodeEdit|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None
                EndNodeEdit|u:0x10000001|s:|b:False
                DeleteComponents";

            bool result01 = controller.RunCommands(commands);
            Assert.IsTrue(result01);

            Assert.AreEqual(0, controller.GetVisualNodes().Count());
        }
开发者ID:samuto,项目名称:designscript,代码行数:43,代码来源:DeleteTests.cs

示例7: CreateCodeBlockWithMultipleLines

        public void CreateCodeBlockWithMultipleLines()
        {
            // Create Code Block with mutiple lines
            //
            string commands = @"
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                CreateCodeBlockNode|d:10432.0|d:10142.0|s:
                BeginNodeEdit|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,NorthWest|i:-1|e:System.Windows.Input.ModifierKeys,None
                EndNodeEdit|u:0x10000001|s:a = 1;b = 2;c = a + b;|b:True
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None";

            GraphController controller = new GraphController(null);
            bool result = controller.RunCommands(commands);
            Assert.AreEqual(true, result);

            IVisualNode node = controller.GetVisualNodes().ElementAt(0);
            Assert.AreEqual(3, node.GetOutputSlots().Count());
        }
开发者ID:samuto,项目名称:designscript,代码行数:22,代码来源:CodeBlockNodeTests.cs

示例8: TestUndoRedoBehaviour

        public void TestUndoRedoBehaviour()
        {
            // 1. Create a node.
            // 2. Undo.
            // 3. Create another node.
            // 4. Redo. The first node should not be repopulated back onto the canvas.
            //
            string commands = @"
                CreateDriverNode|d:396.0|d:254.0
                UndoOperation
                CreateIdentifierNode|d:489.0|d:248.0
                RedoOperation";

            GraphController graphController = new GraphController(null);
            bool result = graphController.RunCommands(commands);
            Assert.AreEqual(true, result);
            Assert.AreEqual(1, graphController.GetVisualNodes().Count);
        }
开发者ID:samuto,项目名称:designscript,代码行数:18,代码来源:UndoRedoOperationTests.cs

示例9: RedoReplaceConnectionLines

        public void RedoReplaceConnectionLines()
        {
            // Create one add node and two code block node.
            // Connect two code block nodes to input slots of add node.
            // Replace connection of second node
            // Undo connection
            // Redo connection

            string commands = @"
                CreateFunctionNode|d:644.0|d:185.0|s:|s:+|s:double,double
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                CreateCodeBlockNode|d:410.0|d:191.0|s:
                BeginNodeEdit|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,Text
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,NorthWest|i:0|e:System.Windows.Input.ModifierKeys,None
                EndNodeEdit|u:0x10000002|s:45|b:True
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                CreateCodeBlockNode|d:414.0|d:266.0|s:
                BeginNodeEdit|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,Text
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,NorthWest|i:0|e:System.Windows.Input.ModifierKeys,None
                EndNodeEdit|u:0x10000003|s:98|b:True
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None
                BeginDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:435.0|d:204.0
                EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:652.0|d:196.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None
                BeginDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:438.0|d:279.0
                EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:1|e:System.Windows.Input.ModifierKeys,None|d:652.0|d:211.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:1|e:System.Windows.Input.ModifierKeys,None
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None
                BeginDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:430.0|d:203.0
                EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:1|e:System.Windows.Input.ModifierKeys,None|d:648.0|d:212.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:1|e:System.Windows.Input.ModifierKeys,None
                UndoOperation
                RedoOperation";

            GraphController controller = new GraphController(null);
            bool result = controller.RunCommands(commands);
            Assert.AreEqual(true, result);

            IVisualNode node01 = controller.GetVisualNode(0x10000001);
            IVisualNode node02 = controller.GetVisualNode(0x10000002);
            IVisualNode node03 = controller.GetVisualNode(0x10000003);

            ISlot outputSlot = controller.GetSlot(0x30000004); // Output 0x10000002
            Assert.IsNotNull(outputSlot);
            ISlot inputSlot = controller.GetSlot(0x30000001); // Input 0x10000001
            Assert.IsNotNull(inputSlot);
            // Output slot 0x10000002 should connect to input slot 0x10000001.
            uint[] connecting = outputSlot.ConnectingSlots;
            Assert.IsNotNull(connecting);
            Assert.IsTrue(connecting.Contains((uint)0x30000001));

            ISlot outputSlot1 = controller.GetSlot(0x30000004); // Output 0x10000002
            Assert.IsNotNull(outputSlot1);
            ISlot inputSlot1 = controller.GetSlot(0x30000002); // Input 0x10000001
            Assert.IsNotNull(inputSlot1);
            // Output slot 0x10000002 should connect to input slot 0x10000001.
            uint[] connecting1 = outputSlot1.ConnectingSlots;
            Assert.IsNotNull(connecting1);
            Assert.IsTrue(connecting1.Contains((uint)0x30000002));

            ISlot outputSlot2 = controller.GetSlot(0x30000005); // Output 0x10000003
            //connecting2 = outputSlot2.ConnectingSlots;
            Assert.IsNull(outputSlot2.ConnectingSlots);

            Assert.AreEqual(3, controller.GetVisualNodes().Count); //Check if node count is 3
            Assert.IsTrue(new object[] { node01, node02, node03 }.All((object o)=>o!=null)); // Check if node is created
            Assert.AreEqual(NodeType.Function, node01.VisualType); // Check if node type is Function node
            Assert.AreEqual(NodeType.CodeBlock, node02.VisualType); // Check if node type is Code block node
            Assert.AreEqual(NodeType.CodeBlock, node02.VisualType); // Check if node type is Code block node
        }
开发者ID:samuto,项目名称:designscript,代码行数:75,代码来源:UndoRedoOperationTests.cs

示例10: RedoCreationOfSolidRevolve


//.........这里部分代码省略.........
                BeginDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000006|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None|d:815.0|d:680.0
                EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000006|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None|d:821.0|d:680.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000006|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000006|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None
                BeginDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000006|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:826.0|d:678.0
                EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000009|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:1|e:System.Windows.Input.ModifierKeys,None|d:993.0|d:543.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000009|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:1|e:System.Windows.Input.ModifierKeys,None
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000005|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None
                BeginDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000005|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:731.0|d:401.0
                EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000009|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:992.0|d:530.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000009|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                UndoOperation
                UndoOperation
                UndoOperation
                UndoOperation
                UndoOperation
                UndoOperation
                UndoOperation
                UndoOperation
                UndoOperation
                UndoOperation
                UndoOperation
                UndoOperation
                UndoOperation
                UndoOperation
                UndoOperation
                UndoOperation
                UndoOperation
                UndoOperation
                UndoOperation
                UndoOperation
                UndoOperation
                UndoOperation
                UndoOperation
                UndoOperation
                UndoOperation
                UndoOperation
                UndoOperation
                UndoOperation
                UndoOperation
                RedoOperation
                RedoOperation
                RedoOperation
                RedoOperation
                RedoOperation
                RedoOperation
                RedoOperation
                RedoOperation
                RedoOperation
                RedoOperation
                RedoOperation
                RedoOperation
                RedoOperation
                RedoOperation
                RedoOperation
                RedoOperation
                RedoOperation
                RedoOperation
                RedoOperation
                RedoOperation
                RedoOperation
                RedoOperation
                RedoOperation
                RedoOperation
                RedoOperation
                RedoOperation
                RedoOperation
                RedoOperation
                RedoOperation
                RedoOperation
                RedoOperation
                RedoOperation
                RedoOperation
                RedoOperation
                RedoOperation";

            GraphController controller = new GraphController(null);
            bool result = controller.RunCommands(commands);
            Assert.AreEqual(true, result);

            IVisualNode node01 = controller.GetVisualNode(0x10000001);// Function Node (Point)
            IVisualNode node02 = controller.GetVisualNode(0x10000002);// Code Block node (0)
            IVisualNode node03 = controller.GetVisualNode(0x10000003);// Function Node (Point)
            IVisualNode node04 = controller.GetVisualNode(0x10000004);// Code Block node (10)
            IVisualNode node05 = controller.GetVisualNode(0x10000005);// Function Node (Line)
            IVisualNode node06 = controller.GetVisualNode(0x10000006);// Function Node (Circle)
            IVisualNode node07 = controller.GetVisualNode(0x10000007);// Function Node (Point)
            IVisualNode node08 = controller.GetVisualNode(0x10000008);// Code Block node (5)
            IVisualNode node09 = controller.GetVisualNode(0x10000009);// Function Node (Solid)
            IVisualNode node10 = controller.GetVisualNode(0x1000000a);// Code Block node (1)

            Assert.AreEqual(10, controller.GetVisualNodes().Count); //Check if node count is 10
            Assert.NotNull(new object[] { node01, node02, node03, node04, node05, node06, node07, node08, node09, node10 }); // Check if all nodes are created
            Assert.AreEqual(NodeType.Function, node01.VisualType); // Check if node type Function Node Point
            Assert.AreEqual(NodeType.CodeBlock, node02.VisualType); // Check if node type is code block node
            Assert.AreEqual(NodeType.Function, node05.VisualType); // Check if node type Function Node Line
            Assert.AreEqual(NodeType.Function, node09.VisualType); // Check if node type Function Node Solid
        }
开发者ID:samuto,项目名称:designscript,代码行数:101,代码来源:UndoRedoOperationTests.cs

示例11: RedoConnectionLines

        public void RedoConnectionLines()
        {
            // Create one add node and two code block node.
            // Connect to code block nodes to input slots of add node.
            // Undo connection
            // Redo connection

            string commands = @"
                CreateFunctionNode|d:781.0|d:217.0|s:|s:+|s:double,double
                CreateCodeBlockNode|d:471.0|d:168.0|s:Double Click and type
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:0|e:System.Windows.Input.ModifierKeys,None
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:0|e:System.Windows.Input.ModifierKeys,None
                BeginNodeEdit|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,Text
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:0|e:System.Windows.Input.ModifierKeys,None
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                EndNodeEdit|u:0x10000002|s:9|b:True
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                CreateCodeBlockNode|d:482.0|d:274.0|s:Double Click and type
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:0|e:System.Windows.Input.ModifierKeys,None
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:0|e:System.Windows.Input.ModifierKeys,None
                BeginNodeEdit|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,Text
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:0|e:System.Windows.Input.ModifierKeys,None
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                EndNodeEdit|u:0x10000003|s:7|b:True
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None
                BeginDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:491.0|d:181.0
                EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:787.0|d:229.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None
                BeginDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:503.0|d:289.0
                EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:1|e:System.Windows.Input.ModifierKeys,None|d:789.0|d:242.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:1|e:System.Windows.Input.ModifierKeys,None
                UndoOperation
                UndoOperation
                RedoOperation
                RedoOperation";

            GraphController controller = new GraphController(null);
            bool result = controller.RunCommands(commands);
            Assert.AreEqual(true, result);

            IVisualNode node01 = controller.GetVisualNode(0x10000001);
            IVisualNode node02 = controller.GetVisualNode(0x10000002);
            IVisualNode node03 = controller.GetVisualNode(0x10000003);

            ISlot outputSlot = controller.GetSlot(0x30000001); // Output 0x10000002
            Assert.IsNotNull(outputSlot);
            ISlot inputSlot = controller.GetSlot(0x30000004); // Input 0x10000001
            Assert.IsNotNull(inputSlot);
            // Output slot 0x10000002 should connect to input slot 0x10000001.
            uint[] connecting = outputSlot.ConnectingSlots;
            Assert.IsNotNull(connecting);
            Assert.AreEqual(0x30000004, connecting[0]);

            ISlot outputSlot1 = controller.GetSlot(0x30000005); // Output 0x10000003
            Assert.IsNotNull(outputSlot1);
            ISlot inputSlot1 = controller.GetSlot(0x30000002); // Input 0x10000001
            Assert.IsNotNull(inputSlot1);
            // Output slot 0x10000003 should connect to input slot 0x10000001.
            uint[] connecting1 = outputSlot1.ConnectingSlots;
            Assert.IsNotNull(connecting1);
            Assert.AreEqual(0x30000002, connecting1[0]);

            Assert.AreEqual(3, controller.GetVisualNodes().Count); //Check if node count is 3
            Assert.NotNull(new object[] { node01, node02, node03 }); // Check if node is created
            Assert.AreEqual(NodeType.Function, node01.VisualType); // Check if node type is Function node
            Assert.AreEqual(NodeType.CodeBlock, node02.VisualType); // Check if node type is Code block node
            Assert.AreEqual(NodeType.CodeBlock, node02.VisualType); // Check if node type is Code block node
        }
开发者ID:samuto,项目名称:designscript,代码行数:72,代码来源:UndoRedoOperationTests.cs

示例12: UndoRedoMove_TestRedoOfSingleNodeMove

        public void UndoRedoMove_TestRedoOfSingleNodeMove()
        {
            // Create Add Node and move it to new position.
            // Do undo.
            // Do Redo

            string commands = @"
                CreateFunctionNode|d:562.0|d:180.0|s:|s:+|s:double,double
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None
                BeginDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None|d:654.0|d:195.0
                EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None|d:483.0|d:434.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None";

            GraphController controller = new GraphController(null);
            bool result = controller.RunCommands(commands);
            Assert.AreEqual(true, result);

            IVisualNode node01 = controller.GetVisualNode(0x10000001);// Add Node

            double X = node01.X;
            double Y = node01.Y;

            commands [email protected]"
                UndoOperation
                RedoOperation";

            bool result01 = controller.RunCommands(commands);
            Assert.AreEqual(true, result01);

            Assert.AreEqual(X, node01.X);
            Assert.AreEqual(Y, node01.Y);

            Assert.AreEqual(1, controller.GetVisualNodes().Count);
        }
开发者ID:samuto,项目名称:designscript,代码行数:34,代码来源:UndoRedoOperationTests.cs

示例13: UndoRedoMove_TestRedoOfNodeMoveMaintainConnections

        public void UndoRedoMove_TestRedoOfNodeMoveMaintainConnections()
        {
            // Create Two CodeBlock Nodes and one Add Node.
            // Connect both Code Block nodes to Add node.
            // Move both Clode Block nodes to new position one by one.
            // Do undo twice.
            // Do Redo twice.

            string commands = @"
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                CreateCodeBlockNode|d:369.0|d:166.0|s:
                BeginNodeEdit|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,NorthWest|i:0|e:System.Windows.Input.ModifierKeys,None
                EndNodeEdit|u:0x10000001|s:50|b:True
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                CreateCodeBlockNode|d:352.0|d:251.0|s:
                BeginNodeEdit|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,Text
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,NorthWest|i:0|e:System.Windows.Input.ModifierKeys,None
                EndNodeEdit|u:0x10000002|s:69|b:True
                CreateFunctionNode|d:519.0|d:226.0|s:|s:+|s:double,double
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None
                BeginDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:396.0|d:182.0
                EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:526.0|d:238.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None
                BeginDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:377.0|d:262.0
                EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:1|e:System.Windows.Input.ModifierKeys,None|d:525.0|d:252.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:1|e:System.Windows.Input.ModifierKeys,None
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:0|e:System.Windows.Input.ModifierKeys,None
                BeginDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:0|e:System.Windows.Input.ModifierKeys,None|d:385.0|d:176.0
                EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:0|e:System.Windows.Input.ModifierKeys,None|d:553.0|d:90.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:0|e:System.Windows.Input.ModifierKeys,None";

            GraphController controller = new GraphController(null);
            bool result = controller.RunCommands(commands);
            Assert.AreEqual(true, result);

            IVisualNode node01 = controller.GetVisualNode(0x10000001);// CodeBlock Node
            IVisualNode node02 = controller.GetVisualNode(0x10000002);// CodeBlock Node
            IVisualNode node03 = controller.GetVisualNode(0x10000003);// Add Node

            double X = node01.X;
            double Y = node01.Y;

            commands = @"
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:0|e:System.Windows.Input.ModifierKeys,None
                BeginDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:0|e:System.Windows.Input.ModifierKeys,None|d:366.0|d:265.0
                EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:0|e:System.Windows.Input.ModifierKeys,None|d:473.0|d:397.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:0|e:System.Windows.Input.ModifierKeys,None
                UndoOperation
                UndoOperation
                RedoOperation
                RedoOperation";

            Assert.AreEqual(X, node01.X);
            Assert.AreEqual(Y, node01.Y);

            ISlot outputSlot = controller.GetSlot(0x30000001); // Output of first CodeBlock ndoe.
            Assert.IsNotNull(outputSlot);
            ISlot inputSlot = controller.GetSlot(0x30000003); // First Input of Add Node.
            Assert.IsNotNull(inputSlot);
            // Output slot CoedBlock Node should connect to input slot Add node.
            uint[] connecting = outputSlot.ConnectingSlots;
            Assert.IsNotNull(connecting);
            Assert.IsTrue(connecting.Contains((uint)0x30000003));

            Assert.AreEqual(3, controller.GetVisualNodes().Count);
        }
开发者ID:samuto,项目名称:designscript,代码行数:72,代码来源:UndoRedoOperationTests.cs

示例14: UndoRedoMove_TestMovingOfAllTypesOfNodesUsingWindowSelection

        public void UndoRedoMove_TestMovingOfAllTypesOfNodesUsingWindowSelection()
        {
            // Create Code Blok, Identifier, Add, Dirver and two revolve Node (having 4 and 3 slots)
            // Now select all nodes using window selection.
            // Now move all nodes to new position
            // Do Undo
            string commands = @"
                CreateCodeBlockNode|d:368.0|d:124.0|s:Your code goes here
                BeginNodeEdit|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text
                EndNodeEdit|u:0x10000001|s:a = 10;|b:True
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                CreateDriverNode|d:574.0|d:133.0
                CreateIdentifierNode|d:678.0|d:231.0
                CreateFunctionNode|d:401.0|d:223.0|s:|s:+|s:double,double|s:value,value
                CreateFunctionNode|d:660.0|d:373.0|s:ProtoGeometry.dll|s:Solid.Revolve|s:Curve,Point,Vector,double,double
                CreateFunctionNode|d:754.0|d:158.0|s:ProtoGeometry.dll|s:Solid.Revolve|s:Curve,Point,Vector
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                BeginDrag|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None|d:947.0|d:516.0
                SelectComponent|u:0x10000001|e:System.Windows.Input.ModifierKeys,None
                SelectComponent|u:0x10000002|e:System.Windows.Input.ModifierKeys,None
                SelectComponent|u:0x10000003|e:System.Windows.Input.ModifierKeys,None
                SelectComponent|u:0x10000004|e:System.Windows.Input.ModifierKeys,None
                SelectComponent|u:0x10000005|e:System.Windows.Input.ModifierKeys,None
                SelectComponent|u:0x10000006|e:System.Windows.Input.ModifierKeys,None
                EndDrag|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None|d:337.0|d:82.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000004|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None
                BeginDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000004|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None|d:502.0|d:246.0
                EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000004|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None|d:423.0|d:438.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000004|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None";

            GraphController controller = new GraphController(null);
            bool result = controller.RunCommands(commands);
            Assert.AreEqual(true, result);

            IVisualNode node01 = controller.GetVisualNode(0x10000001);// Line
            IVisualNode node02 = controller.GetVisualNode(0x10000002);// Circle
            IVisualNode node03 = controller.GetVisualNode(0x10000003);// CodeBlock
            IVisualNode node04 = controller.GetVisualNode(0x10000004);// Line
            IVisualNode node05 = controller.GetVisualNode(0x10000005);// Circle
            IVisualNode node06 = controller.GetVisualNode(0x10000006);// CodeBlock

            double X = node01.X;
            double Y = node01.Y;
            double X1 = node02.X;
            double Y1 = node02.Y;
            double X2 = node03.X;
            double Y2 = node03.Y;
            double X3 = node04.X;
            double Y3 = node04.Y;
            double X4 = node05.X;
            double Y4 = node05.Y;
            double X5 = node06.X;
            double Y5 = node06.Y;

            commands = @"UndoOperation";
            bool result02 = controller.RunCommands(commands);
            Assert.AreEqual(true, result02);

            Assert.AreEqual(368.0, node01.X);
            Assert.AreEqual(124.0, node01.Y);

            Assert.AreEqual(574.0, node02.X);
            Assert.AreEqual(133.0, node02.Y);

            Assert.AreEqual(678.0, node03.X);
            Assert.AreEqual(231.0, node03.Y);

            Assert.AreEqual(401.0, node04.X);
            Assert.AreEqual(223.0, node04.Y);

            Assert.AreEqual(660.0, node05.X);
            Assert.AreEqual(373.0, node05.Y);

            Assert.AreEqual(754.0, node06.X);
            Assert.AreEqual(158.0, node06.Y);

            Assert.AreEqual(6, controller.GetVisualNodes().Count);
        }
开发者ID:samuto,项目名称:designscript,代码行数:80,代码来源:UndoRedoOperationTests.cs

示例15: UndoRedoMove_TestFunctionNodeWithNoInputSolt

        public void UndoRedoMove_TestFunctionNodeWithNoInputSolt()
        {
            // Create GeometrySettings, Reset and Identity nodes.
            // Do undo.
            // Do Redo

            string commands = @"MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000004|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None";

            GraphController controller = new GraphController(null);
            bool result = controller.RunCommands(commands);
            Assert.AreEqual(true, result);

            IVisualNode node01 = controller.GetVisualNode(0x10000001);// Point Node
            IVisualNode node02 = controller.GetVisualNode(0x10000002);// CodeBlock
            IVisualNode node03 = controller.GetVisualNode(0x10000003);// CodeBlock
            IVisualNode node04 = controller.GetVisualNode(0x10000004);// LIne Node
            IVisualNode node05 = controller.GetVisualNode(0x10000005);// Point Node

            double X = node01.X;
            double Y = node01.Y;
            double X1 = node02.X;
            double Y1 = node02.Y;
            double X2 = node03.X;
            double Y2 = node03.Y;
            double X3 = node04.X;
            double Y3 = node04.Y;
            double X4 = node05.X;
            double Y4 = node05.Y;

            commands = @"
                UndoOperation
                RedoOperation";

            Assert.AreEqual(X, node01.X);
            Assert.AreEqual(Y, node01.Y);
            Assert.AreEqual(X1, node02.X);
            Assert.AreEqual(Y1, node02.Y);
            Assert.AreEqual(X2, node03.X);
            Assert.AreEqual(Y2, node03.Y);
            Assert.AreEqual(X3, node04.X);
            Assert.AreEqual(Y3, node04.Y);
            Assert.AreEqual(X4, node05.X);
            Assert.AreEqual(Y4, node05.Y);

            ISlot outputSlot = controller.GetSlot(0x30000005); // Output of first CodeBlock ndoe.
            Assert.IsNotNull(outputSlot);
            ISlot inputSlot = controller.GetSlot(0x30000003); // First Input of Add Node.
            Assert.IsNotNull(inputSlot);
            // Output slot CoedBlock Node should connect to input slot Add node.
            uint[] connecting = outputSlot.ConnectingSlots;
            Assert.IsNotNull(connecting);
            Assert.IsTrue(connecting.Contains((uint)0x30000003));

            Assert.AreEqual("0", ((CodeBlockNode)node02).Text); // Check if text is 0
            Assert.AreEqual("10", ((CodeBlockNode)node03).Text);// Check if text is 10

            Assert.AreEqual(5, controller.GetVisualNodes().Count);
        }
开发者ID:samuto,项目名称:designscript,代码行数:58,代码来源:UndoRedoOperationTests.cs


注:本文中的DesignScriptStudio.Graph.Core.GraphController.GetVisualNodes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。