This commit is contained in:
Loni Tra 2024-09-23 16:25:37 -07:00
Родитель d16dc12b4d
Коммит 90b550b489
1 изменённых файлов: 17 добавлений и 0 удалений

Просмотреть файл

@ -2485,4 +2485,21 @@ public partial class DataObjectTests
IDataObject outData = dropTargetAccessor.CreateDelegate<CreateWinFormsDataObjectForOutgoingDropData>()(inDataPtr);
outData.Should().BeSameAs(inData);
}
[WinFormsFact]
public unsafe void DataObject_Native_GetFormats_ReturnsExpected()
{
DataObject native = new();
using Bitmap bitmap = new(10, 10);
native.SetImage(bitmap);
string customFormat = "customFormat";
native.SetData(customFormat, "custom");
// Simulate receiving DataObject from native.
DataObject data = new(ComHelpers.GetComPointer<Com.IDataObject>(native));
data.GetDataPresent(typeof(Bitmap)).Should().BeTrue();
data.GetDataPresent(customFormat).Should().BeTrue();
data.GetDataPresent("notExist").Should().BeFalse();
data.GetFormats().Should().BeEquivalentTo([typeof(Bitmap).FullName, typeof(Bitmap).Name, customFormat]);
}
}