Browse Source

fix unit tests.

pull/4334/head
Dan Walmsley 6 years ago
parent
commit
2ad4002686
  1. 2
      tests/Avalonia.Controls.UnitTests/DesktopStyleApplicationLifetimeTests.cs
  2. 8
      tests/Avalonia.Controls.UnitTests/WindowBaseTests.cs
  3. 12
      tests/Avalonia.Controls.UnitTests/WindowTests.cs
  4. 2
      tests/Avalonia.UnitTests/MockWindowingPlatform.cs

2
tests/Avalonia.Controls.UnitTests/DesktopStyleApplicationLifetimeTests.cs

@ -191,7 +191,7 @@ namespace Avalonia.Controls.UnitTests
{
var windowImpl = new Mock<IWindowImpl>();
windowImpl.SetupProperty(x => x.Closed);
windowImpl.Setup(x => x.RenderScaling).Returns(1);
windowImpl.Setup(x => x.DesktopScaling).Returns(1);
var services = TestServices.StyledWindow.With(
windowingPlatform: new MockWindowingPlatform(() => windowImpl.Object));

8
tests/Avalonia.Controls.UnitTests/WindowBaseTests.cs

@ -110,7 +110,7 @@ namespace Avalonia.Controls.UnitTests
public void IsVisible_Should_Be_False_Atfer_Impl_Signals_Close()
{
var windowImpl = new Mock<IPopupImpl>();
windowImpl.Setup(x => x.RenderScaling).Returns(1);
windowImpl.Setup(x => x.DesktopScaling).Returns(1);
windowImpl.SetupProperty(x => x.Closed);
using (UnitTestApplication.Start(TestServices.StyledWindow))
@ -128,7 +128,7 @@ namespace Avalonia.Controls.UnitTests
public void Setting_IsVisible_True_Shows_Window()
{
var windowImpl = new Mock<IPopupImpl>();
windowImpl.Setup(x => x.RenderScaling).Returns(1);
windowImpl.Setup(x => x.DesktopScaling).Returns(1);
using (UnitTestApplication.Start(TestServices.StyledWindow))
{
@ -143,7 +143,7 @@ namespace Avalonia.Controls.UnitTests
public void Setting_IsVisible_False_Hides_Window()
{
var windowImpl = new Mock<IPopupImpl>();
windowImpl.Setup(x => x.RenderScaling).Returns(1);
windowImpl.Setup(x => x.DesktopScaling).Returns(1);
using (UnitTestApplication.Start(TestServices.StyledWindow))
{
@ -208,7 +208,7 @@ namespace Avalonia.Controls.UnitTests
{
var renderer = new Mock<IRenderer>();
var windowImpl = new Mock<IPopupImpl>();
windowImpl.Setup(x => x.RenderScaling).Returns(1);
windowImpl.Setup(x => x.DesktopScaling).Returns(1);
windowImpl.SetupProperty(x => x.Closed);
windowImpl.Setup(x => x.CreateRenderer(It.IsAny<IRenderRoot>())).Returns(renderer.Object);

12
tests/Avalonia.Controls.UnitTests/WindowTests.cs

@ -100,7 +100,7 @@ namespace Avalonia.Controls.UnitTests
{
var windowImpl = new Mock<IWindowImpl>();
windowImpl.SetupProperty(x => x.Closed);
windowImpl.Setup(x => x.RenderScaling).Returns(1);
windowImpl.Setup(x => x.DesktopScaling).Returns(1);
var services = TestServices.StyledWindow.With(
windowingPlatform: new MockWindowingPlatform(() => windowImpl.Object));
@ -206,7 +206,7 @@ namespace Avalonia.Controls.UnitTests
var parent = new Mock<Window>();
var windowImpl = new Mock<IWindowImpl>();
windowImpl.SetupProperty(x => x.Closed);
windowImpl.Setup(x => x.RenderScaling).Returns(1);
windowImpl.Setup(x => x.DesktopScaling).Returns(1);
var target = new Window(windowImpl.Object);
var task = target.ShowDialog<bool>(parent.Object);
@ -245,7 +245,7 @@ namespace Avalonia.Controls.UnitTests
var parent = new Mock<Window>();
var windowImpl = new Mock<IWindowImpl>();
windowImpl.SetupProperty(x => x.Closed);
windowImpl.Setup(x => x.RenderScaling).Returns(1);
windowImpl.Setup(x => x.DesktopScaling).Returns(1);
var target = new Window(windowImpl.Object);
var task = target.ShowDialog<bool>(parent.Object);
@ -273,7 +273,7 @@ namespace Avalonia.Controls.UnitTests
var windowImpl = MockWindowingPlatform.CreateWindowMock();
windowImpl.Setup(x => x.ClientSize).Returns(new Size(800, 480));
windowImpl.Setup(x => x.RenderScaling).Returns(1);
windowImpl.Setup(x => x.DesktopScaling).Returns(1);
windowImpl.Setup(x => x.Screen).Returns(screens.Object);
using (UnitTestApplication.Start(TestServices.StyledWindow))
@ -298,12 +298,12 @@ namespace Avalonia.Controls.UnitTests
var parentWindowImpl = MockWindowingPlatform.CreateWindowMock();
parentWindowImpl.Setup(x => x.ClientSize).Returns(new Size(800, 480));
parentWindowImpl.Setup(x => x.MaxAutoSizeHint).Returns(new Size(1920, 1080));
parentWindowImpl.Setup(x => x.RenderScaling).Returns(1);
parentWindowImpl.Setup(x => x.DesktopScaling).Returns(1);
var windowImpl = MockWindowingPlatform.CreateWindowMock();
windowImpl.Setup(x => x.ClientSize).Returns(new Size(320, 200));
windowImpl.Setup(x => x.MaxAutoSizeHint).Returns(new Size(1920, 1080));
windowImpl.Setup(x => x.RenderScaling).Returns(1);
windowImpl.Setup(x => x.DesktopScaling).Returns(1);
var parentWindowServices = TestServices.StyledWindow.With(
windowingPlatform: new MockWindowingPlatform(() => parentWindowImpl.Object));

2
tests/Avalonia.UnitTests/MockWindowingPlatform.cs

@ -29,7 +29,7 @@ namespace Avalonia.UnitTests
windowImpl.SetupAllProperties();
windowImpl.Setup(x => x.ClientSize).Returns(() => clientSize);
windowImpl.Setup(x => x.MaxAutoSizeHint).Returns(s_screenSize);
windowImpl.Setup(x => x.RenderScaling).Returns(1);
windowImpl.Setup(x => x.DesktopScaling).Returns(1);
windowImpl.Setup(x => x.Screen).Returns(CreateScreenMock().Object);
windowImpl.Setup(x => x.Position).Returns(() => position);
SetupToplevel(windowImpl);

Loading…
Cancel
Save