Fix crash in wxImage::Paste() when using images without alpha

Check for the presence of alpha channel before using it in the fallback
code.

Also add a unit test exercising this branch of the code and which
crashed before.
This commit is contained in:
Hartwig
2020-10-05 18:17:16 +02:00
committed by Vadim Zeitlin
parent d58f9bea72
commit 728f2f958f
2 changed files with 8 additions and 3 deletions

View File

@@ -1540,6 +1540,10 @@ TEST_CASE("wxImage::Paste", "[image][paste]")
wxImage expected(toggle_equal_size_xpm);
actual.Paste(paste, 0, 0);
CHECK_THAT(actual, RGBSameAs(expected));
// Without alpha using "compose" doesn't change anything.
actual.Paste(paste, 0, 0, wxIMAGE_ALPHA_BLEND_COMPOSE);
CHECK_THAT(actual, RGBSameAs(expected));
}
SECTION("Paste larger image")