Migrate to MTP (#37651)

Duplicating https://github.com/microsoft/PowerToys/pull/37001, but
opening from upstream instead of fork as CI doesn't play nicely with PRs
from forks (https://github.com/microsoft/PowerToys/pull/37617 is
improving that)

---------

Co-authored-by: Clint Rutkas <clint@rutkas.com>
Co-authored-by: vanzue <vanzue@outlook.com>
This commit is contained in:
Youssef Victor
2026-02-14 08:47:56 +01:00
committed by GitHub
parent 8e264d37a1
commit a403323530
55 changed files with 766 additions and 625 deletions

View File

@@ -3,6 +3,10 @@
<Import Project="$(RepoRoot)src\Common.Dotnet.CsWinRT.props" />
<PropertyGroup>
<SelfContained>true</SelfContained>
<RuntimeIdentifier Condition="'$(Platform)' == 'x64'">win-x64</RuntimeIdentifier>
<RuntimeIdentifier Condition="'$(Platform)' == 'ARM64'">win-arm64</RuntimeIdentifier>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<IsPackable>false</IsPackable>
<OutputPath>$(RepoRoot)$(Configuration)\$(Platform)\tests\SettingsTests\</OutputPath>
@@ -10,6 +14,7 @@
<!-- These are caused by streamjsonrpc dependency on Microsoft.VisualStudio.Threading.Analyzers -->
<!-- We might want to add that to the project and fix the issues as well -->
<NoWarn>VSTHRD002;VSTHRD110;VSTHRD100;VSTHRD200;VSTHRD101</NoWarn>
<OutputType>Exe</OutputType>
</PropertyGroup>
<ItemGroup>

View File

@@ -126,10 +126,22 @@ namespace ViewModelTests
public void StartupShouldEnableRunOnStartUpWhenSuccessful()
{
// Assert
bool sawExpectedIpcPayload = false;
Func<string, int> sendMockIPCConfigMSG = msg =>
{
if (string.IsNullOrWhiteSpace(msg))
{
return 0;
}
OutGoingGeneralSettings snd = JsonSerializer.Deserialize<OutGoingGeneralSettings>(msg);
if (snd?.GeneralSettings is null)
{
return 0;
}
Assert.IsTrue(snd.GeneralSettings.Startup);
sawExpectedIpcPayload = true;
return 0;
};
@@ -150,16 +162,29 @@ namespace ViewModelTests
// act
viewModel.Startup = true;
Assert.IsTrue(sawExpectedIpcPayload);
}
[TestMethod]
public void RunElevatedShouldEnableAlwaysRunElevatedWhenSuccessful()
{
// Assert
bool sawExpectedIpcPayload = false;
Func<string, int> sendMockIPCConfigMSG = msg =>
{
if (string.IsNullOrWhiteSpace(msg))
{
return 0;
}
OutGoingGeneralSettings snd = JsonSerializer.Deserialize<OutGoingGeneralSettings>(msg);
if (snd?.GeneralSettings is null)
{
return 0;
}
Assert.IsTrue(snd.GeneralSettings.RunElevated);
sawExpectedIpcPayload = true;
return 0;
};
@@ -182,6 +207,7 @@ namespace ViewModelTests
// act
viewModel.RunElevated = true;
Assert.IsTrue(sawExpectedIpcPayload);
}
[TestMethod]
@@ -189,12 +215,24 @@ namespace ViewModelTests
{
// Arrange
GeneralViewModel viewModel = null;
bool sawExpectedIpcPayload = false;
// Assert
Func<string, int> sendMockIPCConfigMSG = msg =>
{
if (string.IsNullOrWhiteSpace(msg))
{
return 0;
}
OutGoingGeneralSettings snd = JsonSerializer.Deserialize<OutGoingGeneralSettings>(msg);
if (snd?.GeneralSettings is null)
{
return 0;
}
Assert.AreEqual("light", snd.GeneralSettings.Theme);
sawExpectedIpcPayload = true;
return 0;
};
@@ -214,17 +252,29 @@ namespace ViewModelTests
// act
viewModel.ThemeIndex = 1;
Assert.IsTrue(sawExpectedIpcPayload);
}
[TestMethod]
public void IsDarkThemeRadioButtonCheckedShouldThemeToDarkWhenSuccessful()
{
// Arrange
// Assert
bool sawExpectedIpcPayload = false;
Func<string, int> sendMockIPCConfigMSG = msg =>
{
if (string.IsNullOrWhiteSpace(msg))
{
return 0;
}
OutGoingGeneralSettings snd = JsonSerializer.Deserialize<OutGoingGeneralSettings>(msg);
if (snd?.GeneralSettings is null)
{
return 0;
}
Assert.AreEqual("dark", snd.GeneralSettings.Theme);
sawExpectedIpcPayload = true;
return 0;
};
@@ -244,17 +294,29 @@ namespace ViewModelTests
// act
viewModel.ThemeIndex = 0;
Assert.IsTrue(sawExpectedIpcPayload);
}
[TestMethod]
public void IsShowSysTrayIconEnabledByDefaultShouldDisableWhenSuccessful()
{
// Arrange
// Assert
bool sawExpectedIpcPayload = false;
Func<string, int> sendMockIPCConfigMSG = msg =>
{
if (string.IsNullOrWhiteSpace(msg))
{
return 0;
}
OutGoingGeneralSettings snd = JsonSerializer.Deserialize<OutGoingGeneralSettings>(msg);
if (snd?.GeneralSettings is null)
{
return 0;
}
Assert.IsFalse(snd.GeneralSettings.ShowSysTrayIcon);
sawExpectedIpcPayload = true;
return 0;
};
@@ -274,6 +336,7 @@ namespace ViewModelTests
// Act
viewModel.ShowSysTrayIcon = false;
Assert.IsTrue(sawExpectedIpcPayload);
}
[TestMethod]