コード例 #1
0
        public void AppendTwoRuns_WithAndWithoutNamedCharStyles()
        {
            CheckDisposed();

            // Build an StTxtPara
            StTxtParaBldr        bldr  = new StTxtParaBldr(Cache);
            IParaStylePropsProxy proxy = new DummyProxy("Para Meister");

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

            bldr.AppendRun("Run 1 ", textProps);
            textProps = StyleUtils.CharStyleTextProps("Italic Run", m_wsArbitrary);
            // verify its length
            Assert.AreEqual(6, bldr.Length);
            // add another run
            bldr.AppendRun("Run 2", textProps);
            StTxtPara para = bldr.CreateParagraph(m_text.Hvo, 1);

            // verify paragraph's state
            Assert.IsNotNull(para);
            Assert.AreEqual(proxy.Props, para.StyleRules);
            AssertEx.RunIsCorrect(para.Contents.UnderlyingTsString, 0, "Run 1 ", null, m_wsArbitrary);
            AssertEx.RunIsCorrect(para.Contents.UnderlyingTsString, 1, "Run 2", "Italic Run", m_wsArbitrary);
            // Builder should now be cleared
            Assert.AreEqual(0, bldr.Length);
        }
コード例 #2
0
        public void CreateTwoParagraphs()
        {
            CheckDisposed();

            // Build First StTxtPara
            StTxtParaBldr        bldr  = new StTxtParaBldr(Cache);
            IParaStylePropsProxy proxy = new DummyProxy("MyParaStyle");

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

            bldr.AppendRun("Para 1", textProps);
            StText    text  = new StText(Cache, m_text.Hvo);
            int       iPara = text.ParagraphsOS.Count;
            StTxtPara para1 = bldr.CreateParagraph(text.Hvo, iPara);

            // verify paragraph 1
            AssertEx.RunIsCorrect(para1.Contents.UnderlyingTsString, 0, "Para 1", null,
                                  m_wsArbitrary);

            // Build Second StTxtPara -- Builder should have been cleared
            textProps = StyleUtils.CharStyleTextProps("BringBrangBrung", m_wsArbitrary);
            bldr.AppendRun("Para 2", textProps);
            StTxtPara para2 = bldr.CreateParagraph(text.Hvo, iPara + 1);

            Assert.AreEqual(text.ParagraphsOS[iPara].Hvo, para1.Hvo);
            Assert.AreEqual(text.ParagraphsOS[iPara + 1].Hvo, para2.Hvo);

            // Re-verify paragraph 1
            AssertEx.RunIsCorrect(para1.Contents.UnderlyingTsString, 0, "Para 1", null,
                                  m_wsArbitrary);
            // verify paragraph 2
            AssertEx.RunIsCorrect(para2.Contents.UnderlyingTsString, 0, "Para 2",
                                  "BringBrangBrung", m_wsArbitrary);
        }
コード例 #3
0
        public void CreateTwoParagraphs()
        {
            // Build First IStTxtPara
            IParaStylePropsProxy proxy = new DummyProxy("MyParaStyle");

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

            m_bldr.AppendRun("Para 1", textProps);
            int        iPara = m_text.ParagraphsOS.Count;
            IStTxtPara para1 = m_bldr.CreateParagraph(m_text, iPara);

            // verify paragraph 1
            AssertEx.RunIsCorrect(para1.Contents, 0, "Para 1", null,
                                  m_wsArbitrary);

            // Build Second IStTxtPara -- Builder should have been cleared
            textProps = StyleUtils.CharStyleTextProps("BringBrangBrung", m_wsArbitrary);
            m_bldr.AppendRun("Para 2", textProps);
            IStTxtPara para2 = m_bldr.CreateParagraph(m_text, iPara + 1);

            Assert.AreEqual(m_text.ParagraphsOS[iPara], para1);
            Assert.AreEqual(m_text.ParagraphsOS[iPara + 1], para2);

            // Re-verify paragraph 1
            AssertEx.RunIsCorrect(para1.Contents, 0, "Para 1", null, m_wsArbitrary);
            // verify paragraph 2
            AssertEx.RunIsCorrect(para2.Contents, 0, "Para 2", "BringBrangBrung", m_wsArbitrary);
        }
