-
Notifications
You must be signed in to change notification settings - Fork 1k
Add unit test for GridToolTip.cs file #13533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #13533 +/- ##
====================================================
+ Coverage 62.21083% 76.59019% +14.37936%
====================================================
Files 3213 3253 +40
Lines 638302 640992 +2690
Branches 47201 47439 +238
====================================================
+ Hits 397093 490937 +93844
+ Misses 234153 146518 -87635
+ Partials 7056 3537 -3519
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces unit tests for the GridToolTip class to verify its functionality with respect to tooltip value setting, handling of null and empty strings, text truncation, resetting behavior, and handle creation.
- Added comprehensive tests covering various tooltip value scenarios
- Integrated handle creation validation through a Form-based test
public void GridToolTip_Reset() | ||
{ | ||
_toolTip.ToolTip = "abc"; | ||
_toolTip.Reset(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The 'GridToolTip_Reset' test expects the tooltip value to remain unchanged after calling Reset(). Consider adding a comment to clarify the intended behavior of Reset() to improve code clarity and maintainability.
Copilot uses AI. Check for mistakes.
...test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/GridToolTipTests.cs
Outdated
Show resolved
Hide resolved
...test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/GridToolTipTests.cs
Outdated
Show resolved
Hide resolved
...test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/GridToolTipTests.cs
Outdated
Show resolved
Hide resolved
...test/unit/System.Windows.Forms/System/Windows/Forms/PropertyGridInternal/GridToolTipTests.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
_toolTip.ToolTip = new('a', 1005); | ||
|
||
_toolTip.ToolTip.Should().EndWith("..."); | ||
_toolTip.ToolTip.Length.Should().Be(1003); | ||
|
||
_toolTip.ToolTip = new('b', 1000); | ||
|
||
_toolTip.ToolTip.Should().NotEndWith("..."); | ||
_toolTip.ToolTip.Length.Should().Be(1000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the readability and clarity, I think maybe it's better to introduce somthing like this private const int MaximumToolTipLength = 1000;
, which is what did in GridToolTip.cs
Related #13442
Proposed changes
Microsoft Reviewers: Open in CodeFlow