1 changed files with 39 additions and 0 deletions
@ -0,0 +1,39 @@ |
|||
using System; |
|||
using Avalonia.Media; |
|||
using Avalonia.Platform; |
|||
using Avalonia.UnitTests; |
|||
using Moq; |
|||
using Xunit; |
|||
|
|||
namespace Avalonia.Visuals.UnitTests.Media |
|||
{ |
|||
public class RectangleGeometryTests |
|||
{ |
|||
[Fact] |
|||
public void Rectangle_With_Transform_Can_Be_Changed() |
|||
{ |
|||
using (UnitTestApplication.Start(GetServices())) |
|||
{ |
|||
var target = new RectangleGeometry |
|||
{ |
|||
Rect = new Rect(0, 0, 100, 100), |
|||
Transform = new RotateTransform(45), |
|||
}; |
|||
|
|||
target.Rect = new Rect(50, 50, 150, 150); |
|||
} |
|||
} |
|||
|
|||
private TestServices GetServices() |
|||
{ |
|||
var context = Mock.Of<IStreamGeometryContextImpl>(); |
|||
var transformedGeometry = new Mock<IGeometryImpl>(); |
|||
var streamGeometry = Mock.Of<IStreamGeometryImpl>(x => |
|||
x.Open() == context && |
|||
x.WithTransform(It.IsAny<Matrix>()) == transformedGeometry.Object); |
|||
var renderInterface = Mock.Of<IPlatformRenderInterface>(x => |
|||
x.CreateStreamGeometry() == streamGeometry); |
|||
return new TestServices(renderInterface: renderInterface); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue