Browse Source

Merge branch 'master' into refactor/value-store

pull/3287/head
Steven Kirk 7 years ago
parent
commit
13c6fb61fb
  1. 85
      tests/Avalonia.Styling.UnitTests/SelectorTests_Child.cs
  2. 2
      tests/Avalonia.Styling.UnitTests/SelectorTests_Class.cs
  3. 85
      tests/Avalonia.Styling.UnitTests/SelectorTests_Descendent.cs
  4. 3
      tests/Avalonia.Styling.UnitTests/SelectorTests_Name.cs
  5. 4
      tests/Avalonia.Styling.UnitTests/SelectorTests_Not.cs
  6. 5
      tests/Avalonia.Styling.UnitTests/SelectorTests_OfType.cs
  7. 9
      tests/Avalonia.Styling.UnitTests/SelectorTests_Or.cs

85
tests/Avalonia.Styling.UnitTests/SelectorTests_Child.cs

@ -81,89 +81,12 @@ namespace Avalonia.Styling.UnitTests
Assert.Equal("TestLogical1 > TestLogical3", selector.ToString()); Assert.Equal("TestLogical1 > TestLogical3", selector.ToString());
} }
public abstract class TestLogical : ILogical, IStyleable public abstract class TestLogical : Control
{ {
public TestLogical() public ILogical LogicalParent
{ {
Classes = new Classes(); get => Parent;
} set => ((ISetLogicalParent)this).SetParent(value);
public event EventHandler<AvaloniaPropertyChangedEventArgs> PropertyChanged;
public event EventHandler<AvaloniaPropertyChangedEventArgs> InheritablePropertyChanged;
public event EventHandler<LogicalTreeAttachmentEventArgs> AttachedToLogicalTree;
public event EventHandler<LogicalTreeAttachmentEventArgs> DetachedFromLogicalTree;
public Classes Classes { get; }
public string Name { get; set; }
public bool IsAttachedToLogicalTree { get; }
public IAvaloniaReadOnlyList<ILogical> LogicalChildren { get; set; }
public ILogical LogicalParent { get; set; }
public Type StyleKey { get; }
public ITemplatedControl TemplatedParent { get; }
IObservable<IStyleable> IStyleable.StyleDetach { get; }
IAvaloniaReadOnlyList<string> IStyleable.Classes => Classes;
public object GetValue(AvaloniaProperty property)
{
throw new NotImplementedException();
}
public T GetValue<T>(AvaloniaProperty<T> property)
{
throw new NotImplementedException();
}
public void SetValue(AvaloniaProperty property, object value, BindingPriority priority)
{
throw new NotImplementedException();
}
public void SetValue<T>(AvaloniaProperty<T> property, T value, BindingPriority priority = BindingPriority.LocalValue)
{
throw new NotImplementedException();
}
public IDisposable Bind(AvaloniaProperty property, IObservable<BindingValue<object>> source, BindingPriority priority)
{
throw new NotImplementedException();
}
public bool IsAnimating(AvaloniaProperty property)
{
throw new NotImplementedException();
}
public bool IsSet(AvaloniaProperty property)
{
throw new NotImplementedException();
}
public IDisposable Bind<T>(AvaloniaProperty<T> property, IObservable<BindingValue<T>> source, BindingPriority priority = BindingPriority.LocalValue)
{
throw new NotImplementedException();
}
public void NotifyAttachedToLogicalTree(LogicalTreeAttachmentEventArgs e)
{
throw new NotImplementedException();
}
public void NotifyDetachedFromLogicalTree(LogicalTreeAttachmentEventArgs e)
{
throw new NotImplementedException();
}
public void NotifyResourcesChanged(ResourcesChangedEventArgs e)
{
throw new NotImplementedException();
} }
public void ClearValue(AvaloniaProperty property) public void ClearValue(AvaloniaProperty property)

2
tests/Avalonia.Styling.UnitTests/SelectorTests_Class.cs

@ -144,7 +144,7 @@ namespace Avalonia.Styling.UnitTests
Assert.Equal(new[] { true, false }, result); Assert.Equal(new[] { true, false }, result);
} }
public class Control1 : TestControlBase public class Control1 : Control
{ {
} }
} }

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

@ -111,89 +111,12 @@ namespace Avalonia.Styling.UnitTests
Assert.Equal("TestLogical1.foo TestLogical3", selector.ToString()); Assert.Equal("TestLogical1.foo TestLogical3", selector.ToString());
} }
public abstract class TestLogical : ILogical, IStyleable public abstract class TestLogical : Control
{ {
public TestLogical() public ILogical LogicalParent
{ {
Classes = new Classes(); get => Parent;
} set => ((ISetLogicalParent)this).SetParent(value);
public event EventHandler<AvaloniaPropertyChangedEventArgs> PropertyChanged;
public event EventHandler<AvaloniaPropertyChangedEventArgs> InheritablePropertyChanged;
public event EventHandler<LogicalTreeAttachmentEventArgs> AttachedToLogicalTree;
public event EventHandler<LogicalTreeAttachmentEventArgs> DetachedFromLogicalTree;
public Classes Classes { get; }
public string Name { get; set; }
public bool IsAttachedToLogicalTree { get; }
public IAvaloniaReadOnlyList<ILogical> LogicalChildren { get; set; }
public ILogical LogicalParent { get; set; }
public Type StyleKey { get; }
public ITemplatedControl TemplatedParent { get; }
IAvaloniaReadOnlyList<string> IStyleable.Classes => Classes;
IObservable<IStyleable> IStyleable.StyleDetach { get; }
public object GetValue(AvaloniaProperty property)
{
throw new NotImplementedException();
}
public T GetValue<T>(AvaloniaProperty<T> property)
{
throw new NotImplementedException();
}
public void SetValue(AvaloniaProperty property, object value, BindingPriority priority)
{
throw new NotImplementedException();
}
public void SetValue<T>(AvaloniaProperty<T> property, T value, BindingPriority priority = BindingPriority.LocalValue)
{
throw new NotImplementedException();
}
public IDisposable Bind(AvaloniaProperty property, IObservable<BindingValue<object>> source, BindingPriority priority = BindingPriority.LocalValue)
{
throw new NotImplementedException();
}
public bool IsAnimating(AvaloniaProperty property)
{
throw new NotImplementedException();
}
public bool IsSet(AvaloniaProperty property)
{
throw new NotImplementedException();
}
public IDisposable Bind<T>(AvaloniaProperty<T> property, IObservable<BindingValue<T>> source, BindingPriority priority = BindingPriority.LocalValue)
{
throw new NotImplementedException();
}
public void NotifyAttachedToLogicalTree(LogicalTreeAttachmentEventArgs e)
{
throw new NotImplementedException();
}
public void NotifyDetachedFromLogicalTree(LogicalTreeAttachmentEventArgs e)
{
throw new NotImplementedException();
}
public void NotifyResourcesChanged(ResourcesChangedEventArgs e)
{
throw new NotImplementedException();
} }
public void ClearValue(AvaloniaProperty property) public void ClearValue(AvaloniaProperty property)

3
tests/Avalonia.Styling.UnitTests/SelectorTests_Name.cs

@ -1,6 +1,7 @@
// Copyright (c) The Avalonia Project. All rights reserved. // 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. // Licensed under the MIT license. See licence.md file in the project root for full license information.
using Avalonia.Controls;
using Moq; using Moq;
using Xunit; using Xunit;
@ -52,7 +53,7 @@ namespace Avalonia.Styling.UnitTests
Assert.Equal("Control1#foo", target.ToString()); Assert.Equal("Control1#foo", target.ToString());
} }
public class Control1 : TestControlBase public class Control1 : Control
{ {
} }
} }

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

@ -103,11 +103,11 @@ namespace Avalonia.Styling.UnitTests
Assert.Equal(typeof(Control1), target.TargetType); Assert.Equal(typeof(Control1), target.TargetType);
} }
public class Control1 : TestControlBase public class Control1 : Control
{ {
} }
public class Control2 : TestControlBase public class Control2 : Control
{ {
} }
} }

5
tests/Avalonia.Styling.UnitTests/SelectorTests_OfType.cs

@ -1,6 +1,7 @@
// Copyright (c) The Avalonia Project. All rights reserved. // 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. // Licensed under the MIT license. See licence.md file in the project root for full license information.
using Avalonia.Controls;
using Moq; using Moq;
using Xunit; using Xunit;
@ -44,11 +45,11 @@ namespace Avalonia.Styling.UnitTests
Assert.Equal(SelectorMatchResult.AlwaysThisType, target.Match(control).Result); Assert.Equal(SelectorMatchResult.AlwaysThisType, target.Match(control).Result);
} }
public class Control1 : TestControlBase public class Control1 : Control
{ {
} }
public class Control2 : TestControlBase public class Control2 : Control
{ {
} }
} }

9
tests/Avalonia.Styling.UnitTests/SelectorTests_Or.cs

@ -1,6 +1,7 @@
// Copyright (c) The Avalonia Project. All rights reserved. // 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. // Licensed under the MIT license. See licence.md file in the project root for full license information.
using Avalonia.Controls;
using Xunit; using Xunit;
namespace Avalonia.Styling.UnitTests namespace Avalonia.Styling.UnitTests
@ -78,7 +79,7 @@ namespace Avalonia.Styling.UnitTests
default(Selector).OfType<Control1>().Class("foo"), default(Selector).OfType<Control1>().Class("foo"),
default(Selector).OfType<Control2>().Class("bar")); default(Selector).OfType<Control2>().Class("bar"));
Assert.Equal(typeof(TestControlBase), target.TargetType); Assert.Equal(typeof(Control), target.TargetType);
} }
[Fact] [Fact]
@ -91,15 +92,15 @@ namespace Avalonia.Styling.UnitTests
Assert.Equal(null, target.TargetType); Assert.Equal(null, target.TargetType);
} }
public class Control1 : TestControlBase public class Control1 : Control
{ {
} }
public class Control2 : TestControlBase public class Control2 : Control
{ {
} }
public class Control3 : TestControlBase public class Control3 : Control
{ {
} }
} }

Loading…
Cancel
Save