Exemple #1
0
        public void ReadLogfontGeorgia()
        {
            // Well formed data with
            byte[] streamData =
            {
                14,    0,   0,   0,  0,   0,   0,   0,   0,   0,
                0,     0,   0,   0,  0,   0, 188,   2,   0,   0,
                0,     0,   1,   0,  3,   2,   1,  18,  71, 101,
                111, 114, 103, 105, 97,   0,  32,  71, 111, 116,
                104, 105,  99,  32, 77, 101, 100, 105, 117, 109,
                0,     0,   0,   0,  0, 0
            };

            WangStream  stream = new WangStream(streamData);
            WangLogFont read   = WangAnnotationStructureReader.ReadLogfont(stream);

            Assert.IsTrue(read != null);

            Assert.AreEqual(14, read.Height);
            Assert.AreEqual(0, read.Width);
            Assert.AreEqual(0, read.Escapement);
            Assert.AreEqual(0, read.Orientation);
            Assert.AreEqual(700, read.Weight);
            Assert.AreEqual(false, read.Italic);
            Assert.AreEqual(false, read.Underline);
            Assert.AreEqual(true, read.StrikeOut);
            Assert.AreEqual(0, read.CharSet);
            Assert.AreEqual(3, read.OutPrecision);
            Assert.AreEqual(2, read.ClipPrecision);
            Assert.AreEqual(1, read.Quality);
            Assert.AreEqual(18, read.PitchAndFamily);
            Assert.AreEqual("Georgia", read.FaceName);
        }
Exemple #2
0
        public void ReadLogfontZeroSignificant()
        {
            // Well formed data with. Zero significant data and trailing stuff
            byte[] streamData =
            {
                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, 223,
                10, 0, 219, 49, 145, 124, 247, 49, 145, 124,
                8,  6,  12,  0, 136,   0, 126,  0,   0,   0,
                0,  0,   0,  0,   0, 0
            };

            WangStream  stream = new WangStream(streamData);
            WangLogFont read   = WangAnnotationStructureReader.ReadLogfont(stream);

            Assert.IsTrue(read != null);

            Assert.AreEqual(0, read.Height);
            Assert.AreEqual(0, read.Width);
            Assert.AreEqual(0, read.Escapement);
            Assert.AreEqual(0, read.Orientation);
            Assert.AreEqual(0, read.Weight);
            Assert.AreEqual(false, read.Italic);
            Assert.AreEqual(false, read.Underline);
            Assert.AreEqual(false, read.StrikeOut);
            Assert.AreEqual(0, read.CharSet);
            Assert.AreEqual(0, read.OutPrecision);
            Assert.AreEqual(0, read.ClipPrecision);
            Assert.AreEqual(0, read.Quality);
            Assert.AreEqual(0, read.PitchAndFamily);
            Assert.AreEqual("", read.FaceName);
        }
Exemple #3
0
        public void ReadLogfontArialUnderline()
        {
            // Well formed data with
            byte[] streamData =
            {
                12,   0,   0, 0, 0, 0,   0, 0,  0,   0,
                0,    0,   0, 0, 0, 0, 144, 1,  0,   0,
                0,    1,   0, 0, 0, 0,   0, 0, 65, 114,
                105, 97, 108, 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);
            WangLogFont read   = WangAnnotationStructureReader.ReadLogfont(stream);

            Assert.IsTrue(read != null);

            Assert.AreEqual(12, read.Height);
            Assert.AreEqual(0, read.Width);
            Assert.AreEqual(0, read.Escapement);
            Assert.AreEqual(0, read.Orientation);
            Assert.AreEqual(400, read.Weight);
            Assert.AreEqual(false, read.Italic);
            Assert.AreEqual(true, read.Underline);
            Assert.AreEqual(false, read.StrikeOut);
            Assert.AreEqual(0, read.CharSet);
            Assert.AreEqual(0, read.OutPrecision);
            Assert.AreEqual(0, read.ClipPrecision);
            Assert.AreEqual(0, read.Quality);
            Assert.AreEqual(0, read.PitchAndFamily);
            Assert.AreEqual("Arial", read.FaceName);
        }
Exemple #4
0
        public void ReadLogfontZero()
        {
            // Well formed data (only 0s)
            byte[] streamData = new byte[56];

            WangStream  stream = new WangStream(streamData);
            WangLogFont read   = WangAnnotationStructureReader.ReadLogfont(stream);

            Assert.IsTrue(read != null);

            Assert.AreEqual(0, read.Height);
            Assert.AreEqual(0, read.Width);
            Assert.AreEqual(0, read.Escapement);
            Assert.AreEqual(0, read.Orientation);
            Assert.AreEqual(0, read.Weight);
            Assert.AreEqual(false, read.Italic);
            Assert.AreEqual(false, read.Underline);
            Assert.AreEqual(false, read.StrikeOut);
            Assert.AreEqual(0, read.CharSet);
            Assert.AreEqual(0, read.OutPrecision);
            Assert.AreEqual(0, read.ClipPrecision);
            Assert.AreEqual(0, read.Quality);
            Assert.AreEqual(0, read.PitchAndFamily);
            Assert.AreEqual("", read.FaceName);
        }
Exemple #5
0
 public void ReadLogfontReadFailure()
 {
     for (int dataSize = 0; dataSize < 56; dataSize++)
     {
         byte[]     streamData = new byte[dataSize];
         WangStream stream     = new WangStream(streamData);
         Assert.AreEqual(null, WangAnnotationStructureReader.ReadLogfont(stream));
     }
 }