-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Windows] Fixed Shadow not updated when Clipping a View with a shadow #27873
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
PureWeen
merged 7 commits into
dotnet:inflight/current
from
NirmalKumarYuvaraj:fix-27730
Mar 18, 2025
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
2510122
Fixed Shadow not updated when Clipping a View with a shadow
NirmalKumarYuvaraj 24d5c8f
FIxed shadow not updating with vlip
NirmalKumarYuvaraj f8aaa55
Updated code changes
NirmalKumarYuvaraj 00f923e
Updated testcase image
NirmalKumarYuvaraj 9d98461
Updated test case
NirmalKumarYuvaraj aa1230b
updated test case image
NirmalKumarYuvaraj ffb00a3
Added pending snapshots
NirmalKumarYuvaraj 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
Binary file added
BIN
+66.7 KB
...ts/TestCases.Android.Tests/snapshots/android/ShadowShouldUpdateWhenClipping.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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| using Microsoft.Maui.Controls.Shapes; | ||
|
|
||
| namespace Maui.Controls.Sample.Issues | ||
| { | ||
| [Issue(IssueTracker.Github, 27730, "Shadow not updated when Clipping a View with a shadow", PlatformAffected.UWP)] | ||
| public class Issue27730 : TestContentPage | ||
| { | ||
| Border _borderWithShadow; | ||
| Border _normalBorder; | ||
|
|
||
| protected override void Init() | ||
| { | ||
| VerticalStackLayout rootLayout = new VerticalStackLayout | ||
| { | ||
| Spacing = 10, | ||
| Padding = 10 | ||
| }; | ||
|
|
||
| Label shadowLabel = new Label { Text = "Border with Shadow, Clipping applied at runtime" }; | ||
| Label clipLabel = new Label { Text = "Normal Border without shadow, Clipping first, Shadow added later" }; | ||
|
|
||
| _borderWithShadow = CreateBorder(true); | ||
| _normalBorder = CreateBorder(false); | ||
|
|
||
| Button applyClipButton = new Button { Text = "Apply Clip", AutomationId = "ApplyClipBtn" }; | ||
| Button applyShadowButton = new Button { Text = "Apply Shadow", AutomationId = "ApplyShadowBtn" }; | ||
|
|
||
| applyClipButton.Clicked += (s, e) => ApplyClip(); | ||
| applyShadowButton.Clicked += (s, e) => ApplyShadow(); | ||
|
|
||
| rootLayout.Add(shadowLabel); | ||
| rootLayout.Add(_borderWithShadow); | ||
| rootLayout.Add(clipLabel); | ||
| rootLayout.Add(_normalBorder); | ||
| rootLayout.Add(applyClipButton); | ||
| rootLayout.Add(applyShadowButton); | ||
| Content = rootLayout; | ||
| } | ||
|
|
||
| Border CreateBorder(bool withShadow) | ||
| { | ||
| return new Border | ||
| { | ||
| StrokeShape = new RoundRectangle { CornerRadius = new CornerRadius(24) }, | ||
| Background = Colors.Red, | ||
| WidthRequest = 100, | ||
| HeightRequest = 100, | ||
| Margin = new Thickness(12, 0), | ||
| Shadow = withShadow ? new Shadow | ||
| { | ||
| Brush = Colors.Black, | ||
| Offset = new Point(12, 12), | ||
| Radius = 10, | ||
| Opacity = 1 | ||
| } : null | ||
| }; | ||
| } | ||
|
|
||
| void ApplyClip() | ||
| { | ||
| EllipseGeometry clipGeometry = new EllipseGeometry | ||
| { | ||
| Center = new Point(50, 50), | ||
| RadiusX = 25, | ||
| RadiusY = 25 | ||
| }; | ||
|
|
||
| _borderWithShadow.Clip = clipGeometry; | ||
| _normalBorder.Clip = clipGeometry; | ||
| } | ||
|
|
||
| void ApplyShadow() | ||
| { | ||
| _normalBorder.Shadow = new Shadow | ||
| { | ||
| Brush = Colors.Black, | ||
| Offset = new Point(12, 12), | ||
| Radius = 10, | ||
| Opacity = 1 | ||
| }; | ||
| } | ||
| } | ||
| } |
Binary file added
BIN
+26.7 KB
...rols/tests/TestCases.Mac.Tests/snapshots/mac/ShadowShouldUpdateWhenClipping.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions
25
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue27730.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,25 @@ | ||
| using NUnit.Framework; | ||
| using UITest.Appium; | ||
| using UITest.Core; | ||
|
|
||
| namespace Microsoft.Maui.TestCases.Tests.Issues | ||
| { | ||
| public class Issue27730 : _IssuesUITest | ||
| { | ||
| public Issue27730(TestDevice testDevice) : base(testDevice) | ||
| { | ||
| } | ||
|
|
||
| public override string Issue => "Shadow not updated when Clipping a View with a shadow"; | ||
|
|
||
| [Test] | ||
| [Category(UITestCategories.Visual)] | ||
| public void ShadowShouldUpdateWhenClipping() | ||
| { | ||
| App.WaitForElement("ApplyShadowBtn"); | ||
| App.Tap("ApplyClipBtn"); | ||
| App.Tap("ApplyShadowBtn"); | ||
| VerifyScreenshot(); | ||
| } | ||
| } | ||
| } |
Binary file added
BIN
+18.7 KB
...ests/TestCases.WinUI.Tests/snapshots/windows/ShadowShouldUpdateWhenClipping.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
+68.6 KB
...rols/tests/TestCases.iOS.Tests/snapshots/ios/ShadowShouldUpdateWhenClipping.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.
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.
This works if the View already have a Shadow, but, works if the order is:
?
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.
@jsuarezruiz , A new shadow will be created if the order is reversed.