Browse Source
Merge branch 'master' into single-win32-assembly
pull/1355/head
Jeremy Koritzinsky
9 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with
48 additions and
17 deletions
-
appveyor.yml
-
src/Avalonia.Controls/TextBox.cs
-
src/Avalonia.Visuals/Rendering/SceneGraph/IVisualNode.cs
-
src/Avalonia.Visuals/Rendering/SceneGraph/Scene.cs
-
src/Avalonia.Visuals/Rendering/SceneGraph/VisualNode.cs
-
src/Shared/SharedAssemblyInfo.cs
-
tests/Avalonia.Controls.UnitTests/TextBoxTests.cs
|
|
|
@ -5,8 +5,6 @@ configuration: |
|
|
|
environment: |
|
|
|
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 |
|
|
|
DOTNET_CLI_TELEMETRY_OPTOUT: 1 |
|
|
|
NUGET_API_KEY: |
|
|
|
secure: Xv89dlP2MSBZKhl1nrWSxqcDgCXB0HRhOd4SWQ+jRJ7QoLxQel5mLTipXM++J3G5 |
|
|
|
NUGET_API_URL: https://www.nuget.org/api/v2/package |
|
|
|
MYGET_API_KEY: |
|
|
|
secure: OtVfyN3ErqQrDTnWH2HDfJDlCiu/i4/X4wFmK3ZXXP7HmCiXYPSbTjMPwwdOxRaK |
|
|
|
|
|
|
|
@ -103,7 +103,7 @@ namespace Avalonia.Controls |
|
|
|
if (acceptsReturn) |
|
|
|
{ |
|
|
|
return wrapping == TextWrapping.NoWrap ? |
|
|
|
ScrollBarVisibility.Visible : |
|
|
|
ScrollBarVisibility.Auto : |
|
|
|
ScrollBarVisibility.Disabled; |
|
|
|
} |
|
|
|
else |
|
|
|
|
|
|
|
@ -93,5 +93,7 @@ namespace Avalonia.Rendering.SceneGraph |
|
|
|
/// to hit test children they must be hit tested manually.
|
|
|
|
/// </remarks>
|
|
|
|
bool HitTest(Point p); |
|
|
|
|
|
|
|
bool Disposed { get; } |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -98,7 +98,10 @@ namespace Avalonia.Rendering.SceneGraph |
|
|
|
|
|
|
|
public void Dispose() |
|
|
|
{ |
|
|
|
Root.Dispose(); |
|
|
|
foreach (var node in _index.Values) |
|
|
|
{ |
|
|
|
node.Dispose(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -137,6 +140,8 @@ namespace Avalonia.Rendering.SceneGraph |
|
|
|
Contract.Requires<ArgumentNullException>(node != null); |
|
|
|
|
|
|
|
_index.Remove(node.Visual); |
|
|
|
|
|
|
|
node.Dispose(); |
|
|
|
} |
|
|
|
|
|
|
|
private VisualNode Clone(VisualNode source, IVisualNode parent, Dictionary<IVisual, IVisualNode> index) |
|
|
|
|
|
|
|
@ -113,6 +113,11 @@ namespace Avalonia.Rendering.SceneGraph |
|
|
|
/// <param name="child">The child to add.</param>
|
|
|
|
public void AddChild(IVisualNode child) |
|
|
|
{ |
|
|
|
if (child.Disposed) |
|
|
|
{ |
|
|
|
throw new ObjectDisposedException("Visual node for {node.Visual}"); |
|
|
|
} |
|
|
|
|
|
|
|
EnsureChildrenCreated(); |
|
|
|
_children.Add(child); |
|
|
|
} |
|
|
|
@ -135,7 +140,6 @@ namespace Avalonia.Rendering.SceneGraph |
|
|
|
{ |
|
|
|
EnsureChildrenCreated(); |
|
|
|
_children.Remove(child); |
|
|
|
child.Dispose(); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -145,13 +149,13 @@ namespace Avalonia.Rendering.SceneGraph |
|
|
|
/// <param name="node">The child to add.</param>
|
|
|
|
public void ReplaceChild(int index, IVisualNode node) |
|
|
|
{ |
|
|
|
EnsureChildrenCreated(); |
|
|
|
var old = _children[index]; |
|
|
|
_children[index] = node; |
|
|
|
if (node != old) |
|
|
|
if (node.Disposed) |
|
|
|
{ |
|
|
|
old.Dispose(); |
|
|
|
throw new ObjectDisposedException("Visual node for {node.Visual}"); |
|
|
|
} |
|
|
|
|
|
|
|
EnsureChildrenCreated(); |
|
|
|
_children[index] = node; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -332,13 +336,11 @@ namespace Avalonia.Rendering.SceneGraph |
|
|
|
_drawOperationsCloned = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public bool Disposed { get; } |
|
|
|
|
|
|
|
public void Dispose() |
|
|
|
{ |
|
|
|
foreach (var child in Children) |
|
|
|
{ |
|
|
|
child.Dispose(); |
|
|
|
} |
|
|
|
_drawOperationsRefCounter?.Dispose(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -14,6 +14,6 @@ using System.Runtime.CompilerServices; |
|
|
|
[assembly: AssemblyTrademark("")] |
|
|
|
[assembly: NeutralResourcesLanguage("en")] |
|
|
|
|
|
|
|
[assembly: AssemblyVersion("0.5.2")] |
|
|
|
[assembly: AssemblyFileVersion("0.5.2")] |
|
|
|
[assembly: AssemblyInformationalVersion("0.5.2")] |
|
|
|
[assembly: AssemblyVersion("0.6.0")] |
|
|
|
[assembly: AssemblyFileVersion("0.6.0")] |
|
|
|
[assembly: AssemblyInformationalVersion("0.6.0")] |
|
|
|
|
|
|
|
@ -4,10 +4,12 @@ |
|
|
|
using System; |
|
|
|
using System.Reactive.Linq; |
|
|
|
using Avalonia.Controls.Presenters; |
|
|
|
using Avalonia.Controls.Primitives; |
|
|
|
using Avalonia.Controls.Templates; |
|
|
|
using Avalonia.Data; |
|
|
|
using Avalonia.Input; |
|
|
|
using Avalonia.Markup.Xaml.Data; |
|
|
|
using Avalonia.Media; |
|
|
|
using Avalonia.Platform; |
|
|
|
using Avalonia.UnitTests; |
|
|
|
using Moq; |
|
|
|
@ -245,6 +247,28 @@ namespace Avalonia.Controls.UnitTests |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[InlineData(new object[] { false, TextWrapping.NoWrap, ScrollBarVisibility.Hidden })] |
|
|
|
[InlineData(new object[] { false, TextWrapping.Wrap, ScrollBarVisibility.Hidden })] |
|
|
|
[InlineData(new object[] { true, TextWrapping.NoWrap, ScrollBarVisibility.Auto })] |
|
|
|
[InlineData(new object[] { true, TextWrapping.Wrap, ScrollBarVisibility.Disabled })] |
|
|
|
public void Has_Correct_Horizontal_ScrollBar_Visibility( |
|
|
|
bool acceptsReturn, |
|
|
|
TextWrapping wrapping, |
|
|
|
ScrollBarVisibility expected) |
|
|
|
{ |
|
|
|
using (UnitTestApplication.Start(Services)) |
|
|
|
{ |
|
|
|
var target = new TextBox |
|
|
|
{ |
|
|
|
AcceptsReturn = acceptsReturn, |
|
|
|
TextWrapping = wrapping, |
|
|
|
}; |
|
|
|
|
|
|
|
Assert.Equal(expected, ScrollViewer.GetHorizontalScrollBarVisibility(target)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private static TestServices Services => TestServices.MockThreadingInterface.With( |
|
|
|
standardCursorFactory: Mock.Of<IStandardCursorFactory>()); |
|
|
|
|
|
|
|
|