Example #1
0
        public void GetFootnoteMarkerFromGuid()
        {
            StFootnote footnote = new StFootnote();

            m_scr.ScriptureBooksOS[0].FootnotesOS.Append(footnote);
            footnote.FootnoteMarker.Text = "a";

            Guid guid = m_fdoCache.GetGuidFromId(footnote.Hvo);

            // Add the guid property so we can get it out as a string.
            ITsPropsBldr propsBldr = TsPropsBldrClass.Create();

            byte[] objData = MiscUtils.GetObjData(guid, 1);
            propsBldr.SetStrPropValueRgch(1, objData, objData.Length);

            // Get the guid property as a string.
            string sObjData;

            propsBldr.GetStrPropValue(1, out sObjData);

            using (StVc vc = new StVc())
            {
                vc.Cache     = m_fdoCache;
                vc.DefaultWs = m_fdoCache.LanguageWritingSystemFactoryAccessor.UserWs;
                ITsString footnoteMarker = vc.GetStrForGuid(sObjData.Substring(1));

                Assert.AreEqual("2", footnoteMarker.Text);
            }
        }
Example #2
0
        public void GetFootnoteMarkerFromGuid()
        {
            IScrFootnote footnote = Cache.ServiceLocator.GetInstance <IScrFootnoteFactory>().Create();

            m_scr.ScriptureBooksOS[0].FootnotesOS.Add(footnote);
            footnote.FootnoteMarker = Cache.TsStrFactory.MakeString("a", Cache.WritingSystemFactory.GetWsFromStr("en"));

            // Add the guid property so we can get it out as a string.
            ITsPropsBldr propsBldr = TsPropsBldrClass.Create();

            byte[] objData = TsStringUtils.GetObjData(footnote.Guid, 1);
            propsBldr.SetStrPropValueRgch(1, objData, objData.Length);

            // Get the guid property as a string.
            string sObjData;

            propsBldr.GetStrPropValue(1, out sObjData);

            StVc vc = new StVc(Cache.WritingSystemFactory.UserWs)
            {
                Cache = Cache
            };
            ITsString footnoteMarker = vc.GetStrForGuid(sObjData.Substring(1));

            // Call to GetStrForGuid doesn't generate a footnote marker based on the
            // Scripture Footnote properties since the method to do that is in TeStVc.
            int dummy;

            Assert.AreEqual(StringUtils.kszObject, footnoteMarker.Text);
            ITsTextProps props = footnoteMarker.get_Properties(0);

            Assert.AreEqual(2, props.IntPropCount);
            Assert.AreEqual(Cache.DefaultUserWs, props.GetIntPropValues((int)FwTextPropType.ktptWs, out dummy));
            Assert.AreEqual(0, props.GetIntPropValues((int)FwTextPropType.ktptEditable, out dummy));
            Assert.AreEqual(1, props.StrPropCount);

            FwObjDataTypes odt;
            Guid           footnoteGuid = TsStringUtils.GetGuidFromProps(props, null, out odt);

            Assert.IsTrue(odt == FwObjDataTypes.kodtPictEvenHot || odt == FwObjDataTypes.kodtPictOddHot);
            Assert.AreEqual(footnote.Guid, footnoteGuid);
        }