Repository navigation
[iOS] Fix Label background not clipped when Clip property is set #34276
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
Merged
Merged
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
eece808
Fixed the switch thumb color shadow issue
Shalini-Ashokan 21b8e00
Revert "Fixed the switch thumb color shadow issue"
Shalini-Ashokan 9eb3f1f
Fixed the label with background clip issue
Shalini-Ashokan 772fc5c
modified the fix to initial clip for windows
Shalini-Ashokan 8f79016
simplified the windows fix
Shalini-Ashokan de40b87
modify a test and committed the images
Shalini-Ashokan 8c3a745
Removed windows fix
Shalini-Ashokan 2ea1358
Modified the test case
Shalini-Ashokan 242723e
modified the test
Shalini-Ashokan daae1bf
Added base snapshots
Shalini-Ashokan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| using Microsoft.Maui.Controls.Shapes; | ||
|
|
||
| namespace Maui.Controls.Sample.Issues; | ||
|
|
||
| [Issue(IssueTracker.Github, 34114, "Label with background clip is not working properly", PlatformAffected.iOS | PlatformAffected.macOS | PlatformAffected.UWP)] | ||
| public class Issue34114 : ContentPage | ||
| { | ||
| Label _clipTestLabel; | ||
| Button _changeClipButton; | ||
| public Issue34114() | ||
| { | ||
| _clipTestLabel = new Label | ||
| { | ||
| Text = "Clipped Label", | ||
| BackgroundColor = Colors.Red, | ||
| HorizontalTextAlignment = TextAlignment.Center, | ||
| VerticalTextAlignment = TextAlignment.Center, | ||
| WidthRequest = 300, | ||
| HeightRequest = 300, | ||
| AutomationId = "ClippedLabel", | ||
| Clip = new EllipseGeometry | ||
| { | ||
| Center = new Point(150, 150), | ||
| RadiusX = 150, | ||
| RadiusY = 150 | ||
| } | ||
| }; | ||
|
|
||
| _changeClipButton = new Button | ||
| { | ||
| Text = "Change Clip", | ||
| AutomationId = "ChangeClip" | ||
| }; | ||
|
|
||
| _changeClipButton.Clicked += (s, e) => | ||
| { | ||
| _clipTestLabel.Clip = new RoundRectangleGeometry(new CornerRadius(50), new Rect(75, 100, 150, 100)); | ||
| }; | ||
|
|
||
| Content = new VerticalStackLayout | ||
| { | ||
| VerticalOptions = LayoutOptions.Center, | ||
| Children = | ||
| { | ||
| _clipTestLabel, | ||
| _changeClipButton | ||
| } | ||
| }; | ||
| } | ||
| } |
32 changes: 32 additions & 0 deletions
32
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue34114.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| #if TEST_FAILS_ON_WINDOWS // This test fails on Windows because of a known issue with clipping in WinUI. | ||
|
|
||
| using NUnit.Framework; | ||
| using UITest.Appium; | ||
| using UITest.Core; | ||
|
|
||
| namespace Microsoft.Maui.TestCases.Tests.Issues; | ||
|
|
||
| public class Issue34114 : _IssuesUITest | ||
| { | ||
| public Issue34114(TestDevice device) : base(device) { } | ||
|
|
||
| public override string Issue => "Label with background clip is not working properly"; | ||
|
|
||
| [Test, Order(0)] | ||
| [Category(UITestCategories.Label)] | ||
| public void VerifyLabelBackgroundIsClippedWithEllipseGeometry() | ||
| { | ||
| App.WaitForElement("ClippedLabel"); | ||
| VerifyScreenshot(); | ||
| } | ||
|
|
||
| [Test, Order(1)] | ||
| [Category(UITestCategories.Label)] | ||
| public void VerifyLabelBackgroundIsClippedWithRectangleGeometry() | ||
| { | ||
| App.WaitForElement("ClippedLabel"); | ||
| App.Tap("ChangeClip"); | ||
| VerifyScreenshot(); | ||
| } | ||
| } | ||
| #endif | ||
Binary file added
BIN
+40.1 KB
...s.iOS.Tests/snapshots/ios/VerifyLabelBackgroundIsClippedWithEllipseGeometry.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+28.8 KB
...iOS.Tests/snapshots/ios/VerifyLabelBackgroundIsClippedWithRectangleGeometry.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.