Skip to content

Commit

Permalink
Fix test failures on high-res monitors
Browse files Browse the repository at this point in the history
  • Loading branch information
Morten Nielsen committed Feb 21, 2024
1 parent 80f7768 commit 714622c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/WinUIEx.Tests/WindowExtensionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ await UITestHelper.RunWindowExTest(async (WindowContext) =>
var windowPadding = WindowContext.Width - width;
WindowContext.Width = 500;
await grid.SizeChangedAsync();
Assert.AreEqual(500, grid.ActualWidth + windowPadding, "Width after window resize");
Assert.AreEqual(500, grid.ActualWidth + windowPadding, 0.01, "Width after window resize");
});
}

Expand All @@ -31,7 +31,7 @@ await UITestHelper.RunWindowExTest(async (WindowEx) =>
var windowPadding = WindowEx.Height - height;
WindowEx.Height = 500;
await grid.SizeChangedAsync();
Assert.AreEqual(500, grid.ActualHeight + windowPadding, "Height after window resize");
Assert.AreEqual(500, grid.ActualHeight + windowPadding, 0.01, "Height after window resize");
});
}

Expand Down
12 changes: 6 additions & 6 deletions src/WinUIEx.Tests/WindowManagerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ await UITestHelper.RunWindowTest(async (window) =>
var manager = WindowManager.Get(window);
manager.Width = 500;
await window.Content.LoadAsync();
Assert.AreEqual(500, window.AppWindow.Size.Width * window.Content.XamlRoot.RasterizationScale);
Assert.AreEqual(500, window.AppWindow.Size.Width / window.Content.XamlRoot.RasterizationScale);
});
}

Expand All @@ -58,7 +58,7 @@ await UITestHelper.RunWindowTest(async (window) =>
var manager = WindowManager.Get(window);
manager.Height = 500;
await window.Content.LoadAsync();
Assert.AreEqual(500, window.AppWindow.Size.Height * window.Content.XamlRoot.RasterizationScale);
Assert.AreEqual(500, window.AppWindow.Size.Height / window.Content.XamlRoot.RasterizationScale);
});
}

Expand All @@ -72,7 +72,7 @@ await UITestHelper.RunWindowTest(async (window) =>
manager.Width = 500;
await window.Content.LoadAsync();
manager.MinWidth = 600;
Assert.AreEqual(600, window.AppWindow.Size.Width * window.Content.XamlRoot.RasterizationScale);
Assert.AreEqual(600, window.AppWindow.Size.Width / window.Content.XamlRoot.RasterizationScale);
});
}

Expand All @@ -86,7 +86,7 @@ await UITestHelper.RunWindowTest(async (window) =>
manager.Height = 500;
await window.Content.LoadAsync();
manager.MinHeight = 600;
Assert.AreEqual(600, window.AppWindow.Size.Height * window.Content.XamlRoot.RasterizationScale);
Assert.AreEqual(600, window.AppWindow.Size.Height / window.Content.XamlRoot.RasterizationScale);
});
}

Expand All @@ -100,7 +100,7 @@ await UITestHelper.RunWindowTest(async (window) =>
manager.Width = 600;
manager.MaxWidth = 500;
await window.Content.LoadAsync();
Assert.AreEqual(500, window.AppWindow.Size.Width * window.Content.XamlRoot.RasterizationScale);
Assert.AreEqual(500, window.AppWindow.Size.Width / window.Content.XamlRoot.RasterizationScale);
});
}

Expand All @@ -112,7 +112,7 @@ public async Task SetMaxHeight() => await UITestHelper.RunWindowTest(async (wind
manager.Height = 600;
manager.MaxHeight = 500;
await window.Content.LoadAsync();
Assert.AreEqual(500, window.AppWindow.Size.Height * window.Content.XamlRoot.RasterizationScale);
Assert.AreEqual(500, window.AppWindow.Size.Height / window.Content.XamlRoot.RasterizationScale);
});

[TestMethod]
Expand Down

0 comments on commit 714622c

Please sign in to comment.