Skip to content

[Repo Assist] test: add MenuSizingHelper unit tests + ShellQuoting edge cases#142

Draft
github-actions[bot] wants to merge 1 commit intomasterfrom
repo-assist/test-sizing-helper-coverage-2026-04-03-9a1d084563743567
Draft

[Repo Assist] test: add MenuSizingHelper unit tests + ShellQuoting edge cases#142
github-actions[bot] wants to merge 1 commit intomasterfrom
repo-assist/test-sizing-helper-coverage-2026-04-03-9a1d084563743567

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions bot commented Apr 3, 2026

🤖 This PR was created by Repo Assist, an automated AI assistant.

Summary

Adds dedicated unit tests for MenuSizingHelper and extends ShellQuotingTests with previously uncovered edge cases.

MenuSizingHelperTests (new file — 21 tests)

MenuSizingHelper was used in integration-style scenarios inside MenuPositionerTests, but had no dedicated unit tests. The new class covers all documented edge cases for both methods:

ConvertPixelsToViewUnits

  • Zero / negative pixel inputs → 0
  • DPI = 0 fallback to 96 (same as 100% scale)
  • Correct scaling at 96, 120, 144, 192 DPI
  • Extreme DPI: result is always at least 1

CalculateWindowHeight

  • Normal fit / content smaller than minimum → minimumHeight
  • Content larger than work area → clamped to work area
  • Negative content → treated as zero
  • minimumHeight < 1 → forced to 1
  • Zero / negative work area → returns max(content, minimum)
  • minimumHeight > workAreaHeight → clamped to work area
  • Typical tray menu scenarios

ShellQuotingTests (6 additional cases)

Previously untested metacharacters and scenarios:

  • Closing brackets ], }, )NeedsQuoting returns true
  • Newline (\n) and carriage-return (\r) → NeedsQuoting returns true
  • FormatExecCommand with a single argument
  • FormatExecCommand with an empty array → returns ""

Test Status

Suite Before After
OpenClaw.Tray.Tests 99 passed 120 passed (+21)
OpenClaw.Shared.Tests 525 passed, 20 skipped 531 passed, 20 skipped (+6)

All tests pass. No production code was modified.

Generated by Repo Assist ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@cbb46ab386962aa371045839fc9998ee4e97ca64

Add dedicated MenuSizingHelperTests.cs covering all edge cases
for CalculateWindowHeight and ConvertPixelsToViewUnits:
- zero/negative pixel inputs
- zero DPI fallback to 96
- DPI scaling (96, 120, 144, 192)
- minimum height enforcement and clamping
- negative/zero work area handling
- minimum larger than work area

Extend ShellQuotingTests with previously untested metacharacters
(], }, )), newline/carriage-return chars, and FormatExecCommand
with single and empty argument arrays.

Tray tests: 99 → 120 passed
Shared tests: 525 → 531 passed (551 total, 20 skipped)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants