Browse Source

Merge branch 'master' into fixes/open-windows

pull/996/head
Steven Kirk 9 years ago
committed by GitHub
parent
commit
13720df8a2
  1. 2
      src/Avalonia.Controls/Control.cs
  2. 4
      src/Avalonia.Controls/Presenters/ScrollContentPresenter.cs
  3. 4
      src/Avalonia.Controls/Templates/TemplateExtensions.cs
  4. 2
      src/Avalonia.Controls/TopLevel.cs
  5. 46
      src/Avalonia.Input/Navigation/DirectionalNavigation.cs
  6. 6
      src/Avalonia.Input/Navigation/FocusExtensions.cs
  7. 46
      src/Avalonia.Input/Navigation/TabNavigation.cs
  8. 2
      src/Avalonia.Layout/Layoutable.cs
  9. 6
      src/Avalonia.Styling/LogicalTree/LogicalExtensions.cs
  10. 14
      src/Avalonia.Styling/Styling/DescendentSelector.cs
  11. 6
      src/Avalonia.Styling/Styling/Selectors.cs
  12. 2
      src/Avalonia.Visuals/Rendering/ImmediateRenderer.cs
  13. 6
      src/Avalonia.Visuals/Visual.cs
  14. 16
      src/Avalonia.Visuals/VisualTree/VisualExtensions.cs
  15. 10
      src/Markup/Avalonia.Markup.Xaml/Parsers/SelectorGrammar.cs
  16. 6
      src/Markup/Avalonia.Markup.Xaml/Parsers/SelectorParser.cs
  17. 2
      tests/Avalonia.Controls.UnitTests/ListBoxTests.cs
  18. 8
      tests/Avalonia.Controls.UnitTests/Presenters/ScrollContentPresenterTests.cs
  19. 2
      tests/Avalonia.Controls.UnitTests/Primitives/PopupTests.cs
  20. 4
      tests/Avalonia.Controls.UnitTests/Primitives/TemplatedControlTests.cs
  21. 2
      tests/Avalonia.Controls.UnitTests/TreeViewTests.cs
  22. 2
      tests/Avalonia.Interactivity.UnitTests/InteractiveTests.cs
  23. 2
      tests/Avalonia.Layout.UnitTests/MeasureTests.cs
  24. 4
      tests/Avalonia.Markup.Xaml.UnitTests/Parsers/SelectorGrammarTests.cs
  25. 26
      tests/Avalonia.Styling.UnitTests/SelectorTests_Descendent.cs
  26. 4
      tests/Avalonia.Styling.UnitTests/SelectorTests_Multiple.cs
  27. 2
      tests/Avalonia.Visuals.UnitTests/VisualTests.cs

2
src/Avalonia.Controls/Control.cs

