-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[NET10] Make IPlatformMeasureInvalidationController public #31133
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 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f6b1f78
Initial plan
Copilot de8f1d4
Make IPlatformMeasureInvalidationController public for .NET 10 and ad…
Copilot 886e9e3
Fix PublicAPI files by adding interface declaration for IPlatformMeas…
Copilot d861ca6
Fix PublicAPI duplicate symbol error by removing duplicate LerpDelega…
Copilot 66e9cce
Fix PublicAPI BOM character error in SafeAreaEdgesTypeConverter decla…
Copilot 30b937a
Remove IPlatformMeasureInvalidationControllerTests.cs file as requested
Copilot 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
15 changes: 14 additions & 1 deletion
15
src/Core/src/Platform/iOS/IPlatformMeasureInvalidationController.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 |
|---|---|---|
| @@ -1,7 +1,20 @@ | ||
| namespace Microsoft.Maui.Platform; | ||
|
|
||
| internal interface IPlatformMeasureInvalidationController | ||
| /// <summary> | ||
| /// Provides platform-specific measure invalidation control for iOS views. | ||
| /// </summary> | ||
| public interface IPlatformMeasureInvalidationController | ||
| { | ||
| /// <summary> | ||
| /// Schedules measure invalidation to occur when the view is moved to a window. | ||
| /// This is used to handle scenarios where invalidation is attempted before the view is attached to a window. | ||
| /// </summary> | ||
| void InvalidateAncestorsMeasuresWhenMovedToWindow(); | ||
|
|
||
| /// <summary> | ||
| /// Invalidates the current view via SetNeedsLayout and returns whether to continue propagating the invalidation to ancestors or not. | ||
| /// </summary> | ||
| /// <param name="isPropagating">True if this invalidation is being propagated from a descendant view, false if this is the initial view that triggered the invalidation.</param> | ||
| /// <returns>True to continue propagating invalidation to ancestor views, false to stop propagation.</returns> | ||
| bool InvalidateMeasure(bool isPropagating = false); | ||
| } |
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
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
78 changes: 78 additions & 0 deletions
78
src/Core/tests/UnitTests/Platform/IPlatformMeasureInvalidationControllerTests.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,78 @@ | ||
| using System; | ||
| using Xunit; | ||
|
|
||
| #if IOS | ||
| using Microsoft.Maui.Platform; | ||
|
|
||
| namespace Microsoft.Maui.UnitTests.Platform | ||
| { | ||
| public class IPlatformMeasureInvalidationControllerTests | ||
| { | ||
PureWeen marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| [Fact] | ||
| public void InterfaceCanBeImplemented() | ||
| { | ||
| // Verify that the interface is public and can be implemented by external code | ||
| var implementation = new TestPlatformMeasureInvalidationController(); | ||
|
|
||
| Assert.NotNull(implementation); | ||
| Assert.True(implementation is IPlatformMeasureInvalidationController); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void InvalidateMeasureMethod_CanBeCalledWithDefaultParameter() | ||
| { | ||
| var implementation = new TestPlatformMeasureInvalidationController(); | ||
|
|
||
| // Should be able to call with default parameter (isPropagating = false) | ||
| bool result = implementation.InvalidateMeasure(); | ||
|
|
||
| Assert.True(result); // Default implementation returns true | ||
| } | ||
|
|
||
| [Fact] | ||
| public void InvalidateMeasureMethod_CanBeCalledWithExplicitParameter() | ||
| { | ||
| var implementation = new TestPlatformMeasureInvalidationController(); | ||
|
|
||
| // Should be able to call with explicit parameter | ||
| bool result1 = implementation.InvalidateMeasure(isPropagating: false); | ||
| bool result2 = implementation.InvalidateMeasure(isPropagating: true); | ||
|
|
||
| Assert.True(result1); | ||
| Assert.False(result2); // Test implementation returns false when propagating | ||
| } | ||
|
|
||
| [Fact] | ||
| public void InvalidateAncestorsMeasuresWhenMovedToWindowMethod_CanBeCalled() | ||
| { | ||
| var implementation = new TestPlatformMeasureInvalidationController(); | ||
|
|
||
| // Should be able to call without exceptions | ||
| implementation.InvalidateAncestorsMeasuresWhenMovedToWindow(); | ||
|
|
||
| Assert.True(implementation.WasInvalidateAncestorsCalled); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Test implementation of IPlatformMeasureInvalidationController for testing purposes. | ||
| /// Demonstrates how external customers can implement the interface to control propagation. | ||
| /// </summary> | ||
| private class TestPlatformMeasureInvalidationController : IPlatformMeasureInvalidationController | ||
| { | ||
| public bool WasInvalidateAncestorsCalled { get; private set; } | ||
|
|
||
| public void InvalidateAncestorsMeasuresWhenMovedToWindow() | ||
| { | ||
| WasInvalidateAncestorsCalled = true; | ||
| } | ||
|
|
||
| public bool InvalidateMeasure(bool isPropagating = false) | ||
| { | ||
| // Return false when propagating to test stopping propagation scenario | ||
| // This demonstrates how customers can control propagation behavior | ||
| return !isPropagating; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| #endif | ||
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.
@copilot delete this file
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.
Deleted the IPlatformMeasureInvalidationControllerTests.cs file as requested. Build verified successfully after removal. Commit: df32577