Skip to content

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

Merged

Conversation

Zheng-Li01
Copy link
Member

@Zheng-Li01 Zheng-Li01 commented Jun 18, 2025

Related #13442

Proposed changes

Add unit test file:DataGridViewImageCellTests.cs for public/protected methods/properties of the DataGridViewImageCell.cs

Microsoft Reviewers: Open in CodeFlow

Copy link

codecov bot commented Jun 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.79330%. Comparing base (ece6f6d) to head (8b518fd).
Report is 51 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main      #13616         +/-   ##
===================================================
+ Coverage   76.58723%   76.79330%   +0.20606%     
===================================================
  Files           3253        3257          +4     
  Lines         640992      642349       +1357     
  Branches       47439       47561        +122     
===================================================
+ Hits          490918      493281       +2363     
+ Misses        146541      145406       -1135     
- Partials        3533        3662        +129     
Flag Coverage Δ
Debug 76.79330% <100.00000%> (+0.20606%) ⬆️
integration 18.98375% <ø> (+0.50159%) ⬆️
production 51.37602% <ø> (+0.35426%) ⬆️
test 97.41905% <100.00000%> (+0.00730%) ⬆️
unit 48.76126% <ø> (+0.32932%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Zheng-Li01 Zheng-Li01 added the waiting-review This item is waiting on review by one or more members of team label Jun 18, 2025
@LeafShi1 LeafShi1 requested a review from Copilot June 19, 2025 07:17
Copy link
Contributor

@Copilot Copilot AI left a 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 to Cell or DataGridViewImageCellInstance.
    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 where OwningColumn and a valid image value are set so that GetContentBounds returns a non‐empty rectangle.
        Rectangle bounds = (Rectangle)dataGridViewImageCell.TestAccessor().Dynamic.GetContentBounds(g, style, 0);

@LeafShi1 LeafShi1 requested a review from Epica3055 June 24, 2025 06:28
@LeafShi1 LeafShi1 removed the waiting-review This item is waiting on review by one or more members of team label Jun 25, 2025
@dotnet-policy-service dotnet-policy-service bot added the waiting-author-feedback The team requires more information from the author label Jul 4, 2025
@ricardobossan ricardobossan added the waiting-review This item is waiting on review by one or more members of team label Jul 4, 2025
@dotnet-policy-service dotnet-policy-service bot removed the waiting-author-feedback The team requires more information from the author label Jul 4, 2025
ricardobossan
ricardobossan previously approved these changes Jul 5, 2025
@LeafShi1 LeafShi1 merged commit ecd33a6 into dotnet:main Jul 17, 2025
8 checks passed
@dotnet-policy-service dotnet-policy-service bot removed the waiting-review This item is waiting on review by one or more members of team label Jul 17, 2025
@Zheng-Li01 Zheng-Li01 deleted the Add_code_coverage_for_DataGridViewImageCell branch July 17, 2025 08:23
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.

3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy