mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
Matching ExactName for known Win32 Programs (#6924)
* Matching explorer.exe also for explorer Added unit test Optimized multiple iterations for IProgram * Fixed linter Co-authored-by: p-storm <paul.de.man@gmail.com>
This commit is contained in:
@@ -63,7 +63,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
|
||||
AppType = Win32Program.ApplicationType.Win32Application,
|
||||
};
|
||||
|
||||
private static readonly Win32Program _fileExplorer = new Win32Program
|
||||
private static readonly Win32Program _fileExplorerLink = new Win32Program
|
||||
{
|
||||
Name = "File Explorer",
|
||||
ExecutableName = "File Explorer.lnk",
|
||||
@@ -72,6 +72,15 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
|
||||
AppType = Win32Program.ApplicationType.Win32Application,
|
||||
};
|
||||
|
||||
private static readonly Win32Program _fileExplorer = new Win32Program
|
||||
{
|
||||
Name = "File Explorer",
|
||||
ExecutableName = "explorer.exe",
|
||||
FullPath = "c:\\windows\\explorer.exe",
|
||||
LnkResolvedPath = null,
|
||||
AppType = Win32Program.ApplicationType.Win32Application,
|
||||
};
|
||||
|
||||
private static readonly Win32Program _wordpad = new Win32Program
|
||||
{
|
||||
Name = "Wordpad",
|
||||
@@ -273,7 +282,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
|
||||
// Arrange
|
||||
List<Win32Program> prgms = new List<Win32Program>
|
||||
{
|
||||
_fileExplorer,
|
||||
_fileExplorerLink,
|
||||
};
|
||||
|
||||
// Act
|
||||
@@ -403,6 +412,14 @@ namespace Microsoft.Plugin.Program.UnitTests.Programs
|
||||
Assert.IsTrue(_commandPrompt.QueryEqualsNameForRunCommands(query));
|
||||
}
|
||||
|
||||
[TestCase("explorer")]
|
||||
[TestCase("explorer.exe")]
|
||||
public void Win32ApplicationsShouldNotFilterWhenExecutingNameOrNameIsUsed(string query)
|
||||
{
|
||||
// Even if there is an exact match in the name or exe name, win32 applications should never be filtered
|
||||
Assert.IsTrue(_fileExplorer.QueryEqualsNameForRunCommands(query));
|
||||
}
|
||||
|
||||
[TestCase("cmd")]
|
||||
[TestCase("Cmd")]
|
||||
[TestCase("CMD")]
|
||||
|
||||
Reference in New Issue
Block a user