[Testing] Migration of Compatibility.Core platform-specific unit tests into device tests - 4#28105
Conversation
Contributor
There was a problem hiding this comment.
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)
src/Controls/tests/DeviceTests/Elements/CheckBox/CheckBoxTests.cs
Outdated
Show resolved
Hide resolved
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
jsuarezruiz
suggested changes
Mar 3, 2025
Contributor
jsuarezruiz
left a comment
There was a problem hiding this comment.
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)
Contributor
Author
@jsuarezruiz Resolved the mentioned issue and committed the changes, can you please review and trigger the CI again. |
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
Contributor
|
/rebase |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
jsuarezruiz
approved these changes
Mar 5, 2025
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
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:
src/Controls/tests/DeviceTests/Elements/BoxView/BoxViewTests.Android.cs: AddedGetPlatformOpacitymethod to retrieve the opacity value for BoxView on Android.src/Controls/tests/DeviceTests/Elements/BoxView/BoxViewTests.Windows.cs: AddedGetPlatformOpacitymethod to retrieve the opacity value for BoxView on Windows.src/Controls/tests/DeviceTests/Elements/BoxView/BoxViewTests.cs: Added a new testVerifyBoxViewOpacityPropertyto check the opacity property of BoxView.Similar Additions for Other Elements:
src/Controls/tests/DeviceTests/Elements/Button/ButtonTests.Android.cs: AddedGetPlatformOpacitymethod for Button on Android.src/Controls/tests/DeviceTests/Elements/Button/ButtonTests.Windows.cs: AddedGetPlatformOpacitymethod for Button on Windows.src/Controls/tests/DeviceTests/Elements/Button/ButtonTests.cs: AddedVerifyButtonOpacityPropertytest for Button.src/Controls/tests/DeviceTests/Elements/CheckBox/CheckBoxTests.Android.cs: AddedGetPlatformOpacitymethod for CheckBox on Android.src/Controls/tests/DeviceTests/Elements/CheckBox/CheckBoxTests.Windows.cs: AddedGetPlatformOpacitymethod for CheckBox on Windows.src/Controls/tests/DeviceTests/Elements/CheckBox/CheckBoxTests.cs: AddedVerifyCheckBoxOpacityPropertytest for CheckBox.src/Controls/tests/DeviceTests/Elements/Editor/EditorTests.Android.cs: AddedGetPlatformOpacitymethod for Editor on Android.src/Controls/tests/DeviceTests/Elements/Editor/EditorTests.Windows.cs: AddedGetPlatformOpacitymethod for Editor on Windows.src/Controls/tests/DeviceTests/Elements/Editor/EditorTests.cs: AddedVerifyEditorOpacityPropertytest for Editor.src/Controls/tests/DeviceTests/Elements/Entry/EntryTests.Android.cs: AddedGetPlatformOpacitymethod for Entry on Android.src/Controls/tests/DeviceTests/Elements/Entry/EntryTests.Windows.cs: AddedGetPlatformOpacitymethod for Entry on Windows.src/Controls/tests/DeviceTests/Elements/Entry/EntryTests.cs: AddedVerifyEntryOpacityPropertytest for Entry.src/Controls/tests/DeviceTests/Elements/Image/ImageTests.Android.cs: AddedGetPlatformOpacitymethod for Image on Android.Issues Fixed
Fixes #27303