Skip to content

Add 39 C++ MSTest tests for MeasureTool#46933

Open
crutkas wants to merge 4 commits intomicrosoft:mainfrom
crutkas:split/measuretool-tests
Open

Add 39 C++ MSTest tests for MeasureTool#46933
crutkas wants to merge 4 commits intomicrosoft:mainfrom
crutkas:split/measuretool-tests

Conversation

@crutkas
Copy link
Copy Markdown
Member

@crutkas crutkas commented Apr 12, 2026

Summary

39 new TEST_METHODs covering MeasureTool:

  • BGRATextureView pixel indexing and color proximity
  • Edge detection: uniform, centered/corner/asymmetric boxes, tolerance
  • Unit conversion: pixel/inch/cm/mm with DPI scaling
  • Constants validation (frame rate, font size, opacity)

Split from #46905 (4/7) — see that PR for full context.

Files Changed (7)

  • src/modules/MeasureTool/UnitTests/MeasureToolTests.cpp (new)
  • src/modules/MeasureTool/UnitTests/UnitTests-MeasureTool.vcxproj (new)
  • src/modules/MeasureTool/UnitTests/UnitTests-MeasureTool.vcxproj.filters (new)
  • src/modules/MeasureTool/UnitTests/packages.config (new)
  • src/modules/MeasureTool/UnitTests/pch.cpp (new)
  • src/modules/MeasureTool/UnitTests/pch.h (new)
  • PowerToys.slnx (modified — +1 project ref in /modules/MeasureTool/Tests/)

BGRATextureView pixel indexing and color proximity, edge detection (uniform,
centered/corner/asymmetric boxes, tolerance), unit conversion (pixel/inch/cm/mm
with DPI scaling), and constants validation (frame rate, font size, opacity).

Split from PR microsoft#46905 (4/7)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@crutkas crutkas added the Area-Tests issues that relate to tests label Apr 12, 2026
@crutkas crutkas requested a review from a team as a code owner April 12, 2026 17:25
@crutkas crutkas added the Area-Tests issues that relate to tests label Apr 12, 2026
@crutkas
Copy link
Copy Markdown
Member Author

crutkas commented Apr 12, 2026

/azp run

@crutkas crutkas added the Needs-Review This Pull Request awaits the review of a maintainer. label Apr 12, 2026
@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Copy Markdown
Member

@DHowett DHowett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An engineer--not a computer--needs to verify each of these test cases to ensure that they are worthwhile and on-target.

…nt tests

- Kept 19 BGRATextureView + EdgeDetection tests (all call real product code)
- Deleted 12 hollow UnitConversion tests that reimplemented Convert() locally
- Trimmed Constants to 2 safety-critical values (TargetFrameRate, MouseWheelToleranceStep)
- Added 8 real Measurement class tests via MeasurementForTests.cpp
- Added PixelsClose total-mode large diff test documenting & 0xFF truncation bug
- Every test has deep comments explaining what product code it exercises and why
- Documented 3 product bugs: mm formula 100x wrong, & 0xFF truncation, FindEdge boundary

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

This comment has been minimized.

Deleted MeasurementForTests.cpp/h (copy-pasted product code).
Now compiles the real MeasureToolCore/Measurement.cpp in the test project.
Added #ifndef UNIT_TEST guards around WinRT-dependent functions
(InitResources, GetUnitAbbreviation, Print, PrintToStream) that the
tests don't need — Width/Height/GetUnitFromIndex/Convert are tested
using the exact product code.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Tests issues that relate to tests Needs-Review This Pull Request awaits the review of a maintainer.

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants