public void ParagraphBreak_RemoveCharStyleFromAdjacentWhiteSpace() { CheckDisposed(); m_draftView.RefreshDisplay(); // *** Test setup *** // Insert text with a character style. StTxtPara para1 = (StTxtPara)m_exodus.SectionsOS[0].ContentOA.ParagraphsOS[0]; ITsStrBldr tssBldr = para1.Contents.UnderlyingTsString.GetBldr(); ITsPropsBldr ttpBldr = TsPropsBldrClass.Create(); ttpBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, "Emphasis"); tssBldr.ReplaceRgch(15, 15, "really, really", 6, ttpBldr.GetTextProps()); int paraCount = m_exodus.SectionsOS[0].ContentOA.ParagraphsOS.Count; // Set the IP in the white space within the inserted text. m_draftView.SetInsertionPoint(0, 0, 0, 23, true); IVwSelection sel0 = m_draftView.RootBox.Selection; Assert.IsNotNull(sel0); // Insert paragraph break m_draftView.OnKeyPress(new KeyPressEventArgs('\r')); Assert.AreEqual(paraCount + 1, m_exodus.SectionsOS[0].ContentOA.ParagraphsOS.Count, "Should have one more paragraph in the intro section"); // We expect that the last run of the first paragraph and first run of the new // paragraph will be a space character with no character style. ITsString tss1 = para1.Contents.UnderlyingTsString; Assert.AreEqual(3, tss1.RunCount, "First intro paragraph should have three runs"); Assert.AreEqual("really,", tss1.get_RunText(1)); ITsTextProps ttp = tss1.get_Properties(1); Assert.AreEqual("Emphasis", ttp.GetStrPropValue((int)FwTextStringProp.kstpNamedStyle)); ttp = tss1.get_Properties(2); Assert.AreEqual(" ", tss1.get_RunText(2)); Assert.AreEqual(null, ttp.GetStrPropValue((int)FwTextStringProp.kstpNamedStyle)); ITsString tss2 = ((StTxtPara)m_exodus.SectionsOS[0].ContentOA.ParagraphsOS[1]).Contents.UnderlyingTsString; Assert.AreEqual(3, tss2.RunCount); Assert.AreEqual(" ", tss2.get_RunText(0)); ttp = tss1.get_Properties(0); Assert.AreEqual(null, ttp.GetStrPropValue((int)FwTextStringProp.kstpNamedStyle)); ttp = tss1.get_Properties(1); Assert.AreEqual("Emphasis", ttp.GetStrPropValue((int)FwTextStringProp.kstpNamedStyle)); Assert.AreEqual("really", tss2.get_RunText(0)); }