コード例 #4
0
        public void AppendParagraph()
        {
            CheckDisposed();

            // Build an StTxtPara
            StTxtParaBldr        bldr  = new StTxtParaBldr(Cache);
            IParaStylePropsProxy proxy = new DummyProxy("Para Meister");

            bldr.ParaStylePropsProxy = proxy;
            ITsTextProps textProps = StyleUtils.CharStyleTextProps(null,
                                                                   Cache.LanguageEncodings.Item(0).Hvo);

            bldr.AppendRun("Run 1", textProps);

            StText text  = new StText(Cache, m_text.Hvo);
            int    iPara = text.ParagraphsOS.Count;

            StTxtPara para = bldr.CreateParagraph(text.Hvo);

            // verify paragraph's state
            Assert.IsNotNull(para);
            Assert.AreEqual(proxy.Props, para.StyleRules);
            AssertEx.RunIsCorrect(para.Contents.UnderlyingTsString, 0, "Run 1", null,
                                  m_wsArbitrary);
            Assert.AreEqual(para.Hvo, text.ParagraphsOS[iPara].Hvo);
            // Builder should now be cleared
            Assert.AreEqual(0, bldr.Length);
        }
コード例 #5
0
        public void CreateParagraphEmpty()
        {
            // create an IStTxtPara
            IParaStylePropsProxy proxy = new DummyProxy("EmptyPara");

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

            m_bldr.AppendRun(string.Empty, textProps);
            Assert.AreEqual(0, m_bldr.Length);
            IStTxtPara para = m_bldr.CreateParagraph(m_text, 1);

            // verify paragraph's state
            Assert.IsNotNull(para);
            Assert.AreEqual(proxy.StyleId, para.StyleName);
            Assert.AreEqual(1, para.Contents.RunCount);
            Assert.IsNull(para.Contents.Text);
        }
コード例 #6
0
        public void TrimTrailingSpaceWithTwoSpacesAtEnd()
        {
            // 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(8, m_bldr.Length);
            // trim one of the spaces off the end
            m_bldr.TrimTrailingSpaceInPara();
            Assert.AreEqual(7, m_bldr.Length);
            IStTxtPara para = m_bldr.CreateParagraph(m_text, 1);

            // verify paragraph contents
            AssertEx.RunIsCorrect(para.Contents, 0, "My run ", null,
                                  m_wsArbitrary);
        }
コード例 #7
0
        public void TrimTrailingSpaceWithNoSpaceAtEnd()
        {
            // Build 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(6, m_bldr.Length);
            // Attempt to trim the space off the end -- nothing should happen.
            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);
        }
コード例 #8
0
        public void CreateParagraphEmpty()
        {
            CheckDisposed();

            // create an StTxtPara
            StTxtParaBldr        bldr  = new StTxtParaBldr(Cache);
            IParaStylePropsProxy proxy = new DummyProxy("EmptyPara");

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

            bldr.AppendRun(string.Empty, textProps);
            Assert.AreEqual(0, bldr.Length);
            StTxtPara para = bldr.CreateParagraph(m_text.Hvo, 1);

            // verify paragraph's state
            Assert.IsNotNull(para);
            Assert.AreEqual(proxy.Props, para.StyleRules);
            Assert.AreEqual(1, para.Contents.UnderlyingTsString.RunCount);
            Assert.IsNull(para.Contents.Text);
        }
コード例 #9
0
        public void TrimTrailingSpaceWithNoSpaceAtEnd()
        {
            CheckDisposed();

            // Build 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(6, bldr.Length);
                // Attempt to trim the space off the end -- nothing should happen.
                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.
        }
