Skip to content

Commit 601b074

Browse files
Merge pull request #307 from SixLabors/js/update-refs
Update refs to latest
2 parents ec146c9 + 706a8a3 commit 601b074

File tree

12 files changed

+45
-32
lines changed

12 files changed

+45
-32
lines changed

src/Directory.Build.props

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
2121
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
2222
</PropertyGroup>
23+
24+
<PropertyGroup>
25+
<UseImageSharp>true</UseImageSharp>
26+
</PropertyGroup>
2327

2428
<ItemGroup>
2529
<!-- DynamicProxyGenAssembly2 is needed so Moq can use our internals -->

src/ImageSharp.Drawing/ImageSharp.Drawing.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545
<None Include="..\..\shared-infrastructure\branding\icons\imagesharp.drawing\sixlabors.imagesharp.drawing.128.png" Pack="true" PackagePath="" />
4646
</ItemGroup>
4747
<ItemGroup>
48-
<PackageReference Include="SixLabors.Fonts" Version="2.0.0" />
49-
<PackageReference Include="SixLabors.ImageSharp" Version="3.0.2" />
48+
<PackageReference Include="SixLabors.Fonts" Version="2.0.1" />
49+
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.0" />
5050
</ItemGroup>
5151
<Import Project="..\..\shared-infrastructure\src\SharedInfrastructure\SharedInfrastructure.projitems" Label="Shared" />
5252
</Project>

src/ImageSharp.Drawing/Processing/GradientBrush.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Numerics;
55
using SixLabors.ImageSharp.Drawing.Utilities;
66
using SixLabors.ImageSharp.Memory;
7+
using SixLabors.ImageSharp.PixelFormats;
78

89
namespace SixLabors.ImageSharp.Drawing.Processing;
910

tests/Directory.Build.props

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,8 @@
1616
<!-- Import the solution .props file. -->
1717
<Import Project="$(MSBuildThisFileDirectory)..\Directory.Build.props" />
1818

19+
<PropertyGroup>
20+
<UseImageSharp>true</UseImageSharp>
21+
</PropertyGroup>
22+
1923
</Project>

tests/ImageSharp.Drawing.Tests/ConfigurationTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public class ConfigurationTests
1818

1919
public Configuration DefaultConfiguration { get; }
2020

21-
private readonly int expectedDefaultConfigurationCount = 8;
21+
private readonly int expectedDefaultConfigurationCount = 9;
2222

2323
public ConfigurationTests()
2424
{

tests/ImageSharp.Drawing.Tests/Processing/BaseImageOperationsExtensionTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public BaseImageOperationsExtensionTest()
3333
this.shapeOptions = new ShapeOptions { IntersectionRule = IntersectionRule.NonZero };
3434
this.source = new Image<Rgba32>(91 + 324, 123 + 56);
3535
this.rect = new Rectangle(91, 123, 324, 56); // make this random?
36-
this.internalOperations = new FakeImageOperationsProvider.FakeImageOperations<Rgba32>(this.source.GetConfiguration(), this.source, false);
36+
this.internalOperations = new FakeImageOperationsProvider.FakeImageOperations<Rgba32>(this.source.Configuration, this.source, false);
3737
this.internalOperations.SetShapeOptions(this.shapeOptions);
3838
this.internalOperations.SetGraphicsOptions(this.graphicsOptions);
3939
this.operations = this.internalOperations;

tests/ImageSharp.Drawing.Tests/Processing/FillPathProcessorTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public void FillOffCanvas()
3333
var options = new GraphicsOptions { Antialias = true };
3434
var processor = new FillPathProcessor(new DrawingOptions() { GraphicsOptions = options }, brush.Object, path);
3535
var img = new Image<Rgba32>(10, 10);
36-
processor.Execute(img.GetConfiguration(), img, bounds);
36+
processor.Execute(img.Configuration, img, bounds);
3737
}
3838

