mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 03:07:04 +02:00
[PTRun]Don't show results from other plugins when using keyword (#19206)
This commit is contained in:
committed by
GitHub
parent
8e2570033c
commit
996a235e12
@@ -17,12 +17,6 @@ namespace Wox.Test
|
||||
[DataRow(">", "dummyQueryText", "dummyTitle", "> dummyQueryText")]
|
||||
[DataRow(">", null, "dummyTitle", "> dummyTitle")]
|
||||
[DataRow(">", "", "dummyTitle", "> dummyTitle")]
|
||||
[DataRow("", "dummyQueryText", "dummyTitle", "dummyQueryText")]
|
||||
[DataRow("", null, "dummyTitle", "dummyTitle")]
|
||||
[DataRow("", "", "dummyTitle", "dummyTitle")]
|
||||
[DataRow(null, "dummyQueryText", "dummyTitle", "dummyQueryText")]
|
||||
[DataRow(null, null, "dummyTitle", "dummyTitle")]
|
||||
[DataRow(null, "", "dummyTitle", "dummyTitle")]
|
||||
public void QueryForPluginSetsActionKeywordWhenQueryTextDisplayIsEmpty(string actionKeyword, string queryTextDisplay, string title, string expectedResult)
|
||||
{
|
||||
// Arrange
|
||||
@@ -58,5 +52,44 @@ namespace Wox.Test
|
||||
// Assert
|
||||
Assert.AreEqual(expectedResult, queryOutput[0].QueryTextDisplay);
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
[DataRow("", true)]
|
||||
[DataRow(null, true)]
|
||||
[DataRow(">", false)]
|
||||
public void QueryDefaultResultsForPlugin(string actionKeyword, bool emptyResults)
|
||||
{
|
||||
// Arrange
|
||||
var query = new Query(string.Empty, actionKeyword);
|
||||
var metadata = new PluginMetadata
|
||||
{
|
||||
ID = "dummyName",
|
||||
IcoPathDark = "dummyIcoPath",
|
||||
IcoPathLight = "dummyIcoPath",
|
||||
ExecuteFileName = "dummyExecuteFileName",
|
||||
PluginDirectory = "dummyPluginDirectory",
|
||||
ActionKeyword = ">",
|
||||
IsGlobal = true,
|
||||
};
|
||||
var result = new Result()
|
||||
{
|
||||
QueryTextDisplay = "dummyQueryText",
|
||||
Title = "dummyTitle",
|
||||
};
|
||||
var results = new List<Result>() { result };
|
||||
var pluginMock = new Mock<IPlugin>();
|
||||
pluginMock.Setup(r => r.Query(query)).Returns(results);
|
||||
var pluginPair = new PluginPair(metadata)
|
||||
{
|
||||
Plugin = pluginMock.Object,
|
||||
IsPluginInitialized = true,
|
||||
};
|
||||
|
||||
// Act
|
||||
var queryOutput = PluginManager.QueryForPlugin(pluginPair, query);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(queryOutput.Count == 0, emptyResults);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user