154 references to TextDataFormat
Microsoft.VisualBasic.Forms (3)
Microsoft\VisualBasic\MyServices\ClipboardProxy.vb (3)
79
Public Function ContainsText(format As
TextDataFormat
) As Boolean
139
Public Function GetText(format As
TextDataFormat
) As String
207
Public Sub SetText(text As String, format As
TextDataFormat
)
Microsoft.VisualBasic.Forms.Tests (3)
System\Windows\Forms\ClipboardProxyTests.vb (3)
21
''' Testing only that <see cref=" MyServices.ClipboardProxy"/> contains <see cref="
TextDataFormat
.Text"/>.
28
Dim expected As Boolean = clipboardProxy.ContainsText(format:=
TextDataFormat
.Text)
29
Clipboard.ContainsText(format:=
TextDataFormat
.Text).Should.Be(expected)
Microsoft.VisualBasic.Tests (5)
Microsoft\VisualBasic\MyServices\ClipboardProxyTests.cs (5)
9
using TextDataFormat = System.Windows.Forms.
TextDataFormat
;
80
clipboard.SetText(text,
TextDataFormat
.UnicodeText);
83
System.Windows.Forms.Clipboard.GetText(
TextDataFormat
.UnicodeText).Should().Be(clipboard.GetText(
TextDataFormat
.UnicodeText));
84
clipboard.GetText(
TextDataFormat
.UnicodeText).Should().Be(text);
System.Windows.Forms (29)
System\Windows\Forms\OLE\Clipboard.cs (18)
204
/// Indicates whether there is text data on the Clipboard in <see cref="
TextDataFormat
.UnicodeText"/> format.
206
public static bool ContainsText() => ContainsText(
TextDataFormat
.UnicodeText);
210
/// <see cref="
TextDataFormat
"/> value.
212
public static bool ContainsText(
TextDataFormat
format)
256
/// Retrieves text data from the <see cref="Clipboard"/> in the <see cref="
TextDataFormat
.UnicodeText"/> format.
258
public static string GetText() => GetText(
TextDataFormat
.UnicodeText);
262
/// <see cref="
TextDataFormat
"/> value.
264
public static string GetText(
TextDataFormat
format)
328
/// Clears the Clipboard and then adds text data in the <see cref="
TextDataFormat
.UnicodeText"/> format.
330
public static void SetText(string text) => SetText(text,
TextDataFormat
.UnicodeText);
334
/// <see cref="
TextDataFormat
"/> value.
336
public static void SetText(string text,
TextDataFormat
format)
343
private static string ConvertToDataFormats(
TextDataFormat
format) => format switch
345
TextDataFormat
.Text => DataFormats.Text,
346
TextDataFormat
.UnicodeText => DataFormats.UnicodeText,
347
TextDataFormat
.Rtf => DataFormats.Rtf,
348
TextDataFormat
.Html => DataFormats.Html,
349
TextDataFormat
.CommaSeparatedValue => DataFormats.CommaSeparatedValue,
System\Windows\Forms\OLE\DataObject.cs (11)
129
public virtual bool ContainsText() => ContainsText(
TextDataFormat
.UnicodeText);
131
public virtual bool ContainsText(
TextDataFormat
format)
153
public virtual string GetText() => GetText(
TextDataFormat
.UnicodeText);
155
public virtual string GetText(
TextDataFormat
format)
176
public virtual void SetText(string textData) => SetText(textData,
TextDataFormat
.UnicodeText);
178
public virtual void SetText(string textData,
TextDataFormat
format)
188
private static string ConvertToDataFormats(
TextDataFormat
format) => format switch
190
TextDataFormat
.UnicodeText => DataFormats.UnicodeTextConstant,
191
TextDataFormat
.Rtf => DataFormats.RtfConstant,
192
TextDataFormat
.Html => DataFormats.HtmlConstant,
193
TextDataFormat
.CommaSeparatedValue => DataFormats.CsvConstant,
System.Windows.Forms.Tests (114)
System\Windows\Forms\ClipboardTests.cs (14)
77
[EnumData<
TextDataFormat
>]
78
public void Clipboard_ContainsText_TextDataFormat_InvokeMultipleTimes_Success(
TextDataFormat
format)
85
[InvalidEnumData<
TextDataFormat
>]
86
public void Clipboard_ContainsText_InvalidFormat_ThrowsInvalidEnumArgumentException(
TextDataFormat
format)
140
[EnumData<
TextDataFormat
>]
141
public void Clipboard_GetText_TextDataFormat_InvokeMultipleTimes_Success(
TextDataFormat
format)
148
[InvalidEnumData<
TextDataFormat
>]
149
public void Clipboard_GetText_InvalidFormat_ThrowsInvalidEnumArgumentException(
TextDataFormat
format)
356
() => Clipboard.SetText("text",
TextDataFormat
.Text)
459
[EnumData<
TextDataFormat
>]
460
public void Clipboard_SetText_InvokeStringTextDataFormat_GetReturnsExpected(
TextDataFormat
format)
473
action = () => Clipboard.SetText(text,
TextDataFormat
.Text);
478
[InvalidEnumData<
TextDataFormat
>]
479
public void Clipboard_SetText_InvalidFormat_ThrowsInvalidEnumArgumentException(
TextDataFormat
format)
System\Windows\Forms\DataObjectTests.ClipboardTests.cs (10)
122
dataObject.ContainsText(
TextDataFormat
.Text).Should().Be(format == DataFormats.UnicodeText);
123
dataObject.ContainsText(
TextDataFormat
.UnicodeText).Should().Be(format == DataFormats.UnicodeText);
124
dataObject.ContainsText(
TextDataFormat
.Rtf).Should().Be(format == DataFormats.Rtf);
125
dataObject.ContainsText(
TextDataFormat
.Html).Should().Be(format == DataFormats.Html);
126
dataObject.ContainsText(
TextDataFormat
.CommaSeparatedValue).Should().Be(format == DataFormats.CommaSeparatedValue);
182
dataObject.ContainsText(
TextDataFormat
.Text).Should().Be(format == DataFormats.UnicodeText);
183
dataObject.ContainsText(
TextDataFormat
.UnicodeText).Should().Be(format == DataFormats.UnicodeText);
184
dataObject.ContainsText(
TextDataFormat
.Rtf).Should().Be(format == DataFormats.Rtf);
185
dataObject.ContainsText(
TextDataFormat
.Html).Should().Be(format == DataFormats.Html);
186
dataObject.ContainsText(
TextDataFormat
.CommaSeparatedValue).Should().Be(format == DataFormats.CommaSeparatedValue);
System\Windows\Forms\DataObjectTests.cs (90)
141
.Setup(o => o.ContainsText(
TextDataFormat
.UnicodeText))
145
mockDataObject.Verify(o => o.ContainsText(
TextDataFormat
.UnicodeText), Times.Once());
149
[EnumData<
TextDataFormat
>]
150
public void DataObject_ContainsText_InvokeTextDataFormat_ReturnsFalse(
TextDataFormat
format)
156
public static TheoryData<
TextDataFormat
, string, bool> ContainsText_TextDataFormat_TheoryData()
158
TheoryData<
TextDataFormat
, string, bool> theoryData = [];
161
theoryData.Add(
TextDataFormat
.Text, DataFormats.UnicodeText, result);
162
theoryData.Add(
TextDataFormat
.UnicodeText, DataFormats.UnicodeText, result);
163
theoryData.Add(
TextDataFormat
.Rtf, DataFormats.Rtf, result);
164
theoryData.Add(
TextDataFormat
.Html, DataFormats.Html, result);
165
theoryData.Add(
TextDataFormat
.CommaSeparatedValue, DataFormats.CommaSeparatedValue, result);
173
public void DataObject_ContainsText_InvokeTextDataFormatMocked_CallsGetDataPresent(
TextDataFormat
format, string expectedFormat, bool result)
188
[InvalidEnumData<
TextDataFormat
>]
189
public void DataObject_ContainsText_InvokeInvalidTextDataFormat_ThrowsInvalidEnumArgumentException(
TextDataFormat
format)
733
.Setup(o => o.GetText(
TextDataFormat
.UnicodeText))
737
mockDataObject.Verify(o => o.GetText(
TextDataFormat
.UnicodeText), Times.Once());
741
[EnumData<
TextDataFormat
>]
742
public void DataObject_GetText_InvokeTextDataFormatDefault_ReturnsEmpty(
TextDataFormat
format)
748
public static TheoryData<
TextDataFormat
, string, object, string> GetText_TextDataFormat_TheoryData() => new()
750
{
TextDataFormat
.Text, DataFormats.UnicodeText, null, string.Empty },
751
{
TextDataFormat
.Text, DataFormats.UnicodeText, new(), string.Empty },
752
{
TextDataFormat
.Text, DataFormats.UnicodeText, string.Empty, string.Empty },
753
{
TextDataFormat
.Text, DataFormats.UnicodeText, " ", " " },
754
{
TextDataFormat
.Text, DataFormats.UnicodeText, "a", "a" },
756
{
TextDataFormat
.UnicodeText, DataFormats.UnicodeText, null, string.Empty },
757
{
TextDataFormat
.UnicodeText, DataFormats.UnicodeText, new(), string.Empty },
758
{
TextDataFormat
.UnicodeText, DataFormats.UnicodeText, string.Empty, string.Empty },
759
{
TextDataFormat
.UnicodeText, DataFormats.UnicodeText, " ", " " },
760
{
TextDataFormat
.UnicodeText, DataFormats.UnicodeText, "a", "a" },
762
{
TextDataFormat
.Rtf, DataFormats.Rtf, null, string.Empty },
763
{
TextDataFormat
.Rtf, DataFormats.Rtf, new(), string.Empty },
764
{
TextDataFormat
.Rtf, DataFormats.Rtf, string.Empty, string.Empty },
765
{
TextDataFormat
.Rtf, DataFormats.Rtf, " ", " " },
766
{
TextDataFormat
.Rtf, DataFormats.Rtf, "a", "a" },
768
{
TextDataFormat
.Html, DataFormats.Html, null, string.Empty },
769
{
TextDataFormat
.Html, DataFormats.Html, new(), string.Empty },
770
{
TextDataFormat
.Html, DataFormats.Html, string.Empty, string.Empty },
771
{
TextDataFormat
.Html, DataFormats.Html, " ", " " },
772
{
TextDataFormat
.Html, DataFormats.Html, "a", "a" },
774
{
TextDataFormat
.CommaSeparatedValue, DataFormats.CommaSeparatedValue, null, string.Empty },
775
{
TextDataFormat
.CommaSeparatedValue, DataFormats.CommaSeparatedValue, new(), string.Empty },
776
{
TextDataFormat
.CommaSeparatedValue, DataFormats.CommaSeparatedValue, string.Empty, string.Empty },
777
{
TextDataFormat
.CommaSeparatedValue, DataFormats.CommaSeparatedValue, " ", " " },
778
{
TextDataFormat
.CommaSeparatedValue, DataFormats.CommaSeparatedValue, "a", "a" },
783
public void DataObject_GetText_InvokeTextDataFormatWithData_ReturnsExpected(
TextDataFormat
format, string expectedFormat, object result, string expected)
792
public void DataObject_GetText_InvokeTextDataFormatMocked_ReturnsExpected(
TextDataFormat
format, string expectedFormat, object result, string expected)
807
[InvalidEnumData<
TextDataFormat
>]
808
public void DataObject_GetText_InvokeInvalidFormat_ThrowsInvalidEnumArgumentException(
TextDataFormat
format)
1036
dataObject.ContainsText(
TextDataFormat
.Text).Should().BeFalse();
1037
dataObject.ContainsText(
TextDataFormat
.UnicodeText).Should().BeFalse();
1038
dataObject.ContainsText(
TextDataFormat
.Rtf).Should().BeFalse();
1039
dataObject.ContainsText(
TextDataFormat
.Html).Should().BeFalse();
1040
dataObject.ContainsText(
TextDataFormat
.CommaSeparatedValue).Should().BeFalse();
1116
dataObject.ContainsText(
TextDataFormat
.Text).Should().BeFalse();
1117
dataObject.ContainsText(
TextDataFormat
.UnicodeText).Should().BeFalse();
1118
dataObject.ContainsText(
TextDataFormat
.Rtf).Should().BeFalse();
1119
dataObject.ContainsText(
TextDataFormat
.Html).Should().BeFalse();
1120
dataObject.ContainsText(
TextDataFormat
.CommaSeparatedValue).Should().BeFalse();
1417
.Setup(o => o.SetText(textData,
TextDataFormat
.UnicodeText))
1420
mockDataObject.Verify(o => o.SetText(textData,
TextDataFormat
.UnicodeText), Times.Once());
1436
public static TheoryData<string,
TextDataFormat
, string, string, string, string> SetText_StringTextDataFormat_TheoryData()
1438
TheoryData<string,
TextDataFormat
, string, string, string, string> theoryData = [];
1441
theoryData.Add(textData,
TextDataFormat
.Text, textData, null, null, null);
1442
theoryData.Add(textData,
TextDataFormat
.UnicodeText, textData, null, null, null);
1443
theoryData.Add(textData,
TextDataFormat
.Rtf, null, textData, null, null);
1444
theoryData.Add(textData,
TextDataFormat
.Html, null, null, textData, null);
1445
theoryData.Add(textData,
TextDataFormat
.CommaSeparatedValue, null, null, null, textData);
1453
public void DataObject_SetText_InvokeStringTextDataFormat_GetReturnsExpected(string textData,
TextDataFormat
format, string expectedUnicodeText, string expectedRtfText, string expectedHtmlText, string expectedCsvText)
1487
public static TheoryData<string,
TextDataFormat
, string> SetText_StringTextDataFormatMocked_TheoryData()
1489
TheoryData<string,
TextDataFormat
, string> theoryData = [];
1492
theoryData.Add(textData,
TextDataFormat
.Text, DataFormats.UnicodeText);
1493
theoryData.Add(textData,
TextDataFormat
.UnicodeText, DataFormats.UnicodeText);
1494
theoryData.Add(textData,
TextDataFormat
.Rtf, DataFormats.Rtf);
1495
theoryData.Add(textData,
TextDataFormat
.Html, DataFormats.Html);
1496
theoryData.Add(textData,
TextDataFormat
.CommaSeparatedValue, DataFormats.CommaSeparatedValue);
1504
public void DataObject_SetText_InvokeStringTextDataFormatMocked_CallsSetText(string textData,
TextDataFormat
format, string expectedFormat)
1519
public void DataObject_SetText_InvokeStringTextDataFormatIDataObject_CallsSetData(string textData,
TextDataFormat
format, string expectedFormat)
1537
((Action)(() => dataObject.SetText(textData,
TextDataFormat
.Text))).Should()
1542
[InvalidEnumData<
TextDataFormat
>]
1543
public void DataObject_SetText_InvalidFormat_ThrowsInvalidEnumArgumentException(
TextDataFormat
format)
2087
public static TheoryData<
TextDataFormat
, short> GetDataHere_Text_TheoryData() => new()
2089
{
TextDataFormat
.Rtf, (short)DataFormats.GetFormat(DataFormats.Rtf).Id },
2090
{
TextDataFormat
.Html, (short)DataFormats.GetFormat(DataFormats.Html).Id }
2095
public unsafe void IComDataObjectGetDataHere_Text_Success(
TextDataFormat
textDataFormat, short cfFormat)
2130
public static TheoryData<
TextDataFormat
, short> GetDataHere_UnicodeText_TheoryData() => new()
2132
{
TextDataFormat
.Text, (short)CLIPBOARD_FORMAT.CF_UNICODETEXT },
2133
{
TextDataFormat
.UnicodeText, (short)CLIPBOARD_FORMAT.CF_UNICODETEXT }
2138
public unsafe void IComDataObjectGetDataHere_UnicodeText_Success(
TextDataFormat
textDataFormat, short cfFormat)
2175
public unsafe void IComDataObjectGetDataHere_TextNoData_ThrowsArgumentException(
TextDataFormat
textDataFormat, short cfFormat)
2197
public unsafe void IComDataObjectGetDataHere_UnicodeTextNoData_ThrowsArgumentException(
TextDataFormat
textDataFormat, short cfFormat)