@ -469,7 +469,7 @@ namespace Avalonia.Controls
{
if (!IsInitialized)
{
foreach (var i in this.GetSelfAndVisualDescendents())
foreach (var i in this.GetSelfAndVisualDescendants())
{
var c = i as IControl;

4
src/Avalonia.Controls/Presenters/ScrollContentPresenter.cs

@ -111,7 +111,7 @@ namespace Avalonia.Controls.Presenters
/// <param name="target">The target visual.</param>
/// <param name="targetRect">The portion of the target visual to bring into view.</param>
/// <returns>True if the scroll offset was changed; otherwise false.</returns>
public bool BringDescendentIntoView(IVisual target, Rect targetRect)
public bool BringDescendantIntoView(IVisual target, Rect targetRect)
{
if (Child == null)
{
@ -262,7 +262,7 @@ namespace Avalonia.Controls.Presenters
private void BringIntoViewRequested(object sender, RequestBringIntoViewEventArgs e)
{
e.Handled = BringDescendentIntoView(e.TargetObject, e.TargetRect);
e.Handled = BringDescendantIntoView(e.TargetObject, e.TargetRect);
}
private void ChildChanged(AvaloniaPropertyChangedEventArgs e)

4
src/Avalonia.Controls/Templates/TemplateExtensions.cs

@ -31,9 +31,9 @@ namespace Avalonia.Controls.Templates
if (child.TemplatedParent != null)
{
foreach (var descendent in GetTemplateChildren(child, templatedParent))
foreach (var descendant in GetTemplateChildren(child, templatedParent))
{
yield return descendent;
yield return descendant;
}
}
}

2
src/Avalonia.Controls/TopLevel.cs

@ -253,7 +253,7 @@ namespace Avalonia.Controls
/// <param name="scaling">The window scaling.</param>
protected virtual void HandleScalingChanged(double scaling)
{
foreach (ILayoutable control in this.GetSelfAndVisualDescendents())
foreach (ILayoutable control in this.GetSelfAndVisualDescendants())
{
control.InvalidateMeasure();
}

46
src/Avalonia.Input/Navigation/DirectionalNavigation.cs

@ -44,7 +44,7 @@ namespace Avalonia.Input.Navigation
GetFirstInNextContainer(element, direction);
case KeyboardNavigationMode.Cycle:
return GetNextInContainer(element, container, direction) ??
GetFocusableDescendent(container, direction);
GetFocusableDescendant(container, direction);
case KeyboardNavigationMode.Contained:
return GetNextInContainer(element, container, direction);
default:
@ -53,7 +53,7 @@ namespace Avalonia.Input.Navigation
}
else
{
return GetFocusableDescendents(element).FirstOrDefault();
return GetFocusableDescendants(element).FirstOrDefault();
}
}
@ -71,24 +71,24 @@ namespace Avalonia.Input.Navigation
}
/// <summary>
/// Gets the first or last focusable descendent of the specified element.
/// Gets the first or last focusable descendant of the specified element.
/// </summary>
/// <param name="container">The element.</param>
/// <param name="direction">The direction to search.</param>
/// <returns>The element or null if not found.##</returns>
private static IInputElement GetFocusableDescendent(IInputElement container, NavigationDirection direction)
private static IInputElement GetFocusableDescendant(IInputElement container, NavigationDirection direction)
{
return IsForward(direction) ?
GetFocusableDescendents(container).FirstOrDefault() :
GetFocusableDescendents(container).LastOrDefault();
GetFocusableDescendants(container).FirstOrDefault() :
GetFocusableDescendants(container).LastOrDefault();
}
/// <summary>
/// Gets the focusable descendents of the specified element.
/// Gets the focusable descendants of the specified element.
/// </summary>
/// <param name="element">The element.</param>
/// <returns>The element's focusable descendents.</returns>
private static IEnumerable<IInputElement> GetFocusableDescendents(IInputElement element)
/// <returns>The element's focusable descendants.</returns>
private static IEnumerable<IInputElement> GetFocusableDescendants(IInputElement element)
{
var children = element.GetVisualChildren().OfType<IInputElement>();
@ -99,11 +99,11 @@ namespace Avalonia.Input.Navigation
yield return child;
}
if (child.CanFocusDescendents())
if (child.CanFocusDescendants())
{
foreach (var descendent in GetFocusableDescendents(child))
foreach (var descendant in GetFocusableDescendants(child))
{
yield return descendent;
yield return descendant;
}
}
}
@ -123,11 +123,11 @@ namespace Avalonia.Input.Navigation
{
if (direction == NavigationDirection.Down)
{
var descendent = GetFocusableDescendents(element).FirstOrDefault();
var descendant = GetFocusableDescendants(element).FirstOrDefault();
if (descendent != null)
if (descendant != null)
{
return descendent;
return descendant;
}
}
@ -156,11 +156,11 @@ namespace Avalonia.Input.Navigation
if (element != null && direction == NavigationDirection.Up)
{
var descendent = GetFocusableDescendents(element).LastOrDefault();
var descendant = GetFocusableDescendants(element).LastOrDefault();
if (descendent != null)
if (descendant != null)
{
return descendent;
return descendant;
}
}
@ -193,7 +193,7 @@ namespace Avalonia.Input.Navigation
var siblings = parent.GetVisualChildren()
.OfType<IInputElement>()
.Where(FocusExtensions.CanFocusDescendents);
.Where(FocusExtensions.CanFocusDescendants);
var sibling = isForward ?
siblings.SkipWhile(x => x != container).Skip(1).FirstOrDefault() :
siblings.TakeWhile(x => x != container).LastOrDefault();
@ -207,8 +207,8 @@ namespace Avalonia.Input.Navigation
else
{
next = isForward ?
GetFocusableDescendents(sibling).FirstOrDefault() :
GetFocusableDescendents(sibling).LastOrDefault();
GetFocusableDescendants(sibling).FirstOrDefault() :
GetFocusableDescendants(sibling).LastOrDefault();
}
}
@ -220,8 +220,8 @@ namespace Avalonia.Input.Navigation
else
{
next = isForward ?
GetFocusableDescendents(container).FirstOrDefault() :
GetFocusableDescendents(container).LastOrDefault();
GetFocusableDescendants(container).FirstOrDefault() :
GetFocusableDescendants(container).LastOrDefault();
}
return next;

6
src/Avalonia.Input/Navigation/FocusExtensions.cs

@ -16,10 +16,10 @@ namespace Avalonia.Input.Navigation
public static bool CanFocus(this IInputElement e) => e.Focusable && e.IsEnabledCore && e.IsVisible;
/// <summary>
/// Checks if descendents of the specified element can be focused.
/// Checks if descendants of the specified element can be focused.
/// </summary>
/// <param name="e">The element.</param>
/// <returns>True if descendents of the element can be focused.</returns>
public static bool CanFocusDescendents(this IInputElement e) => e.IsEnabledCore && e.IsVisible;
/// <returns>True if descendants of the element can be focused.</returns>
public static bool CanFocusDescendants(this IInputElement e) => e.IsEnabledCore && e.IsVisible;
}
}

