Fix comparing wxDataFormat with wxDF_INVALID in wxGTK
Define wxDataFormat::operator==(wxDataFormatId) instead of relying on the implicit conversion from wxDataFormatId to wxDataFormat, as this can't be done when the format ID is wxDF_INVALID because creating wxDataFormat results in an assert failure in this case, while comparing with wxDF_INVALID is clearly a perfectly valid operation. Add a unit test checking for this. Closes #22213.
This commit is contained in:
@@ -70,6 +70,13 @@ TEST_CASE("GUI::URLDataObject", "[guifuncs]")
|
||||
CHECK( wxTheClipboard->SetData(dobj) );
|
||||
wxTheClipboard->Flush();
|
||||
}
|
||||
|
||||
TEST_CASE("GUI::DataFormatCompare", "[guifuncs][dataformat]")
|
||||
{
|
||||
const wxDataFormat df(wxDF_TEXT);
|
||||
CHECK( df == wxDF_TEXT );
|
||||
CHECK( df != wxDF_INVALID );
|
||||
}
|
||||
#endif // wxUSE_DATAOBJ
|
||||
|
||||
TEST_CASE("GUI::ParseFileDialogFilter", "[guifuncs]")
|
||||
|
||||
Reference in New Issue
Block a user