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