public void ShouldReturnNullWhenTableCouldNotBeFound() { var writer = new BigEndianBinaryWriter(); writer.WriteTrueTypeFileHeader(); using MemoryStream stream = writer.GetStream(); Assert.Null(VerticalHeadTable.Load(new FontReader(stream))); }
public void ShouldReturnDefaultValueWhenTableCouldNotBeFound() { var writer = new BigEndianBinaryWriter(); writer.WriteTrueTypeFileHeader(); using (System.IO.MemoryStream stream = writer.GetStream()) { var table = KerningTable.Load(new FontReader(stream)); Assert.NotNull(table); } }
public void ShouldThrowExceptionWhenTableCouldNotBeFound() { var writer = new BigEndianBinaryWriter(); writer.WriteTrueTypeFileHeader(); using (System.IO.MemoryStream stream = writer.GetStream()) { InvalidFontTableException exception = Assert.Throws <InvalidFontTableException>(() => CMapTable.Load(new FontReader(stream))); Assert.Equal("cmap", exception.Table); } }
public void ShouldReturnNullWhenTableCouldNotBeFound() { var writer = new BigEndianBinaryWriter(); 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 (System.IO.MemoryStream stream = writer.GetStream()) { Assert.Null(IndexLocationTable.Load(new FontReader(stream))); } }
public void ShouldThrowExceptionWhenMaximumProfileTableCouldNotBeFound() { var writer = new BigEndianBinaryWriter(); 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 (System.IO.MemoryStream stream = writer.GetStream()) { InvalidFontTableException exception = Assert.Throws <InvalidFontTableException>( () => IndexLocationTable.Load(new FontReader(stream))); Assert.Equal("maxp", exception.Table); } }