46
src/Avalonia.Input/Navigation/TabNavigation.cs

@ -44,7 +44,7 @@ namespace Avalonia.Input.Navigation
GetFirstInNextContainer(element, direction);
case KeyboardNavigationMode.Cycle:
return GetNextInContainer(element, container, direction) ??
GetFocusableDescendent(container, direction);
GetFocusableDescendant(container, direction);
case KeyboardNavigationMode.Contained:
return GetNextInContainer(element, container, direction);
default:
@ -53,29 +53,29 @@ namespace Avalonia.Input.Navigation
}
else
{
return GetFocusableDescendents(element).FirstOrDefault();
return GetFocusableDescendants(element).FirstOrDefault();
}
}
/// <summary>
/// Gets the first or last focusable descendent of the specified element.
/// Gets the first or last focusable descendant of the specified element.
/// </summary>
/// <param name="container">The element.</param>
/// <param name="direction">The direction to search.</param>
/// <returns>The element or null if not found.##</returns>
private static IInputElement GetFocusableDescendent(IInputElement container, NavigationDirection direction)
private static IInputElement GetFocusableDescendant(IInputElement container, NavigationDirection direction)
{
return direction == NavigationDirection.Next ?
GetFocusableDescendents(container).FirstOrDefault() :
GetFocusableDescendents(container).LastOrDefault();
GetFocusableDescendants(container).FirstOrDefault() :
GetFocusableDescendants(container).LastOrDefault();
}
/// <summary>
/// Gets the focusable descendents of the specified element.
/// Gets the focusable descendants of the specified element.
/// </summary>
/// <param name="element">The element.</param>
/// <returns>The element's focusable descendents.</returns>
private static IEnumerable<IInputElement> GetFocusableDescendents(IInputElement element)
/// <returns>The element's focusable descendants.</returns>
private static IEnumerable<IInputElement> GetFocusableDescendants(IInputElement element)
{
var mode = KeyboardNavigation.GetTabNavigation((InputElement)element);
@ -108,11 +108,11 @@ namespace Avalonia.Input.Navigation
yield return child;
}
if (child.CanFocusDescendents())
if (child.CanFocusDescendants())
{
foreach (var descendent in GetFocusableDescendents(child))
foreach (var descendant in GetFocusableDescendants(child))
{
yield return descendent;
yield return descendant;
}
}
}
@ -132,11 +132,11 @@ namespace Avalonia.Input.Navigation
{
if (direction == NavigationDirection.Next)
{
var descendent = GetFocusableDescendents(element).FirstOrDefault();
var descendant = GetFocusableDescendants(element).FirstOrDefault();
if (descendent != null)
if (descendant != null)
{
return descendent;
return descendant;
}
}
@ -167,11 +167,11 @@ namespace Avalonia.Input.Navigation
if (element != null && direction == NavigationDirection.Previous)
{
var descendent = GetFocusableDescendents(element).LastOrDefault();
var descendant = GetFocusableDescendants(element).LastOrDefault();
if (descendent != null)
if (descendant != null)
{
return descendent;
return descendant;
}
}
@ -203,7 +203,7 @@ namespace Avalonia.Input.Navigation
var siblings = parent.GetVisualChildren()
.OfType<IInputElement>()
.Where(FocusExtensions.CanFocusDescendents);
.Where(FocusExtensions.CanFocusDescendants);
var sibling = direction == NavigationDirection.Next ?
siblings.SkipWhile(x => x != container).Skip(1).FirstOrDefault() :
siblings.TakeWhile(x => x != container).LastOrDefault();
@ -217,8 +217,8 @@ namespace Avalonia.Input.Navigation
else
{
next = direction == NavigationDirection.Next ?
GetFocusableDescendents(sibling).FirstOrDefault() :
GetFocusableDescendents(sibling).LastOrDefault();
GetFocusableDescendants(sibling).FirstOrDefault() :
GetFocusableDescendants(sibling).LastOrDefault();
}
}
@ -230,8 +230,8 @@ namespace Avalonia.Input.Navigation
else
{
next = direction == NavigationDirection.Next ?
GetFocusableDescendents(container).FirstOrDefault() :
GetFocusableDescendents(container).LastOrDefault();
GetFocusableDescendants(container).FirstOrDefault() :
GetFocusableDescendants(container).LastOrDefault();
}
return next;

