浏览代码

Merge branch 'remove-duplicate-testroot' into scenegraph

 Conflicts:
	tests/Avalonia.Visuals.UnitTests/TestRoot.cs
Steven Kirk 9 年之前
父节点
当前提交
83d45c548b

+ 1 - 1
src/Gtk/Avalonia.Cairo/Avalonia.Cairo.v2.ncrunchproject

@@ -7,7 +7,7 @@
   <AllowDynamicCodeContractChecking>true</AllowDynamicCodeContractChecking>
   <AllowDynamicCodeContractChecking>true</AllowDynamicCodeContractChecking>
   <AllowStaticCodeContractChecking>false</AllowStaticCodeContractChecking>
   <AllowStaticCodeContractChecking>false</AllowStaticCodeContractChecking>
   <AllowCodeAnalysis>false</AllowCodeAnalysis>
   <AllowCodeAnalysis>false</AllowCodeAnalysis>
-  <IgnoreThisComponentCompletely>false</IgnoreThisComponentCompletely>
+  <IgnoreThisComponentCompletely>true</IgnoreThisComponentCompletely>
   <RunPreBuildEvents>false</RunPreBuildEvents>
   <RunPreBuildEvents>false</RunPreBuildEvents>
   <RunPostBuildEvents>false</RunPostBuildEvents>
   <RunPostBuildEvents>false</RunPostBuildEvents>
   <PreviouslyBuiltSuccessfully>true</PreviouslyBuiltSuccessfully>
   <PreviouslyBuiltSuccessfully>true</PreviouslyBuiltSuccessfully>

+ 0 - 1
tests/Avalonia.Visuals.UnitTests/Avalonia.Visuals.UnitTests.csproj

@@ -85,7 +85,6 @@
     <Compile Include="ThicknessTests.cs" />
     <Compile Include="ThicknessTests.cs" />
     <Compile Include="Media\BrushTests.cs" />
     <Compile Include="Media\BrushTests.cs" />
     <Compile Include="Media\ColorTests.cs" />
     <Compile Include="Media\ColorTests.cs" />
-    <Compile Include="TestRoot.cs" />
     <Compile Include="TestVisual.cs" />
     <Compile Include="TestVisual.cs" />
     <Compile Include="RelativePointTests.cs" />
     <Compile Include="RelativePointTests.cs" />
     <Compile Include="RenderTests_Culling.cs" />
     <Compile Include="RenderTests_Culling.cs" />

+ 0 - 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 { return AvaloniaLocator.Current.GetService<IRenderer>(); }
-        }
-
-        public Point PointToClient(Point p)
-        {
-            throw new NotImplementedException();
-        }
-
-        public Point PointToScreen(Point p)
-        {
-            throw new NotImplementedException();
-        }
-    }
-}

+ 8 - 7
tests/Avalonia.Visuals.UnitTests/VisualTests.cs

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