コード例 #1
0
        internal void ComposeOnDrawing(DrawingContext context)
        {
            GraphController controller = edgeController.GetGraphController();

            Slot  startSlot  = controller.GetSlot(this.StartSlotId) as Slot;
            Slot  endSlot    = controller.GetSlot(this.EndSlotId) as Slot;
            Point startPoint = startSlot.GetPosition();
            Point endPoint   = endSlot.GetPosition();

            UpdateControlPoint(startPoint, endPoint, startSlot.SlotType != SlotType.Output);
            DrawCurve(context, this.PreviewSelected);
        }
コード例 #2
0
        internal void UpdateControlPoint()
        {
            GraphController controller = edgeController.GetGraphController();
            Slot            startSlot  = controller.GetSlot(this.StartSlotId) as Slot;
            Slot            endSlot    = controller.GetSlot(this.EndSlotId) as Slot;
            Point           startPoint = startSlot.GetPosition();
            Point           endPoint   = endSlot.GetPosition();

            UpdateControlPoint(startPoint, endPoint, startSlot.SlotType != SlotType.Output);

            this.Dirty = true;
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        public void Defect_IDE_1387()
        {
            // Error message is when there is no error in the code.
            // create a Code Block with value "a=10;"
            // create another Code Block with value "b=a;"
            // After creating second Code Block error will pop up for variable 'a' hasn't been defined yet

            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:10343.0|d:10121.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=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
                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:10354.0|d:10201.0|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";

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

            IVisualNode node01 = controller.GetVisualNode(0x10000001);// Code Block Node
            IVisualNode node02 = controller.GetVisualNode(0x10000002);// Code Block Node

            Assert.IsEmpty(node02.ErrorMessage);

            // Check for Implicit connection
            ISlot outputSlot = controller.GetSlot(0x30000001); // Output 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));
        }
コード例 #5
0
        public uint GetInputSlot(int index)
        {
            if (inputSlots.Count <= 0 || index < 0)
            {
                return(uint.MaxValue);
            }
            if (index < 0 || index >= inputSlots.Count)
            {
                throw new IndexOutOfRangeException();
            }

            if (((Slot)graphController.GetSlot(inputSlots[index])).Visible)
            {
                return(inputSlots[index]);
            }
            else
            {
                return(uint.MaxValue);
            }
        }
コード例 #6
0
        internal VisualEdge(EdgeController edgeController, uint startSlotId, uint endSlotId, bool isImplicit)
        {
            this.edgeController = edgeController;
            if (isImplicit)
            {
                this.EdgeType = EdgeType.ImplicitConnection;
            }
            else
            {
                this.EdgeType = EdgeType.ExplicitConnection;
            }
            this.version     = VisualEdge.Version.Current;
            this.StartSlotId = startSlotId;
            this.EndSlotId   = endSlotId;

            // Generate new ID for this visual edge.
            GraphController graphController = edgeController.GetGraphController();
            IdGenerator     idGenerator     = graphController.GetIdGenerator();

            this.EdgeId = idGenerator.GetNextId(ComponentType.Edge);

            controlPoints.Add(new Point());
            controlPoints.Add(new Point());
            controlPoints.Add(new Point());
            controlPoints.Add(new Point());

            GraphController controller = edgeController.GetGraphController();
            Slot            startSlot  = controller.GetSlot(this.StartSlotId) as Slot;
            Slot            endSlot    = controller.GetSlot(this.EndSlotId) as Slot;

            if (startSlot != null && endSlot != null)
            {
                Point startPoint = startSlot.GetPosition();
                Point endPoint   = endSlot.GetPosition();
                UpdateControlPoint(startPoint, endPoint, startSlot.SlotType != SlotType.Output);
            }
            else
            {
                throw new ArgumentNullException("startSlot or endSlot");
            }
        }
コード例 #7
0
        public AuditStatus Audit()
        {
            GraphController controller = edgeController.GetGraphController();
            Slot            startSlot  = controller.GetSlot(this.StartSlotId) as Slot;
            Slot            endSlot    = controller.GetSlot(this.EndSlotId) as Slot;

            if (startSlot != null && endSlot != null)
            {
                Point startPoint      = startSlot.GetPosition();
                Point endPoint        = endSlot.GetPosition();
                bool  positionChanged = false;

                if (startSlot.SlotType == SlotType.Output)
                {
                    if (startPoint != controlPoints[0] || endPoint != controlPoints[3])
                    {
                        positionChanged = true;
                    }
                }
                else
                {
                    if (startPoint != controlPoints[3] || endPoint != controlPoints[0])
                    {
                        positionChanged = true;
                    }
                }

                if (positionChanged)
                {
                    UpdateControlPoint(startPoint, endPoint, startSlot.SlotType != SlotType.Output);
                    //this.Dirty = true;
                    //this.Compose();
                    return(AuditStatus.PersistentDataChanged);
                }
            }

            return(AuditStatus.NoChange);
        }
コード例 #8
0
        public void TestFunctionInputSlotClickingCrash()
        {
            // 1. Create "sin" function node (takes single argument).
            // 2. Click on second input slot (non-existence).
            // 3. Crashes.
            //
            string commands = @"
                CreateFunctionNode|d:684.0|d:129.0|s:Math.dll|s:sin|s:double
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None";

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

            ISlot slot = controller.GetSlot(0x30000001);
            Assert.IsNotNull(slot);
            Assert.IsNull(slot.ConnectingSlots);
        }
コード例 #9
0
        public void Test04DropEdgeOnInvalidSlot()
        {
            // 1. Create code block node with value of 123.
            // 2. Create "Add" function node.
            // 3. When start drawing edge from code block node while drop it in the output slot of the function node, no connection would be built
            //
            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:361.0|d:189.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:123|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
                CreateFunctionNode|d:566.0|d:234.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:395.0|d:202.0
                EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:691.0|d:262.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None";

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

            // Ensure all other slots are not connected!
            ISlot slot = controller.GetSlot(0x30000001);
            Assert.IsNotNull(slot);
            Assert.IsNull(slot.ConnectingSlots);

            slot = controller.GetSlot(0x30000002);
            Assert.IsNotNull(slot);
            Assert.IsNull(slot.ConnectingSlots);

            slot = controller.GetSlot(0x30000003);
            Assert.IsNotNull(slot);
            Assert.IsNull(slot.ConnectingSlots);

            slot = controller.GetSlot(0x30000004);
            Assert.IsNotNull(slot);
            Assert.IsNull(slot.ConnectingSlots);
        }
コード例 #10
0
ファイル: SlotTests.cs プロジェクト: samuto/designscript
        public void TestSlotConnections01()
        {
            // 1. Create 5 identifier nodes and one function node ( Max : with 2 input slots )
            // 2. connect output of first identifier to input of all 4 identifiers
            // 3. Connect output of one identifier to 2 slots of the Max function
            // 4. Connect output of another identifier to one input slot of the Max function ( the original connection to this slot gets deleted )

            string commands = @"
                    CreateIdentifierNode|d:561.0|d:189.0
                    CreateIdentifierNode|d:701.0|d:100.0
                    CreateIdentifierNode|d:743.0|d:193.0
                    CreateIdentifierNode|d:741.0|d:317.0
                    BeginDrag|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None|d:376.0|d:276.0
                    SelectComponent|u:0x10000001|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:621.0|d:328.0
                    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:638.0|d:349.0
                    CreateFunctionNode|d:509.0|d:423.0|s:Math.dll|s:Math.Max|s:int,int
                    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:596.0|d:206.0
                    EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:701.0|d:113.0
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None
                    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:597.0|d:210.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:746.0|d:208.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: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:596.0|d:210.0
                    EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000004|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:742.0|d:330.0
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000004|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None
                    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:596.0|d:212.0
                    EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000005|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:638.0|d:364.0
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000005|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|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,Caption|i:-1|e:System.Windows.Input.ModifierKeys,None|d:677.0|d:364.0
                    EndDrag|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None|d:495.0|d:410.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: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:674.0|d:365.0
                    EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000006|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:509.0|d:436.0
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000006|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|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:674.0|d:370.0
                    EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000006|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:1|e:System.Windows.Input.ModifierKeys,None|d:508.0|d:450.0
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000006|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:1|e:System.Windows.Input.ModifierKeys,None
                    MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000004|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None
                    BeginDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000004|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:777.0|d:335.0
                    EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000006|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:508.0|d:438.0
                    MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000006|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None";

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

            IVisualEdge edge = controller.GetVisualEdge(0x60000005);
            Assert.AreEqual(null, edge);
            edge = controller.GetVisualEdge(0x60000006);
            Assert.AreEqual(0x60000006, edge.EdgeId);

            ISlot outputSlot = controller.GetSlot(0x30000008);
            uint[] connecting = outputSlot.ConnectingSlots;
            Assert.IsNotNull(connecting);
            Assert.AreEqual(0x3000000b, connecting[0]);
        }
コード例 #11
0
        public void Defect_IDE_1429()
        {
            // IDE-1429: Implicit connection line shouldn't be selectable
            // Create a Code Block node with value "a" and another with value "c=a+b;"
            // After above step you will find there is a implicit connection between two code blocks. User should not be able to select this connection line neither detach nor delete should work for this line.

            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:15301.0|d:15187.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:15602.0|d:15202.0|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: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
                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:15400.0|d:15092.0
                EndDrag|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None|d:15561.0|d:15369.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                DeleteComponents";

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

            ISlot outputSlot = controller.GetSlot(0x30000001); //Output slot of first CBN.
            Assert.IsNotNull(outputSlot);
            ISlot inputSlot = controller.GetSlot(0x30000002); //Input slot of seocnd CBN.
            Assert.IsNotNull(inputSlot);
            //Output slot of first CBN should connect to Input slot second CBN node.
            uint[] connecting = outputSlot.ConnectingSlots;
            Assert.IsNotNull(connecting);
            Assert.IsTrue(connecting.Contains((uint)0x30000002));
        }
コード例 #12
0
        public void Test08NodeConnectionReplacement()
        {
            // 1. Create three nodes(two code block with value of 123 and one "Math.Sin").
            // 2. Connect the first code block node to the input of the function node.
            // 3. Try to Connect the second code block node to the input of the function node.
            // 4. Undo.
            // 5. Redo.
            //
            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:328.0|d:181.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:123|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:335.0|d:270.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:123|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
                CreateFunctionNode|d:519.0|d:230.0|s:Math.dll|s:Math.Sin|s: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:363.0|d:193.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:520.0|d:249.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:366.0|d:283.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:523.0|d:250.0
                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);
            Assert.IsNotNull(outputSlot);
            ISlot inputSlot = controller.GetSlot(0x30000003);
            Assert.IsNotNull(inputSlot);

            uint[] connecting = outputSlot.ConnectingSlots;
            Assert.IsNotNull(connecting);
            Assert.AreEqual(0x30000003, connecting[0]);
            connecting = inputSlot.ConnectingSlots;
            Assert.IsNotNull(connecting);
            Assert.AreEqual(0x30000001, connecting[0]);

            ISlot otherSlot = controller.GetSlot(0x30000002);
            Assert.IsNotNull(otherSlot);
            Assert.IsNull(otherSlot.ConnectingSlots);

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

            outputSlot = controller.GetSlot(0x30000002);
            Assert.IsNotNull(outputSlot);
            inputSlot = controller.GetSlot(0x30000003);
            Assert.IsNotNull(inputSlot);

            connecting = outputSlot.ConnectingSlots;
            Assert.IsNotNull(connecting);
            Assert.AreEqual(0x30000003, connecting[0]);
            connecting = inputSlot.ConnectingSlots;
            Assert.IsNotNull(connecting);
            Assert.AreEqual(0x30000002, connecting[0]);

            otherSlot = controller.GetSlot(0x30000001);
            Assert.IsNotNull(otherSlot);
            Assert.IsNull(otherSlot.ConnectingSlots);
        }
