Browse Source

Renamed Decorator.Content property as Child.

pull/63/head
Steven Kirk 11 years ago
parent
commit
fba2633ab9
  1. 4
      Perspex.Controls/Border.cs
  2. 16
      Perspex.Controls/Decorator.cs
  3. 2
      Perspex.Diagnostics/DevTools.cs
  4. 2
      Perspex.Themes.Default/ButtonStyle.cs
  5. 2
      Perspex.Themes.Default/CheckBoxStyle.cs
  6. 2
      Perspex.Themes.Default/DropDownStyle.cs
  7. 2
      Perspex.Themes.Default/ListBoxItemStyle.cs
  8. 2
      Perspex.Themes.Default/ListBoxStyle.cs
  9. 8
      Perspex.Themes.Default/MenuItemStyle.cs
  10. 2
      Perspex.Themes.Default/MenuStyle.cs
  11. 2
      Perspex.Themes.Default/PopupRootStyle.cs
  12. 2
      Perspex.Themes.Default/RadioButtonStyle.cs
  13. 2
      Perspex.Themes.Default/ScrollBarStyle.cs
  14. 2
      Perspex.Themes.Default/TextBoxStyle.cs
  15. 2
      Perspex.Themes.Default/ToggleButtonStyle.cs
  16. 2
      Perspex.Themes.Default/ToolTipStyle.cs
  17. 4
      Perspex.Themes.Default/TreeViewItemStyle.cs
  18. 2
      Perspex.Themes.Default/TreeViewStyle.cs
  19. 4
      Perspex.Themes.Default/WindowStyle.cs
  20. 4
      TestApplication/Program.cs
  21. 22
      Tests/Perspex.Controls.UnitTests/BorderTests.cs
  22. 4
      Tests/Perspex.Controls.UnitTests/ContentControlTests.cs
  23. 8
      Tests/Perspex.Controls.UnitTests/ControlTests.cs
  24. 22
      Tests/Perspex.Controls.UnitTests/DecoratorTests.cs
  25. 2
      Tests/Perspex.Controls.UnitTests/ItemsControlTests.cs
  26. 4
      Tests/Perspex.Controls.UnitTests/TemplatedControlTests.cs
  27. 6
      Tests/Perspex.Controls.UnitTests/Templates/TemplateExtensionsTests.cs
  28. 4
      Tests/Perspex.Layout.UnitTests/FullLayoutTests.cs
  29. 54
      Tests/Perspex.RenderTests/Controls/BorderTests.cs
  30. 16
      Tests/Perspex.RenderTests/Controls/ImageTests.cs
  31. 2
      Tests/Perspex.RenderTests/Shapes/EllipseTests.cs
  32. 10
      Tests/Perspex.RenderTests/Shapes/PathTests.cs
  33. 6
      Tests/Perspex.RenderTests/Shapes/RectangleTests.cs
  34. 4
      Tests/Perspex.SceneGraph.UnitTests/VisualTree/BoundsTrackerTests.cs
  35. 2
      Tests/Perspex.Styling.UnitTests/SelectorTests_Template.cs

4
Perspex.Controls/Border.cs

