فهرست منبع

Merge branch 'master' into control-resources

 Conflicts:
	src/Avalonia.Controls/Application.cs
	src/Avalonia.Controls/Control.cs
	src/Avalonia.Controls/IControl.cs
	src/Avalonia.Styling/Styling/StyleExtensions.cs
	tests/Avalonia.Styling.UnitTests/ResourceTests.cs
Steven Kirk 8 سال پیش
والد
کامیت
fd526514f8
24فایلهای تغییر یافته به همراه133 افزوده شده و 103 حذف شده
  1. 1 1
      build.cake
  2. 9 6
      src/Avalonia.Controls/Application.cs
  3. 8 6
      src/Avalonia.Controls/Control.cs
  4. 9 6
      src/Avalonia.Controls/IControl.cs
  5. 1 5
      src/Avalonia.Controls/IGlobalDataTemplates.cs
  6. 15 9
      src/Avalonia.Controls/Templates/DataTemplateExtensions.cs
  7. 27 0
      src/Avalonia.Controls/Templates/IDataTemplateHost.cs
  8. 1 1
      src/Avalonia.Diagnostics/DevTools.xaml.cs
  9. 1 1
      src/Avalonia.Diagnostics/Views/ControlDetailsView.cs
  10. 12 8
      src/Avalonia.Interactivity/Interactive.cs
  11. 11 0
      src/Avalonia.Styling/Styling/IStyleHost.cs
  12. 4 1
      src/Avalonia.Styling/Styling/Styler.cs
  13. 2 0
      src/Gtk/Avalonia.Gtk3/Interop/Utf8Buffer.cs
  14. 1 1
      tests/Avalonia.Controls.UnitTests/ItemsControlTests.cs
  15. 4 4
      tests/Avalonia.Controls.UnitTests/ListBoxTests.cs
  16. 1 1
      tests/Avalonia.Controls.UnitTests/Presenters/ContentPresenterTests_Unrooted.cs
  17. 1 0
      tests/Avalonia.Controls.UnitTests/Primitives/PopupTests.cs
  18. 4 4
      tests/Avalonia.Controls.UnitTests/Primitives/TemplatedControlTests.cs
  19. 2 2
      tests/Avalonia.Controls.UnitTests/TabControlTests.cs
  20. 14 14
      tests/Avalonia.Controls.UnitTests/TreeViewTests.cs
  21. 1 1
      tests/Avalonia.Controls.UnitTests/UserControlTests.cs
  22. 2 31
      tests/Avalonia.Input.UnitTests/Avalonia.Input.UnitTests.csproj
  23. 1 0
      tests/Avalonia.Layout.UnitTests/FullLayoutTests.cs
  24. 1 1
      tests/Avalonia.LeakTests/ControlTests.cs

+ 1 - 1
build.cake

@@ -6,7 +6,7 @@
 #addin "nuget:?package=NuGet.Core&version=2.12.0"
 #tool "nuget:?package=xunit.runner.console&version=2.2.0"
 #tool "nuget:https://dotnet.myget.org/F/nuget-build/?package=NuGet.CommandLine&version=4.3.0-preview1-3980&prerelease"
-#tool "JetBrains.ReSharper.CommandLineTools"
+#tool "nuget:?package=JetBrains.ReSharper.CommandLineTools&version=2017.1.20170613.162720"
 ///////////////////////////////////////////////////////////////////////////////
 // TOOLS
 ///////////////////////////////////////////////////////////////////////////////

+ 9 - 6
src/Avalonia.Controls/Application.cs

@@ -39,6 +39,7 @@ namespace Avalonia
         private readonly Lazy<IClipboard> _clipboard =
             new Lazy<IClipboard>(() => (IClipboard)AvaloniaLocator.Current.GetService(typeof(IClipboard)));
         private readonly Styler _styler = new Styler();
+        private Styles _styles;
         private IResourceDictionary _resources;
 
         /// <summary>