コード例 #13
0
        public void RedoRepositionAndDeletionOfNodesAndConnectionLines()
        {
            // Create Min Node from Math
            // Create Two Code block node by typing any values.
            // Connect Both code block nodes to input slots of Min node.
            // Move Min node, and also move both Code block nodes.
            // Now delete Both connection lines.(window selection)
            // Undo all
            // Redo all

            string commands = @"
                CreateFunctionNode|d:622.0|d:208.0|s:Math.dll|s:Math.Min|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:372.0|d:177.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: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
                CreateCodeBlockNode|d:371.0|d:249.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:20|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:395.0|d:190.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:628.0|d:220.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:394.0|d:264.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:628.0|d:234.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,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:387.0|d:191.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:392.0|d:154.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:0|e:System.Windows.Input.ModifierKeys,None
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:0|e:System.Windows.Input.ModifierKeys,None
                BeginDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:0|e:System.Windows.Input.ModifierKeys,None|d:386.0|d:265.0
                EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:0|e:System.Windows.Input.ModifierKeys,None|d:391.0|d:307.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:0|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
                BeginDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None|d:669.0|d:221.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:619.0|d:227.0
                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: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:515.0|d:354.0
                SelectComponent|u:0x60000001|e:System.Windows.Input.ModifierKeys,None
                SelectComponent|u:0x60000002|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:495.0|d:124.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                DeleteComponents
                UndoOperation
                UndoOperation
                UndoOperation
                UndoOperation
                UndoOperation
                UndoOperation
                RedoOperation
                RedoOperation
                RedoOperation
                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(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.AreEqual(0x30000001, connecting[0]);

            ISlot outputSlot1 = controller.GetSlot(0x30000005); // Output 0x10000002
            Assert.IsNotNull(outputSlot);
            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(connecting);
            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, node03.VisualType); // Check if node type is Code block node
        }
