Exemple #1
0
        public void ShouldThrowExceptionWhenTableCouldNotBeFound()
        {
            var writer = new BinaryWriter();

            writer.WriteTrueTypeFileHeader();

            using (System.IO.MemoryStream stream = writer.GetStream())
            {
                InvalidFontTableException exception = Assert.Throws <InvalidFontTableException>(() => NameTable.Load(new FontReader(stream)));

                Assert.Equal("name", exception.Table);
            }
        }
Exemple #2
0
        public void ShouldThrowExceptionWhenTableCouldNotBeFound()
        {
            var writer = new BigEndianBinaryWriter();

            writer.WriteTrueTypeFileHeader();

            using (MemoryStream stream = writer.GetStream())
            {
                InvalidFontTableException exception = Assert.Throws <InvalidFontTableException>(
                    () => MaximumProfileTable.Load(new FontReader(stream)));

                Assert.Equal("maxp", exception.Table);
            }
        }
Exemple #3
0
        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 (System.IO.MemoryStream stream = writer.GetStream())
            {
                InvalidFontTableException exception = Assert.Throws <InvalidFontTableException>(() =>
                {
                    IndexLocationTable.Load(new FontReader(stream));
                });

                Assert.Equal("maxp", exception.Table);
            }
        }