164 references to TextDataFormat
Microsoft.VisualBasic.Forms (3)
Microsoft\VisualBasic\MyServices\ClipboardProxy.vb (3)
81
Public Function ContainsText(format As
TextDataFormat
) As Boolean
148
Public Function GetText(format As
TextDataFormat
) As String
231
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)
11
using TextDataFormat = System.Windows.Forms.
TextDataFormat
;
83
clipboard.SetText(text,
TextDataFormat
.UnicodeText);
86
System.Windows.Forms.Clipboard.GetText(
TextDataFormat
.UnicodeText).Should().Be(clipboard.GetText(
TextDataFormat
.UnicodeText));
87
clipboard.GetText(
TextDataFormat
.UnicodeText).Should().Be(text);
System.Windows.Forms (29)
System\Windows\Forms\OLE\Clipboard.cs (18)
215
/// Indicates whether there is text data on the Clipboard in <see cref="
TextDataFormat
.UnicodeText"/> format.
217
public static bool ContainsText() => ContainsText(
TextDataFormat
.UnicodeText);
221
/// <see cref="
TextDataFormat
"/> value.
223
public static bool ContainsText(
TextDataFormat
format)
456
/// Retrieves text data from the <see cref="Clipboard"/> in the <see cref="
TextDataFormat
.UnicodeText"/> format.
458
public static string GetText() => GetText(
TextDataFormat
.UnicodeText);
462
/// <see cref="
TextDataFormat
"/> value.
464
public static string GetText(
TextDataFormat
format)
605
/// Clears the Clipboard and then adds text data in the <see cref="
TextDataFormat
.UnicodeText"/> format.
607
public static void SetText(string text) => SetText(text,
TextDataFormat
.UnicodeText);
611
/// <see cref="
TextDataFormat
"/> value.
613
public static void SetText(string text,
TextDataFormat
format)
620
private static string ConvertToDataFormats(
TextDataFormat
format) => format switch
622
TextDataFormat
.Text => DataFormats.Text,
623
TextDataFormat
.UnicodeText => DataFormats.UnicodeText,
624
TextDataFormat
.Rtf => DataFormats.Rtf,
625
TextDataFormat
.Html => DataFormats.Html,
626
TextDataFormat
.CommaSeparatedValue => DataFormats.CommaSeparatedValue,
System\Windows\Forms\OLE\DataObject.cs (11)
313
public virtual bool ContainsText() => ContainsText(
TextDataFormat
.UnicodeText);
315
public virtual bool ContainsText(
TextDataFormat
format)
338
public virtual string GetText(
TextDataFormat
format)
346
public virtual string GetText() => GetText(
TextDataFormat
.UnicodeText);
362
public virtual void SetText(string textData) => SetText(textData,
TextDataFormat
.UnicodeText);
364
public virtual void SetText(string textData,
TextDataFormat
format)
430
private static string ConvertToDataFormats(
TextDataFormat
format) => format switch
432
TextDataFormat
.UnicodeText => DataFormats.UnicodeTextConstant,
433
TextDataFormat
.Rtf => DataFormats.RtfConstant,
434
TextDataFormat
.Html => DataFormats.HtmlConstant,
435
TextDataFormat
.CommaSeparatedValue => DataFormats.CsvConstant,
System.Windows.Forms.Tests (124)
System\Windows\Forms\ClipboardTests.cs (14)
85
[EnumData<
TextDataFormat
>]
86
public void Clipboard_ContainsText_TextDataFormat_InvokeMultipleTimes_Success(
TextDataFormat
format)
93
[InvalidEnumData<
TextDataFormat
>]
94
public void Clipboard_ContainsText_InvalidFormat_ThrowsInvalidEnumArgumentException(
TextDataFormat
format)
149
[EnumData<
TextDataFormat
>]
150
public void Clipboard_GetText_TextDataFormat_InvokeMultipleTimes_Success(
TextDataFormat
format)
157
[InvalidEnumData<
TextDataFormat
>]
158
public void Clipboard_GetText_InvalidFormat_ThrowsInvalidEnumArgumentException(
TextDataFormat
format)
374
() => Clipboard.SetText("text",
TextDataFormat
.Text)
502
[EnumData<
TextDataFormat
>]
503
public void Clipboard_SetText_InvokeStringTextDataFormat_GetReturnsExpected(
TextDataFormat
format)
516
action = () => Clipboard.SetText(text,
TextDataFormat
.Text);
521
[InvalidEnumData<
TextDataFormat
>]
522
public void Clipboard_SetText_InvalidFormat_ThrowsInvalidEnumArgumentException(
TextDataFormat
format)
System\Windows\Forms\DataObjectTests.ClipboardTests.cs (10)
124
dataObject.ContainsText(
TextDataFormat
.Text).Should().Be(format == DataFormats.UnicodeText);
125
dataObject.ContainsText(
TextDataFormat
.UnicodeText).Should().Be(format == DataFormats.UnicodeText);
126
dataObject.ContainsText(
TextDataFormat
.Rtf).Should().Be(format == DataFormats.Rtf);
127
dataObject.ContainsText(
TextDataFormat
.Html).Should().Be(format == DataFormats.Html);
128
dataObject.ContainsText(
TextDataFormat
.CommaSeparatedValue).Should().Be(format == DataFormats.CommaSeparatedValue);
184
dataObject.ContainsText(
TextDataFormat
.Text).Should().Be(format == DataFormats.UnicodeText);
185
dataObject.ContainsText(
TextDataFormat
.UnicodeText).Should().Be(format == DataFormats.UnicodeText);
186
dataObject.ContainsText(
TextDataFormat
.Rtf).Should().Be(format == DataFormats.Rtf);
187
dataObject.ContainsText(
TextDataFormat
.Html).Should().Be(format == DataFormats.Html);
188
dataObject.ContainsText(
TextDataFormat
.CommaSeparatedValue).Should().Be(format == DataFormats.CommaSeparatedValue);
System\Windows\Forms\DataObjectTests.cs (100)
149
.Setup(o => o.ContainsText(
TextDataFormat
.UnicodeText))
153
mockDataObject.Verify(o => o.ContainsText(
TextDataFormat
.UnicodeText), Times.Once());
157
[EnumData<
TextDataFormat
>]
158
public void DataObject_ContainsText_InvokeTextDataFormat_ReturnsFalse(
TextDataFormat
format)
164
public static TheoryData<
TextDataFormat
, string, bool> ContainsText_TextDataFormat_TheoryData()
166
TheoryData<
TextDataFormat
, string, bool> theoryData = [];
169
theoryData.Add(
TextDataFormat
.Text, DataFormats.UnicodeText, result);
170
theoryData.Add(
TextDataFormat
.UnicodeText, DataFormats.UnicodeText, result);
171
theoryData.Add(
TextDataFormat
.Rtf, DataFormats.Rtf, result);
172
theoryData.Add(
TextDataFormat
.Html, DataFormats.Html, result);
173
theoryData.Add(
TextDataFormat
.CommaSeparatedValue, DataFormats.CommaSeparatedValue, result);
181
public void DataObject_ContainsText_InvokeTextDataFormatMocked_CallsGetDataPresent(
TextDataFormat
format, string expectedFormat, bool result)
196
[InvalidEnumData<
TextDataFormat
>]
197
public void DataObject_ContainsText_InvokeInvalidTextDataFormat_ThrowsInvalidEnumArgumentException(
TextDataFormat
format)
879
.Setup(o => o.GetText(
TextDataFormat
.UnicodeText))
883
mockDataObject.Verify(o => o.GetText(
TextDataFormat
.UnicodeText), Times.Once());
887
[EnumData<
TextDataFormat
>]
888
public void DataObject_GetText_InvokeTextDataFormatDefault_ReturnsEmpty(
TextDataFormat
format)
894
public static TheoryData<
TextDataFormat
, string, object, string> GetText_TextDataFormat_TheoryData() => new()
896
{
TextDataFormat
.Text, DataFormats.UnicodeText, null, string.Empty },
897
{
TextDataFormat
.Text, DataFormats.UnicodeText, new(), string.Empty },
898
{
TextDataFormat
.Text, DataFormats.UnicodeText, string.Empty, string.Empty },
899
{
TextDataFormat
.Text, DataFormats.UnicodeText, " ", " " },
900
{
TextDataFormat
.Text, DataFormats.UnicodeText, "a", "a" },
902
{
TextDataFormat
.UnicodeText, DataFormats.UnicodeText, null, string.Empty },
903
{
TextDataFormat
.UnicodeText, DataFormats.UnicodeText, new(), string.Empty },
904
{
TextDataFormat
.UnicodeText, DataFormats.UnicodeText, string.Empty, string.Empty },
905
{
TextDataFormat
.UnicodeText, DataFormats.UnicodeText, " ", " " },
906
{
TextDataFormat
.UnicodeText, DataFormats.UnicodeText, "a", "a" },
908
{
TextDataFormat
.Rtf, DataFormats.Rtf, null, string.Empty },
909
{
TextDataFormat
.Rtf, DataFormats.Rtf, new(), string.Empty },
910
{
TextDataFormat
.Rtf, DataFormats.Rtf, string.Empty, string.Empty },
911
{
TextDataFormat
.Rtf, DataFormats.Rtf, " ", " " },
912
{
TextDataFormat
.Rtf, DataFormats.Rtf, "a", "a" },
914
{
TextDataFormat
.Html, DataFormats.Html, null, string.Empty },
915
{
TextDataFormat
.Html, DataFormats.Html, new(), string.Empty },
916
{
TextDataFormat
.Html, DataFormats.Html, string.Empty, string.Empty },
917
{
TextDataFormat
.Html, DataFormats.Html, " ", " " },
918
{
TextDataFormat
.Html, DataFormats.Html, "a", "a" },
920
{
TextDataFormat
.CommaSeparatedValue, DataFormats.CommaSeparatedValue, null, string.Empty },
921
{
TextDataFormat
.CommaSeparatedValue, DataFormats.CommaSeparatedValue, new(), string.Empty },
922
{
TextDataFormat
.CommaSeparatedValue, DataFormats.CommaSeparatedValue, string.Empty, string.Empty },
923
{
TextDataFormat
.CommaSeparatedValue, DataFormats.CommaSeparatedValue, " ", " " },
924
{
TextDataFormat
.CommaSeparatedValue, DataFormats.CommaSeparatedValue, "a", "a" },
929
public void DataObject_GetText_InvokeTextDataFormatWithData_ReturnsExpected(
TextDataFormat
format, string expectedFormat, object result, string expected)
938
public void DataObject_GetText_InvokeTextDataFormatMocked_ReturnsExpected(
TextDataFormat
format, string expectedFormat, object result, string expected)
953
[InvalidEnumData<
TextDataFormat
>]
954
public void DataObject_GetText_InvokeInvalidFormat_ThrowsInvalidEnumArgumentException(
TextDataFormat
format)
1205
dataObject.ContainsText(
TextDataFormat
.Text).Should().Be(format == DataFormats.UnicodeText);
1206
dataObject.ContainsText(
TextDataFormat
.UnicodeText).Should().Be(format == DataFormats.UnicodeText);
1207
dataObject.ContainsText(
TextDataFormat
.Rtf).Should().Be(format == DataFormats.Rtf);
1208
dataObject.ContainsText(
TextDataFormat
.Html).Should().Be(format == DataFormats.Html);
1209
dataObject.ContainsText(
TextDataFormat
.CommaSeparatedValue).Should().Be(format == DataFormats.CommaSeparatedValue);
1245
dataObject.ContainsText(
TextDataFormat
.Text).Should().BeFalse();
1246
dataObject.ContainsText(
TextDataFormat
.UnicodeText).Should().BeFalse();
1247
dataObject.ContainsText(
TextDataFormat
.Rtf).Should().BeFalse();
1248
dataObject.ContainsText(
TextDataFormat
.Html).Should().BeFalse();
1249
dataObject.ContainsText(
TextDataFormat
.CommaSeparatedValue).Should().BeFalse();
1354
dataObject.ContainsText(
TextDataFormat
.Text).Should().Be(format == DataFormats.UnicodeText);
1355
dataObject.ContainsText(
TextDataFormat
.UnicodeText).Should().Be(format == DataFormats.UnicodeText);
1356
dataObject.ContainsText(
TextDataFormat
.Rtf).Should().Be(format == DataFormats.Rtf);
1357
dataObject.ContainsText(
TextDataFormat
.Html).Should().Be(format == DataFormats.Html);
1358
dataObject.ContainsText(
TextDataFormat
.CommaSeparatedValue).Should().Be(format == DataFormats.CommaSeparatedValue);
1398
dataObject.ContainsText(
TextDataFormat
.Text).Should().BeFalse();
1399
dataObject.ContainsText(
TextDataFormat
.UnicodeText).Should().BeFalse();
1400
dataObject.ContainsText(
TextDataFormat
.Rtf).Should().BeFalse();
1401
dataObject.ContainsText(
TextDataFormat
.Html).Should().BeFalse();
1402
dataObject.ContainsText(
TextDataFormat
.CommaSeparatedValue).Should().BeFalse();
1699
.Setup(o => o.SetText(textData,
TextDataFormat
.UnicodeText))
1702
mockDataObject.Verify(o => o.SetText(textData,
TextDataFormat
.UnicodeText), Times.Once());
1718
public static TheoryData<string,
TextDataFormat
, string, string, string, string> SetText_StringTextDataFormat_TheoryData()
1720
TheoryData<string,
TextDataFormat
, string, string, string, string> theoryData = [];
1723
theoryData.Add(textData,
TextDataFormat
.Text, textData, null, null, null);
1724
theoryData.Add(textData,
TextDataFormat
.UnicodeText, textData, null, null, null);
1725
theoryData.Add(textData,
TextDataFormat
.Rtf, null, textData, null, null);
1726
theoryData.Add(textData,
TextDataFormat
.Html, null, null, textData, null);
1727
theoryData.Add(textData,
TextDataFormat
.CommaSeparatedValue, null, null, null, textData);
1735
public void DataObject_SetText_InvokeStringTextDataFormat_GetReturnsExpected(string textData,
TextDataFormat
format, string expectedUnicodeText, string expectedRtfText, string expectedHtmlText, string expectedCsvText)
1769
public static TheoryData<string,
TextDataFormat
, string> SetText_StringTextDataFormatMocked_TheoryData()
1771
TheoryData<string,
TextDataFormat
, string> theoryData = [];
1774
theoryData.Add(textData,
TextDataFormat
.Text, DataFormats.UnicodeText);
1775
theoryData.Add(textData,
TextDataFormat
.UnicodeText, DataFormats.UnicodeText);
1776
theoryData.Add(textData,
TextDataFormat
.Rtf, DataFormats.Rtf);
1777
theoryData.Add(textData,
TextDataFormat
.Html, DataFormats.Html);
1778
theoryData.Add(textData,
TextDataFormat
.CommaSeparatedValue, DataFormats.CommaSeparatedValue);
1786
public void DataObject_SetText_InvokeStringTextDataFormatMocked_CallsSetText(string textData,
TextDataFormat
format, string expectedFormat)
1801
public void DataObject_SetText_InvokeStringTextDataFormatIDataObject_CallsSetData(string textData,
TextDataFormat
format, string expectedFormat)
1819
((Action)(() => dataObject.SetText(textData,
TextDataFormat
.Text))).Should()
1824
[InvalidEnumData<
TextDataFormat
>]
1825
public void DataObject_SetText_InvalidFormat_ThrowsInvalidEnumArgumentException(
TextDataFormat
format)
2369
public static TheoryData<
TextDataFormat
, short> GetDataHere_Text_TheoryData() => new()
2371
{
TextDataFormat
.Rtf, (short)DataFormats.GetFormat(DataFormats.Rtf).Id },
2372
{
TextDataFormat
.Html, (short)DataFormats.GetFormat(DataFormats.Html).Id }
2377
public unsafe void IComDataObjectGetDataHere_Text_Success(
TextDataFormat
textDataFormat, short cfFormat)
2412
public static TheoryData<
TextDataFormat
, short> GetDataHere_UnicodeText_TheoryData() => new()
2414
{
TextDataFormat
.Text, (short)CLIPBOARD_FORMAT.CF_UNICODETEXT },
2415
{
TextDataFormat
.UnicodeText, (short)CLIPBOARD_FORMAT.CF_UNICODETEXT }
2420
public unsafe void IComDataObjectGetDataHere_UnicodeText_Success(
TextDataFormat
textDataFormat, short cfFormat)
2457
public unsafe void IComDataObjectGetDataHere_TextNoData_ThrowsArgumentException(
TextDataFormat
textDataFormat, short cfFormat)
2479
public unsafe void IComDataObjectGetDataHere_UnicodeTextNoData_ThrowsArgumentException(
TextDataFormat
textDataFormat, short cfFormat)