Browse Source

strictly categorized test jpeg-s into Baseline/Progressive groups

af/merge-core
Anton Firszov 9 years ago
parent
commit
4004feeda9
  1. 3
      tests/ImageSharp.Sandbox46/ImageSharp.Sandbox46.csproj
  2. 14
      tests/ImageSharp.Tests/FileTestBase.cs
  3. 6
      tests/ImageSharp.Tests/Formats/Jpg/BadEofJpegTests.cs
  4. 28
      tests/ImageSharp.Tests/Formats/Jpg/JpegTests.cs
  5. 8
      tests/ImageSharp.Tests/Profiles/Exif/ExifProfileTests.cs
  6. 2
      tests/ImageSharp.Tests/Profiles/Exif/ExifValueTests.cs
  7. 83
      tests/ImageSharp.Tests/TestImages.cs
  8. 0
      tests/ImageSharp.Tests/TestImages/Formats/Jpg/baseline/Calliphora.jpg
  9. 0
      tests/ImageSharp.Tests/TestImages/Formats/Jpg/baseline/Floorplan.jpg
  10. 0
      tests/ImageSharp.Tests/TestImages/Formats/Jpg/baseline/Hiyamugi.jpg
  11. 0
      tests/ImageSharp.Tests/TestImages/Formats/Jpg/baseline/Lake.jpg
  12. 0
      tests/ImageSharp.Tests/TestImages/Formats/Jpg/baseline/Snake.jpg
  13. 0
      tests/ImageSharp.Tests/TestImages/Formats/Jpg/baseline/badeof.jpg
  14. 0
      tests/ImageSharp.Tests/TestImages/Formats/Jpg/baseline/cmyk.jpg
  15. 0
      tests/ImageSharp.Tests/TestImages/Formats/Jpg/baseline/exif.jpg
  16. 0
      tests/ImageSharp.Tests/TestImages/Formats/Jpg/baseline/gamma_dalai_lama_gray.jpg
  17. 0
      tests/ImageSharp.Tests/TestImages/Formats/Jpg/baseline/testimgint.jpg
  18. 0
      tests/ImageSharp.Tests/TestImages/Formats/Jpg/baseline/testorig.jpg
  19. 0
      tests/ImageSharp.Tests/TestImages/Formats/Jpg/baseline/turtle.jpg
  20. 0
      tests/ImageSharp.Tests/TestImages/Formats/Jpg/baseline/ycck.jpg
  21. 0
      tests/ImageSharp.Tests/TestImages/Formats/Jpg/progressive/Festzug.jpg
  22. 0
      tests/ImageSharp.Tests/TestImages/Formats/Jpg/progressive/fb.jpg
  23. 0
      tests/ImageSharp.Tests/TestImages/Formats/Jpg/progressive/progress.jpg

3
tests/ImageSharp.Sandbox46/ImageSharp.Sandbox46.csproj

@ -91,6 +91,9 @@
<Compile Include="..\ImageSharp.Tests\FileTestBase.cs">
<Link>Tests\FileTestBase.cs</Link>
</Compile>
<Compile Include="..\ImageSharp.Tests\Formats\Jpg\BadEofJpegTests.cs">
<Link>Tests\Formats\Jpg\BadEofJpegTests.cs</Link>
</Compile>
<Compile Include="..\ImageSharp.Tests\Formats\Jpg\Block8x8FTests.cs">
<Link>Tests\Formats\Jpg\Block8x8FTests.cs</Link>
</Compile>

14
tests/ImageSharp.Tests/FileTestBase.cs

