public virtual void GifImageFrameOutOfBoundsTest() { NUnit.Framework.Assert.That(() => { ImageDataFactory.CreateGifFrame(UrlUtil.ToURL(sourceFolder + "image-2frames.gif"), 3); } , NUnit.Framework.Throws.InstanceOf <iText.IO.IOException>().With.Message.EqualTo(MessageFormatUtil.Format(iText.IO.IOException.CannotFind1Frame, 2))) ; }
public virtual void GifImageSpecificFrameTest() { String imageFilePath = sourceFolder + "image-2frames.gif"; using (FileStream file = new FileStream(imageFilePath, FileMode.Open, FileAccess.Read)) { byte[] fileContent = StreamUtil.InputStreamToArray(file); ImageData img = ImageDataFactory.CreateGifFrame(fileContent, 2); NUnit.Framework.Assert.AreEqual(100, (int)img.GetWidth()); NUnit.Framework.Assert.AreEqual(100, (int)img.GetHeight()); ImageData imgFromUrl = ImageDataFactory.CreateGifFrame(UrlUtil.ToURL(imageFilePath), 2); NUnit.Framework.Assert.AreEqual(img.GetData(), imgFromUrl.GetData()); } }