コード例 #14
0
        public void Test10EdgeReconnection()
        {
            // 1. Create one identifier node and two function node.
            // 2. Connect the identifier node and the first function node.
            // 3. Select the edge created by box selection on it.
            // 4. Mousedown on the end of the selected edge(on the side of the function node). Drag and drop it to the output of the second function node.
            // 5. Edge reconnected.
            //
            string commands = @"
                CreateIdentifierNode|d:371.0|d:189.0
                CreateFunctionNode|d:578.0|d:151.0|s:|s:+|s:double,double
                CreateFunctionNode|d:581.0|d:286.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:406.0|d:211.0
                EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:582.0|d:164.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000002|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
                BeginDrag|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None|d:488.0|d:173.0
                SelectComponent|u:0x60000001|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:518.0|d:205.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:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None
                BeginDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:580.0|d:165.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:585.0|d:301.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None";

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

            ISlot outputSlot = controller.GetSlot(0x30000002);
            Assert.IsNotNull(outputSlot);
            ISlot inputSlot = controller.GetSlot(0x30000006);
            Assert.IsNotNull(inputSlot);

            uint[] connecting = outputSlot.ConnectingSlots;
            Assert.IsNotNull(connecting);
            Assert.AreEqual(0x30000006, connecting[0]);
            connecting = inputSlot.ConnectingSlots;
            Assert.IsNotNull(connecting);
            Assert.AreEqual(0x30000002, connecting[0]);

            ISlot slot = controller.GetSlot(0x30000004);
            Assert.IsNotNull(slot);
            Assert.IsNull(slot.ConnectingSlots);
        }
コード例 #15
0
        public void TestLiteralInputSlotClicking()
        {
            // 1. Create a literal node.
            // 2. Click on the input slot of literal node (there's none).
            // 3. Crashes.
            //
            // Updated to exclude the last "MouseDown" command because with the
            // fix that command would not even occur (Literal node has got no
            // input slot so the NodePart.InputSlot will not even be sent.
            //
            // string commands = @"
            //     CreateNode|e:DesignScriptStudio.Graph.Core.NodeType,Literal|s:Literal|d:684.0|d:186.0
            //     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,None|i:1
            //     MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None";
            //
            string commands = @"
                CreateCodeBlockNode|d:684.0|d:186.0|s:Literal
                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,None|i:1|e:System.Windows.Input.ModifierKeys,None";

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

            // Ensure the literal node is created.
            IVisualNode node = controller.GetVisualNode(0x10000001);
            Assert.IsNotNull(node);
            Assert.AreEqual(NodeType.CodeBlock, node.VisualType);

            // Ensure the slot exists.
            ISlot slot = controller.GetSlot(0x30000001);
            Assert.IsNotNull(slot.Owners);
            Assert.AreEqual(0x10000001, slot.Owners[0]);

            // Ensure the only slot does not connect to other slots.
            Assert.IsNull(slot.ConnectingSlots);
        }
コード例 #16
0
        public void UndoRedoMove_TestRedoOfGeometryNodesWhenTheyAreConnectedToEachOther()
        {
            // Create Geometry Workflow to create lineusing two input points.
            // After joining all relevant connections select all of them using window selection from right bottom to left top.
            // Move them to new position.
            // Do undo.
            // Do Redo

            string commands = @"
                CreateFunctionNode|d:514.0|d:167.0|s:ProtoGeometry.dll|s:Point.ByCoordinates|s:double,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:347.0|d:147.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:0|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:347.0|d:233.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:10|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:364.0|d:161.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:516.0|d:181.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: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:364.0|d:158.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:516.0|d:195.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:362.0|d:160.0
                EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:2|e:System.Windows.Input.ModifierKeys,None|d:518.0|d:210.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:2|e:System.Windows.Input.ModifierKeys,None
                CreateFunctionNode|d:760.0|d:287.0|s:ProtoGeometry.dll|s:Line.ByStartPointEndPoint|s:Point,Point
                CreateFunctionNode|d:526.0|d:311.0|s:ProtoGeometry.dll|s:Point.ByCoordinates|s:double,double,double
                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:370.0|d:244.0
                EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000005|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:530.0|d:327.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000005|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:364.0|d:160.0
                EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000005|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:1|e:System.Windows.Input.ModifierKeys,None|d:529.0|d:339.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000005|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:363.0|d:161.0
                EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000005|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:2|e:System.Windows.Input.ModifierKeys,None|d:530.0|d:353.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000005|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:2|e:System.Windows.Input.ModifierKeys,None
                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:638.0|d:214.0
                EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000004|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:766.0|d:300.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000004|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|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:649.0|d:356.0
                EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000004|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:1|e:System.Windows.Input.ModifierKeys,None|d:769.0|d:313.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000004|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|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
                BeginDrag|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None|d:927.0|d:441.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:0x60000001|e:System.Windows.Input.ModifierKeys,None
                SelectComponent|u:0x60000002|e:System.Windows.Input.ModifierKeys,None
                SelectComponent|u:0x60000003|e:System.Windows.Input.ModifierKeys,None
                SelectComponent|u:0x60000004|e:System.Windows.Input.ModifierKeys,None
                SelectComponent|u:0x60000005|e:System.Windows.Input.ModifierKeys,None
                SelectComponent|u:0x60000006|e:System.Windows.Input.ModifierKeys,None
                SelectComponent|u:0x60000007|e:System.Windows.Input.ModifierKeys,None
                SelectComponent|u:0x60000008|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:317.0|d:91.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: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:578.0|d:192.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:878.0|d:84.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);// 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); // Input of Point 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);
        }