コード例 #10
0
        public void AppendRunWithNamedCharStyle()
        {
            // create an IStTxtPara
            IParaStylePropsProxy proxy = new DummyProxy("Whatever");

            m_bldr.ParaStylePropsProxy = proxy;
            ITsTextProps textProps =
                StyleUtils.CharStyleTextProps("George's Favorite Char Style", m_wsArbitrary);

            m_bldr.AppendRun("My run", textProps);

            IStTxtPara para = m_bldr.CreateParagraph(m_text, 1);

            // verify paragraph's state
            Assert.IsNotNull(para);
            Assert.AreEqual(proxy.StyleId, para.StyleName);
            AssertEx.RunIsCorrect(para.Contents, 0, "My run", "George's Favorite Char Style",
                                  m_wsArbitrary);
            // Builder should now be cleared
            Assert.AreEqual(0, m_bldr.Length);
        }
コード例 #11
0
        public void AppendParagraph()
        {
            // Build an IStTxtPara
            IParaStylePropsProxy proxy = new DummyProxy("Para Meister");

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

            m_bldr.AppendRun("Run 1", textProps);

            int        iPara = m_text.ParagraphsOS.Count;
            IStTxtPara para  = m_bldr.CreateParagraph(m_text);

            // verify paragraph's state
            Assert.IsNotNull(para);
            Assert.AreEqual(proxy.StyleId, para.StyleName);
            AssertEx.RunIsCorrect(para.Contents, 0, "Run 1", null,
                                  m_wsArbitrary);
            Assert.AreEqual(para.Hvo, m_text.ParagraphsOS[iPara].Hvo);
            // Builder should now be cleared
            Assert.AreEqual(0, m_bldr.Length);
        }
コード例 #12
0
        public void AppendTwoRuns_WithAndWithoutNamedCharStyles()
        {
            // Build an IStTxtPara
            IParaStylePropsProxy proxy = new DummyProxy("Para Meister");

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

            m_bldr.AppendRun("Run 1 ", textProps);
            textProps = StyleUtils.CharStyleTextProps("Italic Run", m_wsArbitrary);
            // verify its length
            Assert.AreEqual(6, m_bldr.Length);
            // add another run
            m_bldr.AppendRun("Run 2", textProps);
            IStTxtPara para = m_bldr.CreateParagraph(m_text, 1);

            // verify paragraph's state
            Assert.IsNotNull(para);
            Assert.AreEqual(proxy.StyleId, para.StyleName);
            AssertEx.RunIsCorrect(para.Contents, 0, "Run 1 ", null, m_wsArbitrary);
            AssertEx.RunIsCorrect(para.Contents, 1, "Run 2", "Italic Run", m_wsArbitrary);
            // Builder should now be cleared
            Assert.AreEqual(0, m_bldr.Length);
        }
コード例 #13
0
        public void AppendRunWithNamedCharStyle()
        {
            CheckDisposed();

            // create an StTxtPara
            StTxtParaBldr        bldr  = new StTxtParaBldr(Cache);
            IParaStylePropsProxy proxy = new DummyProxy("Whatever");

            bldr.ParaStylePropsProxy = proxy;
            ITsTextProps textProps =
                StyleUtils.CharStyleTextProps("George's Favorite Char Style", m_wsArbitrary);

            bldr.AppendRun("My run", textProps);

            StTxtPara para = bldr.CreateParagraph(m_text.Hvo, 1);

            // verify paragraph's state
            Assert.IsNotNull(para);
            Assert.AreEqual(proxy.Props, para.StyleRules);
            AssertEx.RunIsCorrect(para.Contents.UnderlyingTsString, 0, "My run", "George's Favorite Char Style",
                                  m_wsArbitrary);
            // Builder should now be cleared
            Assert.AreEqual(0, bldr.Length);
        }
