16 changed files with 138 additions and 192 deletions
@ -1,35 +0,0 @@ |
|||
using System; |
|||
using Moq; |
|||
using Avalonia.Platform; |
|||
|
|||
namespace Avalonia.Controls.UnitTests |
|||
{ |
|||
public class WindowingPlatformMock : IWindowingPlatform |
|||
{ |
|||
private readonly Func<IWindowImpl> _windowImpl; |
|||
private readonly Func<IPopupImpl> _popupImpl; |
|||
|
|||
public WindowingPlatformMock(Func<IWindowImpl> windowImpl = null, Func<IPopupImpl> popupImpl = null ) |
|||
{ |
|||
_windowImpl = windowImpl; |
|||
_popupImpl = popupImpl; |
|||
} |
|||
|
|||
public IWindowImpl CreateWindow() |
|||
{ |
|||
return _windowImpl?.Invoke() ?? Mock.Of<IWindowImpl>(x => x.RenderScaling == 1); |
|||
} |
|||
|
|||
public IWindowImpl CreateEmbeddableWindow() |
|||
{ |
|||
throw new NotImplementedException(); |
|||
} |
|||
|
|||
public ITrayIconImpl CreateTrayIcon() |
|||
{ |
|||
return null; |
|||
} |
|||
|
|||
public IPopupImpl CreatePopup() => _popupImpl?.Invoke() ?? Mock.Of<IPopupImpl>(x => x.RenderScaling == 1); |
|||
} |
|||
} |
|||
@ -1,54 +0,0 @@ |
|||
using System; |
|||
using Avalonia.Controls; |
|||
using Avalonia.Controls.Presenters; |
|||
using Avalonia.Controls.Templates; |
|||
using Avalonia.Layout; |
|||
using Avalonia.LogicalTree; |
|||
using Avalonia.Platform; |
|||
using Avalonia.Rendering; |
|||
using Avalonia.Styling; |
|||
|
|||
namespace Avalonia.UnitTests |
|||
{ |
|||
public class TestTemplatedRoot : ContentControl, ILayoutRoot, IRenderRoot, ILogicalRoot |
|||
{ |
|||
private readonly NameScope _nameScope = new NameScope(); |
|||
|
|||
public TestTemplatedRoot() |
|||
{ |
|||
LayoutManager = new LayoutManager(this); |
|||
Template = new FuncControlTemplate<TestTemplatedRoot>((x, scope) => new ContentPresenter |
|||
{ |
|||
Name = "PART_ContentPresenter", |
|||
}.RegisterInNameScope(scope)); |
|||
} |
|||
|
|||
public Size ClientSize => new Size(100, 100); |
|||
|
|||
public Size MaxClientSize => Size.Infinity; |
|||
|
|||
public double LayoutScaling => 1; |
|||
|
|||
public ILayoutManager LayoutManager { get; set; } |
|||
|
|||
public double RenderScaling => 1; |
|||
|
|||
public IRenderTarget RenderTarget => null; |
|||
|
|||
public IRenderer Renderer => null; |
|||
|
|||
public IRenderTarget CreateRenderTarget() |
|||
{ |
|||
throw new NotImplementedException(); |
|||
} |
|||
|
|||
public void Invalidate(Rect rect) |
|||
{ |
|||
throw new NotImplementedException(); |
|||
} |
|||
|
|||
public Point PointToClient(PixelPoint p) => p.ToPoint(1); |
|||
|
|||
public PixelPoint PointToScreen(Point p) => PixelPoint.FromPoint(p, 1); |
|||
} |
|||
} |
|||
Loading…
Reference in new issue