Example #1
0
        public void TestStore()
        {
            //      .fontheight      = c8
            //      .attributes      = 0
            //           .italic     = false
            //           .strikout   = false
            //           .macoutlined= false
            //           .macshadowed= false
            //      .colorpalette    = 7fff
            //      .boldweight      = 190
            //      .supersubscript  = 0
            //      .underline       = 0
            //      .family          = 0
            //      .charset         = 0
            //      .namelength      = 5
            //      .fontname        = Arial

            FontRecord record = new FontRecord();
            record.FontHeight = ((short)0xc8);
            record.Attributes=((short)0);
            record.ColorPaletteIndex=((short)0x7fff);
            record.BoldWeight=((short)0x190);
            record.SuperSubScript=((short)0);
            record.Underline=((byte)0);
            record.Family=((byte)0);
            record.Charset=((byte)0);
            record.FontName = ("Arial");

            byte[] recordBytes = record.Serialize();
            TestcaseRecordInputStream.ConfirmRecordEncoding(0x31, data, recordBytes);
        }
Example #2
0
        public void TestCloneOnto()
        {
            FontRecord base1 = new FontRecord(TestcaseRecordInputStream.Create(0x31, data));

            FontRecord other = new FontRecord();
            other.CloneStyleFrom(base1);

            byte[] recordBytes = other.Serialize();
            Assert.AreEqual(recordBytes.Length - 4, data.Length);
            for (int i = 0; i < data.Length; i++)
                Assert.AreEqual(data[i], recordBytes[i + 4], "At offset " + i);
        }
Example #3
0
        public void TestEmptyName_bug47250()
        {
            byte[] emptyNameData = HexRead.ReadFromString(
                    "C8 00 00 00 FF 7F 90 01 00 00 00 00 00 00 "
                    + "00" // zero length
                    + "00" // unicode options byte
                    );

            RecordInputStream in1 = TestcaseRecordInputStream.Create(SID, emptyNameData);
            FontRecord fr = new FontRecord(in1);
            if (in1.Available() == 1)
            {
                throw new AssertionException("Identified bug 47250");
            }
            Assert.AreEqual(0, in1.Available());

            Assert.AreEqual(0, fr.FontName.Length);
            byte[] recordBytes = fr.Serialize();
            TestcaseRecordInputStream.ConfirmRecordEncoding(SID, emptyNameData, recordBytes);
        }