@@ -69,11 +70,7 @@ namespace Avalonia
         /// <value>
         /// The application's global data templates.
         /// </value>
-        public DataTemplates DataTemplates
-        {
-            get { return _dataTemplates ?? (_dataTemplates = new DataTemplates()); }
-            set { _dataTemplates = value; }
-        }
+        public DataTemplates DataTemplates => _dataTemplates ?? (_dataTemplates = new DataTemplates());
 
         /// <summary>
         /// Gets the application's focus manager.
@@ -141,13 +138,19 @@ namespace Avalonia
         /// <remarks>
         /// Global styles apply to all windows in the application.
         /// </remarks>
-        public Styles Styles { get; } = new Styles();
+        public Styles Styles => _styles ?? (_styles = new Styles());
+
+        /// <inheritdoc/>
+        bool IDataTemplateHost.IsDataTemplatesInitialized => _dataTemplates != null;
 
         /// <summary>
         /// Gets the styling parent of the application, which is null.
         /// </summary>
         IStyleHost IStyleHost.StylingParent => null;
 
+        /// <inheritdoc/>
+        bool IStyleHost.IsStylesInitialized => _styles != null;
+
         /// <inheritdoc/>
         bool IResourceProvider.HasResources => _resources?.Count > 0;
 

+ 8 - 6
src/Avalonia.Controls/Control.cs

@@ -249,11 +249,7 @@ namespace Avalonia.Controls
         /// Each control may define data templates which are applied to the control itself and its
         /// children.
         /// </remarks>
-        public DataTemplates DataTemplates
-        {
-            get { return _dataTemplates ?? (_dataTemplates = new DataTemplates()); }
-            set { _dataTemplates = value; }
-        }
+        public DataTemplates DataTemplates => _dataTemplates ?? (_dataTemplates = new DataTemplates());
 
         /// <summary>
         /// Gets a value that indicates whether the element has finished initialization.
@@ -265,7 +261,7 @@ namespace Avalonia.Controls
         public bool IsInitialized { get; private set; }
 
         /// <summary>
-        /// Gets or sets the styles for the control.
+        /// Gets the styles for the control.
         /// </summary>
         /// <remarks>
         /// Styles for the entire application are added to the Application.Styles collection, but
@@ -379,6 +375,9 @@ namespace Avalonia.Controls
             }
         }
 
+        /// <inheritdoc/>
+        bool IDataTemplateHost.IsDataTemplatesInitialized => _dataTemplates != null;
+
         /// <summary>
         /// Gets the <see cref="Classes"/> collection in a form that allows adding and removing
         /// pseudoclasses.
@@ -423,6 +422,9 @@ namespace Avalonia.Controls
         /// <inheritdoc/>
         IObservable<IStyleable> IStyleable.StyleDetach => _styleDetach;
 
+        /// <inheritdoc/>
+        bool IStyleHost.IsStylesInitialized => _styles != null;
+
         /// <inheritdoc/>
         IStyleHost IStyleHost.StylingParent => (IStyleHost)InheritanceParent;
 

+ 9 - 6
src/Avalonia.Controls/IControl.cs

@@ -14,7 +14,15 @@ namespace Avalonia.Controls
     /// <summary>
     /// Interface for Avalonia controls.
     /// </summary>
-    public interface IControl : IVisual, ILogical, ILayoutable, IInputElement, INamed, IResourceNode, IStyleable, IStyleHost
+    public interface IControl : IVisual,
+        IDataTemplateHost,
+        ILogical,
+        ILayoutable,
+        IInputElement,
+        INamed,
+        IResourceNode,
+        IStyleable,
+        IStyleHost
     {
         /// <summary>
         /// Occurs when the control has finished initialization.
@@ -31,11 +39,6 @@ namespace Avalonia.Controls
         /// </summary>
         object DataContext { get; set; }
 
-        /// <summary>
-        /// Gets the data templates for the control.
-        /// </summary>
-        DataTemplates DataTemplates { get; }
-
         /// <summary>
         /// Gets a value that indicates whether the element has finished initialization.
         /// </summary>

+ 1 - 5
src/Avalonia.Controls/IGlobalDataTemplates.cs

@@ -8,11 +8,7 @@ namespace Avalonia.Controls
     /// <summary>
     /// Defines the application-global data templates.
     /// </summary>
-    public interface IGlobalDataTemplates
+    public interface IGlobalDataTemplates : IDataTemplateHost
     {
-        /// <summary>
-        /// Gets the application-global data templates.
-        /// </summary>
-        DataTemplates DataTemplates { get; }
     }
 }

