Browse Source

Removed duplicate TestRoot.

Use the one in Avalonia.UnitTests.
pull/796/head
Steven Kirk 10 years ago
parent
commit
8aae515130
  1. 39
      tests/Avalonia.Visuals.UnitTests/TestRoot.cs
  2. 15
      tests/Avalonia.Visuals.UnitTests/VisualTests.cs

39
tests/Avalonia.Visuals.UnitTests/TestRoot.cs

@ -1,39 +0,0 @@
// Copyright (c) The Avalonia Project. All rights reserved.
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using System;
using Avalonia.Platform;
using Avalonia.Rendering;
namespace Avalonia.Visuals.UnitTests
{
public class TestRoot : TestVisual, IRenderRoot
{
public Size ClientSize { get; }
public IRenderTarget CreateRenderTarget()
{
throw new NotImplementedException();
}
public void Invalidate(Rect rect)
{
throw new NotImplementedException();
}
public IRenderer Renderer
{
get { throw new NotImplementedException(); }
}
public Point PointToClient(Point p)
{
throw new NotImplementedException();
}
public Point PointToScreen(Point p)
{
throw new NotImplementedException();
}
}
}

15
tests/Avalonia.Visuals.UnitTests/VisualTests.cs

@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Avalonia.Controls;
using Avalonia.UnitTests;
using Avalonia.VisualTree;
using Xunit;
@ -66,8 +67,8 @@ namespace Avalonia.Visuals.UnitTests
[Fact]
public void Adding_Children_Should_Fire_OnAttachedToVisualTree()
{
var child2 = new TestVisual();
var child1 = new TestVisual { Child = child2 };
var child2 = new Decorator();
var child1 = new Decorator { Child = child2 };
var root = new TestRoot();
var called1 = false;
var called2 = false;
@ -84,8 +85,8 @@ namespace Avalonia.Visuals.UnitTests
[Fact]
public void Removing_Children_Should_Fire_OnDetachedFromVisualTree()
{
var child2 = new TestVisual();
var child1 = new TestVisual { Child = child2 };
var child2 = new Decorator();
var child1 = new Decorator { Child = child2 };
var root = new TestRoot();
var called1 = false;
var called2 = false;
@ -104,11 +105,11 @@ namespace Avalonia.Visuals.UnitTests
{
var root1 = new TestRoot();
var root2 = new TestRoot();
var child = new TestVisual();
var child = new Canvas();
root1.AddChild(child);
root1.Child = child;
Assert.Throws<InvalidOperationException>(() => root2.AddChild(child));
Assert.Throws<InvalidOperationException>(() => root2.Child = child);
Assert.Equal(0, root2.GetVisualChildren().Count());
}
}

Loading…
Cancel
Save