Skip to content

Add unit test for RadioButtonStandardAdapter.cs, RadioButtonPopupAdapter.cs and RadioButtonFlatAdapter.cs files #13456

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 2 commits into
base: main
Choose a base branch
from

Conversation

Olina-Zhang
Copy link
Member

@Olina-Zhang Olina-Zhang commented May 14, 2025

Related #13442

Proposed changes

  • Add unit test file: RadioButtonStandardAdapterTests.cs for RadioButtonStandardAdapter.cs file.
  • Add unit test file: RadioButtonPopupAdapterTests.cs for RadioButtonPopupAdapter.cs file.
  • Add unit test file: RadioButtonFlatAdapterTests.cs for RadioButtonFlatAdapter.cs file

@Olina-Zhang Olina-Zhang requested a review from a team as a code owner May 14, 2025 07:13
@Olina-Zhang Olina-Zhang requested review from Copilot and removed request for a team May 14, 2025 07:15
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

This PR adds a new unit test file for RadioButtonStandardAdapter, verifying its rendering methods for various RadioButton appearance settings.

  • Adds tests for PaintUp, PaintDown, and PaintOver methods under different control appearances
  • Covers both Appearance.Button and Appearance.Normal cases
Comments suppressed due to low confidence (2)

src/test/unit/System.Windows.Forms/System/Windows/Forms/RadioButtonStandardAdapterTests.cs:72

  • [nitpick] The test method name 'PaintDown_AppearanceNormal_CallsPaintUp' may be misleading. If the intended behavior is for PaintDown to internally delegate to PaintUp on Appearance.Normal, consider clarifying the method name or adding a comment to explain this behavior.
public void PaintDown_AppearanceNormal_CallsPaintUp()

src/test/unit/System.Windows.Forms/System/Windows/Forms/RadioButtonStandardAdapterTests.cs:25

  • [nitpick] Currently, the tests only verify that the control properties remain unchanged after the painting call. Consider adding assertions or additional verifications (such as inspecting the bitmap or using a graphics mock) to ensure that the adapter’s painting logic executes as expected.
adapter.PaintUp(e, CheckState.Checked);

Copy link

codecov bot commented May 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 51.13003%. Comparing base (5821493) to head (3c7a751).
Report is 2 commits behind head on main.

❗ There is a different number of reports uploaded between BASE (5821493) and HEAD (3c7a751). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (5821493) HEAD (3c7a751)
test 1 0
Additional details and impacted files
@@                 Coverage Diff                  @@
##                main      #13456          +/-   ##
====================================================
- Coverage   62.21083%   51.13003%   -11.08081%     
====================================================
  Files           3213        2054        -1159     
  Lines         638302      286540      -351762     
  Branches       47201       41933        -5268     
====================================================
- Hits          397093      146508      -250585     
+ Misses        234153      137221       -96932     
+ Partials        7056        2811        -4245     
Flag Coverage Δ
Debug 51.13003% <ø> (-11.08081%) ⬇️
integration 18.78668% <ø> (-0.00210%) ⬇️
production 51.13003% <ø> (+32.34125%) ⬆️
test ?
unit 48.51120% <ø> (?)

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.

@Olina-Zhang Olina-Zhang requested a review from a team May 14, 2025 08:24
@Olina-Zhang Olina-Zhang changed the title Add unit test for RadioButtonStandardAdapter.cs file Add unit test for RadioButtonStandardAdapter.cs, RadioButtonPopupAdapter.cs and RadioButtonFlatAdapter.cs files May 14, 2025
@KlausLoeffelmann
Copy link
Member

Hey Olina,

let's please wait with unit tests for Button- and ToolStripRenderers, until the DarkMode changes are ready.

We would need to take a closer look anyway, since there are a few things, I need to investigate, which may have been regressed in the past.

I'll follow up!

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.

2 participants