Browse Source

Update tests

pull/637/head
James Jackson-South 8 years ago
parent
commit
9a12d09d7a
  1. 2
      src/ImageSharp/Formats/Gif/GifEncoderCore.cs
  2. 26
      tests/ImageSharp.Tests/Formats/Gif/GifEncoderTests.cs
  3. 2
      tests/Images/External

2
src/ImageSharp/Formats/Gif/GifEncoderCore.cs

@ -350,7 +350,7 @@ namespace SixLabors.ImageSharp.Formats.Gif
localColorTableFlag: hasColorTable,
interfaceFlag: false,
sortFlag: false,
localColorTableSize: (byte)(this.bitDepth - 1)); // Note: we subtract 1 from the colorTableSize writing
localColorTableSize: (byte)this.bitDepth);
var descriptor = new GifImageDescriptor(
left: 0,

26
tests/ImageSharp.Tests/Formats/Gif/GifEncoderTests.cs

@ -117,5 +117,31 @@ namespace SixLabors.ImageSharp.Tests.Formats.Gif
}
}
}
[Theory]
[WithFile(TestImages.Gif.Cheers, PixelTypes.Rgba32)]
public void EncodeGlobalPaletteReturnsSmallerFile<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
using (Image<TPixel> image = provider.GetImage())
{
var encoder = new GifEncoder
{
ColorTableMode = GifColorTableMode.Global,
Quantizer = new OctreeQuantizer(false)
};
// Always save as we need to compare the encoded output.
provider.Utility.SaveTestOutputFile(image, "gif", encoder, "global");
encoder.ColorTableMode = GifColorTableMode.Local;
provider.Utility.SaveTestOutputFile(image, "gif", encoder, "local");
var fileInfoGlobal = new FileInfo(provider.Utility.GetTestOutputFileName("gif", "global"));
var fileInfoLocal = new FileInfo(provider.Utility.GetTestOutputFileName("gif", "local"));
Assert.True(fileInfoGlobal.Length < fileInfoLocal.Length);
}
}
}
}

2
tests/Images/External

@ -1 +1 @@
Subproject commit 6fcee2ccd5e8bac98a0290b467ad86bb02d00b6c
Subproject commit fa43e075a78d041c6fc7a52da96b23adf0e8775a
Loading…
Cancel
Save