public void ShouldThrowExceptionWhenHeadTableCouldNotBeFound() { var writer = new BinaryWriter(); writer.WriteTrueTypeFileHeader(); using (var stream = writer.GetStream()) { var exception = Assert.Throws <InvalidFontTableException>(() => IndexLocationTable.Load(new FontReader(stream))); Assert.Equal("head", exception.Table); } }
public void ShouldThrowExceptionWhenHeadTableCouldNotBeFound() { var writer = new BigEndianBinaryWriter(); writer.WriteTrueTypeFileHeader(); using (System.IO.MemoryStream stream = writer.GetStream()) { MissingFontTableException exception = Assert.Throws <MissingFontTableException>( () => IndexLocationTable.Load(new FontReader(stream))); Assert.Equal("head", exception.Table); } }
public void ShouldReturnNullWhenTableCouldNotBeFound() { var writer = new BinaryWriter(); writer.WriteTrueTypeFileHeader(new TableHeader("head", 0, 0, 0), new TableHeader("maxp", 0, 0, 0)); writer.WriteHeadTable(new HeadTable(HeadTable.HeadFlags.None, HeadTable.HeadMacStyle.Italic | HeadTable.HeadMacStyle.Bold, 1024, new DateTime(2017, 02, 06, 07, 47, 00), new DateTime(2017, 02, 07, 07, 47, 00), new Bounds(0, 0, 1024, 1022), 0, HeadTable.IndexLocationFormats.Offset16)); using (var stream = writer.GetStream()) { Assert.Null(IndexLocationTable.Load(new FontReader(stream))); } }
public void ShouldThrowExceptionWhenMaximumProfileTableCouldNotBeFound() { var writer = new BinaryWriter(); writer.WriteTrueTypeFileHeader(new TableHeader("head", 0, 0, 0)); writer.WriteHeadTable(new HeadTable(HeadTable.HeadFlags.None, HeadTable.HeadMacStyle.Italic | HeadTable.HeadMacStyle.Bold, 1024, new DateTime(2017, 02, 06, 07, 47, 00), new DateTime(2017, 02, 07, 07, 47, 00), new Bounds(0, 0, 1024, 1022), 0, HeadTable.IndexLocationFormats.Offset16)); using (var stream = writer.GetStream()) { var exception = Assert.Throws <InvalidFontTableException>(() => IndexLocationTable.Load(new FontReader(stream))); Assert.Equal("maxp", exception.Table); } }