Browse Source

Merge branch 'xmlns-attr' into assisted-designer

pull/148/head
Nikita Tsukanov 11 years ago
parent
commit
3f8b0ae1b3
  1. 1
      Perspex.sln
  2. BIN
      Tests/TestFiles/Cairo/Media/LinearGradientBrush/LinearGradientBrush_RedBlue_Horizontal_Fill.expected.png
  3. BIN
      Tests/TestFiles/Cairo/Media/LinearGradientBrush/LinearGradientBrush_RedBlue_Vertical_Fill.expected.png
  4. BIN
      Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Align_BottomRight.expected.png
  5. BIN
      Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Align_Center.expected.png
  6. BIN
      Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Align_TopLeft.expected.png
  7. BIN
      Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_DestinationRect_Absolute.expected.png
  8. BIN
      Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_FlipX.expected.png
  9. BIN
      Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_FlipXY.expected.png
  10. BIN
      Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_FlipY.expected.png
  11. BIN
      Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_SourceRect_Absolute.expected.png
  12. BIN
      Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_SourceRect_DestinationRect_Absolute.expected.png
  13. BIN
      Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_SourceRect_DestinationRect_Percent.expected.png
  14. BIN
      Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Stretch_Fill_Large.expected.png
  15. BIN
      Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Stretch_Uniform.expected.png
  16. BIN
      Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Stretch_UniformToFill.expected.png
  17. BIN
      Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Tile.expected.png
  18. BIN
      Tests/TestFiles/Cairo/Media/VisualBrush/VisualBrush_Tile_Alignment_BottomRight.expected.png
  19. BIN
      Tests/TestFiles/Cairo/Shapes/Path/Path_Tick_Scaled_Stroke_8px.expected.png
  20. 0
      Tests/TestFiles/Direct2D1/Media/LinearGradientBrush/LinearGradientBrush_RedBlue_Horizontal_Fill.expected.png
  21. BIN
      Tests/TestFiles/Direct2D1/Media/LinearGradientBrush/LinearGradientBrush_RedBlue_Vertical_Fill.expected.png
  22. 2
      docs/build.md
  23. 20
      docs/contributing.md
  24. 114
      samples/XamlTestApplication/Views/MainWindow.xaml
  25. 10
      src/Gtk/Perspex.Cairo/CairoExtensions.cs
  26. 19
      src/Gtk/Perspex.Cairo/CairoPlatform.cs
  27. 45
      src/Gtk/Perspex.Cairo/Media/DrawingContext.cs
  28. 13
      src/Gtk/Perspex.Cairo/Media/FormattedTextImpl.cs
  29. 6
      src/Gtk/Perspex.Cairo/Media/Imaging/RenderTargetBitmapImpl.cs
  30. 3
      src/Gtk/Perspex.Cairo/Media/StreamGeometryContextImpl.cs
  31. 1
      src/Gtk/Perspex.Cairo/Media/StreamGeometryImpl.cs
  32. 1
      src/Gtk/Perspex.Gtk/GtkPlatform.cs
  33. 3
      src/Gtk/Perspex.Gtk/Perspex.Gtk.csproj
  34. 5
      src/Gtk/Perspex.Gtk/WindowImpl.cs
  35. 61
      src/Markup/Perspex.Markup.Xaml/Context/PerspexWiringContext.cs
  36. 2
      src/Markup/Perspex.Markup.Xaml/Converters/BitmapTypeConverter.cs
  37. 2
      src/Markup/Perspex.Markup.Xaml/Converters/BrushTypeConverter.cs
  38. 2
      src/Markup/Perspex.Markup.Xaml/Converters/ThicknessTypeConverter.cs
  39. 6
      src/Markup/Perspex.Markup.Xaml/Perspex.Markup.Xaml.csproj
  40. 31
      src/Markup/Perspex.Markup.Xaml/PerspexXamlLoader.cs
  41. 3
      src/Markup/Perspex.Markup.Xaml/Properties/AssemblyInfo.cs
  42. 21
      src/Perspex.Base/Metadata/XmlnsDefinitionAttribute.cs
  43. 2
      src/Perspex.Base/Perspex.Base.csproj
  44. 14
      src/Perspex.Base/Platform/IPclPlatformWrapper.cs
  45. 2
      src/Perspex.Controls/Image.cs
  46. 6
      src/Perspex.Controls/Properties/AssemblyInfo.cs
  47. 24
      src/Perspex.SceneGraph/Rect.cs
  48. 2
      src/Perspex.Styling/Properties/AssemblyInfo.cs
  49. BIN
      src/Shared/PclPlatformWrapper.cs
  50. 3
      src/Windows/Perspex.Win32/Perspex.Win32.csproj
  51. 1
      src/Windows/Perspex.Win32/Win32Platform.cs
  52. 4
      tests/Perspex.Base.UnitTests/Properties/AssemblyInfo.cs
  53. 33
      tests/Perspex.RenderTests/Media/LinearGradientBrushTests.cs
  54. 64
      tests/Perspex.RenderTests/Media/VisualBrushTests.cs
  55. 2
      tests/Perspex.RenderTests/Perspex.Cairo.RenderTests.csproj
  56. 4
      tests/Perspex.Styling.UnitTests/Properties/AssemblyInfo.cs
  57. BIN
      tests/TestFiles/Cairo/Controls/Border/Border_Bottom_Aligns_Content.expected.png
  58. BIN
      tests/TestFiles/Cairo/Controls/Border/Border_Centers_Content_Horizontally.expected.png
  59. BIN
      tests/TestFiles/Cairo/Controls/Border/Border_Centers_Content_Vertically.expected.png
  60. BIN
      tests/TestFiles/Cairo/Controls/Border/Border_Left_Aligns_Content.expected.png
  61. BIN
      tests/TestFiles/Cairo/Controls/Border/Border_Right_Aligns_Content.expected.png
  62. BIN
      tests/TestFiles/Cairo/Controls/Border/Border_Top_Aligns_Content.expected.png
  63. BIN
      tests/TestFiles/Cairo/Shapes/Path/Path_Expander_With_Border.expected.png
  64. BIN
      tests/TestFiles/Cairo/Shapes/Rectangle/Rectangle_1px_Stroke.expected.png
  65. BIN
      tests/TestFiles/Cairo/Shapes/Rectangle/Rectangle_2px_Stroke.expected.png
  66. BIN
      tests/TestFiles/Cairo/Shapes/Rectangle/Rectangle_Stroke_Fill.expected.png

1
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

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 611 B

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 653 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

BIN
Tests/TestFiles/Cairo/Shapes/Path/Path_Tick_Scaled_Stroke_8px.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

0
tests/TestFiles/Direct2D1/Media/LinearGradientBrush/LinearGradientBrush_RedBlue_Fill.expected.png → Tests/TestFiles/Direct2D1/Media/LinearGradientBrush/LinearGradientBrush_RedBlue_Horizontal_Fill.expected.png

Before

Width:  |  Height:  |  Size: 652 B

After

Width:  |  Height:  |  Size: 652 B

BIN
Tests/TestFiles/Direct2D1/Media/LinearGradientBrush/LinearGradientBrush_RedBlue_Vertical_Fill.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

2
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.

20
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!

114
samples/XamlTestApplication/Views/MainWindow.xaml

@ -1,112 +1,10 @@
<Window x:Class="XamlTestApplication.MainWindow"
xmlns="https://github.com/grokys/Perspex"
xmlns="https://github.com/perspex"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Perspex Test Application" Height="350" Width="525">
<Grid RowDefinitions="Auto,*">
<TabControl Grid.Row="1">
<TabItem Header="Buttons">
<StackPanel HorizontalAlignment="Center" Width="200" VerticalAlignment="Center">
<Button Content="Button" />
<Button Content="Button" Background="#119EDA" ToolTip.Tip="Goodbye Cruel World!" />
<Button Content="Default" IsDefault="True" />
<Button Content="Disabled" IsEnabled="False" />
<Button Content="Disabled" IsEnabled="False" Background="#119eda" />
<ToggleButton Content="Toggle" />
<ToggleButton Content="Toggle" IsEnabled="False" />
<CheckBox Content="Checkbox" />
<RadioButton Content="RadioButton 1" IsChecked="True" />
<RadioButton Content="RadioButton 2" />
</StackPanel>
</TabItem>
<TabItem Header="Text">
<StackPanel HorizontalAlignment="Center" Width="200" VerticalAlignment="Center">
<TextBlock
Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin venenatis dui quis libero suscipit tincidunt."
TextWrapping="Wrap" TextAlignment="Center" />
<TextBlock Text="Italic text." TextWrapping="Wrap" TextAlignment="Left" FontStyle="Italic" />
<TextBlock TextWrapping="Wrap" TextAlignment="Right" FontWeight="Bold">Bold text.</TextBlock>
<TextBox Text="A non-wrapping text box. Lorem ipsum dolor sit amet." TextWrapping="NoWrap" />
<TextBox
Text="A wrapping text box. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin venenatis dui quis libero suscipit tincidunt. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin venenatis dui quis libero suscipit tincidunt."
TextWrapping="Wrap" MaxHeight="100" AcceptsReturn="True" />
</StackPanel>
</TabItem>
<TabItem Header="Images">
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<ScrollViewer Height="200" Width="200" HorizontalScrollBarVisibility="Visible">
<Image Source="github_icon.png" Height="500" Width="400" />
</ScrollViewer>
</StackPanel>
</TabItem>
<TabItem Header="Lists">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
<ListBox>
<ListBoxItem>
<StackPanel>
<TextBlock Text="Item 1" FontSize="24" />
<TextBlock Text="Item 1 Value" />
</StackPanel>
</ListBoxItem>
<ListBoxItem>
<StackPanel>
<TextBlock Text="Item 2" FontSize="24" />
<TextBlock Text="Item 2 Value" />
</StackPanel>
</ListBoxItem>
</ListBox>
<DropDown VerticalAlignment="Center">
<StackPanel>
<TextBlock Text="Item 1" FontSize="24" />
<TextBlock Text="Item 1 Value" />
</StackPanel>
<StackPanel>
<TextBlock Text="Item 2" FontSize="24" />
<TextBlock Text="Item 2 Value" />
</StackPanel>
</DropDown>
</StackPanel>
</TabItem>
<TabItem Header="Layout">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<StackPanel>
<Button HorizontalAlignment="Left" Content="Left Aligned" />
<Button HorizontalAlignment="Center" Content="Center Aligned" />
<Button HorizontalAlignment="Right" Content="Right Aligned" />
<Button HorizontalAlignment="Stretch" Content="Stretch" />
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal">
<Button VerticalAlignment="Top" Content="Top Aligned" />
<Button VerticalAlignment="Center" Content="Center Aligned" />
<Button VerticalAlignment="Bottom" Content="Bottom Aligned" />
<Button VerticalAlignment="Stretch" Content="Stretch" />
</StackPanel>
</Grid>
</TabItem>
<TabItem Header="Animations">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Border Width="100" Height="100" Background="Crimson">
<TextBox HorizontalAlignment="Center" VerticalAlignment="Center" Text="hello!"></TextBox>
</Border>
<Border Grid.Row="0" Grid.Column="1" Background="Coral" HorizontalAlignment="Center"
VerticalAlignment="Center">
<Image Width="100" Height="100" Source="github_icon.png">
</Image>
</Border>
<Button Grid.Row="1" Grid.Column="1" Content="Animate" HorizontalAlignment="Center"></Button>
</Grid>
</TabItem>
</TabControl>
</Grid>
<Window.Styles>
<Style>
</Style>
</Window.Styles>
</Window>

