diff --git a/Perspex.sln b/Perspex.sln
index 3fb017f8f4..ed46e06bb2 100644
--- a/Perspex.sln
+++ b/Perspex.sln
@@ -79,6 +79,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{9B9E
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{A689DEF5-D50F-4975-8B72-124C9EB54066}"
ProjectSection(SolutionItems) = preProject
+ src\Shared\PclPlatformWrapper.cs = src\Shared\PclPlatformWrapper.cs
src\Shared\SharedAssemblyInfo.cs = src\Shared\SharedAssemblyInfo.cs
EndProjectSection
EndProject
diff --git a/Tests/TestFiles/Cairo/Media/LinearGradientBrush/LinearGradientBrush_RedBlue_Horizontal_Fill.expected.png b/Tests/TestFiles/Cairo/Media/LinearGradientBrush/LinearGradientBrush_RedBlue_Horizontal_Fill.expected.png
new file mode 100644
index 0000000000..9d11e8b233
Binary files /dev/null and b/Tests/TestFiles/Cairo/Media/LinearGradientBrush/LinearGradientBrush_RedBlue_Horizontal_Fill.expected.png differ
diff --git a/Tests/TestFiles/Cairo/Media/LinearGradientBrush/LinearGradientBrush_RedBlue_Vertical_Fill.expected.png b/Tests/TestFiles/Cairo/Media/LinearGradientBrush/LinearGradientBrush_RedBlue_Vertical_Fill.expected.png
new file mode 100644
index 0000000000..d09c0c30b4
Binary files /dev/null and b/Tests/TestFiles/Cairo/Media/LinearGradientBrush/LinearGradientBrush_RedBlue_Vertical_Fill.expected.png differ
diff --git a/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Align_BottomRight.expected.png b/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Align_BottomRight.expected.png
new file mode 100644
index 0000000000..0918b7fd51
Binary files /dev/null and b/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Align_BottomRight.expected.png differ
diff --git a/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Align_Center.expected.png b/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Align_Center.expected.png
new file mode 100644
index 0000000000..dc6050fec4
Binary files /dev/null and b/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Align_Center.expected.png differ
diff --git a/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Align_TopLeft.expected.png b/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Align_TopLeft.expected.png
new file mode 100644
index 0000000000..905ec5386a
Binary files /dev/null and b/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Align_TopLeft.expected.png differ
diff --git a/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_DestinationRect_Absolute.expected.png b/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_DestinationRect_Absolute.expected.png
new file mode 100644
index 0000000000..9253eee164
Binary files /dev/null and b/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_DestinationRect_Absolute.expected.png differ
diff --git a/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_FlipX.expected.png b/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_FlipX.expected.png
new file mode 100644
index 0000000000..da7003b419
Binary files /dev/null and b/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_FlipX.expected.png differ
diff --git a/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_FlipXY.expected.png b/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_FlipXY.expected.png
new file mode 100644
index 0000000000..4bfcdb2dd3
Binary files /dev/null and b/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_FlipXY.expected.png differ
diff --git a/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_FlipY.expected.png b/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_FlipY.expected.png
new file mode 100644
index 0000000000..74a01bb78c
Binary files /dev/null and b/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_FlipY.expected.png differ
diff --git a/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_SourceRect_Absolute.expected.png b/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_SourceRect_Absolute.expected.png
new file mode 100644
index 0000000000..e1fcdbc1a6
Binary files /dev/null and b/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_SourceRect_Absolute.expected.png differ
diff --git a/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_SourceRect_DestinationRect_Absolute.expected.png b/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_SourceRect_DestinationRect_Absolute.expected.png
new file mode 100644
index 0000000000..b2abed4041
Binary files /dev/null and b/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_SourceRect_DestinationRect_Absolute.expected.png differ
diff --git a/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_SourceRect_DestinationRect_Percent.expected.png b/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_SourceRect_DestinationRect_Percent.expected.png
new file mode 100644
index 0000000000..1aedd35831
Binary files /dev/null and b/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_SourceRect_DestinationRect_Percent.expected.png differ
diff --git a/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Stretch_Fill_Large.expected.png b/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Stretch_Fill_Large.expected.png
new file mode 100644
index 0000000000..f1914a404f
Binary files /dev/null and b/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Stretch_Fill_Large.expected.png differ
diff --git a/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Stretch_Uniform.expected.png b/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Stretch_Uniform.expected.png
new file mode 100644
index 0000000000..fb2ae9f8cc
Binary files /dev/null and b/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Stretch_Uniform.expected.png differ
diff --git a/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Stretch_UniformToFill.expected.png b/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Stretch_UniformToFill.expected.png
new file mode 100644
index 0000000000..d0009b6abb
Binary files /dev/null and b/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Stretch_UniformToFill.expected.png differ
diff --git a/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Tile.expected.png b/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Tile.expected.png
new file mode 100644
index 0000000000..64695d4bb1
Binary files /dev/null and b/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Tile.expected.png differ
diff --git a/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Tile_Alignment_BottomRight.expected.png b/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Tile_Alignment_BottomRight.expected.png
new file mode 100644
index 0000000000..0918b7fd51
Binary files /dev/null and b/Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Tile_Alignment_BottomRight.expected.png differ
diff --git a/Tests/TestFiles/Cairo/Shapes/Path/Path_Tick_Scaled_Stroke_8px.expected.png b/Tests/TestFiles/Cairo/Shapes/Path/Path_Tick_Scaled_Stroke_8px.expected.png
new file mode 100644
index 0000000000..355edf84c2
Binary files /dev/null and b/Tests/TestFiles/Cairo/Shapes/Path/Path_Tick_Scaled_Stroke_8px.expected.png differ
diff --git a/tests/TestFiles/Direct2D1/Media/LinearGradientBrush/LinearGradientBrush_RedBlue_Fill.expected.png b/Tests/TestFiles/Direct2D1/Media/LinearGradientBrush/LinearGradientBrush_RedBlue_Horizontal_Fill.expected.png
similarity index 100%
rename from tests/TestFiles/Direct2D1/Media/LinearGradientBrush/LinearGradientBrush_RedBlue_Fill.expected.png
rename to Tests/TestFiles/Direct2D1/Media/LinearGradientBrush/LinearGradientBrush_RedBlue_Horizontal_Fill.expected.png
diff --git a/Tests/TestFiles/Direct2D1/Media/LinearGradientBrush/LinearGradientBrush_RedBlue_Vertical_Fill.expected.png b/Tests/TestFiles/Direct2D1/Media/LinearGradientBrush/LinearGradientBrush_RedBlue_Vertical_Fill.expected.png
new file mode 100644
index 0000000000..3a3d7df5d4
Binary files /dev/null and b/Tests/TestFiles/Direct2D1/Media/LinearGradientBrush/LinearGradientBrush_RedBlue_Vertical_Fill.expected.png differ
diff --git a/docs/build.md b/docs/build.md
index d62f285f89..4a25794ac5 100644
--- a/docs/build.md
+++ b/docs/build.md
@@ -6,7 +6,7 @@ Perspex requires Visual Studio 2015 to build on Windows.
### Install GTK Sharp
-To compile the full project under windows, you must have gtk-sharp installed. However, if you're
+To compile the full project under windows, you must have [gtk-sharp](http://www.mono-project.com/download/#download-win) installed. However, if you're
not interested in building the cross-platform bits you can simply unload the Perspex.Cairo and
Perspex.Gtk project in Visual Studio.
diff --git a/docs/contributing.md b/docs/contributing.md
index a8dd7cf6bb..f601422f05 100644
--- a/docs/contributing.md
+++ b/docs/contributing.md
@@ -2,23 +2,11 @@
## Style ##
-The codebase uses StyleCop with default settings[1] to enforce coding style. Yes, some of the
-decisions it makes are downright bizarre, and are certainly not what I would've personally chosen
-but the less time spent debating coding style the more time left for coding.
-
-StyleCop should run on each build and give warnings for any violations. So please, follow the style;
-you'll get used to it in the end (I know I have).
-
-If the .NET core team decide on a style and write an automatic checker/tidy tool for that style,
-I'll gladly adopt it! I'm certainly not tied to the current style, I'm just tired of endless coding
-style debates. Someone decide for me goddammit!
+The codebase uses [.net core](https://github.com/dotnet/corefx/blob/master/Documentation/coding-guidelines/coding-style.md) coding style.
Try to keep lines of code around 100 characters in length or less, though this is not a hard limit.
If you're a few characters over then don't worry too much.
-Documentation comments should also be formatted to a 100 character length to help keep them
-readable.
-
**DO NOT USE #REGIONS** full stop.
## Pull requests ##
@@ -45,8 +33,7 @@ unless you see something that is obviously wrong or that could be written in a m
idiomatic style. It takes time to review each pull request - time that I'd prefer to spend writing
new features!
-Prefer terseness to verbosity (yes I know that StyleCop will often be working against you here
-:weary:) but don't try to be too clever.
+Prefer terseness to verbosity but don't try to be too clever.
## Tests ##
@@ -67,6 +54,3 @@ English what the test is testing, e.g.
Render tests should describe what the produced image is:
void Rectangle_2px_Stroke_Filled()
-
-----
-[1] Documentation rules are disabled because there's currently so much missing documentation, sorry!
diff --git a/samples/XamlTestApplication/Views/MainWindow.xaml b/samples/XamlTestApplication/Views/MainWindow.xaml
index da27d04242..78d30bda9f 100644
--- a/samples/XamlTestApplication/Views/MainWindow.xaml
+++ b/samples/XamlTestApplication/Views/MainWindow.xaml
@@ -1,112 +1,10 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Bold text.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
\ No newline at end of file
diff --git a/src/Gtk/Perspex.Cairo/CairoExtensions.cs b/src/Gtk/Perspex.Cairo/CairoExtensions.cs
index 1b9581d1f3..5798796a37 100644
--- a/src/Gtk/Perspex.Cairo/CairoExtensions.cs
+++ b/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);
@@ -22,6 +27,11 @@ namespace Perspex.Cairo
return new Cairo.Rectangle(rect.X, rect.Y, rect.Width, rect.Height);
}
+ public static Rect ToPerspex(this Cairo.Rectangle rect)
+ {
+ return new Rect(rect.X, rect.Y, rect.Width, rect.Height);
+ }
+
public static Rect ToPerspex(this Pango.Rectangle rect)
{
return new Rect(
diff --git a/src/Gtk/Perspex.Cairo/CairoPlatform.cs b/src/Gtk/Perspex.Cairo/CairoPlatform.cs
index 5ddfe1eab0..f25aadda95 100644
--- a/src/Gtk/Perspex.Cairo/CairoPlatform.cs
+++ b/src/Gtk/Perspex.Cairo/CairoPlatform.cs
@@ -17,6 +17,8 @@ namespace Perspex.Cairo
{
private static readonly CairoPlatform s_instance = new CairoPlatform();
+ private static Pango.Context s_pangoContext = CreatePangoContext();
+
public static void Initialize()
{
var locator = Locator.CurrentMutable;
@@ -36,12 +38,11 @@ namespace Perspex.Cairo
TextAlignment textAlignment,
Perspex.Media.FontWeight fontWeight)
{
- return new FormattedTextImpl(text, fontFamily, fontSize, fontStyle, textAlignment, fontWeight);
+ return new FormattedTextImpl(s_pangoContext, text, fontFamily, fontSize, fontStyle, textAlignment, fontWeight);
}
public IRenderer CreateRenderer(IPlatformHandle handle, double width, double height)
{
- Locator.CurrentMutable.RegisterConstant(GetPangoContext(handle), typeof(Pango.Context));
return new Renderer(handle, width, height);
}
@@ -69,18 +70,10 @@ namespace Perspex.Cairo
return new BitmapImpl(pixbuf);
}
- private Pango.Context GetPangoContext(IPlatformHandle handle)
+ private static Pango.Context CreatePangoContext()
{
- switch (handle.HandleDescriptor)
- {
- case "GtkWindow":
- var window = GLib.Object.GetObject(handle.Handle) as Gtk.Window;
- return window.PangoContext;
- default:
- throw new NotSupportedException(string.Format(
- "Don't know how to get a Pango Context from a '{0}'.",
- handle.HandleDescriptor));
- }
+ Gtk.Application.Init();
+ return new Gtk.Invisible().CreatePangoContext();
}
}
}
diff --git a/src/Gtk/Perspex.Cairo/Media/DrawingContext.cs b/src/Gtk/Perspex.Cairo/Media/DrawingContext.cs
index 4c99590cb6..ce1dc5c796 100644
--- a/src/Gtk/Perspex.Cairo/Media/DrawingContext.cs
+++ b/src/Gtk/Perspex.Cairo/Media/DrawingContext.cs
@@ -42,6 +42,9 @@ namespace Perspex.Cairo.Media
CurrentTransform = Matrix.Identity;
}
+ ///
+ /// Gets the current transform of the drawing context.
+ ///
public Matrix CurrentTransform
{
get; }
@@ -54,17 +57,30 @@ namespace Perspex.Cairo.Media
_context.Dispose();
}
+ ///
+ /// Draws a bitmap image.
+ ///
+ /// The bitmap image.
+ /// The opacity to draw with.
+ /// The rect in the image to draw.
+ /// The rect in the output to draw to.
public void DrawImage(IBitmap bitmap, double opacity, Rect sourceRect, Rect destRect)
{
var impl = bitmap.PlatformImpl as BitmapImpl;
var size = new Size(impl.PixelWidth, impl.PixelHeight);
- var scaleX = destRect.Size.Width / sourceRect.Size.Width;
- var scaleY = destRect.Size.Height / sourceRect.Size.Height;
+ var scale = new Vector(destRect.Width / sourceRect.Width, destRect.Height / sourceRect.Height);
_context.Save();
- _context.Scale(scaleX, scaleY);
- Gdk.CairoHelper.SetSourcePixbuf(_context, impl.Surface, (int)sourceRect.X, (int)sourceRect.Y);
- _context.Rectangle(sourceRect.ToCairo());
+ _context.Scale(scale.X, scale.Y);
+ destRect /= scale;
+
+ Gdk.CairoHelper.SetSourcePixbuf(
+ _context,
+ impl.Surface,
+ -sourceRect.X + destRect.X,
+ -sourceRect.Y + destRect.Y);
+
+ _context.Rectangle(destRect.ToCairo());
_context.Fill();
_context.Restore();
}
@@ -109,13 +125,12 @@ namespace Perspex.Cairo.Media
else
_context.Fill();
}
+ }
-
- if (pen != null)
- {
- SetPen(pen, geometry.Bounds.Size);
- _context.Stroke();
- }
+ if (pen != null)
+ {
+ SetPen(pen, geometry.Bounds.Size);
+ _context.Stroke();
}
}
@@ -212,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.AddColorStopRgb(s.Offset, new Cairo.Color(s.Color.R, s.Color.G, s.Color.B, s.Color.A));
+ g.AddColorStop(s.Offset, s.Color.ToCairo());
g.Extend = Cairo.Extend.Pad;
diff --git a/src/Gtk/Perspex.Cairo/Media/FormattedTextImpl.cs b/src/Gtk/Perspex.Cairo/Media/FormattedTextImpl.cs
index ac71e14e02..81ae567817 100644
--- a/src/Gtk/Perspex.Cairo/Media/FormattedTextImpl.cs
+++ b/src/Gtk/Perspex.Cairo/Media/FormattedTextImpl.cs
@@ -12,7 +12,10 @@ namespace Perspex.Cairo.Media
{
public class FormattedTextImpl : IFormattedTextImpl
{
+ private Size _size;
+
public FormattedTextImpl(
+ Pango.Context context,
string text,
string fontFamily,
double fontSize,
@@ -20,7 +23,8 @@ namespace Perspex.Cairo.Media
TextAlignment textAlignment,
FontWeight fontWeight)
{
- var context = Locator.Current.GetService();
+ Contract.Requires(context != null);
+
Layout = new Pango.Layout(context);
Layout.SetText(text);
Layout.FontDescription = new Pango.FontDescription
@@ -34,7 +38,6 @@ namespace Perspex.Cairo.Media
Layout.Alignment = textAlignment.ToCairo();
}
- private Size _size;
public Size Constraint
{
get
@@ -45,13 +48,15 @@ namespace Perspex.Cairo.Media
set
{
_size = value;
- Layout.Width = Pango.Units.FromDouble(value.Width);
+ Layout.Width = double.IsPositiveInfinity(value.Width) ?
+ -1 : Pango.Units.FromDouble(value.Width);
}
}
public Pango.Layout Layout
{
- get; }
+ get;
+ }
public void Dispose()
{
diff --git a/src/Gtk/Perspex.Cairo/Media/Imaging/RenderTargetBitmapImpl.cs b/src/Gtk/Perspex.Cairo/Media/Imaging/RenderTargetBitmapImpl.cs
index 8c017d9cfd..ef816d6910 100644
--- a/src/Gtk/Perspex.Cairo/Media/Imaging/RenderTargetBitmapImpl.cs
+++ b/src/Gtk/Perspex.Cairo/Media/Imaging/RenderTargetBitmapImpl.cs
@@ -10,10 +10,9 @@ namespace Perspex.Cairo.Media.Imaging
public class RenderTargetBitmapImpl : IRenderTargetBitmapImpl
{
- public RenderTargetBitmapImpl(
- Cairo.ImageSurface surface)
+ public RenderTargetBitmapImpl(Cairo.ImageSurface surface)
{
-
+ Surface = surface;
}
public int PixelWidth => Surface.Width;
@@ -25,7 +24,6 @@ namespace Perspex.Cairo.Media.Imaging
Surface.Dispose();
}
-
public Cairo.ImageSurface Surface
{
get;
diff --git a/src/Gtk/Perspex.Cairo/Media/StreamGeometryContextImpl.cs b/src/Gtk/Perspex.Cairo/Media/StreamGeometryContextImpl.cs
index 47a822865d..b287146806 100644
--- a/src/Gtk/Perspex.Cairo/Media/StreamGeometryContextImpl.cs
+++ b/src/Gtk/Perspex.Cairo/Media/StreamGeometryContextImpl.cs
@@ -47,8 +47,7 @@ namespace Perspex.Cairo.Media
if (isClosed)
_context.ClosePath();
- var extents = _context.StrokeExtents();
- _impl.Bounds = new Rect(extents.X, extents.Y, extents.Width, extents.Height);
+ _impl.Bounds = _context.FillExtents().ToPerspex();
_impl.Path = _context.CopyPath();
}
diff --git a/src/Gtk/Perspex.Cairo/Media/StreamGeometryImpl.cs b/src/Gtk/Perspex.Cairo/Media/StreamGeometryImpl.cs
index a87c1b06e2..a9e0266d4a 100644
--- a/src/Gtk/Perspex.Cairo/Media/StreamGeometryImpl.cs
+++ b/src/Gtk/Perspex.Cairo/Media/StreamGeometryImpl.cs
@@ -61,6 +61,7 @@ namespace Perspex.Cairo.Media
public Rect GetRenderBounds(double strokeThickness)
{
+ // TODO: Calculate properly.
return Bounds;
}
diff --git a/src/Gtk/Perspex.Gtk/GtkPlatform.cs b/src/Gtk/Perspex.Gtk/GtkPlatform.cs
index d02e112845..2881bd292f 100644
--- a/src/Gtk/Perspex.Gtk/GtkPlatform.cs
+++ b/src/Gtk/Perspex.Gtk/GtkPlatform.cs
@@ -28,6 +28,7 @@ namespace Perspex.Gtk
public static void Initialize()
{
var locator = Locator.CurrentMutable;
+ locator.Register(() => new PclPlatformWrapper(), typeof(IPclPlatformWrapper));
locator.Register(() => new WindowImpl(), typeof(IWindowImpl));
locator.Register(() => new PopupImpl(), typeof(IPopupImpl));
locator.Register(() => new ClipboardImpl(), typeof(IClipboard));
diff --git a/src/Gtk/Perspex.Gtk/Perspex.Gtk.csproj b/src/Gtk/Perspex.Gtk/Perspex.Gtk.csproj
index 563d87b2a3..95d3c8c5c5 100644
--- a/src/Gtk/Perspex.Gtk/Perspex.Gtk.csproj
+++ b/src/Gtk/Perspex.Gtk/Perspex.Gtk.csproj
@@ -58,6 +58,9 @@
+
+ PclPlatformWrapper.cs
+
diff --git a/src/Gtk/Perspex.Gtk/WindowImpl.cs b/src/Gtk/Perspex.Gtk/WindowImpl.cs
index 4247a3d853..2e5da0c42f 100644
--- a/src/Gtk/Perspex.Gtk/WindowImpl.cs
+++ b/src/Gtk/Perspex.Gtk/WindowImpl.cs
@@ -78,9 +78,8 @@ namespace Perspex.Gtk
public void Invalidate(Rect rect)
{
-#pragma warning disable CS0612 // Type or member is obsolete
- Draw(new Rectangle { X = (int)rect.X, Y = (int)rect.Y, Width = (int)rect.Width, Height = (int)rect.Height });
-#pragma warning restore CS0612 // Type or member is obsolete
+ base.GdkWindow.InvalidateRect (new Rectangle ((int)rect.X, (int)rect.Y, (int)rect.Width, (int)rect.Height), true);
+
}
public Point PointToScreen(Point point)
diff --git a/src/Markup/Perspex.Markup.Xaml/Context/PerspexWiringContext.cs b/src/Markup/Perspex.Markup.Xaml/Context/PerspexWiringContext.cs
index 7ab5758f41..cf16bcb8f7 100644
--- a/src/Markup/Perspex.Markup.Xaml/Context/PerspexWiringContext.cs
+++ b/src/Markup/Perspex.Markup.Xaml/Context/PerspexWiringContext.cs
@@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
+using System.Linq;
using System.Reflection;
using Glass;
using OmniXaml;
@@ -16,13 +17,17 @@ using Perspex.Markup.Xaml.DataBinding;
using Perspex.Markup.Xaml.MarkupExtensions;
using Perspex.Media;
using Perspex.Media.Imaging;
+using Perspex.Metadata;
+using Perspex.Platform;
+using Perspex.Styling;
+using Splat;
namespace Perspex.Markup.Xaml.Context
{
public class PerspexWiringContext : IWiringContext
{
private readonly WiringContext _context;
- private const string PerspexNs = "https://github.com/grokys/Perspex";
+ private const string PerspexNs = "https://github.com/perspex";
public PerspexWiringContext(ITypeFactory typeFactory)
{
@@ -39,37 +44,27 @@ namespace Perspex.Markup.Xaml.Context
{
var xamlNamespaceRegistry = new XamlNamespaceRegistry();
- var rootType = typeof(Control);
- var bindingType = typeof(BindingExtension);
- var templateType = typeof(XamlDataTemplate);
-
- var definitionForRoot = XamlNamespace
- .Map(PerspexNs)
- .With(
- new[]
- {
- Route.Assembly(rootType.GetTypeInfo().Assembly).WithNamespaces(
- new[]
- {
- rootType.Namespace
- }),
- Route.Assembly(bindingType.GetTypeInfo().Assembly).WithNamespaces(
- new[]
- {
- bindingType.Namespace,
- }),
- Route.Assembly(templateType.GetTypeInfo().Assembly).WithNamespaces(
- new[]
- {
- templateType.Namespace,
- })
- });
-
- foreach (var ns in new List { definitionForRoot })
+ var forcedAssemblies = new[]
{
- xamlNamespaceRegistry.AddNamespace(ns);
+ typeof (Control),
+ typeof(Style)
+ }.Select(t => t.GetTypeInfo().Assembly);
+
+ foreach (var nsa in
+ forcedAssemblies
+ .Concat(Locator.Current.GetService().GetLoadedAssemblies())
+ .Distinct()
+ .SelectMany(asm
+ => asm.GetCustomAttributes().Select(attr => new {asm, attr}))
+ .GroupBy(entry => entry.attr.XmlNamespace))
+ {
+ var def = XamlNamespace.Map(nsa.Key)
+ .With(nsa.GroupBy(x => x.asm).Select(
+ a => Route.Assembly(a.Key)
+ .WithNamespaces(a.Select(entry => entry.attr.ClrNamespace).ToList())
+ ));
+ xamlNamespaceRegistry.AddNamespace(def);
}
-
xamlNamespaceRegistry.RegisterPrefix(new PrefixRegistration(string.Empty, PerspexNs));
return xamlNamespaceRegistry;
@@ -80,12 +75,12 @@ namespace Perspex.Markup.Xaml.Context
var typeConverterProvider = new TypeConverterProvider();
var converters = new[]
{
- new TypeConverterRegistration(typeof(Bitmap), new BitmapConverter()),
- new TypeConverterRegistration(typeof(Brush), new BrushConverter()),
+ new TypeConverterRegistration(typeof(Bitmap), new BitmapTypeConverter()),
+ new TypeConverterRegistration(typeof(Brush), new BrushTypeConverter()),
new TypeConverterRegistration(typeof(ColumnDefinitions), new ColumnDefinitionsTypeConverter()),
new TypeConverterRegistration(typeof(GridLength), new GridLengthTypeConverter()),
new TypeConverterRegistration(typeof(RowDefinitions), new RowDefinitionsTypeConverter()),
- new TypeConverterRegistration(typeof(Thickness), new ThicknessConverter()),
+ new TypeConverterRegistration(typeof(Thickness), new ThicknessTypeConverter()),
};
typeConverterProvider.AddAll(converters);
diff --git a/src/Markup/Perspex.Markup.Xaml/Converters/BitmapConverter.cs b/src/Markup/Perspex.Markup.Xaml/Converters/BitmapTypeConverter.cs
similarity index 94%
rename from src/Markup/Perspex.Markup.Xaml/Converters/BitmapConverter.cs
rename to src/Markup/Perspex.Markup.Xaml/Converters/BitmapTypeConverter.cs
index 392da12630..1aa1660079 100644
--- a/src/Markup/Perspex.Markup.Xaml/Converters/BitmapConverter.cs
+++ b/src/Markup/Perspex.Markup.Xaml/Converters/BitmapTypeConverter.cs
@@ -8,7 +8,7 @@ using Perspex.Media.Imaging;
namespace Perspex.Markup.Xaml.Converters
{
- public class BitmapConverter : ITypeConverter
+ public class BitmapTypeConverter : ITypeConverter
{
public bool CanConvertFrom(IXamlTypeConverterContext context, Type sourceType)
{
diff --git a/src/Markup/Perspex.Markup.Xaml/Converters/BrushConverter.cs b/src/Markup/Perspex.Markup.Xaml/Converters/BrushTypeConverter.cs
similarity index 94%
rename from src/Markup/Perspex.Markup.Xaml/Converters/BrushConverter.cs
rename to src/Markup/Perspex.Markup.Xaml/Converters/BrushTypeConverter.cs
index d734caf37a..197cb20a8d 100644
--- a/src/Markup/Perspex.Markup.Xaml/Converters/BrushConverter.cs
+++ b/src/Markup/Perspex.Markup.Xaml/Converters/BrushTypeConverter.cs
@@ -8,7 +8,7 @@ using Perspex.Media;
namespace Perspex.Markup.Xaml.Converters
{
- public class BrushConverter : ITypeConverter
+ public class BrushTypeConverter : ITypeConverter
{
public bool CanConvertFrom(IXamlTypeConverterContext context, Type sourceType)
{
diff --git a/src/Markup/Perspex.Markup.Xaml/Converters/ThicknessConverter.cs b/src/Markup/Perspex.Markup.Xaml/Converters/ThicknessTypeConverter.cs
similarity index 94%
rename from src/Markup/Perspex.Markup.Xaml/Converters/ThicknessConverter.cs
rename to src/Markup/Perspex.Markup.Xaml/Converters/ThicknessTypeConverter.cs
index a001913711..1e33525494 100644
--- a/src/Markup/Perspex.Markup.Xaml/Converters/ThicknessConverter.cs
+++ b/src/Markup/Perspex.Markup.Xaml/Converters/ThicknessTypeConverter.cs
@@ -7,7 +7,7 @@ using OmniXaml.TypeConversion;
namespace Perspex.Markup.Xaml.Converters
{
- public class ThicknessConverter : ITypeConverter
+ public class ThicknessTypeConverter : ITypeConverter
{
public bool CanConvertFrom(IXamlTypeConverterContext context, Type sourceType)
{
diff --git a/src/Markup/Perspex.Markup.Xaml/Perspex.Markup.Xaml.csproj b/src/Markup/Perspex.Markup.Xaml/Perspex.Markup.Xaml.csproj
index e146cac468..d2aaa43766 100644
--- a/src/Markup/Perspex.Markup.Xaml/Perspex.Markup.Xaml.csproj
+++ b/src/Markup/Perspex.Markup.Xaml/Perspex.Markup.Xaml.csproj
@@ -40,11 +40,11 @@
-
+
-
-
+
+
diff --git a/src/Markup/Perspex.Markup.Xaml/PerspexXamlLoader.cs b/src/Markup/Perspex.Markup.Xaml/PerspexXamlLoader.cs
index a2e7cfbabe..cf8409d5e9 100644
--- a/src/Markup/Perspex.Markup.Xaml/PerspexXamlLoader.cs
+++ b/src/Markup/Perspex.Markup.Xaml/PerspexXamlLoader.cs
@@ -2,6 +2,8 @@
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using System;
+using System.Collections.Generic;
+using System.IO;
using System.Reflection;
using OmniXaml;
using Perspex.Markup.Xaml.Context;
@@ -52,7 +54,27 @@ namespace Perspex.Markup.Xaml
/// The loaded object.
public object Load(Type type, object rootInstance = null)
{
- return Load(GetUriFor(type), rootInstance);
+ var assetLocator = Locator.Current.GetService();
+ if (assetLocator == null)
+ {
+ throw new InvalidOperationException(
+ "Could not create IAssetLoader : maybe Application.RegisterServices() wasn't called?");
+ }
+ foreach (var uri in GetUrisFor(type))
+ {
+ Stream stream;
+ try
+ {
+ stream= assetLocator.Open(uri);
+ }
+ catch (FileNotFoundException)
+ {
+ continue;
+ }
+ using (stream)
+ return Load(stream, rootInstance);
+ }
+ throw new FileNotFoundException("Unable to find view for " + type.FullName);
}
///
@@ -84,7 +106,7 @@ namespace Perspex.Markup.Xaml
///
/// The type.
/// The URI.
- private static Uri GetUriFor(Type type)
+ private static IEnumerable GetUrisFor(Type type)
{
if (type.Namespace != null)
{
@@ -97,10 +119,9 @@ namespace Perspex.Markup.Xaml
replace = replace + "/";
}
- return new Uri(replace + type.Name + ".xaml", UriKind.Relative);
+ foreach (var ext in new[] {".xaml", ".paml"})
+ yield return new Uri(replace + type.Name + ext, UriKind.Relative);
}
-
- return null;
}
}
}
diff --git a/src/Markup/Perspex.Markup.Xaml/Properties/AssemblyInfo.cs b/src/Markup/Perspex.Markup.Xaml/Properties/AssemblyInfo.cs
index eea5e0803d..07a61a6798 100644
--- a/src/Markup/Perspex.Markup.Xaml/Properties/AssemblyInfo.cs
+++ b/src/Markup/Perspex.Markup.Xaml/Properties/AssemblyInfo.cs
@@ -2,5 +2,8 @@
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using System.Reflection;
+using Perspex.Metadata;
[assembly: AssemblyTitle("Perspex.Markup.Xaml")]
+[assembly: XmlnsDefinition("https://github.com/perspex", "Perspex.Markup.Xaml.MarkupExtensions")]
+[assembly: XmlnsDefinition("https://github.com/perspex", "Perspex.Markup.Xaml.Templates")]
\ No newline at end of file
diff --git a/src/Perspex.Base/Metadata/XmlnsDefinitionAttribute.cs b/src/Perspex.Base/Metadata/XmlnsDefinitionAttribute.cs
new file mode 100644
index 0000000000..63371bf80f
--- /dev/null
+++ b/src/Perspex.Base/Metadata/XmlnsDefinitionAttribute.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Perspex.Metadata
+{
+ [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
+ public class XmlnsDefinitionAttribute : Attribute
+ {
+ public string XmlNamespace { get; set; }
+ public string ClrNamespace { get; set; }
+
+ public XmlnsDefinitionAttribute(string xmlNamespace, string clrNamespace)
+ {
+ XmlNamespace = xmlNamespace;
+ ClrNamespace = clrNamespace;
+ }
+ }
+}
diff --git a/src/Perspex.Base/Perspex.Base.csproj b/src/Perspex.Base/Perspex.Base.csproj
index 8370b131f1..0ab51860f1 100644
--- a/src/Perspex.Base/Perspex.Base.csproj
+++ b/src/Perspex.Base/Perspex.Base.csproj
@@ -46,8 +46,10 @@
+
+
diff --git a/src/Perspex.Base/Platform/IPclPlatformWrapper.cs b/src/Perspex.Base/Platform/IPclPlatformWrapper.cs
new file mode 100644
index 0000000000..c57b87a738
--- /dev/null
+++ b/src/Perspex.Base/Platform/IPclPlatformWrapper.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Perspex.Platform
+{
+ public interface IPclPlatformWrapper
+ {
+ Assembly[] GetLoadedAssemblies();
+ }
+}
diff --git a/src/Perspex.Controls/Image.cs b/src/Perspex.Controls/Image.cs
index d34948e2ee..0782b51f2a 100644
--- a/src/Perspex.Controls/Image.cs
+++ b/src/Perspex.Controls/Image.cs
@@ -23,7 +23,7 @@ namespace Perspex.Controls
///
public static readonly PerspexProperty StretchProperty =
PerspexProperty.Register(nameof(Stretch), Stretch.Uniform);
-
+
///
/// Gets or sets the bitmap image that will be displayed.
///
diff --git a/src/Perspex.Controls/Properties/AssemblyInfo.cs b/src/Perspex.Controls/Properties/AssemblyInfo.cs
index 479c2fc91b..4cda6c4aa5 100644
--- a/src/Perspex.Controls/Properties/AssemblyInfo.cs
+++ b/src/Perspex.Controls/Properties/AssemblyInfo.cs
@@ -3,6 +3,10 @@
using System.Reflection;
using System.Runtime.CompilerServices;
+using Perspex.Metadata;
[assembly: AssemblyTitle("Perspex.Controls")]
-[assembly: InternalsVisibleTo("Perspex.Controls.UnitTests")]
\ No newline at end of file
+[assembly: InternalsVisibleTo("Perspex.Controls.UnitTests")]
+
+[assembly: XmlnsDefinition("https://github.com/perspex", "Perspex.Controls")]
+[assembly: XmlnsDefinition("https://github.com/perspex", "Perspex.Controls.Primitives")]
\ No newline at end of file
diff --git a/src/Perspex.SceneGraph/Rect.cs b/src/Perspex.SceneGraph/Rect.cs
index 95b08eedd6..2dba97e764 100644
--- a/src/Perspex.SceneGraph/Rect.cs
+++ b/src/Perspex.SceneGraph/Rect.cs
@@ -184,15 +184,11 @@ namespace Perspex
/// The scaled rectangle.
public static Rect operator *(Rect rect, Vector scale)
{
- double centerX = rect._x + (rect._width / 2);
- double centerY = rect._y + (rect._height / 2);
- double width = rect._width * scale.X;
- double height = rect._height * scale.Y;
return new Rect(
- centerX - (width / 2),
- centerY - (height / 2),
- width,
- height);
+ rect.X * scale.X,
+ rect.Y * scale.Y,
+ rect.Width * scale.X,
+ rect.Height * scale.Y);
}
///
@@ -214,15 +210,11 @@ namespace Perspex
/// The scaled rectangle.
public static Rect operator /(Rect rect, Vector scale)
{
- double centerX = rect._x + (rect._width / 2);
- double centerY = rect._y + (rect._height / 2);
- double width = rect._width / scale.X;
- double height = rect._height / scale.Y;
return new Rect(
- centerX - (width / 2),
- centerY - (height / 2),
- width,
- height);
+ rect.X / scale.X,
+ rect.Y / scale.Y,
+ rect.Width / scale.X,
+ rect.Height / scale.Y);
}
///
diff --git a/src/Perspex.Styling/Properties/AssemblyInfo.cs b/src/Perspex.Styling/Properties/AssemblyInfo.cs
index 3dbe71ef35..f06c17710e 100644
--- a/src/Perspex.Styling/Properties/AssemblyInfo.cs
+++ b/src/Perspex.Styling/Properties/AssemblyInfo.cs
@@ -2,5 +2,7 @@
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using System.Reflection;
+using Perspex.Metadata;
[assembly: AssemblyTitle("Perspex.Styling")]
+[assembly: XmlnsDefinition("https://github.com/perspex", "Perspex.Styling")]
\ No newline at end of file
diff --git a/src/Shared/PclPlatformWrapper.cs b/src/Shared/PclPlatformWrapper.cs
new file mode 100644
index 0000000000..9057a8085b
Binary files /dev/null and b/src/Shared/PclPlatformWrapper.cs differ
diff --git a/src/Windows/Perspex.Win32/Perspex.Win32.csproj b/src/Windows/Perspex.Win32/Perspex.Win32.csproj
index a55bba662b..68093baf10 100644
--- a/src/Windows/Perspex.Win32/Perspex.Win32.csproj
+++ b/src/Windows/Perspex.Win32/Perspex.Win32.csproj
@@ -62,6 +62,9 @@
+
+ PclPlatformWrapper.cs
+
Properties\SharedAssemblyInfo.cs
diff --git a/src/Windows/Perspex.Win32/Win32Platform.cs b/src/Windows/Perspex.Win32/Win32Platform.cs
index da4be6b6a6..4cfe797450 100644
--- a/src/Windows/Perspex.Win32/Win32Platform.cs
+++ b/src/Windows/Perspex.Win32/Win32Platform.cs
@@ -40,6 +40,7 @@ namespace Perspex.Win32
private static void InitializeInternal()
{
var locator = Locator.CurrentMutable;
+ locator.Register(()=>new PclPlatformWrapper(), typeof(IPclPlatformWrapper));
locator.Register(() => new PopupImpl(), typeof(IPopupImpl));
locator.Register(() => new ClipboardImpl(), typeof(IClipboard));
locator.Register(() => WindowsKeyboardDevice.Instance, typeof(IKeyboardDevice));
diff --git a/tests/Perspex.Base.UnitTests/Properties/AssemblyInfo.cs b/tests/Perspex.Base.UnitTests/Properties/AssemblyInfo.cs
index b011d2a1c4..1752a3b211 100644
--- a/tests/Perspex.Base.UnitTests/Properties/AssemblyInfo.cs
+++ b/tests/Perspex.Base.UnitTests/Properties/AssemblyInfo.cs
@@ -2,5 +2,9 @@
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using System.Reflection;
+using Xunit;
[assembly: AssemblyTitle("Perspex.UnitTests")]
+
+// Don't run tests in parallel.
+[assembly: CollectionBehavior(DisableTestParallelization = true)]
\ No newline at end of file
diff --git a/tests/Perspex.RenderTests/Media/LinearGradientBrushTests.cs b/tests/Perspex.RenderTests/Media/LinearGradientBrushTests.cs
index e4d0fbde6f..cd69fcd194 100644
--- a/tests/Perspex.RenderTests/Media/LinearGradientBrushTests.cs
+++ b/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
{
@@ -19,7 +23,7 @@ namespace Perspex.Direct2D1.RenderTests.Media
}
[Fact]
- public void LinearGradientBrush_RedBlue_Fill()
+ public void LinearGradientBrush_RedBlue_Horizontal_Fill()
{
Decorator target = new Decorator
{
@@ -44,5 +48,32 @@ namespace Perspex.Direct2D1.RenderTests.Media
RenderToFile(target);
CompareImages();
}
+
+ [Fact]
+ public void LinearGradientBrush_RedBlue_Vertical_Fill()
+ {
+ Decorator target = new Decorator
+ {
+ Padding = new Thickness(8),
+ Width = 200,
+ Height = 200,
+ Child = new Border
+ {
+ Background = new LinearGradientBrush
+ {
+ StartPoint = new Point(0.5, 0),
+ EndPoint = new Point(0.5, 1),
+ GradientStops =
+ {
+ new GradientStop { Color = Colors.Red, Offset = 0 },
+ new GradientStop { Color = Colors.Blue, Offset = 1 }
+ }
+ }
+ }
+ };
+
+ RenderToFile(target);
+ CompareImages();
+ }
}
}
diff --git a/tests/Perspex.RenderTests/Media/VisualBrushTests.cs b/tests/Perspex.RenderTests/Media/VisualBrushTests.cs
index 90b327cd66..5bff4198cb 100644
--- a/tests/Perspex.RenderTests/Media/VisualBrushTests.cs
+++ b/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
diff --git a/tests/Perspex.RenderTests/Perspex.Cairo.RenderTests.csproj b/tests/Perspex.RenderTests/Perspex.Cairo.RenderTests.csproj
index e28d91a6b4..024b77b93d 100644
--- a/tests/Perspex.RenderTests/Perspex.Cairo.RenderTests.csproj
+++ b/tests/Perspex.RenderTests/Perspex.Cairo.RenderTests.csproj
@@ -74,6 +74,8 @@
+
+
diff --git a/tests/Perspex.Styling.UnitTests/Properties/AssemblyInfo.cs b/tests/Perspex.Styling.UnitTests/Properties/AssemblyInfo.cs
index c17aed34e1..e45f18c082 100644
--- a/tests/Perspex.Styling.UnitTests/Properties/AssemblyInfo.cs
+++ b/tests/Perspex.Styling.UnitTests/Properties/AssemblyInfo.cs
@@ -2,5 +2,9 @@
// Licensed under the MIT license. See licence.md file in the project root for full license information.
using System.Reflection;
+using Xunit;
[assembly: AssemblyTitle("Perspex.Styling.UnitTests")]
+
+// Don't run tests in parallel.
+[assembly: CollectionBehavior(DisableTestParallelization = true)]
\ No newline at end of file
diff --git a/tests/TestFiles/Cairo/Controls/Border/Border_Bottom_Aligns_Content.expected.png b/tests/TestFiles/Cairo/Controls/Border/Border_Bottom_Aligns_Content.expected.png
index 163e53293f..97ad212701 100644
Binary files a/tests/TestFiles/Cairo/Controls/Border/Border_Bottom_Aligns_Content.expected.png and b/tests/TestFiles/Cairo/Controls/Border/Border_Bottom_Aligns_Content.expected.png differ
diff --git a/tests/TestFiles/Cairo/Controls/Border/Border_Centers_Content_Horizontally.expected.png b/tests/TestFiles/Cairo/Controls/Border/Border_Centers_Content_Horizontally.expected.png
index 18ecd01c7a..77a7601e13 100644
Binary files a/tests/TestFiles/Cairo/Controls/Border/Border_Centers_Content_Horizontally.expected.png and b/tests/TestFiles/Cairo/Controls/Border/Border_Centers_Content_Horizontally.expected.png differ
diff --git a/tests/TestFiles/Cairo/Controls/Border/Border_Centers_Content_Vertically.expected.png b/tests/TestFiles/Cairo/Controls/Border/Border_Centers_Content_Vertically.expected.png
index 40d0de862e..ff0c7b5984 100644
Binary files a/tests/TestFiles/Cairo/Controls/Border/Border_Centers_Content_Vertically.expected.png and b/tests/TestFiles/Cairo/Controls/Border/Border_Centers_Content_Vertically.expected.png differ
diff --git a/tests/TestFiles/Cairo/Controls/Border/Border_Left_Aligns_Content.expected.png b/tests/TestFiles/Cairo/Controls/Border/Border_Left_Aligns_Content.expected.png
index 73be4dcdc6..5f0166406b 100644
Binary files a/tests/TestFiles/Cairo/Controls/Border/Border_Left_Aligns_Content.expected.png and b/tests/TestFiles/Cairo/Controls/Border/Border_Left_Aligns_Content.expected.png differ
diff --git a/tests/TestFiles/Cairo/Controls/Border/Border_Right_Aligns_Content.expected.png b/tests/TestFiles/Cairo/Controls/Border/Border_Right_Aligns_Content.expected.png
index 3db06328cc..3ee5e25b7c 100644
Binary files a/tests/TestFiles/Cairo/Controls/Border/Border_Right_Aligns_Content.expected.png and b/tests/TestFiles/Cairo/Controls/Border/Border_Right_Aligns_Content.expected.png differ
diff --git a/tests/TestFiles/Cairo/Controls/Border/Border_Top_Aligns_Content.expected.png b/tests/TestFiles/Cairo/Controls/Border/Border_Top_Aligns_Content.expected.png
index 1c48ec82c6..ca04ee9121 100644
Binary files a/tests/TestFiles/Cairo/Controls/Border/Border_Top_Aligns_Content.expected.png and b/tests/TestFiles/Cairo/Controls/Border/Border_Top_Aligns_Content.expected.png differ
diff --git a/tests/TestFiles/Cairo/Shapes/Path/Path_Expander_With_Border.expected.png b/tests/TestFiles/Cairo/Shapes/Path/Path_Expander_With_Border.expected.png
index 9c72e69ea9..4a7f4c26b0 100644
Binary files a/tests/TestFiles/Cairo/Shapes/Path/Path_Expander_With_Border.expected.png and b/tests/TestFiles/Cairo/Shapes/Path/Path_Expander_With_Border.expected.png differ
diff --git a/tests/TestFiles/Cairo/Shapes/Rectangle/Rectangle_1px_Stroke.expected.png b/tests/TestFiles/Cairo/Shapes/Rectangle/Rectangle_1px_Stroke.expected.png
index 6aa013a894..24239d5799 100644
Binary files a/tests/TestFiles/Cairo/Shapes/Rectangle/Rectangle_1px_Stroke.expected.png and b/tests/TestFiles/Cairo/Shapes/Rectangle/Rectangle_1px_Stroke.expected.png differ
diff --git a/tests/TestFiles/Cairo/Shapes/Rectangle/Rectangle_2px_Stroke.expected.png b/tests/TestFiles/Cairo/Shapes/Rectangle/Rectangle_2px_Stroke.expected.png
index c3ee9548b0..cebe42f3df 100644
Binary files a/tests/TestFiles/Cairo/Shapes/Rectangle/Rectangle_2px_Stroke.expected.png and b/tests/TestFiles/Cairo/Shapes/Rectangle/Rectangle_2px_Stroke.expected.png differ
diff --git a/tests/TestFiles/Cairo/Shapes/Rectangle/Rectangle_Stroke_Fill.expected.png b/tests/TestFiles/Cairo/Shapes/Rectangle/Rectangle_Stroke_Fill.expected.png
index 2eb5c946ce..d1c13a9e57 100644
Binary files a/tests/TestFiles/Cairo/Shapes/Rectangle/Rectangle_Stroke_Fill.expected.png and b/tests/TestFiles/Cairo/Shapes/Rectangle/Rectangle_Stroke_Fill.expected.png differ