|
9 | 9 | using System.Windows.Media; |
10 | 10 | using Dynamo.Controls; |
11 | 11 | using Dynamo.Graph; |
| 12 | +using Dynamo.Graph.Nodes; |
12 | 13 | using Dynamo.Graph.Workspaces; |
13 | 14 | using Dynamo.Models; |
14 | 15 | using Dynamo.Selection; |
15 | 16 | using Dynamo.UI.Prompts; |
16 | 17 | using Dynamo.ViewModels; |
17 | 18 | using DynamoCoreWpfTests.Utility; |
18 | 19 | using NUnit.Framework; |
| 20 | +using ProtoCore.AST.AssociativeAST; |
19 | 21 |
|
20 | 22 | namespace DynamoCoreWpfTests |
21 | 23 | { |
22 | 24 | public class NodeViewTests : DynamoTestUIBase |
23 | 25 | { |
24 | 26 | // adapted from: http://stackoverflow.com/questions/9336165/correct-method-for-using-the-wpf-dispatcher-in-unit-tests |
| 27 | + private class DefaultValueInputTypeNode : NodeModel |
| 28 | + { |
| 29 | + internal DefaultValueInputTypeNode() |
| 30 | + { |
| 31 | + InPorts.Add(new PortModel(PortType.Input, this, new PortData("integer", "integer", AstFactory.BuildIntNode(1)))); |
| 32 | + InPorts.Add(new PortModel(PortType.Input, this, new PortData("number", "number", AstFactory.BuildDoubleNode(1.0)))); |
| 33 | + InPorts.Add(new PortModel(PortType.Input, this, new PortData("boolean", "boolean", AstFactory.BuildBooleanNode(true)))); |
| 34 | + InPorts.Add(new PortModel(PortType.Input, this, new PortData("text", "text", AstFactory.BuildStringNode("value")))); |
| 35 | + RegisterAllPorts(); |
| 36 | + } |
| 37 | + } |
25 | 38 |
|
26 | 39 | protected override void GetLibrariesToPreload(List<string> libraries) |
27 | 40 | { |
@@ -361,6 +374,16 @@ public void InputPortType_NodeModelNode_AreCorrect() |
361 | 374 | Assert.AreEqual("System.Drawing.Bitmap", type); |
362 | 375 | } |
363 | 376 |
|
| 377 | + [Test] |
| 378 | + public void InputPortType_NodeModelNodeWithoutInPortTypes_FallsBackToDefaultValueType() |
| 379 | + { |
| 380 | + var node = new DefaultValueInputTypeNode(); |
| 381 | + |
| 382 | + CollectionAssert.AreEqual( |
| 383 | + new[] { "int", "double", "bool", "string" }, |
| 384 | + node.InPorts.Select(port => port.GetInputPortType())); |
| 385 | + } |
| 386 | + |
364 | 387 | [Test] |
365 | 388 | [Category("RegressionTests")] |
366 | 389 | public void GettingNodeNameDoesNotTriggerPropertyChangeCycle() |
|
0 commit comments