Skip to content

Commit

Permalink
Merge pull request #1 from Perspex/master
Browse files Browse the repository at this point in the history
Merge latest commits.
  • Loading branch information
danwalmsley committed Sep 24, 2015
2 parents 52dd3d1 + 0bd15b1 commit 736dc4d
Show file tree
Hide file tree
Showing 894 changed files with 20,702 additions and 16,659 deletions.
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
; This file is for unifying the coding style for different editors and IDEs.
; More information at http://EditorConfig.org

root = true

[*]
end_of_line = CRLF

[*.cs]
indent_style = space
indent_size = 4
7 changes: 7 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
[submodule "src/Perspex.ReactiveUI/src"]
path = src/Perspex.ReactiveUI/src
url = https://github.com/reactiveui/ReactiveUI.git
[submodule "src/Perspex.HtmlRenderer/external"]
path = src/Perspex.HtmlRenderer/external
url = https://github.com/Perspex/HTML-Renderer.git
branch = perspex-pcl
[submodule "src/Markup/Perspex.Markup.Xaml/OmniXAML"]
path = src/Markup/Perspex.Markup.Xaml/OmniXAML
url = https://github.com/SuperJMN/OmniXAML.git
150 changes: 88 additions & 62 deletions Perspex.sln

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions Perspex.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=6417B24E_002D49C2_002D4985_002D8DB2_002D3AB9D898EC91/@EntryIndexedValue">ExplicitlyExcluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=E3A1060B_002D50D0_002D44E8_002D88B6_002DF44EF2E5BD72_002Ff_003Ahtml_002Ehtm/@EntryIndexedValue">ExplicitlyExcluded</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantUsingDirective/@EntryIndexedValue">HINT</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=Constants/@EntryIndexedValue">&lt;Policy Inspect="False" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=EnumMember/@EntryIndexedValue">&lt;Policy Inspect="False" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=Interfaces/@EntryIndexedValue">&lt;Policy Inspect="False" Prefix="I" Suffix="" Style="AaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=Locals/@EntryIndexedValue">&lt;Policy Inspect="False" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=MethodPropertyEvent/@EntryIndexedValue">&lt;Policy Inspect="False" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=Other/@EntryIndexedValue">&lt;Policy Inspect="False" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=Parameters/@EntryIndexedValue">&lt;Policy Inspect="False" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateConstants/@EntryIndexedValue">&lt;Policy Inspect="False" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="s_" Suffix="" Style="aaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticReadonly/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb"&gt;&lt;ExtraRule Prefix="s_" Suffix="" Style="aaBb" /&gt;&lt;/Policy&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=StaticReadonly/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=TypeParameters/@EntryIndexedValue">&lt;Policy Inspect="False" Prefix="T" Suffix="" Style="AaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=TypesAndNamespaces/@EntryIndexedValue">&lt;Policy Inspect="False" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String></wpf:ResourceDictionary>
Binary file modified Perspex.v2.ncrunchsolution
Binary file not shown.
44 changes: 44 additions & 0 deletions Tests/Perspex.Controls.UnitTests/DockPanelTests/AlignerTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
namespace Perspex.Controls.UnitTests.DockPanelTests
{
using Xunit;


public class AlignerTests
{
[Fact]
public void ToStartTest()
{
Segment container = new Segment(2, 5);

var aligned = container.AlignToStart(2);
Assert.Equal(new Segment(2, 4), aligned);
}

[Fact]
public void ToEndTest()
{
Segment container = new Segment(2, 5);

var aligned = container.AlignToEnd(2);
Assert.Equal(new Segment(3, 5), aligned);
}

[Fact]
public void ToMiddleTest()
{
Segment container = new Segment(2, 5);

var aligned = container.AlignToMiddle(2);
Assert.Equal(new Segment(2.5, 4.5), aligned);
}

[Fact]
public void ToMiddleTest2()
{
Segment container = new Segment(0, 500);

var aligned = container.AlignToMiddle(200);
Assert.Equal(new Segment(150, 350), aligned);
}
}
}
38 changes: 38 additions & 0 deletions Tests/Perspex.Controls.UnitTests/DockPanelTests/LeftDockerTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
namespace Perspex.Controls.UnitTests.DockPanelTests
{
using System.Collections.Generic;
using Layout;
using Moq;
using Xunit;

public class LeftDockerTests
{
private readonly ILayoutable _layoutable;

public LeftDockerTests()
{
var layoutableMock = new Mock<ILayoutable>();
layoutableMock.Setup(l => l.DesiredSize).Returns(new Size(40, 30));
_layoutable = layoutableMock.Object;
}

[Theory]
[MemberData("Source")]
public void Dock(Margins margins, Rect expectedRect)
{
var sut = new LeftDocker(new Size(100, 50));
var actualRect = sut.GetDockingRect(_layoutable.DesiredSize, margins, new Alignments(Alignment.Middle, Alignment.Stretch));

Assert.Equal(expectedRect, actualRect);
}

// ReSharper disable once UnusedMember.Global
public static IEnumerable<object[]> Source => new[]
{
new object[] { new Margins(), new Rect(0, 0, 40, 50)},
new object[] { new Margins { VerticalMargin = new Segment(15, 0) }, new Rect(0, 15, 40, 35)},
new object[] { new Margins { VerticalMargin = new Segment(0, 15) }, new Rect(0, 0, 40, 35)},
new object[] { new Margins { VerticalMargin = new Segment(20, 15) }, new Rect(0, 20, 40, 15)},
};
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
namespace Perspex.Controls.UnitTests.DockPanelTests
{
using Layout;
using Xunit;

public class RectAlignerTests
{
private readonly Rect _container = new Rect(0, 0, 40, 40);
private readonly Size _child = new Size(20, 20);

[Theory]
[MemberData("TestData")]
public void LefTopTest(Alignment horz, Alignment vert, Rect expectedRect)
{
var actualRect = _container.AlignChild(_child, horz, vert);
Assert.Equal(expectedRect, actualRect);
}

// ReSharper disable once UnusedMember.Global
public static object[] TestData => new object[]
{
new object[] {Alignment.Start, Alignment.Start, new Rect(0, 0, 20, 20)},
new object[] {Alignment.Middle, Alignment.Start, new Rect(10, 0, 20, 20)},
new object[] {Alignment.End, Alignment.Start, new Rect(20, 0, 20, 20)},
new object[] {Alignment.Stretch, Alignment.Start, new Rect(0, 0, 40, 20)},

new object[] {Alignment.Start, Alignment.Middle, new Rect(0, 10, 20, 20)},
new object[] {Alignment.Middle, Alignment.Middle, new Rect(10, 10, 20, 20)},
new object[] {Alignment.End, Alignment.Middle, new Rect(20, 10, 20, 20)},
new object[] {Alignment.Stretch, Alignment.Middle, new Rect(0, 10, 40, 20)},

new object[] {Alignment.Start, VerticalAlignment.Bottom, new Rect(0, 20, 20, 20)},
new object[] {Alignment.Middle, VerticalAlignment.Bottom, new Rect(10, 20, 20, 20)},
new object[] {Alignment.End, VerticalAlignment.Bottom, new Rect(20, 20, 20, 20)},
new object[] {Alignment.Stretch, VerticalAlignment.Bottom, new Rect(0, 20, 40, 20)},

new object[] {Alignment.Stretch, VerticalAlignment.Stretch, new Rect(0, 0, 40, 40)},
};
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
namespace Perspex.Controls.UnitTests.DockPanelTests
{
using System.Collections.Generic;
using Layout;
using Moq;
using Xunit;

public class RightDockerTests
{
private readonly ILayoutable _layoutable;

public RightDockerTests()
{
var layoutableMock = new Mock<ILayoutable>();
layoutableMock.Setup(l => l.DesiredSize).Returns(new Size(40, 30));
_layoutable = layoutableMock.Object;
}

[Theory]
[MemberData("Source")]
public void Dock(Margins margins, Rect expectedRect)
{
var sut = new RightDocker(new Size(100, 50));
var actualRect = sut.GetDockingRect(_layoutable.DesiredSize, margins, new Alignments(Alignment.Middle, Alignment.Stretch));

Assert.Equal(expectedRect, actualRect);
}

// ReSharper disable once UnusedMember.Global
public static IEnumerable<object[]> Source => new[]
{
new object[] { new Margins(), new Rect(60, 0, 40, 50)},
new object[] { new Margins { VerticalMargin = new Segment(0, 15) }, new Rect(60, 0, 40, 35)},
new object[] { new Margins { VerticalMargin = new Segment(15, 0) }, new Rect(60, 15, 40, 35)},
new object[] { new Margins { VerticalMargin = new Segment(20, 15) }, new Rect(60, 20, 40, 15)},
};
}
}
16 changes: 15 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,20 @@ os: Visual Studio 2015
before_build:
- git submodule update --init
- nuget restore Perspex.sln

environment:
myget_key:
secure: XOgD5bJUKNOS2kDDgb+affS4pDcslxALh+xvvnr1Koy0PjXlhILsBdNhxRe0KcNm

configuration:
- Release

after_test:
- ps: nuget\build-appveyor.ps1

artifacts:
- path: nuget\*.nupkg

build:
project: Perspex.sln
verbosity: minimal
verbosity: minimal
Binary file added docs/add-dialogs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/add-packages.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 2 additions & 3 deletions docs/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -27,8 +27,7 @@ please submit a PR if you have anything to add.
### Install Latest Mono

That the time of writing, mono 4.2 aplha was needed to build. Add mono package sources by following
instructions below for the stable channel, and then add the alpha channel to
`/etc/apt/sources.list.d/mono-xamarin-alpha.list` as well.
instructions below for the stable channel and then add the alpha channel as well.

http://www.mono-project.com/docs/getting-started/install/linux/#debian-ubuntu-and-derivatives

Expand Down
22 changes: 5 additions & 17 deletions docs/contributing.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
# Contributing #

## Style ##
## Before You Start ##

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.
Drop into our [gitter chat room](https://gitter.im/Perspex/Perspex) and let us know what you're thinking of doing. We might be able to give you guidance or let you know if someone else is already working on the feature.

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).
## Style ##

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 ##
Expand All @@ -45,8 +37,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 ##

Expand All @@ -67,6 +58,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!
15 changes: 15 additions & 0 deletions docs/gettingstarted.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Getting Started

## Windows

![](add-dialogs.png)

The easiest way to try out Perspex is to install the Visual Studio Extension.

This will add a Perspex project template and a Window template to the standard Visual Studo “Add” dialog (yes, icons still to come :) ):

## OSX / Linux

It is a little more manual on non-Windows platforms, but using Xamarin Studio you can install the Perspex NuGet package.

![](add-packages.png)
Binary file added docs/perspex-video.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/screen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 736dc4d

Please sign in to comment.