Browse Source
And use it in every unit test project except SceneGraph as that one is different.pull/417/head
19 changed files with 123 additions and 276 deletions
@ -1,38 +0,0 @@ |
|||
// Copyright (c) The Perspex Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System; |
|||
using Moq; |
|||
using Perspex.Layout; |
|||
using Perspex.Platform; |
|||
using Perspex.Rendering; |
|||
using Perspex.Styling; |
|||
|
|||
namespace Perspex.Controls.UnitTests |
|||
{ |
|||
internal class TestRoot : Decorator, ILayoutRoot, IRenderRoot, IStyleRoot |
|||
{ |
|||
public Size ClientSize => new Size(100, 100); |
|||
|
|||
public Size MaxClientSize => Size.Infinity; |
|||
|
|||
public ILayoutManager LayoutManager => new Mock<ILayoutManager>().Object; |
|||
|
|||
public IRenderTarget RenderTarget |
|||
{ |
|||
get { throw new NotImplementedException(); } |
|||
} |
|||
|
|||
public IRenderQueueManager RenderQueueManager => null; |
|||
|
|||
public Point PointToClient(Point p) |
|||
{ |
|||
throw new NotImplementedException(); |
|||
} |
|||
|
|||
public Point PointToScreen(Point p) |
|||
{ |
|||
return new Point(); |
|||
} |
|||
} |
|||
} |
|||
@ -1,67 +0,0 @@ |
|||
// Copyright (c) The Perspex Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System; |
|||
using Perspex.Controls; |
|||
using Perspex.Platform; |
|||
using Perspex.Rendering; |
|||
using Perspex.Styling; |
|||
|
|||
namespace Perspex.Markup.Xaml.UnitTests |
|||
{ |
|||
public class TestRoot : Decorator, IRenderRoot, INameScope, IStyleRoot |
|||
{ |
|||
private readonly NameScope _nameScope = new NameScope(); |
|||
|
|||
event EventHandler<NameScopeEventArgs> INameScope.Registered |
|||
{ |
|||
add { _nameScope.Registered += value; ++NameScopeRegisteredSubscribers; } |
|||
remove { _nameScope.Registered -= value; --NameScopeRegisteredSubscribers; } |
|||
} |
|||
|
|||
public event EventHandler<NameScopeEventArgs> Unregistered |
|||
{ |
|||
add { _nameScope.Unregistered += value; ++NameScopeUnregisteredSubscribers; } |
|||
remove { _nameScope.Unregistered -= value; --NameScopeUnregisteredSubscribers; } |
|||
} |
|||
|
|||
public int NameScopeRegisteredSubscribers { get; private set; } |
|||
|
|||
public int NameScopeUnregisteredSubscribers { get; private set; } |
|||
|
|||
public IRenderTarget RenderTarget |
|||
{ |
|||
get { throw new NotImplementedException(); } |
|||
} |
|||
|
|||
public IRenderQueueManager RenderQueueManager |
|||
{ |
|||
get { throw new NotImplementedException(); } |
|||
} |
|||
|
|||
public Point PointToClient(Point p) |
|||
{ |
|||
throw new NotImplementedException(); |
|||
} |
|||
|
|||
public Point PointToScreen(Point p) |
|||
{ |
|||
throw new NotImplementedException(); |
|||
} |
|||
|
|||
public void Register(string name, object element) |
|||
{ |
|||
_nameScope.Register(name, element); |
|||
} |
|||
|
|||
public object Find(string name) |
|||
{ |
|||
return _nameScope.Find(name); |
|||
} |
|||
|
|||
public void Unregister(string name) |
|||
{ |
|||
_nameScope.Unregister(name); |
|||
} |
|||
} |
|||
} |
|||
@ -1,39 +0,0 @@ |
|||
// Copyright (c) The Perspex Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System; |
|||
using Moq; |
|||
using Perspex.Controls; |
|||
using Perspex.Layout; |
|||
using Perspex.Platform; |
|||
using Perspex.Rendering; |
|||
|
|||
namespace Perspex.Styling.UnitTests |
|||
{ |
|||
internal class TestRoot : Decorator, ILayoutRoot, IRenderRoot, IStyleRoot |
|||
{ |
|||
public Size ClientSize => new Size(100, 100); |
|||
|
|||
public Size MaxClientSize => Size.Infinity; |
|||
|
|||
public IRenderTarget RenderTarget |
|||
{ |
|||
get { throw new NotImplementedException(); } |
|||
} |
|||
|
|||
public IRenderQueueManager RenderQueueManager |
|||
{ |
|||
get { throw new NotImplementedException(); } |
|||
} |
|||
|
|||
public Point PointToClient(Point p) |
|||
{ |
|||
throw new NotImplementedException(); |
|||
} |
|||
|
|||
public Point PointToScreen(Point p) |
|||
{ |
|||
return new Point(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,65 @@ |
|||
// Copyright (c) The Perspex Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using System; |
|||
using Perspex.Controls; |
|||
using Perspex.Controls.Presenters; |
|||
using Perspex.Controls.Templates; |
|||
using Perspex.Layout; |
|||
using Perspex.Platform; |
|||
using Perspex.Rendering; |
|||
using Perspex.Styling; |
|||
|
|||
namespace Perspex.UnitTests |
|||
{ |
|||
public class TestTemplatedRoot : ContentControl, ILayoutRoot, INameScope, IRenderRoot, IStyleRoot |
|||
{ |
|||
private readonly NameScope _nameScope = new NameScope(); |
|||
|
|||
public TestTemplatedRoot() |
|||
{ |
|||
Template = new FuncControlTemplate<TestTemplatedRoot>(x => new ContentPresenter()); |
|||
} |
|||
|
|||
public event EventHandler<NameScopeEventArgs> Registered |
|||
{ |
|||
add { _nameScope.Registered += value; } |
|||
remove { _nameScope.Registered -= value; } |
|||
} |
|||
|
|||
public event EventHandler<NameScopeEventArgs> Unregistered |
|||
{ |
|||
add { _nameScope.Unregistered += value; } |
|||
remove { _nameScope.Unregistered -= value; } |
|||
} |
|||
|
|||
public Size ClientSize => new Size(100, 100); |
|||
|
|||
public Size MaxClientSize => Size.Infinity; |
|||
|
|||
public ILayoutManager LayoutManager => PerspexLocator.Current.GetService<ILayoutManager>(); |
|||
|
|||
public IRenderTarget RenderTarget => null; |
|||
|
|||
public IRenderQueueManager RenderQueueManager => null; |
|||
|
|||
public Point PointToClient(Point p) => p; |
|||
|
|||
public Point PointToScreen(Point p) => p; |
|||
|
|||
void INameScope.Register(string name, object element) |
|||
{ |
|||
_nameScope.Register(name, element); |
|||
} |
|||
|
|||
object INameScope.Find(string name) |
|||
{ |
|||
return _nameScope.Find(name); |
|||
} |
|||
|
|||
void INameScope.Unregister(string name) |
|||
{ |
|||
_nameScope.Unregister(name); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue