Skip to content
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

DYN-4451 bug instalation spinner packages #12931

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
Original file line number Diff line number Diff line change
Expand Up @@ -966,35 +966,35 @@
CornerRadius="3,0,0,3" />
</Grid>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding ElementName=downloadState, Path=Text}" Value="Unknown">
<DataTrigger Binding="{Binding ElementName=downloadState, Path=Text}" Value="{x:Static p:Resources.PackageStateUnknown}">
<DataTrigger.Setters>
<Setter TargetName="downloadStatusFlag" Property="Background" Value="#CC000000" />
</DataTrigger.Setters>
</DataTrigger>
<DataTrigger Binding="{Binding ElementName=downloadState, Path=Text}" Value="Downloaded">
<DataTrigger Binding="{Binding ElementName=downloadState, Path=Text}" Value="{x:Static p:Resources.PackageDownloadStateDownloaded}">
<DataTrigger.Setters>
<Setter TargetName="downloadStatusFlag" Property="Background" Value="Gray" />
</DataTrigger.Setters>
</DataTrigger>
<DataTrigger Binding="{Binding ElementName=downloadState, Path=Text}" Value="Downloading">
<DataTrigger Binding="{Binding ElementName=downloadState, Path=Text}" Value="{x:Static p:Resources.PackageDownloadStateDownloading}">
<DataTrigger.Setters>
<Setter TargetName="downloadStatusFlag" Property="Background" Value="Gray" />
</DataTrigger.Setters>
</DataTrigger>
<DataTrigger Binding="{Binding ElementName=downloadState, Path=Text}" Value="Error">
<DataTrigger Binding="{Binding ElementName=downloadState, Path=Text}" Value="{x:Static p:Resources.PackageDownloadStateError}">
<DataTrigger.Setters>
<Setter TargetName="downloadStatusFlag" Property="Background" Value="LightCoral" />
<Setter TargetName="downloadCompletedIcon" Property="Source" Value="/DynamoCoreWpf;component/UI/Images/package_error.png" />
</DataTrigger.Setters>
</DataTrigger>
<DataTrigger Binding="{Binding ElementName=downloadState, Path=Text}" Value="Installed">
<DataTrigger Binding="{Binding ElementName=downloadState, Path=Text}" Value="{x:Static p:Resources.PackageDownloadStateInstalled}">
<DataTrigger.Setters>
<Setter TargetName="downloadStatusFlag" Property="Background" Value="LightBlue" />
<Setter TargetName="downloadCompletedIcon" Property="Visibility" Value="Visible" />
<Setter TargetName="downloadingIcon" Property="Visibility" Value="Collapsed" />
</DataTrigger.Setters>
</DataTrigger>
<DataTrigger Binding="{Binding ElementName=downloadState, Path=Text}" Value="Installing">
<DataTrigger Binding="{Binding ElementName=downloadState, Path=Text}" Value="{x:Static p:Resources.PackageDownloadStateInstalling}">
<DataTrigger.Setters>
<Setter TargetName="downloadStatusFlag" Property="Background" Value="Gray" />
</DataTrigger.Setters>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Dynamo.ViewModels;
using System.Collections.Generic;
using static Dynamo.PackageManager.PackageManagerSearchViewModel;
using Dynamo.Controls;

namespace Dynamo.PackageManager.Wpf.Tests
{
Expand Down Expand Up @@ -102,6 +103,57 @@ public void TestPackageManagerSearchElementCanInstall()
packageManagerSearchViewModel.ClearSearchResults();
}


/// <summary>
/// A test to ensure that the label converted is equal the resources when localized
/// </summary>
[Test]
public void TestPackageManagerInstallStatusByResourceName()
{
var name1 = "package";
var version = "1.0.0";

var dHandle1 = new PackageDownloadHandle()
{
Id = name1,
VersionName = version,
Name = name1
};

dHandle1.DownloadState = PackageDownloadHandle.State.Installed;

var download1State = new PackageDownloadStateToStringConverter().Convert(dHandle1.DownloadState, null, null, null).ToString();
Assert.IsTrue(download1State.Equals(Dynamo.Wpf.Properties.Resources.PackageDownloadStateInstalled));

dHandle1.DownloadState = PackageDownloadHandle.State.Installing;

download1State = new PackageDownloadStateToStringConverter().Convert(dHandle1.DownloadState, null, null, null).ToString();
Assert.IsTrue(download1State.Equals(Dynamo.Wpf.Properties.Resources.PackageDownloadStateInstalling));

dHandle1.DownloadState = PackageDownloadHandle.State.Downloaded;

download1State = new PackageDownloadStateToStringConverter().Convert(dHandle1.DownloadState, null, null, null).ToString();
Assert.IsTrue(download1State.Equals(Dynamo.Wpf.Properties.Resources.PackageDownloadStateDownloaded));

dHandle1.DownloadState = PackageDownloadHandle.State.Downloading;

download1State = new PackageDownloadStateToStringConverter().Convert(dHandle1.DownloadState, null, null, null).ToString();
Assert.IsTrue(download1State.Equals(Dynamo.Wpf.Properties.Resources.PackageDownloadStateDownloading));

dHandle1.DownloadState = PackageDownloadHandle.State.Error;

download1State = new PackageDownloadStateToStringConverter().Convert(dHandle1.DownloadState, null, null, null).ToString();
Assert.IsTrue(download1State.Equals(Dynamo.Wpf.Properties.Resources.PackageDownloadStateError));

dHandle1.DownloadState = PackageDownloadHandle.State.Uninitialized;

download1State = new PackageDownloadStateToStringConverter().Convert(dHandle1.DownloadState, null, null, null).ToString();
Assert.IsTrue(download1State.Equals(Dynamo.Wpf.Properties.Resources.PackageDownloadStateStarting));

download1State = new PackageDownloadStateToStringConverter().Convert(null, null, null, null).ToString();
Assert.IsTrue(download1State.Equals(Dynamo.Wpf.Properties.Resources.PackageStateUnknown));
}

/// <summary>
/// This unit test will validate that after we set the filters in the package search, we will get an intersection of the results (instead of a union)
/// </summary>
Expand Down