|
|
|
@ -1,3 +1,4 @@ |
|
|
|
using System.Collections.Generic; |
|
|
|
using Avalonia.Media; |
|
|
|
using CrossUI; |
|
|
|
using Xunit; |
|
|
|
@ -51,4 +52,64 @@ public class CrossTileBrushTests : CrossTestBase |
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
[CrossFact] |
|
|
|
public void Should_Render_Scaled_TileBrush() |
|
|
|
{ |
|
|
|
var brush = new CrossDrawingBrush |
|
|
|
{ |
|
|
|
TileMode = TileMode.Tile, |
|
|
|
Viewbox = new Rect(0, 0, 20, 20), |
|
|
|
ViewboxUnits = BrushMappingMode.Absolute, |
|
|
|
Viewport = new Rect(0, 0, 20, 20), |
|
|
|
ViewportUnits = BrushMappingMode.Absolute, |
|
|
|
Drawing = new CrossGeometryDrawing(new CrossSvgGeometry("M 0 0 l 50 50")) |
|
|
|
{ |
|
|
|
Pen = new CrossPen { Brush = new CrossSolidColorBrush(Colors.Red), Thickness = 5 } |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
RenderAndCompare(new CrossControl() |
|
|
|
{ |
|
|
|
Width = 100, |
|
|
|
Height = 100, |
|
|
|
Background = brush |
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
[CrossFact] |
|
|
|
public void Should_Render_With_Transform() |
|
|
|
{ |
|
|
|
var brush = new CrossDrawingBrush() |
|
|
|
{ |
|
|
|
TileMode = TileMode.None, |
|
|
|
Viewbox = new Rect(0, 0, 1, 1), |
|
|
|
ViewboxUnits = BrushMappingMode.RelativeToBoundingBox, |
|
|
|
Viewport = new Rect(0, 0, 50, 50), |
|
|
|
ViewportUnits = BrushMappingMode.Absolute, |
|
|
|
Transform = Matrix.CreateTranslation(150, 150), |
|
|
|
Drawing = new CrossDrawingGroup() |
|
|
|
{ |
|
|
|
Children = new List<CrossDrawing>() |
|
|
|
{ |
|
|
|
new CrossGeometryDrawing(new CrossRectangleGeometry(new(0, 0, 100, 100))) |
|
|
|
{ |
|
|
|
Brush = new CrossSolidColorBrush(Colors.Crimson) |
|
|
|
}, |
|
|
|
new CrossGeometryDrawing(new CrossRectangleGeometry(new(20, 20, 60, 60))) |
|
|
|
{ |
|
|
|
Brush = new CrossSolidColorBrush(Colors.Blue) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
RenderAndCompare(new CrossControl() |
|
|
|
{ |
|
|
|
Width = 200, |
|
|
|
Height = 200, |
|
|
|
Background = brush |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|