Browse Source

Updated tests to use IDispatcherImpl

pull/10691/head
Nikita Tsukanov 4 years ago
parent
commit
0f4ed2a4b9
  1. 20
      tests/Avalonia.Base.UnitTests/AvaloniaObjectTests_Binding.cs
  2. 6
      tests/Avalonia.Base.UnitTests/AvaloniaObjectTests_Direct.cs
  3. 43
      tests/Avalonia.Base.UnitTests/AvaloniaObjectTests_Threading.cs
  4. 7
      tests/Avalonia.Base.UnitTests/Input/MouseDeviceTests.cs
  5. 3
      tests/Avalonia.Base.UnitTests/Input/TouchDeviceTests.cs
  6. 2
      tests/Avalonia.Benchmarks/Layout/ControlsBenchmark.cs
  7. 14
      tests/Avalonia.Benchmarks/NullThreadingPlatform.cs
  8. 2
      tests/Avalonia.Benchmarks/Styling/ControlTheme_Change.cs
  9. 2
      tests/Avalonia.Benchmarks/Styling/ResourceBenchmarks.cs
  10. 2
      tests/Avalonia.Benchmarks/Styling/Style_Apply_Detach_Complex.cs
  11. 2
      tests/Avalonia.Benchmarks/Text/HugeTextLayout.cs
  12. 2
      tests/Avalonia.Benchmarks/Themes/FluentBenchmark.cs
  13. 8
      tests/Avalonia.Controls.UnitTests/DesktopStyleApplicationLifetimeTests.cs
  14. 10
      tests/Avalonia.Controls.UnitTests/Primitives/SelectingItemsControlTests.cs
  15. 33
      tests/Avalonia.RenderTests/TestBase.cs
  16. 15
      tests/Avalonia.UnitTests/TestServices.cs
  17. 2
      tests/Avalonia.UnitTests/UnitTestApplication.cs

20
tests/Avalonia.Base.UnitTests/AvaloniaObjectTests_Binding.cs

