Skip to content

Commit b3fcfa9

Browse files
committed
Address node annotation type review feedback
Add the new OpenNodeAnnotationEventArgs input and output type properties to the WPF public API list. Cover the NodeModel input-port type fallback path for ports that omit InPortTypes but provide default value AST nodes.
1 parent 58454c5 commit b3fcfa9

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

src/DynamoCoreWpf/PublicAPI.Unshipped.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ Dynamo.ViewModels.DynamoViewModel.PythonEngineUpgradeToastRequested -> System.Ac
2626
Dynamo.ViewModels.DynamoViewModel.ToastManager.get -> Dynamo.Wpf.UI.ToastManager
2727
Dynamo.ViewModels.DynamoViewModel.ToastManager.set -> void
2828
Dynamo.ViewModels.DynamoViewModel.ShowPythonEngineUpgradeCanvasToast(string message, bool stayOpen = true, string filePath = null) -> void
29+
Dynamo.ViewModels.OpenNodeAnnotationEventArgs.InputTypes.get -> System.Collections.Generic.IEnumerable<string>
30+
Dynamo.ViewModels.OpenNodeAnnotationEventArgs.OutputTypes.get -> System.Collections.Generic.IEnumerable<string>
2931
Dynamo.ViewModels.PreferencesViewModel.AutoSyncDocumentBrowserIsChecked.get -> bool
3032
Dynamo.ViewModels.PreferencesViewModel.AutoSyncDocumentBrowserIsChecked.set -> void
3133
Dynamo.ViewModels.PreferencesViewModel.ShowPythonAutoMigrationNotificationIsChecked.get -> bool

test/DynamoCoreWpf3Tests/NodeViewTests.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,32 @@
99
using System.Windows.Media;
1010
using Dynamo.Controls;
1111
using Dynamo.Graph;
12+
using Dynamo.Graph.Nodes;
1213
using Dynamo.Graph.Workspaces;
1314
using Dynamo.Models;
1415
using Dynamo.Selection;
1516
using Dynamo.UI.Prompts;
1617
using Dynamo.ViewModels;
1718
using DynamoCoreWpfTests.Utility;
1819
using NUnit.Framework;
20+
using ProtoCore.AST.AssociativeAST;
1921

2022
namespace DynamoCoreWpfTests
2123
{
2224
public class NodeViewTests : DynamoTestUIBase
2325
{
2426
// 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+
}
2538

2639
protected override void GetLibrariesToPreload(List<string> libraries)
2740
{
@@ -361,6 +374,16 @@ public void InputPortType_NodeModelNode_AreCorrect()
361374
Assert.AreEqual("System.Drawing.Bitmap", type);
362375
}
363376

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+
364387
[Test]
365388
[Category("RegressionTests")]
366389
public void GettingNodeNameDoesNotTriggerPropertyChangeCycle()

0 commit comments

Comments
 (0)