Browse Source

Added brush tests to cairo render tests.

VisualBrush tests currently ignored as it's not yet implemented on
cairo.
pull/141/head
Steven Kirk 11 years ago
parent
commit
b0401f5c71
  1. BIN
      Tests/TestFiles/Cairo/Media/LinearGradientBrush/LinearGradientBrush_RedBlue_Fill.expected.png
  2. BIN
      Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Align_BottomRight.expected.png
  3. BIN
      Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Align_Center.expected.png
  4. BIN
      Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Align_TopLeft.expected.png
  5. BIN
      Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_DestinationRect_Absolute.expected.png
  6. BIN
      Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_FlipX.expected.png
  7. BIN
      Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_FlipXY.expected.png
  8. BIN
      Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_FlipY.expected.png
  9. BIN
      Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_SourceRect_Absolute.expected.png
  10. BIN
      Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_SourceRect_DestinationRect_Absolute.expected.png
  11. BIN
      Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_SourceRect_DestinationRect_Percent.expected.png
  12. BIN
      Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Stretch_Fill_Large.expected.png
  13. BIN
      Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Stretch_Uniform.expected.png
  14. BIN
      Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Stretch_UniformToFill.expected.png
  15. BIN
      Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Tile.expected.png
  16. BIN
      Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Tile_Alignment_BottomRight.expected.png
  17. 5
      src/Gtk/Perspex.Cairo/CairoExtensions.cs
  18. 8
      src/Gtk/Perspex.Cairo/Media/DrawingContext.cs
  19. 4
      tests/Perspex.RenderTests/Media/LinearGradientBrushTests.cs
  20. 64
      tests/Perspex.RenderTests/Media/VisualBrushTests.cs
  21. 2
      tests/Perspex.RenderTests/Perspex.Cairo.RenderTests.csproj

BIN
Tests/TestFiles/Cairo/Media/LinearGradientBrush/LinearGradientBrush_RedBlue_Fill.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 611 B

BIN
Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Align_BottomRight.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 928 B

BIN
Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Align_Center.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 924 B

BIN
Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Align_TopLeft.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 934 B

BIN
Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_DestinationRect_Absolute.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_FlipX.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_FlipXY.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_FlipY.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_SourceRect_Absolute.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_SourceRect_DestinationRect_Absolute.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_SourceRect_DestinationRect_Percent.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Stretch_Fill_Large.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Stretch_Uniform.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Stretch_UniformToFill.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Tile.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Tile_Alignment_BottomRight.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 928 B

5
src/Gtk/Perspex.Cairo/CairoExtensions.cs

