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