Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
43cbdab
Fix stylecop warnings in the test project
brianpopow Jan 21, 2020
38454f8
Use using declarations to reduce nesting
brianpopow Jan 22, 2020
bb42df5
Merge remote-tracking branch 'upstream/master' into feature/stylecopT…
brianpopow Jan 22, 2020
6c40593
Remove regions
brianpopow Jan 23, 2020
f897ab6
Change WithTestPatternImageAttribute to WithTestPatternImagesAttribute
brianpopow Jan 23, 2020
94dc54b
Rename method names again to be the same as in the reference implemen…
brianpopow Jan 23, 2020
715de4c
Defining the tmp vars in a single line again
brianpopow Jan 23, 2020
8a6797c
Move ITestImageProvider to a separate file
brianpopow Jan 23, 2020
d59ca98
Revert comment as it was before, add exception for SA1115
brianpopow Jan 23, 2020
32bc422
Merge remote-tracking branch 'upstream/master' into feature/stylecopT…
brianpopow Jan 30, 2020
076a2bc
Update external for the changed test ruleset
brianpopow Jan 30, 2020
6f0e6e9
Fix some leftover stylecop warnings
brianpopow Jan 30, 2020
9f181a3
Change InternalsVisibleTo from SixLabors.ImageSharp.Sandbox46 to Imag…
brianpopow Jan 30, 2020
5ff7bb7
Revert "Change InternalsVisibleTo from SixLabors.ImageSharp.Sandbox46…
brianpopow Jan 31, 2020
0bce7af
Remove including tests into the profiling sandbox
brianpopow Jan 31, 2020
2c7e253
Merge branch 'master' into feature/stylecopTests
brianpopow Jan 31, 2020
15a7a55
Revert `using` declaration changes for until we establish guidelines.
JimBobSquarePants Feb 2, 2020
1f3311b
Add more rule exemptions and prevent blanket using recommendations
JimBobSquarePants Feb 2, 2020
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
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,15 @@ public ShortClr()
[Params(
TestImages.Jpeg.BenchmarkSuite.Lake_Small444YCbCr,
TestImages.Jpeg.BenchmarkSuite.BadRstProgressive518_Large444YCbCr,
/* The scaled result for the large image "ExifGetString750Transform_Huge420YCbCr"
is almost the same as the result for Jpeg420Exif,
which proves that the execution time for the most common YCbCr 420 path scales linearly.
TestImages.Jpeg.BenchmarkSuite.ExifGetString750Transform_Huge420YCbCr,
*/

#pragma warning disable SA1115 // Parameter should follow comma
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we not just disable these kind of rules instead?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SA1115 is now disabled


// The scaled result for the large image "ExifGetString750Transform_Huge420YCbCr"
// is almost the same as the result for Jpeg420Exif,
// which proves that the execution time for the most common YCbCr 420 path scales linearly.
// TestImages.Jpeg.BenchmarkSuite.ExifGetString750Transform_Huge420YCbCr,
TestImages.Jpeg.BenchmarkSuite.Jpeg420Exif_MidSizeYCbCr)]
#pragma warning restore SA1115 // Parameter should follow comma

public string TestImage { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,31 +242,19 @@ public void Bitops_Simd()
}
}

#pragma warning disable SA1132 // Do not combine fields
[StructLayout(LayoutKind.Sequential)]
private struct B
{
public uint Tmp2;
public uint Tmp5;
public uint Tmp8;
public uint Tmp11;
public uint Tmp14;
public uint Tmp17;
public uint Tmp20;
public uint Tmp23;
public uint Tmp2, Tmp5, Tmp8, Tmp11, Tmp14, Tmp17, Tmp20, Tmp23;
}

[StructLayout(LayoutKind.Sequential)]
private struct C
{
public uint Tmp3;
public uint Tmp6;
public uint Tmp9;
public uint Tmp12;
public uint Tmp15;
public uint Tmp18;
public uint Tmp21;
public uint Tmp24;
public uint Tmp3, Tmp6, Tmp9, Tmp12, Tmp15, Tmp18, Tmp21, Tmp24;
}
#pragma warning restore SA1132 // Do not combine fields