コード例 #17
0
        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);
        }
コード例 #18
0
        public void Test16DeleteComponentWithEdge()
        {
            // 1. create two function node and draw an edge in between
            // 2. select the first node and delete
            // 3. undo
            //
            string commands = @"CreateFunctionNode|d:336.0|d:178.0|s:DesignScriptStudio.Tests.dll|s:House.ByWidthHeight|s:double,double
                CreateFunctionNode|d:650.0|d:162.0|s:DesignScriptStudio.Tests.dll|s:House.ByWidthHeight|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:466.0|d:215.0
                EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:658.0|d:176.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000002|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
                BeginDrag|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None|d:547.0|d:184.0
                SelectComponent|u:0x60000001|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:565.0|d:210.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                DeleteComponents";

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

            IVisualNode node01 = controller.GetVisualNode(0x10000001);
            IVisualNode node02 = controller.GetVisualNode(0x10000002);
            IVisualEdge edge = controller.GetVisualEdge(0x60000001);
            Assert.IsNotNull(node01);
            Assert.IsNotNull(node02);
            Assert.IsNull(edge);

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

            node01 = controller.GetVisualNode(0x10000001);
            node02 = controller.GetVisualNode(0x10000002);
            IVisualEdge edge1 = controller.GetVisualEdge(0x60000001);
            Assert.IsNotNull(node01);
            Assert.IsNotNull(node02);
            Assert.IsNotNull(edge1);

            ISlot outputSlot = controller.GetSlot(0x30000003);
            Assert.IsNotNull(outputSlot);
            ISlot inputSlot = controller.GetSlot(0x30000004);
            Assert.IsNotNull(inputSlot);

            uint[] connecting = outputSlot.ConnectingSlots;
            Assert.IsNotNull(connecting);
            Assert.AreEqual(0x30000004, connecting[0]);
            connecting = inputSlot.ConnectingSlots;
            Assert.IsNotNull(connecting);
            Assert.AreEqual(0x30000003, connecting[0]);

            ISlot slot = controller.GetSlot(0x30000001);
            Assert.IsNotNull(slot);
            Assert.IsNull(slot.ConnectingSlots);

            slot = controller.GetSlot(0x30000002);
            Assert.IsNotNull(slot);
            Assert.IsNull(slot.ConnectingSlots);

            slot = controller.GetSlot(0x30000005);
            Assert.IsNotNull(slot);
            Assert.IsNull(slot.ConnectingSlots);

            slot = controller.GetSlot(0x30000006);
            Assert.IsNotNull(slot);
            Assert.IsNull(slot.ConnectingSlots);
        }
コード例 #19
0
        public void Test14ConnectionReplacementafterUndoDelete()
        {
            // 1.1 Create three nodes code block nodes
            // 1.2 Connect the first node to identifier
            // 1.3 Try to Connect the second one to the same identifier
            // 1.4 Try to Connect the third one to the same identifier
            //
            string commands = @"
                CreateCodeBlockNode|d:351.0|d:210.0|s:Double Click and type
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:0|e:System.Windows.Input.ModifierKeys,None
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:0|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: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
                EndNodeEdit|u:0x10000001|s:100|b:True
                CreateCodeBlockNode|d:355.0|d:260.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:200|b:True
                CreateFunctionNode|d:474.0|d:241.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:382.0|d:226.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:476.0|d:254.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None";

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

            ISlot outputSlot = controller.GetSlot(0x30000001);
            Assert.IsNotNull(outputSlot);
            ISlot inputSlot = controller.GetSlot(0x30000003);
            Assert.IsNotNull(inputSlot);

            uint[] connecting = outputSlot.ConnectingSlots;
            Assert.IsNotNull(connecting);
            Assert.IsTrue(connecting.Contains((uint)0x30000003));

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

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

            ISlot outputSlot2 = controller.GetSlot(0x30000001);
            Assert.IsNotNull(outputSlot2);

            uint[] connecting2 = outputSlot2.ConnectingSlots;
            Assert.IsNull(connecting2);
            commands = @"UndoOperation";

            bool result3 = controller.RunCommands(commands);

            ISlot outputSlot3 = controller.GetSlot(0x30000001);
            Assert.IsNotNull(outputSlot3);
            ISlot inputSlot3 = controller.GetSlot(0x30000003);
            Assert.IsNotNull(inputSlot3);

            uint[] connecting3 = outputSlot3.ConnectingSlots;
            Assert.IsNotNull(connecting3);
            Assert.IsTrue(connecting3.Contains((uint)0x30000003));

            commands = @"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:388.0|d:276.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:478.0|d:256.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None";

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

            ISlot outputSlot4 = controller.GetSlot(0x30000002);
            Assert.IsNotNull(outputSlot4);
            ISlot inputSlot4 = controller.GetSlot(0x30000003);
            Assert.IsNotNull(inputSlot4);

            uint[] connecting4 = outputSlot4.ConnectingSlots;
            Assert.IsNotNull(connecting4);
            Assert.IsTrue(connecting4.Contains((uint)0x30000003));
        }
