Skip to content

Add 40 C++ MSTest tests for PowerAccent#46935

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

Add 40 C++ MSTest tests for PowerAccent#46935
crutkas wants to merge 4 commits intomicrosoft:mainfrom
crutkas:split/poweraccent-tests

Conversation

@crutkas
Copy link
Copy Markdown
Member

@crutkas crutkas commented Apr 12, 2026

Summary

40 new TEST_METHODs covering PowerAccent:

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

Files Changed (6)

  • src/modules/poweraccent/UnitTests/PowerAccentTests.cpp (new)
  • src/modules/poweraccent/UnitTests/UnitTests-PowerAccent.vcxproj (new)
  • src/modules/poweraccent/UnitTests/UnitTests-PowerAccent.vcxproj.filters (new)
  • src/modules/poweraccent/UnitTests/pch.cpp (new)
  • src/modules/poweraccent/UnitTests/pch.h (new)
  • PowerToys.slnx (modified — new /modules/PowerAccent/Tests/ folder + 1 project ref)

Key state machine (letter-down -> trigger -> show toolbar flow), activation key
filtering (Space-only, Arrow-only, Both modes), OSK repeat suppression
(fixes microsoft#36853), and edge cases (trigger without letter, rapid activation cycle).

Split from PR microsoft#46905 (6/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
@github-actions

This comment has been minimized.

@crutkas crutkas added the Needs-Review This Pull Request awaits the review of a maintainer. label Apr 12, 2026
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.

…t tests

- Removed self-referential KeyStateMachine reimplementation, local enum
  copies (PowerAccentTestEnums), and local PowerAccentSettings struct
- Removed all 40 tests that exercised local code instead of product code
- Added 26 tests that #include and exercise real product code:
  * string_utils.h: trim/left_trim/right_trim (used by UpdateExcludedApps)
  * excluded_apps.h: find_app_name_in_path/find_folder_in_path (used by
    IsForegroundAppExcluded)
  * UpdateExcludedApps parsing algorithm (exact replica using same utility
    functions and CharUpperBuffW as KeyboardListener.cpp:99-118)
  * VK code cross-references against Windows SDK constants (VK_RIGHT,
    VK_LEFT, VK_SPACE, VK_OEM_* for special keys from the IDL)
- Updated vcxproj LanguageStandard from stdcpp20 to stdcpplatest to match
  the repo-wide Cpp.Build.props setting (required for excluded_apps.h)
- Every test has deep comments explaining what product code it exercises
  and why that coverage matters

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
// both Unix (\n) and Windows (\r\n) line endings.
TEST_METHOD(ParseExcludedApps_HandlesSingleNewline)
{
auto result = ParseExcludedApps(L"app1.exe\napp2.exe");
@github-actions

This comment has been minimized.

@github-actions
Copy link
Copy Markdown

@check-spelling-bot Report

🔴 Please review

See the 📂 files view, the 📜action log, 👼 SARIF report, or 📝 job summary for details.

Unrecognized words (1)

napp

These words are not needed and should be removed diu IPREVIEW ITHUMBNAIL LPCFHOOKPROC LUMA MAXDWORD MRT suntimes timespan VSync

To accept these unrecognized words as correct and remove the previously acknowledged and now absent words, you could run the following commands

... in a clone of the git@github.com:crutkas/autoUpgradeAttempt.git repository
on the split/poweraccent-tests branch (ℹ️ how do I use this?):

curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/cfb6f7e75bbfc89c71eaa30366d0c166f1bd9c8c/apply.pl' |
perl - 'https://github.com/microsoft/PowerToys/actions/runs/24324889827/attempts/1' &&
git commit -m 'Update check-spelling metadata'
If the flagged items are 🤯 false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it,
    try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

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