Browse Source

Test pixel array is not reversed. #282

Former-commit-id: a5ca9ed2bb9b811dce1b53dbb7477264f6fcbef0
Former-commit-id: 27e7100347220ad5c7b943263cad5edd18957ad2
Former-commit-id: 861f55171351ecb0fa2c4f4d42e287291022214a
pull/1/head
James Jackson-South 10 years ago
parent
commit
f4c5bfe2b9
  1. 36
      tests/ImageProcessorCore.Tests/Processors/Formats/EncoderDecoderTests.cs

36
tests/ImageProcessorCore.Tests/Processors/Formats/EncoderDecoderTests.cs

@ -6,7 +6,7 @@
using Formats;
using Xunit;
using System.Linq;
public class EncoderDecoderTests : ProcessorTestBase
{
[Fact]
@ -101,5 +101,39 @@
}
}
}
[Fact]
public void ImageShouldPreservePixelByteOrderWhenSerialized()
{
if (!Directory.Exists("TestOutput/Serialized"))
{
Directory.CreateDirectory("TestOutput/Serialized");
}
foreach (string file in Files)
{
using (FileStream stream = File.OpenRead(file))
{
Image image = new Image(stream);
byte[] serialized;
using (MemoryStream memoryStream = new MemoryStream())
{
image.Save(memoryStream);
memoryStream.Flush();
serialized = memoryStream.ToArray();
}
using (MemoryStream memoryStream = new MemoryStream(serialized))
{
Image image2 = new Image(memoryStream);
using (FileStream output = File.OpenWrite($"TestOutput/Serialized/{Path.GetFileName(file)}"))
{
image2.Save(output);
}
}
}
}
}
}
}
Loading…
Cancel
Save