Add unit tests for PowerAccent.Core and Peek.Common helpers#46684
Add unit tests for PowerAccent.Core and Peek.Common helpers#46684
Conversation
Add PowerAccent.Core.UnitTests project with tests for: - Point, Size, Rect struct constructors and division operators - Calculation position logic with boundary conditions and DPI - Languages character mapping for multiple languages Add Peek.Common.UnitTests project with tests for: - MathHelper.Modulo with positive/negative values - MathHelper.NumberOfDigits with edge cases - PathHelper.IsUncPath with various path formats Agent-Logs-Url: https://github.com/microsoft/PowerToys/sessions/643cb57b-c352-45a6-83d0-d6b09011290b Co-authored-by: crutkas <1462282+crutkas@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
|
@copilot add Ene to https://github.com/microsoft/PowerToys/blob/main/.github/actions/spell-check/allow/code.txt remove the following list LPCFHOOKPROC LUMA MAXDWORD MRT VSync |
… expect list Agent-Logs-Url: https://github.com/microsoft/PowerToys/sessions/717795b3-9c5f-484e-9b9c-63de37852f81 Co-authored-by: crutkas <1462282+crutkas@users.noreply.github.com>
Added |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
@copilot this claims 95 new tests but the test count doesn't reflect that |
Agent-Logs-Url: https://github.com/microsoft/PowerToys/sessions/9ffea101-795b-4b8c-817a-ab5af7004f72 Co-authored-by: crutkas <1462282+crutkas@users.noreply.github.com>
The test projects were missing from |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
@copilot fix SA1124 errors |
Agent-Logs-Url: https://github.com/microsoft/PowerToys/sessions/00075017-9397-4cb6-ad53-1afda756d401 Co-authored-by: crutkas <1462282+crutkas@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
|
@copilot fix spelling errors |
Agent-Logs-Url: https://github.com/microsoft/PowerToys/sessions/1daa557f-51f2-454e-a7f9-aacc3912d36f Co-authored-by: crutkas <1462282+crutkas@users.noreply.github.com>
Added |
|
@copilot fix the build errors. |
Agent-Logs-Url: https://github.com/microsoft/PowerToys/sessions/0b83d8fc-328d-47ec-a746-685956604afe Co-authored-by: crutkas <1462282+crutkas@users.noreply.github.com>
Added missing Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
@copilot SA1508 and CS0246 errors, please fix |
…missing using System Agent-Logs-Url: https://github.com/microsoft/PowerToys/sessions/a6ae0e3d-68ed-4a4f-8b91-e039e2f05689 Co-authored-by: crutkas <1462282+crutkas@users.noreply.github.com>
Fixed both in fb7c945:
|
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
@copilot 'Audit deps.json files for all applications' failed. PowerToys.Peek.Common.UnitTests.deps.json shows it is on the wrong version, it is showing 9.0.1025.47515 when the rest of the solution is on 9.0.1426.11910. AdvancedPaste.UnitTests.deps.json does show correctly. |
Agent-Logs-Url: https://github.com/microsoft/PowerToys/sessions/a7787ea5-42eb-4e09-96c8-c295385faa9c Co-authored-by: crutkas <1462282+crutkas@users.noreply.github.com>
Added |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Summary of the Pull Request
Adds 105 unit tests across two new test projects for modules with zero prior test coverage: PowerAccent.Core (geometric types, toolbar positioning, language character mappings) and Peek.Common (math helpers, UNC path detection).
Checked existing open PRs (#46679 covers Hosts/ColorPicker, #45375 covers StringTruncationHelper) to avoid duplication.
PR Checklist
Detailed Description of the Pull Request / Additional comments
PowerAccent.Core.UnitTests (new project, 72 tests)
PointTests,SizeTests,RectTests— Constructors (default, int, double, composite), division operators (scalar + componentwise),DivideByZeroExceptionguards, implicit conversions fromSystem.DrawingtypesCalculationTests—GetRawCoordinatesFromCaret: left/right/top boundary clamping, multi-monitor offset screens.GetRawCoordinatesFromPosition: all 9Positionenum values at DPI 1.0/1.5/2.0, verifying offset and window-size scalingLanguagesTests— Empty/single/multi-language arrays, deduplication across combined languages, known accent verification (French à/â/æ, German ö/ü/ß, Spanish ñ, Czech č, Polish ł, Vietnamese multi-diacritics), special characters (subscript/superscript/fractions),_allLanguagesCachehit, exhaustiveLetterKeysweep with no-duplicate assertionAdded
InternalsVisibleToonPowerAccent.Core.csproj→PowerToys.PowerAccent.Core.UnitTests(follows existing pattern in imageresizer, CmdPal, MouseJump, etc.).Peek.Common.UnitTests (new project, 33 tests)
MathHelperTests—Modulo: proper wrapping for negative dividends (e.g.Modulo(-1, 3) == 2), zero, exact division, large values.NumberOfDigits: zero, negatives, powers-of-ten boundaries (9→10, 99→100),int.MaxValuePathHelperTests—IsUncPath: standard UNC, IP-based, dotted FQDN servers →true; local drives, relative paths, HTTP URLs,file:///URIs, single backslash, empty string →falseSolution and CI integration
PowerAccent.Core.UnitTestsandPeek.Common.UnitTeststoPowerToys.slnxwith ARM64/x64 platform configurations so CI builds and discovers the tests via the existing**\*UnitTest*.dllVSTest pattern.Common.SelfContained.propsin both test projects to pinSelfContained=trueandRuntimeIdentifier, ensuring the deps.json resolves the same .NET runtime version as the rest of the solution (fixesverifyDepsJsonLibraryVersions.ps1audit step).Spell-check allow/expect list updates
Ene,traies,uditto.github/actions/spell-check/allow/code.txtto resolve unrecognized-spelling alerts.github/actions/spell-check/expect.txt:LPCFHOOKPROC,LUMA,MAXDWORD,MRT,VSyncStyleCop and build compliance
#region/#endregiondirectives from test files to fix SA1124 errorsusing System;toPointTests.cs,SizeTests.cs,RectTests.cs, andLanguagesTests.csforDivideByZeroException,Array, andEnumtypes (ImplicitUsingsis disabled globally inDirectory.Build.props)using System.Linq;toLanguagesTests.csforDistinct()andCount()extension methodsLanguagesTests.cs,CalculationTests.cs,MathHelperTests.cs, andPathHelperTests.csto fix SA1508 errorsValidation Steps Performed
[TestClass],[TestMethod],[DataRow]) consistent with repo conventionsInternalsVisibleTo)PowerToys.slnxfor CI discovery#regiondirectives remain (SA1124 compliance)usingdirectives are present for all required namespaces (repo disablesImplicitUsingsglobally), includingusing System;forDivideByZeroException,Array,Enumandusing System.Linq;for LINQ extension methodsCommon.SelfContained.propsto pin .NET runtime version consistently with the rest of the solution (deps.json audit compliance)