Avoid sending spurious wxEVT_LIST_ITEM_{FOCUSED, SELECTED, DESELECTED}
events and make the generic version consistent with the behaviour of the
native wxMSW one.
Also add/extend the tests and slightly improve the sample.
Closes https://github.com/wxWidgets/wxWidgets/pull/2044
Don't send the event when it's redundant, i.e. doesn't really notify
about the change in the slider value.
Also add a test case for wxEVT_SLIDER and show these events in the
widgets sample.
Closes https://github.com/wxWidgets/wxWidgets/pull/2080Closes#18929.
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.
No real changes, just execute only the tests relevant for the section
being executed instead of always running the code loading PNG images
when running a section not using them at all.
This has the advantages of being a bit faster to execute (and the total
test suite run time does add up) and, more importantly, showing the
right amount of tests when executing a single section: e.g. now it's 1
in the simplest case, as expected, and not 5.
The disadvantage is, of course, slightly more code duplication, but it
doesn't seem a huge problem in practice and making each section code
more self-contained is arguably worth it.
Also, compensate for this somewhat by extracting all XPM definitions at
the function level: those are only initialized once (being static), so
there is no need to duplicate them.
Finally, also call AddHandler() once instead of once per section as
before.
Add new image test files added in 6e8da8641c (Add alpha blending for
wxImage::Paste, 2020-09-23) and 1f0ade29f0 (Fix using mask colour even
if there is no mask in wxImage::Paste, 2020-09-30) to Makefile, so that
they're copied to the build directory and could be found by the test
there, otherwise running wxImage::Paste test when building outside of
the source directory failed.
Fix a bug with wrong size passed to memset() introduced in 1f0ade29f0
(Fix using mask colour even if there is no mask in wxImage::Paste,
2020-09-30) which caused memory corruption and add a test (the one with
the large negative vertical offset) allowing to reproduce this reliably.
Closes https://github.com/wxWidgets/wxWidgets/pull/2067
Verify that constructing wxCaret using its default ctor and Create()
works too, now that it does -- previously it uses to result in a GTK
warning and a crash in wxGTK.
Also update the test to avoid assuming that wxBitmapComboBox inherits
from wxComboBox, which now allows it to build (and pass) on all
platforms.
Closes https://github.com/wxWidgets/wxWidgets/pull/2057
In case an image without alpha is pasted on top of an image with alpha,
the alpha blending gives wrong results. This is caused by the fact that
the final (if nothing has been pasted yet) pixel copying algorithm in
Paste() does not take into account whether the pasted image actually
uses a mask.
To fix this:
- Add the check for image.HasMask().
- In case there is no mask, simply copy the image via memcpy.
- Finally, update the alpha channel of the changed image (if present):
whenever a pixel is copied, the alpha is set to fully opaque.
Closes https://github.com/wxWidgets/wxWidgets/pull/2065
Allow creating wxWindowPtr from wxScopedPtr<> too, to avoid having to
use .get() in the test code, and add CHECK_SAME_WINDOW() macro which
gives more useful information about the windows in case of failure.
We can't rely on HasSelection() returning true immediately after calling
SelectAll() because this operation (as almost all the other ones) is
asynchronous with WebKit and might not have completed yet when we check
for the selection existence.
There doesn't seem to be any way to wait for its completion, so just
poll the selection state for some time before deciding that it hasn't
been updated. In practice, just a couple of ms is enough on a normal
machine, but wait up to 50ms on Travis just to be on the safe side.
Note that to reliably reproduce the problem locally it's enough to run
"taskset 1 ./test_gui -c Selection WebView", i.e. pin both the main and
WebKit processes to the same CPU.
Check compilation of all wx headers with all gcc warnings enabled.
This should make it impossible to introduce problems that only appear
when -Wpedantic or -Wany-other-not-completely-unreasonable-warning is
enabled when building user code including wx headers again.
See https://github.com/wxWidgets/wxWidgets/pull/2033
We don't use "final" in our code, as very few classes in wx code have
virtual functions but are not meant to be derived from in the user code.
Ideal would be to check the existing warnings and maybe apply "final" if
it's relevant and disable it otherwise, as these warnings can be useful
to build the application code with, but for now just disable them in the
test suite.
As wx headers are included from user applications which may compile with
higher warning level than wx itself, try to check headers compilation
with almost all of gcc warning flags turned on.
This notably should prevent the headers from becoming uncompilable with
-pedantic again in the future.
For wxMSW text controls with wxTE_RICH2 style, calling SetFont() counts
as an undoable operation, resulting in CanUndo() returning true even if
no "real" changes have been made yet.
Fix this by resetting the undo stack after creating the control using
ITextDocument::Undo().
Unfortunately this interface is not available in MinGW-32, so this fix
can't be used with it.
Closes https://github.com/wxWidgets/wxWidgets/pull/2010Closes#17524.
Add wx/xrc/xmlres.h to the list of headers compiled with
wxNO_IMPLICIT_WXSTRING_ENCODING to test that they can be used even when
the implicit conversions from "char*" to wxString are disabled.
This used to be broken, see #18898, and now that it is fixed by
5a70051c7e (Avoid assertion failure in wxButton with bitmap and empty
label, see #18898, 2020-08-21) add a unit test so that it stays fixed.
Using wxRegEx in wxCmpNaturalGeneric() introduced a dependency of the
base library on the regex library.
Replace wxRegEx with character classification functions wxIsspace(),
wxIspunct(), and wxIsdigit() to remove this rather unnecessary
dependency.
Closes https://github.com/wxWidgets/wxWidgets/pull/2014
Check that deselecting a row leaves the cells outside of this row
selected.
This requires passing "true" to the previous call of SelectRow() to
prevent it from clearing the existing selection, as it does by default.
These functions got broken by the changes of cdf3187fe5 (Improve rows,
columns and cells deselection in wxGrid, 2020-03-26), but this went
unnoticed because they were not covered by the unit tests, so add the
tests for them to prevent this from happening again in the future.
This was disabled, but only didn't work because wxSlider used tiny size
in wxGTK by default previously. After correcting this in aa2d159e8c (Use
more reasonable length for wxSlider in wxGTK by default, 2020-08-04),
the unit test passes with wxGTK too and can be reenabled.
Closes https://github.com/wxWidgets/wxWidgets/pull/1992