Skip to content

Commit adc5993

Browse files
Merge branch 'master' into Release
2 parents 54115b3 + 04cf5f5 commit adc5993

18 files changed

+968
-888
lines changed

CI/azure-pipelines-build.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,13 @@ parameters:
1919
default: '0'
2020
variables:
2121
- group: IronDrawingVersions
22+
2223
- name: Configuration
2324
value: 'Release'
25+
2426
- name: IronDrawingPatch
2527
value: $[counter(format('{0}.{1}', variables['IronDrawingMajorVersion'], variables['IronDrawingMinorVersion']), 1)]
28+
2629
- name: AssemblyVersion
2730
${{ if eq(parameters.inputNuGetVersion, '0') }}:
2831
value: $(IronDrawingMajorVersion).$(IronDrawingMinorVersion).$(IronDrawingPatch).$(IronDrawingRevisionVersion)
@@ -91,4 +94,4 @@ stages:
9194
jobs:
9295
- template: job_templates/deploy_drawing_libraries.yml
9396
parameters:
94-
NuGetVersion: $(NuGetVersion)
97+
NuGetVersion: $(NuGetVersion)

IronSoftware.Drawing/IronSoftware.Drawing.Common.Tests/Context/TestingTraits.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
{
33
public class TestingTraits
44
{
5-
public const string Category = "Test Category";
6-
public const string IntegrationTest = "Integration Test";
7-
public const string LongTimeTest = "Long Time Test";
8-
public const string ManualRunning = "Manual Running";
9-
public const string SmokeTest = "Smoke Test";
10-
public const string UnitTest = "Unit Test";
11-
public const string Unstable = "Unstable Test";
5+
public const string CATEGORY = "Test Category";
6+
public const string INTEGRATION_TEST = "Integration Test";
7+
public const string LONG_TIME_TEST = "Long Time Test";
8+
public const string MANUAL_RUNNING = "Manual Running";
9+
public const string SMOKE_TEST = "Smoke Test";
10+
public const string UNIT_TEST = "Unit Test";
11+
public const string UNSTABLE = "Unstable Test";
1212
}
1313
}
Lines changed: 33 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,40 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3-
<PropertyGroup>
4-
<TargetFrameworks>net472;netcoreapp3.1;net50;net60;net70</TargetFrameworks>
5-
<LangVersion>latest</LangVersion>
3+
<PropertyGroup>
4+
<TargetFrameworks>net472;netcoreapp3.1;net50;net60;net70</TargetFrameworks>
5+
<LangVersion>latest</LangVersion>
6+
<CheckEolTargetFramework>false</CheckEolTargetFramework>
7+
<IsPackable>false</IsPackable>
8+
<RunSettingsFilePath>$(MSBuildProjectDirectory)\tests.runsettings</RunSettingsFilePath>
9+
<NoWarn>CS8002</NoWarn>
10+
</PropertyGroup>
611

7-
<IsPackable>false</IsPackable>
8-
<RunSettingsFilePath>$(MSBuildProjectDirectory)\tests.runsettings</RunSettingsFilePath>
9-
</PropertyGroup>
12+
<ItemGroup>
13+
<PackageReference Include="FluentAssertions" Version="6.10.0" />
14+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
15+
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="1.0.0-beta15" />
16+
<PackageReference Include="Microsoft.Maui.Graphics" Version="7.0.81" />
17+
<PackageReference Include="SkiaSharp" Version="2.88.3" />
18+
<PackageReference Include="System.Drawing.Common" Version="5.0.3" />
19+
<PackageReference Include="xunit" Version="2.4.2" />
20+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
21+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
22+
<PrivateAssets>all</PrivateAssets>
23+
</PackageReference>
24+
<PackageReference Include="coverlet.collector" Version="3.2.0">
25+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
26+
<PrivateAssets>all</PrivateAssets>
27+
</PackageReference>
28+
</ItemGroup>
1029

11-
<ItemGroup>
12-
<PackageReference Include="FluentAssertions" Version="6.8.0" />
13-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
14-
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="1.0.0-beta15" />
15-
<PackageReference Include="xunit" Version="2.4.2" />
16-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
17-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
18-
<PrivateAssets>all</PrivateAssets>
19-
</PackageReference>
20-
<PackageReference Include="coverlet.collector" Version="3.2.0">
21-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
22-
<PrivateAssets>all</PrivateAssets>
23-
</PackageReference>
24-
<PackageReference Include="Microsoft.Maui.Graphics">
25-
<Version>7.0.49</Version>
26-
</PackageReference>
27-
<PackageReference Include="SkiaSharp">
28-
<Version>2.88.3</Version>
29-
</PackageReference>
30-
<PackageReference Include="System.Drawing.Common">
31-
<Version>5.0.3</Version>
32-
</PackageReference>
33-
</ItemGroup>
30+
<ItemGroup>
31+
<ProjectReference Include="..\IronSoftware.Drawing.Common\IronSoftware.Drawing.Common.csproj" />
32+
</ItemGroup>
3433