@ -7,6 +7,11 @@ namespace Perspex.Cairo
public static class CairoExtensions
{
public static Cairo.Color ToCairo(this Perspex.Media.Color color)
{
return new Cairo.Color(color.R / 255.0, color.G / 255.0, color.B / 255.0, color.A / 255.0);
}
public static Cairo.Matrix ToCairo(this Matrix m)
{
return new Cairo.Matrix(m.M11, m.M12, m.M21, m.M22, m.M31, m.M32);

8
src/Gtk/Perspex.Cairo/Media/DrawingContext.cs

@ -227,10 +227,14 @@ namespace Perspex.Cairo.Media
}
else if (linearGradientBrush != null)
{
Cairo.LinearGradient g = new Cairo.LinearGradient(linearGradientBrush.StartPoint.X * destinationSize.Width, linearGradientBrush.StartPoint.Y * destinationSize.Height, linearGradientBrush.EndPoint.X * destinationSize.Width, linearGradientBrush.EndPoint.Y * destinationSize.Height);
Cairo.LinearGradient g = new Cairo.LinearGradient(
linearGradientBrush.StartPoint.X * destinationSize.Width,
linearGradientBrush.StartPoint.Y * destinationSize.Height,
linearGradientBrush.EndPoint.X * destinationSize.Width,
linearGradientBrush.EndPoint.Y * destinationSize.Height);
foreach (var s in linearGradientBrush.GradientStops)
g.AddColorStop(s.Offset, new Cairo.Color(s.Color.R / 255.0, s.Color.G / 255.0, s.Color.B / 255.0, s.Color.A / 255.0));
g.AddColorStop(s.Offset, s.Color.ToCairo());
g.Extend = Cairo.Extend.Pad;

4
tests/Perspex.RenderTests/Media/LinearGradientBrushTests.cs

@ -10,7 +10,11 @@ using System.Text;
using System.Threading.Tasks;
using Xunit;
#if PERSPEX_CAIRO
namespace Perspex.Cairo.RenderTests.Media
#else
namespace Perspex.Direct2D1.RenderTests.Media
#endif
{
public class LinearGradientBrushTests : TestBase
{

64
tests/Perspex.RenderTests/Media/VisualBrushTests.cs

@ -7,7 +7,11 @@ using Perspex.Layout;
using Perspex.Media;
using Xunit;
#if PERSPEX_CAIRO
namespace Perspex.Cairo.RenderTests.Media
#else
namespace Perspex.Direct2D1.RenderTests.Media
#endif
{
public class VisualBrushTests : TestBase
{
@ -16,7 +20,11 @@ namespace Perspex.Direct2D1.RenderTests.Media
{
}
#if PERSPEX_CAIRO
[Fact(Skip = "VisualBrush not yet implemented on Cairo")]
#else
[Fact]
#endif
public void VisualBrush_Align_TopLeft()
{
Decorator target = new Decorator
@ -55,7 +63,11 @@ namespace Perspex.Direct2D1.RenderTests.Media
CompareImages();
}
#if PERSPEX_CAIRO
[Fact(Skip = "VisualBrush not yet implemented on Cairo")]
#else
[Fact]
#endif
public void VisualBrush_Align_Center()
{
Decorator target = new Decorator
@ -94,7 +106,11 @@ namespace Perspex.Direct2D1.RenderTests.Media
CompareImages();
}
#if PERSPEX_CAIRO
[Fact(Skip = "VisualBrush not yet implemented on Cairo")]
#else
[Fact]
#endif
public void VisualBrush_Align_BottomRight()
{
Decorator target = new Decorator
@ -133,7 +149,11 @@ namespace Perspex.Direct2D1.RenderTests.Media
CompareImages();
}
#if PERSPEX_CAIRO
[Fact(Skip = "VisualBrush not yet implemented on Cairo")]
#else
[Fact]
#endif
public void VisualBrush_Stretch_Fill_Large()
{
Decorator target = new Decorator
@ -170,7 +190,11 @@ namespace Perspex.Direct2D1.RenderTests.Media
CompareImages();
}
#if PERSPEX_CAIRO
[Fact(Skip = "VisualBrush not yet implemented on Cairo")]
#else
[Fact]
#endif
public void VisualBrush_Stretch_Uniform()
{
Decorator target = new Decorator
@ -207,7 +231,11 @@ namespace Perspex.Direct2D1.RenderTests.Media
CompareImages();
}
#if PERSPEX_CAIRO
[Fact(Skip = "VisualBrush not yet implemented on Cairo")]
#else
[Fact]
#endif
public void VisualBrush_Stretch_UniformToFill()
{
Decorator target = new Decorator
@ -244,7 +272,11 @@ namespace Perspex.Direct2D1.RenderTests.Media
CompareImages();
}
#if PERSPEX_CAIRO
[Fact(Skip = "VisualBrush not yet implemented on Cairo")]
#else
[Fact]
#endif
public void VisualBrush_SourceRect_Absolute()
{
Decorator target = new Decorator
@ -281,7 +313,11 @@ namespace Perspex.Direct2D1.RenderTests.Media
CompareImages();
}
#if PERSPEX_CAIRO
[Fact(Skip = "VisualBrush not yet implemented on Cairo")]
#else
[Fact]
#endif
public void VisualBrush_DestinationRect_Absolute()
{
Decorator target = new Decorator
@ -318,7 +354,11 @@ namespace Perspex.Direct2D1.RenderTests.Media
CompareImages();
}
#if PERSPEX_CAIRO
[Fact(Skip = "VisualBrush not yet implemented on Cairo")]
#else
[Fact]
#endif
public void VisualBrush_SourceRect_DestinationRect_Absolute()
{
Decorator target = new Decorator
@ -356,7 +396,11 @@ namespace Perspex.Direct2D1.RenderTests.Media
CompareImages();
}
#if PERSPEX_CAIRO
[Fact(Skip = "VisualBrush not yet implemented on Cairo")]
#else
[Fact]
#endif
public void VisualBrush_SourceRect_DestinationRect_Percent()
{
Decorator target = new Decorator
@ -394,7 +438,11 @@ namespace Perspex.Direct2D1.RenderTests.Media
CompareImages();
}
#if PERSPEX_CAIRO
[Fact(Skip = "VisualBrush not yet implemented on Cairo")]
#else
[Fact]
#endif
public void VisualBrush_Tile()
{
Decorator target = new Decorator
@ -433,7 +481,11 @@ namespace Perspex.Direct2D1.RenderTests.Media
CompareImages();
}
#if PERSPEX_CAIRO
[Fact(Skip = "VisualBrush not yet implemented on Cairo")]
#else
[Fact]
#endif
public void VisualBrush_Tile_Alignment_BottomRight()
{
Decorator target = new Decorator
@ -473,7 +525,11 @@ namespace Perspex.Direct2D1.RenderTests.Media
CompareImages();
}
#if PERSPEX_CAIRO
[Fact(Skip = "VisualBrush not yet implemented on Cairo")]
#else
[Fact]
#endif
public void VisualBrush_FlipX()
{
Decorator target = new Decorator
@ -512,7 +568,11 @@ namespace Perspex.Direct2D1.RenderTests.Media
CompareImages();
}
#if PERSPEX_CAIRO
[Fact(Skip = "VisualBrush not yet implemented on Cairo")]
#else
[Fact]
#endif
public void VisualBrush_FlipY()
{
Decorator target = new Decorator
@ -551,7 +611,11 @@ namespace Perspex.Direct2D1.RenderTests.Media
CompareImages();
}
#if PERSPEX_CAIRO
[Fact(Skip = "VisualBrush not yet implemented on Cairo")]
#else
[Fact]
#endif
public void VisualBrush_FlipXY()
{
Decorator target = new Decorator

2
tests/Perspex.RenderTests/Perspex.Cairo.RenderTests.csproj

@ -74,6 +74,8 @@
<ItemGroup>
<Compile Include="Controls\ImageTests.cs" />
<Compile Include="Controls\BorderTests.cs" />
<Compile Include="Media\LinearGradientBrushTests.cs" />
<Compile Include="Media\VisualBrushTests.cs" />
<Compile Include="Shapes\PathTests.cs" />
<Compile Include="Shapes\EllipseTests.cs" />
<Compile Include="Shapes\RectangleTests.cs" />

Loading…
Cancel
Save