Instead of forcing the tests to manually use memcmp(), specialize
CppUnit::assertion_traits<> for wxImage. This allows to simply use
CPPUNIT_ASSERT_EQUAL() and related macros with wxImage objects.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67616 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
ImageTestCase::DibPadding was always failing due to differences in pixel data between the decoded GIF and encoded ICO image. Instead of comparing image content just check if the saving of the ICO succeeds (prior to r67296 it would crash).
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67386 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
When an image did not have a width with a multiple of 4 the calculations for the number of padding bytes (to get a scan line DWORD aligned) would be wrong. This caused a buffer overrun when saving the 1 bits per pixel mask.
Fixes#12937.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67296 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Instead of converting alpha to a mask an attempt is made to write a palettised PNG file with an ARGB palette using a maximum of 256 transparency values where formerly just up to one was supported. GIF images with 256 colours and transparency can now also be saved as a palettised PNG instead of true colour, making the image a lot smaller.
Applied (modified) patch by troelsk. Closes#12850.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67101 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Applied (modified) patch by troelsk. Changed comments (which are allowed per frame in an animated GIF) to be read using wxIMAGE_OPTION_GIF_COMMENT with wxImage.GetOption. Added unit tests for reading and writing GIF comments.
Closes#12843.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66828 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
There were no boundary checks in place to verify an indicated repeat of pixels would still be inside the image's data. Added these checks and a unit test making sure these kind of TGAs now fail to load.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66758 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Applied (modified) patch by troelsk. Also added a basic unit test for checking the frames of a saved animated GIF (a previous unit test already handles content of a GIF with a single frame).
Closes#8583.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66716 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
When explicitly requesting saving as a palettised image but then later on that turns out to not be possible (or desired) the image would be marked as PNG_COLOR_TYPE_GRAY or PNG_COLOR_TYPE_GRAY_ALPHA. Simply set the colour type to RGB if this occurs also updated the unit test to catch this case.
This is similar to the fix in r66590 but that one was related to wxUSE_PALETTE == 0 cases.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66617 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Supports saving 24-bit and 32-bit (RGB with alpha).
Updated image unit test to verify the alpha channel of saved TGA images. Also removed a condition skipping a test which only was in place for TGA (formerly its saving handler would do nothing yet say saving was succesful).
See also #7661.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66485 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Compare the alpha data of saved images (where applicable, currently for PNG only) to a generated alpha channel. Refactored most of ImageTestCase.CompareSavedImage into (static) function CompareImage to easily compare with a 24-bit image and then a 32-bit one.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66483 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Compare the data of loaded images in different formats against a reference image (one for 8-bit images, another for 24-bit). Do the same for images saved using SaveFile. Excluded some formats because they are either lossy or don't pass the test right now.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66478 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Add a lot of tests for many wx GUI classes.
Add tests using the new wxUIActionSimulator class but disable them under OS X
as too many of them currently fail there.
Refactor the test suite to make organizing the existing tests and adding the
new ones easier.
Improve documentation using the information gathered while testing the
classes. Also update the documentation of the testing system itself.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65386 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
In wxSOCKET_NOWAIT mode wxSOCKET_WOULDBLOCK is not a real error as it's
expected and should be just discarded. Failing to do this could result in the
following scenario:
1. Try to read a big buffer with wxSOCKET_NOWAIT (setting wxSocket error to
wxSOCKET_WOULDBLOCK).
2. Process small part of it.
3. Read more data from wxSocket -- which now goes to the data containing
already cached data without going to the socket itself and this without
resetting the error.
4. Check wxSocket::Error() which turns out to be (still) true.
And this was exactly what happened in mysteriously failing unit test case
reading wxImage contents from a socket: the failure was difficult to reproduce
because it depended on how much data exactly did we read from the socket in
one go.
Fix this by resetting the error properly and reenable the unit test which was
previously disabled for the build bot, it should pass now.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65378 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This test case keeps failing erratically resulting in too many bogus build
breakage notifications. Disable it until someone has time to fix it properly.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64134 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775