コード例 #14
0
		public void CreateParagraphEmpty()
		{
			// create an IStTxtPara
			IParaStylePropsProxy proxy = new DummyProxy("EmptyPara");
			m_bldr.ParaStylePropsProxy = proxy;
			ITsTextProps textProps = StyleUtils.CharStyleTextProps(null, m_wsArbitrary);
			m_bldr.AppendRun(string.Empty, textProps);
			Assert.AreEqual(0, m_bldr.Length);
			IStTxtPara para = m_bldr.CreateParagraph(m_text, 1);
			// verify paragraph's state
			Assert.IsNotNull(para);
			Assert.AreEqual(proxy.StyleId, para.StyleName);
			Assert.AreEqual(1, para.Contents.RunCount);
			Assert.IsNull(para.Contents.Text);
		}
コード例 #15
0
		public void CreateTwoParagraphs()
		{
			// Build First IStTxtPara
			IParaStylePropsProxy proxy = new DummyProxy("MyParaStyle");
			m_bldr.ParaStylePropsProxy = proxy;
			ITsTextProps textProps = StyleUtils.CharStyleTextProps(null, m_wsArbitrary);
			m_bldr.AppendRun("Para 1", textProps);
			int iPara = m_text.ParagraphsOS.Count;
			IStTxtPara para1 = m_bldr.CreateParagraph(m_text, iPara);

			// verify paragraph 1
			AssertEx.RunIsCorrect(para1.Contents, 0, "Para 1", null,
				m_wsArbitrary);

			// Build Second IStTxtPara -- Builder should have been cleared
			textProps = StyleUtils.CharStyleTextProps("BringBrangBrung", m_wsArbitrary);
			m_bldr.AppendRun("Para 2", textProps);
			IStTxtPara para2 = m_bldr.CreateParagraph(m_text, iPara + 1);

			Assert.AreEqual(m_text.ParagraphsOS[iPara], para1);
			Assert.AreEqual(m_text.ParagraphsOS[iPara + 1], para2);

			// Re-verify paragraph 1
			AssertEx.RunIsCorrect(para1.Contents, 0, "Para 1", null, m_wsArbitrary);
			// verify paragraph 2
			AssertEx.RunIsCorrect(para2.Contents, 0, "Para 2", "BringBrangBrung", m_wsArbitrary);
		}
コード例 #16
0
		public void AppendTwoRuns_WithAndWithoutNamedCharStyles()
		{
			// Build an IStTxtPara
			IParaStylePropsProxy proxy = new DummyProxy("Para Meister");
			m_bldr.ParaStylePropsProxy = proxy;
			ITsTextProps textProps = StyleUtils.CharStyleTextProps(null, m_wsArbitrary);
			m_bldr.AppendRun("Run 1 ", textProps);
			textProps = StyleUtils.CharStyleTextProps("Italic Run", m_wsArbitrary);
			// verify its length
			Assert.AreEqual(6, m_bldr.Length);
			// add another run
			m_bldr.AppendRun("Run 2", textProps);
			IStTxtPara para = m_bldr.CreateParagraph(m_text, 1);
			// verify paragraph's state
			Assert.IsNotNull(para);
			Assert.AreEqual(proxy.StyleId, para.StyleName);
			AssertEx.RunIsCorrect(para.Contents, 0, "Run 1 ", null, m_wsArbitrary);
			AssertEx.RunIsCorrect(para.Contents, 1, "Run 2", "Italic Run", m_wsArbitrary);
			// Builder should now be cleared
			Assert.AreEqual(0, m_bldr.Length);
		}
コード例 #17
0
		public void AppendRunWithNamedCharStyle()
		{
			// create an IStTxtPara
			IParaStylePropsProxy proxy = new DummyProxy("Whatever");
			m_bldr.ParaStylePropsProxy = proxy;
			ITsTextProps textProps =
				StyleUtils.CharStyleTextProps("George's Favorite Char Style", m_wsArbitrary);
			m_bldr.AppendRun("My run", textProps);

			IStTxtPara para = m_bldr.CreateParagraph(m_text, 1);
			// verify paragraph's state
			Assert.IsNotNull(para);
			Assert.AreEqual(proxy.StyleId, para.StyleName);
			AssertEx.RunIsCorrect(para.Contents, 0, "My run", "George's Favorite Char Style",
				m_wsArbitrary);
			// Builder should now be cleared
			Assert.AreEqual(0, m_bldr.Length);
		}