[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static void BitopsSimdImpl(ref Octet.OfUInt32 s, ref Octet.OfUInt32 d)
Expand Down
10 changes: 5 additions & 5 deletions tests/ImageSharp.Tests/Advanced/AdvancedImageExtensionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class GetPixelMemory
{
[Theory]
[WithSolidFilledImages(1, 1, "Red", PixelTypes.Rgba32)]
[WithTestPatternImage(131, 127, PixelTypes.Rgba32 | PixelTypes.Bgr24)]
[WithTestPatternImages(131, 127, PixelTypes.Rgba32 | PixelTypes.Bgr24)]
public void WhenMemoryIsOwned<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
Expand All @@ -38,7 +38,7 @@ public void WhenMemoryIsOwned<TPixel>(TestImageProvider<TPixel> provider)

[Theory]
[WithSolidFilledImages(1, 1, "Red", PixelTypes.Rgba32 | PixelTypes.Bgr24)]
[WithTestPatternImage(131, 127, PixelTypes.Rgba32 | PixelTypes.Bgr24)]
[WithTestPatternImages(131, 127, PixelTypes.Rgba32 | PixelTypes.Bgr24)]
public void WhenMemoryIsConsumed<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
Expand All @@ -64,7 +64,7 @@ public void WhenMemoryIsConsumed<TPixel>(TestImageProvider<TPixel> provider)

[Theory]
[WithSolidFilledImages(1, 1, "Red", PixelTypes.Rgba32)]
[WithTestPatternImage(131, 127, PixelTypes.Rgba32 | PixelTypes.Bgr24)]
[WithTestPatternImages(131, 127, PixelTypes.Rgba32 | PixelTypes.Bgr24)]
public void GetPixelRowMemory<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
Expand All @@ -87,7 +87,7 @@ public void GetPixelRowMemory<TPixel>(TestImageProvider<TPixel> provider)

[Theory]
[WithSolidFilledImages(1, 1, "Red", PixelTypes.Rgba32)]
[WithTestPatternImage(131, 127, PixelTypes.Rgba32 | PixelTypes.Bgr24)]
[WithTestPatternImages(131, 127, PixelTypes.Rgba32 | PixelTypes.Bgr24)]
public void GetPixelRowSpan<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
Expand All @@ -111,7 +111,7 @@ public void GetPixelRowSpan<TPixel>(TestImageProvider<TPixel> provider)
#pragma warning disable 0618

[Theory]
[WithTestPatternImage(131, 127, PixelTypes.Rgba32 | PixelTypes.Bgr24)]
[WithTestPatternImages(131, 127, PixelTypes.Rgba32 | PixelTypes.Bgr24)]
public unsafe void DangerousGetPinnableReference_CopyToBuffer<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
Expand Down
8 changes: 4 additions & 4 deletions tests/ImageSharp.Tests/Drawing/DrawImageTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ public void ImageBlendingMatchesSvgSpecExamples<TPixel>(TestImageProvider<TPixel
[WithFile(TestImages.Png.CalliphoraPartial, PixelTypes.Rgba32, TestImages.Png.Splash, PixelColorBlendingMode.Normal, 0.75f)]
[WithFile(TestImages.Png.CalliphoraPartial, PixelTypes.Rgba32, TestImages.Png.Splash, PixelColorBlendingMode.Normal, 0.25f)]

[WithTestPatternImage(400, 400, PixelTypes.Rgba32, TestImages.Png.Splash, PixelColorBlendingMode.Multiply, 0.5f)]
[WithTestPatternImage(400, 400, PixelTypes.Rgba32, TestImages.Png.Splash, PixelColorBlendingMode.Add, 0.5f)]
[WithTestPatternImage(400, 400, PixelTypes.Rgba32, TestImages.Png.Splash, PixelColorBlendingMode.Subtract, 0.5f)]
[WithTestPatternImages(400, 400, PixelTypes.Rgba32, TestImages.Png.Splash, PixelColorBlendingMode.Multiply, 0.5f)]
[WithTestPatternImages(400, 400, PixelTypes.Rgba32, TestImages.Png.Splash, PixelColorBlendingMode.Add, 0.5f)]
[WithTestPatternImages(400, 400, PixelTypes.Rgba32, TestImages.Png.Splash, PixelColorBlendingMode.Subtract, 0.5f)]

[WithFile(TestImages.Png.Rgb48Bpp, PixelTypes.Rgba64, TestImages.Png.Splash, PixelColorBlendingMode.Normal, 1f)]
[WithFile(TestImages.Png.Rgb48Bpp, PixelTypes.Rgba64, TestImages.Png.Splash, PixelColorBlendingMode.Normal, 0.25f)]
Expand Down Expand Up @@ -93,7 +93,7 @@ public void WorksWithDifferentConfigurations<TPixel>(
}

[Theory]
[WithTestPatternImage(200, 200, PixelTypes.Rgba32 | PixelTypes.Bgra32)]
[WithTestPatternImages(200, 200, PixelTypes.Rgba32 | PixelTypes.Bgra32)]
public void DrawImageOfDifferentPixelType<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
Expand Down
10 changes: 5 additions & 5 deletions tests/ImageSharp.Tests/Formats/Bmp/BmpEncoderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,16 @@ public void Encode_PreserveBitsPerPixel(string imagePath, BmpBitsPerPixel bmpBit
}

[Theory]
[WithTestPatternImage(nameof(BitsPerPixel), 24, 24, PixelTypes.Rgba32 | PixelTypes.Bgra32 | PixelTypes.Rgb24)]
[WithTestPatternImages(nameof(BitsPerPixel), 24, 24, PixelTypes.Rgba32 | PixelTypes.Bgra32 | PixelTypes.Rgb24)]
public void Encode_IsNotBoundToSinglePixelType<TPixel>(TestImageProvider<TPixel> provider, BmpBitsPerPixel bitsPerPixel)
where TPixel : struct, IPixel<TPixel> => TestBmpEncoderCore(provider, bitsPerPixel);

[Theory]
[WithTestPatternImage(nameof(BitsPerPixel), 48, 24, PixelTypes.Rgba32)]
[WithTestPatternImage(nameof(BitsPerPixel), 47, 8, PixelTypes.Rgba32)]
[WithTestPatternImage(nameof(BitsPerPixel), 49, 7, PixelTypes.Rgba32)]
[WithTestPatternImages(nameof(BitsPerPixel), 48, 24, PixelTypes.Rgba32)]
[WithTestPatternImages(nameof(BitsPerPixel), 47, 8, PixelTypes.Rgba32)]
[WithTestPatternImages(nameof(BitsPerPixel), 49, 7, PixelTypes.Rgba32)]
[WithSolidFilledImages(nameof(BitsPerPixel), 1, 1, 255, 100, 50, 255, PixelTypes.Rgba32)]
[WithTestPatternImage(nameof(BitsPerPixel), 7, 5, PixelTypes.Rgba32)]
[WithTestPatternImages(nameof(BitsPerPixel), 7, 5, PixelTypes.Rgba32)]
public void Encode_WorksWithDifferentSizes<TPixel>(TestImageProvider<TPixel> provider, BmpBitsPerPixel bitsPerPixel)
where TPixel : struct, IPixel<TPixel> => TestBmpEncoderCore(provider, bitsPerPixel);

Expand Down
2 changes: 1 addition & 1 deletion tests/ImageSharp.Tests/Formats/Gif/GifEncoderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class GifEncoderTests
};

[Theory]
[WithTestPatternImage(100, 100, TestPixelTypes)]
[WithTestPatternImages(100, 100, TestPixelTypes)]
public void EncodeGeneratedPatterns<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
Expand Down
12 changes: 6 additions & 6 deletions tests/ImageSharp.Tests/Formats/Jpg/JpegEncoderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,17 @@ public void Encode_PreserveQuality(string imagePath, int quality)

[Theory]
[WithFile(TestImages.Png.CalliphoraPartial, nameof(BitsPerPixel_Quality), PixelTypes.Rgba32)]
[WithTestPatternImage(nameof(BitsPerPixel_Quality), 73, 71, PixelTypes.Rgba32)]
[WithTestPatternImage(nameof(BitsPerPixel_Quality), 48, 24, PixelTypes.Rgba32)]
[WithTestPatternImage(nameof(BitsPerPixel_Quality), 46, 8, PixelTypes.Rgba32)]
[WithTestPatternImage(nameof(BitsPerPixel_Quality), 51, 7, PixelTypes.Rgba32)]
[WithTestPatternImages(nameof(BitsPerPixel_Quality), 73, 71, PixelTypes.Rgba32)]
[WithTestPatternImages(nameof(BitsPerPixel_Quality), 48, 24, PixelTypes.Rgba32)]
[WithTestPatternImages(nameof(BitsPerPixel_Quality), 46, 8, PixelTypes.Rgba32)]
[WithTestPatternImages(nameof(BitsPerPixel_Quality), 51, 7, PixelTypes.Rgba32)]
[WithSolidFilledImages(nameof(BitsPerPixel_Quality), 1, 1, 255, 100, 50, 255, PixelTypes.Rgba32)]
[WithTestPatternImage(nameof(BitsPerPixel_Quality), 7, 5, PixelTypes.Rgba32)]
[WithTestPatternImages(nameof(BitsPerPixel_Quality), 7, 5, PixelTypes.Rgba32)]
public void EncodeBaseline_WorksWithDifferentSizes<TPixel>(TestImageProvider<TPixel> provider, JpegSubsample subsample, int quality)
where TPixel : struct, IPixel<TPixel> => TestJpegEncoderCore(provider, subsample, quality);

[Theory]
[WithTestPatternImage(nameof(BitsPerPixel_Quality), 48, 48, PixelTypes.Rgba32 | PixelTypes.Bgra32)]
[WithTestPatternImages(nameof(BitsPerPixel_Quality), 48, 48, PixelTypes.Rgba32 | PixelTypes.Bgra32)]
public void EncodeBaseline_IsNotBoundToSinglePixelType<TPixel>(TestImageProvider<TPixel> provider, JpegSubsample subsample, int quality)
where TPixel : struct, IPixel<TPixel> => TestJpegEncoderCore(provider, subsample, quality);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public static Block8x8F TransformFDCT(ref Block8x8F block)

private static double[,] InitCosLut()
{
var coslu = new double[8, 8];
double[,] coslu = new double[8, 8];
int a, b;
double tmp;

Expand Down
Loading