Skip to content

Commit

Permalink
Remove duplicate visualization tests and fixes DYN-5962 (DynamoDS#14146)
Browse files Browse the repository at this point in the history
* Remove duplicate visualization tests

* Update HelixImageComparisonTests.cs

* Add try catch to handle exception crash
  • Loading branch information
reddyashish authored Jul 11, 2023
1 parent 0f6b62a commit 85b4596
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 15 deletions.
31 changes: 19 additions & 12 deletions src/DynamoCoreWpf/Controls/StartPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -368,25 +368,32 @@ private void RefreshFileList(ObservableCollection<StartPageListItem> files,
files.Clear();
foreach (var filePath in filePaths)
{
var extension = Path.GetExtension(filePath).ToUpper();
// If not extension specified and code reach here, this means this is still a valid file
// only without file type. Otherwise, simply take extension substring skipping the 'dot'.
var subScript = extension.IndexOf(".") == 0 ? extension.Substring(1) : "";
var caption = Path.GetFileNameWithoutExtension(filePath);
try
{
var extension = Path.GetExtension(filePath).ToUpper();
// If not extension specified and code reach here, this means this is still a valid file
// only without file type. Otherwise, simply take extension substring skipping the 'dot'.
var subScript = extension.IndexOf(".") == 0 ? extension.Substring(1) : "";
var caption = Path.GetFileNameWithoutExtension(filePath);

files.Add(new StartPageListItem(caption)
files.Add(new StartPageListItem(caption)
{
ContextData = filePath,
ToolTip = filePath,
SubScript = subScript,
ClickAction = StartPageListItem.Action.FilePath
});
}
catch (ArgumentException ex)
{
ContextData = filePath,
ToolTip = filePath,
SubScript = subScript,
ClickAction = StartPageListItem.Action.FilePath
});
DynamoViewModel.Model.Logger.Log("File path is not valid: " + ex.StackTrace);
}
}
}

private void HandleRegularCommand(StartPageListItem item)
{
var dvm = this.DynamoViewModel;
var dvm = this.DynamoViewModel;

switch (item.ContextData)
{
Expand Down
14 changes: 11 additions & 3 deletions src/VisualizationTests/HelixImageComparisonTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,26 @@
using System.Linq;
using System.Reflection;
using System.Windows.Media.Imaging;
using Dynamo.Graph.Nodes.ZeroTouch;
using Dynamo.Controls;
using Dynamo.Selection;
using Dynamo.Utilities;
using DynamoCoreWpfTests.Utility;
using HelixToolkit.Wpf.SharpDX;
using NUnit.Framework;

namespace WpfVisualizationTests
{

[TestFixture]
public class HelixImageComparisonTests : HelixWatch3DViewModelTests
public class HelixImageComparisonTests : VisualizationTest
{
protected Watch3DView BackgroundPreview
{
get
{
return (Watch3DView)View.background_grid.Children().FirstOrDefault(c => c is Watch3DView);
}
}

#region utilities

/// <summary>
Expand Down

0 comments on commit 85b4596

Please sign in to comment.