Commit Graph

26 Commits

Author SHA1 Message Date
Vadim Zeitlin
a25b5bbfc9 Make it easier to compare wxImages in the unit tests.
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
2011-04-26 22:57:16 +00:00
Dimitri Schoolwerth
a5a0ba3dbd Fixed failing image test.
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
2011-04-03 22:41:58 +00:00
Dimitri Schoolwerth
2a6545a5a7 Fixed buffer overflow when saving certain images in the Windows icon format.
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
2011-03-23 15:20:25 +00:00
Dimitri Schoolwerth
8529b0b909 Improved palette handling with saving PNG files.
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
2011-03-01 21:29:17 +00:00
Dimitri Schoolwerth
15f345aad3 Added support for reading comments from a GIF image.
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
2011-02-02 11:19:30 +00:00
Dimitri Schoolwerth
fdfedfc077 Fixed heap corruption when reading a corrupted RLE TGA image.
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
2011-01-25 11:23:42 +00:00
Dimitri Schoolwerth
77b83d0a0f Added GIF and animated GIF saving support.
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
2011-01-19 12:28:31 +00:00
Dimitri Schoolwerth
818bc81a8b removed some leftover debugging code
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66715 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-01-19 11:30:27 +00:00
Dimitri Schoolwerth
b057ac075b Fixed saving PNG in wrong format sometimes.
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
2011-01-07 08:48:43 +00:00
Dimitri Schoolwerth
5d875c119e fixed compilation of image test units when wxUSE_PALETTE is set to 0
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66589 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-01-05 11:37:52 +00:00
Vadim Zeitlin
2960bae821 Fix wxImage test compilation for MSVC6.
Don't reuse variables declared inside for loops as VC6 doesn't implement
proper scoping for them.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66583 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-01-04 23:48:09 +00:00
Dimitri Schoolwerth
8ee313d2be Added support for saving PNG files with palette.
Based on (heavily modified) patch by troelsk.

Closes #12505.



git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66552 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-01-03 22:22:16 +00:00
Dimitri Schoolwerth
3d926ff8a9 Added saving support to TGA image handler.
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
2010-12-28 22:38:04 +00:00
Dimitri Schoolwerth
5828d76add Expanded existing image saving test to also verify alpha content of saved images.
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
2010-12-28 22:05:01 +00:00
Dimitri Schoolwerth
2b39567fd4 Added some simple unit tests for verifying pixel content of loaded and saved images.
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
2010-12-28 19:50:41 +00:00
Vadim Zeitlin
232fdc630c Merge the new GUI tests from SOC2010_GUI_TEST branch.
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
2010-08-22 22:16:05 +00:00
Vadim Zeitlin
686d0cc0a6 Don't report spurious errors from wxSocket in "no wait" mode.
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
2010-08-21 23:33:40 +00:00
Vadim Zeitlin
51fe41000c Disable ImageTestCase::LoadFromFile() on build slaves.
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
2010-04-24 17:52:27 +00:00
Vadim Zeitlin
2e51fb3041 Correct wxImage::Size() again; add unit tests for it.
wxImage::Size() didn't handle the paste position correctly.

Closes #7874.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61792 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-08-30 21:43:11 +00:00
Francesco Montorsi
9e91447ca4 minor change: differentiate the initial banner of test.exe from test_gui.exe
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60859 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-06-01 14:46:44 +00:00
Francesco Montorsi
c99214eb52 add check about network connectivity; don't run the test if it's not available
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60858 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-06-01 14:45:26 +00:00
Francesco Montorsi
53c2cdb0b1 fix PCH-less build
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60854 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-06-01 12:40:50 +00:00
Francesco Montorsi
21fe35aff7 add wxImage test units to test loading from both seekable and non-seekable streams
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60853 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-06-01 11:46:36 +00:00
Vadim Zeitlin
60235673ec fix a bug in the test which was corrupting 1 byte beyond wxImage buffer
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54773 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-07-23 23:23:23 +00:00
Vadim Zeitlin
24671bc900 define wxHAS_RAW_BITMAP (instead of inconsistenly named wxHAVE_RAW_BITMAP) and use it to avoid test build error under ports not supporting raw bitmaps
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53907 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-06-01 18:42:33 +00:00
Vadim Zeitlin
3e50a139b4 fixed wxImagePixelData compilation (ticket #3003); added a unit test for it (to be extended to cover more wxImage methods...)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53852 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-05-30 19:30:23 +00:00