@ -962,12 +962,12 @@ namespace Avalonia.Base.UnitTests
var currentThreadId = Thread.CurrentThread.ManagedThreadId;
var raised = 0;
var threadingInterfaceMock = new Mock<IPlatformThreadingInterface>();
threadingInterfaceMock.SetupGet(mock => mock.CurrentThreadIsLoopThread)
var dispatcherMock = new Mock<IDispatcherImpl>();
dispatcherMock.SetupGet(mock => mock.CurrentThreadIsLoopThread)
.Returns(() => Thread.CurrentThread.ManagedThreadId == currentThreadId);
var services = new TestServices(
threadingInterface: threadingInterfaceMock.Object);
dispatcherImpl: dispatcherMock.Object);
target.PropertyChanged += (s, e) =>
{
@ -1000,12 +1000,12 @@ namespace Avalonia.Base.UnitTests
var currentThreadId = Thread.CurrentThread.ManagedThreadId;
var raised = 0;
var threadingInterfaceMock = new Mock<IPlatformThreadingInterface>();
threadingInterfaceMock.SetupGet(mock => mock.CurrentThreadIsLoopThread)
var dispatcherMock = new Mock<IDispatcherImpl>();
dispatcherMock.SetupGet(mock => mock.CurrentThreadIsLoopThread)
.Returns(() => Thread.CurrentThread.ManagedThreadId == currentThreadId);
var services = new TestServices(
threadingInterface: threadingInterfaceMock.Object);
dispatcherImpl: dispatcherMock.Object);
target.PropertyChanged += (s, e) =>
{
@ -1038,12 +1038,12 @@ namespace Avalonia.Base.UnitTests
var currentThreadId = Thread.CurrentThread.ManagedThreadId;
var raised = 0;
var threadingInterfaceMock = new Mock<IPlatformThreadingInterface>();
var threadingInterfaceMock = new Mock<IDispatcherImpl>();
threadingInterfaceMock.SetupGet(mock => mock.CurrentThreadIsLoopThread)
.Returns(() => Thread.CurrentThread.ManagedThreadId == currentThreadId);
var services = new TestServices(
threadingInterface: threadingInterfaceMock.Object);
dispatcherImpl: threadingInterfaceMock.Object);
target.PropertyChanged += (s, e) =>
{
@ -1071,12 +1071,12 @@ namespace Avalonia.Base.UnitTests
var source = new Subject<double>();
var currentThreadId = Thread.CurrentThread.ManagedThreadId;
var threadingInterfaceMock = new Mock<IPlatformThreadingInterface>();
var threadingInterfaceMock = new Mock<IDispatcherImpl>();
threadingInterfaceMock.SetupGet(mock => mock.CurrentThreadIsLoopThread)
.Returns(() => Thread.CurrentThread.ManagedThreadId == currentThreadId);
var services = new TestServices(
threadingInterface: threadingInterfaceMock.Object);
dispatcherImpl: threadingInterfaceMock.Object);
using (UnitTestApplication.Start(services))
{

6
tests/Avalonia.Base.UnitTests/AvaloniaObjectTests_Direct.cs

@ -530,12 +530,12 @@ namespace Avalonia.Base.UnitTests
var currentThreadId = Thread.CurrentThread.ManagedThreadId;
var raised = 0;
var threadingInterfaceMock = new Mock<IPlatformThreadingInterface>();
threadingInterfaceMock.SetupGet(mock => mock.CurrentThreadIsLoopThread)
var dispatcherMock = new Mock<IDispatcherImpl>();
dispatcherMock.SetupGet(mock => mock.CurrentThreadIsLoopThread)
.Returns(() => Thread.CurrentThread.ManagedThreadId == currentThreadId);
var services = new TestServices(
threadingInterface: threadingInterfaceMock.Object);
dispatcherImpl: dispatcherMock.Object);
target.PropertyChanged += (s, e) =>
{

43
tests/Avalonia.Base.UnitTests/AvaloniaObjectTests_Threading.cs

@ -11,12 +11,12 @@ namespace Avalonia.Base.UnitTests
{
public class AvaloniaObjectTests_Threading
{
private ThreadingInterface _threading = new ThreadingInterface(true);
private TestDipatcherImpl _threading = new(true);
[Fact]
public void AvaloniaObject_Constructor_Should_Throw()
{
using (UnitTestApplication.Start(new TestServices(threadingInterface: new ThreadingInterface())))
using (UnitTestApplication.Start(new TestServices(dispatcherImpl: new TestDipatcherImpl())))
{
Assert.Throws<InvalidOperationException>(() => new Class1());
}
@ -25,7 +25,7 @@ namespace Avalonia.Base.UnitTests
[Fact]
public void StyledProperty_GetValue_Should_Throw()
{
using (UnitTestApplication.Start(new TestServices(threadingInterface: _threading)))
using (UnitTestApplication.Start(new TestServices(dispatcherImpl: _threading)))
{
var target = new Class1();
_threading.CurrentThreadIsLoopThread = false;
@ -36,7 +36,7 @@ namespace Avalonia.Base.UnitTests
[Fact]
public void StyledProperty_SetValue_Should_Throw()
{
using (UnitTestApplication.Start(new TestServices(threadingInterface: _threading)))
using (UnitTestApplication.Start(new TestServices(dispatcherImpl: _threading)))
{
var target = new Class1();
_threading.CurrentThreadIsLoopThread = false;
@ -47,7 +47,7 @@ namespace Avalonia.Base.UnitTests
[Fact]
public void Setting_StyledProperty_Binding_Should_Throw()
{
using (UnitTestApplication.Start(new TestServices(threadingInterface: _threading)))
using (UnitTestApplication.Start(new TestServices(dispatcherImpl: _threading)))
{
var target = new Class1();
_threading.CurrentThreadIsLoopThread = false;
@ -61,7 +61,7 @@ namespace Avalonia.Base.UnitTests
[Fact]
public void StyledProperty_ClearValue_Should_Throw()
{
using (UnitTestApplication.Start(new TestServices(threadingInterface: _threading)))
using (UnitTestApplication.Start(new TestServices(dispatcherImpl: _threading)))
{
var target = new Class1();
_threading.CurrentThreadIsLoopThread = false;
@ -72,7 +72,7 @@ namespace Avalonia.Base.UnitTests
[Fact]
public void StyledProperty_IsSet_Should_Throw()
{
using (UnitTestApplication.Start(new TestServices(threadingInterface: _threading)))
using (UnitTestApplication.Start(new TestServices(dispatcherImpl: _threading)))
{
var target = new Class1();
_threading.CurrentThreadIsLoopThread = false;
@ -83,7 +83,7 @@ namespace Avalonia.Base.UnitTests
[Fact]
public void DirectProperty_GetValue_Should_Throw()
{
using (UnitTestApplication.Start(new TestServices(threadingInterface: _threading)))
using (UnitTestApplication.Start(new TestServices(dispatcherImpl: _threading)))
{
var target = new Class1();
_threading.CurrentThreadIsLoopThread = false;
@ -94,7 +94,7 @@ namespace Avalonia.Base.UnitTests
[Fact]
public void DirectProperty_SetValue_Should_Throw()
{
using (UnitTestApplication.Start(new TestServices(threadingInterface: _threading)))
using (UnitTestApplication.Start(new TestServices(dispatcherImpl: _threading)))
{
var target = new Class1();
_threading.CurrentThreadIsLoopThread = false;
@ -105,7 +105,7 @@ namespace Avalonia.Base.UnitTests
[Fact]
public void Setting_DirectProperty_Binding_Should_Throw()
{
using (UnitTestApplication.Start(new TestServices(threadingInterface: _threading)))
using (UnitTestApplication.Start(new TestServices(dispatcherImpl: _threading)))
{
var target = new Class1();
_threading.CurrentThreadIsLoopThread = false;
@ -119,7 +119,7 @@ namespace Avalonia.Base.UnitTests
[Fact]
public void DirectProperty_ClearValue_Should_Throw()
{
using (UnitTestApplication.Start(new TestServices(threadingInterface: _threading)))
using (UnitTestApplication.Start(new TestServices(dispatcherImpl: _threading)))
{
var target = new Class1();
_threading.CurrentThreadIsLoopThread = false;
@ -130,7 +130,7 @@ namespace Avalonia.Base.UnitTests
[Fact]
public void DirectProperty_IsSet_Should_Throw()
{
using (UnitTestApplication.Start(new TestServices(threadingInterface: _threading)))
using (UnitTestApplication.Start(new TestServices(dispatcherImpl: _threading)))
{
var target = new Class1();
_threading.CurrentThreadIsLoopThread = false;
@ -147,10 +147,10 @@ namespace Avalonia.Base.UnitTests
AvaloniaProperty.RegisterDirect<Class1, string>("Qux", _ => null, (o, v) => { });
}
private class ThreadingInterface : IPlatformThreadingInterface
private class TestDipatcherImpl : IDispatcherImpl
{
public ThreadingInterface(bool isLoopThread = false)
public TestDipatcherImpl(bool isLoopThread = false)
{
CurrentThreadIsLoopThread = isLoopThread;
}
@ -158,18 +158,17 @@ namespace Avalonia.Base.UnitTests
public bool CurrentThreadIsLoopThread { get; set; }
#pragma warning disable 67
public event Action<DispatcherPriority?> Signaled;
#pragma warning restore 67
public void Signal(DispatcherPriority prio)
public event Action Signaled;
public event Action Timer;
public long Now => 0;
public void UpdateTimer(long? dueTimeInMs)
{
throw new NotImplementedException();
}
public void Signal() => throw new NotImplementedException();
#pragma warning restore 67
public IDisposable StartTimer(DispatcherPriority priority, TimeSpan interval, Action tick)
{
throw new NotImplementedException();
}
}
}
}

7
tests/Avalonia.Base.UnitTests/Input/MouseDeviceTests.cs

@ -3,6 +3,7 @@ using Avalonia.Input;
using Avalonia.Input.Raw;
using Avalonia.Media;
using Avalonia.Platform;
using Avalonia.Threading;
using Avalonia.UnitTests;
using Moq;
using Xunit;
@ -16,9 +17,9 @@ namespace Avalonia.Base.UnitTests.Input
{
using var scope = AvaloniaLocator.EnterScope();
var settingsMock = new Mock<IPlatformSettings>();
var threadingMock = new Mock<IPlatformThreadingInterface>();
var dispatcherMock = new Mock<IDispatcherImpl>();
threadingMock.Setup(x => x.CurrentThreadIsLoopThread).Returns(true);
dispatcherMock.Setup(x => x.CurrentThreadIsLoopThread).Returns(true);
AvaloniaLocator.CurrentMutable.BindToSelf(this)
.Bind<IPlatformSettings>().ToConstant(settingsMock.Object);
@ -26,7 +27,7 @@ namespace Avalonia.Base.UnitTests.Input
using var app = UnitTestApplication.Start(
new TestServices(
inputManager: new InputManager(),
threadingInterface: threadingMock.Object));
dispatcherImpl: dispatcherMock.Object));
var renderer = RendererMocks.CreateRenderer();
var device = new MouseDevice();

3
tests/Avalonia.Base.UnitTests/Input/TouchDeviceTests.cs

@ -1,6 +1,7 @@
using System;
using Avalonia.Input.Raw;
using Avalonia.Platform;
using Avalonia.Threading;
using Avalonia.UnitTests;
using Moq;
using Xunit;
@ -207,7 +208,7 @@ namespace Avalonia.Input.UnitTests
private IDisposable UnitTestApp(TimeSpan doubleClickTime = new TimeSpan())
{
var unitTestApp = UnitTestApplication.Start(
new TestServices(inputManager: new InputManager(), threadingInterface: Mock.Of<IPlatformThreadingInterface>(x => x.CurrentThreadIsLoopThread == true)));
new TestServices(inputManager: new InputManager(), dispatcherImpl: Mock.Of<IDispatcherImpl>(x => x.CurrentThreadIsLoopThread == true)));
var iSettingsMock = new Mock<IPlatformSettings>();
iSettingsMock.Setup(x => x.GetDoubleTapTime(It.IsAny<PointerType>())).Returns(doubleClickTime);
iSettingsMock.Setup(x => x.GetDoubleTapSize(It.IsAny<PointerType>())).Returns(new Size(16, 16));

2
tests/Avalonia.Benchmarks/Layout/ControlsBenchmark.cs

@ -18,7 +18,7 @@ namespace Avalonia.Benchmarks.Layout
_app = UnitTestApplication.Start(
TestServices.StyledWindow.With(
renderInterface: new NullRenderingPlatform(),
threadingInterface: new NullThreadingPlatform(),
dispatcherImpl: new NullThreadingPlatform(),
standardCursorFactory: new NullCursorFactory()));
_root = new TestRoot(true, null)

14
tests/Avalonia.Benchmarks/NullThreadingPlatform.cs

@ -6,22 +6,22 @@ using Avalonia.Threading;
namespace Avalonia.Benchmarks
{
internal class NullThreadingPlatform : IPlatformThreadingInterface
internal class NullThreadingPlatform : IDispatcherImpl
{
public IDisposable StartTimer(DispatcherPriority priority, TimeSpan interval, Action tick)
public void Signal()
{
return Disposable.Empty;
}
public void Signal(DispatcherPriority priority)
public void UpdateTimer(long? dueTimeInMs)
{
}
public bool CurrentThreadIsLoopThread => true;
#pragma warning disable CS0067
public event Action<DispatcherPriority?> Signaled;
public event Action Signaled;
public event Action Timer;
public long Now => 0;
#pragma warning restore CS0067
}
}

2
tests/Avalonia.Benchmarks/Styling/ControlTheme_Change.cs

@ -23,7 +23,7 @@ namespace Avalonia.Benchmarks.Styling
_app = UnitTestApplication.Start(
TestServices.StyledWindow.With(
renderInterface: new NullRenderingPlatform(),
threadingInterface: new NullThreadingPlatform()));
dispatcherImpl: new NullThreadingPlatform()));
// Simulate an application with a lot of styles by creating a tree of nested panels,
// each with a bunch of styles applied.

2
tests/Avalonia.Benchmarks/Styling/ResourceBenchmarks.cs

@ -23,7 +23,7 @@ namespace Avalonia.Benchmarks.Styling
renderInterface: new MockPlatformRenderInterface(),
standardCursorFactory: Mock.Of<ICursorFactory>(),
theme: () => CreateTheme(),
threadingInterface: new NullThreadingPlatform(),
dispatcherImpl: new NullThreadingPlatform(),
fontManagerImpl: new MockFontManagerImpl(),
textShaperImpl: new MockTextShaperImpl(),
windowingPlatform: new MockWindowingPlatform());

2
tests/Avalonia.Benchmarks/Styling/Style_Apply_Detach_Complex.cs

@ -20,7 +20,7 @@ namespace Avalonia.Benchmarks.Styling
_app = UnitTestApplication.Start(
TestServices.StyledWindow.With(
renderInterface: new NullRenderingPlatform(),
threadingInterface: new NullThreadingPlatform()));
dispatcherImpl: new NullThreadingPlatform()));
// Simulate an application with a lot of styles by creating a tree of nested panels,
// each with a bunch of styles applied.

2
tests/Avalonia.Benchmarks/Text/HugeTextLayout.cs

@ -32,7 +32,7 @@ public class HugeTextLayout : IDisposable
var testServices = TestServices.StyledWindow.With(
renderInterface: new NullRenderingPlatform(),
threadingInterface: new NullThreadingPlatform(),
dispatcherImpl: new NullThreadingPlatform(),
standardCursorFactory: new NullCursorFactory());
if (s_useSkia)

2
tests/Avalonia.Benchmarks/Themes/FluentBenchmark.cs

@ -47,7 +47,7 @@ namespace Avalonia.Benchmarks.Themes
renderInterface: new MockPlatformRenderInterface(),
standardCursorFactory: Mock.Of<ICursorFactory>(),
theme: () => LoadFluentTheme(),
threadingInterface: new NullThreadingPlatform(),
dispatcherImpl: new NullThreadingPlatform(),
fontManagerImpl: new MockFontManagerImpl(),
textShaperImpl: new MockTextShaperImpl(),
windowingPlatform: new MockWindowingPlatform());

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

@ -3,6 +3,7 @@ using System.Collections.Generic;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Platform;
using Avalonia.Rendering;
using Avalonia.Threading;
using Avalonia.UnitTests;
using Moq;
using Xunit;
@ -12,10 +13,13 @@ namespace Avalonia.Controls.UnitTests
public class DesktopStyleApplicationLifetimeTests
{
IDispatcherImpl CreateDispatcherWithInstantMainLoop() => Mock.Of<IControlledDispatcherImpl>(x => x.CurrentThreadIsLoopThread == true);
[Fact]
public void Should_Set_ExitCode_After_Shutdown()
{
using (UnitTestApplication.Start(TestServices.MockThreadingInterface))
using (UnitTestApplication.Start(new TestServices(dispatcherImpl: CreateDispatcherWithInstantMainLoop())))
using(var lifetime = new ClassicDesktopStyleApplicationLifetime())
{
lifetime.Shutdown(1337);
@ -215,7 +219,7 @@ namespace Avalonia.Controls.UnitTests
[Fact]
public void Should_Allow_Canceling_Shutdown_Via_ShutdownRequested_Event()
{
using (UnitTestApplication.Start(TestServices.StyledWindow))
using (UnitTestApplication.Start(TestServices.StyledWindow.With(dispatcherImpl: CreateDispatcherWithInstantMainLoop())))
using (var lifetime = new ClassicDesktopStyleApplicationLifetime())
{
var lifetimeEvents = new Mock<IPlatformLifetimeEventsImpl>();

10
tests/Avalonia.Controls.UnitTests/Primitives/SelectingItemsControlTests.cs

@ -2084,13 +2084,9 @@ namespace Avalonia.Controls.UnitTests.Primitives
[Fact]
public void Setting_IsTextSearchEnabled_Enables_Or_Disables_Text_Search()
{
var pti = Mock.Of<IPlatformThreadingInterface>(x => x.CurrentThreadIsLoopThread == true);
Mock.Get(pti)
.Setup(v => v.StartTimer(It.IsAny<DispatcherPriority>(), It.IsAny<TimeSpan>(), It.IsAny<Action>()))
.Returns(Disposable.Empty);
using (UnitTestApplication.Start(TestServices.StyledWindow.With(threadingInterface: pti)))
var pti = Mock.Of<IDispatcherImpl>(x => x.CurrentThreadIsLoopThread == true);
using (UnitTestApplication.Start(TestServices.StyledWindow.With(dispatcherImpl: pti)))
{
var items = new[]
{

33
tests/Avalonia.RenderTests/TestBase.cs

@ -41,8 +41,8 @@ namespace Avalonia.Direct2D1.RenderTests
#endif
public static FontFamily TestFontFamily = new FontFamily(s_fontUri);
private static readonly TestThreadingInterface threadingInterface =
new TestThreadingInterface();
private static readonly TestDispatcherImpl threadingInterface =
new TestDispatcherImpl();
private static readonly IAssetLoader assetLoader = new AssetLoader();
@ -54,7 +54,7 @@ namespace Avalonia.Direct2D1.RenderTests
Direct2D1Platform.Initialize();
#endif
AvaloniaLocator.CurrentMutable
.Bind<IPlatformThreadingInterface>()
.Bind<IDispatcherImpl>()
.ToConstant(threadingInterface);
AvaloniaLocator.CurrentMutable
@ -243,40 +243,27 @@ namespace Avalonia.Direct2D1.RenderTests
return path;
}
private class TestThreadingInterface : IPlatformThreadingInterface
private class TestDispatcherImpl : IDispatcherImpl
{
public bool CurrentThreadIsLoopThread => MainThread.ManagedThreadId == Thread.CurrentThread.ManagedThreadId;
public Thread MainThread { get; set; }
#pragma warning disable 67
public event Action<DispatcherPriority?> Signaled;
public event Action Signaled;
public event Action Timer;
#pragma warning restore 67
public void Signal(DispatcherPriority prio)
public void Signal()
{
// No-op
}
private static List<Action> s_timers = new();
public static void RunTimers()
{
lock (s_timers)
{
foreach(var t in s_timers.ToList())
t.Invoke();
}
}
public long Now => 0;
public IDisposable StartTimer(DispatcherPriority priority, TimeSpan interval, Action tick)
public void UpdateTimer(long? dueTimeInMs)
{
var act = () => tick();
lock (s_timers) s_timers.Add(act);
return Disposable.Create(() =>
{
lock (s_timers) s_timers.Remove(act);
});
// No-op
}
}

15
tests/Avalonia.UnitTests/TestServices.cs

@ -13,6 +13,7 @@ using System.Collections.Generic;
using Avalonia.Controls;
using System.Reflection;
using Avalonia.Animation;
using Avalonia.Threading;
namespace Avalonia.UnitTests
{
@ -24,7 +25,7 @@ namespace Avalonia.UnitTests
renderInterface: new MockPlatformRenderInterface(),
standardCursorFactory: Mock.Of<ICursorFactory>(),
theme: () => CreateSimpleTheme(),
threadingInterface: Mock.Of<IPlatformThreadingInterface>(x => x.CurrentThreadIsLoopThread == true),
dispatcherImpl: Mock.Of<IDispatcherImpl>(x => x.CurrentThreadIsLoopThread == true),
fontManagerImpl: new MockFontManagerImpl(),
textShaperImpl: new MockTextShaperImpl(),
windowingPlatform: new MockWindowingPlatform());
@ -39,7 +40,7 @@ namespace Avalonia.UnitTests
platform: Mock.Of<IRuntimePlatform>());
public static readonly TestServices MockThreadingInterface = new TestServices(
threadingInterface: Mock.Of<IPlatformThreadingInterface>(x => x.CurrentThreadIsLoopThread == true));
dispatcherImpl: Mock.Of<IDispatcherImpl>(x => x.CurrentThreadIsLoopThread == true));
public static readonly TestServices MockWindowingPlatform = new TestServices(
windowingPlatform: new MockWindowingPlatform());
@ -73,7 +74,7 @@ namespace Avalonia.UnitTests
IRenderTimer renderLoop = null,
ICursorFactory standardCursorFactory = null,
Func<IStyle> theme = null,
IPlatformThreadingInterface threadingInterface = null,
IDispatcherImpl dispatcherImpl = null,
IFontManagerImpl fontManagerImpl = null,
ITextShaperImpl textShaperImpl = null,
IWindowImpl windowImpl = null,
@ -92,7 +93,7 @@ namespace Avalonia.UnitTests
TextShaperImpl = textShaperImpl;
StandardCursorFactory = standardCursorFactory;
Theme = theme;
ThreadingInterface = threadingInterface;
DispatcherImpl = dispatcherImpl;
WindowImpl = windowImpl;
WindowingPlatform = windowingPlatform;
}
@ -110,7 +111,7 @@ namespace Avalonia.UnitTests
public ITextShaperImpl TextShaperImpl { get; }
public ICursorFactory StandardCursorFactory { get; }
public Func<IStyle> Theme { get; }
public IPlatformThreadingInterface ThreadingInterface { get; }
public IDispatcherImpl DispatcherImpl { get; }
public IWindowImpl WindowImpl { get; }
public IWindowingPlatform WindowingPlatform { get; }
@ -128,7 +129,7 @@ namespace Avalonia.UnitTests
IScheduler scheduler = null,
ICursorFactory standardCursorFactory = null,
Func<IStyle> theme = null,
IPlatformThreadingInterface threadingInterface = null,
IDispatcherImpl dispatcherImpl = null,
IFontManagerImpl fontManagerImpl = null,
ITextShaperImpl textShaperImpl = null,
IWindowImpl windowImpl = null,
@ -148,7 +149,7 @@ namespace Avalonia.UnitTests
textShaperImpl: textShaperImpl ?? TextShaperImpl,
standardCursorFactory: standardCursorFactory ?? StandardCursorFactory,
theme: theme ?? Theme,
threadingInterface: threadingInterface ?? ThreadingInterface,
dispatcherImpl: dispatcherImpl ?? DispatcherImpl,
windowingPlatform: windowingPlatform ?? WindowingPlatform,
windowImpl: windowImpl ?? WindowImpl);
}

2
tests/Avalonia.UnitTests/UnitTestApplication.cs

@ -71,7 +71,7 @@ namespace Avalonia.UnitTests
.Bind<IPlatformRenderInterface>().ToConstant(Services.RenderInterface)
.Bind<IFontManagerImpl>().ToConstant(Services.FontManagerImpl)
.Bind<ITextShaperImpl>().ToConstant(Services.TextShaperImpl)
.Bind<IPlatformThreadingInterface>().ToConstant(Services.ThreadingInterface)
.Bind<IDispatcherImpl>().ToConstant(Services.DispatcherImpl)
.Bind<ICursorFactory>().ToConstant(Services.StandardCursorFactory)
.Bind<IWindowingPlatform>().ToConstant(Services.WindowingPlatform)
.Bind<PlatformHotkeyConfiguration>().ToSingleton<PlatformHotkeyConfiguration>();

Loading…
Cancel
Save