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 unit tests checking that the behaviour really corresponds to the
documentation too.
And also mention that it's not a good idea to have strings differing by case
only in wxComboBox anyhow.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66442 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Changes of r66379 broke the unit test as wxAcceleratorEntry::Create() now
requires the TAB to be present in the string passed to it (again).
Update the test to make it pass.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66380 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
The logical value of wxSlider was changed when its range was changed in wxMSW
if the slider had wxSL_INVERSE style because the logical value was actually
computed using the range and the actual physical control value and we forgot
to update the latter when changing the range.
Do update it now in SetRange() to fix this.
Also add unit tests checking for this and, more generally, for other
operations with inversed sliders.
Closes#12765.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66368 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
FromString() should parse string returned by ToString() successfully but this
wasn't the case because the accelerator parsing functions always insisted on
having a TAB in the string.
Fix this, document the string format and add a unit test checking for the
correct behaviour.
Closes#12745.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66308 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Check that Insert() returns the index of the last inserted item.
Also document this behaviour for mulit-item renames explicitly.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66278 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Even though this behaviour is somewhat counterintuitive, the documentation
mentions that this is what should happen and wxGTK and wxOSX already behave
like this so bring wxMSW in line.
wxListBox::DeselectAll() should probably just call SetSelection(wxNOT_FOUND)
when the item to leave selected is not specified too now.
Closes#12705.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66243 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
GetFamily() returns wxFONTFAMILY_DEFAULT and not wxFONTFAMILY_UNKNOWN since
r65670.
Correct the test to handle wxFONTFAMILY_DEFAULT as allowed value.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66221 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This change is not needed any longer after r66219 which fixed the real
underlying problem, i.e. that attempting to load an invalid XRC file resulted
in failures when loading all subsequent XRC files.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66220 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
The path being normalized could have come from user and there doesn't seem to
be any point in complaining about too many ".."s in it when we can handle them
correctly instead.
So simply ignore the extra ".."s for the absolute paths and keep them
unchanged for the relative ones instead of returning an error.
See #10960.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66218 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
wxMenu::GetTitle() returned a string in GTK+ format (i.e. using underscores
instead of ampersands) instead of the expected wx one.
This is, of course, the right thing to do and it also fixes
wxMenuBar::FindMenuItem() as a side effect.
Closes#12672.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66175 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
A virtual list control must override wxListCtrl::OnGetItemText() method and
wxMSW native implementation asserts if this is not the case (the generic one
should arguably do it as well).
Avoid the asserts by providing a dummy implementation of OnGetItemText() in
the unit test.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66171 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Fixing the implicit focus grabbing by wxTreeCtrl::SelectItem() in r65905 broke
its unit test case as the simulated key event was not delivered to wxTreeCtrl
itself any more.
Fix this by simply setting the focus to the tree explicitly before sending it
any key strokes.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66170 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Parsing an incomplete date with nothing but whitespace and/or date delimiter
characters at the end crashed as we happily went beyond the end of string.
Fix this by not using a loop which didn't check for the iterator validity.
Closes#12685.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66166 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
wxOSX rearranges the standard menu items such as wxID_EXIT and wxID_ABOUT and,
for the former, changes its text to "Quit", so don't use them in the menu unit
test which expects to find the items in the menus to which they were added and
exactly with the labels used when adding them.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66144 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Disable unit tests involving operations (such as conversions between UTF and
anything but plain ASCII) not available in ANSI build.
This fixes the test suite for non-Unicode build under Unix.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66103 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
In ANSI build wxString::mb_str() returns a pointer to the internal wxString
data directly instead of a buffer with a proper length, so it provides access
to the part of the string before the first embedded NUL only.
Use To8BitData() which always returns the buffer of the correct size in all
builds.
The open question remains whether mb_str() should be changed to return a (non
owned) buffer and not just a pointer in ANSI build. This would make
manipulating strings with embedded NULs safer but mb_str() would be less
efficient and less compatible.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66102 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
The test used a wide character constant and so didn't work in ANSI build. Use
an ASCII string there now while still keeping the original version in Unicode
build.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66101 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
wxCairoRenderer::CreateMeasuringContext() is only implemented for wxGTK so the
test fails under other ports when using Cairo. Disable it for wxX11 for now.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66095 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Leaving invalid XRC entries in wxXmlResource internal list of loaded resources
resulted in failures in the XRC unit test which executed after this one.
It seems that loading an invalid resource shouldn't prevent the other ones
from loading correctly later and this probably should be corrected at
wxXmlResource level but for now work around this problem in the test itself.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66070 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Allow to declare ranges of consecutive IDs in XRC by using the "id[n]" syntax.
Show this functionality in the xrc sample and test it in the new unit test.
Also show and test the "object reference" XRC functionality.
Closes#11431.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66059 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
The test doesn't work because the test window never get any events. This might
be a bug in the test or in wxUIActionSimulator itself but for now I just have
no idea about how to fix it, so disable the test to let the rest of the test
suite run.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66026 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Select an item initially to prevent GTK from doing it automatically as soon as
the listbox is clicked anywhere (even outside of the items area).
This makes all GUI tests finally pass under wxGTK.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65938 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
wxMax, wxMin and wxClip work correctly when called with a mix of signed and
unsigned arguments but give warnings about comparing them when compiled with
g++.
Cast both arguments to the result type, which is defined consistently with
standard C rules for implicit promotion, before comparing them to avoid this.
Also add more tests to check that using these functions in this case doesn't
provoke warnings.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65933 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This allows to search the string just once, in BeforeXXX(), when both the
parts of the string before and after some character are needed instead of
having to do it twice in both BeforeXXX() and AfterXXX().
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65862 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Only comparisons between const_iterator and iterator worked before (because of
implicit conversion from the latter to the former), implement the ones in the
other direction explicitly now.
Closes#12594.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65857 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Don't assign wxNO_LEN to int variable, this results in gcc warnings about
overflow in implicit constant conversion.
Use size_t for the variable containing string length to fix it.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65838 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
The test was intended to verify that round trip via wxFile::Write/Read()
worked even for the strings with embedded NULs but as the string wasn't
constructed correctly it didn't actually contain any NULs but was ended by the
first of them.
Fix this by using explicit length of the string as usual when dealing with
strings with embedded NULs. Also fix the conversion back to Unicode to use the
correct length.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65835 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
These tests didn't work correctly in ANSI build because the conversion
parameter of wxFile::Write() isn't used there, the contents of an ANSI
wxString is always written to the file as is -- hence reading it back using
UTF-16 or UTF-32 conversion fails.
The test would need to be totally rewritten for ANSI build of wx and it
wouldn't test wxFile but rather conversion functions already tested elsewhere
so just disable it instead.
This fixes a crash (due to passing NULL pointer to memcmp()) which prevented
the test suite from running to completion in ANSI build.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65834 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This symbol is defined for the ports that support wxCHK_3STATE style. While
most of the ports do support it, a couple still do not and having this symbol
makes it more convenient to exclude 3-state-checkbox-specific code, like in
CheckBoxTestCase.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65825 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Detect when incompatible styles are used (this required changing the value of
wxCHK_2STATE to be non-null) and sanitize the styles (after asserting) in this
case.
Put the validation code in wxCheckBoxBase instead of having slightly different
versions of it in port-specific wxCheckBox implementations.
Add a unit test checking that the expected asserts are indeed generated.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65824 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This is more than a cosmetic change: adding "GTK" prefix in wxComboBox and not
doing it in wxChoice in r64436 broke the event generation for wxComboBox as it
didn't override wxChoice methods any longer but defined its own (useless) ones.
Using the same name for the methods in both classes notably fixes unexpected
event generation from wxComboBox::SetSelection().
Closes#12568.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65818 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
If the in-place text control was still alive when wxGenericListCtrl was
destroyed, it resulted in asserts from wxWindow dtor about child windows still
being alive, so explicitly destroy it from wxListMainWindow dtor.
As this required a slightly different behaviour from wxListTextCtrlWrapper::
EndEdit(), replace its bool argument with an enum one which can take more than
2 values. Not using bool values when calling it also made the code more clear.
Finally, added a unit test verifying that the in-place control is indeed
destroyed correctly.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65769 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This test crashes for unknown reasons on wxGTK ANSI build slave and prevents
the rest of the test suite from running, so disable it for now.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65768 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775