+ 15 - 9
src/Avalonia.Controls/Templates/DataTemplateExtensions.cs

@@ -17,8 +17,8 @@ namespace Avalonia.Controls.Templates
         /// <param name="control">The control searching for the data template.</param>
         /// <param name="data">The data.</param>
         /// <param name="primary">
-        /// An optional primary template that can will be tried before the
-        /// <see cref="IControl.DataTemplates"/> in the tree are searched.
+        /// An optional primary template that can will be tried before the DataTemplates in the
+        /// tree are searched.
         /// </param>
         /// <returns>The data template or null if no matching data template was found.</returns>
         public static IDataTemplate FindDataTemplate(
@@ -31,13 +31,16 @@ namespace Avalonia.Controls.Templates
                 return primary;
             }
 
-            foreach (var i in control.GetSelfAndLogicalAncestors().OfType<IControl>())
+            foreach (var i in control.GetSelfAndLogicalAncestors().OfType<IDataTemplateHost>())
             {
-                foreach (IDataTemplate dt in i.DataTemplates)
+                if (i.IsDataTemplatesInitialized)
                 {
-                    if (dt.Match(data))
+                    foreach (IDataTemplate dt in i.DataTemplates)
                     {
-                        return dt;
+                        if (dt.Match(data))
+                        {
+                            return dt;
+                        }
                     }
                 }
             }
@@ -46,11 +49,14 @@ namespace Avalonia.Controls.Templates
 
             if (global != null)
             {
-                foreach (IDataTemplate dt in global.DataTemplates)
+                if (global.IsDataTemplatesInitialized)
                 {
-                    if (dt.Match(data))
+                    foreach (IDataTemplate dt in global.DataTemplates)
                     {
-                        return dt;
+                        if (dt.Match(data))
+                        {
+                            return dt;
+                        }
                     }
                 }
             }

+ 27 - 0
src/Avalonia.Controls/Templates/IDataTemplateHost.cs

@@ -0,0 +1,27 @@
+// 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;
+
+namespace Avalonia.Controls.Templates
+{
+    /// <summary>
+    /// Defines an element that has a <see cref="DataTemplates"/> collection.
+    /// </summary>
+    public interface IDataTemplateHost
+    {
+        /// <summary>
+        /// Gets the data templates for the element.
+        /// </summary>
+        DataTemplates DataTemplates { get; }
+
+        /// <summary>
+        /// Gets a value indicating whether <see cref="DataTemplates"/> is initialized.
+        /// </summary>
+        /// <remarks>
+        /// The <see cref="DataTemplates"/> property may be lazily initialized, if so this property
+        /// indicates whether it has been initialized.
+        /// </remarks>
+        bool IsDataTemplatesInitialized { get; }
+    }
+}

+ 1 - 1
src/Avalonia.Diagnostics/DevTools.xaml.cs

@@ -71,7 +71,7 @@ namespace Avalonia.Diagnostics
                         Width = 1024,
                         Height = 512,
                         Content = devTools,
-                        DataTemplates = new DataTemplates
+                        DataTemplates =
                         {
                             new ViewLocator<ViewModelBase>(),
                         }

+ 1 - 1
src/Avalonia.Diagnostics/Views/ControlDetailsView.cs