35-
<ItemGroup>
36-
<ProjectReference Include="..\IronSoftware.Drawing.Common\IronSoftware.Drawing.Common.csproj" />
37-
</ItemGroup>
38-
39-
<ItemGroup>
40-
<None Update="Data\Mona-Lisa-oil-wood-panel-Leonardo-da.webp">
41-
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
42-
</None>
43-
</ItemGroup>
34+
<ItemGroup>
35+
<None Update="Data\Mona-Lisa-oil-wood-panel-Leonardo-da.webp">
36+
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
37+
</None>
38+
</ItemGroup>
4439

4540
</Project>

IronSoftware.Drawing/IronSoftware.Drawing.Common.Tests/TargetFramework.cs

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ public TargetFramework()
2424
public AppDomain CreateAppDomain(string domainName)
2525
{
2626
#if NETFRAMEWORK
27-
AppDomainSetup setup = new AppDomainSetup();
28-
setup.ApplicationBase = Directory.GetCurrentDirectory();
29-
setup.ConfigurationFile = $"{Assembly.GetExecutingAssembly().Location}.config";
30-
setup.TargetFrameworkName = AppDomain.CurrentDomain.SetupInformation.TargetFrameworkName;
27+
var setup = new AppDomainSetup
28+
{
29+
ApplicationBase = Directory.GetCurrentDirectory(),
30+
ConfigurationFile = $"{Assembly.GetExecutingAssembly().Location}.config",
31+
TargetFrameworkName = AppDomain.CurrentDomain.SetupInformation.TargetFrameworkName
32+
};
3133
return AppDomain.CreateDomain(domainName, null, setup);
3234
#else
3335
throw new NotImplementedException();
@@ -41,7 +43,7 @@ public void DoAppDomainCall(AppDomain domain, Action action)
4143
domain.DoCallBack(crossAppDomainAction.Invoke);
4244

4345
// rethrow exception from the domain into the current AppDomain.
44-
var exception = crossAppDomainAction.GetException(domain);
46+
Exception exception = crossAppDomainAction.GetException(domain);
4547
if(exception != null)
4648
{
4749
throw exception;
@@ -58,15 +60,15 @@ public static string GetAppSettingsValue(string key)
5860
throw new InvalidOperationException($"Can not find the Environment variable by the name='{key}'");
5961
}
6062

61-
var configValue = Environment.GetEnvironmentVariable(key);
63+
string configValue = Environment.GetEnvironmentVariable(key);
6264
return configValue;
6365
}
6466

6567
public bool IsDotNetCore { get; private set; }
6668

6769
public bool IsFramework { get; private set; }
6870

69-
public string OsGeneralName
71+
public static string OsGeneralName
7072
{
7173
get
7274
{
@@ -85,9 +87,14 @@ public string OsGeneralName
8587
& Directory.Exists("/System")
8688
& Directory.Exists("/Users")
8789
& Directory.Exists("/Volumes"))
90+
{
8891
goto case PlatformID.MacOSX;
92+
}
8993
else
94+
{
9095
return "linux";
96+
}
97+
9198
case PlatformID.MacOSX:
9299
return "osx";
93100
}
@@ -117,15 +124,16 @@ public string OsGeneralName
117124
}
118125

