479 references to DataFormats
Microsoft.VisualBasic.Tests (8)
Microsoft\VisualBasic\MyServices\ClipboardProxyTests.cs (8)
10
using DataFormats = System.Windows.Forms.
DataFormats
;
47
clipboard.SetData(
DataFormats
.UnicodeText, data);
48
clipboard.ContainsData(
DataFormats
.UnicodeText).Should().Be(System.Windows.Forms.Clipboard.ContainsData(
DataFormats
.UnicodeText));
49
clipboard.GetData(
DataFormats
.UnicodeText).Should().Be(System.Windows.Forms.Clipboard.GetData(
DataFormats
.UnicodeText));
58
clipboard.GetDataObject().GetData(
DataFormats
.UnicodeText).Should().Be(System.Windows.Forms.Clipboard.GetDataObject()?.GetData(
DataFormats
.UnicodeText));
System.Windows.Forms (56)
GlobalUsings.cs (1)
9
global using DragDropHelper = System.Private.Windows.Ole.DragDropHelper<System.Windows.Forms.Ole.WinFormsOleServices, System.Windows.Forms.
DataFormats
.Format>;
System\Windows\Forms\Controls\DataGridView\DataGridView.Methods.cs (7)
7135
DataFormats
.Html,
7136
DataFormats
.Text,
7137
DataFormats
.UnicodeText,
7138
DataFormats
.CommaSeparatedValue
7423
if (string.Equals(format,
DataFormats
.Html, StringComparison.OrdinalIgnoreCase))
7722
if (string.Equals(format,
DataFormats
.Html, StringComparison.OrdinalIgnoreCase))
8138
if (string.Equals(format,
DataFormats
.Html, StringComparison.OrdinalIgnoreCase))
System\Windows\Forms\Controls\DataGridView\DataGridViewCell.cs (4)
1316
if (string.Equals(format,
DataFormats
.Html, StringComparison.OrdinalIgnoreCase))
1353
bool csv = string.Equals(format,
DataFormats
.CommaSeparatedValue, StringComparison.OrdinalIgnoreCase);
1355
string.Equals(format,
DataFormats
.Text, StringComparison.OrdinalIgnoreCase) ||
1356
string.Equals(format,
DataFormats
.UnicodeText, StringComparison.OrdinalIgnoreCase))
System\Windows\Forms\Controls\DataGridView\DataGridViewColumnHeaderCell.cs (4)
138
if (string.Equals(format,
DataFormats
.Html, StringComparison.OrdinalIgnoreCase))
171
bool csv = string.Equals(format,
DataFormats
.CommaSeparatedValue, StringComparison.OrdinalIgnoreCase);
173
string.Equals(format,
DataFormats
.Text, StringComparison.OrdinalIgnoreCase) ||
174
string.Equals(format,
DataFormats
.UnicodeText, StringComparison.OrdinalIgnoreCase))
System\Windows\Forms\Controls\DataGridView\DataGridViewRowHeaderCell.cs (4)
108
if (string.Equals(format,
DataFormats
.Html, StringComparison.OrdinalIgnoreCase))
143
bool csv = string.Equals(format,
DataFormats
.CommaSeparatedValue, StringComparison.OrdinalIgnoreCase);
145
string.Equals(format,
DataFormats
.Text, StringComparison.OrdinalIgnoreCase) ||
146
string.Equals(format,
DataFormats
.UnicodeText, StringComparison.OrdinalIgnoreCase))
System\Windows\Forms\Controls\RichTextBox\RichTextBox.cs (2)
1606
public bool CanPaste(
DataFormats
.Format clipFormat)
2587
public void Paste(
DataFormats
.Format clipFormat)
System\Windows\Forms\OLE\Clipboard.cs (18)
159
/// Indicates whether there is data on the Clipboard in the <see cref="
DataFormats
.WaveAudio"/> format.
174
/// Indicates whether there is data on the Clipboard that is in the <see cref="
DataFormats
.FileDrop"/> format
177
public static bool ContainsFileDropList() => ContainsData(
DataFormats
.FileDrop, autoConvert: true);
180
/// Indicates whether there is data on the Clipboard that is in the <see cref="
DataFormats
.Bitmap"/> format
183
public static bool ContainsImage() => ContainsData(
DataFormats
.Bitmap, autoConvert: true);
237
/// The format of the data to retrieve. See the <see cref="
DataFormats
"/> class for a set of predefined data formats.
419
public static Image? GetImage() => GetTypedDataIfAvailable<Image>(
DataFormats
.Bitmap);
454
/// Clears the <see cref="Clipboard"/> and then adds data in the <see cref="
DataFormats
.WaveAudio"/> format.
459
/// Clears the <see cref="Clipboard"/> and then adds data in the <see cref="
DataFormats
.WaveAudio"/> format.
499
/// and you are using a custom format or <see cref="
DataFormats
.Serializable"/>,
539
/// Clears the Clipboard and then adds a collection of file names in the <see cref="
DataFormats
.FileDrop"/> format.
565
/// Clears the Clipboard and then adds an <see cref="Image"/> in the <see cref="
DataFormats
.Bitmap"/> format.
588
TextDataFormat.Text =>
DataFormats
.Text,
589
TextDataFormat.UnicodeText =>
DataFormats
.UnicodeText,
590
TextDataFormat.Rtf =>
DataFormats
.Rtf,
591
TextDataFormat.Html =>
DataFormats
.Html,
592
TextDataFormat.CommaSeparatedValue =>
DataFormats
.CommaSeparatedValue,
593
_ =>
DataFormats
.UnicodeText,
System\Windows\Forms\OLE\DataObject.cs (11)
32
private readonly Composition<WinFormsRuntime,
DataFormats
.Format> _innerData;
39
internal DataObject(Com.IDataObject* data) => _innerData = Composition<WinFormsRuntime,
DataFormats
.Format>.CreateFromNativeDataObject(data);
45
public DataObject() => _innerData = Composition<WinFormsRuntime,
DataFormats
.Format>.CreateFromManagedDataObject(new DataStore());
63
_innerData = Composition<WinFormsRuntime,
DataFormats
.Format>.CreateFromManagedDataObject(internalDataObject);
67
_innerData = Composition<WinFormsRuntime,
DataFormats
.Format>.CreateFromManagedDataObject(new DataObjectAdapter(iDataObject));
71
_innerData = Composition<WinFormsRuntime,
DataFormats
.Format>.CreateFromRuntimeDataObject(comDataObject);
75
_innerData = Composition<WinFormsRuntime,
DataFormats
.Format>.CreateFromManagedDataObject(new DataStore());
113
/// <param name="format">The format associated with the data. See <see cref="
DataFormats
"/> for predefined formats.</param>
124
/// and you are using a custom format or <see cref="
DataFormats
.Serializable"/>
281
public virtual Stream? GetAudioStream() => GetData(
DataFormats
.WaveAudio, autoConvert: false) as Stream;
294
public virtual Image? GetImage() => GetData(
DataFormats
.Bitmap, autoConvert: true) as Image;
System\Windows\Forms\OLE\DataObject.DataStore.cs (4)
95
if (data is Bitmap && format.Equals(
DataFormats
.Dib))
97
format = autoConvert ?
DataFormats
.Bitmap : throw new NotSupportedException(SR.DataObjectDibNotSupported);
116
&& !_mappedData.ContainsKey(
DataFormats
.Serializable))
118
SetData(
DataFormats
.Serializable, data);
System\Windows\Forms\WinFormsRuntime.cs (1)
12
internal class WinFormsRuntime : Runtime<
DataFormats
.Format, WinFormsNrbfSerializer, WinFormsOleServices>
System.Windows.Forms.Design (1)
System\Windows\Forms\Design\OleDragDropHandler.ComponentDataObject.cs (1)
203
return [NestedToolboxItemFormat, DataFormat,
DataFormats
.Serializable, ExtraInfoFormat];
System.Windows.Forms.Tests (371)
System\Windows\Forms\ClipboardTests.cs (18)
172
Clipboard.GetData(
DataFormats
.WaveAudio).Should().BeOfType<MemoryStream>().Which.ToArray().Should().Equal(audioBytes);
174
Clipboard.ContainsData(
DataFormats
.WaveAudio).Should().BeTrue();
184
Clipboard.GetData(
DataFormats
.WaveAudio).Should().BeNull();
186
Clipboard.ContainsData(
DataFormats
.WaveAudio).Should().BeTrue();
204
Clipboard.GetData(
DataFormats
.WaveAudio).Should().BeOfType<MemoryStream>().Which.ToArray().Should().Equal(audioBytes);
206
Clipboard.ContainsData(
DataFormats
.WaveAudio).Should().BeTrue();
216
Clipboard.GetData(
DataFormats
.WaveAudio).Should().BeNull();
218
Clipboard.ContainsData(
DataFormats
.WaveAudio).Should().BeTrue();
659
dataObject.GetData(
DataFormats
.Text).Should().Be(testString);
662
Clipboard.ContainsData(
DataFormats
.Text).Should().BeTrue();
663
Clipboard.ContainsData(
DataFormats
.UnicodeText).Should().BeTrue();
1027
cfFormat = (short)
DataFormats
.GetFormat("testFormat").Id,
1192
Clipboard.ContainsData(
DataFormats
.Text).Should().BeTrue();
1193
Clipboard.ContainsData(
DataFormats
.UnicodeText).Should().BeTrue();
1218
Clipboard.ContainsData(
DataFormats
.Text).Should().BeTrue();
1219
Clipboard.ContainsData(
DataFormats
.UnicodeText).Should().BeTrue();
1247
Clipboard.ContainsData(
DataFormats
.Text).Should().BeTrue();
1248
Clipboard.ContainsData(
DataFormats
.UnicodeText).Should().BeTrue();
System\Windows\Forms\DataFormatsTests.ClipboardTests.cs (3)
25
DataFormats
.Format result =
DataFormats
.GetFormat(id);
26
Assert.Equal(result,
DataFormats
.GetFormat(id));
System\Windows\Forms\DataFormatsTests.cs (58)
13
yield return new object[] {
DataFormats
.Bitmap, "Bitmap" };
14
yield return new object[] {
DataFormats
.CommaSeparatedValue, "Csv" };
15
yield return new object[] {
DataFormats
.Dib, "DeviceIndependentBitmap" };
16
yield return new object[] {
DataFormats
.Dif, "DataInterchangeFormat" };
17
yield return new object[] {
DataFormats
.EnhancedMetafile, "EnhancedMetafile" };
18
yield return new object[] {
DataFormats
.FileDrop, "FileDrop" };
19
yield return new object[] {
DataFormats
.Html, "HTML Format" };
20
yield return new object[] {
DataFormats
.Locale, "Locale" };
21
yield return new object[] {
DataFormats
.MetafilePict, "MetaFilePict" };
22
yield return new object[] {
DataFormats
.OemText, "OEMText" };
23
yield return new object[] {
DataFormats
.Palette, "Palette" };
24
yield return new object[] {
DataFormats
.PenData, "PenData" };
25
yield return new object[] {
DataFormats
.Riff, "RiffAudio" };
26
yield return new object[] {
DataFormats
.Rtf, "Rich Text Format" };
27
yield return new object[] {
DataFormats
.Serializable, "WindowsForms10PersistentObject" };
28
yield return new object[] {
DataFormats
.StringFormat, "System.String" };
29
yield return new object[] {
DataFormats
.SymbolicLink, "SymbolicLink" };
30
yield return new object[] {
DataFormats
.Text, "Text" };
31
yield return new object[] {
DataFormats
.Tiff, "TaggedImageFileFormat" };
32
yield return new object[] {
DataFormats
.UnicodeText, "UnicodeText" };
33
yield return new object[] {
DataFormats
.WaveAudio, "WaveAudio" };
45
yield return new object[] {
DataFormats
.Bitmap, "Bitmap", 2 };
46
yield return new object[] {
DataFormats
.Dib, "DeviceIndependentBitmap", 8 };
47
yield return new object[] {
DataFormats
.Dif, "DataInterchangeFormat", 5 };
48
yield return new object[] {
DataFormats
.EnhancedMetafile, "EnhancedMetafile", 14 };
49
yield return new object[] {
DataFormats
.FileDrop, "FileDrop", 15 };
50
yield return new object[] {
DataFormats
.Locale, "Locale", 16 };
51
yield return new object[] {
DataFormats
.MetafilePict, "MetaFilePict", 3 };
52
yield return new object[] {
DataFormats
.OemText, "OEMText", 7 };
53
yield return new object[] {
DataFormats
.Palette, "Palette", 9 };
54
yield return new object[] {
DataFormats
.PenData, "PenData", 10 };
55
yield return new object[] {
DataFormats
.Riff, "RiffAudio", 11 };
56
yield return new object[] {
DataFormats
.SymbolicLink, "SymbolicLink", 4 };
57
yield return new object[] {
DataFormats
.Text, "Text", 1 };
58
yield return new object[] {
DataFormats
.Tiff, "TaggedImageFileFormat", 6 };
59
yield return new object[] {
DataFormats
.UnicodeText, "UnicodeText", 13 };
60
yield return new object[] {
DataFormats
.WaveAudio, "WaveAudio", 12 };
67
DataFormats
.Format result =
DataFormats
.GetFormat(format);
68
Assert.Same(result,
DataFormats
.GetFormat(format.ToLowerInvariant()));
73
Assert.Same(result,
DataFormats
.GetFormat(format));
78
yield return new object[] {
DataFormats
.CommaSeparatedValue, "Csv" };
79
yield return new object[] {
DataFormats
.Html, "HTML Format" };
80
yield return new object[] {
DataFormats
.Rtf, "Rich Text Format" };
81
yield return new object[] {
DataFormats
.Serializable, "WindowsForms10PersistentObject" };
82
yield return new object[] {
DataFormats
.StringFormat, "System.String" };
90
DataFormats
.Format result =
DataFormats
.GetFormat(format);
91
Assert.Same(result,
DataFormats
.GetFormat(format));
92
Assert.Same(result,
DataFormats
.GetFormat(format.ToLowerInvariant()));
102
Assert.Same(result,
DataFormats
.GetFormat(result.Id));
108
Assert.Throws<ArgumentException>("format", () =>
DataFormats
.GetFormat(""));
109
Assert.Throws<ArgumentNullException>("format", () =>
DataFormats
.GetFormat(null));
121
Assert.Throws<Win32Exception>(() =>
DataFormats
.GetFormat(format));
152
DataFormats
.Format result =
DataFormats
.GetFormat(id);
153
Assert.Equal(result,
DataFormats
.GetFormat(id));
164
var format = new
DataFormats
.Format(name, id);
System\Windows\Forms\DataObjectExtensionsTests.cs (14)
20
Action tryGetData2 = () => DataObjectExtensions.TryGetData<string>(dataObject: null!,
DataFormats
.Text, out _);
22
Action tryGetData3 = () => DataObjectExtensions.TryGetData<string>(dataObject: null!,
DataFormats
.Dib, autoConvert: true, out _);
24
Action tryGetData4 = () => DataObjectExtensions.TryGetData<string>(dataObject: null!,
DataFormats
.EnhancedMetafile, autoConvert: false, out _);
26
Action tryGetData5 = () => DataObjectExtensions.TryGetData<string>(dataObject: null!,
DataFormats
.UnicodeText, Resolver, autoConvert: true, out _);
28
Action tryGetData6 = () => DataObjectExtensions.TryGetData<string>(dataObject: null!,
DataFormats
.Serializable, Resolver, autoConvert: false, out _);
47
Action tryGetData = () => dataObject.TryGetData<string>(
DataFormats
.Text, out _);
57
Action tryGetData = () => dataObject.TryGetData<string>(
DataFormats
.CommaSeparatedValue, autoConvert, out _);
67
Action tryGetData = () => dataObject.TryGetData<string>(
DataFormats
.UnicodeText, Resolver, autoConvert, out _);
84
dataObject.TryGetData(
DataFormats
.Dib, out Bitmap? bitmap).Should().BeFalse();
93
dataObject.TryGetData(
DataFormats
.Serializable, autoConvert, out Font? font).Should().BeFalse();
102
dataObject.TryGetData(
DataFormats
.SymbolicLink, Resolver, autoConvert, out DateTime? date).Should().BeFalse();
118
dataObject.TryGetData(
DataFormats
.Dib, out Bitmap? _).Should().BeFalse();
127
dataObject.TryGetData(
DataFormats
.FileDrop, autoConvert, out int? _).Should().BeFalse();
136
dataObject.TryGetData(
DataFormats
.SymbolicLink, Resolver, autoConvert, out DateTime? date).Should().BeFalse();
System\Windows\Forms\DataObjectTests.ClipboardTests.cs (22)
89
theoryData.Add(format, null, format ==
DataFormats
.FileDrop, format ==
DataFormats
.Bitmap);
90
theoryData.Add(format, "input", format ==
DataFormats
.FileDrop, format ==
DataFormats
.Bitmap);
120
dataObject.ContainsAudio().Should().Be(format ==
DataFormats
.WaveAudio);
123
dataObject.ContainsText().Should().Be(format ==
DataFormats
.UnicodeText);
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);
144
theoryData.Add(format, autoConvert, null, format ==
DataFormats
.FileDrop, format ==
DataFormats
.Bitmap);
145
theoryData.Add(format, autoConvert, "input", format ==
DataFormats
.FileDrop, format ==
DataFormats
.Bitmap);
180
dataObject.ContainsAudio().Should().Be(format ==
DataFormats
.WaveAudio);
183
dataObject.ContainsText().Should().Be(format ==
DataFormats
.UnicodeText);
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 (242)
31
DataFormats
.CommaSeparatedValue,
32
DataFormats
.Dib,
33
DataFormats
.Dif,
34
DataFormats
.PenData,
35
DataFormats
.Riff,
36
DataFormats
.Tiff,
37
DataFormats
.WaveAudio,
38
DataFormats
.SymbolicLink,
39
DataFormats
.StringFormat,
40
DataFormats
.Bitmap,
41
DataFormats
.EnhancedMetafile,
42
DataFormats
.FileDrop,
43
DataFormats
.Html,
44
DataFormats
.MetafilePict,
45
DataFormats
.OemText,
46
DataFormats
.Palette,
47
DataFormats
.Rtf,
48
DataFormats
.Text,
49
DataFormats
.UnicodeText,
60
DataFormats
.Serializable,
80
.Setup(o => o.GetDataPresent(
DataFormats
.WaveAudio, false))
84
mockDataObject.Verify(o => o.GetDataPresent(
DataFormats
.WaveAudio, false), Times.Once());
103
.Setup(o => o.GetDataPresent(
DataFormats
.FileDrop, true))
107
mockDataObject.Verify(o => o.GetDataPresent(
DataFormats
.FileDrop, true), Times.Once());
126
.Setup(o => o.GetDataPresent(
DataFormats
.Bitmap, true))
130
mockDataObject.Verify(o => o.GetDataPresent(
DataFormats
.Bitmap, true), Times.Once());
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);
228
dataObject.SetData(
DataFormats
.WaveAudio, result);
241
.Setup(o => o.GetData(
DataFormats
.WaveAudio, false))
245
mockDataObject.Verify(o => o.GetData(
DataFormats
.WaveAudio, false), Times.Once());
435
DataFormats
.CommaSeparatedValue,
467
string format =
DataFormats
.Bitmap;
480
string format =
DataFormats
.Bitmap;
493
{
DataFormats
.CommaSeparatedValue, true },
495
{
DataFormats
.CommaSeparatedValue, false },
530
string format =
DataFormats
.Bitmap;
568
string format =
DataFormats
.Bitmap;
581
string format =
DataFormats
.Bitmap;
737
dataObject.SetData(
DataFormats
.FileDrop, result);
750
.Setup(o => o.GetData(
DataFormats
.FileDrop, true))
754
mockDataObject.Verify(o => o.GetData(
DataFormats
.FileDrop, true), Times.Once());
907
dataObject.SetData(
DataFormats
.Bitmap, result);
920
.Setup(o => o.GetData(
DataFormats
.Bitmap, true))
924
mockDataObject.Verify(o => o.GetData(
DataFormats
.Bitmap, true), Times.Once());
947
dataObject.SetData(
DataFormats
.UnicodeText, result);
977
{ TextDataFormat.Text,
DataFormats
.UnicodeText, null, string.Empty },
978
{ TextDataFormat.Text,
DataFormats
.UnicodeText, new(), string.Empty },
979
{ TextDataFormat.Text,
DataFormats
.UnicodeText, string.Empty, string.Empty },
980
{ TextDataFormat.Text,
DataFormats
.UnicodeText, " ", " " },
981
{ TextDataFormat.Text,
DataFormats
.UnicodeText, "a", "a" },
983
{ TextDataFormat.UnicodeText,
DataFormats
.UnicodeText, null, string.Empty },
984
{ TextDataFormat.UnicodeText,
DataFormats
.UnicodeText, new(), string.Empty },
985
{ TextDataFormat.UnicodeText,
DataFormats
.UnicodeText, string.Empty, string.Empty },
986
{ TextDataFormat.UnicodeText,
DataFormats
.UnicodeText, " ", " " },
987
{ TextDataFormat.UnicodeText,
DataFormats
.UnicodeText, "a", "a" },
989
{ TextDataFormat.Rtf,
DataFormats
.Rtf, null, string.Empty },
990
{ TextDataFormat.Rtf,
DataFormats
.Rtf, new(), string.Empty },
991
{ TextDataFormat.Rtf,
DataFormats
.Rtf, string.Empty, string.Empty },
992
{ TextDataFormat.Rtf,
DataFormats
.Rtf, " ", " " },
993
{ TextDataFormat.Rtf,
DataFormats
.Rtf, "a", "a" },
995
{ TextDataFormat.Html,
DataFormats
.Html, null, string.Empty },
996
{ TextDataFormat.Html,
DataFormats
.Html, new(), string.Empty },
997
{ TextDataFormat.Html,
DataFormats
.Html, string.Empty, string.Empty },
998
{ TextDataFormat.Html,
DataFormats
.Html, " ", " " },
999
{ TextDataFormat.Html,
DataFormats
.Html, "a", "a" },
1001
{ TextDataFormat.CommaSeparatedValue,
DataFormats
.CommaSeparatedValue, null, string.Empty },
1002
{ TextDataFormat.CommaSeparatedValue,
DataFormats
.CommaSeparatedValue, new(), string.Empty },
1003
{ TextDataFormat.CommaSeparatedValue,
DataFormats
.CommaSeparatedValue, string.Empty, string.Empty },
1004
{ TextDataFormat.CommaSeparatedValue,
DataFormats
.CommaSeparatedValue, " ", " " },
1005
{ TextDataFormat.CommaSeparatedValue,
DataFormats
.CommaSeparatedValue, "a", "a" },
1056
dataObject.GetData(
DataFormats
.WaveAudio, autoConvert: true).Should().BeOfType<MemoryStream>().Subject.ToArray().Should().Equal(audioBytes);
1057
dataObject.GetData(
DataFormats
.WaveAudio, autoConvert: false).Should().BeOfType<MemoryStream>().Subject.ToArray().Should().Equal(audioBytes);
1060
dataObject.GetDataPresent(
DataFormats
.WaveAudio, autoConvert: true).Should().BeTrue();
1061
dataObject.GetDataPresent(
DataFormats
.WaveAudio, autoConvert: false).Should().BeTrue();
1085
.Setup(o => o.SetData(
DataFormats
.WaveAudio, false, It.IsAny<MemoryStream>()))
1089
mockDataObject.Verify(o => o.SetData(
DataFormats
.WaveAudio, false, It.IsAny<MemoryStream>()), Times.Once());
1114
dataObject.GetData(
DataFormats
.WaveAudio, autoConvert: true).Should().BeSameAs(audioStream);
1115
dataObject.GetData(
DataFormats
.WaveAudio, autoConvert: false).Should().BeSameAs(audioStream);
1118
dataObject.GetDataPresent(
DataFormats
.WaveAudio, autoConvert: true).Should().BeTrue();
1119
dataObject.GetDataPresent(
DataFormats
.WaveAudio, autoConvert: false).Should().BeTrue();
1131
.Setup(o => o.SetData(
DataFormats
.WaveAudio, false, audioStream))
1134
mockDataObject.Verify(o => o.SetData(
DataFormats
.WaveAudio, false, audioStream), Times.Once());
1143
.Setup(o => o.SetData(
DataFormats
.WaveAudio, false, audioStream))
1147
mockDataObject.Verify(o => o.SetData(
DataFormats
.WaveAudio, false, audioStream), Times.Once());
1162
{ new Mock<ISerializable>(MockBehavior.Strict).Object,
DataFormats
.Serializable }
1204
dataObject.GetData(
DataFormats
.Serializable, autoConvert: false).Should().Be(data1);
1205
dataObject.GetData(
DataFormats
.Serializable, autoConvert: true).Should().Be(data1);
1209
dataObject.GetDataPresent(
DataFormats
.Serializable, autoConvert: false).Should().BeTrue();
1210
dataObject.GetDataPresent(
DataFormats
.Serializable, autoConvert: true).Should().BeTrue();
1251
theoryData.Add(format, null, format ==
DataFormats
.FileDrop, format ==
DataFormats
.Bitmap);
1252
theoryData.Add(format, "input", format ==
DataFormats
.FileDrop, format ==
DataFormats
.Bitmap);
1282
dataObject.ContainsAudio().Should().Be(format ==
DataFormats
.WaveAudio);
1285
dataObject.ContainsText().Should().Be(format ==
DataFormats
.UnicodeText);
1286
dataObject.ContainsText(TextDataFormat.Text).Should().Be(format ==
DataFormats
.UnicodeText);
1287
dataObject.ContainsText(TextDataFormat.UnicodeText).Should().Be(format ==
DataFormats
.UnicodeText);
1288
dataObject.ContainsText(TextDataFormat.Rtf).Should().Be(format ==
DataFormats
.Rtf);
1289
dataObject.ContainsText(TextDataFormat.Html).Should().Be(format ==
DataFormats
.Html);
1290
dataObject.ContainsText(TextDataFormat.CommaSeparatedValue).Should().Be(format ==
DataFormats
.CommaSeparatedValue);
1338
dataObject.SetData(
DataFormats
.Dib, autoConvert: true, image);
1341
dataObject.GetData(
DataFormats
.Bitmap, autoConvert: true).Should().BeSameAs(image);
1342
dataObject.GetData(
DataFormats
.Bitmap, autoConvert: false).Should().BeSameAs(image);
1345
dataObject.GetData(
DataFormats
.Dib, autoConvert: true).Should().BeNull();
1346
dataObject.GetData(
DataFormats
.Dib, autoConvert: false).Should().BeNull();
1349
dataObject.GetDataPresent(
DataFormats
.Bitmap, autoConvert: true).Should().BeTrue();
1350
dataObject.GetDataPresent(
DataFormats
.Bitmap, autoConvert: false).Should().BeTrue();
1353
dataObject.GetDataPresent(
DataFormats
.Dib, autoConvert: true).Should().BeFalse();
1354
dataObject.GetDataPresent(
DataFormats
.Dib, autoConvert: false).Should().BeFalse();
1395
theoryData.Add(format, autoConvert, null, format ==
DataFormats
.FileDrop, format ==
DataFormats
.Bitmap);
1396
theoryData.Add(format, autoConvert, "input", format ==
DataFormats
.FileDrop, format ==
DataFormats
.Bitmap);
1431
dataObject.ContainsAudio().Should().Be(format ==
DataFormats
.WaveAudio);
1434
dataObject.ContainsText().Should().Be(format ==
DataFormats
.UnicodeText);
1435
dataObject.ContainsText(TextDataFormat.Text).Should().Be(format ==
DataFormats
.UnicodeText);
1436
dataObject.ContainsText(TextDataFormat.UnicodeText).Should().Be(format ==
DataFormats
.UnicodeText);
1437
dataObject.ContainsText(TextDataFormat.Rtf).Should().Be(format ==
DataFormats
.Rtf);
1438
dataObject.ContainsText(TextDataFormat.Html).Should().Be(format ==
DataFormats
.Html);
1439
dataObject.ContainsText(TextDataFormat.CommaSeparatedValue).Should().Be(format ==
DataFormats
.CommaSeparatedValue);
1475
dataObject.ContainsAudio().Should().Be(format ==
DataFormats
.WaveAudio);
1491
dataObject.SetData(
DataFormats
.Dib, autoConvert: true, image);
1494
dataObject.GetData(
DataFormats
.Bitmap, autoConvert: true).Should().BeSameAs(image);
1495
dataObject.GetData(
DataFormats
.Bitmap, autoConvert: false).Should().BeSameAs(image);
1498
dataObject.GetData(
DataFormats
.Dib, autoConvert: true).Should().BeNull();
1499
dataObject.GetData(
DataFormats
.Dib, autoConvert: false).Should().BeNull();
1502
dataObject.GetDataPresent(
DataFormats
.Bitmap, autoConvert: true).Should().BeTrue();
1503
dataObject.GetDataPresent(
DataFormats
.Bitmap, autoConvert: false).Should().BeTrue();
1506
dataObject.GetDataPresent(
DataFormats
.Dib, autoConvert: true).Should().BeFalse();
1507
dataObject.GetDataPresent(
DataFormats
.Dib, autoConvert: false).Should().BeFalse();
1597
((Action)(() => dataObject.SetData(
DataFormats
.Dib, false, new Bitmap(10, 10))))
1615
dataObject.GetData(
DataFormats
.FileDrop, autoConvert: true).Should().BeEquivalentTo(filePaths.Cast<string>());
1616
dataObject.GetData(
DataFormats
.FileDrop, autoConvert: false).Should().BeEquivalentTo(filePaths.Cast<string>());
1623
dataObject.GetDataPresent(
DataFormats
.FileDrop, autoConvert: true).Should().BeTrue();
1624
dataObject.GetDataPresent(
DataFormats
.FileDrop, autoConvert: false).Should().BeTrue();
1640
.Setup(o => o.SetData(
DataFormats
.FileDrop, true, It.IsAny<string[]>()))
1643
mockDataObject.Verify(o => o.SetData(
DataFormats
.FileDrop, true, It.IsAny<string[]>()), Times.Once());
1652
.Setup(o => o.SetData(
DataFormats
.FileDrop, true, It.IsAny<string[]>()))
1656
mockDataObject.Verify(o => o.SetData(
DataFormats
.FileDrop, true, It.IsAny<string[]>()), Times.Once());
1675
dataObject.GetData(
DataFormats
.Bitmap, autoConvert: true).Should().BeSameAs(image);
1676
dataObject.GetData(
DataFormats
.Bitmap, autoConvert: false).Should().BeSameAs(image);
1679
dataObject.GetData(
DataFormats
.Dib, autoConvert: true).Should().BeNull();
1680
dataObject.GetData(
DataFormats
.Dib, autoConvert: false).Should().BeNull();
1683
dataObject.GetDataPresent(
DataFormats
.Bitmap, autoConvert: true).Should().BeTrue();
1684
dataObject.GetDataPresent(
DataFormats
.Bitmap, autoConvert: false).Should().BeTrue();
1687
dataObject.GetDataPresent(
DataFormats
.Dib, autoConvert: true).Should().BeFalse();
1688
dataObject.GetDataPresent(
DataFormats
.Dib, autoConvert: false).Should().BeFalse();
1701
.Setup(o => o.SetData(
DataFormats
.Bitmap, true, image))
1704
mockDataObject.Verify(o => o.SetData(
DataFormats
.Bitmap, true, image), Times.Once());
1714
.Setup(o => o.SetData(
DataFormats
.Bitmap, true, image))
1718
mockDataObject.Verify(o => o.SetData(
DataFormats
.Bitmap, true, image), Times.Once());
1743
dataObject.GetData(
DataFormats
.UnicodeText, autoConvert: true).Should().BeSameAs(textData);
1744
dataObject.GetData(
DataFormats
.UnicodeText, autoConvert: false).Should().BeSameAs(textData);
1745
dataObject.GetData(
DataFormats
.Text, autoConvert: true).Should().BeSameAs(textData);
1746
dataObject.GetData(
DataFormats
.Text, autoConvert: false).Should().BeNull();
1747
dataObject.GetData(
DataFormats
.StringFormat, autoConvert: true).Should().BeSameAs(textData);
1748
dataObject.GetData(
DataFormats
.StringFormat, autoConvert: false).Should().BeNull();
1749
dataObject.GetData(
DataFormats
.Rtf, autoConvert: true).Should().BeNull();
1750
dataObject.GetData(
DataFormats
.Rtf, autoConvert: false).Should().BeNull();
1751
dataObject.GetData(
DataFormats
.Html, autoConvert: true).Should().BeNull();
1752
dataObject.GetData(
DataFormats
.Html, autoConvert: false).Should().BeNull();
1753
dataObject.GetData(
DataFormats
.CommaSeparatedValue, autoConvert: true).Should().BeNull();
1754
dataObject.GetData(
DataFormats
.CommaSeparatedValue, autoConvert: false).Should().BeNull();
1757
dataObject.GetDataPresent(
DataFormats
.UnicodeText, autoConvert: true).Should().BeTrue();
1758
dataObject.GetDataPresent(
DataFormats
.UnicodeText, autoConvert: false).Should().BeTrue();
1759
dataObject.GetDataPresent(
DataFormats
.Text, autoConvert: true).Should().BeFalse();
1760
dataObject.GetDataPresent(
DataFormats
.Text, autoConvert: false).Should().BeFalse();
1761
dataObject.GetDataPresent(
DataFormats
.StringFormat, autoConvert: true).Should().BeFalse();
1762
dataObject.GetDataPresent(
DataFormats
.StringFormat, autoConvert: false).Should().BeFalse();
1763
dataObject.GetDataPresent(
DataFormats
.Rtf, autoConvert: true).Should().BeFalse();
1764
dataObject.GetDataPresent(
DataFormats
.Rtf, autoConvert: false).Should().BeFalse();
1765
dataObject.GetDataPresent(
DataFormats
.Html, autoConvert: true).Should().BeFalse();
1766
dataObject.GetDataPresent(
DataFormats
.Html, autoConvert: false).Should().BeFalse();
1767
dataObject.GetDataPresent(
DataFormats
.CommaSeparatedValue, autoConvert: true).Should().BeFalse();
1768
dataObject.GetDataPresent(
DataFormats
.CommaSeparatedValue, autoConvert: false).Should().BeFalse();
1792
.Setup(o => o.SetData(
DataFormats
.UnicodeText, false, textData))
1796
mockDataObject.Verify(o => o.SetData(
DataFormats
.UnicodeText, false, textData), Times.Once());
1822
dataObject.GetData(
DataFormats
.UnicodeText, autoConvert: true).Should().Be(expectedUnicodeText);
1823
dataObject.GetData(
DataFormats
.UnicodeText, autoConvert: false).Should().Be(expectedUnicodeText);
1824
dataObject.GetData(
DataFormats
.Text, autoConvert: true).Should().Be(expectedUnicodeText);
1825
dataObject.GetData(
DataFormats
.Text, autoConvert: false).Should().BeNull();
1826
dataObject.GetData(
DataFormats
.StringFormat, autoConvert: true).Should().Be(expectedUnicodeText);
1827
dataObject.GetData(
DataFormats
.StringFormat, autoConvert: false).Should().BeNull();
1828
dataObject.GetData(
DataFormats
.Rtf, autoConvert: true).Should().Be(expectedRtfText);
1829
dataObject.GetData(
DataFormats
.Rtf, autoConvert: false).Should().Be(expectedRtfText);
1830
dataObject.GetData(
DataFormats
.Html, autoConvert: true).Should().Be(expectedHtmlText);
1831
dataObject.GetData(
DataFormats
.Html, autoConvert: false).Should().Be(expectedHtmlText);
1832
dataObject.GetData(
DataFormats
.CommaSeparatedValue, autoConvert: true).Should().Be(expectedCsvText);
1833
dataObject.GetData(
DataFormats
.CommaSeparatedValue, autoConvert: false).Should().Be(expectedCsvText);
1836
dataObject.GetDataPresent(
DataFormats
.UnicodeText, autoConvert: true).Should().Be(expectedUnicodeText is not null);
1837
dataObject.GetDataPresent(
DataFormats
.UnicodeText, autoConvert: false).Should().Be(expectedUnicodeText is not null);
1838
dataObject.GetDataPresent(
DataFormats
.Text, autoConvert: true).Should().BeFalse();
1839
dataObject.GetDataPresent(
DataFormats
.Text, autoConvert: false).Should().BeFalse();
1840
dataObject.GetDataPresent(
DataFormats
.StringFormat, autoConvert: true).Should().BeFalse();
1841
dataObject.GetDataPresent(
DataFormats
.StringFormat, autoConvert: false).Should().BeFalse();
1842
dataObject.GetDataPresent(
DataFormats
.Rtf, autoConvert: true).Should().Be(expectedRtfText is not null);
1843
dataObject.GetDataPresent(
DataFormats
.Rtf, autoConvert: false).Should().Be(expectedRtfText is not null);
1844
dataObject.GetDataPresent(
DataFormats
.Html, autoConvert: true).Should().Be(expectedHtmlText is not null);
1845
dataObject.GetDataPresent(
DataFormats
.Html, autoConvert: false).Should().Be(expectedHtmlText is not null);
1846
dataObject.GetDataPresent(
DataFormats
.CommaSeparatedValue, autoConvert: true).Should().Be(expectedCsvText is not null);
1847
dataObject.GetDataPresent(
DataFormats
.CommaSeparatedValue, autoConvert: false).Should().Be(expectedCsvText is not null);
1855
theoryData.Add(textData, TextDataFormat.Text,
DataFormats
.UnicodeText);
1856
theoryData.Add(textData, TextDataFormat.UnicodeText,
DataFormats
.UnicodeText);
1857
theoryData.Add(textData, TextDataFormat.Rtf,
DataFormats
.Rtf);
1858
theoryData.Add(textData, TextDataFormat.Html,
DataFormats
.Html);
1859
theoryData.Add(textData, TextDataFormat.CommaSeparatedValue,
DataFormats
.CommaSeparatedValue);
1922
data.GetData(
DataFormats
.EnhancedMetafile).Should().BeNull();
2105
{
DataFormats
.Bitmap, TYMED.TYMED_GDI },
2106
{
DataFormats
.CommaSeparatedValue, TYMED.TYMED_HGLOBAL },
2107
{
DataFormats
.Dib, TYMED.TYMED_HGLOBAL },
2108
{
DataFormats
.Dif, TYMED.TYMED_HGLOBAL },
2109
{
DataFormats
.EnhancedMetafile, TYMED.TYMED_HGLOBAL },
2110
{
DataFormats
.FileDrop, TYMED.TYMED_HGLOBAL },
2113
{
DataFormats
.Html, TYMED.TYMED_HGLOBAL },
2114
{
DataFormats
.Locale, TYMED.TYMED_HGLOBAL },
2115
{
DataFormats
.MetafilePict, TYMED.TYMED_HGLOBAL },
2116
{
DataFormats
.OemText, TYMED.TYMED_HGLOBAL },
2117
{
DataFormats
.Palette, TYMED.TYMED_HGLOBAL },
2118
{
DataFormats
.PenData, TYMED.TYMED_HGLOBAL },
2119
{
DataFormats
.Riff, TYMED.TYMED_HGLOBAL },
2120
{
DataFormats
.Rtf, TYMED.TYMED_HGLOBAL },
2121
{
DataFormats
.Serializable, TYMED.TYMED_HGLOBAL },
2122
{
DataFormats
.StringFormat, TYMED.TYMED_HGLOBAL },
2123
{
DataFormats
.SymbolicLink, TYMED.TYMED_HGLOBAL },
2124
{
DataFormats
.Text, TYMED.TYMED_HGLOBAL },
2125
{
DataFormats
.Tiff, TYMED.TYMED_HGLOBAL },
2126
{
DataFormats
.UnicodeText, TYMED.TYMED_HGLOBAL },
2127
{
DataFormats
.WaveAudio, TYMED.TYMED_HGLOBAL }
2165
result[0].cfFormat.Should().Be(unchecked((short)(ushort)(
DataFormats
.GetFormat(format1).Id)));
2247
.Returns(["Format1",
DataFormats
.Bitmap, "Format2"]);
2268
result[0].cfFormat.Should().Be(unchecked((short)(ushort)(
DataFormats
.GetFormat("Format1").Id)));
2278
result[0].cfFormat.Should().Be(unchecked((short)(ushort)(
DataFormats
.GetFormat("Format2").Id)));
2355
result[0].cfFormat.Should().Be(unchecked((short)(ushort)(
DataFormats
.GetFormat(format1).Id)));
2452
{ TextDataFormat.Rtf, (short)
DataFormats
.GetFormat(
DataFormats
.Rtf).Id },
2453
{ TextDataFormat.Html, (short)
DataFormats
.GetFormat(
DataFormats
.Html).Id }
2910
DataObject native = new(
DataFormats
.Locale, value);
System\Windows\Forms\DragDropHelperTests.cs (1)
14
System.Windows.Forms.
DataFormats
.Format>;
System\Windows\Forms\RichTextBoxTests.ClipboardTests.cs (6)
46
richTextBox1.Paste(
DataFormats
.GetFormat(
DataFormats
.Text));
58
richTextBox1.Paste(
DataFormats
.GetFormat(
DataFormats
.Text));
79
richTextBox1.Paste(
DataFormats
.GetFormat(
DataFormats
.Rtf));
System\Windows\Forms\RichTextBoxTests.cs (7)
7841
yield return new object[] {
DataFormats
.GetFormat(
DataFormats
.Palette), false };
7842
yield return new object[] { new
DataFormats
.Format("UnknownName", int.MaxValue), false };
7847
public void RichTextBox_CanPaste_Invoke_ReturnsExpected(
DataFormats
.Format format, bool expected)
7856
public void RichTextBox_CanPaste_InvokeWithHandle_ReturnsExpected(
DataFormats
.Format format, bool expected)
7889
Assert.Equal(expected, control.CanPaste(
DataFormats
.GetFormat(
DataFormats
.Text)));
System.Windows.Forms.TestUtilities (19)
Data\DataObjectTestHelpers.cs (19)
17
DataFormats
.Text,
18
DataFormats
.UnicodeText,
20
DataFormats
.Rtf,
21
DataFormats
.Html,
22
DataFormats
.OemText,
23
DataFormats
.FileDrop,
30
DataFormats
.Serializable,
37
DataFormats
.CommaSeparatedValue,
38
DataFormats
.Dib,
39
DataFormats
.Dif,
40
DataFormats
.PenData,
41
DataFormats
.Riff,
42
DataFormats
.Tiff,
43
DataFormats
.WaveAudio,
44
DataFormats
.SymbolicLink,
45
DataFormats
.EnhancedMetafile,
46
DataFormats
.MetafilePict,
47
DataFormats
.Palette
52
DataFormats
.Bitmap,
System.Windows.Forms.UI.IntegrationTests (10)
DragDropTests.cs (10)
288
if (e.Data?.GetDataPresent(
DataFormats
.Serializable) ?? false)
295
if (e.Data?.GetDataPresent(
DataFormats
.Serializable) ?? false)
298
data = (ListViewItem?)e.Data?.GetData(
DataFormats
.Serializable);
312
data.SetData(
DataFormats
.Serializable, listViewItem);
1089
DataObject data = new(
DataFormats
.FileDrop, dropFiles);
1107
&& e.Data.GetDataPresent(
DataFormats
.FileDrop)
1108
&& e.Data.GetData(
DataFormats
.FileDrop) is string[] fileNames
1122
&& e.Data.GetDataPresent(
DataFormats
.FileDrop)
1123
&& e.Data.GetData(
DataFormats
.FileDrop) is string[] fileNames
1149
DataObject data = new(
DataFormats
.FileDrop, dropFiles);
TrimTest (3)
Form1.cs (3)
19
if (e.Data is { } dataObject && dataObject.GetDataPresent(
DataFormats
.UnicodeText))
27
if (e.Data is { } dataObject && dataObject.GetDataPresent(
DataFormats
.UnicodeText))
35
if (e.Data is { } dataObject && dataObject.GetData(
DataFormats
.UnicodeText) is string text)
WinFormsControlsTest (11)
DragDrop.cs (11)
112
if (e.Data.GetDataPresent(
DataFormats
.FileDrop)
113
&& e.Data.GetData(
DataFormats
.FileDrop) is string[] files
159
if (e.Data.GetDataPresent(
DataFormats
.FileDrop)
160
&& e.Data.GetData(
DataFormats
.FileDrop) is string[] files
252
else if (e.Data.GetDataPresent(
DataFormats
.FileDrop)
253
&& e.Data.GetData(
DataFormats
.FileDrop) is string[] files
294
else if (e.Data.GetDataPresent(
DataFormats
.FileDrop)
295
&& e.Data.GetData(
DataFormats
.FileDrop) is string[] files
317
if (e.Data.GetDataPresent(
DataFormats
.FileDrop)
346
&& e.Data.GetDataPresent(
DataFormats
.FileDrop)
537
DataObject data = new(
DataFormats
.FileDrop,