3939
[Fact]

tests/ImageSharp.Drawing.Tests/TestFileSystem.cs

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,45 +8,49 @@ namespace SixLabors.ImageSharp.Drawing.Tests;
88
/// </summary>
99
public class TestFileSystem : IO.IFileSystem
1010
{
11-
private readonly Dictionary<string, Stream> fileSystem = new(StringComparer.OrdinalIgnoreCase);
11+
private readonly Dictionary<string, Func<Stream>> fileSystem = new(StringComparer.OrdinalIgnoreCase);
1212

13-
public void AddFile(string path, Stream data)
13+
public void AddFile(string path, Func<Stream> data)
1414
{
1515
lock (this.fileSystem)
1616
{
1717
this.fileSystem.Add(path, data);
1818
}
1919
}
2020

21-
public Stream Create(string path)
21+
public Stream Create(string path) => this.GetStream(path) ?? File.Create(path);
22+
23+
public Stream CreateAsynchronous(string path) => this.GetStream(path) ?? File.Open(path, new FileStreamOptions
2224
{
23-
// if we have injected a fake file use it instead
24-
lock (this.fileSystem)
25-
{
26-
if (this.fileSystem.ContainsKey(path))
27-
{
28-
Stream stream = this.fileSystem[path];
29-
stream.Position = 0;
30-
return stream;
31-
}
32-
}
25+
Mode = FileMode.Create,
26+
Access = FileAccess.ReadWrite,
27+
Share = FileShare.None,
28+
Options = FileOptions.Asynchronous,
29+
});
3330

34-
return File.Create(path);
35-
}
31+
public Stream OpenRead(string path) => this.GetStream(path) ?? File.OpenRead(path);
32+
33+
public Stream OpenReadAsynchronous(string path) => this.GetStream(path) ?? File.Open(path, new FileStreamOptions
34+
{
35+
Mode = FileMode.Open,
36+
Access = FileAccess.Read,
37+
Share = FileShare.Read,
38+
Options = FileOptions.Asynchronous,
39+
});
3640

37-
public Stream OpenRead(string path)
41+
private Stream? GetStream(string path)
3842
{
3943
// if we have injected a fake file use it instead
4044
lock (this.fileSystem)
4145
{
42-
if (this.fileSystem.ContainsKey(path))
46+
if (this.fileSystem.TryGetValue(path, out Func<Stream>? streamFactory))
4347
{
44-
Stream stream = this.fileSystem[path];
48+
Stream stream = streamFactory();
4549
stream.Position = 0;
4650
return stream;
4751
}
4852
}
4953

50-
return File.OpenRead(path);
54+
return null;
5155
}
5256
}

tests/ImageSharp.Drawing.Tests/TestUtilities/ImageComparison/ExactImageComparer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public override ImageSimilarityReport<TPixelA, TPixelB> CompareImagesOrFrames<TP
2828
var bBuffer = new Rgba64[width];
2929

3030
var differences = new List<PixelDifference>();
31-
Configuration configuration = expected.GetConfiguration();
31+
Configuration configuration = expected.Configuration;
3232
Buffer2D<TPixelA> expectedBuffer = expected.PixelBuffer;
3333
Buffer2D<TPixelB> actualBuffer = actual.PixelBuffer;
3434

tests/ImageSharp.Drawing.Tests/TestUtilities/ImageComparison/TolerantImageComparer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public override ImageSimilarityReport<TPixelA, TPixelB> CompareImagesOrFrames<TP
7070
float totalDifference = 0F;
7171

7272
var differences = new List<PixelDifference>();
73-
Configuration configuration = expected.GetConfiguration();
73+
Configuration configuration = expected.Configuration;
7474
Buffer2D<TPixelA> expectedBuffer = expected.PixelBuffer;
7575
Buffer2D<TPixelB> actualBuffer = actual.PixelBuffer;
7676

0 commit comments

Comments
 (0)