Skip to content

Commit

Permalink
start running serialization view tests again (#14590)
Browse files Browse the repository at this point in the history
* fix all types serialize

* fix serialization tests

* remove failure
  • Loading branch information
mjkkirschner authored Nov 10, 2023
1 parent 9df196d commit b90e84d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
25 changes: 23 additions & 2 deletions test/DynamoCoreTests/SerializationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -277,14 +277,24 @@ public static void CompareWorkspaceModels(serializationTestUtils.WorkspaceCompar
{
var valueA = kvp.Value;
var valueB = b.NodeDataMap[kvp.Key];
var valANodeName = a.NodeTypeMap[kvp.Key].FullName;

// Ignore IntegerSlider nodes as they are being read as IntegerSlider64Bit JSON nodes.
// TODO: Remove this filter once we deprecate IntegerSlider nodes in a future Dynamo version.
if (a.NodeTypeMap[kvp.Key].FullName == "CoreNodeModels.Input.IntegerSlider")
if (valANodeName == "CoreNodeModels.Input.IntegerSlider")
{
Assert.AreEqual("CoreNodeModels.Input.IntegerSlider64Bit", b.NodeTypeMap[kvp.Key].FullName);
continue;
}
//ignore file name/object nodes - the result is dependent on where the graph was run.
//which is modified during this test.

if (valANodeName.ToLower() == "corenodemodels.input.filename" ||
valANodeName.ToLower()== "corenodemodels.input.fileobject"||
valANodeName.ToLower() == "corenodemodels.input.directory")
{
continue;
}

Assert.AreEqual(a.NodeTypeMap[kvp.Key], b.NodeTypeMap[kvp.Key]);

Expand Down Expand Up @@ -389,15 +399,26 @@ public static void CompareWorkspacesDifferentGuids(serializationTestUtils.Worksp
//convert the old guid to the new guid
var newGuid = GuidUtility.Create(GuidUtility.UrlNamespace, modelGuidsToIDmap[kvp.Key]);
var valueB = b.NodeDataMap[newGuid];
var valANodeName = a.NodeTypeMap[kvp.Key].FullName;

// Ignore IntegerSlider nodes as they are being read as IntegerSlider64Bit JSON nodes.
// TODO: Remove this filter once we deprecate IntegerSlider nodes in a future Dynamo version.
if (a.NodeTypeMap[kvp.Key].FullName == "CoreNodeModels.Input.IntegerSlider")
if (valANodeName == "CoreNodeModels.Input.IntegerSlider")
{
Assert.AreEqual("CoreNodeModels.Input.IntegerSlider64Bit", b.NodeTypeMap[newGuid].FullName);
continue;
}

//ignore file name/object nodes - the result is dependent on where the graph was run.
//which is modified during this test.

if (valANodeName.ToLower() == "corenodemodels.input.filename" ||
valANodeName.ToLower() == "corenodemodels.input.fileobject" ||
valANodeName.ToLower() == "corenodemodels.input.directory")
{
continue;
}

Assert.AreEqual(a.NodeTypeMap[kvp.Key], b.NodeTypeMap[newGuid]);

try
Expand Down
6 changes: 3 additions & 3 deletions test/DynamoCoreWpfTests/SerializationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -962,7 +962,7 @@ private void ExecutionEvents_GraphPostExecution(Dynamo.Session.IExecutionSession
/// </summary>
/// <param name="filePath">The path to a .dyn file. This parameter is supplied
/// by the test framework.</param>
[Test, TestCaseSource(nameof(FindWorkspaces)), Category("JsonTestExclude"), Category("Failure")]
[Test, TestCaseSource(nameof(FindWorkspaces)), Category("JsonTestExclude")]
public void SerializationTest(string filePath)
{
DoWorkspaceOpenAndCompareView(filePath,
Expand All @@ -981,7 +981,7 @@ public void SerializationTest(string filePath)
/// </summary>
/// <param name="filePath">The path to a .dyn file. This parameter is supplied
/// by the test framework.</param>
[Test, TestCaseSource(nameof(FindWorkspaces)), Category("JsonTestExclude"), Category("Failure")]
[Test, TestCaseSource(nameof(FindWorkspaces)), Category("JsonTestExclude")]
public void SerializationNonGuidIdsTest(string filePath)
{
modelsGuidToIdMap.Clear();
Expand Down Expand Up @@ -1067,7 +1067,7 @@ public void NewCustomNodeSaveAndLoadPt2()
File.Delete(savePath);
}

[Test, Category("Failure")]
[Test]
public void AllTypesSerialize()
{
var customNodeTestPath = Path.Combine(TestDirectory, @"core\serialization\serialization.dyn");
Expand Down

0 comments on commit b90e84d

Please sign in to comment.