diff --git a/tests/image/image.cpp b/tests/image/image.cpp index 43d493beb9..bebc9921ee 100644 --- a/tests/image/image.cpp +++ b/tests/image/image.cpp @@ -26,6 +26,8 @@ #include "wx/mstream.h" #include "wx/zstream.h" #include "wx/wfstream.h" +#include "wx/clipbrd.h" +#include "wx/dataobj.h" #include "testimage.h" @@ -1942,6 +1944,32 @@ TEST_CASE("wxImage::RGBtoHSV", "[image][rgb][hsv]") } } +TEST_CASE("wxImage::Clipboard", "[image][clipboard]") +{ +#if wxUSE_CLIPBOARD && wxUSE_DATAOBJ + wxInitAllImageHandlers(); + + wxImage imgOriginal; + REQUIRE(imgOriginal.LoadFile("horse.png") == true); + + wxImageDataObject* dobj1 = new wxImageDataObject(imgOriginal); + { + wxClipboardLocker lockClip; + REQUIRE(wxTheClipboard->SetData(dobj1) == true); + } + + wxImageDataObject dobj2; + { + wxClipboardLocker lockClip; + REQUIRE(wxTheClipboard->GetData(dobj2) == true); + } + wxImage imgRetrieved = dobj2.GetImage(); + REQUIRE(imgRetrieved.IsOk()); + + CompareImage(*wxImage::FindHandler(wxBITMAP_TYPE_PNG), imgRetrieved, 0, &imgOriginal); +#endif // wxUSE_CLIPBOARD && wxUSE_DATAOBJ +} + /* TODO: add lots of more tests to wxImage functions */