2
src/Avalonia.Layout/Layoutable.cs

@ -612,7 +612,7 @@ namespace Avalonia.Layout
/// <inheritdoc/>
protected override sealed void OnVisualParentChanged(IVisual oldParent, IVisual newParent)
{
foreach (ILayoutable i in this.GetSelfAndVisualDescendents())
foreach (ILayoutable i in this.GetSelfAndVisualDescendants())
{
i.InvalidateMeasure();
}

6
src/Avalonia.Styling/LogicalTree/LogicalExtensions.cs

@ -37,15 +37,15 @@ namespace Avalonia.LogicalTree
return logical.LogicalChildren;
}
public static IEnumerable<ILogical> GetLogicalDescendents(this ILogical logical)
public static IEnumerable<ILogical> GetLogicalDescendants(this ILogical logical)
{
foreach (ILogical child in logical.LogicalChildren)
{
yield return child;
foreach (ILogical descendent in child.GetLogicalDescendents())
foreach (ILogical descendant in child.GetLogicalDescendants())
{
yield return descendent;
yield return descendant;
}
}
}

14
src/Avalonia.Styling/Styling/DescendentSelector.cs

@ -7,16 +7,16 @@ using Avalonia.LogicalTree;
namespace Avalonia.Styling
{
internal class DescendentSelector : Selector
internal class DescendantSelector : Selector
{
private readonly Selector _parent;
private string _selectorString;
public DescendentSelector(Selector parent)
public DescendantSelector(Selector parent)
{
if (parent == null)
{
throw new InvalidOperationException("Descendent selector must be preceeded by a selector.");
throw new InvalidOperationException("Descendant selector must be preceeded by a selector.");
}
_parent = parent;
@ -41,7 +41,7 @@ namespace Avalonia.Styling
protected override SelectorMatch Evaluate(IStyleable control, bool subscribe)
{
ILogical c = (ILogical)control;
List<IObservable<bool>> descendentMatches = new List<IObservable<bool>>();
List<IObservable<bool>> descendantMatches = new List<IObservable<bool>>();
while (c != null)
{
@ -60,14 +60,14 @@ namespace Avalonia.Styling
}
else
{
descendentMatches.Add(match.ObservableResult);
descendantMatches.Add(match.ObservableResult);
}
}
}
if (descendentMatches.Count > 0)
if (descendantMatches.Count > 0)
{
return new SelectorMatch(StyleActivator.Or(descendentMatches));
return new SelectorMatch(StyleActivator.Or(descendantMatches));
}
else
{

6
src/Avalonia.Styling/Styling/Selectors.cs

@ -42,13 +42,13 @@ namespace Avalonia.Styling
}
/// <summary>
/// Returns a selector which matches a descendent of a previous selector.
/// Returns a selector which matches a descendant of a previous selector.
/// </summary>
/// <param name="previous">The previous selector.</param>
/// <returns>The selector.</returns>
public static Selector Descendent(this Selector previous)
public static Selector Descendant(this Selector previous)
{
return new DescendentSelector(previous);
return new DescendantSelector(previous);
}
/// <summary>

2
src/Avalonia.Visuals/Rendering/ImmediateRenderer.cs

@ -164,7 +164,7 @@ namespace Avalonia.Rendering
private static void ClearTransformedBounds(IVisual visual)
{
foreach (var e in visual.GetSelfAndVisualDescendents())
foreach (var e in visual.GetSelfAndVisualDescendants())
{
BoundsTracker.SetTransformedBounds((Visual)visual, null);
}

6
src/Avalonia.Visuals/Visual.cs

@ -314,7 +314,7 @@ namespace Avalonia
/// <summary>
/// Calls the <see cref="OnAttachedToVisualTree(VisualTreeAttachmentEventArgs)"/> method
/// for this control and all of its visual descendents.
/// for this control and all of its visual descendants.
/// </summary>
/// <param name="e">The event args.</param>
protected virtual void OnAttachedToVisualTreeCore(VisualTreeAttachmentEventArgs e)
@ -342,7 +342,7 @@ namespace Avalonia
/// <summary>
/// Calls the <see cref="OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs)"/> method
/// for this control and all of its visual descendents.
/// for this control and all of its visual descendants.
/// </summary>
/// <param name="e">The event args.</param>
protected virtual void OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs e)
@ -422,7 +422,7 @@ namespace Avalonia
if (visual == null)
{
throw new ArgumentException("'visual' is not a descendent of 'ancestor'.");
throw new ArgumentException("'visual' is not a descendant of 'ancestor'.");
}
}

16
src/Avalonia.Visuals/VisualTree/VisualExtensions.cs

@ -123,33 +123,33 @@ namespace Avalonia.VisualTree
}
/// <summary>
/// Enumerates the descendents of an <see cref="IVisual"/> in the visual tree.
/// Enumerates the descendants of an <see cref="IVisual"/> in the visual tree.
/// </summary>
/// <param name="visual">The visual.</param>
/// <returns>The visual's ancestors.</returns>
public static IEnumerable<IVisual> GetVisualDescendents(this IVisual visual)
public static IEnumerable<IVisual> GetVisualDescendants(this IVisual visual)
{
foreach (IVisual child in visual.VisualChildren)
{
yield return child;
foreach (IVisual descendent in child.GetVisualDescendents())
foreach (IVisual descendant in child.GetVisualDescendants())
{
yield return descendent;
yield return descendant;
}
}
}
/// <summary>
/// Enumerates an <see cref="IVisual"/> and its descendents in the visual tree.
/// Enumerates an <see cref="IVisual"/> and its descendants in the visual tree.
/// </summary>
/// <param name="visual">The visual.</param>
/// <returns>The visual and its ancestors.</returns>
public static IEnumerable<IVisual> GetSelfAndVisualDescendents(this IVisual visual)
public static IEnumerable<IVisual> GetSelfAndVisualDescendants(this IVisual visual)
{
yield return visual;
foreach (var ancestor in visual.GetVisualDescendents())
foreach (var ancestor in visual.GetVisualDescendants())
{
yield return ancestor;
}
@ -196,7 +196,7 @@ namespace Avalonia.VisualTree
/// Tests whether an <see cref="IVisual"/> is an ancestor of another visual.
/// </summary>
/// <param name="visual">The visual.</param>
/// <param name="target">The potential descendent.</param>
/// <param name="target">The potential descendant.</param>
/// <returns>
/// True if <paramref name="visual"/> is an ancestor of <paramref name="target"/>;
/// otherwise false.

10
src/Markup/Avalonia.Markup.Xaml/Parsers/SelectorGrammar.cs

@ -93,9 +93,9 @@ namespace Avalonia.Markup.Xaml.Parsers
public static readonly Parser<ChildSyntax> Child = Parse.Char('>').Token().Return(new ChildSyntax());
public static readonly Parser<DescendentSyntax> Descendent =
public static readonly Parser<DescendantSyntax> Descendant =
from child in Parse.WhiteSpace.Many()
select new DescendentSyntax();
select new DescendantSyntax();
public static readonly Parser<TemplateSyntax> Template =
from template in Parse.String("/template/").Token()
@ -115,7 +115,7 @@ namespace Avalonia.Markup.Xaml.Parsers
.Or<ISyntax>(Property)
.Or<ISyntax>(Child)
.Or<ISyntax>(Template)
.Or<ISyntax>(Descendent);
.Or<ISyntax>(Descendant);
public static readonly Parser<IEnumerable<ISyntax>> Selector = SingleSelector.Many().End();
@ -191,11 +191,11 @@ namespace Avalonia.Markup.Xaml.Parsers
}
}
public class DescendentSyntax : ISyntax
public class DescendantSyntax : ISyntax
{
public override bool Equals(object obj)
{
return obj is DescendentSyntax;
return obj is DescendantSyntax;
}
}

