Skip to content

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

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

Conversation

nivetha-nagalingam
Copy link
Contributor

Description of Change
Migration of Compatibility.Core platform-specific unit tests to device tests. Here the migrated cases which ensuring that the Translation consistency of different elements matches their native counterparts. We are going to migrate tests in blocks in different PRs. This is the 6th 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 several new tests to ensure the consistency of the Translation property across various UI elements in the Android platform. The changes include adding new test cases and necessary imports for testing the Translation property.

New Tests for Translation Property Consistency:

BoxView:

Button:

CheckBox:

Editor:

Entry:

Label:

SearchBar:

SwipeView:

These changes ensure that the Translation properties of different UI elements are accurately tested against their native counterparts, improving the reliability of the UI framework.

Issues Fixed
Fixes #27303

Copy link
Contributor

Hey there @nivetha-nagalingam! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@dotnet-policy-service dotnet-policy-service bot added community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration labels Mar 14, 2025
@nivetha-nagalingam nivetha-nagalingam added the area-testing Unit tests, device tests label Mar 14, 2025
@nivetha-nagalingam nivetha-nagalingam marked this pull request as ready for review March 14, 2025 07:16
@Copilot Copilot AI review requested due to automatic review settings March 14, 2025 07:16
@nivetha-nagalingam nivetha-nagalingam requested a review from a team as a code owner March 14, 2025 07:16
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

This PR migrates platform-specific unit tests for verifying the Translation property consistency from Xamarin.Forms to .NET MAUI device tests on Android.

  • Introduces new device tests for Translation consistency for BoxView, Button, CheckBox, Editor, Entry, Label, SearchBar, and SwipeView.
  • Ensures that the native Translation values of these controls match the expected pixel values calculated using the device’s display density.

Reviewed Changes

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

Show a summary per file
File Description
src/Controls/tests/DeviceTests/Elements/BoxView/BoxViewTests.Android.cs Added test for BoxView Translation consistency
src/Controls/tests/DeviceTests/Elements/Entry/EntryTests.Android.cs Added test for Entry Translation consistency
src/Controls/tests/DeviceTests/Elements/Label/LabelTests.Android.cs Added test for Label Translation consistency
src/Controls/tests/DeviceTests/Elements/SearchBar/SearchBarTests.Android.cs Added test for SearchBar Translation consistency
src/Controls/tests/DeviceTests/Elements/CheckBox/CheckBoxTests.Android.cs Added test for CheckBox Translation consistency
src/Controls/tests/DeviceTests/Elements/Editor/EditorTests.Android.cs Added test for Editor Translation consistency
src/Controls/tests/DeviceTests/Elements/SwipeView/SwipeViewTests.Android.cs Added test for SwipeView Translation consistency
src/Controls/tests/DeviceTests/Elements/Button/ButtonTests.Android.cs Added test for Button Translation consistency

@jsuarezruiz
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

jsuarezruiz
jsuarezruiz previously approved these changes Mar 14, 2025
Copy link
Member

@rmarinho rmarinho left a comment

Choose a reason for hiding this comment

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

I think the Copilot review is correct here, can we use some kind of helper so we don t repeat this code everywhere..

var translation = nativeView.TranslationX;
var density = Microsoft.Maui.Devices.DeviceDisplay.Current.MainDisplayInfo.Density;
var expectedInPixels = density * boxView.TranslationX;

Assert.Equal(expectedInPixels, translation, 1.0);

var translationY = nativeView.TranslationY;
var expectedYInPixels = density * boxView.TranslationY;
Assert.Equal(expectedYInPixels, translationY, 1.0);

@jsuarezruiz
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@nivetha-nagalingam
Copy link
Contributor Author

nivetha-nagalingam commented Mar 17, 2025

I think the Copilot review is correct here, can we use some kind of helper so we don t repeat this code everywhere..

@rmarinho, I’ve added the helper method in the recent commit. Kindly share your thoughts.

jsuarezruiz
jsuarezruiz previously approved these changes Mar 18, 2025
@jsuarezruiz
Copy link
Contributor

@nivetha-nagalingam Could you rebase and fix conflicts? Thanks in advance.

@nivetha-nagalingam nivetha-nagalingam force-pushed the Enabled-translation-property-devicetest-1403 branch from 9d9c11e to 344b604 Compare March 27, 2025 11:12
@nivetha-nagalingam nivetha-nagalingam force-pushed the Enabled-translation-property-devicetest-1403 branch from 55f54b5 to 1febfb2 Compare March 27, 2025 11:57
@nivetha-nagalingam
Copy link
Contributor Author

