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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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.59784%. Comparing base (5821493) to head (20655b6).
Report is 16 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                  @@
##                main      #13511          +/-   ##
====================================================
+ Coverage   62.21083%   76.59784%   +14.38701%     
====================================================
  Files           3213        3232          +19     
  Lines         638302      639176         +874     
  Branches       47201       47297          +96     
====================================================
+ Hits          397093      489595       +92502     
+ Misses        234153      146000       -88153     
+ Partials        7056        3581        -3475     
Flag Coverage Δ
Debug 76.59784% <100.00000%> (+14.38701%) ⬆️
integration 18.77731% <ø> (-0.01147%) ⬇️
production 51.00311% <ø> (+32.21433%) ⬆️
test 97.40419% <100.00000%> (+0.00007%) ⬆️
unit 48.40165% <ø> (?)

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

@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();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-test coverage waiting-review This item is waiting on review by one or more members of team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants