Пример #1
0
        public void MakeDispPropOverrides_invalidValues_BeyondParaBounds()
        {
            IStText text = m_inMemoryCache.AddTitleToMockedBook(m_book.Hvo, "Title text");

            DummyTeStVc stVc = new DummyTeStVc(m_inMemoryCache.Cache, m_inMemoryCache.Cache.DefaultVernWs);

            Assert.AreEqual(0, stVc.PropOverrides.Count);
            stVc.CallMakeDispPropOverrides((StTxtPara)text.ParagraphsOS[0], -1, 11,
                                           delegate(ref DispPropOverride prop)
            {
                // Nothing to do
            });
            Assert.AreEqual(1, stVc.PropOverrides.Count);
            Assert.AreEqual(0, stVc.PropOverrides[0].ichMin);
            Assert.AreEqual(10, stVc.PropOverrides[0].ichLim);
        }
Пример #2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Create a title paragrpaph for the given book.
        /// </summary>
        /// <param name="scrInMemoryCache">in-memory cache to use for testing</param>
        /// <param name="book">The book</param>param>
        /// <param name="sTitle">The text of the title. Can be a simple string or a format
        /// string. (See InMemoryFdoCache.CreateFormatText for the definition of the
        /// format string)</param>
        /// ------------------------------------------------------------------------------------
        internal static void SetTitle(ScrInMemoryFdoCache scrInMemoryCache, IScrBook book, string sTitle)
        {
            book.TitleOA = new StText();

            if (sTitle[0] != '\\')
            {
                scrInMemoryCache.AddTitleToMockedBook(book.Hvo, sTitle);
            }
            else
            {
                // Create a more complex title from the given format string
                // insert a new para in the title
                StTxtPara para = new StTxtPara();
                book.TitleOA.ParagraphsOS.Append(para);
                // set the para's fields
                scrInMemoryCache.AddFormatTextToMockedPara(book, para, sTitle, scrInMemoryCache.Cache.DefaultVernWs);
                para.StyleRules = StyleUtils.ParaStyleTextProps(ScrStyleNames.MainBookTitle);
            }
        }
Пример #3
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Add a title to the given book using the specified text.
 /// </summary>
 /// <param name="book">The book to which the section is to be appended</param>
 /// <param name="sTitle">The text of the title</param>
 /// ------------------------------------------------------------------------------------
 protected void SetTitle(IScrBook book, string sTitle)
 {
     m_scrInMemoryCache.AddTitleToMockedBook(book.Hvo, sTitle);
 }