mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 20:27:36 +02:00
[PT Run] Fix Program Plugin launching issue in Turkish locale (#10981)
* [Launcher] Fix Program Plugin launching issue in Turkish locale * [Launcher] Add test for Turkish localized path * Update expect.txt * Update .github/actions/spell-check/expect.txt Co-authored-by: Clint Rutkas <clint@rutkas.com> Co-authored-by: Enrico Giordani <enricogior@users.noreply.github.com>
This commit is contained in:
@@ -18,6 +18,15 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class Win32Tests
|
public class Win32Tests
|
||||||
{
|
{
|
||||||
|
private static readonly Win32Program _imagingDevices = new Win32Program
|
||||||
|
{
|
||||||
|
Name = "Imaging Devices",
|
||||||
|
ExecutableName = "imagingdevices.exe",
|
||||||
|
FullPath = "c:\\program files\\windows photo viewer\\imagingdevices.exe",
|
||||||
|
LnkResolvedPath = null,
|
||||||
|
AppType = Win32Program.ApplicationType.Win32Application,
|
||||||
|
};
|
||||||
|
|
||||||
private static readonly Win32Program _notepadAppdata = new Win32Program
|
private static readonly Win32Program _notepadAppdata = new Win32Program
|
||||||
{
|
{
|
||||||
Name = "Notepad",
|
Name = "Notepad",
|
||||||
@@ -432,6 +441,12 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
|
|||||||
Assert.IsTrue(_cmdRunCommand.QueryEqualsNameForRunCommands(query));
|
Assert.IsTrue(_cmdRunCommand.QueryEqualsNameForRunCommands(query));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestCase("ımaging")]
|
||||||
|
public void Win32ApplicationsShouldNotHaveIncorrectPathWhenExecuting(string query)
|
||||||
|
{
|
||||||
|
Assert.IsFalse(_imagingDevices.FullPath.Contains(query, StringComparison.Ordinal));
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void WebApplicationShouldReturnContextMenuWithOpenInConsoleWhenContextMenusIsCalled()
|
public void WebApplicationShouldReturnContextMenuWithOpenInConsoleWhenContextMenusIsCalled()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -344,6 +344,7 @@ namespace Microsoft.Plugin.Program.Programs
|
|||||||
}
|
}
|
||||||
|
|
||||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "Any error in CreateWin32Program should not prevent other programs from loading.")]
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "Any error in CreateWin32Program should not prevent other programs from loading.")]
|
||||||
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Globalization", "CA1308:Normalize strings to uppercase", Justification = "User facing path needs to be shown in lowercase.")]
|
||||||
private static Win32Program CreateWin32Program(string path)
|
private static Win32Program CreateWin32Program(string path)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -354,8 +355,8 @@ namespace Microsoft.Plugin.Program.Programs
|
|||||||
ExecutableName = Path.GetFileName(path),
|
ExecutableName = Path.GetFileName(path),
|
||||||
IcoPath = path,
|
IcoPath = path,
|
||||||
|
|
||||||
// Using CurrentCulture since this is user facing
|
// Using InvariantCulture since this is user facing
|
||||||
FullPath = path.ToLower(CultureInfo.CurrentCulture),
|
FullPath = path.ToLowerInvariant(),
|
||||||
UniqueIdentifier = path,
|
UniqueIdentifier = path,
|
||||||
ParentDirectory = Directory.GetParent(path).FullName,
|
ParentDirectory = Directory.GetParent(path).FullName,
|
||||||
Description = string.Empty,
|
Description = string.Empty,
|
||||||
@@ -465,6 +466,7 @@ namespace Microsoft.Plugin.Program.Programs
|
|||||||
}
|
}
|
||||||
|
|
||||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "Unsure of what exceptions are caught here while enabling static analysis")]
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "Unsure of what exceptions are caught here while enabling static analysis")]
|
||||||
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Globalization", "CA1308:Normalize strings to uppercase", Justification = "User facing path needs to be shown in lowercase.")]
|
||||||
private static Win32Program LnkProgram(string path)
|
private static Win32Program LnkProgram(string path)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -481,8 +483,8 @@ namespace Microsoft.Plugin.Program.Programs
|
|||||||
{
|
{
|
||||||
program.LnkResolvedPath = program.FullPath;
|
program.LnkResolvedPath = program.FullPath;
|
||||||
|
|
||||||
// Using CurrentCulture since this is user facing
|
// Using InvariantCulture since this is user facing
|
||||||
program.FullPath = Path.GetFullPath(target).ToLower(CultureInfo.CurrentCulture);
|
program.FullPath = Path.GetFullPath(target).ToLowerInvariant();
|
||||||
program.AppType = GetAppTypeFromPath(target);
|
program.AppType = GetAppTypeFromPath(target);
|
||||||
|
|
||||||
var description = ShellLinkHelper.Description;
|
var description = ShellLinkHelper.Description;
|
||||||
@@ -693,10 +695,11 @@ namespace Microsoft.Plugin.Program.Programs
|
|||||||
return files;
|
return files;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Globalization", "CA1308:Normalize strings to uppercase", Justification = "User facing path needs to be shown in lowercase.")]
|
||||||
private static string Extension(string path)
|
private static string Extension(string path)
|
||||||
{
|
{
|
||||||
// Using CurrentCulture since this is user facing
|
// Using InvariantCulture since this is user facing
|
||||||
var extension = Path.GetExtension(path)?.ToLower(CultureInfo.CurrentCulture);
|
var extension = Path.GetExtension(path)?.ToLowerInvariant();
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(extension))
|
if (!string.IsNullOrEmpty(extension))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user