Skip to content

Commit d0eef49

Browse files
committed
mark the test as windows only
1 parent a759b69 commit d0eef49

2 files changed

Lines changed: 31 additions & 3 deletions

File tree

tests/ImageSharp.Drawing.Tests/Issues/Issue-54.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
using System;
2+
using System.Runtime.InteropServices;
23
using SixLabors.Fonts;
34
using SixLabors.ImageSharp.Drawing.Processing;
5+
using SixLabors.ImageSharp.Drawing.Tests.TestUtilities.Attributes;
46
using SixLabors.ImageSharp.PixelFormats;
57
using SixLabors.ImageSharp.Processing;
68
using Xunit;
@@ -9,7 +11,7 @@ namespace SixLabors.ImageSharp.Drawing.Tests.Issues
911
{
1012
public class Issue_54
1113
{
12-
[Fact]
14+
[WindowsFact]
1315
public void CanDrawWithoutMemoryException()
1416
{
1517
int width = 768;
@@ -39,15 +41,15 @@ public void CanDrawWithoutMemoryException()
3941

4042
// Draw the text
4143
image.Mutate(x => x.DrawText(options, text, font, brush, pen, new PointF(0, 100)));
42-
}
44+
}
4345
}
4446

4547
[Fact]
4648
public void PenMustHaveAWidthGraterThanZero()
4749
{
4850
ArgumentOutOfRangeException ex = Assert.Throws<ArgumentOutOfRangeException>(() =>
4951
{
50-
IPen pen = new Pen(Color.White, 0);
52+
IPen pen = new Pen(Color.White, 0);
5153
});
5254

5355
Assert.Equal("Parameter \"width\" (System.Single) must be greater than 0, was 0 (Parameter 'width')", ex.Message);
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Runtime.InteropServices;
4+
using System.Text;
5+
using Xunit;
6+
7+
namespace SixLabors.ImageSharp.Drawing.Tests.TestUtilities.Attributes
8+
{
9+
public class PlatformFactAttribute : FactAttribute
10+
{
11+
public PlatformFactAttribute(OSPlatform platform)
12+
{
13+
if (!RuntimeInformation.IsOSPlatform(platform))
14+
{
15+
this.Skip = $"Platform specific test, runs only on '{platform}'";
16+
}
17+
}
18+
}
19+
20+
public class WindowsFactAttribute : PlatformFactAttribute
21+
{
22+
public WindowsFactAttribute() : base(OSPlatform.Windows)
23+
{
24+
}
25+
}
26+
}

0 commit comments

Comments
 (0)