Example #1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Creates a new ParaNodeMap containing the location information that
        /// can be extracted from this ScrVerse (namely whether it is in a title
        /// or section, what section is lives in, whether that section is a heading
        /// or content section, which paragraph it is within that section, and the character
        /// offset in the paragraph)
        /// </summary>
        /// <param name="verse">The given ScrVerse.</param>
        /// <param name="cache">The cache.</param>
        /// ------------------------------------------------------------------------------------
        public ParaNodeMap(ScrVerse verse, FdoCache cache)
        {
            // Get para containing the ScrVerse and
            StTxtPara para = new StTxtPara(cache, verse.HvoPara);

            ConstructFromPara(para);

            // Add character offset of ScrVerse
            m_location[kCharIndex] = verse.VerseStartIndex;
        }
Example #2
0
        /// -----------------------------------------------------------------------------------
        ///<summary>
        /// Verify the specified ScrVerse
        ///</summary>
        ///<param name="verse">specified ScrVerse</param>
        ///<param name="cache">database</param>
        ///<param name="verseText">expected text within the ScrVerse</param>
        ///<param name="styleName">expected stylename for the ScrVerse paragraph</param>
        ///<param name="startRef">expected starting reference</param>
        ///<param name="endRef">expected ending reference</param>
        /// -----------------------------------------------------------------------------------
        public static void VerifyScrVerse(ScrVerse verse, FdoCache cache, string verseText,
                                          string styleName, BCVRef startRef, BCVRef endRef)
        {
            ScrTxtPara versePara = new ScrTxtPara(cache, verse.HvoPara);

            if (string.IsNullOrEmpty(verseText))
            {
                Assert.IsTrue(verse.Text == null || string.IsNullOrEmpty(verse.Text.Text));
            }
            else
            {
                Assert.AreEqual(verseText, verse.Text.Text);
            }
            Assert.AreEqual(styleName, ScrStyleNames.GetStyleName(versePara.Hvo, cache));
            Assert.AreEqual(startRef, verse.StartRef);
            Assert.AreEqual(endRef, verse.EndRef);
        }