diff --git a/src/Samples.UITest/UITest.Core/UITestBase.cs b/src/Samples.UITest/UITest.Core/UITestBase.cs index 03ec4cbf..e665f5cf 100644 --- a/src/Samples.UITest/UITest.Core/UITestBase.cs +++ b/src/Samples.UITest/UITest.Core/UITestBase.cs @@ -6,6 +6,7 @@ using System.Globalization; using System.Reflection; using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; using Xunit.Abstractions; namespace UITest; @@ -17,6 +18,7 @@ public abstract class UITestBase : IDisposable static UITestBase() { + NativeMethods.SetProcessDPIAware(); CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en-US"); Mouse.MovePixelsPerMillisecond = 2; @@ -111,4 +113,11 @@ public void Dispose() if (File.Exists(file)) File.Delete(file); } } + + + private static class NativeMethods + { + [DllImport("user32.dll", SetLastError = true)] + public static extern bool SetProcessDPIAware(); + } }