Skip to content

Commit

Permalink
DYN-6218 Turning off "Show Connectors" doesn't keep them off when fil…
Browse files Browse the repository at this point in the history
…e is reopened (#15509)
  • Loading branch information
QilongTang authored Sep 26, 2024
1 parent 2f7f933 commit cebc4bf
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/DynamoCore/Graph/Workspaces/SerializationConverters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1263,8 +1263,8 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist
var startId = obj["Start"].Value<string>();
var endId = obj["End"].Value<string>();
var isHiddenExists = obj[nameof(ConnectorModel.IsHidden)];

var isHidden = isHiddenExists != null && obj[nameof(ConnectorModel.IsHidden)].Value<bool>();
// final connector visibility would respect current setting first, if visible then fallback to serialized value
var isHidden = !PreferenceSettings.Instance.ShowConnector || isHiddenExists != null && obj[nameof(ConnectorModel.IsHidden)].Value<bool>();

var resolver = (IdReferenceResolver)serializer.ReferenceResolver;

Expand Down
30 changes: 23 additions & 7 deletions test/DynamoCoreWpfTests/ConnectorViewModelTests.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,35 @@
using System.Linq;
using System;
using System.IO;
using System.Linq;
using Dynamo.Selection;
using NUnit.Framework;
using static Dynamo.Models.DynamoModel;
using Dynamo.Utilities;
using Dynamo.ViewModels;
using System;
using System.Xml;
using System.IO;
using NUnit.Framework;
using static Dynamo.Models.DynamoModel;

namespace DynamoCoreWpfTests
{
public class ConnectorViewModelTests : DynamoTestUIBase
{

#region Regular Connector Tests
/// <summary>
/// Check to see if a connector is visible after in session preferences is set to hide connectors
/// </summary>
[Test]
public void ConnectorVisibilityWithPrefrencesTest()
{
Model.PreferenceSettings.ShowConnector = false;

Open(@"UI/ConnectorPinTests.dyn");

var connectorViewModel = this.ViewModel.CurrentSpaceViewModel.Connectors.First();

// Although default IsHidden state should be false when opening legacy graph,
// if current preferences are set to hide connectors, the connector should be hidden
Assert.AreEqual(connectorViewModel.IsHidden, true);
}

/// <summary>
/// Check to see if a connector is visible after pre 2.13 graph open
/// </summary>
Expand Down Expand Up @@ -457,4 +473,4 @@ public void CanUndoPlaceWatchNode()
}
#endregion
}
}
}

0 comments on commit cebc4bf

Please sign in to comment.