예제 #1
0
        public void DecompressStreamAsync_ThrowsException_WithUnsupportedCompression(TiffCompression compression)
        {
            var stream = new StreamBuilder(ByteOrder.LittleEndian).ToStream();

            var e = Assert.Throws <NotSupportedException>(() => { TiffDecompressor.DecompressStreamAsync(stream, compression, 100, 100); });

            Assert.Equal($"The compression format '{compression}' is not supported.", e.Message);
        }
예제 #2
0
                    new byte[] { 0xAA, 0xAA, 0xAA, 0x80, 0x00, 0x2A, 0xAA, 0xAA, 0xAA, 0xAA, 0x80, 0x00, 0x2A, 0x22, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA })] // Apple PackBits sample
        public async Task DecompressStreamAsync_DecompressData_PackBits(byte[] compressedData, byte[] uncompressedData)
        {
            var stream = new StreamBuilder(ByteOrder.LittleEndian)
                         .WriteBytes(compressedData)
                         .ToStream();

            var data = await TiffDecompressor.DecompressStreamAsync(stream, TiffCompression.PackBits, compressedData.Length, uncompressedData.Length);

            Assert.Equal(uncompressedData, data);
        }
예제 #3
0
        public async Task DecompressStreamAsync_DecompressData_NoCompression()
        {
            var stream = new StreamBuilder(ByteOrder.LittleEndian)
                         .WriteBytes(new byte[] { 10, 20, 30, 40, 50, 40, 30, 20, 10, 20, 40, 60, 80 })
                         .ToStream();

            var data = await TiffDecompressor.DecompressStreamAsync(stream, TiffCompression.None, 11, 11);

            Assert.Equal(new byte[] { 10, 20, 30, 40, 50, 40, 30, 20, 10, 20, 40 }, data);
        }