csharpc-sharpdotnetxamlavaloniauicross-platformcross-platform-xamlavaloniaguimulti-platformuser-interfacedotnetcore
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.2 KiB
40 lines
1.2 KiB
// 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.
|
|
|
|
using Avalonia.Media;
|
|
using Xunit;
|
|
|
|
namespace Avalonia.Direct2D1.UnitTests.Media
|
|
{
|
|
public class GeometryTests
|
|
{
|
|
private static readonly RectComparer Compare = new RectComparer();
|
|
|
|
[Fact]
|
|
public void Should_Measure_Expander_Triangle_Correctly()
|
|
{
|
|
using (AvaloniaLocator.EnterScope())
|
|
{
|
|
Direct2D1Platform.Initialize();
|
|
|
|
var target = StreamGeometry.Parse("M 0 2 L 4 6 L 0 10 Z");
|
|
|
|
Assert.Equal(new Rect(0, 2, 4, 8), target.Bounds, Compare);
|
|
}
|
|
}
|
|
|
|
[Fact]
|
|
public void Should_Measure_Expander_Triangle_With_Stroke_Correctly()
|
|
{
|
|
using (AvaloniaLocator.EnterScope())
|
|
{
|
|
Direct2D1Platform.Initialize();
|
|
|
|
var target = StreamGeometry.Parse("M 0 2 L 4 6 L 0 10 Z");
|
|
var pen = new Pen(Brushes.Black, 2);
|
|
|
|
Assert.Equal(new Rect(-1, -0.414, 6.414, 12.828), target.GetRenderBounds(pen), Compare);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|