Browse Source

Make ShapeLayoutTests use MockPlatformRenderInterface

repro-selecting-items-control-not-working-inside-popup
Nikita Tsukanov 9 years ago
parent
commit
a4c9f1e400
  1. 19
      tests/Avalonia.Layout.UnitTests/ShapeLayoutTests.cs
  2. 1
      tests/Avalonia.RenderTests/Avalonia.RenderTests.projitems
  3. 23
      tests/Avalonia.UnitTests/TestWithServicesBase.cs

19
tests/Avalonia.RenderTests/Shapes/ShapeTests.cs → tests/Avalonia.Layout.UnitTests/ShapeLayoutTests.cs

@ -2,20 +2,21 @@
using Avalonia.Controls;
using Avalonia.Controls.Shapes;
using Avalonia.Media;
using Avalonia.Platform;
using Avalonia.UnitTests;
using Xunit;
namespace Avalonia.Layout.UnitTests
#if AVALONIA_SKIA
namespace Avalonia.Skia.RenderTests
#else
namespace Avalonia.Direct2D1.RenderTests.Shapes
#endif
{
public class ShapeTests : TestBase
public class ShapeLayoutTests : TestWithServicesBase
{
public ShapeTests()
: base(@"Shapes\Shape")
{ }
public ShapeLayoutTests()
{
AvaloniaLocator.CurrentMutable
.Bind<IPlatformRenderInterface>().ToSingleton<MockPlatformRenderInterface>();
}
[Fact]
public void Shape_Transformation_Calculation_Should_Be_Deferred_To_Arrange_When_Strech_Is_Fill_And_Aviable_Size_Is_Infinite()

1
tests/Avalonia.RenderTests/Avalonia.RenderTests.projitems

@ -14,7 +14,6 @@
<Compile Include="$(MSBuildThisFileDirectory)Media\RadialGradientBrushTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Media\BitmapTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)OpacityMaskTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Shapes\ShapeTests.cs" />
<Compile Include="$(MSBuildThisFileDirectory)SVGPathTests.cs" />
<Compile Include="Media\FormattedTextImplTests.cs" />
<Compile Include="Controls\ImageTests.cs" />

23
tests/Avalonia.UnitTests/TestWithServicesBase.cs

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Avalonia.UnitTests
{
public class TestWithServicesBase : IDisposable
{
private IDisposable _scope;
public TestWithServicesBase()
{
_scope = AvaloniaLocator.EnterScope();
}
public void Dispose()
{
_scope.Dispose();
}
}
}
Loading…
Cancel
Save