コード例 #18
0
		public void CreateTwoParagraphs()
		{
			CheckDisposed();

			// Build First StTxtPara
			StTxtParaBldr bldr = new StTxtParaBldr(Cache);
			IParaStylePropsProxy proxy = new DummyProxy("MyParaStyle");
			bldr.ParaStylePropsProxy = proxy;
			ITsTextProps textProps = StyleUtils.CharStyleTextProps(null, m_wsArbitrary);
			bldr.AppendRun("Para 1", textProps);
			StText text = new StText(Cache, m_text.Hvo);
			int iPara = text.ParagraphsOS.Count;
			StTxtPara para1 = bldr.CreateParagraph(text.Hvo, iPara);

			// verify paragraph 1
			AssertEx.RunIsCorrect(para1.Contents.UnderlyingTsString, 0, "Para 1", null,
				m_wsArbitrary);

			// Build Second StTxtPara -- Builder should have been cleared
			textProps = StyleUtils.CharStyleTextProps("BringBrangBrung", m_wsArbitrary);
			bldr.AppendRun("Para 2", textProps);
			StTxtPara para2 = bldr.CreateParagraph(text.Hvo, iPara + 1);

			Assert.AreEqual(text.ParagraphsOS[iPara].Hvo, para1.Hvo);
			Assert.AreEqual(text.ParagraphsOS[iPara + 1].Hvo, para2.Hvo);

			// Re-verify paragraph 1
			AssertEx.RunIsCorrect(para1.Contents.UnderlyingTsString, 0, "Para 1", null,
				m_wsArbitrary);
			// verify paragraph 2
			AssertEx.RunIsCorrect(para2.Contents.UnderlyingTsString, 0, "Para 2",
				"BringBrangBrung", m_wsArbitrary);
		}
コード例 #19
0
		public void CreateParagraphEmpty()
		{
			CheckDisposed();

			// create an StTxtPara
			StTxtParaBldr bldr = new StTxtParaBldr(Cache);
			IParaStylePropsProxy proxy = new DummyProxy("EmptyPara");
			bldr.ParaStylePropsProxy = proxy;
			ITsTextProps textProps = StyleUtils.CharStyleTextProps(null, m_wsArbitrary);
			bldr.AppendRun(string.Empty, textProps);
			Assert.AreEqual(0, bldr.Length);
			StTxtPara para = bldr.CreateParagraph(m_text.Hvo, 1);
			// verify paragraph's state
			Assert.IsNotNull(para);
			Assert.AreEqual(proxy.Props, para.StyleRules);
			Assert.AreEqual(1, para.Contents.UnderlyingTsString.RunCount);
			Assert.IsNull(para.Contents.Text);
		}
コード例 #20
0
		public void AppendParagraph()
		{
			CheckDisposed();

			// Build an StTxtPara
			StTxtParaBldr bldr = new StTxtParaBldr(Cache);
			IParaStylePropsProxy proxy = new DummyProxy("Para Meister");
			bldr.ParaStylePropsProxy = proxy;
			ITsTextProps textProps = StyleUtils.CharStyleTextProps(null,
				Cache.LanguageEncodings.Item(0).Hvo);
			bldr.AppendRun("Run 1", textProps);

			StText text = new StText(Cache, m_text.Hvo);
			int iPara = text.ParagraphsOS.Count;

			StTxtPara para = bldr.CreateParagraph(text.Hvo);

			// verify paragraph's state
			Assert.IsNotNull(para);
			Assert.AreEqual(proxy.Props, para.StyleRules);
			AssertEx.RunIsCorrect(para.Contents.UnderlyingTsString, 0, "Run 1", null,
				m_wsArbitrary);
			Assert.AreEqual(para.Hvo, text.ParagraphsOS[iPara].Hvo);
			// Builder should now be cleared
			Assert.AreEqual(0, bldr.Length);
		}
