Skip to content

Add code coverage for ImageListConverter & RelatedImageListAttribute #13511

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

Zheng-Li01
Copy link
Member

@Zheng-Li01 Zheng-Li01 commented May 23, 2025

Related #13442

Proposed changes
Add unit test file: ImageListConverterTests.cs & RelatedImageListAttributeTests for public/Internal methods of the ImageListConverter.cs & RelatedImageListAttribute.cs

Microsoft Reviewers: Open in CodeFlow

Copy link

codecov bot commented May 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.60416%. Comparing base (5821493) to head (1063a77).
Report is 85 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                  @@
##                main      #13511          +/-   ##
====================================================
+ Coverage   62.21083%   76.60416%   +14.39332%     
====================================================
  Files           3213        3238          +25     
  Lines         638302      639353        +1051     
  Branches       47201       47314         +113     
====================================================
+ Hits          397093      489771       +92678     
+ Misses        234153      146058       -88095     
+ Partials        7056        3524        -3532     
Flag Coverage Δ
Debug 76.60416% <100.00000%> (+14.39332%) ⬆️
integration 18.54667% <ø> (-0.24212%) ⬇️
production 51.01313% <ø> (+32.22435%) ⬆️
test 97.40075% <100.00000%> (-0.00337%) ⬇️
unit 48.40215% <ø> (?)

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 May 23, 2025
@Zheng-Li01 Zheng-Li01 requested a review from Copilot May 23, 2025 02:55
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

Adds unit tests to improve code coverage for ImageListConverter and RelatedImageListAttribute.

  • Introduce RelatedImageListAttributeTests covering constructor behavior
  • Introduce ImageListConverterTests covering base type assignment and GetPropertiesSupported

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/test/unit/System.Windows.Forms/System/Windows/Forms/RelatedImageListAttributeTests.cs Add test verifying that constructor value is returned by RelatedImageList property
src/test/unit/System.Windows.Forms/System/Windows/Forms/ImageListConverterTests.cs Add tests for default constructor base type and GetPropertiesSupported
Comments suppressed due to low confidence (4)

src/test/unit/System.Windows.Forms/System/Windows/Forms/RelatedImageListAttributeTests.cs:4

  • Test namespace 'System.Windows.Forms.Controls.Tests' does not align with the project’s folder and other test namespaces. Consider using 'System.Windows.Forms.Tests' to match existing patterns.
namespace System.Windows.Forms.Controls.Tests;

src/test/unit/System.Windows.Forms/System/Windows/Forms/RelatedImageListAttributeTests.cs:14

  • Consider adding tests for Equals, GetHashCode, and default attribute behavior to cover the full RelatedImageListAttribute API surface.
RelatedImageListAttribute attr = new(value);

src/test/unit/System.Windows.Forms/System/Windows/Forms/ImageListConverterTests.cs:6

  • Test namespace 'System.Windows.Forms.Controls.Tests' should be updated to 'System.Windows.Forms.Tests' to align with the assembly under test.
namespace System.Windows.Forms.Controls.Tests;

src/test/unit/System.Windows.Forms/System/Windows/Forms/ImageListConverterTests.cs:21

  • Add tests for GetProperties, ConvertTo, and ConvertFrom methods of ImageListConverter to ensure functionality beyond support flags is covered.
Converter.GetPropertiesSupported(null).Should().BeTrue();

LeafShi1
LeafShi1 previously approved these changes May 26, 2025
@LeafShi1 LeafShi1 requested a review from ricardobossan June 11, 2025 08:04
Copy link
Member

@ricardobossan ricardobossan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than small comments, all LGTM!

@ricardobossan ricardobossan added waiting-author-feedback The team requires more information from the author and removed waiting-review This item is waiting on review by one or more members of team labels Jun 12, 2025
@dotnet-policy-service dotnet-policy-service bot removed the waiting-author-feedback The team requires more information from the author label Jun 13, 2025
Copy link
Member

@ricardobossan ricardobossan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@LeafShi1 LeafShi1 merged commit 2e4e90a into dotnet:main Jun 17, 2025
8 checks passed
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