public void TrimTrailingSpaceWithSpaceAtEnd()
        {
            // create an IStTxtPara
            IParaStylePropsProxy proxy = new DummyProxy("Whatever");

            m_bldr.ParaStylePropsProxy = proxy;
            ITsTextProps textProps = StyleUtils.CharStyleTextProps(null, m_wsArbitrary);

            m_bldr.AppendRun("My run ", textProps);
            Assert.AreEqual(7, m_bldr.Length);
            // trim the space off the end
            m_bldr.TrimTrailingSpaceInPara();
            Assert.AreEqual(6, m_bldr.Length);
            IStTxtPara para = m_bldr.CreateParagraph(m_text, 1);

            // verify paragraph contents
            AssertEx.RunIsCorrect(para.Contents, 0, "My run", null,
                                  m_wsArbitrary);
        }
Example #2
0
        public void TrimTrailingSpaceTwiceWithTwoSpacesAtEnd()
        {
            CheckDisposed();

            // create an StTxtPara
            using (StTxtParaBldr bldr = new StTxtParaBldr(Cache))
            {
                IParaStylePropsProxy proxy = new DummyProxy("Whatever");
                bldr.ParaStylePropsProxy = proxy;
                ITsTextProps textProps = StyleUtils.CharStyleTextProps(null, m_wsArbitrary);
                bldr.AppendRun("My run  ", textProps);
                Assert.AreEqual(8, bldr.Length);
                // trim the space off the end
                bldr.TrimTrailingSpaceInPara();
                Assert.AreEqual(7, bldr.Length);
                bldr.TrimTrailingSpaceInPara();
                Assert.AreEqual(6, bldr.Length);
                StTxtPara para = bldr.CreateParagraph(m_text.Hvo, 1);
                // verify paragraph contents
                AssertEx.RunIsCorrect(para.Contents.UnderlyingTsString, 0, "My run", null,
                                      m_wsArbitrary);
            }             // Dispose() frees ICU resources.
        }