@ -21,13 +21,13 @@ namespace ImageSharp.Tests
// TestFile.Create(TestImages.Png.P1), // Perf: Enable for local testing only
// TestFile.Create(TestImages.Png.Pd), // Perf: Enable for local testing only
// TestFile.Create(TestImages.Jpeg.Floorplan), // Perf: Enable for local testing only
TestFile.Create(TestImages.Jpeg.Calliphora),
// TestFile.Create(TestImages.Jpeg.Ycck), // Perf: Enable for local testing only
// TestFile.Create(TestImages.Jpeg.Cmyk), // Perf: Enable for local testing only
TestFile.Create(TestImages.Jpeg.Turtle),
// TestFile.Create(TestImages.Jpeg.Fb), // Perf: Enable for local testing only
// TestFile.Create(TestImages.Jpeg.Progress), // Perf: Enable for local testing only
// TestFile.Create(TestImages.Jpeg.GammaDalaiLamaGray), // Perf: Enable for local testing only
TestFile.Create(TestImages.Jpeg.Baseline.Calliphora),
// TestFile.Create(TestImages.Jpeg.Baseline.Ycck), // Perf: Enable for local testing only
// TestFile.Create(TestImages.Jpeg.Baseline.Cmyk), // Perf: Enable for local testing only
TestFile.Create(TestImages.Jpeg.Baseline.Turtle),
// TestFile.Create(TestImages.Jpeg.Progressive.Fb), // Perf: Enable for local testing only
// TestFile.Create(TestImages.Jpeg.Progressive.Progress), // Perf: Enable for local testing only
// TestFile.Create(TestImages.Jpeg.Baseline.GammaDalaiLamaGray), // Perf: Enable for local testing only
TestFile.Create(TestImages.Bmp.Car),
// TestFile.Create(TestImages.Bmp.Neg_height), // Perf: Enable for local testing only
// TestFile.Create(TestImages.Png.Blur), // Perf: Enable for local testing only

6
tests/ImageSharp.Tests/Formats/Jpg/BadEofJpegTests.cs