コード例 #21
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.
		}
コード例 #22
0
		public void AppendTwoRuns_WithAndWithoutNamedCharStyles()
		{
			CheckDisposed();

			// Build an StTxtPara
			StTxtParaBldr bldr = new StTxtParaBldr(Cache);
			IParaStylePropsProxy proxy = new DummyProxy("Para Meister");
			bldr.ParaStylePropsProxy = proxy;
			ITsTextProps textProps = StyleUtils.CharStyleTextProps(null, m_wsArbitrary);
			bldr.AppendRun("Run 1 ", textProps);
			textProps = StyleUtils.CharStyleTextProps("Italic Run", m_wsArbitrary);
			// verify its length
			Assert.AreEqual(6, bldr.Length);
			// add another run
			bldr.AppendRun("Run 2", textProps);
			StTxtPara para = bldr.CreateParagraph(m_text.Hvo, 1);
			// verify paragraph's state
			Assert.IsNotNull(para);
			Assert.AreEqual(proxy.Props, para.StyleRules);
			AssertEx.RunIsCorrect(para.Contents.UnderlyingTsString, 0, "Run 1 ", null, m_wsArbitrary);
			AssertEx.RunIsCorrect(para.Contents.UnderlyingTsString, 1, "Run 2", "Italic Run", m_wsArbitrary);
			// Builder should now be cleared
			Assert.AreEqual(0, bldr.Length);
		}
コード例 #23
0
		public void AppendParagraph()
		{
			// Build an IStTxtPara
			IParaStylePropsProxy proxy = new DummyProxy("Para Meister");
			m_bldr.ParaStylePropsProxy = proxy;
			ITsTextProps textProps = StyleUtils.CharStyleTextProps(null, m_wsArbitrary);
			m_bldr.AppendRun("Run 1", textProps);

			int iPara = m_text.ParagraphsOS.Count;
			IStTxtPara para = m_bldr.CreateParagraph(m_text);

			// verify paragraph's state
			Assert.IsNotNull(para);
			Assert.AreEqual(proxy.StyleId, para.StyleName);
			AssertEx.RunIsCorrect(para.Contents, 0, "Run 1", null,
				m_wsArbitrary);
			Assert.AreEqual(para.Hvo, m_text.ParagraphsOS[iPara].Hvo);
			// Builder should now be cleared
			Assert.AreEqual(0, m_bldr.Length);
		}
コード例 #24
0
		public void TrimTrailingSpaceTwiceWithTwoSpacesAtEnd()
		{
			// 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(8, m_bldr.Length);
			// trim the space off the end
			m_bldr.TrimTrailingSpaceInPara();
			Assert.AreEqual(7, m_bldr.Length);
			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);
		}
コード例 #25
0
		public void AppendRunWithNamedCharStyle()
		{
			CheckDisposed();

			// create an StTxtPara
			StTxtParaBldr bldr = new StTxtParaBldr(Cache);
			IParaStylePropsProxy proxy = new DummyProxy("Whatever");
			bldr.ParaStylePropsProxy = proxy;
			ITsTextProps textProps =
				StyleUtils.CharStyleTextProps("George's Favorite Char Style", m_wsArbitrary);
			bldr.AppendRun("My run", textProps);

			StTxtPara para = bldr.CreateParagraph(m_text.Hvo, 1);
			// verify paragraph's state
			Assert.IsNotNull(para);
			Assert.AreEqual(proxy.Props, para.StyleRules);
			AssertEx.RunIsCorrect(para.Contents.UnderlyingTsString, 0, "My run", "George's Favorite Char Style",
				m_wsArbitrary);
			// Builder should now be cleared
			Assert.AreEqual(0, bldr.Length);
		}