Skip to content

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

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

TamilarasanSF4853
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 IsEnabled and CornerRadius consistency of different elements matches their native counterparts. We are going to migrate tests in blocks in different PRs. This is the 8st 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 includes updates to various test files to add new tests and improve the existing ones. The key changes include adding new tests to verify text alignment and flow direction for Editor and Entry controls, as well as tests for navigation and embedding functionalities.

New Tests for Text Alignment and Flow Direction

Navigation and Embedding Tests

Other Updates

Issues Fixed

Fixes #27303

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Mar 19, 2025
Copy link
Contributor

Hey there @TamilarasanSF4853! 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 the partner/syncfusion Issues / PR's with Syncfusion collaboration label Mar 19, 2025
@anandhan-rajagopal anandhan-rajagopal added the area-testing Unit tests, device tests label Mar 19, 2025
@TamilarasanSF4853 TamilarasanSF4853 marked this pull request as ready for review March 19, 2025 07:16
@TamilarasanSF4853 TamilarasanSF4853 requested a review from a team as a code owner March 19, 2025 07:16
@TamilarasanSF4853 TamilarasanSF4853 requested review from StephaneDelcroix and tj-devel709 and removed request for a team March 19, 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 pull request migrates and adapts several Compatibility.Core unit tests to run as device tests, ensuring that properties like text alignment, flow direction, navigation, and image button configuration behave as expected on different platforms.

  • Added new tests for Editor and Entry controls on both Windows and iOS to verify text alignment and flow direction.
  • Introduced tests for page view creation and navigation (including double disposal) on Android and iOS.
  • Added a test for ImageButton to confirm it is created with the correct button type.

Reviewed Changes

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

Show a summary per file
File Description
src/Controls/tests/DeviceTests/Elements/Page/PageTests.Android.cs Test for creating a platform view from a ContentPage on Android
src/Controls/tests/DeviceTests/Elements/Editor/EditorTests.Windows.cs Added test for verifying Editor text alignment and flow direction on Windows
src/Controls/tests/DeviceTests/Elements/Editor/EditorTests.iOS.cs Added test for verifying Editor text alignment on iOS
src/Controls/tests/DeviceTests/Elements/Entry/EntryTests.Windows.cs Added test for verifying Entry text alignment on Windows
src/Controls/tests/DeviceTests/Elements/Entry/EntryTests.iOS.cs Added test for verifying Entry text alignment on iOS
src/Controls/tests/DeviceTests/Elements/Page/PageTests.iOS.cs Test for creating a view controller from a ContentPage on iOS
src/Controls/tests/DeviceTests/Elements/NavigationPage/NavigationPageTests.iOS.cs Added test to ensure NavigationRenderer.Dispose can be safely called multiple times
src/Core/tests/DeviceTests/Handlers/ImageButton/ImageButtonHandlerTests.iOS.cs Added test to verify that ImageButton is created with the correct button type

Content = new Label { Text = "Hello" }
};

root.Dispatcher.DispatchAsync(() =>
Copy link
Preview

Copilot AI Mar 19, 2025

Choose a reason for hiding this comment

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

Consider awaiting the Dispatcher.DispatchAsync call in NavigationRendererDoubleDisposal to ensure that the Dispose calls complete before the test finishes.

Suggested change
root.Dispatcher.DispatchAsync(() =>
await root.Dispatcher.DispatchAsync(async () =>

Copilot uses AI. Check for mistakes.

//src/Compatibility/Core/tests/iOS/NavigationTests.cs
[Fact]
[Description("Multiple calls to NavigationRenderer.Dispose shouldn't crash")]
public void NavigationRendererDoubleDisposal()
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
public void NavigationRendererDoubleDisposal()
public async Task NavigationRendererDoubleDisposal()

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.

Make NavigationRendererDoubleDisposal async Task

@TamilarasanSF4853
Copy link
Contributor Author

Make NavigationRendererDoubleDisposal async Task

@rmarinho I've made the changes and committed them. Let me know if any further adjustments are needed.

@jsuarezruiz
Copy link
Contributor

@TamilarasanSF4853 Could you rebase to fix the conflicts?

@TamilarasanSF4853 TamilarasanSF4853 force-pushed the Enabled-UnitTest-To-DeviceTest-5 branch from 1be6d5e to 2cec666 Compare March 27, 2025 09:52
@TamilarasanSF4853
Copy link
Contributor Author

@TamilarasanSF4853 Could you rebase to fix the conflicts?

@jsuarezruiz I’ve rebased and resolved the conflicts

@github-actions github-actions bot force-pushed the inflight/current branch 2 times, most recently from c3d7dd2 to 5b2afee Compare April 3, 2025 15:03
@PureWeen PureWeen merged commit 0ba3cba into dotnet:inflight/current Apr 3, 2025
1 check passed
github-actions bot pushed a commit that referenced this pull request Apr 8, 2025
…s into device tests - 8 (#28496)

* code changes added

* updated code
bhavanesh2001 pushed a commit to bhavanesh2001/maui that referenced this pull request Apr 11, 2025
…s into device tests - 8 (dotnet#28496)

* code changes added

* updated code
PureWeen pushed a commit that referenced this pull request Apr 11, 2025
…s into device tests - 8 (#28496)

* code changes added

* updated code
github-actions bot pushed a commit that referenced this pull request Apr 11, 2025
…s into device tests - 8 (#28496)

* code changes added

* updated code
github-actions bot pushed a commit that referenced this pull request Apr 14, 2025
…s into device tests - 8 (#28496)

* code changes added

* updated code
github-actions bot pushed a commit that referenced this pull request Apr 15, 2025
…s into device tests - 8 (#28496)

* code changes added

* updated code
@github-actions github-actions bot locked and limited conversation to collaborators May 4, 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.

5 participants