mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
[PT Run] Find applications using the PATH env variable (#4418)
* Search for programs in the path env variable * removing list of disabled programs * Added env variable string to classify apps * reverted the fullpath change * removing full paths while calculating dups * removed dups * removed debugging code * Renamed to run command * Added condition to filter run commands unless there is an exact match * renamed occurances to RUN COMMAND * localized the subtitle - Run command * Added tests * add fullpath back to hash calculation * renamed the function
This commit is contained in:
@@ -126,6 +126,24 @@ namespace Wox.Test.Plugins
|
||||
LnkResolvedPath = "c:\\programdata\\microsoft\\windows\\start menu\\programs\\test proxy.lnk"
|
||||
};
|
||||
|
||||
Win32 cmd_run_command = new Win32
|
||||
{
|
||||
Name = "cmd",
|
||||
ExecutableName = "cmd.exe",
|
||||
FullPath = "c:\\windows\\system32\\cmd.exe",
|
||||
LnkResolvedPath = null,
|
||||
AppType = 3 // Run command
|
||||
};
|
||||
|
||||
Win32 cmder_run_command = new Win32
|
||||
{
|
||||
Name = "Cmder",
|
||||
ExecutableName = "Cmder.exe",
|
||||
FullPath = "c:\\tools\\cmder\\cmder.exe",
|
||||
LnkResolvedPath = null,
|
||||
AppType = 3 // Run command
|
||||
};
|
||||
|
||||
Win32 dummy_internetShortcut_app = new Win32
|
||||
{
|
||||
Name = "Shop Titans",
|
||||
@@ -293,5 +311,27 @@ namespace Wox.Test.Plugins
|
||||
// unreachable code
|
||||
return true;
|
||||
}
|
||||
|
||||
[TestCase("Command Prompt")]
|
||||
[TestCase("cmd")]
|
||||
[TestCase("cmd.exe")]
|
||||
[TestCase("ignoreQueryText")]
|
||||
public void Win32Applications_ShouldNotBeFiltered_WhenFilteringRunCommands(string query)
|
||||
{
|
||||
// Even if there is an exact match in the name or exe name, win32 applications should never be filtered
|
||||
Assert.IsTrue(command_prompt.QueryEqualsNameForRunCommands(query));
|
||||
}
|
||||
|
||||
[TestCase("cmd")]
|
||||
[TestCase("Cmd")]
|
||||
[TestCase("CMD")]
|
||||
public void RunCommands_ShouldNotBeFiltered_OnExactMatch(string query)
|
||||
{
|
||||
// Partial matches should be filtered as cmd is not equal to cmder
|
||||
Assert.IsFalse(cmder_run_command.QueryEqualsNameForRunCommands(query));
|
||||
|
||||
// the query matches the name (cmd) and is therefore not filtered (case-insensitive)
|
||||
Assert.IsTrue(cmd_run_command.QueryEqualsNameForRunCommands(query));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user