-
Notifications
You must be signed in to change notification settings - Fork 1k
Add code coverage for DataGridViewImageCell #13616
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
base: main
Are you sure you want to change the base?
Add code coverage for DataGridViewImageCell #13616
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #13616 +/- ##
===================================================
+ Coverage 76.58723% 76.61283% +0.02559%
===================================================
Files 3253 3254 +1
Lines 640992 641155 +163
Branches 47439 47450 +11
===================================================
+ Hits 490918 491207 +289
+ Misses 146541 146391 -150
- Partials 3533 3557 +24
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 a new suite of unit tests for DataGridViewImageCell
, covering its constructors, property getters, layout calculations, painting logic, and ToString
behavior.
- Adds
DataGridViewImageCellTests.cs
with tests for default ctor behavior,DefaultNewRowValue
, content/error bounds, preferred size, painting, and string representation. - Uses the test accessor to exercise protected layout and rendering methods.
- Verifies exception behavior and default values under various DataGridView configurations.
Comments suppressed due to low confidence (2)
src/test/unit/System.Windows.Forms/System/Windows/Forms/DataGridViewImageCellTests.cs:10
- [nitpick] Property names in C# should use PascalCase. Consider renaming
dataGridViewImageCell
toCell
orDataGridViewImageCellInstance
.
public DataGridViewImageCell dataGridViewImageCell => new();
src/test/unit/System.Windows.Forms/System/Windows/Forms/DataGridViewImageCellTests.cs:95
- All
GetContentBounds
tests cover only the empty‐bounds paths. To improve coverage, add a test whereOwningColumn
and a valid image value are set so thatGetContentBounds
returns a non‐empty rectangle.
Rectangle bounds = (Rectangle)dataGridViewImageCell.TestAccessor().Dynamic.GetContentBounds(g, style, 0);
Related #13442
Proposed changes
Add unit test file:DataGridViewImageCellTests.cs for public/protected methods/properties of the DataGridViewImageCell.cs
Microsoft Reviewers: Open in CodeFlow