-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[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
[Testing] Migration of Compatibility.Core platform-specific unit tests into device tests - 6 #28399
Conversation
|
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. |
There was a problem hiding this 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 |
src/Controls/tests/DeviceTests/Elements/SearchBar/SearchBarTests.Android.cs
Show resolved
Hide resolved
src/Controls/tests/DeviceTests/Elements/CheckBox/CheckBoxTests.Android.cs
Show resolved
Hide resolved
src/Controls/tests/DeviceTests/Elements/SwipeView/SwipeViewTests.Android.cs
Show resolved
Hide resolved
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
There was a problem hiding this 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);
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
@rmarinho, I’ve added the helper method in the recent commit. Kindly share your thoughts. |
|
@nivetha-nagalingam Could you rebase and fix conflicts? Thanks in advance. |
9d9c11e to
344b604
Compare
55f54b5 to
1febfb2
Compare
@jsuarezruiz , I have rebased and resolved the conflicts. |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix merge conflicts
1febfb2 to
6572c46
Compare
@PureWeen, I have rebased and resolved the conflicts. |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
1f13873 to
b449c4f
Compare
|
/azp run MAUI-UITests-public |
|
Azure Pipelines successfully started running 1 pipeline(s). |
…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
…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
…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
…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
…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
…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
…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
…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
…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
…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
…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
…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
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:
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
Translationproperty across various UI elements in the Android platform. The changes include adding new test cases and necessary imports for testing theTranslationproperty.New Tests for Translation Property Consistency:
BoxView:
Translationproperty of aBoxViewmatches the nativeTranslation.Button:
Translationproperty of aButtonis consistent with the nativeTranslation.CheckBox:
Translationproperty of aCheckBoxaligns with the nativeTranslation.Editor:
Translationproperty of anEditorcorresponds with the nativeTranslation.Entry:
Translationproperty of anEntrymatches the nativeTranslation.Label:
Translationproperty of anLabelmatches the nativeTranslation.SearchBar:
Translationproperty of anSearchBarmatches the nativeTranslation.SwipeView:
Translationproperty of anSwipeViewmatches the nativeTranslation.These changes ensure that the
Translationproperties of different UI elements are accurately tested against their native counterparts, improving the reliability of the UI framework.Issues Fixed
Fixes #27303