119126
public string SuffixName { get; private set; }
120-
public string TestEnvironmentName => Environment.GetEnvironmentVariable("TEST_ENVIRONMENT_NAME");
127+
public static string TestEnvironmentName => Environment.GetEnvironmentVariable("TEST_ENVIRONMENT_NAME");
121128
}
129+
122130
#if NETFRAMEWORK
123131
// do not use short name for the System.Serializable, because it conflicts with the SerializableAttribute
124132
// from the file PdfSharpCore\SilverlightInternals\AgHacks.cs : 55
125133
[System.Serializable]
126134
internal class CrossAppDomainAction : MarshalByRefObject
127135
{
128-
private static readonly string ExceptionStoreKey =
136+
private static readonly string _exceptionStoreKey =
129137
$"{typeof(CrossAppDomainAction).FullName}.{nameof(SetException)}";
130138

131139
private readonly Action _action;
@@ -139,17 +147,17 @@ private void SetException(Exception exception)
139147
{
140148
if(exception.GetType().IsSerializable)
141149
{
142-
AppDomain.CurrentDomain.SetData(ExceptionStoreKey, exception);
150+
AppDomain.CurrentDomain.SetData(_exceptionStoreKey, exception);
143151
}
144152
else
145153
{
146-
AppDomain.CurrentDomain.SetData(ExceptionStoreKey, new InvalidOperationException(exception.ToString()));
154+
AppDomain.CurrentDomain.SetData(_exceptionStoreKey, new InvalidOperationException(exception.ToString()));
147155
}
148156
}
149157

150158
public Exception GetException(AppDomain domain)
151159
{
152-
var data = domain.GetData(ExceptionStoreKey);
160+
object data = domain.GetData(_exceptionStoreKey);
153161
return (Exception)data;
154162
}
155163

IronSoftware.Drawing/IronSoftware.Drawing.Common.Tests/TestsBase.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace IronSoftware.Drawing.Common.Tests
88
{
9-
[Trait(TestingTraits.Category, TestingTraits.IntegrationTest)]
9+
[Trait(TestingTraits.CATEGORY, TestingTraits.INTEGRATION_TEST)]
1010
public abstract class TestsBase : IDisposable
1111
{
1212
protected static readonly TargetFramework TargetFramework = new TargetFramework();
@@ -23,17 +23,18 @@ protected TestsBase(ITestOutputHelper output)
2323

2424
public void Dispose()
2525
{
26+
GC.SuppressFinalize(this);
2627
}
2728

2829
public static string GetDataPath()
2930
{
30-
var settingsValue = TargetFramework.GetAppSettingsValue("IronSoftware.Drawing.Common.Tests.DataFolder");
31+
string settingsValue = TargetFramework.GetAppSettingsValue("IronSoftware.Drawing.Common.Tests.DataFolder");
3132
settingsValue = settingsValue.Replace('\\', Path.DirectorySeparatorChar);
3233

33-
var currentFolder = Environment.CurrentDirectory;
34+
string currentFolder = Environment.CurrentDirectory;
3435

35-
var dataPath = Path.Combine(currentFolder, settingsValue);
36-
var fullPath = Path.GetFullPath(dataPath);
36+
string dataPath = Path.Combine(currentFolder, settingsValue);
37+
string fullPath = Path.GetFullPath(dataPath);
3738
return fullPath;
3839
}
3940

@@ -44,14 +45,15 @@ public static string GetRelativeFilePath(string fileName)
4445

4546
public static string GetRelativeFilePath(string mainPath, string fileName)
4647
{
47-
var dataPath = GetDataPath();
48+
string dataPath = GetDataPath();
4849
if (!string.IsNullOrEmpty(mainPath))
4950
{
5051
string fullPath = Path.Combine(dataPath, mainPath);
5152
if (mainPath.Contains("expected") && IsUnix())
5253
{
5354
fullPath = Path.Combine(fullPath, "Unix");
5455
}
56+
5557
fullPath = Path.Combine(fullPath, fileName);
5658
fullPath = fullPath.Replace('\\', Path.DirectorySeparatorChar);
5759

@@ -60,7 +62,7 @@ public static string GetRelativeFilePath(string mainPath, string fileName)
6062
else
6163
{
6264
return Path.Combine(dataPath, fileName);
63-
}
65+
}
6466
}
6567

6668
protected static bool IsUnix()

IronSoftware.Drawing/IronSoftware.Drawing.Common.Tests/UnitTests/ColorFunctionality.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ public void Cast_ImageSharp_Rgba64_to_Color()
507507
public void Should_Return_Argb()
508508
{
509509
System.Drawing.Color bmColor = System.Drawing.Color.Azure;
510-
IronSoftware.Drawing.Color ironColor = IronSoftware.Drawing.Color.Azure;
510+
IronSoftware.Drawing.Color ironColor = Color.Azure;
511511
IronSoftware.Drawing.Color fromImageSharp = SixLabors.ImageSharp.Color.Azure;
512512
IronSoftware.Drawing.Color rgba32 = new SixLabors.ImageSharp.PixelFormats.Rgba32(bmColor.R, bmColor.G, bmColor.B, bmColor.A);
513513
IronSoftware.Drawing.Color rgb24 = new SixLabors.ImageSharp.PixelFormats.Rgb24(bmColor.R, bmColor.G, bmColor.B);

0 commit comments

Comments
 (0)