10
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(

19
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();
}
}
}

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

@ -42,6 +42,9 @@ namespace Perspex.Cairo.Media
CurrentTransform = Matrix.Identity;
}
/// <summary>
/// Gets the current transform of the drawing context.
/// </summary>
public Matrix CurrentTransform
{
get; }
@ -54,17 +57,30 @@ namespace Perspex.Cairo.Media
_context.Dispose();
}
/// <summary>
/// Draws a bitmap image.
/// </summary>
/// <param name="source">The bitmap image.</param>
/// <param name="opacity">The opacity to draw with.</param>
/// <param name="sourceRect">The rect in the image to draw.</param>
/// <param name="destRect">The rect in the output to draw to.</param>
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;

13
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<Pango.Context>();
Contract.Requires<NullReferenceException>(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()
{

6
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;

3
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();
}

1
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;
}

1
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));

3
src/Gtk/Perspex.Gtk/Perspex.Gtk.csproj

@ -58,6 +58,9 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\Shared\PclPlatformWrapper.cs">
<Link>PclPlatformWrapper.cs</Link>
</Compile>
<Compile Include="AssetLoader.cs" />
<Compile Include="ClipboardImpl.cs" />
<Compile Include="CursorFactory.cs" />

5
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)

61
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<XamlNamespace> { 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<IPclPlatformWrapper>().GetLoadedAssemblies())
.Distinct()
.SelectMany(asm
=> asm.GetCustomAttributes<XmlnsDefinitionAttribute>().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);

