private void ConstructorStreamTest(bool xmlDebugging) { MemoryStream s = CreateStream(); // Extra stuff not included in the frame stream, to pass to the // constructor. ColourTable colourTable = WikipediaExample.GlobalColourTable; GraphicControlExtension ext = WikipediaExample.GraphicControlExtension; LogicalScreenDescriptor lsd = WikipediaExample.LogicalScreenDescriptor; _frame = new GifFrame(s, lsd, colourTable, ext, null, null, xmlDebugging); Assert.AreEqual(ErrorState.Ok, _frame.ConsolidatedState); WikipediaExample.CheckImage(_frame.TheImage); WikipediaExample.CheckImageDescriptor(_frame.ImageDescriptor); WikipediaExample.CheckGraphicControlExtension(_frame.GraphicControlExtension); WikipediaExample.CheckImageData(_frame.IndexedPixels); Assert.AreEqual(0, _frame.BackgroundColour.R); Assert.AreEqual(0, _frame.BackgroundColour.G); Assert.AreEqual(0, _frame.BackgroundColour.B); if (xmlDebugging) { Assert.AreEqual(ExpectedDebugXml, _frame.DebugXml); } }
private void ConstructorStreamUseLocalTest(bool xmlDebugging) { _decoder = new GifDecoder(@"images\wikipedia example UseLocal.gif", xmlDebugging); _decoder.Decode(); _frame = _decoder.Frames[0]; Assert.AreEqual(ErrorState.Ok, _frame.ConsolidatedState); WikipediaExample.CheckImage(_frame.TheImage); // Check image descriptor ImageDescriptor id = _frame.ImageDescriptor; Assert.AreEqual(true, id.HasLocalColourTable, "HasLocalColourTable"); Assert.AreEqual(false, id.IsInterlaced, "IsInterlaced"); Assert.AreEqual(false, id.IsSorted, "LocalColourTableIsSorted"); Assert.AreEqual(4, id.LocalColourTableSize, "LocalColourTableSize"); Assert.AreEqual(new Point(0, 0), id.Position, "Position"); Assert.AreEqual(new Size(3, 5), id.Size, "Size"); WikipediaExample.CheckGraphicControlExtension(_frame.GraphicControlExtension); WikipediaExample.CheckImageData(_frame.IndexedPixels); Assert.AreEqual(0, _frame.BackgroundColour.R); Assert.AreEqual(0, _frame.BackgroundColour.G); Assert.AreEqual(0, _frame.BackgroundColour.B); if (xmlDebugging) { Assert.AreEqual(ExpectedDebugXml, _frame.DebugXml); } }