@ -27,9 +27,9 @@ namespace ImageSharp.Tests
}
[Theory]
[WithFile(TestImages.Jpeg.BadEOF, PixelTypes.Color)]
[WithFile(TestImages.Jpeg.Progress, PixelTypes.Color)]
public void LoadImage<TColor>(TestImageProvider<TColor> provider)
[WithFile(TestImages.Jpeg.Baseline.Bad.MissingEOF, PixelTypes.Color)]
[WithFile(TestImages.Jpeg.Progressive.Progress, PixelTypes.Color)]
public void LoadBaselineImage<TColor>(TestImageProvider<TColor> provider)
where TColor : struct, IPackedPixel, IEquatable<TColor>
{
var image = provider.GetImage();

28
tests/ImageSharp.Tests/Formats/Jpg/JpegTests.cs

@ -27,10 +27,10 @@ namespace ImageSharp.Tests
}
[Theory]
[WithFile(TestImages.Jpeg.Snake, PixelTypes.StandardImageClass, 75, JpegSubsample.Ratio420)]
[WithFile(TestImages.Jpeg.Lake, PixelTypes.StandardImageClass, 75, JpegSubsample.Ratio420)]
[WithFile(TestImages.Jpeg.Snake, PixelTypes.StandardImageClass, 75, JpegSubsample.Ratio444)]
[WithFile(TestImages.Jpeg.Lake, PixelTypes.StandardImageClass, 75, JpegSubsample.Ratio444)]
[WithFile(TestImages.Jpeg.Baseline.Snake, PixelTypes.StandardImageClass, 75, JpegSubsample.Ratio420)]
[WithFile(TestImages.Jpeg.Baseline.Lake, PixelTypes.StandardImageClass, 75, JpegSubsample.Ratio420)]
[WithFile(TestImages.Jpeg.Baseline.Snake, PixelTypes.StandardImageClass, 75, JpegSubsample.Ratio444)]
[WithFile(TestImages.Jpeg.Baseline.Lake, PixelTypes.StandardImageClass, 75, JpegSubsample.Ratio444)]
public void LoadResizeSave<TColor>(TestImageProvider<TColor> provider, int quality, JpegSubsample subsample)
where TColor : struct, IPackedPixel, IEquatable<TColor>
{
@ -58,7 +58,7 @@ namespace ImageSharp.Tests
public void Encoder_Benchmark(int executionCount, int quality, JpegSubsample subsample)
{
string[] testFiles = TestImages.Bmp.All
.Concat(new[] { TestImages.Jpeg.Calliphora, TestImages.Jpeg.Cmyk })
.Concat(new[] { TestImages.Jpeg.Baseline.Calliphora, TestImages.Jpeg.Baseline.Cmyk })
.ToArray();
Image<Color>[] testImages =
@ -84,7 +84,7 @@ namespace ImageSharp.Tests
}
}
public static IEnumerable<string> AllJpegFiles => TestImages.Jpeg.All;
public static IEnumerable<string> AllJpegFiles => TestImages.Jpeg.Baseline.All;
[Theory]
[WithFileCollection(nameof(AllJpegFiles), PixelTypes.Color | PixelTypes.StandardImageClass | PixelTypes.Argb)]
@ -128,19 +128,19 @@ namespace ImageSharp.Tests
{
TestImages.Bmp.Car, TestImages.Bmp.NegHeight,
TestImages.Bmp.F, TestImages.Png.Splash,
TestImages.Jpeg.Jpeg420, TestImages.Jpeg.Calliphora,
TestImages.Jpeg.Cmyk
TestImages.Jpeg.Baseline.Jpeg420, TestImages.Jpeg.Baseline.Calliphora,
TestImages.Jpeg.Baseline.Cmyk
};
private const PixelTypes BenchmarkPixels = PixelTypes.StandardImageClass; //PixelTypes.Color | PixelTypes.Argb;
//[Theory] // Benchmark, enable manually
[InlineData(TestImages.Jpeg.Cmyk)]
[InlineData(TestImages.Jpeg.Ycck)]
[InlineData(TestImages.Jpeg.Calliphora)]
[InlineData(TestImages.Jpeg.Jpeg400)]
[InlineData(TestImages.Jpeg.Jpeg420)]
[InlineData(TestImages.Jpeg.Jpeg444)]
[InlineData(TestImages.Jpeg.Baseline.Cmyk)]
[InlineData(TestImages.Jpeg.Baseline.Ycck)]
[InlineData(TestImages.Jpeg.Baseline.Calliphora)]
[InlineData(TestImages.Jpeg.Baseline.Jpeg400)]
[InlineData(TestImages.Jpeg.Baseline.Jpeg420)]
[InlineData(TestImages.Jpeg.Baseline.Jpeg444)]
public void Benchmark_JpegDecoder(string fileName)
{
string path = TestFile.GetPath(fileName);

8
tests/ImageSharp.Tests/Profiles/Exif/ExifProfileTests.cs

@ -17,7 +17,7 @@ namespace ImageSharp.Tests
[Fact]
public void Constructor()
{
Image image = TestFile.Create(TestImages.Jpeg.Calliphora).CreateImage();
Image image = TestFile.Create(TestImages.Jpeg.Baseline.Calliphora).CreateImage();
Assert.Null(image.ExifProfile);
@ -104,7 +104,7 @@ namespace ImageSharp.Tests
[Fact]
public void ReadWriteInfinity()
{
Image image = TestFile.Create(TestImages.Jpeg.Floorplan).CreateImage();
Image image = TestFile.Create(TestImages.Jpeg.Baseline.Floorplan).CreateImage();
image.ExifProfile.SetValue(ExifTag.ExposureBiasValue, new SignedRational(double.PositiveInfinity));
image = WriteAndRead(image);
@ -132,7 +132,7 @@ namespace ImageSharp.Tests
{
Rational[] latitude = new Rational[] { new Rational(12.3), new Rational(4.56), new Rational(789.0) };
Image image = TestFile.Create(TestImages.Jpeg.Floorplan).CreateImage();
Image image = TestFile.Create(TestImages.Jpeg.Baseline.Floorplan).CreateImage();
image.ExifProfile.SetValue(ExifTag.Software, "ImageSharp");
ExifValue value = image.ExifProfile.GetValue(ExifTag.Software);
@ -234,7 +234,7 @@ namespace ImageSharp.Tests
private static ExifProfile GetExifProfile()
{
Image image = TestFile.Create(TestImages.Jpeg.Floorplan).CreateImage();
Image image = TestFile.Create(TestImages.Jpeg.Baseline.Floorplan).CreateImage();
ExifProfile profile = image.ExifProfile;
Assert.NotNull(profile);

2
tests/ImageSharp.Tests/Profiles/Exif/ExifValueTests.cs

@ -12,7 +12,7 @@ namespace ImageSharp.Tests
{
private static ExifValue GetExifValue()
{
Image image = TestFile.Create(TestImages.Jpeg.Floorplan).CreateImage();
Image image = TestFile.Create(TestImages.Jpeg.Baseline.Floorplan).CreateImage();
ExifProfile profile = image.ExifProfile;
Assert.NotNull(profile);

83
tests/ImageSharp.Tests/TestImages.cs

@ -3,12 +3,14 @@
// Licensed under the Apache License, Version 2.0.
// </copyright>
// ReSharper disable MemberHidesStaticFromOuterClass
namespace ImageSharp.Tests
{
using System.IO;
using System.Linq;
/// <summary>
/// Class that contains all the test images.
/// Class that contains all the relative test image paths in the TestImages/Formats directory.
/// Use with <see cref="WithFileAttribute"/>, <see cref="WithFileCollectionAttribute"/> or <see cref="FileTestBase"/>.
/// </summary>
public static class TestImages
{
@ -20,9 +22,7 @@ namespace ImageSharp.Tests
public const string Indexed = "Png/indexed.png";
public const string Splash = "Png/splash.png";
public const string Powerpoint = "Png/pp.png";
public const string SplashInterlaced = "Png/splash-interlaced.png";
public const string Interlaced = "Png/interlaced.png";
// filtered test images from http://www.schaik.com/pngsuite/pngsuite_fil_png.html
@ -38,53 +38,60 @@ namespace ImageSharp.Tests
public static class Jpeg
{
public const string Cmyk = "Jpg/cmyk.jpg";
public const string Exif = "Jpg/exif.jpg";
public const string Floorplan = "Jpg/Floorplan.jpg";
public const string Calliphora = "Jpg/Calliphora.jpg";
public const string Ycck = "Jpg/ycck.jpg";
public const string Turtle = "Jpg/turtle.jpg";
public const string Fb = "Jpg/fb.jpg";
public const string Progress ="Jpg/progress.jpg";
public const string GammaDalaiLamaGray = "Jpg/gamma_dalai_lama_gray.jpg";
public const string Festzug = "Jpg/Festzug.jpg";
public const string Hiyamugi = "Jpg/Hiyamugi.jpg";
public const string BadEOF = "Jpg/badeof.jpg";
public const string Snake = "Jpg/Snake.jpg";
public const string Lake = "Jpg/Lake.jpg";
public const string Jpeg400 = "Jpg/baseline/jpeg400jfif.jpg";
public const string Jpeg420 = "Jpg/baseline/jpeg420exif.jpg";
public const string Jpeg422 = "Jpg/baseline/jpeg422jfif.jpg";
public const string Jpeg444 = "Jpg/baseline/jpeg444.jpg";
public static readonly string[] All = {
Cmyk, Ycck, Exif, Floorplan, Calliphora, Turtle, Fb, Progress, GammaDalaiLamaGray,
Festzug, Hiyamugi,
Jpeg400, Jpeg420, Jpeg444,
};
public static class Progressive
{
public const string Fb = "Jpg/progressive/fb.jpg";
public const string Progress = "Jpg/progressive/progress.jpg";
public const string Festzug = "Jpg/progressive/Festzug.jpg";
public static readonly string[] All = { Fb, Progress, Festzug };
}
public static class Baseline
{
public static class Bad
{
public const string MissingEOF = "Jpg/baseline/badeof.jpg";
}
public const string Cmyk = "Jpg/baseline/cmyk.jpg";
public const string Exif = "Jpg/baseline/exif.jpg";
public const string Floorplan = "Jpg/baseline/Floorplan.jpg";
public const string Calliphora = "Jpg/baseline/Calliphora.jpg";
public const string Ycck = "Jpg/baseline/ycck.jpg";
public const string Turtle = "Jpg/baseline/turtle.jpg";
public const string GammaDalaiLamaGray = "Jpg/baseline/gamma_dalai_lama_gray.jpg";
public const string Hiyamugi = "Jpg/baseline/Hiyamugi.jpg";
public const string Snake = "Jpg/baseline/Snake.jpg";
public const string Lake = "Jpg/baseline/Lake.jpg";
public const string Jpeg400 = "Jpg/baseline/jpeg400jfif.jpg";
public const string Jpeg420 = "Jpg/baseline/jpeg420exif.jpg";
public const string Jpeg422 = "Jpg/baseline/jpeg422jfif.jpg";
public const string Jpeg444 = "Jpg/baseline/jpeg444.jpg";
public static readonly string[] All =
{
Cmyk, Ycck, Exif, Floorplan,
Calliphora, Turtle, GammaDalaiLamaGray,
Hiyamugi, Jpeg400, Jpeg420, Jpeg444,
};
}
public static readonly string[] All = Baseline.All.Concat(Progressive.All).ToArray();
}
public static class Bmp
{
public const string Car = "Bmp/Car.bmp";
public const string F = "Bmp/F.bmp";
public const string NegHeight = "Bmp/neg_height.bmp";
public static readonly string[] All = {
Car, F, NegHeight
};
public static readonly string[] All = { Car, F, NegHeight };
}
public static class Gif
{
public const string Rings = "Gif/rings.gif";
public const string Giphy = "Gif/giphy.gif";
public const string Cheers = "Gif/cheers.gif";
}
}

0
tests/ImageSharp.Tests/TestImages/Formats/Jpg/Calliphora.jpg → tests/ImageSharp.Tests/TestImages/Formats/Jpg/baseline/Calliphora.jpg

0
tests/ImageSharp.Tests/TestImages/Formats/Jpg/Floorplan.jpg → tests/ImageSharp.Tests/TestImages/Formats/Jpg/baseline/Floorplan.jpg

0
tests/ImageSharp.Tests/TestImages/Formats/Jpg/Hiyamugi.jpg → tests/ImageSharp.Tests/TestImages/Formats/Jpg/baseline/Hiyamugi.jpg

0
tests/ImageSharp.Tests/TestImages/Formats/Jpg/Lake.jpg → tests/ImageSharp.Tests/TestImages/Formats/Jpg/baseline/Lake.jpg

0
tests/ImageSharp.Tests/TestImages/Formats/Jpg/Snake.jpg → tests/ImageSharp.Tests/TestImages/Formats/Jpg/baseline/Snake.jpg

0
tests/ImageSharp.Tests/TestImages/Formats/Jpg/badeof.jpg → tests/ImageSharp.Tests/TestImages/Formats/Jpg/baseline/badeof.jpg

0
tests/ImageSharp.Tests/TestImages/Formats/Jpg/cmyk.jpg → tests/ImageSharp.Tests/TestImages/Formats/Jpg/baseline/cmyk.jpg

0
tests/ImageSharp.Tests/TestImages/Formats/Jpg/exif.jpg → tests/ImageSharp.Tests/TestImages/Formats/Jpg/baseline/exif.jpg

0
tests/ImageSharp.Tests/TestImages/Formats/Jpg/gamma_dalai_lama_gray.jpg → tests/ImageSharp.Tests/TestImages/Formats/Jpg/baseline/gamma_dalai_lama_gray.jpg

0
tests/ImageSharp.Tests/TestImages/Formats/Jpg/testimgint.jpg → tests/ImageSharp.Tests/TestImages/Formats/Jpg/baseline/testimgint.jpg

0
tests/ImageSharp.Tests/TestImages/Formats/Jpg/testorig.jpg → tests/ImageSharp.Tests/TestImages/Formats/Jpg/baseline/testorig.jpg

0
tests/ImageSharp.Tests/TestImages/Formats/Jpg/turtle.jpg → tests/ImageSharp.Tests/TestImages/Formats/Jpg/baseline/turtle.jpg

0
tests/ImageSharp.Tests/TestImages/Formats/Jpg/ycck.jpg → tests/ImageSharp.Tests/TestImages/Formats/Jpg/baseline/ycck.jpg

0
tests/ImageSharp.Tests/TestImages/Formats/Jpg/Festzug.jpg → tests/ImageSharp.Tests/TestImages/Formats/Jpg/progressive/Festzug.jpg

0
tests/ImageSharp.Tests/TestImages/Formats/Jpg/fb.jpg → tests/ImageSharp.Tests/TestImages/Formats/Jpg/progressive/fb.jpg

0
tests/ImageSharp.Tests/TestImages/Formats/Jpg/progress.jpg → tests/ImageSharp.Tests/TestImages/Formats/Jpg/progressive/progress.jpg

Loading…
Cancel
Save