From 479c11710360a79fd52303cec93f1445e30169e9 Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Sun, 29 Oct 2017 18:08:40 +0300 Subject: [PATCH 01/49] Allow to pass CancellationToken to Application.Run --- src/Avalonia.Controls/Application.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Avalonia.Controls/Application.cs b/src/Avalonia.Controls/Application.cs index abae080515..06c1a8b4cc 100644 --- a/src/Avalonia.Controls/Application.cs +++ b/src/Avalonia.Controls/Application.cs @@ -175,6 +175,15 @@ namespace Avalonia closable.Closed += (s, e) => source.Cancel(); Dispatcher.UIThread.MainLoop(source.Token); } + + /// + /// Runs the application's main loop until the is cancelled. + /// + /// The token to track + public void Run(CancellationToken token) + { + Dispatcher.UIThread.MainLoop(token); + } /// /// Exits the application From 37c5414922ec93d77716764cef1a92a3d4934d91 Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Sun, 29 Oct 2017 18:09:03 +0300 Subject: [PATCH 02/49] Don't allow to call AppBuilder.Setup twice --- src/Avalonia.Controls/AppBuilderBase.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Avalonia.Controls/AppBuilderBase.cs b/src/Avalonia.Controls/AppBuilderBase.cs index 1610d33f9b..4167539455 100644 --- a/src/Avalonia.Controls/AppBuilderBase.cs +++ b/src/Avalonia.Controls/AppBuilderBase.cs @@ -14,6 +14,8 @@ namespace Avalonia.Controls /// The type of the AppBuilder class itself. public abstract class AppBuilderBase where TAppBuilder : AppBuilderBase, new() { + private static bool s_setupWasAlreadyCalled; + /// /// Gets or sets the instance. /// @@ -252,6 +254,9 @@ namespace Avalonia.Controls throw new InvalidOperationException("No rendering system configured."); } + if (s_setupWasAlreadyCalled) + throw new InvalidOperationException("Setup was already called on one of AppBuilder instances"); + Instance.RegisterServices(); RuntimePlatformServicesInitializer(); WindowingSubsystemInitializer(); From af1da0a9c9bdc89db52ea88eb59a47d7e6289aa9 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Thu, 2 Nov 2017 23:34:37 -0500 Subject: [PATCH 03/49] Add missing assignment. --- src/Avalonia.Controls/AppBuilderBase.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Avalonia.Controls/AppBuilderBase.cs b/src/Avalonia.Controls/AppBuilderBase.cs index 4167539455..ebbd682f28 100644 --- a/src/Avalonia.Controls/AppBuilderBase.cs +++ b/src/Avalonia.Controls/AppBuilderBase.cs @@ -255,7 +255,11 @@ namespace Avalonia.Controls } if (s_setupWasAlreadyCalled) + { throw new InvalidOperationException("Setup was already called on one of AppBuilder instances"); + } + + s_setupWasAlreadyCalled = true; Instance.RegisterServices(); RuntimePlatformServicesInitializer(); From 2e8521e690ee67cfd952244ea8c01bc2827cd243 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Mon, 20 Nov 2017 23:10:42 +0100 Subject: [PATCH 04/49] Added failing test for #1271. --- .../ContentControlTests.cs | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/tests/Avalonia.Controls.UnitTests/ContentControlTests.cs b/tests/Avalonia.Controls.UnitTests/ContentControlTests.cs index 5f86b9878d..653ab17b63 100644 --- a/tests/Avalonia.Controls.UnitTests/ContentControlTests.cs +++ b/tests/Avalonia.Controls.UnitTests/ContentControlTests.cs @@ -1,6 +1,7 @@ // 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 System.Collections.Specialized; using System.Linq; using Moq; @@ -11,6 +12,9 @@ using Avalonia.Styling; using Avalonia.UnitTests; using Avalonia.VisualTree; using Xunit; +using Avalonia.Markup.Xaml.Data; +using Avalonia.Data; +using System.Collections.Generic; namespace Avalonia.Controls.UnitTests { @@ -273,6 +277,60 @@ namespace Avalonia.Controls.UnitTests Assert.Null(target.Presenter.Child.DataContext); } + [Fact] + public void Binding_ContentTemplate_After_Content_Does_Not_Leave_Orpaned_TextBlock() + { + // Test for #1271. + var children = new List(); + var presenter = new ContentPresenter(); + + // The content and then the content template property need to be bound with delayed bindings + // as they are in Avalonia.Markup.Xaml. + DelayedBinding.Add(presenter, ContentPresenter.ContentProperty, new Binding("Content") + { + Priority = BindingPriority.TemplatedParent, + RelativeSource = new RelativeSource(RelativeSourceMode.TemplatedParent), + }); + + DelayedBinding.Add(presenter, ContentPresenter.ContentTemplateProperty, new Binding("ContentTemplate") + { + Priority = BindingPriority.TemplatedParent, + RelativeSource = new RelativeSource(RelativeSourceMode.TemplatedParent), + }); + + presenter.GetObservable(ContentPresenter.ChildProperty).Subscribe(children.Add); + + var target = new ContentControl + { + Template = new FuncControlTemplate(_ => presenter), + ContentTemplate = new FuncDataTemplate(x => new Canvas()), + Content = "foo", + }; + + // The control must be rooted. + var root = new TestRoot + { + Child = target, + }; + + target.ApplyTemplate(); + + // When the template is applied, the Content property is bound before the ContentTemplate + // property, causing a TextBlock to be created by the default template before ContentTemplate + // is bound. + Assert.Collection( + children, + x => Assert.Null(x), + x => Assert.IsType(x), + x => Assert.IsType(x)); + + var textBlock = (TextBlock)children[1]; + + // The leak in #1271 was caused by the TextBlock's logical parent not being cleared when + // it is replaced by the Canvas. + Assert.Null(textBlock.GetLogicalParent()); + } + private FuncControlTemplate GetTemplate() { return new FuncControlTemplate(parent => From 9b68067a15f3beff2edc9e4db06b9545cac6e0a1 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Mon, 20 Nov 2017 23:14:26 +0100 Subject: [PATCH 05/49] Fix ContentPresenter logical parent logic. `ContentPresenter` should only be manually setting its child's logical parent when it is outside of a control template. When it's inside a control template, setting the logical parent will be handled by `ContentControlMixin`. Fixes #1271. --- .../Presenters/ContentPresenter.cs | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/Avalonia.Controls/Presenters/ContentPresenter.cs b/src/Avalonia.Controls/Presenters/ContentPresenter.cs index c1adff402a..97760b5632 100644 --- a/src/Avalonia.Controls/Presenters/ContentPresenter.cs +++ b/src/Avalonia.Controls/Presenters/ContentPresenter.cs @@ -255,18 +255,9 @@ namespace Avalonia.Controls.Presenters LogicalChildren.Remove(oldChild); } - if (newChild.Parent == null) + if (newChild.Parent == null && TemplatedParent == null) { - var templatedLogicalParent = TemplatedParent as ILogical; - - if (templatedLogicalParent != null) - { - ((ISetLogicalParent)newChild).SetParent(templatedLogicalParent); - } - else - { - LogicalChildren.Add(newChild); - } + LogicalChildren.Add(newChild); } VisualChildren.Add(newChild); From 3dd11f9046f38a4b50757776de6366039fd2428a Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Mon, 20 Nov 2017 23:48:11 +0100 Subject: [PATCH 06/49] Make Content depend on ContentTemplate. Make the `ContentPresenter.Content` property depend on `ContentPresenter.ContentTemplate` because otherwise a temporary control will be created by the presenter using the default template between the time `Content` and `ContentTemplate` is bound. However, because Portable.Xaml doesn't actually _support_ `DependsOnAttribute` yet, also move the bindings for `ContentTemplate` above `Content` in the default themes. This works around #1271 although #1284 fixes the underlying cause of the leak - this is more to prevent unnecessary controls being created. --- src/Avalonia.Controls/ContentControl.cs | 1 + src/Avalonia.Controls/Presenters/ContentPresenter.cs | 2 ++ src/Avalonia.Themes.Default/Button.xaml | 2 +- src/Avalonia.Themes.Default/CalendarButton.xaml | 2 +- src/Avalonia.Themes.Default/CalendarDayButton.xaml | 2 +- src/Avalonia.Themes.Default/CheckBox.xaml | 2 +- src/Avalonia.Themes.Default/ContentControl.xaml | 2 +- src/Avalonia.Themes.Default/DropDownItem.xaml | 2 +- src/Avalonia.Themes.Default/EmbeddableControlRoot.xaml | 2 +- src/Avalonia.Themes.Default/Expander.xaml | 8 ++++---- src/Avalonia.Themes.Default/LayoutTransformControl.xaml | 2 +- src/Avalonia.Themes.Default/ListBoxItem.xaml | 2 +- src/Avalonia.Themes.Default/PopupRoot.xaml | 2 +- src/Avalonia.Themes.Default/RadioButton.xaml | 2 +- src/Avalonia.Themes.Default/RepeatButton.xaml | 2 +- src/Avalonia.Themes.Default/TabStripItem.xaml | 2 +- src/Avalonia.Themes.Default/ToggleButton.xaml | 2 +- src/Avalonia.Themes.Default/ToolTip.xaml | 2 +- src/Avalonia.Themes.Default/Window.xaml | 2 +- 19 files changed, 23 insertions(+), 20 deletions(-) diff --git a/src/Avalonia.Controls/ContentControl.cs b/src/Avalonia.Controls/ContentControl.cs index 0eba3c13ae..6da6da54a5 100644 --- a/src/Avalonia.Controls/ContentControl.cs +++ b/src/Avalonia.Controls/ContentControl.cs @@ -51,6 +51,7 @@ namespace Avalonia.Controls /// Gets or sets the content to display. /// [Content] + [DependsOn(nameof(ContentTemplate))] public object Content { get { return GetValue(ContentProperty); } diff --git a/src/Avalonia.Controls/Presenters/ContentPresenter.cs b/src/Avalonia.Controls/Presenters/ContentPresenter.cs index c1adff402a..52c0a25caa 100644 --- a/src/Avalonia.Controls/Presenters/ContentPresenter.cs +++ b/src/Avalonia.Controls/Presenters/ContentPresenter.cs @@ -8,6 +8,7 @@ using Avalonia.Controls.Templates; using Avalonia.Layout; using Avalonia.LogicalTree; using Avalonia.Media; +using Avalonia.Metadata; using Avalonia.VisualTree; namespace Avalonia.Controls.Presenters @@ -139,6 +140,7 @@ namespace Avalonia.Controls.Presenters /// /// Gets or sets the content to be displayed by the presenter. /// + [DependsOn(nameof(ContentTemplate))] public object Content { get { return GetValue(ContentProperty); } diff --git a/src/Avalonia.Themes.Default/Button.xaml b/src/Avalonia.Themes.Default/Button.xaml index 908f293fa7..94fcce5e0c 100644 --- a/src/Avalonia.Themes.Default/Button.xaml +++ b/src/Avalonia.Themes.Default/Button.xaml @@ -13,8 +13,8 @@ Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" - Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" + Content="{TemplateBinding Content}" Padding="{TemplateBinding Padding}" TextBlock.Foreground="{TemplateBinding Foreground}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" diff --git a/src/Avalonia.Themes.Default/CalendarButton.xaml b/src/Avalonia.Themes.Default/CalendarButton.xaml index 5f3cba5c7a..84969c135f 100644 --- a/src/Avalonia.Themes.Default/CalendarButton.xaml +++ b/src/Avalonia.Themes.Default/CalendarButton.xaml @@ -29,8 +29,8 @@ diff --git a/src/Avalonia.Themes.Default/ContentControl.xaml b/src/Avalonia.Themes.Default/ContentControl.xaml index 27f6648548..7584ae0dfe 100644 --- a/src/Avalonia.Themes.Default/ContentControl.xaml +++ b/src/Avalonia.Themes.Default/ContentControl.xaml @@ -5,8 +5,8 @@ Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" - Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" + Content="{TemplateBinding Content}" Padding="{TemplateBinding Padding}"/> diff --git a/src/Avalonia.Themes.Default/DropDownItem.xaml b/src/Avalonia.Themes.Default/DropDownItem.xaml index 48d791f629..257030d8af 100644 --- a/src/Avalonia.Themes.Default/DropDownItem.xaml +++ b/src/Avalonia.Themes.Default/DropDownItem.xaml @@ -10,8 +10,8 @@ Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" - Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" + Content="{TemplateBinding Content}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" Padding="{TemplateBinding Padding}"/> diff --git a/src/Avalonia.Themes.Default/EmbeddableControlRoot.xaml b/src/Avalonia.Themes.Default/EmbeddableControlRoot.xaml index f39720bb65..de364c0108 100644 --- a/src/Avalonia.Themes.Default/EmbeddableControlRoot.xaml +++ b/src/Avalonia.Themes.Default/EmbeddableControlRoot.xaml @@ -7,8 +7,8 @@ diff --git a/src/Avalonia.Themes.Default/Expander.xaml b/src/Avalonia.Themes.Default/Expander.xaml index 51efec6b95..5e05dcf608 100644 --- a/src/Avalonia.Themes.Default/Expander.xaml +++ b/src/Avalonia.Themes.Default/Expander.xaml @@ -16,8 +16,8 @@ @@ -34,8 +34,8 @@ @@ -52,8 +52,8 @@ @@ -70,8 +70,8 @@ diff --git a/src/Avalonia.Themes.Default/LayoutTransformControl.xaml b/src/Avalonia.Themes.Default/LayoutTransformControl.xaml index c9df62625f..b26f053622 100644 --- a/src/Avalonia.Themes.Default/LayoutTransformControl.xaml +++ b/src/Avalonia.Themes.Default/LayoutTransformControl.xaml @@ -5,8 +5,8 @@ Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" - Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" + Content="{TemplateBinding Content}" Padding="{TemplateBinding Padding}"/> diff --git a/src/Avalonia.Themes.Default/ListBoxItem.xaml b/src/Avalonia.Themes.Default/ListBoxItem.xaml index 64fc62ba73..a0405f2875 100644 --- a/src/Avalonia.Themes.Default/ListBoxItem.xaml +++ b/src/Avalonia.Themes.Default/ListBoxItem.xaml @@ -7,8 +7,8 @@ Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" - Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" + Content="{TemplateBinding Content}" Padding="{TemplateBinding Padding}"/> diff --git a/src/Avalonia.Themes.Default/PopupRoot.xaml b/src/Avalonia.Themes.Default/PopupRoot.xaml index 47e519bf90..cc23367ac0 100644 --- a/src/Avalonia.Themes.Default/PopupRoot.xaml +++ b/src/Avalonia.Themes.Default/PopupRoot.xaml @@ -4,8 +4,8 @@ diff --git a/src/Avalonia.Themes.Default/RadioButton.xaml b/src/Avalonia.Themes.Default/RadioButton.xaml index 0a0eb48564..fb71432595 100644 --- a/src/Avalonia.Themes.Default/RadioButton.xaml +++ b/src/Avalonia.Themes.Default/RadioButton.xaml @@ -29,8 +29,8 @@ HorizontalAlignment="Center" VerticalAlignment="Center"/> diff --git a/src/Avalonia.Themes.Default/RepeatButton.xaml b/src/Avalonia.Themes.Default/RepeatButton.xaml index 1caaa266de..872f390ac5 100644 --- a/src/Avalonia.Themes.Default/RepeatButton.xaml +++ b/src/Avalonia.Themes.Default/RepeatButton.xaml @@ -20,8 +20,8 @@ Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" - Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" + Content="{TemplateBinding Content}" Padding="{TemplateBinding Padding}" TextBlock.Foreground="{TemplateBinding Foreground}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" diff --git a/src/Avalonia.Themes.Default/TabStripItem.xaml b/src/Avalonia.Themes.Default/TabStripItem.xaml index 7f7fef0a1a..408cfaa3d7 100644 --- a/src/Avalonia.Themes.Default/TabStripItem.xaml +++ b/src/Avalonia.Themes.Default/TabStripItem.xaml @@ -9,8 +9,8 @@ Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" - Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" + Content="{TemplateBinding Content}" Padding="{TemplateBinding Padding}"/> diff --git a/src/Avalonia.Themes.Default/ToggleButton.xaml b/src/Avalonia.Themes.Default/ToggleButton.xaml index 12d7daacda..dadc45d854 100644 --- a/src/Avalonia.Themes.Default/ToggleButton.xaml +++ b/src/Avalonia.Themes.Default/ToggleButton.xaml @@ -13,8 +13,8 @@ Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" - Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" + Content="{TemplateBinding Content}" Padding="{TemplateBinding Padding}" TextBlock.Foreground="{TemplateBinding Foreground}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" diff --git a/src/Avalonia.Themes.Default/ToolTip.xaml b/src/Avalonia.Themes.Default/ToolTip.xaml index f3e819c101..1fc0202dd3 100644 --- a/src/Avalonia.Themes.Default/ToolTip.xaml +++ b/src/Avalonia.Themes.Default/ToolTip.xaml @@ -9,8 +9,8 @@ Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" - Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" + Content="{TemplateBinding Content}" Padding="{TemplateBinding Padding}"/> diff --git a/src/Avalonia.Themes.Default/Window.xaml b/src/Avalonia.Themes.Default/Window.xaml index 06922addad..d19bf41c4d 100644 --- a/src/Avalonia.Themes.Default/Window.xaml +++ b/src/Avalonia.Themes.Default/Window.xaml @@ -7,8 +7,8 @@ From 3eac2134e02e5c27171f21d8ac64f93e727b7459 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Tue, 21 Nov 2017 23:25:21 +0100 Subject: [PATCH 07/49] Trying previous appveyor image. --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 76d1ae3e1c..ba3680d0b9 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -os: Visual Studio 2017 +os: Previous Visual Studio 2017 platform: - Any CPU skip_branch_with_pr: true From 546cbca0eff72adbfb15e962fc5ef2c8ef0258eb Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Fri, 1 Dec 2017 12:39:55 +0100 Subject: [PATCH 08/49] Added failing test for #1247. --- .../Primitives/PopupRootTests.cs | 51 ++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/tests/Avalonia.Controls.UnitTests/Primitives/PopupRootTests.cs b/tests/Avalonia.Controls.UnitTests/Primitives/PopupRootTests.cs index 64344a1584..b3f91ce937 100644 --- a/tests/Avalonia.Controls.UnitTests/Primitives/PopupRootTests.cs +++ b/tests/Avalonia.Controls.UnitTests/Primitives/PopupRootTests.cs @@ -2,11 +2,13 @@ // Licensed under the MIT license. See licence.md file in the project root for full license information. using System; +using System.Linq; using Avalonia.Controls.Presenters; using Avalonia.Controls.Primitives; using Avalonia.Controls.Templates; using Avalonia.LogicalTree; using Avalonia.UnitTests; +using Avalonia.VisualTree; using Xunit; namespace Avalonia.Controls.UnitTests.Primitives @@ -90,14 +92,33 @@ namespace Avalonia.Controls.UnitTests.Primitives } } + [Fact] + public void Clearing_Content_Of_Popup_In_ControlTemplate_Doesnt_Crash() + { + using (UnitTestApplication.Start(TestServices.StyledWindow)) + { + var target = new TemplatedControlWithPopup + { + PopupContent = new Canvas(), + }; + + var root = new TestRoot { Child = target }; + + target.ApplyTemplate(); + target.Popup.Open(); + target.PopupContent = null; + } + } + private PopupRoot CreateTarget() { var result = new PopupRoot { - Template = new FuncControlTemplate(_ => + Template = new FuncControlTemplate(parent => new ContentPresenter { Name = "PART_ContentPresenter", + [!ContentPresenter.ContentProperty] = parent[!PopupRoot.ContentProperty], }), }; @@ -105,5 +126,33 @@ namespace Avalonia.Controls.UnitTests.Primitives return result; } + + private class TemplatedControlWithPopup : TemplatedControl + { + public static readonly AvaloniaProperty PopupContentProperty = + AvaloniaProperty.Register(nameof(PopupContent)); + + public TemplatedControlWithPopup() + { + Template = new FuncControlTemplate(parent => + new Popup + { + [!Popup.ChildProperty] = parent[!TemplatedControlWithPopup.PopupContentProperty], + }); + } + + public Popup Popup { get; private set; } + + public Control PopupContent + { + get => GetValue(PopupContentProperty); + set => SetValue(PopupContentProperty, value); + } + + protected override void OnTemplateApplied(TemplateAppliedEventArgs e) + { + Popup = (Popup)this.GetVisualChildren().Single(); + } + } } } From d1ebb8fc7d4360b1f10dcadeba2039e07dc22442 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Fri, 1 Dec 2017 12:43:00 +0100 Subject: [PATCH 09/49] Handle PopupRoot.Content = null. Handle `PopupRoot.Content` being set to null. Fixes #1247 --- src/Avalonia.Controls/Primitives/PopupRoot.cs | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/Avalonia.Controls/Primitives/PopupRoot.cs b/src/Avalonia.Controls/Primitives/PopupRoot.cs index a999e4ae37..00d43500c3 100644 --- a/src/Avalonia.Controls/Primitives/PopupRoot.cs +++ b/src/Avalonia.Controls/Primitives/PopupRoot.cs @@ -90,20 +90,23 @@ namespace Avalonia.Controls.Primitives private void SetTemplatedParentAndApplyChildTemplates(IControl control) { - var templatedParent = Parent.TemplatedParent; - - if (control.TemplatedParent == null) + if (control != null) { - control.SetValue(TemplatedParentProperty, templatedParent); - } + var templatedParent = Parent.TemplatedParent; + + if (control.TemplatedParent == null) + { + control.SetValue(TemplatedParentProperty, templatedParent); + } - control.ApplyTemplate(); + control.ApplyTemplate(); - if (!(control is IPresenter) && control.TemplatedParent == templatedParent) - { - foreach (IControl child in control.GetVisualChildren()) + if (!(control is IPresenter) && control.TemplatedParent == templatedParent) { - SetTemplatedParentAndApplyChildTemplates(child); + foreach (IControl child in control.GetVisualChildren()) + { + SetTemplatedParentAndApplyChildTemplates(child); + } } } } From 26b2771864834a9db1bc00852850d145999ca742 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Fri, 1 Dec 2017 18:58:20 +0100 Subject: [PATCH 10/49] Added failing test for #1297 --- .../Primitives/TrackTests.cs | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/Avalonia.Controls.UnitTests/Primitives/TrackTests.cs b/tests/Avalonia.Controls.UnitTests/Primitives/TrackTests.cs index f07a5f5095..5396a43f3a 100644 --- a/tests/Avalonia.Controls.UnitTests/Primitives/TrackTests.cs +++ b/tests/Avalonia.Controls.UnitTests/Primitives/TrackTests.cs @@ -140,5 +140,31 @@ namespace Avalonia.Controls.UnitTests.Primitives Assert.Same(thumb.Parent, target); Assert.Equal(new[] { thumb }, ((ILogical)target).LogicalChildren); } + + [Fact] + public void Should_Not_Pass_Invalid_Arrange_Rect() + { + var thumb = new Thumb { Width = 100.873106060606 }; + var increaseButton = new Button { Width = 10 }; + var decreaseButton = new Button { Width = 10 }; + + var target = new Track + { + Height = 12, + Thumb = thumb, + IncreaseButton = increaseButton, + DecreaseButton = decreaseButton, + Orientation = Orientation.Horizontal, + Minimum = 0, + Maximum = 287, + Value = 287, + ViewportSize = 241, + }; + + target.Measure(Size.Infinity); + + // #1297 was occuring here. + target.Arrange(new Rect(0, 0, 221, 12)); + } } } From 91edffd8d20ce93239c33f592793d17643593ba1 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Fri, 1 Dec 2017 18:59:12 +0100 Subject: [PATCH 11/49] Fixed #1297 Handle rounding errors when calculating increase button arrange rect. --- src/Avalonia.Controls/Primitives/Track.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Avalonia.Controls/Primitives/Track.cs b/src/Avalonia.Controls/Primitives/Track.cs index 8c577665d5..3a16e51851 100644 --- a/src/Avalonia.Controls/Primitives/Track.cs +++ b/src/Avalonia.Controls/Primitives/Track.cs @@ -154,7 +154,11 @@ namespace Avalonia.Controls.Primitives if (increaseButton != null) { - increaseButton.Arrange(new Rect(firstWidth + thumbWidth, 0, remaining - firstWidth, finalSize.Height)); + increaseButton.Arrange(new Rect( + firstWidth + thumbWidth, + 0, + Math.Max(0, remaining - firstWidth), + Math.Max(0, finalSize.Height))); } } else From 7405cd79520a4bd19877b8f3f3f033fb49c98e00 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Sat, 9 Dec 2017 12:34:14 +0100 Subject: [PATCH 12/49] Match formatting of other block. --- src/Avalonia.Controls/Primitives/Track.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Avalonia.Controls/Primitives/Track.cs b/src/Avalonia.Controls/Primitives/Track.cs index 3a16e51851..3f50e11a48 100644 --- a/src/Avalonia.Controls/Primitives/Track.cs +++ b/src/Avalonia.Controls/Primitives/Track.cs @@ -189,7 +189,11 @@ namespace Avalonia.Controls.Primitives if (increaseButton != null) { - increaseButton.Arrange(new Rect(0, firstHeight + thumbHeight, finalSize.Width, Math.Max(remaining - firstHeight, 0))); + increaseButton.Arrange(new Rect( + 0, + firstHeight + thumbHeight, + finalSize.Width, + Math.Max(remaining - firstHeight, 0))); } } From e49e682f9ced0e0b0887350fefbf73d509cde811 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Sun, 10 Dec 2017 20:09:20 +0100 Subject: [PATCH 13/49] This Max shouldn't be needed. --- src/Avalonia.Controls/Primitives/Track.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Avalonia.Controls/Primitives/Track.cs b/src/Avalonia.Controls/Primitives/Track.cs index 3f50e11a48..648fe5f4b0 100644 --- a/src/Avalonia.Controls/Primitives/Track.cs +++ b/src/Avalonia.Controls/Primitives/Track.cs @@ -158,7 +158,7 @@ namespace Avalonia.Controls.Primitives firstWidth + thumbWidth, 0, Math.Max(0, remaining - firstWidth), - Math.Max(0, finalSize.Height))); + finalSize.Height)); } } else From d01e19e3f43e71c21e02642bc551e7a562d20b7b Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Tue, 12 Dec 2017 22:05:36 +0100 Subject: [PATCH 14/49] Added failing test for #1275. --- .../Xaml/BasicTests.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/BasicTests.cs b/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/BasicTests.cs index ffd666fe12..fb432c30d4 100644 --- a/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/BasicTests.cs +++ b/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/BasicTests.cs @@ -868,6 +868,25 @@ do we need it?")] } } + [Fact] + public void Element_Whitespace_Should_Be_Trimmed() + { + using (UnitTestApplication.Start(TestServices.MockWindowingPlatform)) + { + var xaml = @" + + + Hello World! + +"; + + var window = AvaloniaXamlLoader.Parse(xaml); + var textBlock = (TextBlock)window.Content; + + Assert.Equal("Hello World!", textBlock.Text); + } + } + private class SelectedItemsViewModel : INotifyPropertyChanged { public string[] Items { get; set; } From 05da271376bbe8b0c0a3a5f6e8ad8cf6895914b0 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Tue, 12 Dec 2017 22:21:39 +0100 Subject: [PATCH 15/49] Updated Portable.Xaml Merged `fixes/76-trim-whitespace` into `avalonia` branch (https://github.com/cwensley/Portable.Xaml/pull/77). Fixes whitespace trimming in Xaml reader. Fixes #1275 --- .../Avalonia.Markup.Xaml/PortableXaml/portable.xaml.github | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Markup/Avalonia.Markup.Xaml/PortableXaml/portable.xaml.github b/src/Markup/Avalonia.Markup.Xaml/PortableXaml/portable.xaml.github index d50ae8335e..c066401445 160000 --- a/src/Markup/Avalonia.Markup.Xaml/PortableXaml/portable.xaml.github +++ b/src/Markup/Avalonia.Markup.Xaml/PortableXaml/portable.xaml.github @@ -1 +1 @@ -Subproject commit d50ae8335eb50d4b9606de6f5fa1cbbc78bfd72f +Subproject commit c0664014455392ac221a765e66f9837704339b6f From ea65626a462f1312f4fe30aa54b0a46cda859c85 Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 13 Dec 2017 13:26:25 +0000 Subject: [PATCH 16/49] use lower case extensions for avalonia documentation files. --- src/Avalonia.Animation/Avalonia.Animation.csproj | 4 ++-- src/Avalonia.Base/Avalonia.Base.csproj | 4 ++-- src/Avalonia.Controls/Avalonia.Controls.csproj | 4 ++-- src/Avalonia.Diagnostics/Avalonia.Diagnostics.csproj | 4 ++-- .../Avalonia.DotNetCoreRuntime.csproj | 2 +- src/Avalonia.Input/Avalonia.Input.csproj | 4 ++-- src/Avalonia.Interactivity/Avalonia.Interactivity.csproj | 4 ++-- src/Avalonia.Layout/Avalonia.Layout.csproj | 4 ++-- src/Avalonia.Logging.Serilog/Avalonia.Logging.Serilog.csproj | 4 ++-- src/Avalonia.Styling/Avalonia.Styling.csproj | 4 ++-- src/Avalonia.Themes.Default/Avalonia.Themes.Default.csproj | 4 ++-- src/Markup/Avalonia.Markup.Xaml/Avalonia.Markup.Xaml.csproj | 2 +- src/Markup/Avalonia.Markup/Avalonia.Markup.csproj | 4 ++-- src/Windows/Avalonia.Win32/Avalonia.Win32.csproj | 4 ++-- 14 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/Avalonia.Animation/Avalonia.Animation.csproj b/src/Avalonia.Animation/Avalonia.Animation.csproj index bafac2b261..2101c5669d 100644 --- a/src/Avalonia.Animation/Avalonia.Animation.csproj +++ b/src/Avalonia.Animation/Avalonia.Animation.csproj @@ -11,7 +11,7 @@ DEBUG;TRACE prompt 4 - bin\Debug\Avalonia.Animation.XML + bin\Debug\Avalonia.Animation.xml false @@ -21,7 +21,7 @@ TRACE prompt 4 - bin\Release\Avalonia.Animation.XML + bin\Release\Avalonia.Animation.xml CS1591 true diff --git a/src/Avalonia.Base/Avalonia.Base.csproj b/src/Avalonia.Base/Avalonia.Base.csproj index 58c510f483..54537841a9 100644 --- a/src/Avalonia.Base/Avalonia.Base.csproj +++ b/src/Avalonia.Base/Avalonia.Base.csproj @@ -12,7 +12,7 @@ DEBUG;TRACE prompt 4 - bin\Debug\Avalonia.Base.XML + bin\Debug\Avalonia.Base.xml CS1591 @@ -22,7 +22,7 @@ TRACE prompt 4 - bin\Release\Avalonia.Base.XML + bin\Release\Avalonia.Base.xml CS1591 true diff --git a/src/Avalonia.Controls/Avalonia.Controls.csproj b/src/Avalonia.Controls/Avalonia.Controls.csproj index c8f6b4e65a..997e15050f 100644 --- a/src/Avalonia.Controls/Avalonia.Controls.csproj +++ b/src/Avalonia.Controls/Avalonia.Controls.csproj @@ -11,7 +11,7 @@ DEBUG;TRACE prompt 4 - bin\Debug\Avalonia.Controls.XML + bin\Debug\Avalonia.Controls.xml CS1591;CS0067 @@ -21,7 +21,7 @@ TRACE prompt 4 - bin\Release\Avalonia.Controls.XML + bin\Release\Avalonia.Controls.xml CS1591 true diff --git a/src/Avalonia.Diagnostics/Avalonia.Diagnostics.csproj b/src/Avalonia.Diagnostics/Avalonia.Diagnostics.csproj index abbdd15bed..5f8e25269b 100644 --- a/src/Avalonia.Diagnostics/Avalonia.Diagnostics.csproj +++ b/src/Avalonia.Diagnostics/Avalonia.Diagnostics.csproj @@ -11,7 +11,7 @@ TRACE;DEBUG prompt 4 - bin\Debug\Avalonia.Diagnostics.XML + bin\Debug\Avalonia.Diagnostics.xml CS1591 @@ -21,7 +21,7 @@ TRACE prompt 4 - bin\Release\Avalonia.Diagnostics.XML + bin\Release\Avalonia.Diagnostics.xml CS1591 true diff --git a/src/Avalonia.DotNetCoreRuntime/Avalonia.DotNetCoreRuntime.csproj b/src/Avalonia.DotNetCoreRuntime/Avalonia.DotNetCoreRuntime.csproj index 53b2c997d0..8630e7b228 100644 --- a/src/Avalonia.DotNetCoreRuntime/Avalonia.DotNetCoreRuntime.csproj +++ b/src/Avalonia.DotNetCoreRuntime/Avalonia.DotNetCoreRuntime.csproj @@ -5,7 +5,7 @@ $(DefineConstants);DOTNETCORE - bin\$(Configuration)\Avalonia.DotNetCoreRuntime.XML + bin\$(Configuration)\Avalonia.DotNetCoreRuntime.xml diff --git a/src/Avalonia.Input/Avalonia.Input.csproj b/src/Avalonia.Input/Avalonia.Input.csproj index 901f7b5675..c82601ac2c 100644 --- a/src/Avalonia.Input/Avalonia.Input.csproj +++ b/src/Avalonia.Input/Avalonia.Input.csproj @@ -11,7 +11,7 @@ DEBUG;TRACE prompt 4 - bin\Debug\Avalonia.Input.XML + bin\Debug\Avalonia.Input.xml CS1591 @@ -21,7 +21,7 @@ TRACE prompt 4 - bin\Release\Avalonia.Input.XML + bin\Release\Avalonia.Input.xml CS1591 true diff --git a/src/Avalonia.Interactivity/Avalonia.Interactivity.csproj b/src/Avalonia.Interactivity/Avalonia.Interactivity.csproj index d683c77468..4f6f9ad6fe 100644 --- a/src/Avalonia.Interactivity/Avalonia.Interactivity.csproj +++ b/src/Avalonia.Interactivity/Avalonia.Interactivity.csproj @@ -11,7 +11,7 @@ DEBUG;TRACE prompt 4 - bin\Debug\Avalonia.Interactivity.XML + bin\Debug\Avalonia.Interactivity.xml CS1591 @@ -21,7 +21,7 @@ TRACE prompt 4 - bin\Release\Avalonia.Interactivity.XML + bin\Release\Avalonia.Interactivity.xml CS1591 true diff --git a/src/Avalonia.Layout/Avalonia.Layout.csproj b/src/Avalonia.Layout/Avalonia.Layout.csproj index 810a985e36..58c18921f5 100644 --- a/src/Avalonia.Layout/Avalonia.Layout.csproj +++ b/src/Avalonia.Layout/Avalonia.Layout.csproj @@ -11,7 +11,7 @@ DEBUG;TRACE prompt 4 - bin\Debug\Avalonia.Layout.XML + bin\Debug\Avalonia.Layout.xml CS1591 @@ -21,7 +21,7 @@ TRACE prompt 4 - bin\Release\Avalonia.Layout.XML + bin\Release\Avalonia.Layout.xml CS1591 true diff --git a/src/Avalonia.Logging.Serilog/Avalonia.Logging.Serilog.csproj b/src/Avalonia.Logging.Serilog/Avalonia.Logging.Serilog.csproj index 5aa2cd67ba..4d9d141d0d 100644 --- a/src/Avalonia.Logging.Serilog/Avalonia.Logging.Serilog.csproj +++ b/src/Avalonia.Logging.Serilog/Avalonia.Logging.Serilog.csproj @@ -11,7 +11,7 @@ DEBUG;TRACE prompt 4 - bin\Debug\Avalonia.Logging.Serilog.XML + bin\Debug\Avalonia.Logging.Serilog.xml pdbonly @@ -20,7 +20,7 @@ TRACE prompt 4 - bin\Release\Avalonia.Logging.Serilog.XML + bin\Release\Avalonia.Logging.Serilog.xml true diff --git a/src/Avalonia.Styling/Avalonia.Styling.csproj b/src/Avalonia.Styling/Avalonia.Styling.csproj index 6c0b957bf4..b8083b52db 100644 --- a/src/Avalonia.Styling/Avalonia.Styling.csproj +++ b/src/Avalonia.Styling/Avalonia.Styling.csproj @@ -12,7 +12,7 @@ DEBUG;TRACE prompt 4 - bin\Debug\Avalonia.Styling.XML + bin\Debug\Avalonia.Styling.xml CS1591 @@ -22,7 +22,7 @@ TRACE prompt 4 - bin\Release\Avalonia.Styling.XML + bin\Release\Avalonia.Styling.xml CS1591 true diff --git a/src/Avalonia.Themes.Default/Avalonia.Themes.Default.csproj b/src/Avalonia.Themes.Default/Avalonia.Themes.Default.csproj index b4b200834b..d8260226e9 100644 --- a/src/Avalonia.Themes.Default/Avalonia.Themes.Default.csproj +++ b/src/Avalonia.Themes.Default/Avalonia.Themes.Default.csproj @@ -11,7 +11,7 @@ DEBUG;TRACE prompt 4 - bin\Debug\Avalonia.Themes.Default.XML + bin\Debug\Avalonia.Themes.Default.xml pdbonly @@ -20,7 +20,7 @@ TRACE prompt 4 - bin\Release\Avalonia.Themes.Default.XML + bin\Release\Avalonia.Themes.Default.xml true diff --git a/src/Markup/Avalonia.Markup.Xaml/Avalonia.Markup.Xaml.csproj b/src/Markup/Avalonia.Markup.Xaml/Avalonia.Markup.Xaml.csproj index a1db5c2915..cf6afbe620 100644 --- a/src/Markup/Avalonia.Markup.Xaml/Avalonia.Markup.Xaml.csproj +++ b/src/Markup/Avalonia.Markup.Xaml/Avalonia.Markup.Xaml.csproj @@ -22,7 +22,7 @@ NETSTANDARD1_3;PCL;NETSTANDARD prompt 4 - bin\Release\Avalonia.Markup.Xaml.XML + bin\Release\Avalonia.Markup.Xaml.xml CS1591 diff --git a/src/Markup/Avalonia.Markup/Avalonia.Markup.csproj b/src/Markup/Avalonia.Markup/Avalonia.Markup.csproj index 57552f852c..a6d3c3336f 100644 --- a/src/Markup/Avalonia.Markup/Avalonia.Markup.csproj +++ b/src/Markup/Avalonia.Markup/Avalonia.Markup.csproj @@ -11,7 +11,7 @@ DEBUG;TRACE prompt 4 - bin\Debug\Avalonia.Markup.XML + bin\Debug\Avalonia.Markup.xml CS1591 @@ -21,7 +21,7 @@ TRACE prompt 4 - bin\Release\Avalonia.Markup.XML + bin\Release\Avalonia.Markup.xml CS1591 true diff --git a/src/Windows/Avalonia.Win32/Avalonia.Win32.csproj b/src/Windows/Avalonia.Win32/Avalonia.Win32.csproj index b2b42877b7..92d973238e 100644 --- a/src/Windows/Avalonia.Win32/Avalonia.Win32.csproj +++ b/src/Windows/Avalonia.Win32/Avalonia.Win32.csproj @@ -22,7 +22,7 @@ DEBUG;TRACE prompt 4 - bin\Debug\Avalonia.Win32.XML + bin\Debug\Avalonia.Win32.xml true CS1591 @@ -33,7 +33,7 @@ TRACE prompt 4 - bin\Release\Avalonia.Win32.XML + bin\Release\Avalonia.Win32.xml true CS1591 true From bdaf4a2046b776c16135b5ef47864b25d2005e83 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Wed, 13 Dec 2017 15:41:27 -0600 Subject: [PATCH 17/49] Fix #1182. --- src/Avalonia.Controls/Control.cs | 14 ++++++++----- src/Avalonia.Controls/Primitives/PopupRoot.cs | 8 +++++++- .../ControlTests_Resources.cs | 16 +++++++++++++++ .../Primitives/PopupRootTests.cs | 20 +++++++++++++++++++ 4 files changed, 52 insertions(+), 6 deletions(-) diff --git a/src/Avalonia.Controls/Control.cs b/src/Avalonia.Controls/Control.cs index 6e1e1a05f1..89721e2e05 100644 --- a/src/Avalonia.Controls/Control.cs +++ b/src/Avalonia.Controls/Control.cs @@ -487,11 +487,6 @@ namespace Avalonia.Controls void ILogical.NotifyResourcesChanged(ResourcesChangedEventArgs e) { ResourcesChanged?.Invoke(this, new ResourcesChangedEventArgs()); - - foreach (var child in LogicalChildren) - { - child.NotifyResourcesChanged(e); - } } /// @@ -536,6 +531,15 @@ namespace Avalonia.Controls } _parent = (IControl)parent; + + if (old != null) + { + old.ResourcesChanged -= ThisResourcesChanged; + } + if (_parent != null) + { + _parent.ResourcesChanged += ThisResourcesChanged; + } ((ILogical)this).NotifyResourcesChanged(new ResourcesChangedEventArgs()); if (_parent is IStyleRoot || _parent?.IsAttachedToLogicalTree == true || this is IStyleRoot) diff --git a/src/Avalonia.Controls/Primitives/PopupRoot.cs b/src/Avalonia.Controls/Primitives/PopupRoot.cs index 00d43500c3..b0b0659f63 100644 --- a/src/Avalonia.Controls/Primitives/PopupRoot.cs +++ b/src/Avalonia.Controls/Primitives/PopupRoot.cs @@ -8,6 +8,7 @@ using Avalonia.Interactivity; using Avalonia.Layout; using Avalonia.Media; using Avalonia.Platform; +using Avalonia.Styling; using Avalonia.VisualTree; using JetBrains.Annotations; @@ -16,7 +17,7 @@ namespace Avalonia.Controls.Primitives /// /// The root window of a . /// - public class PopupRoot : WindowBase, IInteractive, IHostedVisualTreeRoot, IDisposable + public class PopupRoot : WindowBase, IInteractive, IHostedVisualTreeRoot, IDisposable, IResourceNode { private IDisposable _presenterSubscription; @@ -66,6 +67,11 @@ namespace Avalonia.Controls.Primitives /// IVisual IHostedVisualTreeRoot.Host => Parent; + /// + /// Gets the styling parent of the popup root. + /// + IResourceNode IResourceNode.ResourceParent => Parent; + /// public void Dispose() => PlatformImpl?.Dispose(); diff --git a/tests/Avalonia.Controls.UnitTests/ControlTests_Resources.cs b/tests/Avalonia.Controls.UnitTests/ControlTests_Resources.cs index 6a6cb48001..6acd224fe2 100644 --- a/tests/Avalonia.Controls.UnitTests/ControlTests_Resources.cs +++ b/tests/Avalonia.Controls.UnitTests/ControlTests_Resources.cs @@ -204,6 +204,22 @@ namespace Avalonia.Controls.UnitTests Assert.True(raised); } + [Fact] + public void Setting_Logical_Parent_Subscribes_To_Parents_ResourceChanged_Event() + { + var parent = new ContentControl(); + var child = new Border(); + + ((ISetLogicalParent)child).SetParent(parent); + var raisedOnChild = false; + + child.ResourcesChanged += (_, __) => raisedOnChild = true; + + parent.Resources.Add("foo", "bar"); + + Assert.True(raisedOnChild); + } + private IControlTemplate ContentControlTemplate() { return new FuncControlTemplate(x => diff --git a/tests/Avalonia.Controls.UnitTests/Primitives/PopupRootTests.cs b/tests/Avalonia.Controls.UnitTests/Primitives/PopupRootTests.cs index b3f91ce937..68a1f1d90f 100644 --- a/tests/Avalonia.Controls.UnitTests/Primitives/PopupRootTests.cs +++ b/tests/Avalonia.Controls.UnitTests/Primitives/PopupRootTests.cs @@ -7,6 +7,7 @@ using Avalonia.Controls.Presenters; using Avalonia.Controls.Primitives; using Avalonia.Controls.Templates; using Avalonia.LogicalTree; +using Avalonia.Styling; using Avalonia.UnitTests; using Avalonia.VisualTree; using Xunit; @@ -37,6 +38,25 @@ namespace Avalonia.Controls.UnitTests.Primitives } } + [Fact] + public void PopupRoot_ResourceParent_Is_Popup() + { + using (UnitTestApplication.Start(TestServices.StyledWindow)) + { + var target = new TemplatedControlWithPopup + { + PopupContent = new Canvas(), + }; + + var root = new TestRoot { Child = target }; + + target.ApplyTemplate(); + target.Popup.Open(); + + Assert.Equal(target.Popup, ((IResourceNode)target.Popup.PopupRoot).ResourceParent); + } + } + [Fact] public void Attaching_PopupRoot_To_Parent_Logical_Tree_Raises_DetachedFromLogicalTree_And_AttachedToLogicalTree() { From 8bcd07730a4fe557e9c308937a732a21c5042660 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Thu, 14 Dec 2017 22:06:56 -0600 Subject: [PATCH 18/49] Change StylingParent for Popup to be PopupRoot so local styles flow to it. --- src/Avalonia.Controls/Primitives/PopupRoot.cs | 4 ++-- tests/Avalonia.Controls.UnitTests/ControlTests_Resources.cs | 2 +- .../Avalonia.Controls.UnitTests/Primitives/PopupRootTests.cs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Avalonia.Controls/Primitives/PopupRoot.cs b/src/Avalonia.Controls/Primitives/PopupRoot.cs index b0b0659f63..927a54a838 100644 --- a/src/Avalonia.Controls/Primitives/PopupRoot.cs +++ b/src/Avalonia.Controls/Primitives/PopupRoot.cs @@ -17,7 +17,7 @@ namespace Avalonia.Controls.Primitives /// /// The root window of a . /// - public class PopupRoot : WindowBase, IInteractive, IHostedVisualTreeRoot, IDisposable, IResourceNode + public class PopupRoot : WindowBase, IInteractive, IHostedVisualTreeRoot, IDisposable, IStyleHost { private IDisposable _presenterSubscription; @@ -70,7 +70,7 @@ namespace Avalonia.Controls.Primitives /// /// Gets the styling parent of the popup root. /// - IResourceNode IResourceNode.ResourceParent => Parent; + IStyleRoot IStyleHost.StylingParent => Parent; /// public void Dispose() => PlatformImpl?.Dispose(); diff --git a/tests/Avalonia.Controls.UnitTests/ControlTests_Resources.cs b/tests/Avalonia.Controls.UnitTests/ControlTests_Resources.cs index 6acd224fe2..9ee6e3e456 100644 --- a/tests/Avalonia.Controls.UnitTests/ControlTests_Resources.cs +++ b/tests/Avalonia.Controls.UnitTests/ControlTests_Resources.cs @@ -168,7 +168,7 @@ namespace Avalonia.Controls.UnitTests target.Resources.Add("foo", "bar"); Assert.True(raisedOnTarget); - Assert.False(raisedOnPresenter); + Assert.True(raisedOnPresenter); Assert.True(raisedOnChild); } diff --git a/tests/Avalonia.Controls.UnitTests/Primitives/PopupRootTests.cs b/tests/Avalonia.Controls.UnitTests/Primitives/PopupRootTests.cs index 68a1f1d90f..d4b5d01a6b 100644 --- a/tests/Avalonia.Controls.UnitTests/Primitives/PopupRootTests.cs +++ b/tests/Avalonia.Controls.UnitTests/Primitives/PopupRootTests.cs @@ -39,7 +39,7 @@ namespace Avalonia.Controls.UnitTests.Primitives } [Fact] - public void PopupRoot_ResourceParent_Is_Popup() + public void PopupRoot_StylingParent_Is_Popup() { using (UnitTestApplication.Start(TestServices.StyledWindow)) { @@ -53,7 +53,7 @@ namespace Avalonia.Controls.UnitTests.Primitives target.ApplyTemplate(); target.Popup.Open(); - Assert.Equal(target.Popup, ((IResourceNode)target.Popup.PopupRoot).ResourceParent); + Assert.Equal(target.Popup, ((IStyleHost)target.Popup.PopupRoot).StylingParent); } } From 6d075ad27be32cc149bfd1fd27fb5f3f49f40159 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Thu, 14 Dec 2017 22:31:45 -0600 Subject: [PATCH 19/49] Fix #424. --- src/Avalonia.Controls/TextBox.cs | 8 ++++++++ .../Avalonia.Controls.UnitTests/TextBoxTests.cs | 16 ++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/Avalonia.Controls/TextBox.cs b/src/Avalonia.Controls/TextBox.cs index 67a45140c8..36ef8d05c3 100644 --- a/src/Avalonia.Controls/TextBox.cs +++ b/src/Avalonia.Controls/TextBox.cs @@ -178,6 +178,10 @@ namespace Avalonia.Controls { value = CoerceCaretIndex(value); SetAndRaise(SelectionStartProperty, ref _selectionStart, value); + if (SelectionStart == SelectionEnd) + { + CaretIndex = SelectionStart; + } } } @@ -192,6 +196,10 @@ namespace Avalonia.Controls { value = CoerceCaretIndex(value); SetAndRaise(SelectionEndProperty, ref _selectionEnd, value); + if (SelectionStart == SelectionEnd) + { + CaretIndex = SelectionEnd; + } } } diff --git a/tests/Avalonia.Controls.UnitTests/TextBoxTests.cs b/tests/Avalonia.Controls.UnitTests/TextBoxTests.cs index 26fc2a2461..b091f6826e 100644 --- a/tests/Avalonia.Controls.UnitTests/TextBoxTests.cs +++ b/tests/Avalonia.Controls.UnitTests/TextBoxTests.cs @@ -202,6 +202,22 @@ namespace Avalonia.Controls.UnitTests } } + [Fact] + public void Setting_SelectionStart_To_SelectionEnd_Sets_CaretPosition_To_SelectionStart() + { + using (UnitTestApplication.Start(Services)) + { + var textBox = new TextBox + { + Text = "0123456789" + }; + + textBox.SelectionStart = 2; + textBox.SelectionEnd = 2; + Assert.Equal(2, textBox.CaretIndex); + } + } + [Fact] public void Setting_Text_Updates_CaretPosition() { From b463d04e9f1c7d236e6002bd34ce84face1de188 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Thu, 14 Dec 2017 23:11:26 -0600 Subject: [PATCH 20/49] Make KeyGestures with +,-,. in them match with both the non-numpad keys and the matching numpad keys. Fixes #225 --- src/Avalonia.Input/KeyGesture.cs | 17 ++++++- .../KeyGestureParseTests.cs | 28 ------------ .../KeyGestureTests.cs | 44 +++++++++++++++++++ 3 files changed, 60 insertions(+), 29 deletions(-) delete mode 100644 tests/Avalonia.Input.UnitTests/KeyGestureParseTests.cs create mode 100644 tests/Avalonia.Input.UnitTests/KeyGestureTests.cs diff --git a/src/Avalonia.Input/KeyGesture.cs b/src/Avalonia.Input/KeyGesture.cs index 88d3c99839..954333b80f 100644 --- a/src/Avalonia.Input/KeyGesture.cs +++ b/src/Avalonia.Input/KeyGesture.cs @@ -111,6 +111,21 @@ namespace Avalonia.Input return string.Join(" + ", parts); } - public bool Matches(KeyEventArgs keyEvent) => keyEvent.Key == Key && keyEvent.Modifiers == Modifiers; + public bool Matches(KeyEventArgs keyEvent) => ResolveNumPadOperationKey(keyEvent.Key) == Key && keyEvent.Modifiers == Modifiers; + + private Key ResolveNumPadOperationKey(Key key) + { + switch (key) + { + case Key.Add: + return Key.OemPlus; + case Key.Subtract: + return Key.OemMinus; + case Key.Decimal: + return Key.OemPeriod; + default: + return key; + } + } } } diff --git a/tests/Avalonia.Input.UnitTests/KeyGestureParseTests.cs b/tests/Avalonia.Input.UnitTests/KeyGestureParseTests.cs deleted file mode 100644 index d26b03ad80..0000000000 --- a/tests/Avalonia.Input.UnitTests/KeyGestureParseTests.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Xunit; - -namespace Avalonia.Input.UnitTests -{ - public class KeyGestureParseTests - { - private static readonly Dictionary SampleData = new Dictionary - { - {"Ctrl+A", new KeyGesture {Key = Key.A, Modifiers = InputModifiers.Control}}, - {" \tShift\t+Alt +B", new KeyGesture {Key = Key.B, Modifiers = InputModifiers.Shift|InputModifiers.Alt} }, - {"Control++", new KeyGesture {Key = Key.OemPlus, Modifiers = InputModifiers.Control} } - }; - - - - [Fact] - public void Key_Gesture_Is_Able_To_Parse_Sample_Data() - { - foreach (var d in SampleData) - Assert.Equal(d.Value, KeyGesture.Parse(d.Key)); - } - } -} diff --git a/tests/Avalonia.Input.UnitTests/KeyGestureTests.cs b/tests/Avalonia.Input.UnitTests/KeyGestureTests.cs new file mode 100644 index 0000000000..006ed1140e --- /dev/null +++ b/tests/Avalonia.Input.UnitTests/KeyGestureTests.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Xunit; + +namespace Avalonia.Input.UnitTests +{ + public class KeyGestureTests + { + public static readonly IEnumerable SampleData = new object[][] + { + new object[]{"Ctrl+A", new KeyGesture {Key = Key.A, Modifiers = InputModifiers.Control}}, + new object[]{" \tShift\t+Alt +B", new KeyGesture {Key = Key.B, Modifiers = InputModifiers.Shift|InputModifiers.Alt} }, + new object[]{"Control++", new KeyGesture {Key = Key.OemPlus, Modifiers = InputModifiers.Control} } + }; + + + + [Theory] + [MemberData(nameof(SampleData))] + public void Key_Gesture_Is_Able_To_Parse_Sample_Data(string text, KeyGesture gesture) + { + Assert.Equal(gesture, KeyGesture.Parse(text)); + } + + [Theory] + [InlineData(Key.OemMinus, Key.Subtract)] + [InlineData(Key.OemPlus, Key.Add)] + [InlineData(Key.OemPeriod, Key.Decimal)] + public void Key_Gesture_Matches_NumPad_To_Regular_Digit(Key gestureKey, Key pressedKey) + { + var keyGesture = new KeyGesture + { + Key = gestureKey + }; + Assert.True(keyGesture.Matches(new KeyEventArgs + { + Key = pressedKey + })); + } + } +} From 23af42e4233444e556a6ab718036611c47eb70e3 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Thu, 14 Dec 2017 23:16:56 -0600 Subject: [PATCH 21/49] Fix explicit StylingParent definition. --- src/Avalonia.Controls/Primitives/PopupRoot.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Avalonia.Controls/Primitives/PopupRoot.cs b/src/Avalonia.Controls/Primitives/PopupRoot.cs index 927a54a838..507a085fed 100644 --- a/src/Avalonia.Controls/Primitives/PopupRoot.cs +++ b/src/Avalonia.Controls/Primitives/PopupRoot.cs @@ -70,7 +70,7 @@ namespace Avalonia.Controls.Primitives /// /// Gets the styling parent of the popup root. /// - IStyleRoot IStyleHost.StylingParent => Parent; + IStyleHost IStyleHost.StylingParent => Parent; /// public void Dispose() => PlatformImpl?.Dispose(); From 381cd64b1f1859ce0c78638b573bb3fccb8570ad Mon Sep 17 00:00:00 2001 From: "M. ter Woord" Date: Fri, 15 Dec 2017 17:40:54 +0100 Subject: [PATCH 22/49] Add the uri to the error message, that way nested load errors can be diagnosed much quicker. --- .../AvaloniaXamlLoaderPortableXaml.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Markup/Avalonia.Markup.Xaml/AvaloniaXamlLoaderPortableXaml.cs b/src/Markup/Avalonia.Markup.Xaml/AvaloniaXamlLoaderPortableXaml.cs index 0419db5d0f..906bb00863 100644 --- a/src/Markup/Avalonia.Markup.Xaml/AvaloniaXamlLoaderPortableXaml.cs +++ b/src/Markup/Avalonia.Markup.Xaml/AvaloniaXamlLoaderPortableXaml.cs @@ -127,7 +127,19 @@ namespace Avalonia.Markup.Xaml using (var stream = assetLocator.Open(uri, baseUri)) { - return Load(stream, rootInstance, uri); + try + { + return Load(stream, rootInstance, uri); + } + catch (Exception e) + { + var uriString = uri.ToString(); + if (!uri.IsAbsoluteUri) + { + uriString = new Uri(baseUri, uri).AbsoluteUri; + } + throw new Exception("Error loading xaml at " + uriString, e); + } } } From b0d013ad25fbcbcfea0836cbed58cfc1424006ff Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Fri, 15 Dec 2017 12:25:20 -0600 Subject: [PATCH 23/49] Fix tests. --- .../Avalonia.Controls.UnitTests/Primitives/PopupTests.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/Avalonia.Controls.UnitTests/Primitives/PopupTests.cs b/tests/Avalonia.Controls.UnitTests/Primitives/PopupTests.cs index 06b3202a83..84ea717bab 100644 --- a/tests/Avalonia.Controls.UnitTests/Primitives/PopupTests.cs +++ b/tests/Avalonia.Controls.UnitTests/Primitives/PopupTests.cs @@ -15,6 +15,7 @@ using Avalonia.Styling; using Avalonia.UnitTests; using Avalonia.VisualTree; using Xunit; +using Avalonia.Input; namespace Avalonia.Controls.UnitTests.Primitives { @@ -189,9 +190,11 @@ namespace Avalonia.Controls.UnitTests.Primitives { using (CreateServices()) { + var window = new Window(); var target = new Popup(); var child = new Control(); + window.Content = target; target.Open(); Assert.Single(target.PopupRoot.GetVisualChildren()); @@ -214,7 +217,8 @@ namespace Avalonia.Controls.UnitTests.Primitives { Content = new Border(), Template = new FuncControlTemplate(PopupContentControlTemplate), - } + }, + StylingParent = AvaloniaLocator.Current.GetService() }; target.ApplyTemplate(); @@ -306,7 +310,8 @@ namespace Avalonia.Controls.UnitTests.Primitives .Bind().ToFunc(() => globalStyles.Object) .Bind().ToConstant(new WindowingPlatformMock()) .Bind().ToTransient() - .Bind().ToFunc(() => renderInterface.Object); + .Bind().ToFunc(() => renderInterface.Object) + .Bind().ToConstant(new InputManager()); return result; } From ba481365f6469d2d3379d2a5d648a3acf935b45e Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Fri, 15 Dec 2017 20:27:30 -0600 Subject: [PATCH 24/49] Enable turning off the setup check for appbuilder tests. --- src/Avalonia.Controls/AppBuilderBase.cs | 13 ++++++++++++- .../Avalonia.Controls.UnitTests/AppBuilderTests.cs | 6 +++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Controls/AppBuilderBase.cs b/src/Avalonia.Controls/AppBuilderBase.cs index ebbd682f28..7af3deef34 100644 --- a/src/Avalonia.Controls/AppBuilderBase.cs +++ b/src/Avalonia.Controls/AppBuilderBase.cs @@ -209,6 +209,17 @@ namespace Avalonia.Controls public TAppBuilder UseAvaloniaModules() => AfterSetup(builder => SetupAvaloniaModules()); + private bool CheckSetup { get; set; } = true; + + /// + /// Set this AppBuilder to ignore the setup check. Used for testing purposes. + /// + internal TAppBuilder IgnoreSetupCheck() + { + CheckSetup = false; + return Self; + } + private void SetupAvaloniaModules() { var moduleInitializers = from assembly in AvaloniaLocator.Current.GetService().GetLoadedAssemblies() @@ -254,7 +265,7 @@ namespace Avalonia.Controls throw new InvalidOperationException("No rendering system configured."); } - if (s_setupWasAlreadyCalled) + if (s_setupWasAlreadyCalled && CheckSetup) { throw new InvalidOperationException("Setup was already called on one of AppBuilder instances"); } diff --git a/tests/Avalonia.Controls.UnitTests/AppBuilderTests.cs b/tests/Avalonia.Controls.UnitTests/AppBuilderTests.cs index 867f740a3a..60c53d126c 100644 --- a/tests/Avalonia.Controls.UnitTests/AppBuilderTests.cs +++ b/tests/Avalonia.Controls.UnitTests/AppBuilderTests.cs @@ -65,6 +65,7 @@ namespace Avalonia.Controls.UnitTests { ResetModuleLoadStates(); AppBuilder.Configure() + .IgnoreSetupCheck() .UseWindowingSubsystem(() => { }) .UseRenderingSubsystem(() => { }) .UseAvaloniaModules() @@ -81,6 +82,7 @@ namespace Avalonia.Controls.UnitTests { ResetModuleLoadStates(); var builder = AppBuilder.Configure() + .IgnoreSetupCheck() .UseWindowingSubsystem(() => { }) .UseRenderingSubsystem(() => { }, "Direct2D1"); builder.UseAvaloniaModules().SetupWithoutStarting(); @@ -90,6 +92,7 @@ namespace Avalonia.Controls.UnitTests ResetModuleLoadStates(); builder = AppBuilder.Configure() + .IgnoreSetupCheck() .UseWindowingSubsystem(() => { }) .UseRenderingSubsystem(() => { }, "Skia"); builder.UseAvaloniaModules().SetupWithoutStarting(); @@ -99,13 +102,14 @@ namespace Avalonia.Controls.UnitTests } } - [Fact (Skip = "We don't have rendering modules with dependencies right now")] + [Fact] public void LoadsRenderingModuleWithoutDependenciesWhenNoModuleMatches() { using (AvaloniaLocator.EnterScope()) { ResetModuleLoadStates(); var builder = AppBuilder.Configure() + .IgnoreSetupCheck() .UseWindowingSubsystem(() => { }) .UseRenderingSubsystem(() => { }, "TBD"); builder.UseAvaloniaModules().SetupWithoutStarting(); From ad02c53a4629d92b0aa0f301807c0e127e992082 Mon Sep 17 00:00:00 2001 From: "M. ter Woord" Date: Sat, 16 Dec 2017 10:38:49 +0100 Subject: [PATCH 25/49] - Add XamlLoadException - Use it for the new load exception info. --- src/Markup/Avalonia.Markup.Xaml/Avalonia.Markup.Xaml.csproj | 1 + .../Avalonia.Markup.Xaml/AvaloniaXamlLoaderPortableXaml.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Markup/Avalonia.Markup.Xaml/Avalonia.Markup.Xaml.csproj b/src/Markup/Avalonia.Markup.Xaml/Avalonia.Markup.Xaml.csproj index cf6afbe620..0ce2a1a992 100644 --- a/src/Markup/Avalonia.Markup.Xaml/Avalonia.Markup.Xaml.csproj +++ b/src/Markup/Avalonia.Markup.Xaml/Avalonia.Markup.Xaml.csproj @@ -91,6 +91,7 @@ + diff --git a/src/Markup/Avalonia.Markup.Xaml/AvaloniaXamlLoaderPortableXaml.cs b/src/Markup/Avalonia.Markup.Xaml/AvaloniaXamlLoaderPortableXaml.cs index 906bb00863..de2a79c54e 100644 --- a/src/Markup/Avalonia.Markup.Xaml/AvaloniaXamlLoaderPortableXaml.cs +++ b/src/Markup/Avalonia.Markup.Xaml/AvaloniaXamlLoaderPortableXaml.cs @@ -138,7 +138,7 @@ namespace Avalonia.Markup.Xaml { uriString = new Uri(baseUri, uri).AbsoluteUri; } - throw new Exception("Error loading xaml at " + uriString, e); + throw new XamlLoadException("Error loading xaml at " + uriString, e); } } } From 09c7c32e1912f205a117a49e2f9459e91413ca5f Mon Sep 17 00:00:00 2001 From: "M. ter Woord" Date: Sat, 16 Dec 2017 13:24:27 +0100 Subject: [PATCH 26/49] Add the missing file. --- .../Avalonia.Markup.Xaml/XamlLoadException.cs | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/Markup/Avalonia.Markup.Xaml/XamlLoadException.cs diff --git a/src/Markup/Avalonia.Markup.Xaml/XamlLoadException.cs b/src/Markup/Avalonia.Markup.Xaml/XamlLoadException.cs new file mode 100644 index 0000000000..e66b8ddf54 --- /dev/null +++ b/src/Markup/Avalonia.Markup.Xaml/XamlLoadException.cs @@ -0,0 +1,24 @@ +using System; +using System.Runtime.Serialization; + +namespace Avalonia.Markup.Xaml +{ + public class XamlLoadException: Exception + { + public XamlLoadException() + { + } + + protected XamlLoadException(SerializationInfo info, StreamingContext context): base(info, context) + { + } + + public XamlLoadException(string message): base(message) + { + } + + public XamlLoadException(string message, Exception innerException): base(message, innerException) + { + } + } +} \ No newline at end of file From b944783c1bbdee452be874a5bffb38dbe4640676 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 20 Dec 2017 20:02:58 +0000 Subject: [PATCH 27/49] fix Skia SetForegroundBrush when length = 1. --- src/Skia/Avalonia.Skia/FormattedTextImpl.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Skia/Avalonia.Skia/FormattedTextImpl.cs b/src/Skia/Avalonia.Skia/FormattedTextImpl.cs index f727d033cc..f22722a0b5 100644 --- a/src/Skia/Avalonia.Skia/FormattedTextImpl.cs +++ b/src/Skia/Avalonia.Skia/FormattedTextImpl.cs @@ -450,7 +450,7 @@ namespace Avalonia.Skia { var match = _foregroundBrushes[bi]; - len = match.Key.EndIndex - index + 1; + len = match.Key.EndIndex - index; result = match.Value; if (len > 0 && len < length) @@ -641,7 +641,7 @@ namespace Avalonia.Skia Length = length; } - public int EndIndex => StartIndex + Length - 1; + public int EndIndex => StartIndex + Length; public int Length { get; private set; } From 16b99ae3aafdade0fa99daab8f8c7a5125cf5240 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Wed, 20 Dec 2017 20:04:35 +0000 Subject: [PATCH 28/49] add skia to replace scripts so skia issues can be debugged from user apps. --- scripts/ReplaceNugetCache.ps1 | 1 + scripts/ReplaceNugetCache.sh | 2 ++ scripts/ReplaceNugetCacheRelease.ps1 | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/ReplaceNugetCache.ps1 b/scripts/ReplaceNugetCache.ps1 index 4ad31db274..a03d442bff 100644 --- a/scripts/ReplaceNugetCache.ps1 +++ b/scripts/ReplaceNugetCache.ps1 @@ -2,3 +2,4 @@ copy ..\samples\ControlCatalog.NetCore\bin\Debug\netcoreapp2.0\Avalonia**.dll ~\ copy ..\samples\ControlCatalog.NetCore.\bin\Debug\netcoreapp2.0\Avalonia**.dll ~\.nuget\packages\avalonia\$args\lib\netstandard2.0\ copy ..\samples\ControlCatalog.NetCore.\bin\Debug\netcoreapp2.0\Avalonia**.dll ~\.nuget\packages\avalonia.gtk3\$args\lib\netstandard2.0\ copy ..\samples\ControlCatalog.NetCore.\bin\Debug\netcoreapp2.0\Avalonia**.dll ~\.nuget\packages\avalonia.win32\$args\lib\netstandard2.0\ +copy ..\samples\ControlCatalog.NetCore.\bin\Debug\netcoreapp2.0\Avalonia**.dll ~\.nuget\packages\avalonia.skia\$args\lib\netstandard2.0\ diff --git a/scripts/ReplaceNugetCache.sh b/scripts/ReplaceNugetCache.sh index 636aec5f23..d50f4152e8 100755 --- a/scripts/ReplaceNugetCache.sh +++ b/scripts/ReplaceNugetCache.sh @@ -3,4 +3,6 @@ cp ../samples/ControlCatalog.NetCore/bin/Debug/netcoreapp2.0/Avalonia**.dll ~/.nuget/packages/avalonia/$1/lib/netcoreapp2.0/ cp ../samples/ControlCatalog.NetCore/bin/Debug/netcoreapp2.0/Avalonia**.dll ~/.nuget/packages/avalonia/$1/lib/netstandard2.0/ cp ../samples/ControlCatalog.NetCore/bin/Debug/netcoreapp2.0/Avalonia**.dll ~/.nuget/packages/avalonia.gtk3/$1/lib/netstandard2.0/ + cp ../samples/ControlCatalog.NetCore/bin/Debug/netcoreapp2.0/Avalonia**.dll ~/.nuget/packages/avalonia.skia/$1/lib/netstandard2.0/ + diff --git a/scripts/ReplaceNugetCacheRelease.ps1 b/scripts/ReplaceNugetCacheRelease.ps1 index f188c81c51..1c19e00400 100644 --- a/scripts/ReplaceNugetCacheRelease.ps1 +++ b/scripts/ReplaceNugetCacheRelease.ps1 @@ -1,4 +1,5 @@ copy ..\samples\ControlCatalog.NetCore\bin\Release\netcoreapp2.0\Avalonia**.dll ~\.nuget\packages\avalonia\$args\lib\netcoreapp2.0\ copy ..\samples\ControlCatalog.NetCore.\bin\Release\netcoreapp2.0\Avalonia**.dll ~\.nuget\packages\avalonia\$args\lib\netstandard2.0\ copy ..\samples\ControlCatalog.NetCore.\bin\Release\netcoreapp2.0\Avalonia**.dll ~\.nuget\packages\avalonia.gtk3\$args\lib\netstandard2.0\ -copy ..\samples\ControlCatalog.NetCore.\bin\Release\netcoreapp2.0\Avalonia**.dll ~\.nuget\packages\avalonia.win32\$args\lib\netstandard2.0\ \ No newline at end of file +copy ..\samples\ControlCatalog.NetCore.\bin\Release\netcoreapp2.0\Avalonia**.dll ~\.nuget\packages\avalonia.win32\$args\lib\netstandard2.0\ +copy ..\samples\ControlCatalog.NetCore.\bin\Release\netcoreapp2.0\Avalonia**.dll ~\.nuget\packages\avalonia.skia\$args\lib\netstandard2.0\ \ No newline at end of file From eb7c0104624016a41b1e288e0134ab7db7d3e75c Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Wed, 20 Dec 2017 14:20:14 -0600 Subject: [PATCH 29/49] Retarget .Net Framework projects to 4.7 Works around dotnet/standard#567. --- build.cake | 2 +- samples/BindingTest/App.config | 2 +- samples/BindingTest/BindingTest.csproj | 2 +- samples/ControlCatalog.Desktop/App.config | 2 +- .../ControlCatalog.Desktop.csproj | 2 +- samples/RenderTest/App.config | 2 +- samples/RenderTest/RenderTest.csproj | 2 +- samples/VirtualizationTest/App.config | 2 +- .../VirtualizationTest.csproj | 2 +- .../Avalonia.Base.UnitTests.csproj | 2 +- tests/Avalonia.Benchmarks/App.config | 8 ++-- .../Avalonia.Benchmarks.csproj | 2 +- .../Avalonia.Controls.UnitTests.csproj | 2 +- .../App.config | 14 +++--- .../Avalonia.DesignerSupport.TestApp.csproj | 4 +- .../Properties/Resources.Designer.cs | 44 ++++++++----------- .../Properties/Settings.Designer.cs | 22 ++++------ .../Avalonia.DesignerSupport.Tests.csproj | 3 +- .../Avalonia.Direct2D1.UnitTests.csproj | 2 +- tests/Avalonia.Direct2D1.UnitTests/app.config | 12 ++--- .../Avalonia.Input.UnitTests.csproj | 2 +- .../Avalonia.Interactivity.UnitTests.csproj | 2 +- .../Avalonia.Layout.UnitTests.csproj | 2 +- .../Avalonia.LeakTests.csproj | 2 +- tests/Avalonia.LeakTests/app.config | 12 ++--- .../Avalonia.Markup.UnitTests.csproj | 2 +- .../Avalonia.Markup.Xaml.UnitTests.csproj | 2 +- .../Avalonia.Direct2D1.RenderTests.csproj | 2 +- .../Avalonia.Styling.UnitTests.csproj | 2 +- .../Avalonia.UnitTests.csproj | 2 +- .../Avalonia.Visuals.UnitTests.csproj | 2 +- 31 files changed, 78 insertions(+), 87 deletions(-) diff --git a/build.cake b/build.cake index eb5918832e..06ba84e27f 100644 --- a/build.cake +++ b/build.cake @@ -163,7 +163,7 @@ void RunCoreTest(string project, Parameters parameters, bool coreOnly = false) DotNetCoreRestore(project); var frameworks = new List(){"netcoreapp2.0"}; if(parameters.IsRunningOnWindows) - frameworks.Add("net461"); + frameworks.Add("net47"); foreach(var fw in frameworks) { if(!fw.StartsWith("netcoreapp") && coreOnly) diff --git a/samples/BindingTest/App.config b/samples/BindingTest/App.config index 373b3a13f8..538be69997 100644 --- a/samples/BindingTest/App.config +++ b/samples/BindingTest/App.config @@ -1,7 +1,7 @@ - + diff --git a/samples/BindingTest/BindingTest.csproj b/samples/BindingTest/BindingTest.csproj index 9f3fed5522..a17fe0eed1 100644 --- a/samples/BindingTest/BindingTest.csproj +++ b/samples/BindingTest/BindingTest.csproj @@ -9,7 +9,7 @@ Properties BindingTest BindingTest - v4.6.1 + v4.7 512 true diff --git a/samples/ControlCatalog.Desktop/App.config b/samples/ControlCatalog.Desktop/App.config index 68403e421f..cd4593817b 100644 --- a/samples/ControlCatalog.Desktop/App.config +++ b/samples/ControlCatalog.Desktop/App.config @@ -1,7 +1,7 @@ - + diff --git a/samples/ControlCatalog.Desktop/ControlCatalog.Desktop.csproj b/samples/ControlCatalog.Desktop/ControlCatalog.Desktop.csproj index cfa2f89b0e..8a5959e361 100644 --- a/samples/ControlCatalog.Desktop/ControlCatalog.Desktop.csproj +++ b/samples/ControlCatalog.Desktop/ControlCatalog.Desktop.csproj @@ -9,7 +9,7 @@ Properties ControlCatalog.Desktop ControlCatalog.Desktop - v4.6.1 + v4.7 512 true diff --git a/samples/RenderTest/App.config b/samples/RenderTest/App.config index 68403e421f..cd4593817b 100644 --- a/samples/RenderTest/App.config +++ b/samples/RenderTest/App.config @@ -1,7 +1,7 @@ - + diff --git a/samples/RenderTest/RenderTest.csproj b/samples/RenderTest/RenderTest.csproj index 4a471a831a..b33d5d3c70 100644 --- a/samples/RenderTest/RenderTest.csproj +++ b/samples/RenderTest/RenderTest.csproj @@ -9,7 +9,7 @@ Properties RenderTest RenderTest - v4.6.1 + v4.7 512 true diff --git a/samples/VirtualizationTest/App.config b/samples/VirtualizationTest/App.config index 68403e421f..cd4593817b 100644 --- a/samples/VirtualizationTest/App.config +++ b/samples/VirtualizationTest/App.config @@ -1,7 +1,7 @@ - + diff --git a/samples/VirtualizationTest/VirtualizationTest.csproj b/samples/VirtualizationTest/VirtualizationTest.csproj index 147355aed1..0d498d827f 100644 --- a/samples/VirtualizationTest/VirtualizationTest.csproj +++ b/samples/VirtualizationTest/VirtualizationTest.csproj @@ -9,7 +9,7 @@ Properties VirtualizationTest VirtualizationTest - v4.6.1 + v4.7 512 true diff --git a/tests/Avalonia.Base.UnitTests/Avalonia.Base.UnitTests.csproj b/tests/Avalonia.Base.UnitTests/Avalonia.Base.UnitTests.csproj index 8692cdef42..f8ec52a6c7 100644 --- a/tests/Avalonia.Base.UnitTests/Avalonia.Base.UnitTests.csproj +++ b/tests/Avalonia.Base.UnitTests/Avalonia.Base.UnitTests.csproj @@ -1,6 +1,6 @@  - net461;netcoreapp2.0 + net47;netcoreapp2.0 Library diff --git a/tests/Avalonia.Benchmarks/App.config b/tests/Avalonia.Benchmarks/App.config index 121e469348..425e308058 100644 --- a/tests/Avalonia.Benchmarks/App.config +++ b/tests/Avalonia.Benchmarks/App.config @@ -1,13 +1,13 @@ - + - + - - + + diff --git a/tests/Avalonia.Benchmarks/Avalonia.Benchmarks.csproj b/tests/Avalonia.Benchmarks/Avalonia.Benchmarks.csproj index c16b89e0b6..d40dc596a5 100644 --- a/tests/Avalonia.Benchmarks/Avalonia.Benchmarks.csproj +++ b/tests/Avalonia.Benchmarks/Avalonia.Benchmarks.csproj @@ -9,7 +9,7 @@ Properties Avalonia.Benchmarks Avalonia.Benchmarks - v4.6.1 + v4.7 512 true diff --git a/tests/Avalonia.Controls.UnitTests/Avalonia.Controls.UnitTests.csproj b/tests/Avalonia.Controls.UnitTests/Avalonia.Controls.UnitTests.csproj index 8b2f5093cf..a63898486b 100644 --- a/tests/Avalonia.Controls.UnitTests/Avalonia.Controls.UnitTests.csproj +++ b/tests/Avalonia.Controls.UnitTests/Avalonia.Controls.UnitTests.csproj @@ -1,6 +1,6 @@  - net461;netcoreapp2.0 + net47;netcoreapp2.0 Library diff --git a/tests/Avalonia.DesignerSupport.TestApp/App.config b/tests/Avalonia.DesignerSupport.TestApp/App.config index 4fe7131d2a..baef7524af 100644 --- a/tests/Avalonia.DesignerSupport.TestApp/App.config +++ b/tests/Avalonia.DesignerSupport.TestApp/App.config @@ -1,18 +1,18 @@ - + - + - - + + - - + + - \ No newline at end of file + diff --git a/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj b/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj index 7945915e8c..eaae82316e 100644 --- a/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj +++ b/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj @@ -9,9 +9,10 @@ Properties Avalonia.DesignerSupport.TestApp Avalonia.DesignerSupport.TestApp - v4.6.1 + v4.7 512 true + AnyCPU @@ -62,6 +63,7 @@ True Resources.resx + True Designer diff --git a/tests/Avalonia.DesignerSupport.TestApp/Properties/Resources.Designer.cs b/tests/Avalonia.DesignerSupport.TestApp/Properties/Resources.Designer.cs index a251d20120..28db9d4dcf 100644 --- a/tests/Avalonia.DesignerSupport.TestApp/Properties/Resources.Designer.cs +++ b/tests/Avalonia.DesignerSupport.TestApp/Properties/Resources.Designer.cs @@ -8,10 +8,10 @@ // //------------------------------------------------------------------------------ -namespace Avalonia.DesignerSupport.TestApp.Properties -{ - - +namespace Avalonia.DesignerSupport.TestApp.Properties { + using System; + + /// /// A strongly-typed resource class, for looking up localized strings, etc. /// @@ -19,51 +19,43 @@ namespace Avalonia.DesignerSupport.TestApp.Properties // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources - { - + internal class Resources { + private static global::System.Resources.ResourceManager resourceMan; - + private static global::System.Globalization.CultureInfo resourceCulture; - + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() - { + internal Resources() { } - + /// /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager - { - get - { - if ((resourceMan == null)) - { + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Avalonia.DesignerSupport.TestApp.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } - + /// /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture - { - get - { + internal static global::System.Globalization.CultureInfo Culture { + get { return resourceCulture; } - set - { + set { resourceCulture = value; } } diff --git a/tests/Avalonia.DesignerSupport.TestApp/Properties/Settings.Designer.cs b/tests/Avalonia.DesignerSupport.TestApp/Properties/Settings.Designer.cs index eaf8ac263a..15a90aaf18 100644 --- a/tests/Avalonia.DesignerSupport.TestApp/Properties/Settings.Designer.cs +++ b/tests/Avalonia.DesignerSupport.TestApp/Properties/Settings.Designer.cs @@ -8,21 +8,17 @@ // //------------------------------------------------------------------------------ -namespace Avalonia.DesignerSupport.TestApp.Properties -{ - - +namespace Avalonia.DesignerSupport.TestApp.Properties { + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.5.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default - { - get - { + + public static Settings Default { + get { return defaultInstance; } } diff --git a/tests/Avalonia.DesignerSupport.Tests/Avalonia.DesignerSupport.Tests.csproj b/tests/Avalonia.DesignerSupport.Tests/Avalonia.DesignerSupport.Tests.csproj index 477d44b99d..bc9a4b3e29 100644 --- a/tests/Avalonia.DesignerSupport.Tests/Avalonia.DesignerSupport.Tests.csproj +++ b/tests/Avalonia.DesignerSupport.Tests/Avalonia.DesignerSupport.Tests.csproj @@ -9,8 +9,9 @@ Properties Avalonia.DesignerSupport.Tests Avalonia.DesignerSupport.Tests - v4.6.1 + v4.7 512 + true diff --git a/tests/Avalonia.Direct2D1.UnitTests/Avalonia.Direct2D1.UnitTests.csproj b/tests/Avalonia.Direct2D1.UnitTests/Avalonia.Direct2D1.UnitTests.csproj index 4b33d14243..303ebed001 100644 --- a/tests/Avalonia.Direct2D1.UnitTests/Avalonia.Direct2D1.UnitTests.csproj +++ b/tests/Avalonia.Direct2D1.UnitTests/Avalonia.Direct2D1.UnitTests.csproj @@ -9,7 +9,7 @@ Properties Avalonia.Direct2D1.UnitTests Avalonia.Direct2D1.UnitTests - v4.6.1 + v4.7 512 diff --git a/tests/Avalonia.Direct2D1.UnitTests/app.config b/tests/Avalonia.Direct2D1.UnitTests/app.config index 6af30494f2..e4df6c253e 100644 --- a/tests/Avalonia.Direct2D1.UnitTests/app.config +++ b/tests/Avalonia.Direct2D1.UnitTests/app.config @@ -1,15 +1,15 @@ - + - - + + - - + + - \ No newline at end of file + diff --git a/tests/Avalonia.Input.UnitTests/Avalonia.Input.UnitTests.csproj b/tests/Avalonia.Input.UnitTests/Avalonia.Input.UnitTests.csproj index 98a1312782..1f66290dd9 100644 --- a/tests/Avalonia.Input.UnitTests/Avalonia.Input.UnitTests.csproj +++ b/tests/Avalonia.Input.UnitTests/Avalonia.Input.UnitTests.csproj @@ -1,6 +1,6 @@  - net461;netcoreapp2.0 + net47;netcoreapp2.0 Library diff --git a/tests/Avalonia.Interactivity.UnitTests/Avalonia.Interactivity.UnitTests.csproj b/tests/Avalonia.Interactivity.UnitTests/Avalonia.Interactivity.UnitTests.csproj index 78d2128478..3fb2439af8 100644 --- a/tests/Avalonia.Interactivity.UnitTests/Avalonia.Interactivity.UnitTests.csproj +++ b/tests/Avalonia.Interactivity.UnitTests/Avalonia.Interactivity.UnitTests.csproj @@ -1,6 +1,6 @@  - net461;netcoreapp2.0 + net47;netcoreapp2.0 Library diff --git a/tests/Avalonia.Layout.UnitTests/Avalonia.Layout.UnitTests.csproj b/tests/Avalonia.Layout.UnitTests/Avalonia.Layout.UnitTests.csproj index 0020ff46d9..ae6f4d463a 100644 --- a/tests/Avalonia.Layout.UnitTests/Avalonia.Layout.UnitTests.csproj +++ b/tests/Avalonia.Layout.UnitTests/Avalonia.Layout.UnitTests.csproj @@ -1,6 +1,6 @@  - net461;netcoreapp2.0 + net47;netcoreapp2.0 Library diff --git a/tests/Avalonia.LeakTests/Avalonia.LeakTests.csproj b/tests/Avalonia.LeakTests/Avalonia.LeakTests.csproj index 46bd4ee324..7ecc3797ed 100644 --- a/tests/Avalonia.LeakTests/Avalonia.LeakTests.csproj +++ b/tests/Avalonia.LeakTests/Avalonia.LeakTests.csproj @@ -9,7 +9,7 @@ Properties Avalonia.LeakTests Avalonia.LeakTests - v4.6.1 + v4.7 512 diff --git a/tests/Avalonia.LeakTests/app.config b/tests/Avalonia.LeakTests/app.config index 01de951354..71e6d0a02e 100644 --- a/tests/Avalonia.LeakTests/app.config +++ b/tests/Avalonia.LeakTests/app.config @@ -1,15 +1,15 @@ - + - - + + - - + + - \ No newline at end of file + diff --git a/tests/Avalonia.Markup.UnitTests/Avalonia.Markup.UnitTests.csproj b/tests/Avalonia.Markup.UnitTests/Avalonia.Markup.UnitTests.csproj index 5d3b04e24b..4db9bc45ad 100644 --- a/tests/Avalonia.Markup.UnitTests/Avalonia.Markup.UnitTests.csproj +++ b/tests/Avalonia.Markup.UnitTests/Avalonia.Markup.UnitTests.csproj @@ -1,6 +1,6 @@  - net461;netcoreapp2.0 + net47;netcoreapp2.0 Library diff --git a/tests/Avalonia.Markup.Xaml.UnitTests/Avalonia.Markup.Xaml.UnitTests.csproj b/tests/Avalonia.Markup.Xaml.UnitTests/Avalonia.Markup.Xaml.UnitTests.csproj index a3e4ad1418..02fbf23687 100644 --- a/tests/Avalonia.Markup.Xaml.UnitTests/Avalonia.Markup.Xaml.UnitTests.csproj +++ b/tests/Avalonia.Markup.Xaml.UnitTests/Avalonia.Markup.Xaml.UnitTests.csproj @@ -1,6 +1,6 @@  - net461;netcoreapp2.0 + net47;netcoreapp2.0 Library diff --git a/tests/Avalonia.RenderTests/Avalonia.Direct2D1.RenderTests.csproj b/tests/Avalonia.RenderTests/Avalonia.Direct2D1.RenderTests.csproj index 445f8b0368..03f5233546 100644 --- a/tests/Avalonia.RenderTests/Avalonia.Direct2D1.RenderTests.csproj +++ b/tests/Avalonia.RenderTests/Avalonia.Direct2D1.RenderTests.csproj @@ -8,7 +8,7 @@ Properties Avalonia.Direct2D1.RenderTests Avalonia.Direct2D1.RenderTests - v4.6.1 + v4.7 512 diff --git a/tests/Avalonia.Styling.UnitTests/Avalonia.Styling.UnitTests.csproj b/tests/Avalonia.Styling.UnitTests/Avalonia.Styling.UnitTests.csproj index ae12269e18..87d6e4504c 100644 --- a/tests/Avalonia.Styling.UnitTests/Avalonia.Styling.UnitTests.csproj +++ b/tests/Avalonia.Styling.UnitTests/Avalonia.Styling.UnitTests.csproj @@ -1,6 +1,6 @@  - net461;netcoreapp2.0 + net47;netcoreapp2.0 Library CS0067 diff --git a/tests/Avalonia.UnitTests/Avalonia.UnitTests.csproj b/tests/Avalonia.UnitTests/Avalonia.UnitTests.csproj index b04fd5d2bc..c879fe9c94 100644 --- a/tests/Avalonia.UnitTests/Avalonia.UnitTests.csproj +++ b/tests/Avalonia.UnitTests/Avalonia.UnitTests.csproj @@ -1,6 +1,6 @@  - net461;netcoreapp2.0 + net47;netcoreapp2.0 false Library diff --git a/tests/Avalonia.Visuals.UnitTests/Avalonia.Visuals.UnitTests.csproj b/tests/Avalonia.Visuals.UnitTests/Avalonia.Visuals.UnitTests.csproj index 6dc9e3324d..74a48f9ce7 100644 --- a/tests/Avalonia.Visuals.UnitTests/Avalonia.Visuals.UnitTests.csproj +++ b/tests/Avalonia.Visuals.UnitTests/Avalonia.Visuals.UnitTests.csproj @@ -1,6 +1,6 @@  - net461;netcoreapp2.0 + net47;netcoreapp2.0 From bc3e3cb25dc098bc84e52da7c486354e6da0f90b Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Wed, 20 Dec 2017 14:35:08 -0600 Subject: [PATCH 30/49] Update project file for Avalonia.UnitTests to use net47 instead of net461 --- tests/Avalonia.UnitTests/Avalonia.UnitTests.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Avalonia.UnitTests/Avalonia.UnitTests.csproj b/tests/Avalonia.UnitTests/Avalonia.UnitTests.csproj index c879fe9c94..24e335f46e 100644 --- a/tests/Avalonia.UnitTests/Avalonia.UnitTests.csproj +++ b/tests/Avalonia.UnitTests/Avalonia.UnitTests.csproj @@ -21,7 +21,7 @@ prompt 4 - + @@ -32,7 +32,7 @@ - + From abe1afbb01c1dd597696ae4fa6b7f4e8d3e7539b Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Wed, 20 Dec 2017 19:03:16 -0600 Subject: [PATCH 31/49] Retarget base unit tests library (that is just included in tests) back to net461. --- tests/Avalonia.UnitTests/Avalonia.UnitTests.csproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/Avalonia.UnitTests/Avalonia.UnitTests.csproj b/tests/Avalonia.UnitTests/Avalonia.UnitTests.csproj index 24e335f46e..c2580ec004 100644 --- a/tests/Avalonia.UnitTests/Avalonia.UnitTests.csproj +++ b/tests/Avalonia.UnitTests/Avalonia.UnitTests.csproj @@ -1,6 +1,6 @@  - net47;netcoreapp2.0 + net461;netcoreapp2.0 false Library @@ -21,7 +21,7 @@ prompt 4 - + @@ -32,8 +32,8 @@ - - + + From ee433f741e8b4c39e8db15f07fb7102bc22f3bd0 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Wed, 20 Dec 2017 20:12:47 -0600 Subject: [PATCH 32/49] Update appveyor.yml --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index ba3680d0b9..746ded971d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -os: Previous Visual Studio 2017 +os: Visual Studio 2017 platform: - Any CPU skip_branch_with_pr: true @@ -22,7 +22,7 @@ install: before_build: - git submodule update --init build_script: -- ps: .\build.ps1 -Target "AppVeyor" -Platform "$env:platform" -Configuration "$env:configuration" +- ps: .\build.ps1 -Target "AppVeyor" -Platform "$env:platform" -Configuration "$env:configuration" -v Diagnostic test: off artifacts: From f72577cf92e0fc39d1e728b6f3feacb9d25f8321 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Wed, 20 Dec 2017 21:03:23 -0600 Subject: [PATCH 33/49] Clean up test scripts --- appveyor.yml | 2 +- build.cake | 69 +++------- .../Resources/Resource.Designer.cs | 7 +- .../Avalonia.DesignerSupport.TestApp.csproj | 3 +- .../Avalonia.DesignerSupport.Tests.csproj | 3 +- .../Avalonia.Direct2D1.RenderTests.csproj | 125 ++++-------------- tests/Avalonia.RenderTests/TestBase.cs | 4 +- 7 files changed, 54 insertions(+), 159 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 746ded971d..76d1ae3e1c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -22,7 +22,7 @@ install: before_build: - git submodule update --init build_script: -- ps: .\build.ps1 -Target "AppVeyor" -Platform "$env:platform" -Configuration "$env:configuration" -v Diagnostic +- ps: .\build.ps1 -Target "AppVeyor" -Platform "$env:platform" -Configuration "$env:configuration" test: off artifacts: diff --git a/build.cake b/build.cake index 06ba84e27f..d321109a1e 100644 --- a/build.cake +++ b/build.cake @@ -143,8 +143,8 @@ Task("Build") settings.WithProperty("Platform", "\"" + parameters.Platform + "\""); settings.WithProperty("UseRoslynPathHack", "true"); settings.SetVerbosity(Verbosity.Minimal); - settings.WithProperty("Windows", "True"); settings.UseToolVersion(MSBuildToolVersion.VS2017); + settings.WithProperty("Windows", "True"); settings.SetNodeReuse(false); }); } @@ -178,8 +178,11 @@ void RunCoreTest(string project, Parameters parameters, bool coreOnly = false) } } -Task("Run-Net-Core-Unit-Tests") - .IsDependentOn("Clean") +Task("Run-Unit-Tests") + .IsDependentOn("Build") + .IsDependentOn("Run-Designer-Unit-Tests") + .IsDependentOn("Run-Render-Tests") + .WithCriteria(() => !parameters.SkipTests) .Does(() => { RunCoreTest("./tests/Avalonia.Base.UnitTests", parameters, false); RunCoreTest("./tests/Avalonia.Controls.UnitTests", parameters, false); @@ -190,56 +193,22 @@ Task("Run-Net-Core-Unit-Tests") RunCoreTest("./tests/Avalonia.Markup.Xaml.UnitTests", parameters, false); RunCoreTest("./tests/Avalonia.Styling.UnitTests", parameters, false); RunCoreTest("./tests/Avalonia.Visuals.UnitTests", parameters, false); - if(parameters.IsRunningOnWindows) - RunCoreTest("./tests/Avalonia.RenderTests/Avalonia.Skia.RenderTests.csproj", parameters, true); }); -Task("Run-Unit-Tests") - .IsDependentOn("Run-Net-Core-Unit-Tests") +Task("Run-Render-Tests") .IsDependentOn("Build") - //.IsDependentOn("Run-Leak-Tests") - .WithCriteria(() => !parameters.SkipTests) + .WithCriteria(() => !parameters.SkipTests && parameters.IsRunningOnWindows) + .Does(() => { + RunCoreTest("./tests/Avalonia.RenderTests/Avalonia.Skia.RenderTests.csproj", parameters, true); + RunCoreTest("./tests/Avalonia.RenderTests/Avalonia.Direct2D1.RenderTests.csproj", parameters, true); + }) + +Task("Run-Designer-Unit-Tests") + .IsDependentOn("Build") + .WithCriteria(() => !parameters.SkipTests && parameters.IsRunningOnWindows) .Does(() => { - if(!parameters.IsRunningOnWindows) - return; - - var unitTests = GetDirectories("./tests/Avalonia.*.UnitTests") - .Select(dir => System.IO.Path.GetFileName(dir.FullPath)) - .Where( name => !name.Contains("Skia")) // Run in the Run-Net-Core-Unit-Tests target - .Where(name => parameters.IsRunningOnWindows ? true : !name.Contains("Direct2D")) - .Select(name => MakeAbsolute(File("./tests/" + name + "/bin/" + parameters.DirSuffix + "/" + name + ".dll"))) - .ToList(); - - var toolPath = (parameters.IsPlatformAnyCPU || parameters.IsPlatformX86) ? - Context.Tools.Resolve("xunit.console.x86.exe") : - Context.Tools.Resolve("xunit.console.exe"); - - var xUnitSettings = new XUnit2Settings - { - ToolPath = toolPath, - Parallelism = ParallelismOption.None, - ShadowCopy = false - }; - - xUnitSettings.NoAppDomain = !parameters.IsRunningOnWindows; - - foreach(var test in unitTests.Where(testFile => FileExists(testFile))) - { - CopyDirectory(test.GetDirectory(), parameters.TestsRoot); - } - - var testsInDirectoryToRun = new List(); - if(parameters.IsRunningOnWindows) - { - testsInDirectoryToRun.AddRange(GetFiles("./artifacts/tests/*Tests.dll")); - } - else - { - testsInDirectoryToRun.AddRange(GetFiles("./artifacts/tests/*.UnitTests.dll")); - } - - XUnit2(testsInDirectoryToRun, xUnitSettings); + XUnit2(GetFiles("./artifacts/designer-tests/Avalonia.DesignerSupport.Tests.csproj"), xUnitSettings); }); Task("Copy-Files") @@ -427,7 +396,7 @@ Task("Default").Does(() => if(parameters.IsRunningOnWindows) RunTarget("Package"); else - RunTarget("Run-Net-Core-Unit-Tests"); + RunTarget("Run-Unit-Tests"); }); Task("AppVeyor") .IsDependentOn("Zip-Files") @@ -435,7 +404,7 @@ Task("AppVeyor") .IsDependentOn("Publish-NuGet"); Task("Travis") - .IsDependentOn("Run-Net-Core-Unit-Tests"); + .IsDependentOn("Run-Unit-Tests"); /////////////////////////////////////////////////////////////////////////////// // EXECUTE diff --git a/src/Android/Avalonia.Android/Resources/Resource.Designer.cs b/src/Android/Avalonia.Android/Resources/Resource.Designer.cs index e66c2800d3..80cbbc51ec 100644 --- a/src/Android/Avalonia.Android/Resources/Resource.Designer.cs +++ b/src/Android/Avalonia.Android/Resources/Resource.Designer.cs @@ -40,14 +40,11 @@ namespace Avalonia.Android public partial class String { - // aapt resource value: 0x7f020002 - public static int ApplicationName = 2130837506; - // aapt resource value: 0x7f020001 - public static int Hello = 2130837505; + public static int ApplicationName = 2130837505; // aapt resource value: 0x7f020000 - public static int library_name = 2130837504; + public static int Hello = 2130837504; static String() { diff --git a/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj b/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj index eaae82316e..fbbd5f0b28 100644 --- a/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj +++ b/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj @@ -13,13 +13,13 @@ 512 true + ..\..\artifacts\designer-tests\ AnyCPU true full false - ..\..\artifacts\tests\ DEBUG;TRACE prompt 4 @@ -28,7 +28,6 @@ AnyCPU pdbonly true - ..\..\artifacts\tests\ TRACE prompt 4 diff --git a/tests/Avalonia.DesignerSupport.Tests/Avalonia.DesignerSupport.Tests.csproj b/tests/Avalonia.DesignerSupport.Tests/Avalonia.DesignerSupport.Tests.csproj index bc9a4b3e29..4ce24e1d4c 100644 --- a/tests/Avalonia.DesignerSupport.Tests/Avalonia.DesignerSupport.Tests.csproj +++ b/tests/Avalonia.DesignerSupport.Tests/Avalonia.DesignerSupport.Tests.csproj @@ -12,12 +12,12 @@ v4.7 512 + ..\..\artifacts\designer-tests\ true full false - ..\..\artifacts\tests\ DEBUG;TRACE prompt 4 @@ -25,7 +25,6 @@ pdbonly true - ..\..\artifacts\tests\ TRACE prompt 4 diff --git a/tests/Avalonia.RenderTests/Avalonia.Direct2D1.RenderTests.csproj b/tests/Avalonia.RenderTests/Avalonia.Direct2D1.RenderTests.csproj index 03f5233546..6af8fd8963 100644 --- a/tests/Avalonia.RenderTests/Avalonia.Direct2D1.RenderTests.csproj +++ b/tests/Avalonia.RenderTests/Avalonia.Direct2D1.RenderTests.csproj @@ -1,106 +1,39 @@ - - + - Debug - AnyCPU - {DABFD304-D6A4-4752-8123-C2CCF7AC7831} - Library - Properties - Avalonia.Direct2D1.RenderTests - Avalonia.Direct2D1.RenderTests - v4.7 - 512 - - - - true - full - false - ..\..\artifacts\tests\ - DEBUG;TRACE - prompt - 4 - CS1591 + obj-Direct2D1 - - pdbonly - true - ..\..\artifacts\tests\ - TRACE - prompt - 4 + + + netcoreapp2.0 + bin\Direct2D\$(Configuration) + false + False + $(DefineConstants);AVALONIA_DIRECT2D + Library - - - - - - {D211E587-D8BC-45B9-95A4-F297C8FA5200} - Avalonia.Animation - - - {B09B78D8-9B26-48B0-9149-D64A2F120F3F} - Avalonia.Base - - - {D2221C82-4A25-4583-9B43-D791E3F6820C} - Avalonia.Controls - - - {3E908F67-5543-4879-A1DC-08EACE79B3CD} - Avalonia.Direct2D1 - - - {62024B2D-53EB-4638-B26B-85EEAA54866E} - Avalonia.Input - - - {6B0ED19D-A08B-461C-A9D9-A9EE40B0C06B} - Avalonia.Interactivity - - - {42472427-4774-4C81-8AFF-9F27B8E31721} - Avalonia.Layout - - - {EB582467-6ABB-43A1-B052-E981BA910E3A} - Avalonia.Visuals - - - {F1BAA01A-F176-4C6A-B39D-5B40BB1B148F} - Avalonia.Styling - - - - + + - - 4.3.0 - + + + + + + + + + + + + + + + + - - - - - False - - - False - - - False - - - False - - - - - - - + \ No newline at end of file diff --git a/tests/Avalonia.RenderTests/TestBase.cs b/tests/Avalonia.RenderTests/TestBase.cs index 84860eefdb..dd6fcb1c06 100644 --- a/tests/Avalonia.RenderTests/TestBase.cs +++ b/tests/Avalonia.RenderTests/TestBase.cs @@ -46,9 +46,7 @@ namespace Avalonia.Direct2D1.RenderTests public TestBase(string outputPath) { -#if AVALONIA_CAIRO - string testFiles = Path.GetFullPath(@"..\..\tests\TestFiles\Cairo"); -#elif AVALONIA_SKIA +#if AVALONIA_SKIA string testFiles = Path.GetFullPath(@"..\..\..\..\..\TestFiles\Skia"); #else string testFiles = Path.GetFullPath(@"..\..\tests\TestFiles\Direct2D1"); From 4d9b354d1c36dde7283906205885f2d4b38e80f8 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Wed, 20 Dec 2017 21:06:00 -0600 Subject: [PATCH 34/49] Fix cleaned tests-dir. --- build.cake | 2 +- parameters.cake | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.cake b/build.cake index d321109a1e..46dd84d8b6 100644 --- a/build.cake +++ b/build.cake @@ -93,7 +93,7 @@ Task("Clean") CleanDirectory(parameters.NugetRoot); CleanDirectory(parameters.ZipRoot); CleanDirectory(parameters.BinRoot); - CleanDirectory(parameters.TestsRoot); + CleanDirectory(parameters.DesignerTestsRoot); }); Task("Restore-NuGet-Packages") diff --git a/parameters.cake b/parameters.cake index 7406618763..c727b3107f 100644 --- a/parameters.cake +++ b/parameters.cake @@ -30,7 +30,7 @@ public class Parameters public DirectoryPath NugetRoot { get; private set; } public DirectoryPath ZipRoot { get; private set; } public DirectoryPath BinRoot { get; private set; } - public DirectoryPath TestsRoot { get; private set; } + public DirectoryPath DesignerTestsRoot { get; private set; } public string DirSuffix { get; private set; } public string DirSuffixIOS { get; private set; } public DirectoryPathCollection BuildDirs { get; private set; } @@ -106,7 +106,7 @@ public class Parameters NugetRoot = ArtifactsDir.Combine("nuget"); ZipRoot = ArtifactsDir.Combine("zip"); BinRoot = ArtifactsDir.Combine("bin"); - TestsRoot = ArtifactsDir.Combine("tests"); + DesignerTestsRoot = ArtifactsDir.Combine("designer-tests"); BuildDirs = context.GetDirectories("**/bin") + context.GetDirectories("**/obj"); From ba95a9398dbebc460b358eda6dab3a124578ceb8 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Wed, 20 Dec 2017 21:07:32 -0600 Subject: [PATCH 35/49] Add missing close paren in build script. --- build.cake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.cake b/build.cake index 46dd84d8b6..f59a68aee0 100644 --- a/build.cake +++ b/build.cake @@ -201,7 +201,7 @@ Task("Run-Render-Tests") .Does(() => { RunCoreTest("./tests/Avalonia.RenderTests/Avalonia.Skia.RenderTests.csproj", parameters, true); RunCoreTest("./tests/Avalonia.RenderTests/Avalonia.Direct2D1.RenderTests.csproj", parameters, true); - }) + }); Task("Run-Designer-Unit-Tests") .IsDependentOn("Build") From 5b8f906b1ee94b7db7e7dea641532bc94ef100bf Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Wed, 20 Dec 2017 21:10:43 -0600 Subject: [PATCH 36/49] Add back xunit settings. --- build.cake | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/build.cake b/build.cake index f59a68aee0..f14ac20958 100644 --- a/build.cake +++ b/build.cake @@ -208,6 +208,13 @@ Task("Run-Designer-Unit-Tests") .WithCriteria(() => !parameters.SkipTests && parameters.IsRunningOnWindows) .Does(() => { + var xUnitSettings = new XUnit2Settings + { + ToolPath = toolPath, + Parallelism = ParallelismOption.None, + ShadowCopy = false, + }; + XUnit2(GetFiles("./artifacts/designer-tests/Avalonia.DesignerSupport.Tests.csproj"), xUnitSettings); }); From b502f48ff84116db413d2cdb3e52ad96bbdf7326 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Wed, 20 Dec 2017 21:14:41 -0600 Subject: [PATCH 37/49] Make sure Direct2D1 Unit tests (non-render tests) run in the build. --- build.cake | 4 + .../Avalonia.Direct2D1.UnitTests.csproj | 107 +++--------------- 2 files changed, 21 insertions(+), 90 deletions(-) diff --git a/build.cake b/build.cake index f14ac20958..ca969d7fa8 100644 --- a/build.cake +++ b/build.cake @@ -193,6 +193,10 @@ Task("Run-Unit-Tests") RunCoreTest("./tests/Avalonia.Markup.Xaml.UnitTests", parameters, false); RunCoreTest("./tests/Avalonia.Styling.UnitTests", parameters, false); RunCoreTest("./tests/Avalonia.Visuals.UnitTests", parameters, false); + if (parameters.IsRunningOnWindows) + { + RunCoreTest("./tests/Avalonia.Direct2D1.UnitTests", parameters, false); + } }); Task("Run-Render-Tests") diff --git a/tests/Avalonia.Direct2D1.UnitTests/Avalonia.Direct2D1.UnitTests.csproj b/tests/Avalonia.Direct2D1.UnitTests/Avalonia.Direct2D1.UnitTests.csproj index 303ebed001..f6b5d11af1 100644 --- a/tests/Avalonia.Direct2D1.UnitTests/Avalonia.Direct2D1.UnitTests.csproj +++ b/tests/Avalonia.Direct2D1.UnitTests/Avalonia.Direct2D1.UnitTests.csproj @@ -1,95 +1,22 @@ - - - + - Debug - AnyCPU - {EFB11458-9CDF-41C0-BE4F-44AF45A4CAB8} - Library - Properties - Avalonia.Direct2D1.UnitTests - Avalonia.Direct2D1.UnitTests - v4.7 - 512 - + net47;netcoreapp2.0 - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - {D211E587-D8BC-45B9-95A4-F297C8FA5200} - Avalonia.Animation - - - {B09B78D8-9B26-48B0-9149-D64A2F120F3F} - Avalonia.Base - - - {D2221C82-4A25-4583-9B43-D791E3F6820C} - Avalonia.Controls - - - {62024B2D-53EB-4638-B26B-85EEAA54866E} - Avalonia.Input - - - {6B0ED19D-A08B-461C-A9D9-A9EE40B0C06B} - Avalonia.Interactivity - - - {42472427-4774-4C81-8AFF-9F27B8E31721} - Avalonia.Layout - - - {EB582467-6ABB-43A1-B052-E981BA910E3A} - Avalonia.Visuals - - - {F1BAA01A-F176-4C6A-B39D-5B40BB1B148F} - Avalonia.Styling - - - {3E908F67-5543-4879-A1DC-08EACE79B3CD} - Avalonia.Direct2D1 - - - - - + + + + + - + + + + + + + + + + - - \ No newline at end of file From fb8d2daa8ab6358c19ce719cf39ded13d18bfc5b Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Wed, 20 Dec 2017 21:16:10 -0600 Subject: [PATCH 38/49] Add back toolPath. --- build.cake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build.cake b/build.cake index ca969d7fa8..7d612fcdea 100644 --- a/build.cake +++ b/build.cake @@ -195,7 +195,7 @@ Task("Run-Unit-Tests") RunCoreTest("./tests/Avalonia.Visuals.UnitTests", parameters, false); if (parameters.IsRunningOnWindows) { - RunCoreTest("./tests/Avalonia.Direct2D1.UnitTests", parameters, false); + RunCoreTest("./tests/Avalonia.Direct2D1.UnitTests", parameters, true); } }); @@ -212,6 +212,10 @@ Task("Run-Designer-Unit-Tests") .WithCriteria(() => !parameters.SkipTests && parameters.IsRunningOnWindows) .Does(() => { + var toolPath = (parameters.IsPlatformAnyCPU || parameters.IsPlatformX86) ? + Context.Tools.Resolve("xunit.console.x86.exe") : + Context.Tools.Resolve("xunit.console.exe"); + var xUnitSettings = new XUnit2Settings { ToolPath = toolPath, From 1c12cd4bd6cb2cd887065720094c5bbf60d66495 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Wed, 20 Dec 2017 23:31:33 -0600 Subject: [PATCH 39/49] Fix x64 builds of Avaloina.Direct2D1. Refactor build scripts to reduce time and fix issues. --- .gitignore | 2 ++ build.cake | 14 ++++---------- build/Unsafe.props | 5 +++++ packages.cake | 4 +++- .../Resources/Resource.Designer.cs | 7 +++++-- .../Avalonia.Direct2D1/Avalonia.Direct2D1.csproj | 2 ++ .../FramebufferShimRenderTarget.cs | 12 ++++++++---- .../Media/Imaging/WicBitmapImpl.cs | 10 ++++++++-- .../Avalonia.Win32/Interop/UnmanagedMethods.cs | 5 +---- tests/Avalonia.RenderTests/TestBase.cs | 7 ++++--- 10 files changed, 42 insertions(+), 26 deletions(-) create mode 100644 build/Unsafe.props diff --git a/.gitignore b/.gitignore index e67d986a8a..a9a8fd36b4 100644 --- a/.gitignore +++ b/.gitignore @@ -176,3 +176,5 @@ nuget Avalonia.XBuild.sln project.lock.json .idea/* +**/obj-Skia/* +**/obj-Direct2D1/* diff --git a/build.cake b/build.cake index 7d612fcdea..61fda13695 100644 --- a/build.cake +++ b/build.cake @@ -124,14 +124,9 @@ Task("Restore-NuGet-Packages") void DotNetCoreBuild() { - DotNetCoreRestore("samples\\ControlCatalog.NetCore"); - DotNetBuild("samples\\ControlCatalog.NetCore"); + DotNetCoreBuild("samples\\ControlCatalog.NetCore"); } -Task("DotNetCoreBuild") - .IsDependentOn("Clean") - .Does(() => DotNetCoreBuild()); - Task("Build") .IsDependentOn("Restore-NuGet-Packages") .Does(() => @@ -140,9 +135,9 @@ Task("Build") { MSBuild(parameters.MSBuildSolution, settings => { settings.SetConfiguration(parameters.Configuration); + settings.SetVerbosity(Verbosity.Minimal); settings.WithProperty("Platform", "\"" + parameters.Platform + "\""); settings.WithProperty("UseRoslynPathHack", "true"); - settings.SetVerbosity(Verbosity.Minimal); settings.UseToolVersion(MSBuildToolVersion.VS2017); settings.WithProperty("Windows", "True"); settings.SetNodeReuse(false); @@ -160,7 +155,6 @@ void RunCoreTest(string project, Parameters parameters, bool coreOnly = false) if(!project.EndsWith(".csproj")) project = System.IO.Path.Combine(project, System.IO.Path.GetFileName(project)+".csproj"); Information("Running tests from " + project); - DotNetCoreRestore(project); var frameworks = new List(){"netcoreapp2.0"}; if(parameters.IsRunningOnWindows) frameworks.Add("net47"); @@ -215,7 +209,7 @@ Task("Run-Designer-Unit-Tests") var toolPath = (parameters.IsPlatformAnyCPU || parameters.IsPlatformX86) ? Context.Tools.Resolve("xunit.console.x86.exe") : Context.Tools.Resolve("xunit.console.exe"); - + var xUnitSettings = new XUnit2Settings { ToolPath = toolPath, @@ -223,7 +217,7 @@ Task("Run-Designer-Unit-Tests") ShadowCopy = false, }; - XUnit2(GetFiles("./artifacts/designer-tests/Avalonia.DesignerSupport.Tests.csproj"), xUnitSettings); + XUnit2("./artifacts/designer-tests/Avalonia.DesignerSupport.Tests.dll", xUnitSettings); }); Task("Copy-Files") diff --git a/build/Unsafe.props b/build/Unsafe.props new file mode 100644 index 0000000000..db96658bdd --- /dev/null +++ b/build/Unsafe.props @@ -0,0 +1,5 @@ + + + + + diff --git a/packages.cake b/packages.cake index bc290fce22..3c2f76205c 100644 --- a/packages.cake +++ b/packages.cake @@ -120,6 +120,7 @@ public class Packages var SharpDXDirect3D11Version = packageVersions["SharpDX.Direct3D11"].FirstOrDefault().Item1; var SharpDXDirect3D9Version = packageVersions["SharpDX.Direct3D9"].FirstOrDefault().Item1; var SharpDXDXGIVersion = packageVersions["SharpDX.DXGI"].FirstOrDefault().Item1; + var UnsafeVersion = packageVersions["System.Runtime.CompilerServices.Unsafe"].FirstOrDefault().Item1; context.Information("Package: Serilog, version: {0}", SerilogVersion); context.Information("Package: Sprache, version: {0}", SpracheVersion); @@ -394,7 +395,8 @@ public class Packages new NuSpecDependency() { Id = "SharpDX", Version = SharpDXVersion }, new NuSpecDependency() { Id = "SharpDX.Direct2D1", Version = SharpDXDirect2D1Version }, new NuSpecDependency() { Id = "SharpDX.Direct3D11", Version = SharpDXDirect3D11Version }, - new NuSpecDependency() { Id = "SharpDX.DXGI", Version = SharpDXDXGIVersion } + new NuSpecDependency() { Id = "SharpDX.DXGI", Version = SharpDXDXGIVersion }, + new NuSpecDependency() { Id = "System.Runtime.CompilerServices.Unsafe", Version = UnsafeVersion } }, Files = new [] { diff --git a/src/Android/Avalonia.Android/Resources/Resource.Designer.cs b/src/Android/Avalonia.Android/Resources/Resource.Designer.cs index 80cbbc51ec..e66c2800d3 100644 --- a/src/Android/Avalonia.Android/Resources/Resource.Designer.cs +++ b/src/Android/Avalonia.Android/Resources/Resource.Designer.cs @@ -40,11 +40,14 @@ namespace Avalonia.Android public partial class String { + // aapt resource value: 0x7f020002 + public static int ApplicationName = 2130837506; + // aapt resource value: 0x7f020001 - public static int ApplicationName = 2130837505; + public static int Hello = 2130837505; // aapt resource value: 0x7f020000 - public static int Hello = 2130837504; + public static int library_name = 2130837504; static String() { diff --git a/src/Windows/Avalonia.Direct2D1/Avalonia.Direct2D1.csproj b/src/Windows/Avalonia.Direct2D1/Avalonia.Direct2D1.csproj index a84c373886..2b9ce5466b 100644 --- a/src/Windows/Avalonia.Direct2D1/Avalonia.Direct2D1.csproj +++ b/src/Windows/Avalonia.Direct2D1/Avalonia.Direct2D1.csproj @@ -2,6 +2,7 @@ netstandard2.0 false + true @@ -25,4 +26,5 @@ + \ No newline at end of file diff --git a/src/Windows/Avalonia.Direct2D1/FramebufferShimRenderTarget.cs b/src/Windows/Avalonia.Direct2D1/FramebufferShimRenderTarget.cs index 83bd4d2957..dbba7271e2 100644 --- a/src/Windows/Avalonia.Direct2D1/FramebufferShimRenderTarget.cs +++ b/src/Windows/Avalonia.Direct2D1/FramebufferShimRenderTarget.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Runtime.CompilerServices; using System.Text; using Avalonia.Controls.Platform.Surfaces; using Avalonia.Direct2D1.Media; @@ -67,10 +68,13 @@ namespace Avalonia.Direct2D1 { for (var y = 0; y < _target.Height; y++) { - UnmanagedMethods.CopyMemory( - _target.Address + _target.RowBytes * y, - l.Data.DataPointer + l.Stride * y, - (uint) Math.Min(l.Stride, _target.RowBytes)); + unsafe + { + Unsafe.CopyBlock( + (void*)(_target.Address + _target.RowBytes * y), + (void*)(l.Data.DataPointer + l.Stride * y), + (uint)Math.Min(l.Stride, _target.RowBytes)); + } } } Dispose(); diff --git a/src/Windows/Avalonia.Direct2D1/Media/Imaging/WicBitmapImpl.cs b/src/Windows/Avalonia.Direct2D1/Media/Imaging/WicBitmapImpl.cs index 9b99b4c40a..540810f13c 100644 --- a/src/Windows/Avalonia.Direct2D1/Media/Imaging/WicBitmapImpl.cs +++ b/src/Windows/Avalonia.Direct2D1/Media/Imaging/WicBitmapImpl.cs @@ -3,6 +3,7 @@ using System; using System.IO; +using System.Runtime.CompilerServices; using Avalonia.Win32.Interop; using SharpDX.WIC; using APixelFormat = Avalonia.Platform.PixelFormat; @@ -74,8 +75,13 @@ namespace Avalonia.Direct2D1.Media { for (var row = 0; row < height; row++) { - UnmanagedMethods.CopyMemory(new IntPtr(l.Data.DataPointer.ToInt64() + row * l.Stride), - new IntPtr(data.ToInt64() + row * stride), (uint) l.Data.Pitch); + unsafe + { + Unsafe.CopyBlock( + (void*)(l.Data.DataPointer + row * l.Stride), + (void*)(data + row * stride), + (uint) l.Data.Pitch); + } } } } diff --git a/src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs b/src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs index fb4aefbf36..bc81010377 100644 --- a/src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs +++ b/src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs @@ -947,10 +947,7 @@ namespace Avalonia.Win32.Interop uint dwMaximumSizeHigh, uint dwMaximumSizeLow, string lpName); - - [DllImport("kernel32.dll", EntryPoint = "CopyMemory", SetLastError = false)] - public static extern void CopyMemory(IntPtr dest, IntPtr src, uint count); - + public enum MONITOR { MONITOR_DEFAULTTONULL = 0x00000000, diff --git a/tests/Avalonia.RenderTests/TestBase.cs b/tests/Avalonia.RenderTests/TestBase.cs index dd6fcb1c06..cf38ef3818 100644 --- a/tests/Avalonia.RenderTests/TestBase.cs +++ b/tests/Avalonia.RenderTests/TestBase.cs @@ -46,12 +46,13 @@ namespace Avalonia.Direct2D1.RenderTests public TestBase(string outputPath) { + var testFiles = Path.GetFullPath(@"..\..\..\..\..\TestFiles\"); #if AVALONIA_SKIA - string testFiles = Path.GetFullPath(@"..\..\..\..\..\TestFiles\Skia"); + var platform = "Skia"; #else - string testFiles = Path.GetFullPath(@"..\..\tests\TestFiles\Direct2D1"); + var platform = "Direct2D1"; #endif - OutputPath = Path.Combine(testFiles, outputPath); + OutputPath = Path.Combine(testFiles, platform, outputPath); threadingInterface.MainThread = Thread.CurrentThread; } From e462e0619348c3e4a949b8499b0c5c5aa82da16d Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Sat, 23 Dec 2017 13:51:11 -0600 Subject: [PATCH 40/49] Use memcpy instead of System.Runtime.CompilerServices.Unsafe --- build/Unsafe.props | 5 ----- packages.cake | 4 +--- .../Avalonia.Android/Resources/Resource.Designer.cs | 7 ++----- .../Avalonia.Direct2D1/Avalonia.Direct2D1.csproj | 2 -- .../Avalonia.Direct2D1/FramebufferShimRenderTarget.cs | 11 ++++------- .../Avalonia.Direct2D1/Media/Imaging/WicBitmapImpl.cs | 11 ++++------- .../Avalonia.Win32/Interop/UnmanagedMethods.cs | 3 +++ 7 files changed, 14 insertions(+), 29 deletions(-) delete mode 100644 build/Unsafe.props diff --git a/build/Unsafe.props b/build/Unsafe.props deleted file mode 100644 index db96658bdd..0000000000 --- a/build/Unsafe.props +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/packages.cake b/packages.cake index 3c2f76205c..bc290fce22 100644 --- a/packages.cake +++ b/packages.cake @@ -120,7 +120,6 @@ public class Packages var SharpDXDirect3D11Version = packageVersions["SharpDX.Direct3D11"].FirstOrDefault().Item1; var SharpDXDirect3D9Version = packageVersions["SharpDX.Direct3D9"].FirstOrDefault().Item1; var SharpDXDXGIVersion = packageVersions["SharpDX.DXGI"].FirstOrDefault().Item1; - var UnsafeVersion = packageVersions["System.Runtime.CompilerServices.Unsafe"].FirstOrDefault().Item1; context.Information("Package: Serilog, version: {0}", SerilogVersion); context.Information("Package: Sprache, version: {0}", SpracheVersion); @@ -395,8 +394,7 @@ public class Packages new NuSpecDependency() { Id = "SharpDX", Version = SharpDXVersion }, new NuSpecDependency() { Id = "SharpDX.Direct2D1", Version = SharpDXDirect2D1Version }, new NuSpecDependency() { Id = "SharpDX.Direct3D11", Version = SharpDXDirect3D11Version }, - new NuSpecDependency() { Id = "SharpDX.DXGI", Version = SharpDXDXGIVersion }, - new NuSpecDependency() { Id = "System.Runtime.CompilerServices.Unsafe", Version = UnsafeVersion } + new NuSpecDependency() { Id = "SharpDX.DXGI", Version = SharpDXDXGIVersion } }, Files = new [] { diff --git a/src/Android/Avalonia.Android/Resources/Resource.Designer.cs b/src/Android/Avalonia.Android/Resources/Resource.Designer.cs index e66c2800d3..80cbbc51ec 100644 --- a/src/Android/Avalonia.Android/Resources/Resource.Designer.cs +++ b/src/Android/Avalonia.Android/Resources/Resource.Designer.cs @@ -40,14 +40,11 @@ namespace Avalonia.Android public partial class String { - // aapt resource value: 0x7f020002 - public static int ApplicationName = 2130837506; - // aapt resource value: 0x7f020001 - public static int Hello = 2130837505; + public static int ApplicationName = 2130837505; // aapt resource value: 0x7f020000 - public static int library_name = 2130837504; + public static int Hello = 2130837504; static String() { diff --git a/src/Windows/Avalonia.Direct2D1/Avalonia.Direct2D1.csproj b/src/Windows/Avalonia.Direct2D1/Avalonia.Direct2D1.csproj index 2b9ce5466b..a84c373886 100644 --- a/src/Windows/Avalonia.Direct2D1/Avalonia.Direct2D1.csproj +++ b/src/Windows/Avalonia.Direct2D1/Avalonia.Direct2D1.csproj @@ -2,7 +2,6 @@ netstandard2.0 false - true @@ -26,5 +25,4 @@ - \ No newline at end of file diff --git a/src/Windows/Avalonia.Direct2D1/FramebufferShimRenderTarget.cs b/src/Windows/Avalonia.Direct2D1/FramebufferShimRenderTarget.cs index dbba7271e2..523cfeed46 100644 --- a/src/Windows/Avalonia.Direct2D1/FramebufferShimRenderTarget.cs +++ b/src/Windows/Avalonia.Direct2D1/FramebufferShimRenderTarget.cs @@ -68,13 +68,10 @@ namespace Avalonia.Direct2D1 { for (var y = 0; y < _target.Height; y++) { - unsafe - { - Unsafe.CopyBlock( - (void*)(_target.Address + _target.RowBytes * y), - (void*)(l.Data.DataPointer + l.Stride * y), - (uint)Math.Min(l.Stride, _target.RowBytes)); - } + UnmanagedMethods.CopyMemory( + (_target.Address + _target.RowBytes * y), + (l.Data.DataPointer + l.Stride * y), + (UIntPtr)Math.Min(l.Stride, _target.RowBytes)); } } Dispose(); diff --git a/src/Windows/Avalonia.Direct2D1/Media/Imaging/WicBitmapImpl.cs b/src/Windows/Avalonia.Direct2D1/Media/Imaging/WicBitmapImpl.cs index 540810f13c..371dfcfc3e 100644 --- a/src/Windows/Avalonia.Direct2D1/Media/Imaging/WicBitmapImpl.cs +++ b/src/Windows/Avalonia.Direct2D1/Media/Imaging/WicBitmapImpl.cs @@ -75,13 +75,10 @@ namespace Avalonia.Direct2D1.Media { for (var row = 0; row < height; row++) { - unsafe - { - Unsafe.CopyBlock( - (void*)(l.Data.DataPointer + row * l.Stride), - (void*)(data + row * stride), - (uint) l.Data.Pitch); - } + UnmanagedMethods.CopyMemory( + (l.Data.DataPointer + row * l.Stride), + (data + row * stride), + (UIntPtr) l.Data.Pitch); } } } diff --git a/src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs b/src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs index bc81010377..a0518cf92e 100644 --- a/src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs +++ b/src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs @@ -947,6 +947,9 @@ namespace Avalonia.Win32.Interop uint dwMaximumSizeHigh, uint dwMaximumSizeLow, string lpName); + + [DllImport("msvcrt.dll", EntryPoint="memcpy", SetLastError = false, CallingConvention=CallingConvention.Cdecl)] + public static extern IntPtr CopyMemory(IntPtr dest, IntPtr src, UIntPtr count); public enum MONITOR { From 60a04fbd24e1d90f721d82481b6aaefe9d3ede1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Pedro?= Date: Sun, 31 Dec 2017 19:33:04 +0000 Subject: [PATCH 41/49] Fixed ToggleButton.IsChecked default value. --- src/Avalonia.Controls/Primitives/ToggleButton.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Avalonia.Controls/Primitives/ToggleButton.cs b/src/Avalonia.Controls/Primitives/ToggleButton.cs index 7d500975f0..dc9b70ab8c 100644 --- a/src/Avalonia.Controls/Primitives/ToggleButton.cs +++ b/src/Avalonia.Controls/Primitives/ToggleButton.cs @@ -14,6 +14,7 @@ namespace Avalonia.Controls.Primitives nameof(IsChecked), o => o.IsChecked, (o, v) => o.IsChecked = v, + unsetValue: false, defaultBindingMode: BindingMode.TwoWay); public static readonly StyledProperty IsThreeStateProperty = From 7cccc6bda01d47d2d26bfbcd27806740d1dad90d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Pedro?= Date: Mon, 1 Jan 2018 21:51:55 +0000 Subject: [PATCH 42/49] Use nameof where possible. --- src/Avalonia.Controls/Carousel.cs | 2 +- src/Avalonia.Controls/ColumnDefinition.cs | 6 +++--- src/Avalonia.Controls/DropDown.cs | 2 +- .../Primitives/HeaderedContentControl.cs | 2 +- .../Primitives/TemplatedControl.cs | 2 +- src/Avalonia.Controls/Primitives/Thumb.cs | 6 +++--- src/Avalonia.Controls/RowDefinition.cs | 6 +++--- src/Avalonia.Controls/Shapes/Line.cs | 4 ++-- src/Avalonia.Controls/Shapes/Path.cs | 2 +- src/Avalonia.Controls/Shapes/Shape.cs | 8 ++++---- src/Avalonia.Controls/TextBox.cs | 10 +++++----- .../Views/ControlDetailsView.cs | 2 +- src/Avalonia.HtmlRenderer/HtmlControl.cs | 16 ++++++++-------- src/Avalonia.Input/InputElement.cs | 18 +++++++++--------- src/Avalonia.Input/KeyBinding.cs | 6 +++--- src/Avalonia.Visuals/Media/Geometry.cs | 2 +- src/Avalonia.Visuals/Media/ImageBrush.cs | 2 +- src/Avalonia.Visuals/Media/MatrixTransform.cs | 2 +- src/Avalonia.Visuals/Media/RotateTransform.cs | 2 +- .../Media/TranslateTransform.cs | 4 ++-- src/Avalonia.Visuals/Media/VisualBrush.cs | 2 +- .../AvaloniaObjectTests_Direct.cs | 6 +++--- .../AvaloniaObjectTests_GetSubject.cs | 2 +- .../DirectPropertyTests.cs | 2 +- ...ExpressionObserverTests_AttachedProperty.cs | 2 +- .../Data/BindingTests.cs | 2 +- .../Xaml/NonControl.cs | 6 +++--- tests/Avalonia.Styling.UnitTests/StyleTests.cs | 2 +- 28 files changed, 64 insertions(+), 64 deletions(-) diff --git a/src/Avalonia.Controls/Carousel.cs b/src/Avalonia.Controls/Carousel.cs index 71446c627f..e7c934091a 100644 --- a/src/Avalonia.Controls/Carousel.cs +++ b/src/Avalonia.Controls/Carousel.cs @@ -24,7 +24,7 @@ namespace Avalonia.Controls /// Defines the property. /// public static readonly StyledProperty TransitionProperty = - AvaloniaProperty.Register("Transition"); + AvaloniaProperty.Register(nameof(Transition)); /// /// The default value of for diff --git a/src/Avalonia.Controls/ColumnDefinition.cs b/src/Avalonia.Controls/ColumnDefinition.cs index 36fadd0f05..a6b34f8a16 100644 --- a/src/Avalonia.Controls/ColumnDefinition.cs +++ b/src/Avalonia.Controls/ColumnDefinition.cs @@ -12,19 +12,19 @@ namespace Avalonia.Controls /// Defines the property. /// public static readonly StyledProperty MaxWidthProperty = - AvaloniaProperty.Register("MaxWidth", double.PositiveInfinity); + AvaloniaProperty.Register(nameof(MaxWidth), double.PositiveInfinity); /// /// Defines the property. /// public static readonly StyledProperty MinWidthProperty = - AvaloniaProperty.Register("MinWidth"); + AvaloniaProperty.Register(nameof(MinWidth)); /// /// Defines the property. /// public static readonly StyledProperty WidthProperty = - AvaloniaProperty.Register("Width", new GridLength(1, GridUnitType.Star)); + AvaloniaProperty.Register(nameof(Width), new GridLength(1, GridUnitType.Star)); /// /// Initializes a new instance of the class. diff --git a/src/Avalonia.Controls/DropDown.cs b/src/Avalonia.Controls/DropDown.cs index 6b27c479ba..a7ea2da4a4 100644 --- a/src/Avalonia.Controls/DropDown.cs +++ b/src/Avalonia.Controls/DropDown.cs @@ -38,7 +38,7 @@ namespace Avalonia.Controls /// Defines the property. /// public static readonly DirectProperty SelectionBoxItemProperty = - AvaloniaProperty.RegisterDirect("SelectionBoxItem", o => o.SelectionBoxItem); + AvaloniaProperty.RegisterDirect(nameof(SelectionBoxItem), o => o.SelectionBoxItem); private bool _isDropDownOpen; private Popup _popup; diff --git a/src/Avalonia.Controls/Primitives/HeaderedContentControl.cs b/src/Avalonia.Controls/Primitives/HeaderedContentControl.cs index a2de1fbf0e..d67ebfd489 100644 --- a/src/Avalonia.Controls/Primitives/HeaderedContentControl.cs +++ b/src/Avalonia.Controls/Primitives/HeaderedContentControl.cs @@ -12,7 +12,7 @@ namespace Avalonia.Controls.Primitives /// Defines the property. /// public static readonly StyledProperty HeaderProperty = - AvaloniaProperty.Register("Header"); + AvaloniaProperty.Register(nameof(Header)); /// /// Gets or sets the header content. diff --git a/src/Avalonia.Controls/Primitives/TemplatedControl.cs b/src/Avalonia.Controls/Primitives/TemplatedControl.cs index 1ddfb97c14..6deef7c7b9 100644 --- a/src/Avalonia.Controls/Primitives/TemplatedControl.cs +++ b/src/Avalonia.Controls/Primitives/TemplatedControl.cs @@ -75,7 +75,7 @@ namespace Avalonia.Controls.Primitives /// Defines the property. /// public static readonly StyledProperty TemplateProperty = - AvaloniaProperty.Register("Template"); + AvaloniaProperty.Register(nameof(Template)); /// /// Defines the IsTemplateFocusTarget attached property. diff --git a/src/Avalonia.Controls/Primitives/Thumb.cs b/src/Avalonia.Controls/Primitives/Thumb.cs index 065b1aedbe..da4dc63d1e 100644 --- a/src/Avalonia.Controls/Primitives/Thumb.cs +++ b/src/Avalonia.Controls/Primitives/Thumb.cs @@ -11,13 +11,13 @@ namespace Avalonia.Controls.Primitives public class Thumb : TemplatedControl { public static readonly RoutedEvent DragStartedEvent = - RoutedEvent.Register("DragStarted", RoutingStrategies.Bubble); + RoutedEvent.Register(nameof(DragStarted), RoutingStrategies.Bubble); public static readonly RoutedEvent DragDeltaEvent = - RoutedEvent.Register("DragDelta", RoutingStrategies.Bubble); + RoutedEvent.Register(nameof(DragDelta), RoutingStrategies.Bubble); public static readonly RoutedEvent DragCompletedEvent = - RoutedEvent.Register("DragCompleted", RoutingStrategies.Bubble); + RoutedEvent.Register(nameof(DragCompleted), RoutingStrategies.Bubble); private Point? _lastPoint; diff --git a/src/Avalonia.Controls/RowDefinition.cs b/src/Avalonia.Controls/RowDefinition.cs index 265cede17f..7307843417 100644 --- a/src/Avalonia.Controls/RowDefinition.cs +++ b/src/Avalonia.Controls/RowDefinition.cs @@ -12,19 +12,19 @@ namespace Avalonia.Controls /// Defines the property. /// public static readonly StyledProperty MaxHeightProperty = - AvaloniaProperty.Register("MaxHeight", double.PositiveInfinity); + AvaloniaProperty.Register(nameof(MaxHeight), double.PositiveInfinity); /// /// Defines the property. /// public static readonly StyledProperty MinHeightProperty = - AvaloniaProperty.Register("MinHeight"); + AvaloniaProperty.Register(nameof(MinHeight)); /// /// Defines the property. /// public static readonly StyledProperty HeightProperty = - AvaloniaProperty.Register("Height", new GridLength(1, GridUnitType.Star)); + AvaloniaProperty.Register(nameof(Height), new GridLength(1, GridUnitType.Star)); /// /// Initializes a new instance of the class. diff --git a/src/Avalonia.Controls/Shapes/Line.cs b/src/Avalonia.Controls/Shapes/Line.cs index 922597e5bf..b06fe40710 100644 --- a/src/Avalonia.Controls/Shapes/Line.cs +++ b/src/Avalonia.Controls/Shapes/Line.cs @@ -8,10 +8,10 @@ namespace Avalonia.Controls.Shapes public class Line : Shape { public static readonly StyledProperty StartPointProperty = - AvaloniaProperty.Register("StartPoint"); + AvaloniaProperty.Register(nameof(StartPoint)); public static readonly StyledProperty EndPointProperty = - AvaloniaProperty.Register("EndPoint"); + AvaloniaProperty.Register(nameof(EndPoint)); static Line() { diff --git a/src/Avalonia.Controls/Shapes/Path.cs b/src/Avalonia.Controls/Shapes/Path.cs index a337e7c6de..08bed79b3a 100644 --- a/src/Avalonia.Controls/Shapes/Path.cs +++ b/src/Avalonia.Controls/Shapes/Path.cs @@ -9,7 +9,7 @@ namespace Avalonia.Controls.Shapes public class Path : Shape { public static readonly StyledProperty DataProperty = - AvaloniaProperty.Register("Data"); + AvaloniaProperty.Register(nameof(Data)); static Path() { diff --git a/src/Avalonia.Controls/Shapes/Shape.cs b/src/Avalonia.Controls/Shapes/Shape.cs index 73b89ca4b7..2ea681891d 100644 --- a/src/Avalonia.Controls/Shapes/Shape.cs +++ b/src/Avalonia.Controls/Shapes/Shape.cs @@ -12,19 +12,19 @@ namespace Avalonia.Controls.Shapes public abstract class Shape : Control { public static readonly StyledProperty FillProperty = - AvaloniaProperty.Register("Fill"); + AvaloniaProperty.Register(nameof(Fill)); public static readonly StyledProperty StretchProperty = - AvaloniaProperty.Register("Stretch"); + AvaloniaProperty.Register(nameof(Stretch)); public static readonly StyledProperty StrokeProperty = - AvaloniaProperty.Register("Stroke"); + AvaloniaProperty.Register(nameof(Stroke)); public static readonly StyledProperty> StrokeDashArrayProperty = AvaloniaProperty.Register>("StrokeDashArray"); public static readonly StyledProperty StrokeThicknessProperty = - AvaloniaProperty.Register("StrokeThickness"); + AvaloniaProperty.Register(nameof(StrokeThickness)); private Matrix _transform = Matrix.Identity; private Geometry _definingGeometry; diff --git a/src/Avalonia.Controls/TextBox.cs b/src/Avalonia.Controls/TextBox.cs index 36ef8d05c3..1a663ed3b6 100644 --- a/src/Avalonia.Controls/TextBox.cs +++ b/src/Avalonia.Controls/TextBox.cs @@ -21,13 +21,13 @@ namespace Avalonia.Controls public class TextBox : TemplatedControl, UndoRedoHelper.IUndoRedoHost { public static readonly StyledProperty AcceptsReturnProperty = - AvaloniaProperty.Register("AcceptsReturn"); + AvaloniaProperty.Register(nameof(AcceptsReturn)); public static readonly StyledProperty AcceptsTabProperty = - AvaloniaProperty.Register("AcceptsTab"); + AvaloniaProperty.Register(nameof(AcceptsTab)); public static readonly DirectProperty CanScrollHorizontallyProperty = - AvaloniaProperty.RegisterDirect("CanScrollHorizontally", o => o.CanScrollHorizontally); + AvaloniaProperty.RegisterDirect(nameof(CanScrollHorizontally), o => o.CanScrollHorizontally); public static readonly DirectProperty CaretIndexProperty = AvaloniaProperty.RegisterDirect( @@ -69,10 +69,10 @@ namespace Avalonia.Controls TextBlock.TextWrappingProperty.AddOwner(); public static readonly StyledProperty WatermarkProperty = - AvaloniaProperty.Register("Watermark"); + AvaloniaProperty.Register(nameof(Watermark)); public static readonly StyledProperty UseFloatingWatermarkProperty = - AvaloniaProperty.Register("UseFloatingWatermark"); + AvaloniaProperty.Register(nameof(UseFloatingWatermark)); struct UndoRedoState : IEquatable { diff --git a/src/Avalonia.Diagnostics/Views/ControlDetailsView.cs b/src/Avalonia.Diagnostics/Views/ControlDetailsView.cs index e58818d31d..381b2e04b4 100644 --- a/src/Avalonia.Diagnostics/Views/ControlDetailsView.cs +++ b/src/Avalonia.Diagnostics/Views/ControlDetailsView.cs @@ -14,7 +14,7 @@ namespace Avalonia.Diagnostics.Views internal class ControlDetailsView : UserControl { private static readonly StyledProperty ViewModelProperty = - AvaloniaProperty.Register("ViewModel"); + AvaloniaProperty.Register(nameof(ViewModel)); private SimpleGrid _grid; public ControlDetailsView() diff --git a/src/Avalonia.HtmlRenderer/HtmlControl.cs b/src/Avalonia.HtmlRenderer/HtmlControl.cs index 0051f6427b..94b2d56f5f 100644 --- a/src/Avalonia.HtmlRenderer/HtmlControl.cs +++ b/src/Avalonia.HtmlRenderer/HtmlControl.cs @@ -74,29 +74,29 @@ namespace Avalonia.Controls.Html protected Point _lastScrollOffset; public static readonly AvaloniaProperty AvoidImagesLateLoadingProperty = - PropertyHelper.Register("AvoidImagesLateLoading", false, OnAvaloniaProperty_valueChanged); + PropertyHelper.Register(nameof(AvoidImagesLateLoading), false, OnAvaloniaProperty_valueChanged); public static readonly AvaloniaProperty IsSelectionEnabledProperty = - PropertyHelper.Register("IsSelectionEnabled", true, OnAvaloniaProperty_valueChanged); + PropertyHelper.Register(nameof(IsSelectionEnabled), true, OnAvaloniaProperty_valueChanged); public static readonly AvaloniaProperty IsContextMenuEnabledProperty = - PropertyHelper.Register("IsContextMenuEnabled", true, OnAvaloniaProperty_valueChanged); + PropertyHelper.Register(nameof(IsContextMenuEnabled), true, OnAvaloniaProperty_valueChanged); public static readonly AvaloniaProperty BaseStylesheetProperty = - PropertyHelper.Register("BaseStylesheet", null, OnAvaloniaProperty_valueChanged); + PropertyHelper.Register(nameof(BaseStylesheet), null, OnAvaloniaProperty_valueChanged); public static readonly AvaloniaProperty TextProperty = - PropertyHelper.Register("Text", null, OnAvaloniaProperty_valueChanged); + PropertyHelper.Register(nameof(Text), null, OnAvaloniaProperty_valueChanged); public static readonly StyledProperty BackgroundProperty = Border.BackgroundProperty.AddOwner(); public static readonly AvaloniaProperty BorderThicknessProperty = - AvaloniaProperty.Register("BorderThickness", new Thickness(0)); + AvaloniaProperty.Register(nameof(BorderThickness), new Thickness(0)); public static readonly AvaloniaProperty BorderBrushProperty = - AvaloniaProperty.Register("BorderBrush"); + AvaloniaProperty.Register(nameof(BorderBrush)); public static readonly AvaloniaProperty PaddingProperty = - AvaloniaProperty.Register("Padding", new Thickness(0)); + AvaloniaProperty.Register(nameof(Padding), new Thickness(0)); public static readonly RoutedEvent LoadCompleteEvent = RoutedEvent.Register("LoadComplete", RoutingStrategies.Bubble, typeof(HtmlControl)); diff --git a/src/Avalonia.Input/InputElement.cs b/src/Avalonia.Input/InputElement.cs index 6385f7197b..8ac49df4cd 100644 --- a/src/Avalonia.Input/InputElement.cs +++ b/src/Avalonia.Input/InputElement.cs @@ -31,43 +31,43 @@ namespace Avalonia.Input /// Defines the property. /// public static readonly StyledProperty IsEnabledCoreProperty = - AvaloniaProperty.Register("IsEnabledCore", true); + AvaloniaProperty.Register(nameof(IsEnabledCore), true); /// /// Gets or sets associated mouse cursor. /// public static readonly StyledProperty CursorProperty = - AvaloniaProperty.Register("Cursor", null, true); + AvaloniaProperty.Register(nameof(Cursor), null, true); /// /// Defines the property. /// public static readonly DirectProperty IsFocusedProperty = - AvaloniaProperty.RegisterDirect("IsFocused", o => o.IsFocused); + AvaloniaProperty.RegisterDirect(nameof(IsFocused), o => o.IsFocused); /// /// Defines the property. /// public static readonly StyledProperty IsHitTestVisibleProperty = - AvaloniaProperty.Register("IsHitTestVisible", true); + AvaloniaProperty.Register(nameof(IsHitTestVisible), true); /// /// Defines the property. /// public static readonly DirectProperty IsPointerOverProperty = - AvaloniaProperty.RegisterDirect("IsPointerOver", o => o.IsPointerOver); + AvaloniaProperty.RegisterDirect(nameof(IsPointerOver), o => o.IsPointerOver); /// /// Defines the event. /// public static readonly RoutedEvent GotFocusEvent = - RoutedEvent.Register("GotFocus", RoutingStrategies.Bubble); + RoutedEvent.Register(nameof(GotFocus), RoutingStrategies.Bubble); /// /// Defines the event. /// public static readonly RoutedEvent LostFocusEvent = - RoutedEvent.Register("LostFocus", RoutingStrategies.Bubble); + RoutedEvent.Register(nameof(LostFocus), RoutingStrategies.Bubble); /// /// Defines the event. @@ -97,13 +97,13 @@ namespace Avalonia.Input /// Defines the event. /// public static readonly RoutedEvent PointerEnterEvent = - RoutedEvent.Register("PointerEnter", RoutingStrategies.Direct); + RoutedEvent.Register(nameof(PointerEnter), RoutingStrategies.Direct); /// /// Defines the event. /// public static readonly RoutedEvent PointerLeaveEvent = - RoutedEvent.Register("PointerLeave", RoutingStrategies.Direct); + RoutedEvent.Register(nameof(PointerLeave), RoutingStrategies.Direct); /// /// Defines the event. diff --git a/src/Avalonia.Input/KeyBinding.cs b/src/Avalonia.Input/KeyBinding.cs index a14f87beb1..035b6978f4 100644 --- a/src/Avalonia.Input/KeyBinding.cs +++ b/src/Avalonia.Input/KeyBinding.cs @@ -10,7 +10,7 @@ namespace Avalonia.Input public class KeyBinding : AvaloniaObject { public static readonly StyledProperty CommandProperty = - AvaloniaProperty.Register("Command"); + AvaloniaProperty.Register(nameof(Command)); public ICommand Command { @@ -19,7 +19,7 @@ namespace Avalonia.Input } public static readonly StyledProperty CommandParameterProperty = - AvaloniaProperty.Register("CommandParameter"); + AvaloniaProperty.Register(nameof(CommandParameter)); public object CommandParameter { @@ -28,7 +28,7 @@ namespace Avalonia.Input } public static readonly StyledProperty GestureProperty = - AvaloniaProperty.Register("Gesture"); + AvaloniaProperty.Register(nameof(Gesture)); public KeyGesture Gesture { diff --git a/src/Avalonia.Visuals/Media/Geometry.cs b/src/Avalonia.Visuals/Media/Geometry.cs index 591c7d0468..d27626bcc1 100644 --- a/src/Avalonia.Visuals/Media/Geometry.cs +++ b/src/Avalonia.Visuals/Media/Geometry.cs @@ -15,7 +15,7 @@ namespace Avalonia.Media /// Defines the property. /// public static readonly StyledProperty TransformProperty = - AvaloniaProperty.Register("Transform"); + AvaloniaProperty.Register(nameof(Transform)); /// /// Initializes static members of the class. diff --git a/src/Avalonia.Visuals/Media/ImageBrush.cs b/src/Avalonia.Visuals/Media/ImageBrush.cs index 69b98fd35c..fa491ed3e1 100644 --- a/src/Avalonia.Visuals/Media/ImageBrush.cs +++ b/src/Avalonia.Visuals/Media/ImageBrush.cs @@ -14,7 +14,7 @@ namespace Avalonia.Media /// Defines the property. /// public static readonly StyledProperty SourceProperty = - AvaloniaProperty.Register("Source"); + AvaloniaProperty.Register(nameof(Source)); /// /// Initializes a new instance of the class. diff --git a/src/Avalonia.Visuals/Media/MatrixTransform.cs b/src/Avalonia.Visuals/Media/MatrixTransform.cs index 1507720305..247a26dac1 100644 --- a/src/Avalonia.Visuals/Media/MatrixTransform.cs +++ b/src/Avalonia.Visuals/Media/MatrixTransform.cs @@ -15,7 +15,7 @@ namespace Avalonia.Media /// Defines the property. /// public static readonly StyledProperty MatrixProperty = - AvaloniaProperty.Register("Matrix", Matrix.Identity); + AvaloniaProperty.Register(nameof(Matrix), Matrix.Identity); /// /// Initializes a new instance of the class. diff --git a/src/Avalonia.Visuals/Media/RotateTransform.cs b/src/Avalonia.Visuals/Media/RotateTransform.cs index 41f2335ced..4fe615a6df 100644 --- a/src/Avalonia.Visuals/Media/RotateTransform.cs +++ b/src/Avalonia.Visuals/Media/RotateTransform.cs @@ -15,7 +15,7 @@ namespace Avalonia.Media /// Defines the property. /// public static readonly StyledProperty AngleProperty = - AvaloniaProperty.Register("Angle"); + AvaloniaProperty.Register(nameof(Angle)); /// /// Initializes a new instance of the class. diff --git a/src/Avalonia.Visuals/Media/TranslateTransform.cs b/src/Avalonia.Visuals/Media/TranslateTransform.cs index 0c9ca5debc..b66ca7939c 100644 --- a/src/Avalonia.Visuals/Media/TranslateTransform.cs +++ b/src/Avalonia.Visuals/Media/TranslateTransform.cs @@ -15,13 +15,13 @@ namespace Avalonia.Media /// Defines the property. /// public static readonly StyledProperty XProperty = - AvaloniaProperty.Register("X"); + AvaloniaProperty.Register(nameof(X)); /// /// Defines the property. /// public static readonly StyledProperty YProperty = - AvaloniaProperty.Register("Y"); + AvaloniaProperty.Register(nameof(Y)); /// /// Initializes a new instance of the class. diff --git a/src/Avalonia.Visuals/Media/VisualBrush.cs b/src/Avalonia.Visuals/Media/VisualBrush.cs index a6d2b8ae8f..435f4ba1b1 100644 --- a/src/Avalonia.Visuals/Media/VisualBrush.cs +++ b/src/Avalonia.Visuals/Media/VisualBrush.cs @@ -14,7 +14,7 @@ namespace Avalonia.Media /// Defines the property. /// public static readonly StyledProperty VisualProperty = - AvaloniaProperty.Register("Visual"); + AvaloniaProperty.Register(nameof(Visual)); /// /// Initializes a new instance of the class. diff --git a/tests/Avalonia.Base.UnitTests/AvaloniaObjectTests_Direct.cs b/tests/Avalonia.Base.UnitTests/AvaloniaObjectTests_Direct.cs index f415d845ce..5cc5bae8b0 100644 --- a/tests/Avalonia.Base.UnitTests/AvaloniaObjectTests_Direct.cs +++ b/tests/Avalonia.Base.UnitTests/AvaloniaObjectTests_Direct.cs @@ -506,17 +506,17 @@ namespace Avalonia.Base.UnitTests { public static readonly DirectProperty FooProperty = AvaloniaProperty.RegisterDirect( - "Foo", + nameof(Foo), o => o.Foo, (o, v) => o.Foo = v, unsetValue: "unset"); public static readonly DirectProperty BarProperty = - AvaloniaProperty.RegisterDirect("Bar", o => o.Bar); + AvaloniaProperty.RegisterDirect(nameof(Bar), o => o.Bar); public static readonly DirectProperty BazProperty = AvaloniaProperty.RegisterDirect( - "Bar", + nameof(Baz), o => o.Baz, (o, v) => o.Baz = v, unsetValue: -1); diff --git a/tests/Avalonia.Base.UnitTests/AvaloniaObjectTests_GetSubject.cs b/tests/Avalonia.Base.UnitTests/AvaloniaObjectTests_GetSubject.cs index ec872e7cc0..bb6df0e4fb 100644 --- a/tests/Avalonia.Base.UnitTests/AvaloniaObjectTests_GetSubject.cs +++ b/tests/Avalonia.Base.UnitTests/AvaloniaObjectTests_GetSubject.cs @@ -37,7 +37,7 @@ namespace Avalonia.Base.UnitTests private class Class1 : AvaloniaObject { public static readonly StyledProperty FooProperty = - AvaloniaProperty.Register("Foo", "foodefault"); + AvaloniaProperty.Register(nameof(Foo), "foodefault"); public string Foo { diff --git a/tests/Avalonia.Base.UnitTests/DirectPropertyTests.cs b/tests/Avalonia.Base.UnitTests/DirectPropertyTests.cs index 84ff492512..fe7186e417 100644 --- a/tests/Avalonia.Base.UnitTests/DirectPropertyTests.cs +++ b/tests/Avalonia.Base.UnitTests/DirectPropertyTests.cs @@ -85,7 +85,7 @@ namespace Avalonia.Base.UnitTests private class Class1 : AvaloniaObject { public static readonly DirectProperty FooProperty = - AvaloniaProperty.RegisterDirect("Foo", o => o.Foo, (o, v) => o.Foo = v); + AvaloniaProperty.RegisterDirect(nameof(Foo), o => o.Foo, (o, v) => o.Foo = v); private string _foo = "foo"; diff --git a/tests/Avalonia.Markup.UnitTests/Data/ExpressionObserverTests_AttachedProperty.cs b/tests/Avalonia.Markup.UnitTests/Data/ExpressionObserverTests_AttachedProperty.cs index a8069cb75c..5ddff63a0c 100644 --- a/tests/Avalonia.Markup.UnitTests/Data/ExpressionObserverTests_AttachedProperty.cs +++ b/tests/Avalonia.Markup.UnitTests/Data/ExpressionObserverTests_AttachedProperty.cs @@ -136,7 +136,7 @@ namespace Avalonia.Markup.UnitTests.Data private class Class1 : AvaloniaObject { public static readonly StyledProperty NextProperty = - AvaloniaProperty.Register("Next"); + AvaloniaProperty.Register(nameof(Next)); public Class1 Next { diff --git a/tests/Avalonia.Markup.Xaml.UnitTests/Data/BindingTests.cs b/tests/Avalonia.Markup.Xaml.UnitTests/Data/BindingTests.cs index 71c5385c23..c6f89e07a6 100644 --- a/tests/Avalonia.Markup.Xaml.UnitTests/Data/BindingTests.cs +++ b/tests/Avalonia.Markup.Xaml.UnitTests/Data/BindingTests.cs @@ -558,7 +558,7 @@ namespace Avalonia.Markup.Xaml.UnitTests.Data private class InheritanceTest : Decorator { public static readonly StyledProperty BazProperty = - AvaloniaProperty.Register("Baz", defaultValue: 6, inherits: true); + AvaloniaProperty.Register(nameof(Baz), defaultValue: 6, inherits: true); public int Baz { diff --git a/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/NonControl.cs b/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/NonControl.cs index 7562084072..7a728203e6 100644 --- a/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/NonControl.cs +++ b/tests/Avalonia.Markup.Xaml.UnitTests/Xaml/NonControl.cs @@ -8,10 +8,10 @@ namespace Avalonia.Markup.Xaml.UnitTests.Xaml public class NonControl : AvaloniaObject { public static readonly StyledProperty ControlProperty = - AvaloniaProperty.Register("Control"); + AvaloniaProperty.Register(nameof(Control)); public static readonly StyledProperty StringProperty = - AvaloniaProperty.Register("String"); + AvaloniaProperty.Register(nameof(String)); //No getter or setter Avalonia property public static readonly StyledProperty FooProperty = @@ -19,7 +19,7 @@ namespace Avalonia.Markup.Xaml.UnitTests.Xaml //getter only Avalonia property public static readonly StyledProperty BarProperty = - AvaloniaProperty.Register("Bar"); + AvaloniaProperty.Register(nameof(Bar)); public Control Control { diff --git a/tests/Avalonia.Styling.UnitTests/StyleTests.cs b/tests/Avalonia.Styling.UnitTests/StyleTests.cs index d9756ebc4b..a7c559668b 100644 --- a/tests/Avalonia.Styling.UnitTests/StyleTests.cs +++ b/tests/Avalonia.Styling.UnitTests/StyleTests.cs @@ -170,7 +170,7 @@ namespace Avalonia.Styling.UnitTests private class Class1 : Control { public static readonly StyledProperty FooProperty = - AvaloniaProperty.Register("Foo", "foodefault"); + AvaloniaProperty.Register(nameof(Foo), "foodefault"); public string Foo { From 7a60b790b046af0ae3a2e5e98565699b60073eb2 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Sun, 14 Jan 2018 23:53:50 +0100 Subject: [PATCH 43/49] Added failing test for #1341. --- .../Avalonia.RenderTests/Shapes/PathTests.cs | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/Avalonia.RenderTests/Shapes/PathTests.cs b/tests/Avalonia.RenderTests/Shapes/PathTests.cs index 9a580794f8..fab867f428 100644 --- a/tests/Avalonia.RenderTests/Shapes/PathTests.cs +++ b/tests/Avalonia.RenderTests/Shapes/PathTests.cs @@ -362,5 +362,28 @@ namespace Avalonia.Direct2D1.RenderTests.Shapes await RenderToFile(target); CompareImages(); } + + [Fact] + public async Task Path_With_Rotated_Geometry() + { + var target = new Border + { + Width = 200, + Height = 200, + Background = Brushes.White, + Child = new Path + { + Fill = Brushes.Red, + Data = new RectangleGeometry + { + Rect = new Rect(50, 50, 100, 100), + Transform = new RotateTransform(45), + } + } + }; + + await RenderToFile(target); + CompareImages(); + } } } From 438bc89a9066391483c721c9f443c4c2970beca1 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Mon, 15 Jan 2018 00:07:24 +0100 Subject: [PATCH 44/49] Preserve defining geometry transform. Previous logic was overwriting `DefiningGeometry`'s transform with the transform calculated by the layout pass. Be sure to apply both transforms to the `RenderedGeometry`. --- src/Avalonia.Controls/Shapes/Shape.cs | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/Avalonia.Controls/Shapes/Shape.cs b/src/Avalonia.Controls/Shapes/Shape.cs index 2ea681891d..a1848a95b1 100644 --- a/src/Avalonia.Controls/Shapes/Shape.cs +++ b/src/Avalonia.Controls/Shapes/Shape.cs @@ -61,12 +61,26 @@ namespace Avalonia.Controls.Shapes { get { - if (_renderedGeometry == null) + if (_renderedGeometry == null && DefiningGeometry != null) { - if (DefiningGeometry != null) + if (_transform == Matrix.Identity) + { + _renderedGeometry = DefiningGeometry; + } + else { _renderedGeometry = DefiningGeometry.Clone(); - _renderedGeometry.Transform = new MatrixTransform(_transform); + + if (_renderedGeometry.Transform == null || + _renderedGeometry.Transform.Value == Matrix.Identity) + { + _renderedGeometry.Transform = new MatrixTransform(_transform); + } + else + { + _renderedGeometry.Transform = new MatrixTransform( + _renderedGeometry.Transform.Value * _transform); + } } } @@ -193,6 +207,7 @@ namespace Avalonia.Controls.Shapes return finalSize; } + private Size CalculateShapeSizeAndSetTransform(Size availableSize) { // This should probably use GetRenderBounds(strokeThickness) but then the calculations From 062f67cd189e4a50d470702b0a070aac351caf86 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Mon, 15 Jan 2018 00:10:44 +0100 Subject: [PATCH 45/49] Added expected test output. --- .../Path/Path_With_Rotated_Geometry.expected.png | Bin 0 -> 1100 bytes .../Path/Path_With_Rotated_Geometry.expected.png | Bin 0 -> 1149 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 tests/TestFiles/Direct2D1/Shapes/Path/Path_With_Rotated_Geometry.expected.png create mode 100644 tests/TestFiles/Skia/Shapes/Path/Path_With_Rotated_Geometry.expected.png diff --git a/tests/TestFiles/Direct2D1/Shapes/Path/Path_With_Rotated_Geometry.expected.png b/tests/TestFiles/Direct2D1/Shapes/Path/Path_With_Rotated_Geometry.expected.png new file mode 100644 index 0000000000000000000000000000000000000000..767690045966974d1b2f61cc8feb121c93054348 GIT binary patch literal 1100 zcmdVa-A|HX0LI}r#6%D^=d6?&Lsx5SlZwikYe1B+m6>Z(H?xa=q4|KH|T25VH z*7}%H(Q*Te5Up8lW>QAB8EMWW#Kiobh+8dE{HXi+Gdh6x$HRT?87I`Fr=@b)v22Q> zxC*%}1J7>qVy(sd(=5wc5o`w^QHgi=sQ7F)}QAW7h9{DUsoC=GRBkD@EL)oynX-ssL=MG^V^%{ zp1R)`BI`Sk&T69T#jM8a%O5Aiwema8A$%4#%`&zMl+wYF4B6ZKLJq#IamUNoh2D6X zbWISoxwxEvFfq*60dH}6zCqQg(A%NaI z2atSh3847;et=Qt3cy=ifPkRi1cb~G5Z+q^;5E+!IFJ1Wu-@2CenZF@0d_k9TrB}{ z8wuDgBsZj}ya1)03*-jlUUEbDF9Nia1jO|akl8?hMM!RFSNZ^0WKzx=-&1du@{?*V za~Q7@qjDp=8*0bq<xhzbRj}nZ5kmT{aG*Ou@^E>@NC2 zUlG?PFGOgnD`}s&%N94umGN?v4&=>Aj*RD~ElBNTC{n3I-m^!@cqz0OS!u^sP4^%V z*|Alt%t*T(TQ7YTnHIp-Ynn$o0@(5lpOKOPwmefa(iXs0Z>U2mT-fSObI6Y_Y(<7o z;x0*o3tLg+Q)HeCTaihNeB{7Z2TpuX?;N1zl3 K(_|JYUGWb9wxlKi literal 0 HcmV?d00001 diff --git a/tests/TestFiles/Skia/Shapes/Path/Path_With_Rotated_Geometry.expected.png b/tests/TestFiles/Skia/Shapes/Path/Path_With_Rotated_Geometry.expected.png new file mode 100644 index 0000000000000000000000000000000000000000..7f258aa9de35ce524d04e6a97c285fd2ff3ce625 GIT binary patch literal 1149 zcmeAS@N?(olHy`uVBq!ia0vp^CqS5k4M?tyST_$yu@pObhHwBu4M$1`kZa=U;uumf z=j~nFAQ?}Q){EQ=kDfd_2n;dij_rzsML7* zUoE>J=bSJ9y?1#$=-vPSs1WC$r*H4?QEL1@=O3SvkVjChh6rcP2h~^=op+DdswpKV z&cEHQDkS#x=h-f$M91fEpNVpITh{O1?GbSz^|_820LH(-|1@U z%q>=nRq@H%y^vQa(do9IsUYX%n{{vcJ!YJ+E8ggGNadTfjJlB8hW9D16AgC!b?@(L zX_Pgd9j?OjYRAK?N{J4~{mR8Tn=SwSVxDL)!R&i;M~mZ@-45<5JPY3P1}iNre!D(F zm{T@e-a|=f*Hw3gPLCHs_Khk^3$1HeCv~)}`yvjKxR?%-aM}-&*tw6{)5R(HFFQ~= z?HGrOAg6DSFi;Vnc^FWU#gz)6qK5{_Y(Qz}9%-ONnRyvd;>Ojp!Jn>F3C{lU%k<}0 z?Vq2Pe)XDh;)nl)^#1;n+w)J(w_h86$mJQQil>~M%b{h@xPS)Fo~1v*MI|TgoP*HB z4V{%hdk%N)${iWdcgvyav*d9tqM>b88mJ5y97ZfkN_8)i98yl7T`?trj%Fam7I6Up$yGiryc^eK0KjAI> z(Bu#&#J-;6$xI8No=%I3=?+I66W=-RKP9`RD0oo1kg6OU;HjICRfT89xd2d2UI2d!Wbyk`46Z{ z_N6wEIkOJLe5DLzuKd<`=YDr{-qydN_wK9P*QuDB`%Y(kpZT3dkexY0xWhu?$VZ@& zjWW_e=9xkulTj8VdgUKT^essAP92cR`35LD;uWQ`H)u!uPF6Uc1+!~Evaw7bmFb9jK|34^DrpUXO@geCx4r>2Vl literal 0 HcmV?d00001 From 589b76e9cd0579a9a62c3cec773d565976b9e446 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Thu, 18 Jan 2018 23:30:26 +0100 Subject: [PATCH 46/49] Moved render tests for each platform to their own directory. The test .cs files stay in the `Avalonia.RenderTests` directory but the D2D and Skia render test .csprojs are moved to their own directory: include the test files by using a glob in the .csproj. This avoids the hack we were having to do to get `BaseIntermediateOutputPath` to work - we no longer have this problem as now each .csproj has its own directory, it can use the default directory for intermediate files. --- ...ia.Direct2D1.RenderTests.v3.ncrunchproject | 3 ++ ...valonia.Skia.RenderTests.v3.ncrunchproject | 6 ++-- Avalonia.sln | 12 +++---- .../Avalonia.Direct2D1.RenderTests.csproj | 16 ++------- .../Properties/AssemblyInfo.cs | 2 -- tests/Avalonia.RenderTests/.gitignore | 2 -- .../Avalonia.RenderTests.projitems | 33 ------------------ .../Avalonia.RenderTests.shproj | 16 --------- .../Controls/TextBlockTests.cs | 5 +-- .../Properties/AssemblyInfo.cs | 2 -- tests/Avalonia.RenderTests/TestBase.cs | 2 +- .../Avalonia.Skia.RenderTests.csproj | 20 ++--------- .../Cairo/SVGPath/SVGPath.expected.png | Bin 1041 -> 0 bytes .../TextBlock/Wrapping_NoWrap.expected.png | Bin 0 -> 1206 bytes 14 files changed, 20 insertions(+), 99 deletions(-) rename tests/{Avalonia.RenderTests => Avalonia.Direct2D1.RenderTests}/Avalonia.Direct2D1.RenderTests.csproj (69%) delete mode 100644 tests/Avalonia.RenderTests/.gitignore delete mode 100644 tests/Avalonia.RenderTests/Avalonia.RenderTests.projitems delete mode 100644 tests/Avalonia.RenderTests/Avalonia.RenderTests.shproj rename tests/{Avalonia.RenderTests => Avalonia.Skia.RenderTests}/Avalonia.Skia.RenderTests.csproj (69%) delete mode 100644 tests/TestFiles/Cairo/SVGPath/SVGPath.expected.png create mode 100644 tests/TestFiles/Skia/Controls/TextBlock/Wrapping_NoWrap.expected.png diff --git a/.ncrunch/Avalonia.Direct2D1.RenderTests.v3.ncrunchproject b/.ncrunch/Avalonia.Direct2D1.RenderTests.v3.ncrunchproject index 04ab17c4e1..2627a59093 100644 --- a/.ncrunch/Avalonia.Direct2D1.RenderTests.v3.ncrunchproject +++ b/.ncrunch/Avalonia.Direct2D1.RenderTests.v3.ncrunchproject @@ -1,5 +1,8 @@  + + ..\TestFiles\Direct2D1\**.* + 3000 True diff --git a/.ncrunch/Avalonia.Skia.RenderTests.v3.ncrunchproject b/.ncrunch/Avalonia.Skia.RenderTests.v3.ncrunchproject index a8c3abe8f2..7fe2430013 100644 --- a/.ncrunch/Avalonia.Skia.RenderTests.v3.ncrunchproject +++ b/.ncrunch/Avalonia.Skia.RenderTests.v3.ncrunchproject @@ -1,7 +1,9 @@  - 1000 - True + + ..\TestFiles\Skia\**.* + + 3000 True \ No newline at end of file diff --git a/Avalonia.sln b/Avalonia.sln index a29f3dd754..679ef1579e 100644 --- a/Avalonia.sln +++ b/Avalonia.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.27004.2008 +VisualStudioVersion = 15.0.27130.2024 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Base", "src\Avalonia.Base\Avalonia.Base.csproj", "{B09B78D8-9B26-48B0-9149-D64A2F120F3F}" EndProject @@ -45,11 +45,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Layout.UnitTests", EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Interactivity.UnitTests", "tests\Avalonia.Interactivity.UnitTests\Avalonia.Interactivity.UnitTests.csproj", "{08478EF5-44E8-42E9-92D6-15E00EC038D8}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Direct2D1.RenderTests", "tests\Avalonia.RenderTests\Avalonia.Direct2D1.RenderTests.csproj", "{DABFD304-D6A4-4752-8123-C2CCF7AC7831}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Direct2D1.RenderTests", "tests\Avalonia.Direct2D1.RenderTests\Avalonia.Direct2D1.RenderTests.csproj", "{DABFD304-D6A4-4752-8123-C2CCF7AC7831}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Input.UnitTests", "tests\Avalonia.Input.UnitTests\Avalonia.Input.UnitTests.csproj", "{AC18926A-E784-40FE-B09D-BB0FE2B599F0}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Direct2D1.UnitTests", "tests\Avalonia.Direct2D1.UnitTests\Avalonia.Direct2D1.UnitTests.csproj", "{EFB11458-9CDF-41C0-BE4F-44AF45A4CAB8}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Direct2D1.UnitTests", "tests\Avalonia.Direct2D1.UnitTests\Avalonia.Direct2D1.UnitTests.csproj", "{EFB11458-9CDF-41C0-BE4F-44AF45A4CAB8}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Markup.Xaml.UnitTests", "tests\Avalonia.Markup.Xaml.UnitTests\Avalonia.Markup.Xaml.UnitTests.csproj", "{99135EAB-653D-47E4-A378-C96E1278CA44}" EndProject @@ -114,8 +114,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.DesignerSupport.Te EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.DesignerSupport.TestApp", "tests\Avalonia.DesignerSupport.TestApp\Avalonia.DesignerSupport.TestApp.csproj", "{F1381F98-4D24-409A-A6C5-1C5B1E08BB08}" EndProject -Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Avalonia.RenderTests", "tests\Avalonia.RenderTests\Avalonia.RenderTests.shproj", "{48840EDD-24BF-495D-911E-2EB12AE75D3B}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VirtualizationTest", "samples\VirtualizationTest\VirtualizationTest.csproj", "{FBCAF3D0-2808-4934-8E96-3F607594517B}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Interop", "Interop", "{A0CC0258-D18C-4AB3-854F-7101680FC3F9}" @@ -176,7 +174,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Direct3DInteropSample", "sa EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Win32.Interop", "src\Windows\Avalonia.Win32.Interop\Avalonia.Win32.Interop.csproj", "{CBC4FF2F-92D4-420B-BE21-9FE0B930B04E}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Skia.RenderTests", "tests\Avalonia.RenderTests\Avalonia.Skia.RenderTests.csproj", "{E1582370-37B3-403C-917F-8209551B1634}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Skia.RenderTests", "tests\Avalonia.Skia.RenderTests\Avalonia.Skia.RenderTests.csproj", "{E1582370-37B3-403C-917F-8209551B1634}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Remote.Protocol", "src\Avalonia.Remote.Protocol\Avalonia.Remote.Protocol.csproj", "{D78A720C-C0C6-478B-8564-F167F9BDD01B}" EndProject @@ -200,7 +198,6 @@ Global src\Shared\RenderHelpers\RenderHelpers.projitems*{3e908f67-5543-4879-a1dc-08eace79b3cd}*SharedItemsImports = 4 src\Windows\Avalonia.Win32\Avalonia.Win32.Shared.projitems*{40759a76-d0f2-464e-8000-6ff0f5c4bd7c}*SharedItemsImports = 4 src\Shared\PlatformSupport\PlatformSupport.projitems*{4488ad85-1495-4809-9aa4-ddfe0a48527e}*SharedItemsImports = 4 - tests\Avalonia.RenderTests\Avalonia.RenderTests.projitems*{48840edd-24bf-495d-911e-2eb12ae75d3b}*SharedItemsImports = 13 src\Shared\PlatformSupport\PlatformSupport.projitems*{4a1abb09-9047-4bd5-a4ad-a055e52c5ee0}*SharedItemsImports = 4 src\Shared\PlatformSupport\PlatformSupport.projitems*{7863ea94-f0fb-4386-bf8c-e5bfa761560a}*SharedItemsImports = 4 src\Shared\PlatformSupport\PlatformSupport.projitems*{7b92af71-6287-4693-9dcb-bd5b6e927e23}*SharedItemsImports = 4 @@ -2643,7 +2640,6 @@ Global {57E0455D-D565-44BB-B069-EE1AA20F8337} = {9B9E3891-2366-4253-A952-D08BCEB71098} {52F55355-D120-42AC-8116-8410A7D602FA} = {C5A00AC3-B34C-4564-9BDD-2DA473EF4D8B} {F1381F98-4D24-409A-A6C5-1C5B1E08BB08} = {C5A00AC3-B34C-4564-9BDD-2DA473EF4D8B} - {48840EDD-24BF-495D-911E-2EB12AE75D3B} = {C5A00AC3-B34C-4564-9BDD-2DA473EF4D8B} {FBCAF3D0-2808-4934-8E96-3F607594517B} = {9B9E3891-2366-4253-A952-D08BCEB71098} {A0CC0258-D18C-4AB3-854F-7101680FC3F9} = {9B9E3891-2366-4253-A952-D08BCEB71098} {C7A69145-60B6-4882-97D6-A3921DD43978} = {A0CC0258-D18C-4AB3-854F-7101680FC3F9} diff --git a/tests/Avalonia.RenderTests/Avalonia.Direct2D1.RenderTests.csproj b/tests/Avalonia.Direct2D1.RenderTests/Avalonia.Direct2D1.RenderTests.csproj similarity index 69% rename from tests/Avalonia.RenderTests/Avalonia.Direct2D1.RenderTests.csproj rename to tests/Avalonia.Direct2D1.RenderTests/Avalonia.Direct2D1.RenderTests.csproj index 6af8fd8963..42d99cc19a 100644 --- a/tests/Avalonia.RenderTests/Avalonia.Direct2D1.RenderTests.csproj +++ b/tests/Avalonia.Direct2D1.RenderTests/Avalonia.Direct2D1.RenderTests.csproj @@ -1,19 +1,9 @@ - - - obj-Direct2D1 - - + netcoreapp2.0 - bin\Direct2D\$(Configuration) - false - False - $(DefineConstants);AVALONIA_DIRECT2D - Library - - + @@ -33,7 +23,5 @@ - - \ No newline at end of file diff --git a/tests/Avalonia.Direct2D1.UnitTests/Properties/AssemblyInfo.cs b/tests/Avalonia.Direct2D1.UnitTests/Properties/AssemblyInfo.cs index a8edd50b31..a462e5b079 100644 --- a/tests/Avalonia.Direct2D1.UnitTests/Properties/AssemblyInfo.cs +++ b/tests/Avalonia.Direct2D1.UnitTests/Properties/AssemblyInfo.cs @@ -4,7 +4,5 @@ using System.Reflection; using Xunit; -[assembly: AssemblyTitle("Avalonia.Direct2D1.UnitTests")] - // Don't run tests in parallel. [assembly: CollectionBehavior(DisableTestParallelization = true)] \ No newline at end of file diff --git a/tests/Avalonia.RenderTests/.gitignore b/tests/Avalonia.RenderTests/.gitignore deleted file mode 100644 index 76146e97c7..0000000000 --- a/tests/Avalonia.RenderTests/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -obj-Skia/ -obj-Skia/* \ No newline at end of file diff --git a/tests/Avalonia.RenderTests/Avalonia.RenderTests.projitems b/tests/Avalonia.RenderTests/Avalonia.RenderTests.projitems deleted file mode 100644 index ff729a6b48..0000000000 --- a/tests/Avalonia.RenderTests/Avalonia.RenderTests.projitems +++ /dev/null @@ -1,33 +0,0 @@ - - - - $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - true - 48840edd-24bf-495d-911e-2eb12ae75d3b - - - Avalonia.RenderTests - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/Avalonia.RenderTests/Avalonia.RenderTests.shproj b/tests/Avalonia.RenderTests/Avalonia.RenderTests.shproj deleted file mode 100644 index e3bed80491..0000000000 --- a/tests/Avalonia.RenderTests/Avalonia.RenderTests.shproj +++ /dev/null @@ -1,16 +0,0 @@ - - - - 48840edd-24bf-495d-911e-2eb12ae75d3b - 14.0 - - - - - - - - - - - \ No newline at end of file diff --git a/tests/Avalonia.RenderTests/Controls/TextBlockTests.cs b/tests/Avalonia.RenderTests/Controls/TextBlockTests.cs index a5d06a1b0e..80b850635d 100644 --- a/tests/Avalonia.RenderTests/Controls/TextBlockTests.cs +++ b/tests/Avalonia.RenderTests/Controls/TextBlockTests.cs @@ -1,6 +1,7 @@ // 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.Threading.Tasks; using Avalonia.Controls; using Avalonia.Layout; using Avalonia.Media; @@ -20,7 +21,7 @@ namespace Avalonia.Direct2D1.RenderTests.Controls } [Fact] - public void Wrapping_NoWrap() + public async Task Wrapping_NoWrap() { Decorator target = new Decorator { @@ -38,7 +39,7 @@ namespace Avalonia.Direct2D1.RenderTests.Controls } }; - RenderToFile(target); + await RenderToFile(target); CompareImages(); } } diff --git a/tests/Avalonia.RenderTests/Properties/AssemblyInfo.cs b/tests/Avalonia.RenderTests/Properties/AssemblyInfo.cs index d5ba64ac05..a462e5b079 100644 --- a/tests/Avalonia.RenderTests/Properties/AssemblyInfo.cs +++ b/tests/Avalonia.RenderTests/Properties/AssemblyInfo.cs @@ -4,7 +4,5 @@ using System.Reflection; using Xunit; -[assembly: AssemblyTitle("Avalonia.Direct2D1.RenderTests")] - // Don't run tests in parallel. [assembly: CollectionBehavior(DisableTestParallelization = true)] \ No newline at end of file diff --git a/tests/Avalonia.RenderTests/TestBase.cs b/tests/Avalonia.RenderTests/TestBase.cs index cf38ef3818..ae359c5c5f 100644 --- a/tests/Avalonia.RenderTests/TestBase.cs +++ b/tests/Avalonia.RenderTests/TestBase.cs @@ -46,7 +46,7 @@ namespace Avalonia.Direct2D1.RenderTests public TestBase(string outputPath) { - var testFiles = Path.GetFullPath(@"..\..\..\..\..\TestFiles\"); + var testFiles = Path.GetFullPath(@"..\..\..\..\TestFiles\"); #if AVALONIA_SKIA var platform = "Skia"; #else diff --git a/tests/Avalonia.RenderTests/Avalonia.Skia.RenderTests.csproj b/tests/Avalonia.Skia.RenderTests/Avalonia.Skia.RenderTests.csproj similarity index 69% rename from tests/Avalonia.RenderTests/Avalonia.Skia.RenderTests.csproj rename to tests/Avalonia.Skia.RenderTests/Avalonia.Skia.RenderTests.csproj index 370cfac6dd..4a297a340d 100644 --- a/tests/Avalonia.RenderTests/Avalonia.Skia.RenderTests.csproj +++ b/tests/Avalonia.Skia.RenderTests/Avalonia.Skia.RenderTests.csproj @@ -1,21 +1,10 @@ - - - obj-Skia - - - - + netcoreapp2.0 - bin\Skia\$(Configuration) - false - False - $(DefineConstants);AVALONIA_SKIA;AVALONIA_SKIA_SKIP_FAIL - Library + AVALONIA_SKIA;AVALONIA_SKIA_SKIP_FAIL - - + @@ -35,9 +24,6 @@ - - - \ No newline at end of file diff --git a/tests/TestFiles/Cairo/SVGPath/SVGPath.expected.png b/tests/TestFiles/Cairo/SVGPath/SVGPath.expected.png deleted file mode 100644 index 98300488100e4bb5bba799d456efa2cb4ba367e2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1041 zcmeAS@N?(olHy`uVBq!ia0vp^J|N7&1|*M957Y)yEX7WqAsj$Z!;#X#z`%UM)5S5Q zV$R!H4+|d|2(-$Zf0ws95Yhm|4l5X}8cGDT6l57hTS6LEDlB7~!u2NP!S9WW4;pSu zR9_>r<8PYDM#fD% zGed5_oxpfvl1pCCrfpG*#%{~;9AOrdZ7j3C%d@(lOx`!h*6^T$8Ex@KvZ+Kl&qSSw;C z={>Y&oHy^qF2fLwe6y!NHTqtDPnA12ef{ajz8elV-m3HW*8IOAF`|Bx!OS`F-HSf2 z_}plI&~0(BT(Re!jdy>|I(q)2+Kt!QKTESuCdI5W?_F4|cl`PDX7`AR4?mw-=Qa#B0Ohp$D&_Wm+nqJerq!4 zx8Ca<+TD8DC(}aSE;=?r_T>AHUe%h4z71c0RhKYsk$LSWGbh1yR>98(_k(Meep;Rp z^?1j>hq0DZ)w}*NAB>CBc>iSjw9~$&Y*+Sr{M4;Dop|&Flg2JR*^3s2pOg73F)=>y%0 z6YI+_P5Cs3;}iboFyt=akR{0Fs#U_y7O^ diff --git a/tests/TestFiles/Skia/Controls/TextBlock/Wrapping_NoWrap.expected.png b/tests/TestFiles/Skia/Controls/TextBlock/Wrapping_NoWrap.expected.png new file mode 100644 index 0000000000000000000000000000000000000000..2296e02d68707f6276a8a875cb38fa99ad3309b5 GIT binary patch literal 1206 zcmc&z>rdJT6vaAiYo|?@Ewh_W+c=G}K_@j<1R0CgQmeCF8^t2NWsV9~Xng>(wwvoC z(G;DEI@qj*WfjS!VtEKI%LG(pTK6-Eh}kNL7K!C0D0JBU5&Lk?$vq!V?#;dTUVdJ7 zXvha4AP^`NbuROgUzPhf6zpeS;V{cDZ{d)+ND%1P_9J^`LH_!1-8nP~1Pc3o9{~#D z&y{{NoSaoi{(@LdZYZm-0@an(5XfLc6*>AeI0>9~4bqb5&pD0CL|$&hT7U<&%V*yW z%1>dOpTD1gN?rAQSvSBG5R|Zx<6TghPC>Zh_JK-M1VgV1cLp-*C8Hidb=0* z{s98AGOh?U0*q%QbR<&db0x1vC7MvPYm2d(3O!IeyMjNrZ5of@ z6>D^I7r7x4TD?04L-Vzs2%J2|#SlM{Hn(0?p}|!X;ImPMvy#>Lz6WeE_yS>|V{6cO zfGh>Zz+Q?PPz!OYaNA>*Bc0G@^K3RTWEQr}cEa_Wi84hY)*u#3;fV9Y-iHn*b8}%( zFKwB$xTzUwoMDpEEuCzBZKEtXq$G`NM&xxGC9xJ0#)-)s8})#!*zV(dnwnoo{H9xK1|gN$^Pue6@TCIc;i=iPA<#M))_7g^jZF;1D78Ksvh2^W(hs<2Y@@VE%aIPz(+q=cM}n<^lnmMN zdW=F#C(7{izI88}FJf^^_;YUI)+s(v`sS>Jk+QfB<&UI0c4;j`lq7&vsKr!bF+r+W za8P5{3RFF$g^Ap>W_q)?TEC-uscXVkwMhtfQ@Ww+?aJlt*9FNw{kI-qqe|MGWf31el_O@3}8) zGc@&P_17oa@j4TF^(Ra1{o{>aQu@k+KU!Mh^xXPRI2K?1pZ(_P{&xz4!)bvXLFJJX S;fKrjyFq2;We$H Date: Fri, 19 Jan 2018 22:55:48 +0100 Subject: [PATCH 47/49] Update cake script with new render test locations. --- build.cake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.cake b/build.cake index 61fda13695..01aefff093 100644 --- a/build.cake +++ b/build.cake @@ -197,8 +197,8 @@ Task("Run-Render-Tests") .IsDependentOn("Build") .WithCriteria(() => !parameters.SkipTests && parameters.IsRunningOnWindows) .Does(() => { - RunCoreTest("./tests/Avalonia.RenderTests/Avalonia.Skia.RenderTests.csproj", parameters, true); - RunCoreTest("./tests/Avalonia.RenderTests/Avalonia.Direct2D1.RenderTests.csproj", parameters, true); + RunCoreTest("./tests/Avalonia.Skia.RenderTests/Avalonia.Skia.RenderTests.csproj", parameters, true); + RunCoreTest("./tests/Avalonia.Direct2D1.RenderTests/Avalonia.Direct2D1.RenderTests.csproj", parameters, true); }); Task("Run-Designer-Unit-Tests") From f102ef9c1ff359f8490cbb28612e12714190916d Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Sun, 21 Jan 2018 15:59:25 +0100 Subject: [PATCH 48/49] Updated cake to latest version. --- tools/packages.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/packages.config b/tools/packages.config index e0dd39bd2b..e52a2c7e98 100644 --- a/tools/packages.config +++ b/tools/packages.config @@ -1,4 +1,4 @@ - + From 6133837600153d459511995e258f533163897bba Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Sun, 21 Jan 2018 20:12:13 +0100 Subject: [PATCH 49/49] Locate tests directory in code. Rather than using a hard-coded path. --- tests/Avalonia.RenderTests/TestBase.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/Avalonia.RenderTests/TestBase.cs b/tests/Avalonia.RenderTests/TestBase.cs index ae359c5c5f..321dbc4fbe 100644 --- a/tests/Avalonia.RenderTests/TestBase.cs +++ b/tests/Avalonia.RenderTests/TestBase.cs @@ -46,7 +46,8 @@ namespace Avalonia.Direct2D1.RenderTests public TestBase(string outputPath) { - var testFiles = Path.GetFullPath(@"..\..\..\..\TestFiles\"); + var testPath = GetTestsDirectory(); + var testFiles = Path.Combine(testPath, "TestFiles"); #if AVALONIA_SKIA var platform = "Skia"; #else @@ -142,6 +143,18 @@ namespace Avalonia.Direct2D1.RenderTests } } + private string GetTestsDirectory() + { + var path = Directory.GetCurrentDirectory(); + + while (path.Length > 0 && Path.GetFileName(path) != "tests") + { + path = Path.GetDirectoryName(path); + } + + return path; + } + private class TestThreadingInterface : IPlatformThreadingInterface { public bool CurrentThreadIsLoopThread => MainThread.ManagedThreadId == Thread.CurrentThread.ManagedThreadId;