2
src/Markup/Perspex.Markup.Xaml/Converters/BitmapConverter.cs → 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)
{

2
src/Markup/Perspex.Markup.Xaml/Converters/BrushConverter.cs → 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)
{

2
src/Markup/Perspex.Markup.Xaml/Converters/ThicknessConverter.cs → 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)
{

6
src/Markup/Perspex.Markup.Xaml/Perspex.Markup.Xaml.csproj

@ -40,11 +40,11 @@
</Compile>
<Compile Include="Converters\RowDefinitionsTypeConverter.cs" />
<Compile Include="Converters\ColumnDefinitionsTypeConverter.cs" />
<Compile Include="Converters\ThicknessConverter.cs" />
<Compile Include="Converters\ThicknessTypeConverter.cs" />
<Compile Include="Context\PerspexWiringContext.cs" />
<Compile Include="MarkupExtensions\BindingExtension.cs" />
<Compile Include="Converters\BrushConverter.cs" />
<Compile Include="Converters\BitmapConverter.cs" />
<Compile Include="Converters\BrushTypeConverter.cs" />
<Compile Include="Converters\BitmapTypeConverter.cs" />
<Compile Include="Converters\GridLengthTypeConverter.cs" />
<Compile Include="DataBinding\ChangeTracking\ObservablePropertyBranch.cs" />
<Compile Include="DataBinding\ChangeTracking\PropertyMountPoint.cs" />

31
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
/// <returns>The loaded object.</returns>
public object Load(Type type, object rootInstance = null)
{
return Load(GetUriFor(type), rootInstance);
var assetLocator = Locator.Current.GetService<IAssetLoader>();
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);
}
/// <summary>
@ -84,7 +106,7 @@ namespace Perspex.Markup.Xaml
/// </summary>
/// <param name="type">The type.</param>
/// <returns>The URI.</returns>
private static Uri GetUriFor(Type type)
private static IEnumerable<Uri> 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;
}
}
}

3
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")]

21
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;
}
}
}

2
src/Perspex.Base/Perspex.Base.csproj

