public void CommitOrReset(IBusAttrUnderline underline, bool expectedRetVal, string expectedText, int expectedSelStart, int expectedSelLenth) { // Setup m_TextBox.Text = string.Empty; m_TextBox.SelectionStart = 0; m_TextBox.SelectionLength = 0; m_Handler.OnUpdatePreeditText(new IBusText("a", new [] { new IBusUnderlineAttribute(underline, 0, 1) }), 1); // Exercise var ret = m_Handler.CommitOrReset(); // Verify Assert.That(ret, Is.EqualTo(expectedRetVal)); Assert.That(m_TextBox.Text, Is.EqualTo(expectedText)); Assert.That(m_TextBox.SelectionStart, Is.EqualTo(expectedSelStart), "SelectionStart"); Assert.That(m_TextBox.SelectionLength, Is.EqualTo(expectedSelLenth), "SelectionLength"); }
public void CommitOrReset(IBusAttrUnderline underline, bool expectedRetVal, string expectedText, int expectedSelStart, int expectedSelEnd) { // Setup var hvoPara = SetupInitialText("a"); SetSelection(1, 1); m_Handler.OnUpdatePreeditText(new IBusText("b", new [] { new IBusUnderlineAttribute(underline, 0, 1) }), 1); // Exercise var ret = m_Handler.CommitOrReset(); // Verify Assert.That(ret, Is.EqualTo(expectedRetVal)); var selHelper = m_basicView.EditingHelper.CurrentSelection; Assert.That(GetTextFromView(hvoPara), Is.EqualTo(expectedText)); Assert.That(selHelper.IchAnchor, Is.EqualTo(expectedSelStart), "SelectionStart"); Assert.That(selHelper.IchEnd, Is.EqualTo(expectedSelEnd), "SelectionEnd"); }
public void CommitOrReset(IBusAttrUnderline underline, bool expectedRetVal, string expectedText, int expectedSelStart, int expectedSelLenth) { // Setup m_TextBox.Text = string.Empty; m_TextBox.SelectionStart = 0; m_TextBox.SelectionLength = 0; m_Handler.OnUpdatePreeditText(new IBusText("a", new [] { new IBusUnderlineAttribute(underline, 0, 1)}), 1); // Exercise var ret = m_Handler.CommitOrReset(); // Verify Assert.That(ret, Is.EqualTo(expectedRetVal)); Assert.That(m_TextBox.Text, Is.EqualTo(expectedText)); Assert.That(m_TextBox.SelectionStart, Is.EqualTo(expectedSelStart), "SelectionStart"); Assert.That(m_TextBox.SelectionLength, Is.EqualTo(expectedSelLenth), "SelectionLength"); }