Skip to content

Commit

Permalink
Add code coverage for RichTextBox
Browse files Browse the repository at this point in the history
  • Loading branch information
Zheng-Li01 committed Feb 21, 2024
1 parent 235a5dd commit 4af31b5
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10673,6 +10673,21 @@ public void RichTextBox_GetCharIndexFromPosition_Invoke_ReturnsExpected(int x, i
Assert.Equal(0, createdCallCount);
}

[WinFormsFact]
public void RichTextBox_Paste_PastesData()
{
using RichTextBox richTextBox1 = new();
string text = "Hello, World!";

Clipboard.Clear();
richTextBox1.Paste(DataFormats.GetFormat(DataFormats.Text));
Assert.Empty(richTextBox1.Text);

Clipboard.SetText(text);
richTextBox1.Paste(DataFormats.GetFormat(DataFormats.Text));
Assert.Equal(text, richTextBox1.Text);
}

private class CustomGetParaFormatRichTextBox : RichTextBox
{
public bool MakeCustom { get; set; }
Expand Down

0 comments on commit 4af31b5

Please sign in to comment.