Skip to content

[Testing] Migration of Compatibility.Core platform-specific unit tests into device tests - 4#28105

Merged
PureWeen merged 11 commits intomainfrom
unknown repository
Mar 6, 2025
Merged

[Testing] Migration of Compatibility.Core platform-specific unit tests into device tests - 4#28105
PureWeen merged 11 commits intomainfrom
unknown repository

Conversation

@TamilarasanSF4853
Copy link
Copy Markdown
Contributor

Description of Change

Migration of Compatibility.Core platform-specific unit tests to device tests. Here the migrated cases which ensuring that the Opacity consistency of different elements matches their native counterparts. We are going to migrate tests in blocks in different PRs. This is the 4st group.

There are unit tests under:

  • src\Compatibility\Core\tests\Android
  • src\Compatibility\Core\tests\iOS
  • src\Compatibility\Core\tests\WinUI

That are not running right now. these cases from Xamarin.Forms where they could run as unit tests, but now with .NET MAUI this is not possible. So here I migrated the following cases in device tests.

This pull request introduces a series of changes across multiple test files to add functionality for verifying the opacity property of various UI elements. The most significant changes include the addition of methods to retrieve the platform-specific opacity values and new test cases to validate the opacity property consistency between the .NET MAUI controls and their native counterparts.

Additions for Opacity Verification:

Similar Additions for Other Elements:

Issues Fixed

Fixes #27303

@dotnet-policy-service dotnet-policy-service bot added community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration labels Feb 28, 2025
@ghost ghost added the area-testing Unit tests, device tests label Feb 28, 2025
@TamilarasanSF4853 TamilarasanSF4853 marked this pull request as ready for review February 28, 2025 12:51
Copilot AI review requested due to automatic review settings February 28, 2025 12:51
@TamilarasanSF4853 TamilarasanSF4853 requested a review from a team as a code owner February 28, 2025 12:51
Copy link
Copy Markdown
Contributor

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.

PR Overview

This PR migrates several platform-specific unit tests for verifying the opacity consistency of various UI elements from Xamarin.Forms to .NET MAUI device tests. Key changes include:

  • Addition of a GetPlatformOpacity method in each platform-specific test file (Android, iOS, Windows) for different controls.
  • Introduction of new tests for BoxView, CheckBox, Button, Entry, Editor, and Image to validate that the native opacity matches the control’s Opacity property.
  • Updates across multiple test files to ensure the migrated opacity verification cases run on device tests.

Reviewed Changes

File Description
BoxViewTests.cs Added VerifyBoxViewOpacityProperty test for BoxView.
CheckBoxTests.cs Added VerifyCheckBoxOpacityProperty test for CheckBox.
ButtonTests.cs Added VerifyButtonOpacityProperty test for Button.
EntryTests.cs Added VerifyEntryOpacityProperty test for Entry.
EditorTests.cs Added VerifyEditorOpacityProperty test for Editor.
CheckBoxTests.iOS.cs Added GetPlatformOpacity method for CheckBox on iOS.
CheckBoxTests.Android.cs Added GetPlatformOpacity method for CheckBox on Android.
CheckBoxTests.Windows.cs Added GetPlatformOpacity method for CheckBox on Windows.
ButtonTests.Windows.cs Added GetPlatformOpacity method for Button on Windows.
EditorTests.Windows.cs Added GetPlatformOpacity method for Editor on Windows.
BoxViewTests.Windows.cs Added GetPlatformOpacity method for BoxView on Windows.
EntryTests.Windows.cs Added GetPlatformOpacity method for Entry on Windows.
BoxViewTests.Android.cs Added GetPlatformOpacity method for BoxView on Android.
ImageTests.Android.cs Added GetPlatformOpacity and GetPlatformImage methods for Image on Android.
ButtonTests.Android.cs Added GetPlatformOpacity method for Button on Android.
EditorTests.iOS.cs Added GetPlatformOpacity method for Editor on iOS.
EntryTests.iOS.cs Added GetPlatformOpacity method for Entry on iOS.
EntryTests.Android.cs Added GetPlatformOpacity method for Entry on Android.
EditorTests.Android.cs Added GetPlatformOpacity method for Editor on Android.

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

Comments suppressed due to low confidence (1)

src/Controls/tests/DeviceTests/Elements/CheckBox/CheckBoxTests.Android.cs:17

  • The parameter name 'CheckBoxHandler' is capitalized; consider changing it to 'checkBoxHandler' for consistency with standard naming conventions.
Task<float> GetPlatformOpacity(CheckBoxHandler CheckBoxHandler)

@jsuarezruiz
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

Copy link
Copy Markdown
Contributor

@jsuarezruiz jsuarezruiz left a comment

Choose a reason for hiding this comment

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

The GetPlatformOpacity method is pending in the ButtonTests.iOS.cs class.

/Users/builder/azdo/_work/1/s/src/Controls/tests/DeviceTests/Elements/Button/ButtonTests.cs(87,36): error CS0103: The name 'GetPlatformOpacity' does not exist in the current context [/Users/builder/azdo/_work/1/s/src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj::TargetFramework=net9.0-ios]
    1 Error(s)

@TamilarasanSF4853
Copy link
Copy Markdown
Contributor Author

The GetPlatformOpacity method is pending in the ButtonTests.iOS.cs class.

/Users/builder/azdo/_work/1/s/src/Controls/tests/DeviceTests/Elements/Button/ButtonTests.cs(87,36): error CS0103: The name 'GetPlatformOpacity' does not exist in the current context [/Users/builder/azdo/_work/1/s/src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj::TargetFramework=net9.0-ios]
    1 Error(s)

@jsuarezruiz Resolved the mentioned issue and committed the changes, can you please review and trigger the CI again.

@jsuarezruiz
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@jsuarezruiz
Copy link
Copy Markdown
Contributor

/rebase

@jsuarezruiz
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen PureWeen merged commit ef9516c into dotnet:main Mar 6, 2025
123 checks passed
bhavanesh2001 pushed a commit to bhavanesh2001/maui that referenced this pull request Mar 7, 2025
…s into device tests - 4 (dotnet#28105)

* Enabled the Opacity property

* code changes

* code change

* Enabled the Opacity property

* code changes

* code modifications

* changes

* Update src/Controls/tests/DeviceTests/Elements/CheckBox/CheckBoxTests.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/Controls/tests/DeviceTests/Elements/Entry/EntryTests.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* ios changes

* modified codes

---------

Co-authored-by: nivetha-nagalingam <nivetha.nagalingam@syncfusion.com>
Co-authored-by: Anandhan Rajagopal <97146406+anandhan-rajagopal@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
rmarinho pushed a commit that referenced this pull request Mar 11, 2025
…s into device tests - 4 (#28105)

* Enabled the Opacity property

* code changes

* code change

* Enabled the Opacity property

* code changes

* code modifications

* changes

* Update src/Controls/tests/DeviceTests/Elements/CheckBox/CheckBoxTests.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/Controls/tests/DeviceTests/Elements/Entry/EntryTests.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* ios changes

* modified codes

---------

Co-authored-by: nivetha-nagalingam <nivetha.nagalingam@syncfusion.com>
Co-authored-by: Anandhan Rajagopal <97146406+anandhan-rajagopal@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@github-actions github-actions bot locked and limited conversation to collaborators Apr 6, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-testing Unit tests, device tests community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate Compatibility.Core platform-specific unit tests to device tests

5 participants