コード例 #20
0
        public void Test13ConnectionReplacementMultiple()
        {
            // 1.1 Create three nodes code block nodes
            // 1.2 Connect the first node to identifier
            // 1.3 Try to Connect the second one to the same identifier
            // 1.4 Try to Connect the third one to the same identifier
            //
            string commands = @"
                CreateCodeBlockNode|d:300.0|d:266.0|s:Double Click and type
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:0|e:System.Windows.Input.ModifierKeys,None
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:0|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: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
                EndNodeEdit|u:0x10000001|s:100|b:True
                CreateCodeBlockNode|d:304.0|d:308.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:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None
                EndNodeEdit|u:0x10000002|s:200|b:True
                CreateCodeBlockNode|d:308.0|d:353.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:300|b:True
                CreateIdentifierNode|d:472.0|d:305.0
                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:328.0|d:281.0
                EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000004|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:475.0|d:320.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000004|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None";

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

            ISlot outputSlot = controller.GetSlot(0x30000001);
            Assert.IsNotNull(outputSlot);
            ISlot inputSlot = controller.GetSlot(0x30000004);
            Assert.IsNotNull(inputSlot);

            uint[] connecting = outputSlot.ConnectingSlots;
            Assert.IsNotNull(connecting);
            Assert.IsTrue(connecting.Contains((uint)0x30000004));

            commands = @"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:333.0|d:321.0
                EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000004|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:475.0|d:320.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000004|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None";

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

            ISlot outputSlot2 = controller.GetSlot(0x30000002);
            Assert.IsNotNull(outputSlot2);
            ISlot inputSlot2 = controller.GetSlot(0x30000004);
            Assert.IsNotNull(inputSlot2);

            uint[] connecting2 = outputSlot2.ConnectingSlots;
            Assert.IsNotNull(connecting2);
            Assert.IsTrue(connecting2.Contains((uint)0x30000004));

            commands = @"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:336.0|d:371.0
                EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000004|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:478.0|d:319.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000004|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None";

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

            ISlot outputSlot3 = controller.GetSlot(0x30000003);
            Assert.IsNotNull(outputSlot3);
            ISlot inputSlot3 = controller.GetSlot(0x30000004);
            Assert.IsNotNull(inputSlot3);

            uint[] connecting3 = outputSlot3.ConnectingSlots;
            Assert.IsNotNull(connecting3);
            Assert.IsTrue(connecting3.Contains((uint)0x30000004));
        }
コード例 #21
0
        public void Test11EdgeReconnection()
        {
            // 1. Create two code block nodes with value of 123 and three function nodes("Math.Sin").
            // 2. Connect the first literal node to the first two function nodes.
            // 3. Connect the second literal node to the third function node.
            // 3. Select the second edge (i.e. connecting the first code block node to the second function node) by box selection on it.
            // 4. Mousedown on either end of the selected edge. Drag and drop it to the output of the second code block node.
            // 5. Edge reconnected
            //
            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:338.0|d:147.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:123|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:381.0|d:278.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:123|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
                CreateFunctionNode|d:632.0|d:115.0|s:Math.dll|s:Math.Sin|s:double
                CreateFunctionNode|d:643.0|d:208.0|s:Math.dll|s:Math.Sin|s:double
                CreateFunctionNode|d:634.0|d:299.0|s:Math.dll|s:Math.Sin|s: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:370.0|d:161.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:633.0|d:135.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: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:372.0|d:163.0
                EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000004|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:645.0|d:228.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000004|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:415.0|d:291.0
                EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000005|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:643.0|d:318.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000005|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
                BeginDrag|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None|d:523.0|d:176.0
                SelectComponent|u:0x60000002|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:595.0|d:272.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: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:371.0|d:164.0
                EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:416.0|d:293.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None";

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

            ISlot outputSlot = controller.GetSlot(0x30000001);
            Assert.IsNotNull(outputSlot);
            ISlot inputSlot = controller.GetSlot(0x30000003);
            Assert.IsNotNull(inputSlot);

            uint[] connecting = outputSlot.ConnectingSlots;
            Assert.IsNotNull(connecting);
            Assert.AreEqual(0x30000003, connecting[0]);
            connecting = inputSlot.ConnectingSlots;
            Assert.IsNotNull(connecting);
            Assert.AreEqual(0x30000001, connecting[0]);

            outputSlot = controller.GetSlot(0x30000002);
            Assert.IsNotNull(outputSlot);
            inputSlot = controller.GetSlot(0x30000007);
            Assert.IsNotNull(inputSlot);

            connecting = outputSlot.ConnectingSlots;
            Assert.IsNotNull(connecting);
            Assert.AreEqual(0x30000007, connecting[0]);
            connecting = inputSlot.ConnectingSlots;
            Assert.IsNotNull(connecting);
            Assert.AreEqual(0x30000002, connecting[0]);

            outputSlot = controller.GetSlot(0x30000002);
            Assert.IsNotNull(outputSlot);
            inputSlot = controller.GetSlot(0x30000005);
            Assert.IsNotNull(inputSlot);

            connecting = outputSlot.ConnectingSlots;
            Assert.IsNotNull(connecting);
            Assert.AreEqual(0x30000005, connecting[1]);
            connecting = inputSlot.ConnectingSlots;
            Assert.IsNotNull(connecting);
            Assert.AreEqual(0x30000002, connecting[0]);

            ISlot slot = controller.GetSlot(0x30000004);
            Assert.IsNotNull(slot);
            Assert.IsNull(slot.ConnectingSlots);

            slot = controller.GetSlot(0x30000006);
            Assert.IsNotNull(slot);
            Assert.IsNull(slot.ConnectingSlots);

            slot = controller.GetSlot(0x30000008);
            Assert.IsNotNull(slot);
            Assert.IsNull(slot.ConnectingSlots);
        }
