Files
PowerToys/src/modules/Workspaces/WorkspacesLib.UnitTests/WorkspacesLibUnitTests.vcxproj

76 lines
4.6 KiB
XML
Raw Normal View History

Workspaceslib ut (#40007) This pull request introduces a new unit testing framework for the `WorkspacesLib` module, adds test coverage for various utilities, and integrates the new test project into the build system. Key changes include adding the `WorkspacesLibUnitTests` project, implementing tests for `AppUtils`, `JsonUtils`, and `PwaHelper`, and updating the build configuration to include the new test project. ### Unit Tests Added: * **`AppUtilsTests`**: - Added comprehensive tests for methods such as `GetCurrentFolder`, `IsEdge`, `IsChrome`, and `IsSteamGame` to validate their behavior under various conditions. * **`JsonUtilsTests`**: - Implemented tests for reading and writing workspace data, including scenarios for invalid JSON, non-existent files, and valid workspace lists. * **`PwaHelperTests`**: - Added tests to ensure the stability of `PwaHelper` methods, such as `GetEdgeAppId`, `GetChromeAppId`, and `SearchPwaName`, even with invalid or empty inputs. ### Build System Updates: * **New Test Project Integration**: - Added the `WorkspacesLibUnitTests` project to the solution file `PowerToys.sln` with appropriate dependencies. - Updated build configurations to include the new test project for both Debug and Release builds across architectures. [[1]](diffhunk://#diff-ca837ce490070b91656ffffe31cbad8865ba9174e0f020231f77baf35ff3f811R2208-R2215) [[2]](diffhunk://#diff-ca837ce490070b91656ffffe31cbad8865ba9174e0f020231f77baf35ff3f811R2841) ### Pipeline Adjustments: * **Test Discovery**: - Updated the pipeline configuration in `.pipelines/v2/templates/job-build-project.yml` to discover the new `WorkspacesLibUnitTests.dll` during test runs. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2025-06-13 10:51:22 +08:00
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" />
<PropertyGroup Label="Globals">
<ProjectGuid>{A85D4D9F-9A39-4B5D-8B5A-9F2D5C9A8B4C}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>WorkspacesLibUnitTests</RootNamespace>
<ProjectName>Workspaces.Lib.UnitTests</ProjectName>
Workspaceslib ut (#40007) This pull request introduces a new unit testing framework for the `WorkspacesLib` module, adds test coverage for various utilities, and integrates the new test project into the build system. Key changes include adding the `WorkspacesLibUnitTests` project, implementing tests for `AppUtils`, `JsonUtils`, and `PwaHelper`, and updating the build configuration to include the new test project. ### Unit Tests Added: * **`AppUtilsTests`**: - Added comprehensive tests for methods such as `GetCurrentFolder`, `IsEdge`, `IsChrome`, and `IsSteamGame` to validate their behavior under various conditions. * **`JsonUtilsTests`**: - Implemented tests for reading and writing workspace data, including scenarios for invalid JSON, non-existent files, and valid workspace lists. * **`PwaHelperTests`**: - Added tests to ensure the stability of `PwaHelper` methods, such as `GetEdgeAppId`, `GetChromeAppId`, and `SearchPwaName`, even with invalid or empty inputs. ### Build System Updates: * **New Test Project Integration**: - Added the `WorkspacesLibUnitTests` project to the solution file `PowerToys.sln` with appropriate dependencies. - Updated build configurations to include the new test project for both Debug and Release builds across architectures. [[1]](diffhunk://#diff-ca837ce490070b91656ffffe31cbad8865ba9174e0f020231f77baf35ff3f811R2208-R2215) [[2]](diffhunk://#diff-ca837ce490070b91656ffffe31cbad8865ba9174e0f020231f77baf35ff3f811R2841) ### Pipeline Adjustments: * **Test Discovery**: - Updated the pipeline configuration in `.pipelines/v2/templates/job-build-project.yml` to discover the new `WorkspacesLibUnitTests.dll` during test runs. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2025-06-13 10:51:22 +08:00
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Label="Configuration">
[Dev][Build] VS 2026 Support (#44304) <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> ## Summary of the Pull Request This PR updates the PowerToys solution to support **Visual Studio 2026 (PlatformToolset v145)**. It centralizes the build configuration, updates the C++ language standards, and fixes an issue with a MouseJump unit test that appears while using the VS 2026 supported build agent. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [ ] Closes: #xxx - [x] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [x] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [x] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> ## Detailed Description of the Pull Request / Additional comments **Build System & Configuration:** - Updated `Cpp.Build.props` to use `v145` (VS 2026) as the default `PlatformToolset`, with fall back to `v143` for VS 2022. - Configured C++ Language Standard: - `stdcpplatest` for production projects. - Removed explicit `<PlatformToolset>` definitions from individual project files (approx. 37 modules) to inherit correctly from the central `Cpp.Build.props`. **Code Refactoring & Fixes:** - Updated `DrawingHelperTests.cs` in MouseJump Unit Test to ease the pixel difference tolerance. This became an issue after switching to the new VS2026 build agent. <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed - Validated successful compilation of the entire solution. Similar updates have been made to the .NET 10 branch, but these are much cleaner and will be merged into that branch once fully confirmed working. --------- Co-authored-by: Kai Tao (from Dev Box) <kaitao@microsoft.com> Co-authored-by: Gordon Lam (SH) <yeelam@microsoft.com>
2026-01-28 18:46:34 -05:00
Workspaceslib ut (#40007) This pull request introduces a new unit testing framework for the `WorkspacesLib` module, adds test coverage for various utilities, and integrates the new test project into the build system. Key changes include adding the `WorkspacesLibUnitTests` project, implementing tests for `AppUtils`, `JsonUtils`, and `PwaHelper`, and updating the build configuration to include the new test project. ### Unit Tests Added: * **`AppUtilsTests`**: - Added comprehensive tests for methods such as `GetCurrentFolder`, `IsEdge`, `IsChrome`, and `IsSteamGame` to validate their behavior under various conditions. * **`JsonUtilsTests`**: - Implemented tests for reading and writing workspace data, including scenarios for invalid JSON, non-existent files, and valid workspace lists. * **`PwaHelperTests`**: - Added tests to ensure the stability of `PwaHelper` methods, such as `GetEdgeAppId`, `GetChromeAppId`, and `SearchPwaName`, even with invalid or empty inputs. ### Build System Updates: * **New Test Project Integration**: - Added the `WorkspacesLibUnitTests` project to the solution file `PowerToys.sln` with appropriate dependencies. - Updated build configurations to include the new test project for both Debug and Release builds across architectures. [[1]](diffhunk://#diff-ca837ce490070b91656ffffe31cbad8865ba9174e0f020231f77baf35ff3f811R2208-R2215) [[2]](diffhunk://#diff-ca837ce490070b91656ffffe31cbad8865ba9174e0f020231f77baf35ff3f811R2841) ### Pipeline Adjustments: * **Test Discovery**: - Updated the pipeline configuration in `.pipelines/v2/templates/job-build-project.yml` to discover the new `WorkspacesLibUnitTests.dll` during test runs. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2025-06-13 10:51:22 +08:00
</PropertyGroup>
<PropertyGroup>
<ConfigurationType>DynamicLibrary</ConfigurationType>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<OutDir>..\..\..\..\$(Platform)\$(Configuration)\tests\Workspaces\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>..\;..\WorkspacesLib\;$(SolutionDir)src\;$(SolutionDir)src\common;$(SolutionDir)src\common\Telemetry;..\..\;..\..\..\;$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<UseFullPaths>true</UseFullPaths>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>$(VCInstallDir)UnitTest\\lib;$(SolutionDir)$(Platform)\\$(Configuration)\\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>propsys.lib;comctl32.lib;pathcch.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;Pathcch.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="pch.h" />
<ClInclude Include="targetver.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="pch.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="WorkspacesDataTests.cpp" />
<ClCompile Include="StringUtilsTests.cpp" />
<ClCompile Include="JsonUtilsTests.cpp" />
<ClCompile Include="AppUtilsTests.cpp" />
<ClCompile Include="PwaHelperTests.cpp" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\common\SettingsAPI\SettingsAPI.vcxproj">
<Project>{6955446d-23f7-4023-9bb3-8657f904af99}</Project>
</ProjectReference>
<ProjectReference Include="..\WorkspacesLib\WorkspacesLib.vcxproj">
<Project>{b31fcc55-b5a4-4ea7-b414-2dceae6af332}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.props'))" />
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5\build\native\Microsoft.Windows.CppWinRT.targets'))" />
</Target>
</Project>