@@ -42,7 +42,7 @@ namespace Avalonia.Diagnostics.Views
             {
                 Content = _grid = new SimpleGrid
                 {
-                    Styles = new Styles
+                    Styles =
                     {
                         new Style(x => x.Is<Control>())
                         {

+ 12 - 8
src/Avalonia.Interactivity/Interactive.cs

@@ -16,14 +16,18 @@ namespace Avalonia.Interactivity
     /// </summary>
     public class Interactive : Layoutable, IInteractive
     {
-        private readonly Dictionary<RoutedEvent, List<EventSubscription>> _eventHandlers =
-            new Dictionary<RoutedEvent, List<EventSubscription>>();
+        private Dictionary<RoutedEvent, List<EventSubscription>> _eventHandlers;
 
         /// <summary>
         /// Gets the interactive parent of the object for bubbling and tunnelling events.
         /// </summary>
         IInteractive IInteractive.InteractiveParent => ((IVisual)this).VisualParent as IInteractive;
 
+        private Dictionary<RoutedEvent, List<EventSubscription>> EventHandlers
+        {
+            get { return _eventHandlers ?? (_eventHandlers = new Dictionary<RoutedEvent, List<EventSubscription>>()); }
+        }
+
         /// <summary>
         /// Adds a handler for the specified routed event.
         /// </summary>
@@ -43,10 +47,10 @@ namespace Avalonia.Interactivity
 
             List<EventSubscription> subscriptions;
 
-            if (!_eventHandlers.TryGetValue(routedEvent, out subscriptions))
+            if (!EventHandlers.TryGetValue(routedEvent, out subscriptions))
             {
                 subscriptions = new List<EventSubscription>();
-                _eventHandlers.Add(routedEvent, subscriptions);
+                EventHandlers.Add(routedEvent, subscriptions);
             }
 
             var sub = new EventSubscription
@@ -89,9 +93,9 @@ namespace Avalonia.Interactivity
             Contract.Requires<ArgumentNullException>(routedEvent != null);
             Contract.Requires<ArgumentNullException>(handler != null);
 
-            List<EventSubscription> subscriptions;
+            List<EventSubscription> subscriptions = null;
 
-            if (_eventHandlers.TryGetValue(routedEvent, out subscriptions))
+            if (_eventHandlers?.TryGetValue(routedEvent, out subscriptions) == true)
             {
                 subscriptions.RemoveAll(x => x.Handler == handler);
             }
@@ -181,9 +185,9 @@ namespace Avalonia.Interactivity
 
             e.RoutedEvent.InvokeRaised(this, e);
 
-            List<EventSubscription> subscriptions;
+            List<EventSubscription> subscriptions = null;
 
-            if (_eventHandlers.TryGetValue(e.RoutedEvent, out subscriptions))
+            if (_eventHandlers?.TryGetValue(e.RoutedEvent, out subscriptions) == true)
             {
                 foreach (var sub in subscriptions.ToList())
                 {

+ 11 - 0
src/Avalonia.Styling/Styling/IStyleHost.cs

@@ -1,6 +1,8 @@
 // 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;
+
 namespace Avalonia.Styling
 {
     /// <summary>
@@ -8,6 +10,15 @@ namespace Avalonia.Styling
     /// </summary>
     public interface IStyleHost
     {
+        /// <summary>
+        /// Gets a value indicating whether <see cref="Styles"/> is initialized.
+        /// </summary>
+        /// <remarks>
+        /// The <see cref="Styles"/> property may be lazily initialized, if so this property
+        /// indicates whether it has been initialized.
+        /// </remarks>
+        bool IsStylesInitialized { get; }
+
         /// <summary>
         /// Gets the styles for the element.
         /// </summary>

+ 4 - 1
src/Avalonia.Styling/Styling/Styler.cs

@@ -29,7 +29,10 @@ namespace Avalonia.Styling
                 ApplyStyles(control, parentContainer);
             }
 
-            styleHost.Styles.Attach(control, styleHost);
+            if (styleHost.IsStylesInitialized)
+            {
+                styleHost.Styles.Attach(control, styleHost);
+            }
         }
     }
 }

+ 2 - 0
src/Gtk/Avalonia.Gtk3/Interop/Utf8Buffer.cs

@@ -36,6 +36,8 @@ namespace Avalonia.Gtk3.Interop
         public static unsafe string StringFromPtr(IntPtr s)
         {
             var pstr = (byte*)s;
+            if (pstr == null)
+                return null;
             int len;
             for (len = 0; pstr[len] != 0; len++) ;
             var bytes = new byte[len];

+ 1 - 1
tests/Avalonia.Controls.UnitTests/ItemsControlTests.cs

@@ -388,7 +388,7 @@ namespace Avalonia.Controls.UnitTests
             {
                 Template = GetTemplate(),
                 DataContext = "Base",
-                DataTemplates = new DataTemplates
+                DataTemplates =
                 {
                     new FuncDataTemplate<Item>(x => new Button { Content = x })
                 },

+ 4 - 4
tests/Avalonia.Controls.UnitTests/ListBoxTests.cs

@@ -109,10 +109,10 @@ namespace Avalonia.Controls.UnitTests
                 {
                     Template = ListBoxTemplate(),
                     DataContext = "Base",
-                    DataTemplates = new DataTemplates
-                {
-                    new FuncDataTemplate<Item>(x => new Button { Content = x })
-                },
+                    DataTemplates =
+                    {
+                        new FuncDataTemplate<Item>(x => new Button { Content = x })
+                    },
                     Items = items,
                 };
 

+ 1 - 1
tests/Avalonia.Controls.UnitTests/Presenters/ContentPresenterTests_Unrooted.cs

@@ -88,7 +88,7 @@ namespace Avalonia.Controls.UnitTests.Presenters
             root.Child = null;
             root = new TestRoot
             {
-                DataTemplates = new DataTemplates
+                DataTemplates =
                 {
                     new FuncDataTemplate<string>(x => new Decorator()),
                 },

+ 1 - 0
tests/Avalonia.Controls.UnitTests/Primitives/PopupTests.cs

@@ -265,6 +265,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
             };
 
             var globalStyles = new Mock<IGlobalStyles>();
+            globalStyles.Setup(x => x.IsStylesInitialized).Returns(true);
             globalStyles.Setup(x => x.Styles).Returns(styles);
 
             var renderInterface = new Mock<IPlatformRenderInterface>();

+ 4 - 4
tests/Avalonia.Controls.UnitTests/Primitives/TemplatedControlTests.cs

@@ -399,7 +399,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
                 TestTemplatedControl target;
                 var root = new TestRoot
                 {
-                    Styles = new Styles
+                    Styles =
                     {
                         new Style(x => x.OfType<TestTemplatedControl>())
                         {
@@ -435,7 +435,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
                 TestTemplatedControl target;
                 var root = new TestRoot
                 {
-                    Styles = new Styles
+                    Styles =
                     {
                         new Style(x => x.OfType<TestTemplatedControl>())
                         {
@@ -474,7 +474,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
 
                 var root = new TestRoot
                 {
-                    Styles = new Styles
+                    Styles =
                     {
                         new Style(x => x.OfType<TestTemplatedControl>())
                         {
@@ -494,7 +494,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
 
                 var root2 = new TestRoot
                 {
-                    Styles = new Styles
+                    Styles =
                     {
                         new Style(x => x.OfType<TestTemplatedControl>())
                         {

+ 2 - 2
tests/Avalonia.Controls.UnitTests/TabControlTests.cs

@@ -135,7 +135,7 @@ namespace Avalonia.Controls.UnitTests
             {
                 var root = new TestRoot
                 {
-                    Styles = new Styles
+                    Styles =
                     {
                         new Style(x => x.OfType<TabItem>())
                         {
@@ -174,7 +174,7 @@ namespace Avalonia.Controls.UnitTests
             {
                 Template = new FuncControlTemplate<TabControl>(CreateTabControlTemplate),
                 DataContext = "Base",
-                DataTemplates = new DataTemplates
+                DataTemplates =
                 {
                     new FuncDataTemplate<Item>(x => new Button { Content = x })
                 },

+ 14 - 14
tests/Avalonia.Controls.UnitTests/TreeViewTests.cs

@@ -25,9 +25,9 @@ namespace Avalonia.Controls.UnitTests
             {
                 Template = CreateTreeViewTemplate(),
                 Items = CreateTestTreeData(),
-                DataTemplates = CreateNodeDataTemplate(),
             };
 
+            CreateNodeDataTemplate(target);
             ApplyTemplates(target);
 
             Assert.Equal(new[] { "Root" }, ExtractItemHeader(target, 0));
@@ -69,9 +69,9 @@ namespace Avalonia.Controls.UnitTests
             {
                 Template = CreateTreeViewTemplate(),
                 Items = CreateTestTreeData(),
-                DataTemplates = CreateNodeDataTemplate(),
             };
 
+            CreateNodeDataTemplate(target);
             ApplyTemplates(target);
 
             var container = (TreeViewItem)target.ItemContainerGenerator.Containers.Single().ContainerControl;
@@ -87,7 +87,6 @@ namespace Avalonia.Controls.UnitTests
             {
                 Template = CreateTreeViewTemplate(),
                 Items = tree,
-                DataTemplates = CreateNodeDataTemplate(),
             };
 
             // For TreeViewItem to find its parent TreeView, OnAttachedToLogicalTree needs
@@ -95,6 +94,7 @@ namespace Avalonia.Controls.UnitTests
             var root = new TestRoot();
             root.Child = target;
 
+            CreateNodeDataTemplate(target);
             ApplyTemplates(target);
 
             var container = target.ItemContainerGenerator.Index.ContainerFromItem(
@@ -116,11 +116,12 @@ namespace Avalonia.Controls.UnitTests
             {
                 Template = CreateTreeViewTemplate(),
                 Items = tree,
-                DataTemplates = CreateNodeDataTemplate(),
             };
 
             var visualRoot = new TestRoot();
             visualRoot.Child = target;
+
+            CreateNodeDataTemplate(target);
             ApplyTemplates(target);
 
             var item = tree[0].Children[1].Children[0];
@@ -146,11 +147,12 @@ namespace Avalonia.Controls.UnitTests
             {
                 Template = CreateTreeViewTemplate(),
                 Items = tree,
-                DataTemplates = CreateNodeDataTemplate(),
             };
 
             var visualRoot = new TestRoot();
             visualRoot.Child = target;
+
+            CreateNodeDataTemplate(target);
             ApplyTemplates(target);
 
             var item = tree[0].Children[1].Children[0];
@@ -191,12 +193,13 @@ namespace Avalonia.Controls.UnitTests
             var target = new TreeView
             {
                 Template = CreateTreeViewTemplate(),
-                DataTemplates = CreateNodeDataTemplate(),
                 Items = tree,
             };
 
             var root = new TestRoot();
             root.Child = target;
+
+            CreateNodeDataTemplate(target);
             ApplyTemplates(target);
 
             Assert.Equal(5, target.ItemContainerGenerator.Index.Items.Count());
@@ -221,7 +224,7 @@ namespace Avalonia.Controls.UnitTests
             {
                 Template = CreateTreeViewTemplate(),
                 DataContext = "Base",
-                DataTemplates = new DataTemplates
+                DataTemplates =
                 {
                     new FuncDataTemplate<Node>(x => new Button { Content = x })
                 },
@@ -291,9 +294,9 @@ namespace Avalonia.Controls.UnitTests
             {
                 Template = CreateTreeViewTemplate(),
                 Items = data,
-                DataTemplates = CreateNodeDataTemplate(),
             };
 
+            CreateNodeDataTemplate(target);
             ApplyTemplates(target);
 
             Assert.Equal(new[] { "Root" }, ExtractItemHeader(target, 0));
@@ -328,7 +331,6 @@ namespace Avalonia.Controls.UnitTests
                 {
                     Template = CreateTreeViewTemplate(),
                     Items = data,
-                    DataTemplates = CreateNodeDataTemplate(),
                 };
 
                 var button = new Button();
@@ -341,6 +343,7 @@ namespace Avalonia.Controls.UnitTests
                     }
                 };
 
+                CreateNodeDataTemplate(target);
                 ApplyTemplates(target);
 
                 var item = data[0].Children[0];
@@ -411,12 +414,9 @@ namespace Avalonia.Controls.UnitTests
             };
         }
 
-        private DataTemplates CreateNodeDataTemplate()
+        private void CreateNodeDataTemplate(IControl control)
         {
-            return new DataTemplates
-            {
-                new TestTreeDataTemplate()
-            };
+            control.DataTemplates.Add(new TestTreeDataTemplate());
         }
 
         private IControlTemplate CreateTreeViewTemplate()

+ 1 - 1
tests/Avalonia.Controls.UnitTests/UserControlTests.cs

@@ -21,7 +21,7 @@ namespace Avalonia.Controls.UnitTests
                 var target = new UserControl();
                 var root = new TestRoot
                 {
-                    Styles = new Styles
+                    Styles =
                     {
                         new Style(x => x.OfType<ContentControl>())
                         {

+ 2 - 31
tests/Avalonia.Input.UnitTests/Avalonia.Input.UnitTests.csproj

@@ -3,35 +3,6 @@
     <TargetFrameworks>net461;netcoreapp1.1</TargetFrameworks>
     <OutputType>Library</OutputType>
   </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\Debug\</OutputPath>
-    <DefineConstants>DEBUG;TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <DocumentationFile>bin\Debug\Avalonia.Input.UnitTests.XML</DocumentationFile>
-    <NoWarn>CS1591</NoWarn>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <DebugType>pdbonly</DebugType>
-    <Optimize>true</Optimize>
-    <OutputPath>bin\Release\</OutputPath>
-    <DefineConstants>TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-  <ItemGroup>
-    <Reference Include="System" />
-    <Reference Include="System.Core" />
-    <Reference Include="System.Xml.Linq" />
-    <Reference Include="System.Data.DataSetExtensions" />
-    <Reference Include="Microsoft.CSharp" />
-    <Reference Include="System.Data" />
-    <Reference Include="System.Xml" />
-    <Reference Include="WindowsBase" />
-  </ItemGroup>
   <Import Project="..\..\build\UnitTests.NetCore.targets" />
   <Import Project="..\..\build\Moq.props" />
   <Import Project="..\..\build\XUnit.props" />
@@ -49,6 +20,6 @@
     <ProjectReference Include="..\Avalonia.UnitTests\Avalonia.UnitTests.csproj" />
   </ItemGroup>
   <ItemGroup>
-    <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+    <Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
   </ItemGroup>
-</Project>
+</Project>

+ 1 - 0
tests/Avalonia.Layout.UnitTests/FullLayoutTests.cs

@@ -197,6 +197,7 @@ namespace Avalonia.Layout.UnitTests
                 .Bind<IWindowingPlatform>().ToConstant(new Avalonia.Controls.UnitTests.WindowingPlatformMock(() => windowImpl.Object));
 
             var theme = new DefaultTheme();
+            globalStyles.Setup(x => x.IsStylesInitialized).Returns(true);
             globalStyles.Setup(x => x.Styles).Returns(theme);
         }
     }

+ 1 - 1
tests/Avalonia.LeakTests/ControlTests.cs

@@ -276,7 +276,7 @@ namespace Avalonia.LeakTests
                     {
                         Content = target = new TreeView
                         {
-                            DataTemplates = new DataTemplates
+                            DataTemplates =
                             {
                                 new FuncTreeDataTemplate<Node>(
                                     x => new TextBlock { Text = x.Name },