Skip to content

Adding GetData test and SetAudio tests to ClipboardCoreTests #13464

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

LeafShi1
Copy link
Member

@LeafShi1 LeafShi1 commented May 15, 2025

Related #13331

Proposed changes

Adding GetData tests and SetAudio tests to ClipboardCoreTests

Microsoft Reviewers: Open in CodeFlow

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 new unit tests to validate ClipboardCore’s GetData and SetAudio behavior, ensuring correct handling of text formats and audio data via byte arrays and streams.

  • Tests for SetData/GetData with UnicodeText and null/empty/invalid formats
  • Tests for SetAudio with both byte arrays and Stream inputs, plus a helper data provider
Comments suppressed due to low confidence (3)

src/System.Private.Windows.Core/tests/System.Private.Windows.Core.Tests/System/Private/Windows/Ole/ClipboardCoreTests.cs:384

  • [nitpick] The test name implies GetData returns null, but it only checks GetDataPresent; consider renaming to GetDataPresent_NullOrEmptyFormat_ReturnsFalse for clarity.
public void GetData_NullOrEmptyFormat_Returns_Null(string? format)

src/System.Private.Windows.Core/tests/System.Private.Windows.Core.Tests/System/Private/Windows/Ole/ClipboardCoreTests.cs:386

  • Currently the test only asserts GetDataPresent; add an assertion for outData.GetData(format) returning null to cover both API calls.
ClipboardCore.SetData(new DataObject(SomeDataObject.Format, null!), copy: false, retryTimes: 1, retryDelay: 0);

src/System.Private.Windows.Core/tests/System.Private.Windows.Core.Tests/System/Private/Windows/Ole/ClipboardCoreTests.cs:418

  • [nitpick] The name GetEmptyStreamData suggests only empty streams but also yields non-empty data; consider renaming to GetStreamAudioData or similar.
public static IEnumerable<object[]> GetEmptyStreamData()

Copy link

codecov bot commented May 15, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.61323%. Comparing base (71a8e95) to head (4655c65).
Report is 93 commits behind head on main.

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main      #13464         +/-   ##
===================================================
+ Coverage   76.60371%   76.61323%   +0.00951%     
===================================================
  Files           3230        3237          +7     
  Lines         639097      639477        +380     
  Branches       47289       47319         +30     
===================================================
+ Hits          489572      489924        +352     
- Misses        145953      146029         +76     
+ Partials        3572        3524         -48     
Flag Coverage Δ
Debug 76.61323% <ø> (+0.00951%) ⬆️
integration 18.53440% <ø> (-0.25368%) ⬇️
production 51.02228% <ø> (+0.01125%) ⬆️
test 97.41244% <ø> (+0.00833%) ⬆️
unit 48.42211% <ø> (+0.00304%) ⬆️

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.

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 waiting-review This item is waiting on review by one or more members of team labels May 16, 2025
@dotnet-policy-service dotnet-policy-service bot removed the waiting-author-feedback The team requires more information from the author label May 16, 2025
Copy link
Member

@KlausLoeffelmann KlausLoeffelmann left a comment

Choose a reason for hiding this comment

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

Just a nit remark.
Merge it, if you like!

ricardobossan
ricardobossan previously approved these changes 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.

All LGTM!

@LeafShi1 LeafShi1 merged commit 803287f into dotnet:main Jun 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 Jun 17, 2025
@LeafShi1 LeafShi1 deleted the Move_ClipboardTests_To_ClipboardCoreTests branch June 20, 2025 05:43
@github-actions github-actions bot locked and limited conversation to collaborators Jul 20, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants