public void ReadMarkAttributes1() { // Well formed data byte[] streamData = { 10, 0, 0, 0, 229, 1, 0, 0, 202, 0, 0, 0, 233, 3, 0, 0, 155, 2, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 144, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, 114, 105, 97, 108, 0, 145, 124, 247, 49, 145, 124, 8, 6, 12, 0, 136, 0, 126, 0, 0, 0, 0, 0, 0, 0, 0, 0, 44, 224, 10, 0, 0, 0, 0, 0, 68, 3, 51, 88, 1, 0, 0, 0, 63, 248, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; WangStream stream = new WangStream(streamData); WangMarkAttributes read = WangAnnotationStructureReader.ReadMarkAttributes(stream, 164); Assert.IsTrue(read != null); Assert.AreEqual(12, read.LogFont.Height); Assert.AreEqual(0, read.LogFont.Width); Assert.AreEqual(0, read.LogFont.Escapement); Assert.AreEqual(0, read.LogFont.Orientation); Assert.AreEqual(400, read.LogFont.Weight); Assert.AreEqual(false, read.LogFont.Italic); Assert.AreEqual(false, read.LogFont.Underline); Assert.AreEqual(false, read.LogFont.StrikeOut); Assert.AreEqual(0, read.LogFont.CharSet); Assert.AreEqual(0, read.LogFont.OutPrecision); Assert.AreEqual(0, read.LogFont.ClipPrecision); Assert.AreEqual(0, read.LogFont.Quality); Assert.AreEqual(0, read.LogFont.PitchAndFamily); Assert.AreEqual("Arial", read.LogFont.FaceName); Assert.AreEqual(false, read.Highlighting); Assert.AreEqual(false, read.Transparent); Assert.AreEqual((uint)0, read.LineSize); Assert.AreEqual(true, read.Visible); Assert.AreEqual(485, read.Bounds[0]); Assert.AreEqual(202, read.Bounds[1]); Assert.AreEqual(1001, read.Bounds[2]); Assert.AreEqual(667, read.Bounds[3]); Assert.AreEqual(0, read.Color1[0]); Assert.AreEqual(255, read.Color1[1]); Assert.AreEqual(255, read.Color1[2]); Assert.AreEqual(0, read.Color2[0]); Assert.AreEqual(0, read.Color2[1]); Assert.AreEqual(0, read.Color2[2]); }
public void ReadMarkAttributes2() { // Well formed data byte[] streamData = { 15, 0, 0, 0, 64, 1, 0, 0, 68, 0, 0, 0, 156, 4, 0, 0, 16, 3, 0, 0, 192, 192, 192, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 252, 253, 54, 88, 1, 0, 0, 0, 63, 248, 15, 0, 88, 254, 54, 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; WangStream stream = new WangStream(streamData); WangMarkAttributes read = WangAnnotationStructureReader.ReadMarkAttributes(stream, 164); Assert.IsTrue(read != null); Assert.AreEqual(0, read.LogFont.Height); Assert.AreEqual(0, read.LogFont.Width); Assert.AreEqual(0, read.LogFont.Escapement); Assert.AreEqual(0, read.LogFont.Orientation); Assert.AreEqual(0, read.LogFont.Weight); Assert.AreEqual(false, read.LogFont.Italic); Assert.AreEqual(false, read.LogFont.Underline); Assert.AreEqual(false, read.LogFont.StrikeOut); Assert.AreEqual(0, read.LogFont.CharSet); Assert.AreEqual(0, read.LogFont.OutPrecision); Assert.AreEqual(0, read.LogFont.ClipPrecision); Assert.AreEqual(0, read.LogFont.Quality); Assert.AreEqual(0, read.LogFont.PitchAndFamily); Assert.AreEqual("", read.LogFont.FaceName); Assert.AreEqual(true, read.Highlighting); Assert.AreEqual(false, read.Transparent); Assert.AreEqual((uint)0, read.LineSize); Assert.AreEqual(true, read.Visible); Assert.AreEqual(320, read.Bounds[0]); Assert.AreEqual(68, read.Bounds[1]); Assert.AreEqual(1180, read.Bounds[2]); Assert.AreEqual(784, read.Bounds[3]); Assert.AreEqual(192, read.Color1[0]); Assert.AreEqual(192, read.Color1[1]); Assert.AreEqual(192, read.Color1[2]); Assert.AreEqual(0, read.Color2[0]); Assert.AreEqual(0, read.Color2[1]); Assert.AreEqual(0, read.Color2[2]); }
public void ReadMarkAttributesReadFailure() { for (int dataSize = 0; dataSize < 164; dataSize++) { byte[] streamData = new byte[dataSize]; WangStream stream = new WangStream(streamData); Assert.AreEqual(null, WangAnnotationStructureReader.ReadMarkAttributes(stream, dataSize)); } }