コード例 #22
0
        public void Defect_IDE_1767()
        {
            // Steps are ,e

            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:15329.0|d:15185.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,Text|i:-1|e:System.Windows.Input.ModifierKeys,None
                EndNodeEdit|u:0x10000001|s:a=1+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:15472.4|d:15277.8|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,Text|i:-1|e:System.Windows.Input.ModifierKeys,None
                EndNodeEdit|u:0x10000002|s:1+1;\na+b;\n\n1..20;|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:15509.2|d:15167.4|s:
                BeginNodeEdit|u:0x10000003|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:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None
                EndNodeEdit|u:0x10000003|s:b=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";

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

            IVisualNode node01 = controller.GetVisualNode(0x10000001);// Code Block Node
            IVisualNode node02 = controller.GetVisualNode(0x10000002);// Code Block Node

            ISlot outputSlot01 = controller.GetSlot(0x30000001);
            Assert.IsNotNull(outputSlot01);
            ISlot inputSlot01 = controller.GetSlot(0x30000002);
            Assert.IsNotNull(inputSlot01);
            uint[] connecting01 = outputSlot01.ConnectingSlots;
            Assert.IsNotNull(connecting01);
            Assert.IsTrue(connecting01.Contains((uint)0x30000002));

            ISlot outputSlot02 = controller.GetSlot(0x30000001);
            Assert.IsNotNull(outputSlot02);
            ISlot inputSlot02 = controller.GetSlot(0x30000002);
            Assert.IsNotNull(inputSlot02);
            uint[] connecting02 = outputSlot02.ConnectingSlots;
            Assert.IsNotNull(connecting02);
            Assert.IsTrue(connecting02.Contains((uint)0x30000002));

            Assert.IsEmpty(node01.ErrorMessage);
            Assert.IsEmpty(node02.ErrorMessage);

            Assert.AreEqual(3, controller.GetVisualNodes().Count);
        }
コード例 #23
0
        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
        }
コード例 #24
0
        public void Defect_IDE_1472()
        {
            // IDE-1472: [CRASH] while redoing implicit connection line.
            // Create two CBN with values "a=1;" and "b=a;".
            // Now do Undo and then Redo.
            // After redo DSS is crashing.

            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:10376.0|d:10162.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:10396.0|d:10252.0|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
                UndoOperation
                RedoOperation";

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

            Assert.AreEqual(2, controller.GetVisualNodes().Count); // Check if there are 4 nodes.

            // Check for Implicit connection
            ISlot outputSlot = controller.GetSlot(0x30000001); // Output 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));
        }
コード例 #25
0
        public void Test18ConnectionReplacement()
        {
            // Create some code block nodes and function nodes
            // Replace the connection
            //
            string commands = @"
                CreateCodeBlockNode|d:337.0|d:128.0|s:Double Click and type
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:0|e:System.Windows.Input.ModifierKeys,None
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:0|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: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:0x10000001|s:123|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:362.0|d:233.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:456|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
                CreateFunctionNode|d:549.0|d:187.0|s:|s:Range|s:double,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:372.0|d:142.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:550.0|d:199.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None";

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

            ISlot outputSlot = controller.GetSlot(0x30000001);
            Assert.IsNotNull(outputSlot);
            ISlot inputSlot = controller.GetSlot(0x30000003);
            Assert.IsNotNull(inputSlot);

            uint[] connecting = outputSlot.ConnectingSlots;
            Assert.IsNotNull(connecting);
            Assert.IsTrue(connecting.Contains((uint)0x30000003));

            commands = @"
                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:394.0|d:249.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:550.0|d:201.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None";

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

            ISlot outputSlot2 = controller.GetSlot(0x30000002);
            Assert.IsNotNull(outputSlot2);
            ISlot inputSlot2 = controller.GetSlot(0x30000003);
            Assert.IsNotNull(inputSlot2);

            uint[] connecting2 = outputSlot2.ConnectingSlots;
            Assert.IsNotNull(connecting2);
            Assert.IsTrue(connecting2.Contains((uint)0x30000003));
        }
コード例 #26
0
        public void Test09EdgeReconnection()
        {
            // 1. Create three nodes(two code block with value of 123 and one "Math.Sin").
            // 2. Connect the first code block node to the input of the function node.
            // 3. Select the edge created by box selection on it.
            // 4. Mousedown on the end of the selected edge(on side of the code block node). Drag and drop it to the output of the second code block node.
            // 5. Edge reconnected.
            //
            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:360.0|d:122.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:123|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:376.0|d:254.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:123|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
                CreateFunctionNode|d:538.0|d:175.0|s:Math.dll|s:Math.Sin|s: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:394.0|d:133.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:542.0|d:195.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: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:445.0|d:130.0
                SelectComponent|u:0x60000001|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:483.0|d:220.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: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:395.0|d:137.0
                EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:410.0|d:270.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None";

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

            ISlot outputSlot = controller.GetSlot(0x30000002);
            Assert.IsNotNull(outputSlot);
            ISlot inputSlot = controller.GetSlot(0x30000003);
            Assert.IsNotNull(inputSlot);

            uint[] connecting = outputSlot.ConnectingSlots;
            Assert.IsNotNull(connecting);
            Assert.AreEqual(0x30000003, connecting[0]);
            connecting = inputSlot.ConnectingSlots;
            Assert.IsNotNull(connecting);
            Assert.AreEqual(0x30000002, connecting[0]);

            ISlot slot = controller.GetSlot(0x30000001);
            Assert.IsNotNull(slot);
            Assert.IsNull(slot.ConnectingSlots);
        }
コード例 #27
0
        public void UndoRedoMove_TestNodeDeletionAfterMoveAndThenRedoEverything()
        {
            // Create two code block nodes.
            // Create one Add node.
            // Connect both CodeBlock nodes to Add node.
            // Move second CodeBlock node to new position.
            // Delete moved node.
            // Do undo.
            // Do Undo.
            // Do Redo.
            // Do Redo.

            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:373.0|d:138.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:97|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:409.0|d:286.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:61|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
                CreateFunctionNode|d:633.0|d:205.0|s:|s:Add|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:398.0|d:150.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:635.0|d:218.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:436.0|d:299.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:638.0|d:231.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: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:426.0|d:300.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:544.0|d:463.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000002|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);// Max Node

            double X1 = node02.X;
            double Y1 = node02.Y;

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

            Assert.AreEqual(X1, node02.X);
            Assert.AreEqual(Y1, node02.Y);

            ISlot outputSlot = controller.GetSlot(0x30000002); // Output of first CodeBlock ndoe.
            Assert.IsNotNull(outputSlot);
            ISlot inputSlot = controller.GetSlot(0x30000004); // First Input of Add Node.
            Assert.IsNotNull(inputSlot);
            // Output slot CoedBlock Node should connect to input slot Max node.
            uint[] connecting = outputSlot.ConnectingSlots;
            Assert.IsNotNull(connecting);
            Assert.IsTrue(connecting.Contains((uint)0x30000004));
            Assert.AreEqual("97;", ((CodeBlockNode)node01).Text); // Check if text is 97
            Assert.AreEqual("61;", ((CodeBlockNode)node02).Text);// Check if text is 61
            Assert.AreEqual(3, controller.GetVisualNodes().Count);

            commands = @"RedoOperation";
            bool result03 = controller.RunCommands(commands);
            Assert.AreEqual(true, result03);

            Assert.AreEqual(2, controller.GetVisualNodes().Count);
        }
