From 1dfb268db30897413db22103e3d87e88a338b77a Mon Sep 17 00:00:00 2001 From: David Date: Tue, 5 Mar 2024 09:07:08 -0500 Subject: [PATCH] fix: Ensure valida XamlRoot --- .../Library/Helpers/TestBitmap.cs | 2 +- .../Library/Helpers/UIHelper.cs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Uno.UI.RuntimeTests.Engine.Library/Library/Helpers/TestBitmap.cs b/src/Uno.UI.RuntimeTests.Engine.Library/Library/Helpers/TestBitmap.cs index b4fb444..20a4039 100644 --- a/src/Uno.UI.RuntimeTests.Engine.Library/Library/Helpers/TestBitmap.cs +++ b/src/Uno.UI.RuntimeTests.Engine.Library/Library/Helpers/TestBitmap.cs @@ -51,7 +51,7 @@ private TestBitmap(RenderTargetBitmap bitmap, UIElement renderedElement, double /// internal static async Task From(RenderTargetBitmap bitmap, UIElement renderedElement, double? implicitScaling = null) { - implicitScaling ??= DisplayInformation.GetForCurrentView()?.RawPixelsPerViewPixel ?? 1; + implicitScaling ??= renderedElement.XamlRoot?.RasterizationScale ?? 1; var raw = new TestBitmap(bitmap, renderedElement, implicitScaling.Value); await raw.Populate(); diff --git a/src/Uno.UI.RuntimeTests.Engine.Library/Library/Helpers/UIHelper.cs b/src/Uno.UI.RuntimeTests.Engine.Library/Library/Helpers/UIHelper.cs index 0fcc20e..540abc4 100644 --- a/src/Uno.UI.RuntimeTests.Engine.Library/Library/Helpers/UIHelper.cs +++ b/src/Uno.UI.RuntimeTests.Engine.Library/Library/Helpers/UIHelper.cs @@ -249,6 +249,7 @@ public static async ValueTask Show(TestBitmap bitmap, CancellationToken ct = def StackPanel legend; var popup = new ContentDialog { + XamlRoot = UnitTestsUIContentHelper.CurrentTestWindow?.Content?.XamlRoot, MinWidth = bitmap.Width + 2, MinHeight = bitmap.Height + 30, Content = new Grid