Skip to content

DYN-6218 Turning off "Show Connectors" doesn't keep them off when file is reopened #15509

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}
}
}
Loading