本文整理汇总了C#中DesignScriptStudio.Graph.Core.GraphController.GetSlots方法的典型用法代码示例。如果您正苦于以下问题:C# GraphController.GetSlots方法的具体用法?C# GraphController.GetSlots怎么用?C# GraphController.GetSlots使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DesignScriptStudio.Graph.Core.GraphController
的用法示例。
在下文中一共展示了GraphController.GetSlots方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CBNTestWithLastLineEmpty
public void CBNTestWithLastLineEmpty()
{
// Create CBN : a; and second line empty
string commands = @"
CreateCodeBlockNode|d:15475.0|d:15175.0|s:Your code goes here
BeginNodeEdit|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text
EndNodeEdit|u:0x10000001|s:a;\n|b:True
";
GraphController controller = new GraphController(null);
bool result = controller.RunCommands(commands);
Assert.AreEqual(true, result);
IVisualNode node = controller.GetVisualNode(0x10000001);
Assert.NotNull(node); // Check if node is created
Assert.AreEqual(NodeType.CodeBlock, node.VisualType); // Check if node type is code block node
Assert.AreEqual(2, controller.GetSlots().Count); // Check if slot count is only 1
Assert.AreEqual("a;", ((CodeBlockNode)node).Text); // Check if text is 100
}
示例2: TestSlottypes
public void TestSlottypes()
{
//Create a code block node "1+2"
// input slots are not expectd here
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:15325.0|d:15221.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:1+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
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";
GraphController controller = new GraphController(null);
bool result00 = controller.RunCommands(commands);
Assert.AreEqual(true, result00);
List<ISlot> outputSlot = controller.GetSlots();
foreach (ISlot i in outputSlot)
{
Assert.AreEqual(SlotType.Output, i.SlotType);
}
}
示例3: TestUndoAfterPopRecordFromUndoStorage
public void TestUndoAfterPopRecordFromUndoStorage()
{
string commands = @"
CreateFunctionNode|d:10461.0|d:10243.0|s:Math.dll|s:Math.Sin|s:double
MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text|i: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,Text|i:0|e:System.Windows.Input.ModifierKeys,None
EndNodeEdit|u:0x10000001|s:|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 graphController = new GraphController(null);
bool result00 = graphController.RunCommands(commands);
Assert.AreEqual(true, result00);
commands = @"UndoOperation";
bool result01 = graphController.RunCommands(commands);
Assert.AreEqual(true, result01);
Assert.AreEqual(0, graphController.GetVisualNodes().Count);
Assert.AreEqual(0, graphController.GetSlots().Count);
}
示例4: TestCodeBlockNodeWithMixCharacters
public void TestCodeBlockNodeWithMixCharacters()
{
// Create a single code block node and type in alpha-numeric characters
//
string commands = @"
CreateCodeBlockNode|d:426.0|d:227.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,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:494.0|d:249.0
EndNodeEdit|u:0x10000001|s:[email protected]@#$$$|b:True";
GraphController controller = new GraphController(null);
bool result = controller.RunCommands(commands);
Assert.AreEqual(true, result);
IVisualNode node = controller.GetVisualNode(0x10000001);
Assert.NotNull(node); // Check if node is created
Assert.AreEqual(NodeType.CodeBlock, node.VisualType); // Check if node type is code block node
Assert.AreEqual("[email protected]@#$$$;", ((VisualNode)node).Text); // Check if Text contain the alpha-numeric characters
Assert.AreEqual(0, controller.GetSlots().Count); // Check if slot count is only 1
}
示例5: TestCodeBlockNodeWith1000Characaters
public void TestCodeBlockNodeWith1000Characaters()
{
// Create a single code block node and type in 1000 characters
//
string commands = @"
CreateCodeBlockNode|d:330.0|d:213.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,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:397.0|d:235.0
EndNodeEdit|u:0x10000001|s:1234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123451234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567891234567123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789|b:True";
//@TODO(Joy): Cap maximum display width
GraphController controller = new GraphController(null);
bool result = controller.RunCommands(commands);
Assert.AreEqual(true, result);
IVisualNode node = controller.GetVisualNode(0x10000001);
Assert.NotNull(node); // Check if node is created
Assert.AreEqual(NodeType.CodeBlock, node.VisualType); // Check if node type is code block node
Assert.AreEqual(1001, ((VisualNode)node).Text.Count()); // Check if Text contain 1000 characters
// The compiler will return an error due to the literal value being too
// large to parse, and thus the code block will not have any output slot.
//
// "Error: The value is too big or too small to be converted to an integer"
//
Assert.AreEqual(0, controller.GetSlots().Count);
}
示例6: TestCodeBlockNode01
public void TestCodeBlockNode01()
{
// Create 2 code block node by typing on the canvas
//
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:472.0|d:165.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
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:543.0|d:265.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:200|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);
IVisualNode node02 = controller.GetVisualNode(0x10000002);
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.CodeBlock, node02.VisualType); // Check if node type is code block node
Assert.AreEqual("100;", ((CodeBlockNode)node01).Text); // Check if text is 100
Assert.AreEqual("200;", ((CodeBlockNode)node02).Text);// Check if text is 200
Assert.AreEqual(2, controller.GetSlots().Count); // Check if slot count is 2
Assert.AreEqual(null, node01.GetInputSlots()); // Check if input slot count is 0
Assert.AreEqual(null, node02.GetInputSlots()); // Check if input slot count is 0
}
示例7: TestCodeBlockNode00
public void TestCodeBlockNode00()
{
// Create a single code block node by typing on the canvas
//
string commands = @"
CreateCodeBlockNode|d:545.0|d:206.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:100|b:True
MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None";
GraphController controller = new GraphController(null);
bool result = controller.RunCommands(commands);
Assert.AreEqual(true, result);
IVisualNode node = controller.GetVisualNode(0x10000001);
Assert.NotNull(node); // Check if node is created
Assert.AreEqual(NodeType.CodeBlock, node.VisualType); // Check if node type is code block node
Assert.AreEqual(1, controller.GetSlots().Count); // Check if slot count is only 1
}
示例8: T008_TestCodeBlockOutputNode_3
public void T008_TestCodeBlockOutputNode_3()
{
// 1. create a driver node b = 1;
// 2. drag a CBN from the library to the canvas
// 3. edit the CBN to have value "a = b; c = a; d = {0,1}" => verify 3 output slot is created
string commands = @"
CreateDriverNode|d:10581.0|d:10178.0
MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Caption|i:-1|e:System.Windows.Input.ModifierKeys,None
BeginDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Caption|i:-1|e:System.Windows.Input.ModifierKeys,None|d:10654.0|d:10190.0
EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Caption|i:-1|e:System.Windows.Input.ModifierKeys,None|d:10654.0|d:10190.0
MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Caption|i:-1|e:System.Windows.Input.ModifierKeys,None
BeginNodeEdit|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Caption
MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Caption|i:-1|e:System.Windows.Input.ModifierKeys,None
MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Caption|i:-1|e:System.Windows.Input.ModifierKeys,None
EndNodeEdit|u:0x10000001|s: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: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:10652.0|d:10193.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:10652.0|d:10193.0
MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None
BeginNodeEdit|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text
MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None
MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|e:System.Windows.Input.ModifierKeys,None
EndNodeEdit|u:0x10000001|s: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
CreateCodeBlockNode|d:10727.0|d:10278.0|s:Double Click and type
BeginNodeEdit|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,Text
EndNodeEdit|u:0x10000002|s:Double Click and type|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,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:10807.0|d:10293.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:10807.0|d:10293.0
MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|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:-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
EndNodeEdit|u:0x10000002|s:a = b;\nc = a +b;\nd = {0,1};|b:True
MouseDown|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None
MouseUp|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None";
GraphController controller = new GraphController(null);
bool result00 = controller.RunCommands(commands);
Assert.AreEqual(true, result00);
VisualNode node = controller.GetVisualNode(0x10000002);
Assert.AreEqual(10727, node.X);
Assert.AreEqual(10278, node.Y);
Assert.AreEqual(3, node.GetOutputSlots().Count()); // Check if CBN output slot count is 3
Assert.AreEqual("a = b;\nc = a + b;\nd = { 0, 1 };", node.Text); // Check CBN text
Assert.AreEqual(5, controller.GetSlots().Count); // Check total no of slots is 5
}
示例9: T007_TestCodeBlockOutputNode_1
public void T007_TestCodeBlockOutputNode_1()
{
// 1. drag a CBN from the library to the canvas
// 2. create a driver node a = 0;
// 3. edit the CBN to have value "b = a" => verify only one output slot is created
string commands = @"
CreateDriverNode|d:10472.0|d:10168.0
MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Caption|i:-1|e:System.Windows.Input.ModifierKeys,None
BeginDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Caption|i:-1|e:System.Windows.Input.ModifierKeys,None|d:10551.0|d:10185.0
EndDrag|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Caption|i:-1|e:System.Windows.Input.ModifierKeys,None|d:10551.0|d:10185.0
MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Caption|i:-1|e:System.Windows.Input.ModifierKeys,None
BeginNodeEdit|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Caption
MouseDown|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Caption|i:-1|e:System.Windows.Input.ModifierKeys,None
MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000001|e:DesignScriptStudio.Graph.Core.NodePart,Caption|i:-1|e:System.Windows.Input.ModifierKeys,None
EndNodeEdit|u:0x10000001|s: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
CreateCodeBlockNode|d:10659.0|d:10281.0|s:Double Click and type
BeginNodeEdit|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,Text
EndNodeEdit|u:0x10000002|s:Double Click and type|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,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:10704.0|d:10297.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:10704.0|d:10297.0
MouseUp|e:System.Windows.Input.MouseButton,Left|u:0x10000002|e:DesignScriptStudio.Graph.Core.NodePart,Text|i:-1|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:-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
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 result00 = controller.RunCommands(commands);
Assert.AreEqual(true, result00);
VisualNode node = (VisualNode)controller.GetVisualNode(0x10000002);
Assert.AreEqual(10659, node.X);// verify position
Assert.AreEqual(10281, node.Y);
Assert.NotNull(node); // Check if node is created
Assert.AreEqual(NodeType.CodeBlock, node.VisualType); // Check if node type is code block node
Assert.AreEqual(3, controller.GetSlots().Count); // Check total no of slots is 3
Assert.AreEqual(1, node.GetOutputSlots().Count()); // Check if CBN output slot count is only 1
Assert.AreEqual("b = a;", node.Text); // Check if slot count is only 1
}
示例10: Defect_IDE_1780
public void Defect_IDE_1780()
{
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:15382.0|d:15121.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:floorHeight = 5;\nceilingHeight = 10;\n\nnumColsX = 5;\nnumColsY = 6;\nxSize = 10;\nySize = 15;\n\ncolRadius = 0.4;\nbeamRadius = 0.2;\n\nxHeight = 3;\nyHeight = 5;|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
BeginDrag|e:System.Windows.Input.MouseButton,Left|u:0xffffffff|e:DesignScriptStudio.Graph.Core.NodePart,None|i:-1|e:System.Windows.Input.ModifierKeys,None|d:15594.0|d:15254.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:15595.0|d:15254.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: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:15784.0|d:15131.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,Text|i:-1|e:System.Windows.Input.ModifierKeys,None
EndNodeEdit|u:0x10000002|s:ceilingPoints = { };\nxArray = (Math.Sin((0..180..#numColsX)) * xHeight);\nyArray = (Math.Sin((0..180..#numColsY)) * yHeight);\nzArray = xArray<1> + yArray<2> + ceilingHeight;\n\nceilingPoints = Point.ByCoordinates((0..xSize..#numColsX)<1>, (0..ySize..#numColsY)<2>, zArray<1><2>);\ncolumns = Cone.ByStartPointEndPointRadius(Point.ByCoordinates({ 0, xSize }<1>, { 0, ySize }<2>, floorHeight), Point.ByCoordinates({ 0, xSize }<1>, { 0, ySize }<2>, ceilingHeight), colRadius, colRadius).SetColor(Color.Red);\nbeamsY = Cone.ByStartPointEndPointRadius(transposedCeilingPoints[0..(Count(transposedCeilingPoints) - 2)], transposedCeilingPoints[1..(Count(transposedCeilingPoints) - 1)], beamRadius, beamRadius).SetColor(Color.Cyan);|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);
Assert.AreEqual(2, controller.GetVisualNodes().Count);
Assert.AreEqual(28, controller.GetSlots().Count);
//There should be a total of 10 implicit connection
Assert.IsNotNull(controller.GetVisualEdge(0x60000001));
Assert.IsNotNull(controller.GetVisualEdge(0x60000002));
Assert.IsNotNull(controller.GetVisualEdge(0x60000003));
Assert.IsNotNull(controller.GetVisualEdge(0x60000004));
Assert.IsNotNull(controller.GetVisualEdge(0x60000005));
Assert.IsNotNull(controller.GetVisualEdge(0x60000006));
Assert.IsNotNull(controller.GetVisualEdge(0x60000007));
Assert.IsNotNull(controller.GetVisualEdge(0x60000008));
Assert.IsNotNull(controller.GetVisualEdge(0x60000009));
Assert.IsNotNull(controller.GetVisualEdge(0x6000000a));
Assert.IsNull(controller.GetVisualEdge(0x6000000b));
}
示例11: Defect_IDE_1756
public void Defect_IDE_1756()
{
// Create a CBN with value
// a=b;
// c=b+d;
// Now create another CBN with value : b=10;
// Verify that application should not crash and there should be an implicit connection between above two CBN.
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:15352.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,Text|i:-1|e:System.Windows.Input.ModifierKeys,None
EndNodeEdit|u:0x10000001|s:a=b;\nc=b+d;|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:15222.0|d:15189.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,Text|i:-1|e:System.Windows.Input.ModifierKeys,None
EndNodeEdit|u:0x10000002|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);
Assert.AreEqual(2, controller.GetVisualNodes().Count);
Assert.AreEqual(5, controller.GetSlots().Count);
//Only one implicit connection is formed.
Assert.IsNotNull(controller.GetVisualEdge(0x60000001));
Assert.IsNull(controller.GetVisualEdge(0x60000002));
//Implicit connection should be formed between the first slot of the first code block node and output slot of second code block
ISlot outputSlot = controller.GetSlot(0x30000005);
ISlot inputSlot = controller.GetSlot(0x30000001);
Assert.AreEqual(1, outputSlot.ConnectingSlots.Count());
Assert.Contains(outputSlot.SlotId, inputSlot.ConnectingSlots);
Assert.Contains(inputSlot.SlotId, outputSlot.ConnectingSlots);
}