public void LoadTest078()
        {
            string file = Path.Combine(Util.ArtifactsPath, "test078C.djvu");

            using (DjvuDocument document = new DjvuDocument())
            {
                int hash = file.GetHashCode();
                document.Load(file, hash);
                Assert.Equal(hash, document.Identifier);
                IDjvuPage page = document.ActivePage;

                PM44Chunk pmChunk = page.PageForm.Children[0] as PM44Chunk;
                Assert.IsType <PM44Chunk>(pmChunk);

                var img = pmChunk.Image;
                Assert.NotNull(img);

                var pixMap = new Wavelet.InterWavePixelMapDecoder();
                pixMap = pmChunk.ProgressiveDecodeBackground(pixMap) as Wavelet.InterWavePixelMapDecoder;
                Assert.NotNull(pixMap);

                pmChunk = page.PageForm.Children[1] as PM44Chunk;
                Assert.NotNull(pmChunk);

                var pixMap2 = new Wavelet.InterWavePixelMapDecoder();
                Assert.Throws <DjvuFormatException>(() => pmChunk.ProgressiveDecodeBackground(pixMap2));

                // This time call will not throw
                pmChunk.ProgressiveDecodeBackground(pixMap);
            }
        }
Beispiel #2
0
        public void ProgressiveDecodeBackgroundTest()
        {
            string file = Path.Combine(Util.ArtifactsDataPath, "test001C_P01.fg44");

            using (FileStream stream = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read))
                using (DjvuReader reader = new DjvuReader(stream))
                {
                    PM44Chunk unk = new PM44Chunk(reader, null, null, null, reader.Length);
                    Assert.Equal <ChunkType>(ChunkType.PM44, unk.ChunkType);
                    Assert.Equal(ChunkType.PM44.ToString(), unk.Name);
                    Assert.Equal <long>(0, unk.DataOffset);
                    Assert.Equal <long>(reader.Length, unk.Length);

                    var map = new InterWavePixelMapDecoder();
                    IInterWavePixelMap result = unk.ProgressiveDecodeBackground(map);
                    Assert.NotNull(map);
                }
        }