@nivetha-nagalingam Could you rebase and fix conflicts? Thanks in advance.

@jsuarezruiz , I have rebased and resolved the conflicts.

@jsuarezruiz
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

Copy link
Member

@PureWeen PureWeen left a comment

Choose a reason for hiding this comment

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

Fix merge conflicts

@nivetha-nagalingam nivetha-nagalingam force-pushed the Enabled-translation-property-devicetest-1403 branch from 1febfb2 to 6572c46 Compare April 1, 2025 05:18
@nivetha-nagalingam
Copy link
Contributor Author

Fix merge conflicts

@PureWeen, I have rebased and resolved the conflicts.

@jsuarezruiz
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@jsuarezruiz
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

jsuarezruiz
jsuarezruiz previously approved these changes Apr 25, 2025
@nivetha-nagalingam nivetha-nagalingam force-pushed the Enabled-translation-property-devicetest-1403 branch from 1f13873 to b449c4f Compare May 14, 2025 07:34
@jsuarezruiz
Copy link
Contributor

/azp run MAUI-UITests-public

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@PureWeen PureWeen changed the base branch from main to inflight/current June 24, 2025 22:15
@PureWeen PureWeen merged commit 92be210 into dotnet:inflight/current Jun 24, 2025
78 checks passed
PureWeen pushed a commit that referenced this pull request Jun 25, 2025
…s into device tests - 6 (#28399)

* Enabled the translation property for device tests

* Added the helper method

* Reverted the changes

* Updated EditorTests.Android.cs

* Fix formating
github-actions bot pushed a commit that referenced this pull request Jun 26, 2025
…s into device tests - 6 (#28399)

* Enabled the translation property for device tests

* Added the helper method

* Reverted the changes

* Updated EditorTests.Android.cs

* Fix formating
PureWeen pushed a commit that referenced this pull request Jun 27, 2025
…s into device tests - 6 (#28399)

* Enabled the translation property for device tests

* Added the helper method

* Reverted the changes

* Updated EditorTests.Android.cs

* Fix formating
PureWeen pushed a commit that referenced this pull request Jun 28, 2025
…s into device tests - 6 (#28399)

* Enabled the translation property for device tests

* Added the helper method

* Reverted the changes

* Updated EditorTests.Android.cs

* Fix formating
github-actions bot pushed a commit that referenced this pull request Jun 29, 2025
…s into device tests - 6 (#28399)

* Enabled the translation property for device tests

* Added the helper method

* Reverted the changes

* Updated EditorTests.Android.cs

* Fix formating
github-actions bot pushed a commit that referenced this pull request Jun 29, 2025
…s into device tests - 6 (#28399)

* Enabled the translation property for device tests

* Added the helper method

* Reverted the changes

* Updated EditorTests.Android.cs

* Fix formating
github-actions bot pushed a commit that referenced this pull request Jul 1, 2025
…s into device tests - 6 (#28399)

* Enabled the translation property for device tests

* Added the helper method

* Reverted the changes

* Updated EditorTests.Android.cs

* Fix formating
github-actions bot pushed a commit that referenced this pull request Jul 2, 2025
…s into device tests - 6 (#28399)

* Enabled the translation property for device tests

* Added the helper method

* Reverted the changes

* Updated EditorTests.Android.cs

* Fix formating
github-actions bot pushed a commit that referenced this pull request Jul 2, 2025
…s into device tests - 6 (#28399)

* Enabled the translation property for device tests

* Added the helper method

* Reverted the changes

* Updated EditorTests.Android.cs

* Fix formating
github-actions bot pushed a commit that referenced this pull request Jul 8, 2025
…s into device tests - 6 (#28399)

* Enabled the translation property for device tests

* Added the helper method

* Reverted the changes

* Updated EditorTests.Android.cs

* Fix formating
github-actions bot pushed a commit that referenced this pull request Jul 8, 2025
…s into device tests - 6 (#28399)

* Enabled the translation property for device tests

* Added the helper method

* Reverted the changes

* Updated EditorTests.Android.cs

* Fix formating
github-actions bot pushed a commit that referenced this pull request Jul 9, 2025
…s into device tests - 6 (#28399)

* Enabled the translation property for device tests

* Added the helper method

* Reverted the changes

* Updated EditorTests.Android.cs

* Fix formating
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
4 participants