|
|
|
@ -5,6 +5,7 @@ using Perspex.Controls; |
|
|
|
using Perspex.Controls.Shapes; |
|
|
|
using Perspex.Layout; |
|
|
|
using Perspex.Media; |
|
|
|
using Perspex.Media.Imaging; |
|
|
|
using Xunit; |
|
|
|
|
|
|
|
#if PERSPEX_CAIRO
|
|
|
|
@ -20,47 +21,41 @@ namespace Perspex.Direct2D1.RenderTests.Media |
|
|
|
{ |
|
|
|
} |
|
|
|
|
|
|
|
#if PERSPEX_CAIRO
|
|
|
|
[Fact(Skip = "VisualBrush not yet implemented on Cairo")] |
|
|
|
#else
|
|
|
|
[Fact] |
|
|
|
#endif
|
|
|
|
public void VisualBrush_Align_TopLeft() |
|
|
|
private string BitmapPath |
|
|
|
{ |
|
|
|
Decorator target = new Decorator |
|
|
|
get { return System.IO.Path.Combine(OutputPath, "github_icon.png"); } |
|
|
|
} |
|
|
|
|
|
|
|
private Control Visual |
|
|
|
{ |
|
|
|
get |
|
|
|
{ |
|
|
|
Padding = new Thickness(8), |
|
|
|
Width = 200, |
|
|
|
Height = 200, |
|
|
|
Child = new Rectangle |
|
|
|
return new Panel |
|
|
|
{ |
|
|
|
Fill = new VisualBrush |
|
|
|
Children = new Perspex.Controls.Controls |
|
|
|
{ |
|
|
|
AlignmentX = AlignmentX.Left, |
|
|
|
AlignmentY = AlignmentY.Top, |
|
|
|
Stretch = Stretch.None, |
|
|
|
Visual = new Border |
|
|
|
new Image |
|
|
|
{ |
|
|
|
Source = new Bitmap(BitmapPath), |
|
|
|
}, |
|
|
|
new Border |
|
|
|
{ |
|
|
|
Width = 92, |
|
|
|
Height = 92, |
|
|
|
Background = Brushes.Red, |
|
|
|
BorderBrush = Brushes.Black, |
|
|
|
BorderBrush = Brushes.Blue, |
|
|
|
BorderThickness = 2, |
|
|
|
HorizontalAlignment = HorizontalAlignment.Center, |
|
|
|
VerticalAlignment = VerticalAlignment.Center, |
|
|
|
Child = new TextBlock |
|
|
|
{ |
|
|
|
Text = "Perspex", |
|
|
|
FontSize = 12, |
|
|
|
FontSize = 24, |
|
|
|
FontFamily = "Arial", |
|
|
|
HorizontalAlignment = HorizontalAlignment.Center, |
|
|
|
VerticalAlignment = VerticalAlignment.Center, |
|
|
|
Background = Brushes.Green, |
|
|
|
Foreground = Brushes.Yellow, |
|
|
|
Text = "VisualBrush", |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
RenderToFile(target); |
|
|
|
CompareImages(); |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#if PERSPEX_CAIRO
|
|
|
|
@ -68,7 +63,7 @@ namespace Perspex.Direct2D1.RenderTests.Media |
|
|
|
#else
|
|
|
|
[Fact] |
|
|
|
#endif
|
|
|
|
public void VisualBrush_Align_Center() |
|
|
|
public void VisualBrush_NoStretch_NoTile_Alignment_TopLeft() |
|
|
|
{ |
|
|
|
Decorator target = new Decorator |
|
|
|
{ |
|
|
|
@ -79,25 +74,11 @@ namespace Perspex.Direct2D1.RenderTests.Media |
|
|
|
{ |
|
|
|
Fill = new VisualBrush |
|
|
|
{ |
|
|
|
AlignmentX = AlignmentX.Center, |
|
|
|
AlignmentY = AlignmentY.Center, |
|
|
|
Stretch = Stretch.None, |
|
|
|
Visual = new Border |
|
|
|
{ |
|
|
|
Width = 92, |
|
|
|
Height = 92, |
|
|
|
Background = Brushes.Red, |
|
|
|
BorderBrush = Brushes.Black, |
|
|
|
BorderThickness = 2, |
|
|
|
Child = new TextBlock |
|
|
|
{ |
|
|
|
Text = "Perspex", |
|
|
|
FontSize = 12, |
|
|
|
FontFamily = "Arial", |
|
|
|
HorizontalAlignment = HorizontalAlignment.Center, |
|
|
|
VerticalAlignment = VerticalAlignment.Center, |
|
|
|
} |
|
|
|
} |
|
|
|
TileMode = TileMode.None, |
|
|
|
AlignmentX = AlignmentX.Left, |
|
|
|
AlignmentY = AlignmentY.Top, |
|
|
|
Visual = Visual, |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
@ -111,7 +92,7 @@ namespace Perspex.Direct2D1.RenderTests.Media |
|
|
|
#else
|
|
|
|
[Fact] |
|
|
|
#endif
|
|
|
|
public void VisualBrush_Align_BottomRight() |
|
|
|
public void VisualBrush_NoStretch_NoTile_Alignment_Center() |
|
|
|
{ |
|
|
|
Decorator target = new Decorator |
|
|
|
{ |
|
|
|
@ -122,25 +103,11 @@ namespace Perspex.Direct2D1.RenderTests.Media |
|
|
|
{ |
|
|
|
Fill = new VisualBrush |
|
|
|
{ |
|
|
|
AlignmentX = AlignmentX.Right, |
|
|
|
AlignmentY = AlignmentY.Bottom, |
|
|
|
Stretch = Stretch.None, |
|
|
|
Visual = new Border |
|
|
|
{ |
|
|
|
Width = 92, |
|
|
|
Height = 92, |
|
|
|
Background = Brushes.Red, |
|
|
|
BorderBrush = Brushes.Black, |
|
|
|
BorderThickness = 2, |
|
|
|
Child = new TextBlock |
|
|
|
{ |
|
|
|
Text = "Perspex", |
|
|
|
FontSize = 12, |
|
|
|
FontFamily = "Arial", |
|
|
|
HorizontalAlignment = HorizontalAlignment.Center, |
|
|
|
VerticalAlignment = VerticalAlignment.Center, |
|
|
|
} |
|
|
|
} |
|
|
|
TileMode = TileMode.None, |
|
|
|
AlignmentX = AlignmentX.Center, |
|
|
|
AlignmentY = AlignmentY.Center, |
|
|
|
Visual = Visual, |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
@ -154,34 +121,22 @@ namespace Perspex.Direct2D1.RenderTests.Media |
|
|
|
#else
|
|
|
|
[Fact] |
|
|
|
#endif
|
|
|
|
public void VisualBrush_Stretch_Fill_Large() |
|
|
|
public void VisualBrush_NoStretch_NoTile_Alignment_BottomRight() |
|
|
|
{ |
|
|
|
Decorator target = new Decorator |
|
|
|
{ |
|
|
|
Padding = new Thickness(8), |
|
|
|
Width = 920, |
|
|
|
Height = 920, |
|
|
|
Width = 200, |
|
|
|
Height = 200, |
|
|
|
Child = new Rectangle |
|
|
|
{ |
|
|
|
Fill = new VisualBrush |
|
|
|
{ |
|
|
|
Stretch = Stretch.Fill, |
|
|
|
Visual = new Border |
|
|
|
{ |
|
|
|
Width = 92, |
|
|
|
Height = 92, |
|
|
|
Background = Brushes.Red, |
|
|
|
BorderBrush = Brushes.Black, |
|
|
|
BorderThickness = 2, |
|
|
|
Child = new TextBlock |
|
|
|
{ |
|
|
|
Text = "Perspex", |
|
|
|
FontSize = 12, |
|
|
|
FontFamily = "Arial", |
|
|
|
HorizontalAlignment = HorizontalAlignment.Center, |
|
|
|
VerticalAlignment = VerticalAlignment.Center, |
|
|
|
} |
|
|
|
} |
|
|
|
Stretch = Stretch.None, |
|
|
|
TileMode = TileMode.None, |
|
|
|
AlignmentX = AlignmentX.Right, |
|
|
|
AlignmentY = AlignmentY.Bottom, |
|
|
|
Visual = Visual, |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
@ -195,34 +150,20 @@ namespace Perspex.Direct2D1.RenderTests.Media |
|
|
|
#else
|
|
|
|
[Fact] |
|
|
|
#endif
|
|
|
|
public void VisualBrush_Stretch_Uniform() |
|
|
|
public void VisualBrush_Fill_NoTile() |
|
|
|
{ |
|
|
|
Decorator target = new Decorator |
|
|
|
{ |
|
|
|
Padding = new Thickness(8), |
|
|
|
Width = 920, |
|
|
|
Height = 820, |
|
|
|
Height = 920, |
|
|
|
Child = new Rectangle |
|
|
|
{ |
|
|
|
Fill = new VisualBrush |
|
|
|
{ |
|
|
|
Stretch = Stretch.Uniform, |
|
|
|
Visual = new Border |
|
|
|
{ |
|
|
|
Width = 92, |
|
|
|
Height = 92, |
|
|
|
Background = Brushes.Red, |
|
|
|
BorderBrush = Brushes.Black, |
|
|
|
BorderThickness = 2, |
|
|
|
Child = new TextBlock |
|
|
|
{ |
|
|
|
Text = "Perspex", |
|
|
|
FontSize = 12, |
|
|
|
FontFamily = "Arial", |
|
|
|
HorizontalAlignment = HorizontalAlignment.Center, |
|
|
|
VerticalAlignment = VerticalAlignment.Center, |
|
|
|
} |
|
|
|
} |
|
|
|
Stretch = Stretch.Fill, |
|
|
|
TileMode = TileMode.None, |
|
|
|
Visual = Visual, |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
@ -236,34 +177,20 @@ namespace Perspex.Direct2D1.RenderTests.Media |
|
|
|
#else
|
|
|
|
[Fact] |
|
|
|
#endif
|
|
|
|
public void VisualBrush_Stretch_UniformToFill() |
|
|
|
public void VisualBrush_Uniform_NoTile() |
|
|
|
{ |
|
|
|
Decorator target = new Decorator |
|
|
|
{ |
|
|
|
Padding = new Thickness(8), |
|
|
|
Width = 920, |
|
|
|
Height = 820, |
|
|
|
Width = 300, |
|
|
|
Height = 200, |
|
|
|
Child = new Rectangle |
|
|
|
{ |
|
|
|
Fill = new VisualBrush |
|
|
|
{ |
|
|
|
Stretch = Stretch.UniformToFill, |
|
|
|
Visual = new Border |
|
|
|
{ |
|
|
|
Width = 92, |
|
|
|
Height = 92, |
|
|
|
Background = Brushes.Red, |
|
|
|
BorderBrush = Brushes.Black, |
|
|
|
BorderThickness = 2, |
|
|
|
Child = new TextBlock |
|
|
|
{ |
|
|
|
Text = "Perspex", |
|
|
|
FontSize = 12, |
|
|
|
FontFamily = "Arial", |
|
|
|
HorizontalAlignment = HorizontalAlignment.Center, |
|
|
|
VerticalAlignment = VerticalAlignment.Center, |
|
|
|
} |
|
|
|
} |
|
|
|
Stretch = Stretch.Uniform, |
|
|
|
TileMode = TileMode.None, |
|
|
|
Visual = Visual, |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
@ -277,34 +204,20 @@ namespace Perspex.Direct2D1.RenderTests.Media |
|
|
|
#else
|
|
|
|
[Fact] |
|
|
|
#endif
|
|
|
|
public void VisualBrush_SourceRect_Absolute() |
|
|
|
public void VisualBrush_UniformToFill_NoTile() |
|
|
|
{ |
|
|
|
Decorator target = new Decorator |
|
|
|
{ |
|
|
|
Padding = new Thickness(8), |
|
|
|
Width = 200, |
|
|
|
Width = 300, |
|
|
|
Height = 200, |
|
|
|
Child = new Rectangle |
|
|
|
{ |
|
|
|
Fill = new VisualBrush |
|
|
|
{ |
|
|
|
SourceRect = new RelativeRect(40, 40, 100, 100, RelativeUnit.Absolute), |
|
|
|
Visual = new Border |
|
|
|
{ |
|
|
|
Width = 180, |
|
|
|
Height = 180, |
|
|
|
Background = Brushes.Red, |
|
|
|
BorderBrush = Brushes.Black, |
|
|
|
BorderThickness = 2, |
|
|
|
Child = new Ellipse |
|
|
|
{ |
|
|
|
Width = 100, |
|
|
|
Height = 100, |
|
|
|
Fill = Brushes.Yellow, |
|
|
|
VerticalAlignment = VerticalAlignment.Center, |
|
|
|
HorizontalAlignment = HorizontalAlignment.Center, |
|
|
|
} |
|
|
|
} |
|
|
|
Stretch = Stretch.UniformToFill, |
|
|
|
TileMode = TileMode.None, |
|
|
|
Visual = Visual, |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
@ -318,7 +231,7 @@ namespace Perspex.Direct2D1.RenderTests.Media |
|
|
|
#else
|
|
|
|
[Fact] |
|
|
|
#endif
|
|
|
|
public void VisualBrush_DestinationRect_Absolute() |
|
|
|
public void VisualBrush_NoStretch_NoTile_BottomRightQuarterSource() |
|
|
|
{ |
|
|
|
Decorator target = new Decorator |
|
|
|
{ |
|
|
|
@ -329,23 +242,10 @@ namespace Perspex.Direct2D1.RenderTests.Media |
|
|
|
{ |
|
|
|
Fill = new VisualBrush |
|
|
|
{ |
|
|
|
DestinationRect = new RelativeRect(92, 92, 92, 92, RelativeUnit.Absolute), |
|
|
|
Visual = new Border |
|
|
|
{ |
|
|
|
Width = 180, |
|
|
|
Height = 180, |
|
|
|
Background = Brushes.Red, |
|
|
|
BorderBrush = Brushes.Black, |
|
|
|
BorderThickness = 2, |
|
|
|
Child = new Ellipse |
|
|
|
{ |
|
|
|
Width = 100, |
|
|
|
Height = 100, |
|
|
|
Fill = Brushes.Yellow, |
|
|
|
VerticalAlignment = VerticalAlignment.Center, |
|
|
|
HorizontalAlignment = HorizontalAlignment.Center, |
|
|
|
} |
|
|
|
} |
|
|
|
Stretch = Stretch.None, |
|
|
|
TileMode = TileMode.None, |
|
|
|
SourceRect = new RelativeRect(250, 250, 250, 250, RelativeUnit.Absolute), |
|
|
|
Visual = Visual, |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
@ -359,7 +259,7 @@ namespace Perspex.Direct2D1.RenderTests.Media |
|
|
|
#else
|
|
|
|
[Fact] |
|
|
|
#endif
|
|
|
|
public void VisualBrush_SourceRect_DestinationRect_Absolute() |
|
|
|
public void VisualBrush_NoStretch_NoTile_BottomRightQuarterDest() |
|
|
|
{ |
|
|
|
Decorator target = new Decorator |
|
|
|
{ |
|
|
|
@ -370,24 +270,10 @@ namespace Perspex.Direct2D1.RenderTests.Media |
|
|
|
{ |
|
|
|
Fill = new VisualBrush |
|
|
|
{ |
|
|
|
SourceRect = new RelativeRect(40, 40, 100, 100, RelativeUnit.Absolute), |
|
|
|
Stretch = Stretch.None, |
|
|
|
TileMode = TileMode.None, |
|
|
|
DestinationRect = new RelativeRect(92, 92, 92, 92, RelativeUnit.Absolute), |
|
|
|
Visual = new Border |
|
|
|
{ |
|
|
|
Width = 180, |
|
|
|
Height = 180, |
|
|
|
Background = Brushes.Red, |
|
|
|
BorderBrush = Brushes.Black, |
|
|
|
BorderThickness = 2, |
|
|
|
Child = new Ellipse |
|
|
|
{ |
|
|
|
Width = 100, |
|
|
|
Height = 100, |
|
|
|
Fill = Brushes.Yellow, |
|
|
|
VerticalAlignment = VerticalAlignment.Center, |
|
|
|
HorizontalAlignment = HorizontalAlignment.Center, |
|
|
|
} |
|
|
|
} |
|
|
|
Visual = Visual, |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
@ -401,7 +287,7 @@ namespace Perspex.Direct2D1.RenderTests.Media |
|
|
|
#else
|
|
|
|
[Fact] |
|
|
|
#endif
|
|
|
|
public void VisualBrush_SourceRect_DestinationRect_Percent() |
|
|
|
public void VisualBrush_NoStretch_NoTile_BottomRightQuarterSource_BottomRightQuarterDest() |
|
|
|
{ |
|
|
|
Decorator target = new Decorator |
|
|
|
{ |
|
|
|
@ -412,24 +298,11 @@ namespace Perspex.Direct2D1.RenderTests.Media |
|
|
|
{ |
|
|
|
Fill = new VisualBrush |
|
|
|
{ |
|
|
|
SourceRect = new RelativeRect(0.22, 0.22, 0.56, 0.56, RelativeUnit.Relative), |
|
|
|
Stretch = Stretch.None, |
|
|
|
TileMode = TileMode.None, |
|
|
|
SourceRect = new RelativeRect(0.5, 0.5, 0.5, 0.5, RelativeUnit.Relative), |
|
|
|
DestinationRect = new RelativeRect(0.5, 0.5, 0.5, 0.5, RelativeUnit.Relative), |
|
|
|
Visual = new Border |
|
|
|
{ |
|
|
|
Width = 180, |
|
|
|
Height = 180, |
|
|
|
Background = Brushes.Red, |
|
|
|
BorderBrush = Brushes.Black, |
|
|
|
BorderThickness = 2, |
|
|
|
Child = new Ellipse |
|
|
|
{ |
|
|
|
Width = 100, |
|
|
|
Height = 100, |
|
|
|
Fill = Brushes.Yellow, |
|
|
|
VerticalAlignment = VerticalAlignment.Center, |
|
|
|
HorizontalAlignment = HorizontalAlignment.Center, |
|
|
|
} |
|
|
|
} |
|
|
|
Visual = Visual, |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
@ -443,7 +316,7 @@ namespace Perspex.Direct2D1.RenderTests.Media |
|
|
|
#else
|
|
|
|
[Fact] |
|
|
|
#endif
|
|
|
|
public void VisualBrush_Tile() |
|
|
|
public void VisualBrush_NoStretch_Tile_BottomRightQuarterSource_CenterQuarterDest() |
|
|
|
{ |
|
|
|
Decorator target = new Decorator |
|
|
|
{ |
|
|
|
@ -456,67 +329,9 @@ namespace Perspex.Direct2D1.RenderTests.Media |
|
|
|
{ |
|
|
|
Stretch = Stretch.None, |
|
|
|
TileMode = TileMode.Tile, |
|
|
|
SourceRect = new RelativeRect(0.5, 0.5, 0.5, 0.5, RelativeUnit.Relative), |
|
|
|
DestinationRect = new RelativeRect(0.25, 0.25, 0.5, 0.5, RelativeUnit.Relative), |
|
|
|
Visual = new Border |
|
|
|
{ |
|
|
|
Width = 92, |
|
|
|
Height = 92, |
|
|
|
Background = Brushes.Red, |
|
|
|
BorderBrush = Brushes.Black, |
|
|
|
BorderThickness = 2, |
|
|
|
Child = new TextBlock |
|
|
|
{ |
|
|
|
Text = "Perspex", |
|
|
|
FontSize = 12, |
|
|
|
FontFamily = "Arial", |
|
|
|
HorizontalAlignment = HorizontalAlignment.Center, |
|
|
|
VerticalAlignment = VerticalAlignment.Center, |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
RenderToFile(target); |
|
|
|
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 |
|
|
|
{ |
|
|
|
Padding = new Thickness(8), |
|
|
|
Width = 200, |
|
|
|
Height = 200, |
|
|
|
Child = new Rectangle |
|
|
|
{ |
|
|
|
Fill = new VisualBrush |
|
|
|
{ |
|
|
|
Stretch = Stretch.None, |
|
|
|
TileMode = TileMode.Tile, |
|
|
|
AlignmentX = AlignmentX.Right, |
|
|
|
AlignmentY = AlignmentY.Bottom, |
|
|
|
Visual = new Border |
|
|
|
{ |
|
|
|
Width = 92, |
|
|
|
Height = 92, |
|
|
|
Background = Brushes.Red, |
|
|
|
BorderBrush = Brushes.Black, |
|
|
|
BorderThickness = 2, |
|
|
|
Child = new TextBlock |
|
|
|
{ |
|
|
|
Text = "Perspex", |
|
|
|
FontSize = 12, |
|
|
|
FontFamily = "Arial", |
|
|
|
HorizontalAlignment = HorizontalAlignment.Center, |
|
|
|
VerticalAlignment = VerticalAlignment.Center, |
|
|
|
} |
|
|
|
} |
|
|
|
Visual = Visual, |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
@ -530,7 +345,7 @@ namespace Perspex.Direct2D1.RenderTests.Media |
|
|
|
#else
|
|
|
|
[Fact] |
|
|
|
#endif
|
|
|
|
public void VisualBrush_FlipX() |
|
|
|
public void VisualBrush_NoStretch_FlipX_TopLeftDest() |
|
|
|
{ |
|
|
|
Decorator target = new Decorator |
|
|
|
{ |
|
|
|
@ -544,22 +359,7 @@ namespace Perspex.Direct2D1.RenderTests.Media |
|
|
|
Stretch = Stretch.None, |
|
|
|
TileMode = TileMode.FlipX, |
|
|
|
DestinationRect = new RelativeRect(0, 0, 0.5, 0.5, RelativeUnit.Relative), |
|
|
|
Visual = new Border |
|
|
|
{ |
|
|
|
Width = 92, |
|
|
|
Height = 92, |
|
|
|
Background = Brushes.Red, |
|
|
|
BorderBrush = Brushes.Black, |
|
|
|
BorderThickness = 2, |
|
|
|
Child = new TextBlock |
|
|
|
{ |
|
|
|
Text = "Perspex", |
|
|
|
FontSize = 12, |
|
|
|
FontFamily = "Arial", |
|
|
|
HorizontalAlignment = HorizontalAlignment.Center, |
|
|
|
VerticalAlignment = VerticalAlignment.Center, |
|
|
|
} |
|
|
|
} |
|
|
|
Visual = Visual, |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
@ -573,7 +373,7 @@ namespace Perspex.Direct2D1.RenderTests.Media |
|
|
|
#else
|
|
|
|
[Fact] |
|
|
|
#endif
|
|
|
|
public void VisualBrush_FlipY() |
|
|
|
public void VisualBrush_NoStretch_FlipY_TopLeftDest() |
|
|
|
{ |
|
|
|
Decorator target = new Decorator |
|
|
|
{ |
|
|
|
@ -587,22 +387,7 @@ namespace Perspex.Direct2D1.RenderTests.Media |
|
|
|
Stretch = Stretch.None, |
|
|
|
TileMode = TileMode.FlipY, |
|
|
|
DestinationRect = new RelativeRect(0, 0, 0.5, 0.5, RelativeUnit.Relative), |
|
|
|
Visual = new Border |
|
|
|
{ |
|
|
|
Width = 92, |
|
|
|
Height = 92, |
|
|
|
Background = Brushes.Red, |
|
|
|
BorderBrush = Brushes.Black, |
|
|
|
BorderThickness = 2, |
|
|
|
Child = new TextBlock |
|
|
|
{ |
|
|
|
Text = "Perspex", |
|
|
|
FontSize = 12, |
|
|
|
FontFamily = "Arial", |
|
|
|
HorizontalAlignment = HorizontalAlignment.Center, |
|
|
|
VerticalAlignment = VerticalAlignment.Center, |
|
|
|
} |
|
|
|
} |
|
|
|
Visual = Visual, |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
@ -616,7 +401,7 @@ namespace Perspex.Direct2D1.RenderTests.Media |
|
|
|
#else
|
|
|
|
[Fact] |
|
|
|
#endif
|
|
|
|
public void VisualBrush_FlipXY() |
|
|
|
public void VisualBrush_NoStretch_FlipXY_TopLeftDest() |
|
|
|
{ |
|
|
|
Decorator target = new Decorator |
|
|
|
{ |
|
|
|
@ -630,48 +415,11 @@ namespace Perspex.Direct2D1.RenderTests.Media |
|
|
|
Stretch = Stretch.None, |
|
|
|
TileMode = TileMode.FlipXY, |
|
|
|
DestinationRect = new RelativeRect(0, 0, 0.5, 0.5, RelativeUnit.Relative), |
|
|
|
Visual = new Border |
|
|
|
{ |
|
|
|
Width = 92, |
|
|
|
Height = 92, |
|
|
|
Background = Brushes.Red, |
|
|
|
BorderBrush = Brushes.Black, |
|
|
|
BorderThickness = 2, |
|
|
|
Child = new TextBlock |
|
|
|
{ |
|
|
|
Text = "Perspex", |
|
|
|
FontSize = 12, |
|
|
|
FontFamily = "Arial", |
|
|
|
HorizontalAlignment = HorizontalAlignment.Center, |
|
|
|
VerticalAlignment = VerticalAlignment.Center, |
|
|
|
} |
|
|
|
} |
|
|
|
Visual = Visual, |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
RenderToFile(target); |
|
|
|
CompareImages(); |
|
|
|
} |
|
|
|
|
|
|
|
#if PERSPEX_CAIRO
|
|
|
|
[Fact(Skip = "VisualBrush not yet implemented on Cairo")] |
|
|
|
#else
|
|
|
|
[Fact] |
|
|
|
#endif
|
|
|
|
public void VisualBrush_No_Visual() |
|
|
|
{ |
|
|
|
Decorator target = new Decorator |
|
|
|
{ |
|
|
|
Padding = new Thickness(8), |
|
|
|
Width = 200, |
|
|
|
Height = 200, |
|
|
|
Child = new Rectangle |
|
|
|
{ |
|
|
|
Fill = new VisualBrush(), |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
RenderToFile(target); |
|
|
|
CompareImages(); |
|
|
|
} |
|
|
|
|