Browse Source
Fix TopLevelHost mirroring RTL content (#20754)
* Add failing RTL test
* Fix TopLevelHost mirroring RTL content
pull/19747/merge
Julien Lebosquain
3 weeks ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
24 additions and
3 deletions
-
src/Avalonia.Controls/TopLevelHost.cs
-
tests/Avalonia.Controls.UnitTests/WindowTests.cs
|
|
|
@ -18,4 +18,6 @@ internal class TopLevelHost : Control |
|
|
|
{ |
|
|
|
VisualChildren.Add(tl); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
protected override bool BypassFlowDirectionPolicies => true; |
|
|
|
} |
|
|
|
|
|
|
|
@ -3,10 +3,9 @@ using System.Collections.Generic; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using Avalonia.Media; |
|
|
|
using Avalonia.Platform; |
|
|
|
using Avalonia.Rendering; |
|
|
|
using Avalonia.Rendering.Composition; |
|
|
|
using Avalonia.Threading; |
|
|
|
using Avalonia.UnitTests; |
|
|
|
using Avalonia.VisualTree; |
|
|
|
using Moq; |
|
|
|
using Xunit; |
|
|
|
|
|
|
|
@ -689,6 +688,26 @@ namespace Avalonia.Controls.UnitTests |
|
|
|
Assert.False(window.CanMaximize); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void FlowDirection_RTL_Should_Not_Result_In_Mirrored_Host() |
|
|
|
{ |
|
|
|
var windowImpl = MockWindowingPlatform.CreateWindowMock(); |
|
|
|
|
|
|
|
using var app = UnitTestApplication.Start(TestServices.StyledWindow.With( |
|
|
|
windowingPlatform: new MockWindowingPlatform(() => windowImpl.Object))); |
|
|
|
|
|
|
|
var window = new Window |
|
|
|
{ |
|
|
|
FlowDirection = FlowDirection.RightToLeft |
|
|
|
}; |
|
|
|
|
|
|
|
var visualRoot = window.GetVisualRoot(); |
|
|
|
Assert.IsType<TopLevelHost>(visualRoot); |
|
|
|
|
|
|
|
Assert.False(window.HasMirrorTransform); |
|
|
|
Assert.False(visualRoot.HasMirrorTransform); |
|
|
|
} |
|
|
|
|
|
|
|
public class SizingTests : ScopedTestBase |
|
|
|
{ |
|
|
|
[Fact] |
|
|
|
|