@ -76,7 +76,7 @@ namespace Perspex.Controls
protected override Size ArrangeOverride(Size finalSize) protected override Size ArrangeOverride(Size finalSize)
{ {
Control content = this.Content; Control content = this.Child;
if (content != null) if (content != null)
{ {
@ -89,7 +89,7 @@ namespace Perspex.Controls
protected override Size MeasureOverride(Size availableSize) protected override Size MeasureOverride(Size availableSize)
{ {
var content = this.Content; var content = this.Child;
var padding = this.Padding + new Thickness(this.BorderThickness); var padding = this.Padding + new Thickness(this.BorderThickness);
if (content != null) if (content != null)

16
Perspex.Controls/Decorator.cs

@ -15,8 +15,8 @@ namespace Perspex.Controls
public class Decorator : Control, IVisual, ILogical public class Decorator : Control, IVisual, ILogical
{ {
public static readonly PerspexProperty<Control> ContentProperty = public static readonly PerspexProperty<Control> ChildProperty =
PerspexProperty.Register<Decorator, Control>("Content"); PerspexProperty.Register<Decorator, Control>("Child");
public static readonly PerspexProperty<Thickness> PaddingProperty = public static readonly PerspexProperty<Thickness> PaddingProperty =
PerspexProperty.Register<Decorator, Thickness>("Padding"); PerspexProperty.Register<Decorator, Thickness>("Padding");
@ -25,7 +25,7 @@ namespace Perspex.Controls
public Decorator() public Decorator()
{ {
this.GetObservableWithHistory(ContentProperty).Subscribe(x => this.GetObservableWithHistory(ChildProperty).Subscribe(x =>
{ {
if (x.Item1 != null) if (x.Item1 != null)
{ {
@ -43,10 +43,10 @@ namespace Perspex.Controls
}); });
} }
public Control Content public Control Child
{ {
get { return this.GetValue(ContentProperty); } get { return this.GetValue(ChildProperty); }
set { this.SetValue(ContentProperty, value); } set { this.SetValue(ChildProperty, value); }
} }
public Thickness Padding public Thickness Padding
@ -62,7 +62,7 @@ namespace Perspex.Controls
protected override Size ArrangeOverride(Size finalSize) protected override Size ArrangeOverride(Size finalSize)
{ {
Control content = this.Content; Control content = this.Child;
if (content != null) if (content != null)
{ {
@ -74,7 +74,7 @@ namespace Perspex.Controls
protected override Size MeasureOverride(Size availableSize) protected override Size MeasureOverride(Size availableSize)
{ {
var content = this.Content; var content = this.Child;
var padding = this.Padding; var padding = this.Padding;
if (content != null) if (content != null)

2
Perspex.Diagnostics/DevTools.cs

@ -64,7 +64,7 @@ namespace Perspex.Diagnostics
{ {
this.DataTemplates.Add(new ViewLocator<ReactiveObject>()); this.DataTemplates.Add(new ViewLocator<ReactiveObject>());
this.Content = new Grid this.Child = new Grid
{ {
RowDefinitions = new RowDefinitions("*,Auto"), RowDefinitions = new RowDefinitions("*,Auto"),
Children = new Controls Children = new Controls

2
Perspex.Themes.Default/ButtonStyle.cs

@ -90,7 +90,7 @@ namespace Perspex.Themes.Default
{ {
Name = "border", Name = "border",
Padding = new Thickness(3), Padding = new Thickness(3),
Content = new ContentPresenter Child = new ContentPresenter
{ {
Name = "contentPresenter", Name = "contentPresenter",
[~ContentPresenter.ContentProperty] = control[~Button.ContentProperty], [~ContentPresenter.ContentProperty] = control[~Button.ContentProperty],

2
Perspex.Themes.Default/CheckBoxStyle.cs

@ -50,7 +50,7 @@ namespace Perspex.Themes.Default
Border result = new Border Border result = new Border
{ {
[~Border.BackgroundProperty] = control[~CheckBox.BackgroundProperty], [~Border.BackgroundProperty] = control[~CheckBox.BackgroundProperty],
Content = new Grid Child = new Grid
{ {
ColumnDefinitions = new ColumnDefinitions ColumnDefinitions = new ColumnDefinitions
{ {

2
Perspex.Themes.Default/DropDownStyle.cs

@ -50,7 +50,7 @@ namespace Perspex.Themes.Default
[~Border.BackgroundProperty] = control[~DropDown.BackgroundProperty], [~Border.BackgroundProperty] = control[~DropDown.BackgroundProperty],
[~Border.BorderBrushProperty] = control[~DropDown.BorderBrushProperty], [~Border.BorderBrushProperty] = control[~DropDown.BorderBrushProperty],
[~Border.BorderThicknessProperty] = control[~DropDown.BorderThicknessProperty], [~Border.BorderThicknessProperty] = control[~DropDown.BorderThicknessProperty],
Content = new Grid Child = new Grid
{ {
Name = "container", Name = "container",
ColumnDefinitions = new ColumnDefinitions ColumnDefinitions = new ColumnDefinitions

2
Perspex.Themes.Default/ListBoxItemStyle.cs

@ -44,7 +44,7 @@ namespace Perspex.Themes.Default
[~Border.BackgroundProperty] = control[~ListBoxItem.BackgroundProperty], [~Border.BackgroundProperty] = control[~ListBoxItem.BackgroundProperty],
[~Border.BorderBrushProperty] = control[~ListBoxItem.BorderBrushProperty], [~Border.BorderBrushProperty] = control[~ListBoxItem.BorderBrushProperty],
[~Border.BorderThicknessProperty] = control[~ListBoxItem.BorderThicknessProperty], [~Border.BorderThicknessProperty] = control[~ListBoxItem.BorderThicknessProperty],
Content = new ContentPresenter Child = new ContentPresenter
{ {
[~ContentPresenter.ContentProperty] = control[~ListBoxItem.ContentProperty], [~ContentPresenter.ContentProperty] = control[~ListBoxItem.ContentProperty],
}, },

2
Perspex.Themes.Default/ListBoxStyle.cs

@ -38,7 +38,7 @@ namespace Perspex.Themes.Default
[~Border.BackgroundProperty] = control[~ListBox.BackgroundProperty], [~Border.BackgroundProperty] = control[~ListBox.BackgroundProperty],
[~Border.BorderBrushProperty] = control[~ListBox.BorderBrushProperty], [~Border.BorderBrushProperty] = control[~ListBox.BorderBrushProperty],
[~Border.BorderThicknessProperty] = control[~ListBox.BorderThicknessProperty], [~Border.BorderThicknessProperty] = control[~ListBox.BorderThicknessProperty],
Content = new ScrollViewer Child = new ScrollViewer
{ {
Content = new ItemsPresenter Content = new ItemsPresenter
{ {

8
Perspex.Themes.Default/MenuItemStyle.cs

@ -77,7 +77,7 @@ namespace Perspex.Themes.Default
[~Border.BackgroundProperty] = control[~MenuItem.BackgroundProperty], [~Border.BackgroundProperty] = control[~MenuItem.BackgroundProperty],
[~Border.BorderBrushProperty] = control[~MenuItem.BorderBrushProperty], [~Border.BorderBrushProperty] = control[~MenuItem.BorderBrushProperty],
[~Border.BorderThicknessProperty] = control[~MenuItem.BorderThicknessProperty], [~Border.BorderThicknessProperty] = control[~MenuItem.BorderThicknessProperty],
Content = new Panel Child = new Panel
{ {
Children = new Controls Children = new Controls
{ {
@ -102,7 +102,7 @@ namespace Perspex.Themes.Default
BorderBrush = new SolidColorBrush(0xff999999), BorderBrush = new SolidColorBrush(0xff999999),
BorderThickness = 1, BorderThickness = 1,
Padding = new Thickness(2), Padding = new Thickness(2),
Content = new ScrollViewer Child = new ScrollViewer
{ {
Content = new Panel Content = new Panel
{ {
@ -148,7 +148,7 @@ namespace Perspex.Themes.Default
[~Border.BackgroundProperty] = control[~MenuItem.BackgroundProperty], [~Border.BackgroundProperty] = control[~MenuItem.BackgroundProperty],
[~Border.BorderBrushProperty] = control[~MenuItem.BorderBrushProperty], [~Border.BorderBrushProperty] = control[~MenuItem.BorderBrushProperty],
[~Border.BorderThicknessProperty] = control[~MenuItem.BorderThicknessProperty], [~Border.BorderThicknessProperty] = control[~MenuItem.BorderThicknessProperty],
Content = new Grid Child = new Grid
{ {
ColumnDefinitions = new ColumnDefinitions ColumnDefinitions = new ColumnDefinitions
{ {
@ -210,7 +210,7 @@ namespace Perspex.Themes.Default
BorderBrush = new SolidColorBrush(0xff999999), BorderBrush = new SolidColorBrush(0xff999999),
BorderThickness = 1, BorderThickness = 1,
Padding = new Thickness(2), Padding = new Thickness(2),
Content = new ScrollViewer Child = new ScrollViewer
{ {
Content = new Panel Content = new Panel
{ {

2
Perspex.Themes.Default/MenuStyle.cs

@ -36,7 +36,7 @@ namespace Perspex.Themes.Default
[~Border.BorderBrushProperty] = control[~Menu.BorderBrushProperty], [~Border.BorderBrushProperty] = control[~Menu.BorderBrushProperty],
[~Border.BorderThicknessProperty] = control[~Menu.BorderThicknessProperty], [~Border.BorderThicknessProperty] = control[~Menu.BorderThicknessProperty],
[~Border.PaddingProperty] = control[~Menu.PaddingProperty], [~Border.PaddingProperty] = control[~Menu.PaddingProperty],
Content = new ItemsPresenter Child = new ItemsPresenter
{ {
Name = "itemsPresenter", Name = "itemsPresenter",
[~ItemsPresenter.ItemsProperty] = control[~Menu.ItemsProperty], [~ItemsPresenter.ItemsProperty] = control[~Menu.ItemsProperty],

2
Perspex.Themes.Default/PopupRootStyle.cs

@ -35,7 +35,7 @@ namespace Perspex.Themes.Default
return new Border return new Border
{ {
[~Border.BackgroundProperty] = control[~PopupRoot.BackgroundProperty], [~Border.BackgroundProperty] = control[~PopupRoot.BackgroundProperty],
Content = new ContentPresenter Child = new ContentPresenter
{ {
Name = "contentPresenter", Name = "contentPresenter",
[~ContentPresenter.ContentProperty] = control[~PopupRoot.ContentProperty], [~ContentPresenter.ContentProperty] = control[~PopupRoot.ContentProperty],

2
Perspex.Themes.Default/RadioButtonStyle.cs

@ -50,7 +50,7 @@ namespace Perspex.Themes.Default
Border result = new Border Border result = new Border
{ {
[~Border.BackgroundProperty] = control[~RadioButton.BackgroundProperty], [~Border.BackgroundProperty] = control[~RadioButton.BackgroundProperty],
Content = new Grid Child = new Grid
{ {
ColumnDefinitions = new ColumnDefinitions ColumnDefinitions = new ColumnDefinitions
{ {

2
Perspex.Themes.Default/ScrollBarStyle.cs

@ -64,7 +64,7 @@ namespace Perspex.Themes.Default
return new Border return new Border
{ {
Background = Brushes.Silver, Background = Brushes.Silver,
Content = new Track Child = new Track
{ {
Name = "track", Name = "track",
[~Track.MinimumProperty] = control[~ScrollBar.MinimumProperty], [~Track.MinimumProperty] = control[~ScrollBar.MinimumProperty],

2
Perspex.Themes.Default/TextBoxStyle.cs

@ -49,7 +49,7 @@ namespace Perspex.Themes.Default
[~Border.BackgroundProperty] = control[~TextBox.BackgroundProperty], [~Border.BackgroundProperty] = control[~TextBox.BackgroundProperty],
[~Border.BorderBrushProperty] = control[~TextBox.BorderBrushProperty], [~Border.BorderBrushProperty] = control[~TextBox.BorderBrushProperty],
[~Border.BorderThicknessProperty] = control[~TextBox.BorderThicknessProperty], [~Border.BorderThicknessProperty] = control[~TextBox.BorderThicknessProperty],
Content = new ScrollViewer Child = new ScrollViewer
{ {
[~ScrollViewer.CanScrollHorizontallyProperty] = control[~ScrollViewer.CanScrollHorizontallyProperty], [~ScrollViewer.CanScrollHorizontallyProperty] = control[~ScrollViewer.CanScrollHorizontallyProperty],
[~ScrollViewer.HorizontalScrollBarVisibilityProperty] = control[~ScrollViewer.HorizontalScrollBarVisibilityProperty], [~ScrollViewer.HorizontalScrollBarVisibilityProperty] = control[~ScrollViewer.HorizontalScrollBarVisibilityProperty],

2
Perspex.Themes.Default/ToggleButtonStyle.cs

@ -89,7 +89,7 @@ namespace Perspex.Themes.Default
[~Border.BackgroundProperty] = control[~ToggleButton.BackgroundProperty], [~Border.BackgroundProperty] = control[~ToggleButton.BackgroundProperty],
[~Border.BorderBrushProperty] = control[~ToggleButton.BorderBrushProperty], [~Border.BorderBrushProperty] = control[~ToggleButton.BorderBrushProperty],
[~Border.BorderThicknessProperty] = control[~ToggleButton.BorderThicknessProperty], [~Border.BorderThicknessProperty] = control[~ToggleButton.BorderThicknessProperty],
Content = new ContentPresenter Child = new ContentPresenter
{ {
Name = "contentPresenter", Name = "contentPresenter",
[~ContentPresenter.ContentProperty] = control[~ToggleButton.ContentProperty], [~ContentPresenter.ContentProperty] = control[~ToggleButton.ContentProperty],

2
Perspex.Themes.Default/ToolTipStyle.cs

@ -40,7 +40,7 @@ namespace Perspex.Themes.Default
[~Border.BorderBrushProperty] = control[~ToolTip.BorderBrushProperty], [~Border.BorderBrushProperty] = control[~ToolTip.BorderBrushProperty],
[~Border.BorderThicknessProperty] = control[~ToolTip.BorderThicknessProperty], [~Border.BorderThicknessProperty] = control[~ToolTip.BorderThicknessProperty],
[~Border.PaddingProperty] = control[~ToolTip.PaddingProperty], [~Border.PaddingProperty] = control[~ToolTip.PaddingProperty],
Content = new ContentPresenter Child = new ContentPresenter
{ {
Name = "contentPresenter", Name = "contentPresenter",
[~ContentPresenter.ContentProperty] = control[~ToolTip.ContentProperty], [~ContentPresenter.ContentProperty] = control[~ToolTip.ContentProperty],

4
Perspex.Themes.Default/TreeViewItemStyle.cs

@ -92,7 +92,7 @@ namespace Perspex.Themes.Default
Name = "header", Name = "header",
[~Border.BackgroundProperty] = control[~TreeViewItem.BackgroundProperty], [~Border.BackgroundProperty] = control[~TreeViewItem.BackgroundProperty],
[Grid.ColumnProperty] = 1, [Grid.ColumnProperty] = 1,
Content = new ContentPresenter Child = new ContentPresenter
{ {
[~ContentPresenter.ContentProperty] = control[~TreeViewItem.HeaderProperty], [~ContentPresenter.ContentProperty] = control[~TreeViewItem.HeaderProperty],
}, },
@ -119,7 +119,7 @@ namespace Perspex.Themes.Default
Height = 14, Height = 14,
HorizontalAlignment = HorizontalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center, VerticalAlignment = VerticalAlignment.Center,
Content = new Path Child = new Path
{ {
Fill = Brushes.Black, Fill = Brushes.Black,
HorizontalAlignment = HorizontalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center,

2
Perspex.Themes.Default/TreeViewStyle.cs

@ -38,7 +38,7 @@ namespace Perspex.Themes.Default
[~Border.BackgroundProperty] = control[~TreeView.BackgroundProperty], [~Border.BackgroundProperty] = control[~TreeView.BackgroundProperty],
[~Border.BorderBrushProperty] = control[~TreeView.BorderBrushProperty], [~Border.BorderBrushProperty] = control[~TreeView.BorderBrushProperty],
[~Border.BorderThicknessProperty] = control[~TreeView.BorderThicknessProperty], [~Border.BorderThicknessProperty] = control[~TreeView.BorderThicknessProperty],
Content = new ScrollViewer Child = new ScrollViewer
{ {
CanScrollHorizontally = true, CanScrollHorizontally = true,
Content = new ItemsPresenter Content = new ItemsPresenter

4
Perspex.Themes.Default/WindowStyle.cs

@ -36,9 +36,9 @@ namespace Perspex.Themes.Default
return new Border return new Border
{ {
[~Border.BackgroundProperty] = control[~Window.BackgroundProperty], [~Border.BackgroundProperty] = control[~Window.BackgroundProperty],
Content = new AdornerDecorator Child = new AdornerDecorator
{ {
Content = new ContentPresenter Child = new ContentPresenter
{ {
Name = "contentPresenter", Name = "contentPresenter",
[~ContentPresenter.ContentProperty] = control[~Window.ContentProperty], [~ContentPresenter.ContentProperty] = control[~Window.ContentProperty],

4
TestApplication/Program.cs

@ -580,7 +580,7 @@ namespace TestApplication
VerticalAlignment = VerticalAlignment.Center, VerticalAlignment = VerticalAlignment.Center,
Background = Brushes.Crimson, Background = Brushes.Crimson,
RenderTransform = new RotateTransform(), RenderTransform = new RotateTransform(),
Content = new TextBox Child = new TextBox
{ {
Background = Brushes.White, Background = Brushes.White,
Text = "Hello!", Text = "Hello!",
@ -595,7 +595,7 @@ namespace TestApplication
HorizontalAlignment = HorizontalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center, VerticalAlignment = VerticalAlignment.Center,
Background = Brushes.Coral, Background = Brushes.Coral,
Content = new Image Child = new Image
{ {
Source = new Bitmap("github_icon.png"), Source = new Bitmap("github_icon.png"),
HorizontalAlignment = HorizontalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center,

22
Tests/Perspex.Controls.UnitTests/BorderTests.cs

@ -18,7 +18,7 @@ namespace Perspex.Controls.UnitTests
var target = new Border(); var target = new Border();
var child = new Control(); var child = new Control();
target.Content = child; target.Child = child;
Assert.Equal(child.Parent, target); Assert.Equal(child.Parent, target);
Assert.Equal(((ILogical)child).LogicalParent, target); Assert.Equal(((ILogical)child).LogicalParent, target);
@ -30,8 +30,8 @@ namespace Perspex.Controls.UnitTests
var target = new Border(); var target = new Border();
var child = new Control(); var child = new Control();
target.Content = child; target.Child = child;
target.Content = null; target.Child = null;
Assert.Null(child.Parent); Assert.Null(child.Parent);
Assert.Null(((ILogical)child).LogicalParent); Assert.Null(((ILogical)child).LogicalParent);
@ -43,7 +43,7 @@ namespace Perspex.Controls.UnitTests
var target = new Border(); var target = new Border();
var child = new Control(); var child = new Control();
target.Content = child; target.Child = child;
Assert.Equal(new[] { child }, ((ILogical)target).LogicalChildren.ToList()); Assert.Equal(new[] { child }, ((ILogical)target).LogicalChildren.ToList());
} }
@ -54,8 +54,8 @@ namespace Perspex.Controls.UnitTests
var target = new Border(); var target = new Border();
var child = new Control(); var child = new Control();
target.Content = child; target.Child = child;
target.Content = null; target.Child = null;
Assert.Equal(new ILogical[0], ((ILogical)target).LogicalChildren.ToList()); Assert.Equal(new ILogical[0], ((ILogical)target).LogicalChildren.ToList());
} }
@ -70,7 +70,7 @@ namespace Perspex.Controls.UnitTests
((ILogical)target).LogicalChildren.CollectionChanged += (s, e) => ((ILogical)target).LogicalChildren.CollectionChanged += (s, e) =>
called = e.Action == NotifyCollectionChangedAction.Add; called = e.Action == NotifyCollectionChangedAction.Add;
target.Content = child; target.Child = child;
Assert.True(called); Assert.True(called);
} }
@ -82,12 +82,12 @@ namespace Perspex.Controls.UnitTests
var child = new Control(); var child = new Control();
var called = false; var called = false;
target.Content = child; target.Child = child;
((ILogical)target).LogicalChildren.CollectionChanged += (s, e) => ((ILogical)target).LogicalChildren.CollectionChanged += (s, e) =>
called = e.Action == NotifyCollectionChangedAction.Remove; called = e.Action == NotifyCollectionChangedAction.Remove;
target.Content = null; target.Child = null;
Assert.True(called); Assert.True(called);
} }
@ -100,12 +100,12 @@ namespace Perspex.Controls.UnitTests
var child2 = new Control(); var child2 = new Control();
var called = false; var called = false;
target.Content = child1; target.Child = child1;
((ILogical)target).LogicalChildren.CollectionChanged += (s, e) => ((ILogical)target).LogicalChildren.CollectionChanged += (s, e) =>
called = e.Action == NotifyCollectionChangedAction.Replace; called = e.Action == NotifyCollectionChangedAction.Replace;
target.Content = child2; target.Child = child2;
Assert.True(called); Assert.True(called);
} }

4
Tests/Perspex.Controls.UnitTests/ContentControlTests.cs

@ -56,7 +56,7 @@ namespace Perspex.Controls.UnitTests
Locator.CurrentMutable.Register(() => styler.Object, typeof(IStyler)); Locator.CurrentMutable.Register(() => styler.Object, typeof(IStyler));
target.Content = "Foo"; target.Content = "Foo";
target.Template = this.GetTemplate(); target.Template = this.GetTemplate();
root.Content = target; root.Child = target;
target.ApplyTemplate(); target.ApplyTemplate();
@ -278,7 +278,7 @@ namespace Perspex.Controls.UnitTests
return new Border return new Border
{ {
Background = new Perspex.Media.SolidColorBrush(0xffffffff), Background = new Perspex.Media.SolidColorBrush(0xffffffff),
Content = new ContentPresenter Child = new ContentPresenter
{ {
Name = "contentPresenter", Name = "contentPresenter",
[~ContentPresenter.ContentProperty] = parent[~ContentControl.ContentProperty], [~ContentPresenter.ContentProperty] = parent[~ContentControl.ContentProperty],

8
Tests/Perspex.Controls.UnitTests/ControlTests.cs

@ -37,7 +37,7 @@ namespace Perspex.Controls.UnitTests
Locator.CurrentMutable.Register(() => styler.Object, typeof(IStyler)); Locator.CurrentMutable.Register(() => styler.Object, typeof(IStyler));
root.Content = target; root.Child = target;
styler.Verify(x => x.ApplyStyles(target), Times.Once()); styler.Verify(x => x.ApplyStyles(target), Times.Once());
} }
@ -56,12 +56,12 @@ namespace Perspex.Controls.UnitTests
Locator.CurrentMutable.Register(() => styler.Object, typeof(IStyler)); Locator.CurrentMutable.Register(() => styler.Object, typeof(IStyler));
parent.Content = child; parent.Child = child;
child.Content = grandchild; child.Child = grandchild;
styler.Verify(x => x.ApplyStyles(It.IsAny<IStyleable>()), Times.Never()); styler.Verify(x => x.ApplyStyles(It.IsAny<IStyleable>()), Times.Never());
root.Content = parent; root.Child = parent;
styler.Verify(x => x.ApplyStyles(parent), Times.Once()); styler.Verify(x => x.ApplyStyles(parent), Times.Once());
styler.Verify(x => x.ApplyStyles(child), Times.Once()); styler.Verify(x => x.ApplyStyles(child), Times.Once());

22
Tests/Perspex.Controls.UnitTests/DecoratorTests.cs

@ -18,7 +18,7 @@ namespace Perspex.Controls.UnitTests
var decorator = new Decorator(); var decorator = new Decorator();
var child = new Control(); var child = new Control();
decorator.Content = child; decorator.Child = child;
Assert.Equal(child.Parent, decorator); Assert.Equal(child.Parent, decorator);
Assert.Equal(((ILogical)child).LogicalParent, decorator); Assert.Equal(((ILogical)child).LogicalParent, decorator);
@ -30,8 +30,8 @@ namespace Perspex.Controls.UnitTests
var decorator = new Decorator(); var decorator = new Decorator();
var child = new Control(); var child = new Control();
decorator.Content = child; decorator.Child = child;
decorator.Content = null; decorator.Child = null;
Assert.Null(child.Parent); Assert.Null(child.Parent);
Assert.Null(((ILogical)child).LogicalParent); Assert.Null(((ILogical)child).LogicalParent);
@ -43,7 +43,7 @@ namespace Perspex.Controls.UnitTests
var decorator = new Decorator(); var decorator = new Decorator();
var child = new Control(); var child = new Control();
decorator.Content = child; decorator.Child = child;
Assert.Equal(new[] { child }, ((ILogical)decorator).LogicalChildren.ToList()); Assert.Equal(new[] { child }, ((ILogical)decorator).LogicalChildren.ToList());
} }
@ -54,8 +54,8 @@ namespace Perspex.Controls.UnitTests
var decorator = new Decorator(); var decorator = new Decorator();
var child = new Control(); var child = new Control();
decorator.Content = child; decorator.Child = child;
decorator.Content = null; decorator.Child = null;
Assert.Equal(new ILogical[0], ((ILogical)decorator).LogicalChildren.ToList()); Assert.Equal(new ILogical[0], ((ILogical)decorator).LogicalChildren.ToList());
} }
@ -70,7 +70,7 @@ namespace Perspex.Controls.UnitTests
((ILogical)decorator).LogicalChildren.CollectionChanged += (s, e) => ((ILogical)decorator).LogicalChildren.CollectionChanged += (s, e) =>
called = e.Action == NotifyCollectionChangedAction.Add; called = e.Action == NotifyCollectionChangedAction.Add;
decorator.Content = child; decorator.Child = child;
Assert.True(called); Assert.True(called);
} }
@ -82,12 +82,12 @@ namespace Perspex.Controls.UnitTests
var child = new Control(); var child = new Control();
var called = false; var called = false;
decorator.Content = child; decorator.Child = child;
((ILogical)decorator).LogicalChildren.CollectionChanged += (s, e) => ((ILogical)decorator).LogicalChildren.CollectionChanged += (s, e) =>
called = e.Action == NotifyCollectionChangedAction.Remove; called = e.Action == NotifyCollectionChangedAction.Remove;
decorator.Content = null; decorator.Child = null;
Assert.True(called); Assert.True(called);
} }
@ -100,12 +100,12 @@ namespace Perspex.Controls.UnitTests
var child2 = new Control(); var child2 = new Control();
var called = false; var called = false;
decorator.Content = child1; decorator.Child = child1;
((ILogical)decorator).LogicalChildren.CollectionChanged += (s, e) => ((ILogical)decorator).LogicalChildren.CollectionChanged += (s, e) =>
called = e.Action == NotifyCollectionChangedAction.Replace; called = e.Action == NotifyCollectionChangedAction.Replace;
decorator.Content = child2; decorator.Child = child2;
Assert.True(called); Assert.True(called);
} }

2
Tests/Perspex.Controls.UnitTests/ItemsControlTests.cs

@ -298,7 +298,7 @@ namespace Perspex.Controls.UnitTests
return new Border return new Border
{ {
Background = new Perspex.Media.SolidColorBrush(0xffffffff), Background = new Perspex.Media.SolidColorBrush(0xffffffff),
Content = new ItemsPresenter Child = new ItemsPresenter
{ {
Name = "itemsPresenter", Name = "itemsPresenter",
[~ItemsPresenter.ItemsProperty] = parent[~ItemsControl.ItemsProperty], [~ItemsPresenter.ItemsProperty] = parent[~ItemsControl.ItemsProperty],

4
Tests/Perspex.Controls.UnitTests/TemplatedControlTests.cs

@ -155,7 +155,7 @@ namespace Perspex.Controls.UnitTests
var root = new TestRoot var root = new TestRoot
{ {
Content = (target = new TestTemplatedControl Child = (target = new TestTemplatedControl
{ {
Template = new ControlTemplate(_ => Template = new ControlTemplate(_ =>
{ {
@ -247,7 +247,7 @@ namespace Perspex.Controls.UnitTests
{ {
return new Border return new Border
{ {
Content = new ContentPresenter Child = new ContentPresenter
{ {
[~ContentPresenter.ContentProperty] = parent.GetObservable(ContentControl.ContentProperty), [~ContentPresenter.ContentProperty] = parent.GetObservable(ContentControl.ContentProperty),
} }

6
Tests/Perspex.Controls.UnitTests/Templates/TemplateExtensionsTests.cs

@ -31,11 +31,11 @@ namespace Perspex.Controls.Templates.UnitTests
var border5 = new Border { Name = "border5", TemplatedParent = null }; var border5 = new Border { Name = "border5", TemplatedParent = null };
target.AddVisualChild(border1); target.AddVisualChild(border1);
border1.Content = inner; border1.Child = inner;
inner.AddVisualChild(border2); inner.AddVisualChild(border2);
inner.AddVisualChild(border3); inner.AddVisualChild(border3);
border3.Content = border4; border3.Child = border4;
border4.Content = border5; border4.Child = border5;
var result = target.GetTemplateChildren().Select(x => x.Name).ToArray(); var result = target.GetTemplateChildren().Select(x => x.Name).ToArray();

4
Tests/Perspex.Layout.UnitTests/FullLayoutTests.cs

@ -43,9 +43,9 @@ namespace Perspex.Layout.UnitTests
{ {
HorizontalAlignment = HorizontalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center, VerticalAlignment = VerticalAlignment.Center,
Content = new Border Child = new Border
{ {
Content = (textBlock = new TextBlock Child = (textBlock = new TextBlock
{ {
Width = 400, Width = 400,
Height = 400, Height = 400,

54
Tests/Perspex.RenderTests/Controls/BorderTests.cs

@ -26,7 +26,7 @@ namespace Perspex.Direct2D1.RenderTests.Controls
Padding = new Thickness(8), Padding = new Thickness(8),
Width = 200, Width = 200,
Height = 200, Height = 200,
Content = new Border Child = new Border
{ {
BorderBrush = Brushes.Black, BorderBrush = Brushes.Black,
BorderThickness = 1, BorderThickness = 1,
@ -45,7 +45,7 @@ namespace Perspex.Direct2D1.RenderTests.Controls
Padding = new Thickness(8), Padding = new Thickness(8),
Width = 200, Width = 200,
Height = 200, Height = 200,
Content = new Border Child = new Border
{ {
BorderBrush = Brushes.Black, BorderBrush = Brushes.Black,
BorderThickness = 2, BorderThickness = 2,
@ -64,7 +64,7 @@ namespace Perspex.Direct2D1.RenderTests.Controls
Padding = new Thickness(8), Padding = new Thickness(8),
Width = 200, Width = 200,
Height = 200, Height = 200,
Content = new Border Child = new Border
{ {
Background = Brushes.Red, Background = Brushes.Red,
} }
@ -82,11 +82,11 @@ namespace Perspex.Direct2D1.RenderTests.Controls
Padding = new Thickness(8), Padding = new Thickness(8),
Width = 200, Width = 200,
Height = 200, Height = 200,
Content = new Border Child = new Border
{ {
BorderBrush = Brushes.Black, BorderBrush = Brushes.Black,
BorderThickness = 2, BorderThickness = 2,
Content = new Border Child = new Border
{ {
Background = Brushes.Red, Background = Brushes.Red,
} }
@ -105,12 +105,12 @@ namespace Perspex.Direct2D1.RenderTests.Controls
Padding = new Thickness(8), Padding = new Thickness(8),
Width = 200, Width = 200,
Height = 200, Height = 200,
Content = new Border Child = new Border
{ {
BorderBrush = Brushes.Black, BorderBrush = Brushes.Black,
BorderThickness = 2, BorderThickness = 2,
Padding = new Thickness(2), Padding = new Thickness(2),
Content = new Border Child = new Border
{ {
Background = Brushes.Red, Background = Brushes.Red,
} }
@ -129,11 +129,11 @@ namespace Perspex.Direct2D1.RenderTests.Controls
Padding = new Thickness(8), Padding = new Thickness(8),
Width = 200, Width = 200,
Height = 200, Height = 200,
Content = new Border Child = new Border
{ {
BorderBrush = Brushes.Black, BorderBrush = Brushes.Black,
BorderThickness = 2, BorderThickness = 2,
Content = new Border Child = new Border
{ {
Background = Brushes.Red, Background = Brushes.Red,
Margin = new Thickness(2), Margin = new Thickness(2),
@ -153,11 +153,11 @@ namespace Perspex.Direct2D1.RenderTests.Controls
Padding = new Thickness(8), Padding = new Thickness(8),
Width = 200, Width = 200,
Height = 200, Height = 200,
Content = new Border Child = new Border
{ {
BorderBrush = Brushes.Black, BorderBrush = Brushes.Black,
BorderThickness = 2, BorderThickness = 2,
Content = new TextBlock Child = new TextBlock
{ {
Text = "Foo", Text = "Foo",
Background = Brushes.Red, Background = Brushes.Red,
@ -180,11 +180,11 @@ namespace Perspex.Direct2D1.RenderTests.Controls
Padding = new Thickness(8), Padding = new Thickness(8),
Width = 200, Width = 200,
Height = 200, Height = 200,
Content = new Border Child = new Border
{ {
BorderBrush = Brushes.Black, BorderBrush = Brushes.Black,
BorderThickness = 2, BorderThickness = 2,
Content = new TextBlock Child = new TextBlock
{ {
Text = "Foo", Text = "Foo",
Background = Brushes.Red, Background = Brushes.Red,
@ -207,11 +207,11 @@ namespace Perspex.Direct2D1.RenderTests.Controls
Padding = new Thickness(8), Padding = new Thickness(8),
Width = 200, Width = 200,
Height = 200, Height = 200,
Content = new Border Child = new Border
{ {
BorderBrush = Brushes.Black, BorderBrush = Brushes.Black,
BorderThickness = 2, BorderThickness = 2,
Content = new TextBlock Child = new TextBlock
{ {
Text = "Foo", Text = "Foo",
Background = Brushes.Red, Background = Brushes.Red,
@ -234,11 +234,11 @@ namespace Perspex.Direct2D1.RenderTests.Controls
Padding = new Thickness(8), Padding = new Thickness(8),
Width = 200, Width = 200,
Height = 200, Height = 200,
Content = new Border Child = new Border
{ {
BorderBrush = Brushes.Black, BorderBrush = Brushes.Black,
BorderThickness = 2, BorderThickness = 2,
Content = new TextBlock Child = new TextBlock
{ {
Text = "Foo", Text = "Foo",
Background = Brushes.Red, Background = Brushes.Red,
@ -261,11 +261,11 @@ namespace Perspex.Direct2D1.RenderTests.Controls
Padding = new Thickness(8), Padding = new Thickness(8),
Width = 200, Width = 200,
Height = 200, Height = 200,
Content = new Border Child = new Border
{ {
BorderBrush = Brushes.Black, BorderBrush = Brushes.Black,
BorderThickness = 2, BorderThickness = 2,
Content = new TextBlock Child = new TextBlock
{ {
Text = "Foo", Text = "Foo",
Background = Brushes.Red, Background = Brushes.Red,
@ -288,11 +288,11 @@ namespace Perspex.Direct2D1.RenderTests.Controls
Padding = new Thickness(8), Padding = new Thickness(8),
Width = 200, Width = 200,
Height = 200, Height = 200,
Content = new Border Child = new Border
{ {
BorderBrush = Brushes.Black, BorderBrush = Brushes.Black,
BorderThickness = 2, BorderThickness = 2,
Content = new TextBlock Child = new TextBlock
{ {
Text = "Foo", Text = "Foo",
Background = Brushes.Red, Background = Brushes.Red,
@ -315,11 +315,11 @@ namespace Perspex.Direct2D1.RenderTests.Controls
Padding = new Thickness(8), Padding = new Thickness(8),
Width = 200, Width = 200,
Height = 200, Height = 200,
Content = new Border Child = new Border
{ {
BorderBrush = Brushes.Black, BorderBrush = Brushes.Black,
BorderThickness = 2, BorderThickness = 2,
Content = new TextBlock Child = new TextBlock
{ {
Text = "Foo", Text = "Foo",
Background = Brushes.Red, Background = Brushes.Red,
@ -342,11 +342,11 @@ namespace Perspex.Direct2D1.RenderTests.Controls
Padding = new Thickness(8), Padding = new Thickness(8),
Width = 200, Width = 200,
Height = 200, Height = 200,
Content = new Border Child = new Border
{ {
BorderBrush = Brushes.Black, BorderBrush = Brushes.Black,
BorderThickness = 2, BorderThickness = 2,
Content = new TextBlock Child = new TextBlock
{ {
Text = "Foo", Text = "Foo",
Background = Brushes.Red, Background = Brushes.Red,
@ -369,14 +369,14 @@ namespace Perspex.Direct2D1.RenderTests.Controls
Padding = new Thickness(8), Padding = new Thickness(8),
Width = 200, Width = 200,
Height = 200, Height = 200,
Content = new Border Child = new Border
{ {
Background = Brushes.Coral, Background = Brushes.Coral,
Width = 100, Width = 100,
Height = 100, Height = 100,
HorizontalAlignment = HorizontalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center, VerticalAlignment = VerticalAlignment.Center,
Content = new Border Child = new Border
{ {
Margin = new Thickness(25), Margin = new Thickness(25),
Background = Brushes.Chocolate, Background = Brushes.Chocolate,

16
Tests/Perspex.RenderTests/Controls/ImageTests.cs

@ -30,10 +30,10 @@ namespace Perspex.Direct2D1.RenderTests.Controls
Padding = new Thickness(20, 8), Padding = new Thickness(20, 8),
Width = 200, Width = 200,
Height = 200, Height = 200,
Content = new Border Child = new Border
{ {
Background = Brushes.Red, Background = Brushes.Red,
Content = new Image Child = new Image
{ {
Source = this.bitmap, Source = this.bitmap,
Stretch = Stretch.None, Stretch = Stretch.None,
@ -53,10 +53,10 @@ namespace Perspex.Direct2D1.RenderTests.Controls
Padding = new Thickness(20, 8), Padding = new Thickness(20, 8),
Width = 200, Width = 200,
Height = 200, Height = 200,
Content = new Border Child = new Border
{ {
Background = Brushes.Red, Background = Brushes.Red,
Content = new Image Child = new Image
{ {
Source = this.bitmap, Source = this.bitmap,
Stretch = Stretch.Fill, Stretch = Stretch.Fill,
@ -76,10 +76,10 @@ namespace Perspex.Direct2D1.RenderTests.Controls
Padding = new Thickness(20, 8), Padding = new Thickness(20, 8),
Width = 200, Width = 200,
Height = 200, Height = 200,
Content = new Border Child = new Border
{ {
Background = Brushes.Red, Background = Brushes.Red,
Content = new Image Child = new Image
{ {
Source = this.bitmap, Source = this.bitmap,
Stretch = Stretch.Uniform, Stretch = Stretch.Uniform,
@ -99,10 +99,10 @@ namespace Perspex.Direct2D1.RenderTests.Controls
Padding = new Thickness(20, 8), Padding = new Thickness(20, 8),
Width = 200, Width = 200,
Height = 200, Height = 200,
Content = new Border Child = new Border
{ {
Background = Brushes.Red, Background = Brushes.Red,
Content = new Image Child = new Image
{ {
Source = this.bitmap, Source = this.bitmap,
Stretch = Stretch.UniformToFill, Stretch = Stretch.UniformToFill,

2
Tests/Perspex.RenderTests/Shapes/EllipseTests.cs

@ -26,7 +26,7 @@ namespace Perspex.Direct2D1.RenderTests.Shapes
Padding = new Thickness(8), Padding = new Thickness(8),
Width = 200, Width = 200,
Height = 200, Height = 200,
Content = new Ellipse Child = new Ellipse
{ {
Stroke = Brushes.Black, Stroke = Brushes.Black,
StrokeThickness = 1, StrokeThickness = 1,

10
Tests/Perspex.RenderTests/Shapes/PathTests.cs

@ -26,7 +26,7 @@ namespace Perspex.Direct2D1.RenderTests.Shapes
{ {
Width = 200, Width = 200,
Height = 200, Height = 200,
Content = new Path Child = new Path
{ {
Fill = Brushes.Gray, Fill = Brushes.Gray,
Stroke = Brushes.Red, Stroke = Brushes.Red,
@ -48,7 +48,7 @@ namespace Perspex.Direct2D1.RenderTests.Shapes
{ {
Width = 200, Width = 200,
Height = 200, Height = 200,
Content = new Path Child = new Path
{ {
Fill = Brushes.Gray, Fill = Brushes.Gray,
Stroke = Brushes.Red, Stroke = Brushes.Red,
@ -71,7 +71,7 @@ namespace Perspex.Direct2D1.RenderTests.Shapes
{ {
Width = 200, Width = 200,
Height = 200, Height = 200,
Content = new Path Child = new Path
{ {
Fill = Brushes.Gray, Fill = Brushes.Gray,
Stroke = Brushes.Red, Stroke = Brushes.Red,
@ -94,13 +94,13 @@ namespace Perspex.Direct2D1.RenderTests.Shapes
{ {
Width = 200, Width = 200,
Height = 200, Height = 200,
Content = new Border Child = new Border
{ {
BorderBrush = Brushes.Red, BorderBrush = Brushes.Red,
BorderThickness = 1, BorderThickness = 1,
HorizontalAlignment = HorizontalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center, VerticalAlignment = VerticalAlignment.Center,
Content = new Path Child = new Path
{ {
Fill = Brushes.Black, Fill = Brushes.Black,
Stroke = Brushes.Black, Stroke = Brushes.Black,

6
Tests/Perspex.RenderTests/Shapes/RectangleTests.cs

@ -26,7 +26,7 @@ namespace Perspex.Direct2D1.RenderTests.Shapes
Padding = new Thickness(8), Padding = new Thickness(8),
Width = 200, Width = 200,
Height = 200, Height = 200,
Content = new Rectangle Child = new Rectangle
{ {
Stroke = Brushes.Black, Stroke = Brushes.Black,
StrokeThickness = 1, StrokeThickness = 1,
@ -45,7 +45,7 @@ namespace Perspex.Direct2D1.RenderTests.Shapes
Padding = new Thickness(8), Padding = new Thickness(8),
Width = 200, Width = 200,
Height = 200, Height = 200,
Content = new Rectangle Child = new Rectangle
{ {
Stroke = Brushes.Black, Stroke = Brushes.Black,
StrokeThickness = 2, StrokeThickness = 2,
@ -64,7 +64,7 @@ namespace Perspex.Direct2D1.RenderTests.Shapes
Padding = new Thickness(8), Padding = new Thickness(8),
Width = 200, Width = 200,
Height = 200, Height = 200,
Content = new Rectangle Child = new Rectangle
{ {
Stroke = Brushes.Black, Stroke = Brushes.Black,
StrokeThickness = 2, StrokeThickness = 2,

4
Tests/Perspex.SceneGraph.UnitTests/VisualTree/BoundsTrackerTests.cs

@ -25,10 +25,10 @@ namespace Perspex.SceneGraph.UnitTests.VisualTree
var tree = new Decorator var tree = new Decorator
{ {
Padding = new Thickness(10), Padding = new Thickness(10),
Content = new Decorator Child = new Decorator
{ {
Padding = new Thickness(5), Padding = new Thickness(5),
Content = (control = new Rectangle Child = (control = new Rectangle
{ {
Width = 15, Width = 15,
Height = 15, Height = 15,

2
Tests/Perspex.Styling.UnitTests/SelectorTests_Template.cs

@ -117,7 +117,7 @@ namespace Perspex.Styling.UnitTests
new Border new Border
{ {
[Border.TemplatedParentProperty] = templatedControl.Object, [Border.TemplatedParentProperty] = templatedControl.Object,
Content = new TextBlock Child = new TextBlock
{ {
[Border.TemplatedParentProperty] = templatedControl.Object, [Border.TemplatedParentProperty] = templatedControl.Object,
}, },

Loading…
Cancel
Save