コード例 #28
0
        public void Test18_IDE1224()
        {
            //1. create two code block nodes
            //2. connect one of them to the identifier/ any functional node
            //3. select the conection and remove the connection from the input slot of identifier
            //4. reattach it to the same input of the identifier node
            //5. try to connect the other code block to the same input and its possible

            string commands = @"CreateIdentifierNode|d:374.0|d:188.0
                CreateFunctionNode|d:511.0|d:142.0|s:|s:+|s:double,double
                CreateFunctionNode|d:525.0|d:283.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:405.0|d:210.0
                EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:515.0|d:157.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None
                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:409.0|d:208.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:533.0|d:296.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,Text|i:-1|e:System.Windows.Input.ModifierKeys,None
                BeginDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None|d:601.0|d:154.0
                EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None|d:657.0|d:90.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000002|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);

            ISlot outputSlot = controller.GetSlot(0x30000002);
            Assert.IsNotNull(outputSlot);
            ISlot inputSlot = controller.GetSlot(0x30000003);
            Assert.IsNotNull(inputSlot);

            uint[] connecting = outputSlot.ConnectingSlots;
            Assert.IsNotNull(connecting);
            Assert.AreEqual(0x30000003, connecting[0]);
            connecting = inputSlot.ConnectingSlots;
            Assert.IsNotNull(connecting);
            Assert.AreEqual(0x30000002, connecting[0]);

            ISlot slot = controller.GetSlot(0x30000001);
            Assert.IsNotNull(slot);
            Assert.IsNull(slot.ConnectingSlots);
        }
コード例 #29
0
        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);
        }
コード例 #30
0
        public void Test19Reconnection()
        {
            // Create some code block nodes and function node 3 slot
            // Replace the connection
            //
            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:377.0|d:147.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:123|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:393.0|d:245.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:146|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
                CreateFunctionNode|d:538.0|d:186.0|s:|s:Range|s:double,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:411.0|d:160.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:538.0|d:200.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: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:455.0|d:152.0
                SelectComponent|u:0x60000001|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:493.0|d:203.0
                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);

            ISlot outputSlot = controller.GetSlot(0x30000001);
            Assert.IsNotNull(outputSlot);
            ISlot inputSlot = controller.GetSlot(0x30000003);
            Assert.IsNotNull(inputSlot);

            uint[] connecting = outputSlot.ConnectingSlots;
            Assert.IsNotNull(connecting);
            Assert.IsTrue(connecting.Contains((uint)0x30000003));

            commands = @"
                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:412.0|d:164.0
                EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:427.0|d:261.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,OutputSlot|i:0|e:System.Windows.Input.ModifierKeys,None";

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

            ISlot outputSlot2 = controller.GetSlot(0x30000002);
            Assert.IsNotNull(outputSlot2);
            ISlot inputSlot2 = controller.GetSlot(0x30000003);
            Assert.IsNotNull(inputSlot2);

            uint[] connecting2 = outputSlot2.ConnectingSlots;
            Assert.IsNotNull(connecting2);
            Assert.IsTrue(connecting2.Contains((uint)0x30000003));
        }
コード例 #31
0
        public void RedoCreationAndConnectionOfTwoNodes()
        {
            // Create CodeBlockNode
            // Create IdentifierNode
            // Connect Both Nodes.
            // Undo all
            // Redo all
            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:375.0|d:219.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:100|b:True
                CreateIdentifierNode|d:573.0|d:237.0
                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:408.0|d:232.0
                EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:576.0|d:252.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None
                UndoOperation
                UndoOperation
                UndoOperation
                RedoOperation
                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);

            ISlot outputSlot = controller.GetSlot(0x30000001); // Output 0x10000001
            Assert.IsNotNull(outputSlot);
            ISlot inputSlot = controller.GetSlot(0x30000002); // Input 0x10000002
            Assert.IsNotNull(inputSlot);

            // Output slot 0x30000001 should connect to input slot 0x30000003.
            uint[] connecting = outputSlot.ConnectingSlots;
            Assert.IsNotNull(connecting);
            Assert.AreEqual(0x30000002, connecting[0]);

            Assert.AreEqual(2, controller.GetVisualNodes().Count); //Check if node count is 2
            Assert.NotNull(new object[] { node01, node02 }); // Check if node is created
            Assert.AreEqual(NodeType.CodeBlock, node01.VisualType); // Check if node type is code block node
            Assert.AreEqual(NodeType.Identifier, node02.VisualType); // Check if node type is identifier block node
        }
コード例 #32
0
        public void Test20Reconnection()
        {
            // Create some code block nodes and identifier
            // Replace the connection
            //
            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:322.0|d:140.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:123|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:358.0|d:275.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:146|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:511.0|d:209.0
                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:355.0|d:153.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:519.0|d:225.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None";

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

            ISlot outputSlot = controller.GetSlot(0x30000001);
            Assert.IsNotNull(outputSlot);
            ISlot inputSlot = controller.GetSlot(0x30000003);
            Assert.IsNotNull(inputSlot);

            uint[] connecting = outputSlot.ConnectingSlots;
            Assert.IsNotNull(connecting);
            Assert.IsTrue(connecting.Contains((uint)0x30000003));

            commands = @"
                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:389.0|d:288.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:511.0|d:225.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000003|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None";

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

            ISlot outputSlot2 = controller.GetSlot(0x30000002);
            Assert.IsNotNull(outputSlot2);
            ISlot inputSlot2 = controller.GetSlot(0x30000003);
            Assert.IsNotNull(inputSlot2);

            uint[] connecting2 = outputSlot2.ConnectingSlots;
            Assert.IsNotNull(connecting2);
            Assert.IsTrue(connecting2.Contains((uint)0x30000003));
        }
