public void ScaleSizeFFromPixelToDpi() { // Arrange var dpiScaling = DpiScaling.GetByScaleFactors(1.5f, 1.5f); var dpiScalingProvider = A.Fake <IDpiScalingProvider>(); A.CallTo(() => dpiScalingProvider.GetCurrentDpiScaling()).Returns(dpiScaling); // Act var sizePixel = new SizeF(750f, 1500f); var sizeDpi = dpiScalingProvider.TransformSizeFromPixelToDip(sizePixel); // Assert Assert.AreEqual(500f, sizeDpi.Width); Assert.AreEqual(1000f, sizeDpi.Height); }
public void ScaleSizeFromDpiToPixel() { // Arrange var dpiScaling = DpiScaling.GetByScaleFactors(1.5f, 1.5f); var dpiScalingProvider = A.Fake <IDpiScalingProvider>(); A.CallTo(() => dpiScalingProvider.GetCurrentDpiScaling()).Returns(dpiScaling); // Act var sizeDpi = new Size(500, 1000); var sizePixel = dpiScalingProvider.TransformSizeFromDipToPixel(sizeDpi); // Assert Assert.AreEqual(750, sizePixel.Width); Assert.AreEqual(1500, sizePixel.Height); }
public void ScalePointFromDpiToPixel() { // Arrange var dpiScaling = DpiScaling.GetByScaleFactors(1.5f, 1.5f); var dpiScalingProvider = A.Fake <IDpiScalingProvider>(); A.CallTo(() => dpiScalingProvider.GetCurrentDpiScaling()).Returns(dpiScaling); // Act var pointDpi = new Point(500, 1000); var pointPixel = dpiScalingProvider.TransformPointFromDipToPixel(pointDpi); // Assert Assert.AreEqual(750, pointPixel.X); Assert.AreEqual(1500, pointPixel.Y); }
public void ScalePointFFromPixelToDpi() { // Arrange var dpiScaling = DpiScaling.GetByScaleFactors(1.5f, 1.5f); var dpiScalingProvider = A.Fake <IDpiScalingProvider>(); A.CallTo(() => dpiScalingProvider.GetCurrentDpiScaling()).Returns(dpiScaling); // Act var pointPixel = new PointF(750f, 1500f); var pointDpi = dpiScalingProvider.TransformPointFromPixelToDip(pointPixel); // Assert Assert.AreEqual(500f, pointDpi.X); Assert.AreEqual(1000f, pointDpi.Y); }