public void ApplyStyle_CharStyleNotAppliedToBorderingWhiteSpace() { CheckDisposed(); m_draftView.RefreshDisplay(); // Select a word in the book intro with white space around it: " text. " m_draftView.SetInsertionPoint(0, 0, 0, 5, false); IVwSelection sel0 = m_draftView.RootBox.Selection; Assert.IsNotNull(sel0); m_draftView.SetInsertionPoint(0, 0, 0, 12, true); IVwSelection sel1 = m_draftView.RootBox.Selection; Assert.IsNotNull(sel1); IVwSelection rangeSel = m_draftView.RootBox.MakeRangeSelection(sel0, sel1, true); ITsString tssSelected; rangeSel.GetSelectionString(out tssSelected, "*"); Assert.AreEqual(" text. ", tssSelected.Text); // Apply a character style to the selected text. m_draftView.ApplyStyle("Emphasis"); // The selection should be updated to omit bordering white space in the original selection. m_draftView.RootBox.Selection.GetSelectionString(out tssSelected, "*"); Assert.AreEqual("text.", tssSelected.Text); // Confirm that the character styles are applied correctly: Emphasis style applied only to "text." ScrSection introSection = (ScrSection)m_exodus.SectionsOS[0]; ITsString paraContents = ((StTxtPara)introSection.ContentOA.ParagraphsOS[0]).Contents.UnderlyingTsString; Assert.AreEqual(3, paraContents.RunCount); Assert.AreEqual(7, paraContents.get_MinOfRun(1)); Assert.AreEqual(11, paraContents.get_LimOfRun(1)); ITsTextProps ttp = paraContents.get_Properties(0); Assert.IsNull(ttp.GetStrPropValue((int)FwTextStringProp.kstpNamedStyle), "First run should be 'Default Paragraph Characters'"); ttp = paraContents.get_Properties(1); Assert.AreEqual("Emphasis", ttp.GetStrPropValue((int)FwTextStringProp.kstpNamedStyle)); ttp = paraContents.get_Properties(2); Assert.IsNull(ttp.GetStrPropValue((int)FwTextStringProp.kstpNamedStyle), "Third run should be 'Default Paragraph Characters'"); }