Added unit tests for low-coverage System.Windows.Forms classes - #14911
Added unit tests for low-coverage System.Windows.Forms classes#14911Sathish-087 wants to merge 4 commits into
Conversation
|
@SimonZhao888, could you do a manual review of this? Thx! |
There was a problem hiding this comment.
🟡 Changes recommended
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds unit coverage for previously low-coverage WinForms rendering, focus-restoration, and browser-history components.
Changes:
- Tests radio-button adapter painting and layout.
- Tests ToolStrip focus restoration.
- Tests HtmlHistory navigation, validation, and disposal.
File summaries
| File | Description |
|---|---|
RadioButtonFlatAdapterTests.cs |
Tests flat adapter rendering and layout. |
RadioButtonPopupAdapterTests.cs |
Tests popup adapter states and rendering. |
ToolStrip.RestoreFocusMessageFilterTests.cs |
Tests message filtering and focus restoration. |
HtmlHistoryTests.cs |
Tests history APIs and disposal behavior. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 3
- Review effort level: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
|
||
| Action action = () => adapter.PaintDown(e, control.Checked ? CheckState.Checked : CheckState.Unchecked); | ||
|
|
||
| action.Should().NotThrow(); |
There was a problem hiding this comment.
Updated the paint test cases based on existing "HasPixelChanged" pattern.
|
|
||
| Action action = () => adapter.PaintDown(e, control.Checked ? CheckState.Checked : CheckState.Unchecked); | ||
|
|
||
| action.Should().NotThrow(); |
There was a problem hiding this comment.
Updated the paint test cases based on existing HasPixelChanged pattern.
| await Task.Run(() => control.Navigate(path)); | ||
| Assert.True(await source.Task); |
There was a problem hiding this comment.
Modified this test case
| history.Should().NotBeNull(); | ||
|
|
||
| // Relative position always forwards to COM go(); 0 is the safe relative position. | ||
| Action goRelative = () => history!.Go(0); |
There was a problem hiding this comment.
It would make our test cases more comprehensive if we could also cover some edge-case navigation scenarios here—such as Go(-1) or cases where the index falls outside the range of available history.
There was a problem hiding this comment.
Added new test case for Go(-1).
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #14911 +/- ##
=============================================
Coverage 37.24166% 37.24166%
=============================================
Files 246 246
Lines 9774 9774
Branches 1029 1029
=============================================
Hits 3640 3640
Misses 5970 5970
Partials 164 164
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
…ix_Issue_13442
Fixes #13442
Proposed changes
Customer Impact
Regression?
Risk
Test methodology
Accessibility testing
NA
Test environment(s)
Microsoft Reviewers: Open in CodeFlow