@ -46,8 +46,10 @@
<Compile Include="Diagnostics\PerspexObjectExtensions.cs" />
<Compile Include="IObservablePropertyBag.cs" />
<Compile Include="IPropertyBag.cs" />
<Compile Include="Metadata\XmlnsDefinitionAttribute.cs" />
<Compile Include="PerspexObjectExtensions.cs" />
<Compile Include="PerspexProperty`1.cs" />
<Compile Include="Platform\IPclPlatformWrapper.cs" />
<Compile Include="PriorityBindingEntry.cs" />
<Compile Include="Collections\IPerspexList.cs" />
<Compile Include="Collections\PerspexList.cs" />

14
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();
}
}

2
src/Perspex.Controls/Image.cs

@ -23,7 +23,7 @@ namespace Perspex.Controls
/// </summary>
public static readonly PerspexProperty<Stretch> StretchProperty =
PerspexProperty.Register<Image, Stretch>(nameof(Stretch), Stretch.Uniform);
/// <summary>
/// Gets or sets the bitmap image that will be displayed.
/// </summary>

6
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")]
[assembly: InternalsVisibleTo("Perspex.Controls.UnitTests")]
[assembly: XmlnsDefinition("https://github.com/perspex", "Perspex.Controls")]
[assembly: XmlnsDefinition("https://github.com/perspex", "Perspex.Controls.Primitives")]

24
src/Perspex.SceneGraph/Rect.cs

@ -184,15 +184,11 @@ namespace Perspex
/// <returns>The scaled rectangle.</returns>
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);
}
/// <summary>
@ -214,15 +210,11 @@ namespace Perspex
/// <returns>The scaled rectangle.</returns>
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);
}
/// <summary>

2
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")]

BIN
src/Shared/PclPlatformWrapper.cs

Binary file not shown.

3
src/Windows/Perspex.Win32/Perspex.Win32.csproj

@ -62,6 +62,9 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\Shared\PclPlatformWrapper.cs">
<Link>PclPlatformWrapper.cs</Link>
</Compile>
<Compile Include="..\..\Shared\SharedAssemblyInfo.cs">
<Link>Properties\SharedAssemblyInfo.cs</Link>
</Compile>

1
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));

4
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)]

33
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();
}
}
}

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" />

4
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)]

BIN
tests/TestFiles/Cairo/Controls/Border/Border_Bottom_Aligns_Content.expected.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 797 B

After

Width:  |  Height:  |  Size: 761 B

BIN
tests/TestFiles/Cairo/Controls/Border/Border_Centers_Content_Horizontally.expected.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 830 B

After

Width:  |  Height:  |  Size: 760 B

BIN
tests/TestFiles/Cairo/Controls/Border/Border_Centers_Content_Vertically.expected.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 811 B

After

Width:  |  Height:  |  Size: 771 B

BIN
tests/TestFiles/Cairo/Controls/Border/Border_Left_Aligns_Content.expected.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 838 B

After

Width:  |  Height:  |  Size: 743 B

BIN
tests/TestFiles/Cairo/Controls/Border/Border_Right_Aligns_Content.expected.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 800 B

After

Width:  |  Height:  |  Size: 734 B

BIN
tests/TestFiles/Cairo/Controls/Border/Border_Top_Aligns_Content.expected.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 801 B

After

Width:  |  Height:  |  Size: 758 B

BIN
tests/TestFiles/Cairo/Shapes/Path/Path_Expander_With_Border.expected.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
tests/TestFiles/Cairo/Shapes/Rectangle/Rectangle_1px_Stroke.expected.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 628 B

After

Width:  |  Height:  |  Size: 609 B

BIN
tests/TestFiles/Cairo/Shapes/Rectangle/Rectangle_2px_Stroke.expected.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 619 B

After

Width:  |  Height:  |  Size: 611 B

BIN
tests/TestFiles/Cairo/Shapes/Rectangle/Rectangle_Stroke_Fill.expected.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 620 B

After

Width:  |  Height:  |  Size: 615 B

Loading…
Cancel
Save