V10: fix build warnings in test projects (#12509)

* Run code cleanup

* Dotnet format benchmarks project

* Fix up Test.Common

* Run dotnet format + manual cleanup

* Run code cleanup for unit tests

* Run dotnet format

* Fix up errors

* Manual cleanup of Unit test project

* Update tests/Umbraco.Tests.Benchmarks/HexStringBenchmarks.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Update tests/Umbraco.Tests.Integration/Testing/TestDbMeta.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Update tests/Umbraco.Tests.Benchmarks/TypeFinderBenchmarks.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Update tests/Umbraco.Tests.Integration/Testing/UmbracoIntegrationTest.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Update tests/Umbraco.Tests.Integration/Umbraco.Core/Events/EventAggregatorTests.cs

Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>

* Fix according to review

* Fix after merge

* Fix errors

Co-authored-by: Nikolaj Geisle <niko737@edu.ucl.dk>
Co-authored-by: Mole <nikolajlauridsen@protonmail.ch>
Co-authored-by: Zeegaan <nge@umbraco.dk>
This commit is contained in:
Nikolaj Geisle
2022-06-21 08:09:38 +02:00
committed by GitHub
parent 29961d40a3
commit 7aeb400fce
599 changed files with 87303 additions and 86123 deletions

View File

@@ -13,43 +13,40 @@ using SixLabors.ImageSharp.Web.Commands.Converters;
using SixLabors.ImageSharp.Web.Middleware;
using Umbraco.Cms.Web.Common.ImageProcessors;
namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Web.Common.ImageProcessors
namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Web.Common.ImageProcessors;
[TestFixture]
public class CropWebProcessorTests
{
[TestFixture]
public class CropWebProcessorTests
[Test]
// Coordinates are percentages to crop from the left, top, right and bottom sides
[TestCase("0,0,0,0", 50, 90)]
[TestCase("0.1,0.0,0.0,0.0", 45, 90)]
[TestCase("0.0,0.1,0.0,0.0", 50, 81)]
[TestCase("0.0,0.0,0.1,0.0", 45, 90)]
[TestCase("0.0,0.0,0.0,0.1", 50, 81)]
[TestCase("0.1,0.0,0.1,0.0", 40, 90)]
[TestCase("0.0,0.1,0.0,0.1", 50, 72)]
[TestCase("0.1,0.1,0.1,0.1", 40, 72)]
[TestCase("0.25,0.25,0.25,0.25", 25, 45)]
public void CropWebProcessor_CropsImage(string coordinates, int width, int height)
{
[Test]
// Coordinates are percentages to crop from the left, top, right and bottom sides
[TestCase("0,0,0,0", 50, 90)]
[TestCase("0.1,0.0,0.0,0.0", 45, 90)]
[TestCase("0.0,0.1,0.0,0.0", 50, 81)]
[TestCase("0.0,0.0,0.1,0.0", 45, 90)]
[TestCase("0.0,0.0,0.0,0.1", 50, 81)]
[TestCase("0.1,0.0,0.1,0.0", 40, 90)]
[TestCase("0.0,0.1,0.0,0.1", 50, 72)]
[TestCase("0.1,0.1,0.1,0.1", 40, 72)]
[TestCase("0.25,0.25,0.25,0.25", 25, 45)]
public void CropWebProcessor_CropsImage(string coordinates, int width, int height)
using var image = new Image<Rgba32>(50, 90);
using var formattedImage = new FormattedImage(image, PngFormat.Instance);
var logger = new NullLogger<ImageSharpMiddleware>();
var commands = new CommandCollection { { CropWebProcessor.Coordinates, coordinates } };
var parser = new CommandParser(new ICommandConverter[]
{
using var image = new Image<Rgba32>(50, 90);
using var formattedImage = new FormattedImage(image, PngFormat.Instance);
new ArrayConverter<float>(),
new SimpleCommandConverter<float>(),
});
var culture = CultureInfo.InvariantCulture;
var logger = new NullLogger<ImageSharpMiddleware>();
var commands = new CommandCollection
{
{ CropWebProcessor.Coordinates, coordinates },
};
var parser = new CommandParser(new ICommandConverter[]
{
new ArrayConverter<float>(),
new SimpleCommandConverter<float>()
});
var culture = CultureInfo.InvariantCulture;
new CropWebProcessor().Process(formattedImage, logger, commands, parser, culture);
new CropWebProcessor().Process(formattedImage, logger, commands, parser, culture);
Assert.AreEqual(width, image.Width);
Assert.AreEqual(height, image.Height);
}
Assert.AreEqual(width, image.Width);
Assert.AreEqual(height, image.Height);
}
}