// Helper Methods public async Task AssertReadsImageData(TiffIfd ifd, Stream stream, byte[] imageData, Color[][] expectedResult) { int width = expectedResult[0].Length; int height = expectedResult.Length; var decoder = await TiffImageReader.GetImageDecoderAsync(ifd, stream, ByteOrder.LittleEndian); Image <Rgb888> imageRgb = new Image <Rgb888>(width, height); using (var pixels = imageRgb.Lock()) { decoder(imageData, pixels, new Rectangle(0, 0, width, height)); } Image <Color> image = imageRgb.To <Color>(); using (var pixels = image.Lock()) { for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { Assert.Equal(expectedResult[y][x], pixels[x, y]); } } } }
public void SupportsPhotometricInterpretation_ReturnsCorrectValue(TiffPhotometricInterpretation photometricInterpretation, bool expectedResult) { var supported = TiffImageReader.SupportsPhotometricInterpretation(photometricInterpretation); Assert.Equal(expectedResult, supported); }