Exemplo n.º 1
0
        public void DecodeBackwardCompatible_PartiallySet()
        {
            // Setup what we expect
            FontInfo expectedFontInfo = m_infoTable["TestStyle"].FontInfoForWs(-1);

            expectedFontInfo.m_fontName       = new InheritableStyleProp <string>("Algerian");
            expectedFontInfo.m_fontSize       = new InheritableStyleProp <int>(8000);
            expectedFontInfo.m_fontColor      = new InheritableStyleProp <Color>(Color.Red);
            expectedFontInfo.m_underline      = new InheritableStyleProp <FwUnderlineType>(FwUnderlineType.kuntNone);
            expectedFontInfo.m_underlineColor = new InheritableStyleProp <Color>(Color.Black);
            expectedFontInfo.m_superSub       = new InheritableStyleProp <FwSuperscriptVal>(FwSuperscriptVal.kssvOff);
            expectedFontInfo.m_offset         = new InheritableStyleProp <int>(0);

            // Here's the BLOB.
            // we got these values by looking at the memory when debugging Data Notebook.
            byte[] byteBlob = new byte[] { 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00,
                                           0x00, 0x00, 0x00, 0x06, 0x00, 0x40, 0x1f, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
                                           0x00, 0x00, 0x08, 0x00, 0xff, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00,
                                           0x00, 0x01, 0x00, 0x41, 0x00, 0x6c, 0x00, 0x67, 0x00, 0x65, 0x00, 0x72, 0x00,
                                           0x69, 0x00, 0x61, 0x00, 0x6e, 0x00, 0x00, 0x00 };
            string blob = new string(Encoding.Unicode.GetChars(byteBlob));

            BulletInfo bulletInfo = new BulletInfo();

            bulletInfo.EncodedFontInfo = blob;

            Assert.AreEqual(expectedFontInfo, bulletInfo.FontInfo);
        }
Exemplo n.º 2
0
        public void RoundTripEncodingAndDecodingOfFontInfo()
        {
            // Setup what we expect
            FontInfo expectedFontInfo = m_infoTable["TestStyle"].FontInfoForWs(-1);

            expectedFontInfo.m_fontName       = new InheritableStyleProp <string>("Algerian");
            expectedFontInfo.m_fontSize       = new InheritableStyleProp <int>(8000);
            expectedFontInfo.m_fontColor      = new InheritableStyleProp <Color>(Color.Red);
            expectedFontInfo.m_backColor      = new InheritableStyleProp <Color>(Color.White);
            expectedFontInfo.m_underline      = new InheritableStyleProp <FwUnderlineType>(FwUnderlineType.kuntNone);
            expectedFontInfo.m_underlineColor = new InheritableStyleProp <Color>(Color.Black);
            expectedFontInfo.m_bold           = new InheritableStyleProp <bool>(false);
            expectedFontInfo.m_italic         = new InheritableStyleProp <bool>(false);
            expectedFontInfo.m_superSub       = new InheritableStyleProp <FwSuperscriptVal>(FwSuperscriptVal.kssvOff);
            expectedFontInfo.m_offset         = new InheritableStyleProp <int>(0);

            BulletInfo bulletInfo1 = new BulletInfo();

            bulletInfo1.FontInfo = expectedFontInfo;

            BulletInfo bulletInfo2 = new BulletInfo();

            bulletInfo2.EncodedFontInfo = bulletInfo1.EncodedFontInfo;

            Assert.AreEqual(expectedFontInfo, bulletInfo2.FontInfo);
        }
Exemplo n.º 3
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Initializes a new instance of the <see cref="T:BulletInfo"/> class.
 /// </summary>
 /// <param name="other">The other bullet info to copy from.</param>
 /// ------------------------------------------------------------------------------------
 public BulletInfo(BulletInfo other)
 {
     m_numberScheme = other.m_numberScheme;
     m_start        = other.m_start;
     m_textBefore   = other.m_textBefore;
     m_textAfter    = other.m_textAfter;
     m_fontInfo     = new FontInfo(other.FontInfo);
     m_bulletCustom = other.m_bulletCustom;
 }
Exemplo n.º 4
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Compares the contents to another instance of a BulletInfo
 /// </summary>
 /// <param name="other">item to compare to</param>
 /// <returns>true if the contents are equal</returns>
 /// ------------------------------------------------------------------------------------
 public bool CompareEquals(BulletInfo other)
 {
     return
         ((m_numberScheme == other.m_numberScheme) &&
          (m_start == other.m_start) &&
          (m_textAfter == other.m_textAfter) &&
          (m_textBefore == other.m_textBefore) &&
          (m_bulletCustom == other.m_bulletCustom) &&
          (m_fontInfo == other.m_fontInfo));
 }