コード例 #33
0
        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
        }
コード例 #34
0
        public void Defect_IDE_1040()
        {
            //http://adsk-oss.myjetbrains.com/youtrack/issue/IDE-1040//
            // Dragging the wire all the way to the top of input parameter should snap the connection to the input slot

            string commands = @"
                CreateIdentifierNode|d:10373.0|d:10296.0
                CreateFunctionNode|d:10600.0|d:10326.0|s:|s:Range|s:double,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
                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:10419.0|d:10311.0
                EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,InputLabel|i:0|e:System.Windows.Input.ModifierKeys,None|d:10649.0|d:10336.0
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,InputLabel|i:0|e:System.Windows.Input.ModifierKeys,None";

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

            ISlot outputSlot = controller.GetSlot(0x30000002); // Output of Identifier Node.
            Assert.IsNotNull(outputSlot);
            ISlot inputSlot = controller.GetSlot(0x30000003); // First Input slot of Range node.
            Assert.IsNotNull(inputSlot);
            // Output slot Identifier Node should connect to first input slot range node.
            uint[] connecting = outputSlot.ConnectingSlots;
            Assert.IsNotNull(connecting);
            Assert.IsTrue(connecting.Contains((uint)0x30000003));
        }
コード例 #35
0
        private void GetFunctionNodeMenuItems()
        {
            ObservableCollection <LibraryItem> libraryItems = new ObservableCollection <LibraryItem>();

            libraryItemCollection = new Dictionary <int, LibraryItem>();
            VisualNode               node              = graphController.GetVisualNode(this.nodeId);
            FunctionNode             fNode             = (FunctionNode)node;
            Dictionary <int, string> functionNodeItems = new Dictionary <int, string>();

            if (node.GetAssembly() == null || node.ReturnType == null)
            {
                return;
            }
            string[] assemblies  = (node.GetAssembly()).Split(',');
            string[] returnTypes = (node.ReturnType.Split(','));

            switch (nodePart)
            {
            case NodePart.NorthEast:
                //case NodePart.South:
                this.GetMethodsAndProperties(assemblies, returnTypes, libraryItems);
                break;

            case NodePart.North:
                if (fNode.MemberType == LibraryItem.MemberType.Constructor)
                {
                    libraryItems = CoreComponent.Instance.GetConstructors(fNode.Assembly, fNode.QualifiedName);
                }
                else if (fNode.MemberType == LibraryItem.MemberType.InstanceMethod)
                {
                    string   argumentTypes    = fNode.ArgumentTypes;
                    string[] tempArray        = argumentTypes.Split(',');
                    string   parentReturnType = tempArray[0];
                    if (parentReturnType == "this")
                    {
                        uint   slotId          = node.GetInputSlot(0);
                        ISlot  slot            = graphController.GetSlot(slotId);
                        uint[] connectingSlots = slot.ConnectingSlots;
                        if (connectingSlots != null)
                        {
                            ISlot      parentSlot = graphController.GetSlot(connectingSlots[0]);
                            VisualNode visualNode = graphController.GetVisualNode(parentSlot.Owners[0]);
                            parentReturnType = visualNode.ReturnType;
                            string[] tempParent = { parentReturnType };
                            this.GetMethodsAndProperties(assemblies, tempParent, libraryItems);
                            //libraryItems = CoreComponent.Instance.GetMethodsAndProperties(fNode.Assembly, parentReturnType);
                        }
                    }
                    else
                    {
                        libraryItems = CoreComponent.Instance.GetMethodsAndProperties(fNode.Assembly, parentReturnType);
                    }
                }
                break;

            case NodePart.NorthWest:
                Dictionary <int, string> temp = new Dictionary <int, string>();
                this.GetNodeOptions(this.nodeId, out temp);
                functionNodeItems = temp;
                break;

            default:
                break;
            }

            this.PopulateItems(libraryItems);
            return;
        }
コード例 #36
0
        public void Defect_IDE_1333()
        {
            // Dropping a connection line in empty space in canvas should disconnect the node
            // Create two code Block node with any value and connect them to Add node.
            // Now Select one of the connection line and disconnect it from Add node and drop it in empty space in canvas.
            // After above step, the connection should get disconnected, but with current implementation it is again connecting back to Add node.

            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:10272.0|d:10329.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:2|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:10432.71428571|d:10346.0
                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:10294.42857143|d:10342.57142857
                EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:10428.71428571|d:10358.57142857
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None";

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

            ISlot outputSlot = controller.GetSlot(0x30000001); // Output of first CodeBlock ndoe.
            Assert.IsNotNull(outputSlot);
            ISlot inputSlot = controller.GetSlot(0x30000002); // Input of Identifier 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)0x30000002));

               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
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x00000000|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
                SelectComponent|u:0x60000001|e:System.Windows.Input.ModifierKeys,None
                MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None
                BeginDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,InputSlot|i:0|e:System.Windows.Input.ModifierKeys,None|d:10428.14285714|d:10360.85714286
                EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x00000000|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None|d:10360.71428571|d:10408.85714286
                MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x00000000|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None";

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

            ISlot outputSlot01 = controller.GetSlot(0x30000001); // Output of first CodeBlock ndoe.
            Assert.IsNotNull(outputSlot01);
            ISlot inputSlot01 = controller.GetSlot(0x30000002); // Input of Identifier Node.
            Assert.IsNotNull(inputSlot01);
            // Output slot CoedBlock Node should not connected to input slot Identifier node.
            uint[] connecting01 = outputSlot01.ConnectingSlots;
            Assert.IsNull(connecting01);
            //Assert.IsFalse(connecting.Contains((uint)0x30000002));
        }