6
src/Markup/Avalonia.Markup.Xaml/Parsers/SelectorParser.cs

@ -47,7 +47,7 @@ namespace Avalonia.Markup.Xaml.Parsers
var name = i as SelectorGrammar.NameSyntax;
var property = i as SelectorGrammar.PropertySyntax;
var child = i as SelectorGrammar.ChildSyntax;
var descendent = i as SelectorGrammar.DescendentSyntax;
var descendant = i as SelectorGrammar.DescendantSyntax;
var template = i as SelectorGrammar.TemplateSyntax;
if (ofType != null)
@ -102,9 +102,9 @@ namespace Avalonia.Markup.Xaml.Parsers
{
result = result.Child();
}
else if (descendent != null)
else if (descendant != null)
{
result = result.Descendent();
result = result.Descendant();
}
else if (template != null)
{

2
tests/Avalonia.Controls.UnitTests/ListBoxTests.cs

@ -245,7 +245,7 @@ namespace Avalonia.Controls.UnitTests
// The items were created before the template was applied, so now we need to go back
// and re-arrange everything.
foreach (IControl i in target.GetSelfAndVisualDescendents())
foreach (IControl i in target.GetSelfAndVisualDescendants())
{
i.InvalidateMeasure();
}

8
tests/Avalonia.Controls.UnitTests/Presenters/ScrollContentPresenterTests.cs

@ -219,7 +219,7 @@ namespace Avalonia.Controls.UnitTests.Presenters
}
[Fact]
public void BringDescendentIntoView_Should_Update_Offset()
public void BringDescendantIntoView_Should_Update_Offset()
{
var target = new ScrollContentPresenter
{
@ -235,13 +235,13 @@ namespace Avalonia.Controls.UnitTests.Presenters
target.UpdateChild();
target.Measure(Size.Infinity);
target.Arrange(new Rect(0, 0, 100, 100));
target.BringDescendentIntoView(target.Child, new Rect(200, 200, 0, 0));
target.BringDescendantIntoView(target.Child, new Rect(200, 200, 0, 0));
Assert.Equal(new Vector(100, 100), target.Offset);
}
[Fact]
public void BringDescendentIntoView_Should_Handle_Child_Margin()
public void BringDescendantIntoView_Should_Handle_Child_Margin()
{
Border border;
var target = new ScrollContentPresenter
@ -262,7 +262,7 @@ namespace Avalonia.Controls.UnitTests.Presenters
target.UpdateChild();
target.Measure(Size.Infinity);
target.Arrange(new Rect(0, 0, 100, 100));
target.BringDescendentIntoView(border, new Rect(200, 200, 0, 0));
target.BringDescendantIntoView(border, new Rect(200, 200, 0, 0));
Assert.Equal(new Vector(150, 150), target.Offset);
}

2
tests/Avalonia.Controls.UnitTests/Primitives/PopupTests.cs

@ -222,7 +222,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
popup.Open();
var popupRoot = popup.PopupRoot;
var children = popupRoot.GetVisualDescendents().ToList();
var children = popupRoot.GetVisualDescendants().ToList();
var types = children.Select(x => x.GetType().Name).ToList();
Assert.Equal(

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

@ -78,7 +78,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
target.ApplyTemplate();
var types = target.GetVisualDescendents().Select(x => x.GetType()).ToList();
var types = target.GetVisualDescendants().Select(x => x.GetType()).ToList();
Assert.Equal(
new[]
@ -135,7 +135,7 @@ namespace Avalonia.Controls.UnitTests.Primitives
target.ApplyTemplate();
var templatedParents = target.GetVisualDescendents()
var templatedParents = target.GetVisualDescendants()
.OfType<IControl>()
.Select(x => x.TemplatedParent)
.ToList();

2
tests/Avalonia.Controls.UnitTests/TreeViewTests.cs

@ -80,7 +80,7 @@ namespace Avalonia.Controls.UnitTests
}
[Fact]
public void Root_TreeContainerFromItem_Should_Return_Descendent_Item()
public void Root_TreeContainerFromItem_Should_Return_Descendant_Item()
{
var tree = CreateTestTreeData();
var target = new TreeView

2
tests/Avalonia.Interactivity.UnitTests/InteractiveTests.cs

@ -391,7 +391,7 @@ namespace Avalonia.Interactivity.UnitTests
if (handler != null)
{
foreach (var i in tree.GetSelfAndVisualDescendents().Cast<Interactive>())
foreach (var i in tree.GetSelfAndVisualDescendants().Cast<Interactive>())
{
i.AddHandler(ev, handler, handlerRoutes, handledEventsToo);
}

2
tests/Avalonia.Layout.UnitTests/MeasureTests.cs

@ -45,7 +45,7 @@ namespace Avalonia.Layout.UnitTests
}
[Fact]
public void Removing_From_Parent_Should_Invalidate_Measure_Of_Control_And_Descendents()
public void Removing_From_Parent_Should_Invalidate_Measure_Of_Control_And_Descendants()
{
var panel = new StackPanel();
var child2 = new Border();

4
tests/Avalonia.Markup.Xaml.UnitTests/Parsers/SelectorGrammarTests.cs

@ -157,7 +157,7 @@ namespace Avalonia.Xaml.Base.UnitTest.Parsers
}
[Fact]
public void OfType_Descendent_Class()
public void OfType_Descendant_Class()
{
var result = SelectorGrammar.Selector.Parse("Button .foo").ToList();
@ -165,7 +165,7 @@ namespace Avalonia.Xaml.Base.UnitTest.Parsers
new SelectorGrammar.ISyntax[]
{
new SelectorGrammar.OfTypeSyntax { TypeName = "Button" },
new SelectorGrammar.DescendentSyntax { },
new SelectorGrammar.DescendantSyntax { },
new SelectorGrammar.ClassSyntax { Class = "foo" },
},
result);

26
tests/Avalonia.Styling.UnitTests/SelectorTests_Descendent.cs

@ -14,23 +14,23 @@ using Xunit;
namespace Avalonia.Styling.UnitTests
{
public class SelectorTests_Descendent
public class SelectorTests_Descendant
{
[Fact]
public void Descendent_Matches_Control_When_It_Is_Child_OfType()
public void Descendant_Matches_Control_When_It_Is_Child_OfType()
{
var parent = new TestLogical1();
var child = new TestLogical2();
child.LogicalParent = parent;
var selector = default(Selector).OfType<TestLogical1>().Descendent().OfType<TestLogical2>();
var selector = default(Selector).OfType<TestLogical1>().Descendant().OfType<TestLogical2>();
Assert.True(selector.Match(child).ImmediateResult);
}
[Fact]
public void Descendent_Matches_Control_When_It_Is_Descendent_OfType()
public void Descendant_Matches_Control_When_It_Is_Descendant_OfType()
{
var grandparent = new TestLogical1();
var parent = new TestLogical2();
@ -39,13 +39,13 @@ namespace Avalonia.Styling.UnitTests
parent.LogicalParent = grandparent;
child.LogicalParent = parent;
var selector = default(Selector).OfType<TestLogical1>().Descendent().OfType<TestLogical3>();
var selector = default(Selector).OfType<TestLogical1>().Descendant().OfType<TestLogical3>();
Assert.True(selector.Match(child).ImmediateResult);
}
[Fact]
public async Task Descendent_Matches_Control_When_It_Is_Descendent_OfType_And_Class()
public async Task Descendant_Matches_Control_When_It_Is_Descendant_OfType_And_Class()
{
var grandparent = new TestLogical1();
var parent = new TestLogical2();
@ -55,14 +55,14 @@ namespace Avalonia.Styling.UnitTests
parent.LogicalParent = grandparent;
child.LogicalParent = parent;
var selector = default(Selector).OfType<TestLogical1>().Class("foo").Descendent().OfType<TestLogical3>();
var selector = default(Selector).OfType<TestLogical1>().Class("foo").Descendant().OfType<TestLogical3>();
var activator = selector.Match(child).ObservableResult;
Assert.True(await activator.Take(1));
}
[Fact]
public async Task Descendent_Doesnt_Match_Control_When_It_Is_Descendent_OfType_But_Wrong_Class()
public async Task Descendant_Doesnt_Match_Control_When_It_Is_Descendant_OfType_But_Wrong_Class()
{
var grandparent = new TestLogical1();
var parent = new TestLogical2();
@ -73,14 +73,14 @@ namespace Avalonia.Styling.UnitTests
parent.Classes.Add("foo");
child.LogicalParent = parent;
var selector = default(Selector).OfType<TestLogical1>().Class("foo").Descendent().OfType<TestLogical3>();
var selector = default(Selector).OfType<TestLogical1>().Class("foo").Descendant().OfType<TestLogical3>();
var activator = selector.Match(child).ObservableResult;
Assert.False(await activator.Take(1));
}
[Fact]
public async Task Descendent_Matches_Any_Ancestor()
public async Task Descendant_Matches_Any_Ancestor()
{
var grandparent = new TestLogical1();
var parent = new TestLogical1();
@ -89,7 +89,7 @@ namespace Avalonia.Styling.UnitTests
parent.LogicalParent = grandparent;
child.LogicalParent = parent;
var selector = default(Selector).OfType<TestLogical1>().Class("foo").Descendent().OfType<TestLogical3>();
var selector = default(Selector).OfType<TestLogical1>().Class("foo").Descendant().OfType<TestLogical3>();
var activator = selector.Match(child).ObservableResult;
Assert.False(await activator.Take(1));
@ -104,9 +104,9 @@ namespace Avalonia.Styling.UnitTests
}
[Fact]
public void Descendent_Selector_Should_Have_Correct_String_Representation()
public void Descendant_Selector_Should_Have_Correct_String_Representation()
{
var selector = default(Selector).OfType<TestLogical1>().Class("foo").Descendent().OfType<TestLogical3>();
var selector = default(Selector).OfType<TestLogical1>().Class("foo").Descendant().OfType<TestLogical3>();
Assert.Equal("TestLogical1.foo TestLogical3", selector.ToString());
}

4
tests/Avalonia.Styling.UnitTests/SelectorTests_Multiple.cs

@ -91,11 +91,11 @@ namespace Avalonia.Styling.UnitTests
}
[Fact]
public void TargetType_Descendent()
public void TargetType_Descendant()
{
var selector = default(Selector)
.OfType<Button>()
.Descendent()
.Descendant()
.OfType<TextBlock>();
Assert.Equal(typeof(TextBlock), selector.TargetType);

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

@ -135,7 +135,7 @@ namespace Avalonia.Visuals.UnitTests
}
[Fact]
public void Descendents_Should_RetunVisualRoot()
public void Descendants_Should_RetunVisualRoot()
{
var root = new TestRoot();
var child1 = new Decorator();

Loading…
Cancel
Save