Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove RunSerial from tests #1885

Merged
merged 3 commits into from
Dec 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion tests/ImageSharp.Tests/Formats/Bmp/BmpDecoderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
// ReSharper disable InconsistentNaming
namespace SixLabors.ImageSharp.Tests.Formats.Bmp
{
[Collection("RunSerial")]
[Trait("Format", "Bmp")]
public class BmpDecoderTests
{
Expand Down
7 changes: 3 additions & 4 deletions tests/ImageSharp.Tests/Formats/Bmp/BmpEncoderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,26 @@
// ReSharper disable InconsistentNaming
namespace SixLabors.ImageSharp.Tests.Formats.Bmp
{
[Collection("RunSerial")]
[Trait("Format", "Bmp")]
public class BmpEncoderTests
{
public static readonly TheoryData<BmpBitsPerPixel> BitsPerPixel =
new TheoryData<BmpBitsPerPixel>
new()
{
BmpBitsPerPixel.Pixel24,
BmpBitsPerPixel.Pixel32
};

public static readonly TheoryData<string, int, int, PixelResolutionUnit> RatioFiles =
new TheoryData<string, int, int, PixelResolutionUnit>
new()
{
{ Car, 3780, 3780, PixelResolutionUnit.PixelsPerMeter },
{ V5Header, 3780, 3780, PixelResolutionUnit.PixelsPerMeter },
{ RLE8, 2835, 2835, PixelResolutionUnit.PixelsPerMeter }
};

public static readonly TheoryData<string, BmpBitsPerPixel> BmpBitsPerPixelFiles =
new TheoryData<string, BmpBitsPerPixel>
new()
{
{ Bit1, BmpBitsPerPixel.Pixel1 },
{ Bit4, BmpBitsPerPixel.Pixel4 },
Expand Down
8 changes: 3 additions & 5 deletions tests/ImageSharp.Tests/Formats/GeneralFormatTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@
using System.Reflection;
using SixLabors.ImageSharp.Formats;
using SixLabors.ImageSharp.Formats.Png;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Processors.Quantization;
using Xunit;

namespace SixLabors.ImageSharp.Tests.Formats
{
[Collection("RunSerial")]
public class GeneralFormatTests
{
/// <summary>
Expand All @@ -34,7 +32,7 @@ public class GeneralFormatTests
/// <summary>
/// The collection of image files to test against.
/// </summary>
protected static readonly List<TestFile> Files = new List<TestFile>
protected static readonly List<TestFile> Files = new()
{
TestFile.Create(TestImages.Jpeg.Baseline.Calliphora),
TestFile.Create(TestImages.Bmp.Car),
Expand Down Expand Up @@ -85,8 +83,8 @@ public void DecodeThenEncodeImageFromStreamShouldSucceed()
}

public static readonly TheoryData<string> QuantizerNames =
new TheoryData<string>
{
new()
{
nameof(KnownQuantizers.Octree),
nameof(KnownQuantizers.WebSafe),
nameof(KnownQuantizers.Werner),
Expand Down
3 changes: 1 addition & 2 deletions tests/ImageSharp.Tests/Formats/Gif/GifDecoderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@
// ReSharper disable InconsistentNaming
namespace SixLabors.ImageSharp.Tests.Formats.Gif
{
[Collection("RunSerial")]
[Trait("Format", "Gif")]
public class GifDecoderTests
{
private const PixelTypes TestPixelTypes = PixelTypes.Rgba32 | PixelTypes.RgbaVector | PixelTypes.Argb32;

private static GifDecoder GifDecoder => new GifDecoder();
private static GifDecoder GifDecoder => new();

public static readonly string[] MultiFrameTestFiles =
{
Expand Down
3 changes: 1 addition & 2 deletions tests/ImageSharp.Tests/Formats/Gif/GifEncoderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@
// ReSharper disable InconsistentNaming
namespace SixLabors.ImageSharp.Tests.Formats.Gif
{
[Collection("RunSerial")]
[Trait("Format", "Gif")]
public class GifEncoderTests
{
private const PixelTypes TestPixelTypes = PixelTypes.Rgba32 | PixelTypes.RgbaVector | PixelTypes.Argb32;
private static readonly ImageComparer ValidatorComparer = ImageComparer.TolerantPercentage(0.0015F);

public static readonly TheoryData<string, int, int, PixelResolutionUnit> RatioFiles =
new TheoryData<string, int, int, PixelResolutionUnit>
new()
{
{ TestImages.Gif.Rings, (int)ImageMetadata.DefaultHorizontalResolution, (int)ImageMetadata.DefaultVerticalResolution, PixelResolutionUnit.PixelsPerInch },
{ TestImages.Gif.Ratio1x4, 1, 4, PixelResolutionUnit.AspectRatio },
Expand Down
5 changes: 2 additions & 3 deletions tests/ImageSharp.Tests/Formats/Gif/GifMetadataTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,19 @@

namespace SixLabors.ImageSharp.Tests.Formats.Gif
{
[Collection("RunSerial")]
[Trait("Format", "Gif")]
public class GifMetadataTests
{
public static readonly TheoryData<string, int, int, PixelResolutionUnit> RatioFiles =
new TheoryData<string, int, int, PixelResolutionUnit>
new()
{
{ TestImages.Gif.Rings, (int)ImageMetadata.DefaultHorizontalResolution, (int)ImageMetadata.DefaultVerticalResolution, PixelResolutionUnit.PixelsPerInch },
{ TestImages.Gif.Ratio1x4, 1, 4, PixelResolutionUnit.AspectRatio },
{ TestImages.Gif.Ratio4x1, 4, 1, PixelResolutionUnit.AspectRatio }
};

public static readonly TheoryData<string, uint> RepeatFiles =
new TheoryData<string, uint>
new()
{
{ TestImages.Gif.Cheers, 0 },
{ TestImages.Gif.Receipt, 1 },
Expand Down
3 changes: 1 addition & 2 deletions tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
namespace SixLabors.ImageSharp.Tests.Formats.Jpg
{
// TODO: Scatter test cases into multiple test classes
[Collection("RunSerial")]
[Trait("Format", "Jpg")]
[Trait("Format", "Jpg")]
public partial class JpegDecoderTests
{
public const PixelTypes CommonNonDefaultPixelTypes = PixelTypes.Rgba32 | PixelTypes.Argb32 | PixelTypes.Bgr24 | PixelTypes.RgbaVector;
Expand Down
13 changes: 6 additions & 7 deletions tests/ImageSharp.Tests/Formats/Jpg/JpegEncoderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,22 @@

namespace SixLabors.ImageSharp.Tests.Formats.Jpg
{
[Collection("RunSerial")]
[Trait("Format", "Jpg")]
public class JpegEncoderTests
{
private static JpegEncoder JpegEncoder => new JpegEncoder();
private static JpegEncoder JpegEncoder => new();

private static JpegDecoder JpegDecoder => new JpegDecoder();
private static JpegDecoder JpegDecoder => new();

public static readonly TheoryData<string, int> QualityFiles =
new TheoryData<string, int>
new()
{
{ TestImages.Jpeg.Baseline.Calliphora, 80 },
{ TestImages.Jpeg.Progressive.Fb, 75 }
};

public static readonly TheoryData<JpegColorType, int> BitsPerPixel_Quality =
new TheoryData<JpegColorType, int>
new()
{
{ JpegColorType.YCbCrRatio420, 40 },
{ JpegColorType.YCbCrRatio420, 60 },
Expand All @@ -49,15 +48,15 @@ public class JpegEncoderTests
};

public static readonly TheoryData<int> Grayscale_Quality =
new TheoryData<int>
new()
{
{ 40 },
{ 60 },
{ 100 }
};

public static readonly TheoryData<string, int, int, PixelResolutionUnit> RatioFiles =
new TheoryData<string, int, int, PixelResolutionUnit>
new()
{
{ TestImages.Jpeg.Baseline.Ratio1x1, 1, 1, PixelResolutionUnit.AspectRatio },
{ TestImages.Jpeg.Baseline.Snake, 300, 300, PixelResolutionUnit.PixelsPerInch },
Expand Down
3 changes: 1 addition & 2 deletions tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@
// ReSharper disable InconsistentNaming
namespace SixLabors.ImageSharp.Tests.Formats.Png
{
[Collection("RunSerial")]
[Trait("Format", "Png")]
public partial class PngDecoderTests
{
private const PixelTypes PixelTypes = Tests.PixelTypes.Rgba32 | Tests.PixelTypes.RgbaVector | Tests.PixelTypes.Argb32;

private static PngDecoder PngDecoder => new PngDecoder();
private static PngDecoder PngDecoder => new();

public static readonly string[] CommonTestImages =
{
Expand Down
19 changes: 9 additions & 10 deletions tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,20 @@

namespace SixLabors.ImageSharp.Tests.Formats.Png
{
[Collection("RunSerial")]
[Trait("Format", "Png")]
public partial class PngEncoderTests
{
private static PngEncoder PngEncoder => new PngEncoder();
private static PngEncoder PngEncoder => new();

public static readonly TheoryData<string, PngBitDepth> PngBitDepthFiles =
new TheoryData<string, PngBitDepth>
new()
{
{ TestImages.Png.Rgb48Bpp, PngBitDepth.Bit16 },
{ TestImages.Png.Bpp1, PngBitDepth.Bit1 }
};

public static readonly TheoryData<string, PngBitDepth, PngColorType> PngTrnsFiles =
new TheoryData<string, PngBitDepth, PngColorType>
new()
{
{ TestImages.Png.Gray1BitTrans, PngBitDepth.Bit1, PngColorType.Grayscale },
{ TestImages.Png.Gray2BitTrans, PngBitDepth.Bit2, PngColorType.Grayscale },
Expand All @@ -43,15 +42,15 @@ public partial class PngEncoderTests
/// <summary>
/// All types except Palette
/// </summary>
public static readonly TheoryData<PngColorType> PngColorTypes = new TheoryData<PngColorType>
public static readonly TheoryData<PngColorType> PngColorTypes = new()
{
PngColorType.RgbWithAlpha,
PngColorType.Rgb,
PngColorType.Grayscale,
PngColorType.GrayscaleWithAlpha,
};

public static readonly TheoryData<PngFilterMethod> PngFilterMethods = new TheoryData<PngFilterMethod>
public static readonly TheoryData<PngFilterMethod> PngFilterMethods = new()
{
PngFilterMethod.None,
PngFilterMethod.Sub,
Expand All @@ -65,7 +64,7 @@ public partial class PngEncoderTests
/// All types except Palette
/// </summary>
public static readonly TheoryData<PngCompressionLevel> CompressionLevels
= new TheoryData<PngCompressionLevel>
= new()
{
PngCompressionLevel.Level0,
PngCompressionLevel.Level1,
Expand All @@ -79,12 +78,12 @@ public static readonly TheoryData<PngCompressionLevel> CompressionLevels
PngCompressionLevel.Level9,
};

public static readonly TheoryData<int> PaletteSizes = new TheoryData<int>
public static readonly TheoryData<int> PaletteSizes = new()
{
30, 55, 100, 201, 255
};

public static readonly TheoryData<int> PaletteLargeOnly = new TheoryData<int>
public static readonly TheoryData<int> PaletteLargeOnly = new()
{
80, 100, 120, 230
};
Expand All @@ -96,7 +95,7 @@ public static readonly TheoryData<PngCompressionLevel> CompressionLevels
};

public static readonly TheoryData<string, int, int, PixelResolutionUnit> RatioFiles =
new TheoryData<string, int, int, PixelResolutionUnit>
new()
{
{ TestImages.Png.Splash, 11810, 11810, PixelResolutionUnit.PixelsPerMeter },
{ TestImages.Png.Ratio1x4, 1, 4, PixelResolutionUnit.AspectRatio },
Expand Down
3 changes: 1 addition & 2 deletions tests/ImageSharp.Tests/Formats/Tga/TgaDecoderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@
// ReSharper disable InconsistentNaming
namespace SixLabors.ImageSharp.Tests.Formats.Tga
{
[Collection("RunSerial")]
[Trait("Format", "Tga")]
public class TgaDecoderTests
{
private static TgaDecoder TgaDecoder => new TgaDecoder();
private static TgaDecoder TgaDecoder => new();

[Theory]
[WithFile(Gray8BitTopLeft, PixelTypes.Rgba32)]
Expand Down
5 changes: 2 additions & 3 deletions tests/ImageSharp.Tests/Formats/Tga/TgaEncoderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,18 @@
// ReSharper disable InconsistentNaming
namespace SixLabors.ImageSharp.Tests.Formats.Tga
{
[Collection("RunSerial")]
[Trait("Format", "Tga")]
public class TgaEncoderTests
{
public static readonly TheoryData<TgaBitsPerPixel> BitsPerPixel =
new TheoryData<TgaBitsPerPixel>
new()
{
TgaBitsPerPixel.Pixel24,
TgaBitsPerPixel.Pixel32
};

public static readonly TheoryData<string, TgaBitsPerPixel> TgaBitsPerPixelFiles =
new TheoryData<string, TgaBitsPerPixel>
new()
{
{ Gray8BitBottomLeft, TgaBitsPerPixel.Pixel8 },
{ Bit16BottomLeft, TgaBitsPerPixel.Pixel16 },
Expand Down
5 changes: 2 additions & 3 deletions tests/ImageSharp.Tests/Formats/Tiff/TiffDecoderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@

namespace SixLabors.ImageSharp.Tests.Formats.Tiff
{
[Collection("RunSerial")]
[Trait("Format", "Tiff")]
public class TiffDecoderTests
{
public static readonly string[] MultiframeTestImages = Multiframes;

private static TiffDecoder TiffDecoder => new TiffDecoder();
private static TiffDecoder TiffDecoder => new();

private static MagickReferenceDecoder ReferenceDecoder => new MagickReferenceDecoder();
private static MagickReferenceDecoder ReferenceDecoder => new();

[Theory]
[WithFile(RgbUncompressedTiled, PixelTypes.Rgba32)]
Expand Down
1 change: 0 additions & 1 deletion tests/ImageSharp.Tests/Formats/Tiff/TiffEncoderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace SixLabors.ImageSharp.Tests.Formats.Tiff
{
[Collection("RunSerial")]
[Trait("Format", "Tiff")]
public class TiffEncoderTests : TiffEncoderBaseTester
{
Expand Down
3 changes: 1 addition & 2 deletions tests/ImageSharp.Tests/Formats/Tiff/TiffMetadataTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@

namespace SixLabors.ImageSharp.Tests.Formats.Tiff
{
[Collection("RunSerial")]
[Trait("Format", "Tiff")]
public class TiffMetadataTests
{
private static TiffDecoder TiffDecoder => new TiffDecoder();
private static TiffDecoder TiffDecoder => new();

private class NumberComparer : IEqualityComparer<Number>
{
Expand Down
1 change: 0 additions & 1 deletion tests/ImageSharp.Tests/Formats/WebP/WebpDecoderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// ReSharper disable InconsistentNaming
namespace SixLabors.ImageSharp.Tests.Formats.Webp
{
[Collection("RunSerial")]
[Trait("Format", "Webp")]
public class WebpDecoderTests
{
Expand Down
1 change: 0 additions & 1 deletion tests/ImageSharp.Tests/Formats/WebP/WebpEncoderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace SixLabors.ImageSharp.Tests.Formats.Webp
{
[Collection("RunSerial")]
[Trait("Format", "Webp")]
public class WebpEncoderTests
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Six Labors.
// Copyright (c) Six Labors.
// Licensed under the Apache License, Version 2.0.

using System;
Expand Down Expand Up @@ -310,6 +310,7 @@ private static void AllocateGroupAndForget(UniformUnmanagedMemoryPoolMemoryAlloc
}
}

[ActiveIssue("https://github.com/SixLabors/ImageSharp/issues/1887", TestPlatforms.OSX)]
[Theory]
[InlineData(300)] // Group of single SharedArrayPoolBuffer<T>
[InlineData(600)] // Group of single UniformUnmanagedMemoryPool buffer
Expand Down