Browse Source

Added tests for absolute and relative path commands.

Some of the tests are currently failing.
pull/692/head
Steven Kirk 10 years ago
parent
commit
43e82e4e14
  1. 214
      tests/Avalonia.RenderTests/Shapes/PathTests.cs
  2. BIN
      tests/TestFiles/Direct2D1/Shapes/Path/Arc_Absolute.expected.png
  3. BIN
      tests/TestFiles/Direct2D1/Shapes/Path/Arc_Relative.expected.png
  4. BIN
      tests/TestFiles/Direct2D1/Shapes/Path/CubicBezier_Absolute.expected.png
  5. BIN
      tests/TestFiles/Direct2D1/Shapes/Path/CubicBezier_Relative.expected.png
  6. BIN
      tests/TestFiles/Direct2D1/Shapes/Path/HorizontalLine_Absolute.expected.png
  7. BIN
      tests/TestFiles/Direct2D1/Shapes/Path/HorizontalLine_Relative.expected.png
  8. BIN
      tests/TestFiles/Direct2D1/Shapes/Path/Line_Absolute.expected.png
  9. BIN
      tests/TestFiles/Direct2D1/Shapes/Path/Line_Relative.expected.png
  10. BIN
      tests/TestFiles/Direct2D1/Shapes/Path/VerticalLine_Absolute.expected.png
  11. BIN
      tests/TestFiles/Direct2D1/Shapes/Path/VerticalLine_Relative.expected.png

214
tests/Avalonia.RenderTests/Shapes/PathTests.cs

@ -24,6 +24,220 @@ namespace Avalonia.Direct2D1.RenderTests.Shapes
{
}
[Fact]
public void Line_Absolute()
{
Decorator target = new Decorator
{
Width = 200,
Height = 200,
Child = new Path
{
Stroke = Brushes.Red,
StrokeThickness = 1,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
Data = StreamGeometry.Parse("M 10,190 L 190,10 M0,0M200,200"),
}
};
RenderToFile(target);
CompareImages();
}
[Fact]
public void Line_Relative()
{
Decorator target = new Decorator
{
Width = 200,
Height = 200,
Child = new Path
{
Stroke = Brushes.Red,
StrokeThickness = 1,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
Data = StreamGeometry.Parse("M10,190 l190,-190 M0,0M200,200"),
}
};
RenderToFile(target);
CompareImages();
}
[Fact]
public void HorizontalLine_Absolute()
{
Decorator target = new Decorator
{
Width = 200,
Height = 200,
Child = new Path
{
Stroke = Brushes.Red,
StrokeThickness = 1,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
Data = StreamGeometry.Parse("M190,100 H10 M0,0M200,200"),
}
};
RenderToFile(target);
CompareImages();
}
[Fact]
public void HorizontalLine_Relative()
{
Decorator target = new Decorator
{
Width = 200,
Height = 200,
Child = new Path
{
Stroke = Brushes.Red,
StrokeThickness = 1,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
Data = StreamGeometry.Parse("M190,100 h-180 M0,0M200,200"),
}
};
RenderToFile(target);
CompareImages();
}
[Fact]
public void VerticalLine_Absolute()
{
Decorator target = new Decorator
{
Width = 200,
Height = 200,
Child = new Path
{
Stroke = Brushes.Red,
StrokeThickness = 1,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
Data = StreamGeometry.Parse("M100,190 V10 M0,0M200,200"),
}
};
RenderToFile(target);
CompareImages();
}
[Fact]
public void VerticalLine_Relative()
{
Decorator target = new Decorator
{
Width = 200,
Height = 200,
Child = new Path
{
Stroke = Brushes.Red,
StrokeThickness = 1,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
Data = StreamGeometry.Parse("M100,190 V-180 M0,0M200,200"),
}
};
RenderToFile(target);
CompareImages();
}
[Fact]
public void CubicBezier_Absolute()
{
Decorator target = new Decorator
{
Width = 200,
Height = 200,
Child = new Path
{
Fill = Brushes.Gray,
Stroke = Brushes.Red,
StrokeThickness = 1,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
Data = StreamGeometry.Parse("M190,0 C10,10 190,190 10,190 M0,0M200,200"),
}
};
RenderToFile(target);
CompareImages();
}
[Fact]
public void CubicBezier_Relative()
{
Decorator target = new Decorator
{
Width = 200,
Height = 200,
Child = new Path
{
Fill = Brushes.Gray,
Stroke = Brushes.Red,
StrokeThickness = 1,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
Data = StreamGeometry.Parse("M190,0 c-180,10 0,190 -180,190 M0,0M200,200"),
}
};
RenderToFile(target);
CompareImages();
}
[Fact]
public void Arc_Absolute()
{
Decorator target = new Decorator
{
Width = 200,
Height = 200,
Child = new Path
{
Fill = Brushes.Gray,
Stroke = Brushes.Red,
StrokeThickness = 1,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
Data = StreamGeometry.Parse("M190,100 A90,90 0 1,0 10,100 M0,0M200,200"),
}
};
RenderToFile(target);
CompareImages();
}
[Fact]
public void Arc_Relative()
{
Decorator target = new Decorator
{
Width = 200,
Height = 200,
Child = new Path
{
Fill = Brushes.Gray,
Stroke = Brushes.Red,
StrokeThickness = 1,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
Data = StreamGeometry.Parse("M190,100 a90,90 0 1,0 -180,0 M0,0M200,200"),
}
};
RenderToFile(target);
CompareImages();
}
[Fact]
public void Path_100px_Triangle_Centered()
{

BIN
tests/TestFiles/Direct2D1/Shapes/Path/Arc_Absolute.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
tests/TestFiles/Direct2D1/Shapes/Path/Arc_Relative.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
tests/TestFiles/Direct2D1/Shapes/Path/CubicBezier_Absolute.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
tests/TestFiles/Direct2D1/Shapes/Path/CubicBezier_Relative.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
tests/TestFiles/Direct2D1/Shapes/Path/HorizontalLine_Absolute.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 288 B

BIN
tests/TestFiles/Direct2D1/Shapes/Path/HorizontalLine_Relative.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 288 B

BIN
tests/TestFiles/Direct2D1/Shapes/Path/Line_Absolute.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 615 B

BIN
tests/TestFiles/Direct2D1/Shapes/Path/Line_Relative.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 615 B

BIN
tests/TestFiles/Direct2D1/Shapes/Path/VerticalLine_Absolute.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 593 B

BIN
tests/TestFiles/Direct2D1/Shapes/Path/VerticalLine_Relative.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 610 B

Loading…
Cancel
Save