Commit Graph

2341 Commits

Author SHA1 Message Date
Reece Wilson
d329a01a0c
Merge pull request #1 from wxWidgets/master
Pull upstream branch
2020-10-12 04:50:08 +01:00
ali kettab
fedc80eee3 Improve selection and focus events generation in wxGenericLisCtrl
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
2020-10-10 19:13:52 +02:00
PB
952e5f32cd Fix generation of extraneous wxEVT_SLIDER events in wxMSW
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/2080

Closes #18929.
2020-10-10 18:21:27 +02:00
Vadim Zeitlin
7ed330a197 Merge branch 'image-paste-fix'
Fix recent regression resulting in a crash in wxImage::Paste().

See https://github.com/wxWidgets/wxWidgets/pull/2076
2020-10-10 18:12:35 +02:00
Pavel Tyunin
c9dd9e96a1
Allow decoding even shorter strings in fallback encoding
Complete UTF-8 characters (except leading nulls) never appear in failed decoding attempts when the input is fed byte by byte.
2020-10-07 17:31:42 +03:00
Pavel Tyunin
1cbcf24832
Make leading nulls a special case to avoid breaking decoding some short strings in fallback encoding 2020-10-07 17:02:06 +03:00
Hartwig
728f2f958f 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.
2020-10-06 00:48:48 +02:00
Vadim Zeitlin
d58f9bea72 Rearrange sections in wxImage::Paste unit test
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.
2020-10-06 00:40:59 +02:00
Vadim Zeitlin
cb5e0d221c Fix running new wxImage::Paste() unit tests from build directory
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.
2020-10-06 00:37:56 +02:00
b3c612268b update check config to work without cario on win32/macos 2020-10-05 15:46:22 +01:00
Pavel Tyunin
4832565e10
Rename IsFallbackEncoding() to IsUsingFallbackEncoding() 2020-10-05 15:32:07 +03:00
Pavel Tyunin
45adce8561
Fix wxTextInputStream for some inputs starting with nulls 2020-10-03 19:49:46 +03:00
Pavel Tyunin
b3eff48e28
Switch to fallback earlier if the input is not valid UTF-8 prefix 2020-10-03 19:49:46 +03:00
Pavel Tyunin
857950c626
Add more wxConvAuto test cases 2020-10-03 19:49:40 +03:00
Pavel Tyunin
3676635231
Check wxConvAuto state in tests 2020-10-03 19:47:06 +03:00
Eric Raijmakers
ec8bfbebdc Fix wrong step size in wxImage::Paste()
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
2020-10-02 14:54:40 +02:00
Vadim Zeitlin
123044c68c Merge branch 'fix-caret-default'
Fix using default-constructed wxCaret.

See https://github.com/wxWidgets/wxWidgets/pull/2007
2020-10-01 02:29:43 +02:00
Vadim Zeitlin
88f808e303 Add a unit test for wxCaret::Create()
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.
2020-10-01 02:28:42 +02:00
oneeyeman1
61ef150044 Implement GetStringSelection() in generic wxBitmapComboBox
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
2020-10-01 02:19:12 +02:00
Eric Raijmakers
1f0ade29f0 Fix using mask colour even if there is no mask in wxImage::Paste
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
2020-10-01 02:13:28 +02:00
Artur Wieczorek
d00ca6a172 Add more unit tests of coordinates conversion functions 2020-09-27 13:38:41 +02:00
Artur Wieczorek
6fac6c0b35 Add unit tests of coordinates conversion functions 2020-09-26 01:43:20 +02:00
Eric Raijmakers
6e8da8641c Add alpha blending for wxImage::Paste
Add test cases for wxImage::Paste.

Closes #12458.

Co-Authored-By: Rachel Mark <kramdar@gmail.com>
2020-09-25 01:04:49 +02:00
Vadim Zeitlin
1f1a9d52d6 Merge branch 'expose-radiogroup'
Add public functions for navigating in radio button groups.

Also introduce wxRadioButtonBase defining wxRadioButton API for all
ports.

See https://github.com/wxWidgets/wxWidgets/pull/2052
2020-09-24 00:11:15 +02:00
Vadim Zeitlin
b84bc8e26a Add unit tests for radio button group navigation functions
Extend the existing "group" and "single" tests to check these functions
too.

This at least verifies that these functions can be used.
2020-09-21 15:54:42 +02:00
Vadim Zeitlin
ee55427c28 Make it simpler to write useful tests comparing windows
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.
2020-09-21 15:54:42 +02:00
Vadim Zeitlin
46a21e5aba Use wxScopedPtr<> instead of manual delete in wxRadioButton test
Make the test code safer and ensure that no controls created here remain
alive after the test end.
2020-09-21 15:18:22 +02:00
Vadim Zeitlin
fceaa907a8 Remove CppUnit boilerplate from wxRadioButton unit test
Replace CppUnit test case class with a simple fixture and use CHECK()
instead of CPPUNIT_ASSERT_XXX().

No real changes.
2020-09-21 15:15:37 +02:00
Vadim Zeitlin
50fc4eb1f3 Work around spurious Travis CI failures in WebView selection test
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.
2020-09-20 23:19:09 +02:00
Paul Cornett
4ebfe0059a Pre-include another header for Cygwin
Avoid -Wpedantic warning for extra ';'
2020-09-13 08:27:45 -07:00
Vadim Zeitlin
0a053580c0 Use wxEVT_GRID_RANGE_SELECTED instead of deprecated SELECT
Fix building the tests with WXWIN_COMPATIBILITY_3_0 disabled.
2020-09-01 15:04:39 +02:00
Vadim Zeitlin
b9f946fcd3 Merge branch 'check-headers-max-warn'
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
2020-08-31 15:10:16 +02:00
Vadim Zeitlin
82f7cb6e9b Merge branch 'art-ids-literals'
Revert art ids changes and make them `char*` literals again.

See https://github.com/wxWidgets/wxWidgets/pull/2031
2020-08-31 14:51:52 +02:00
Vadim Zeitlin
2a17eef2ed Pre-include even more standard headers with MinGW/Cygwin
Avoid -Wredundant-decls when including them later by pre-including them
before enabling this warning.
2020-08-31 12:40:50 +02:00
Vadim Zeitlin
03bc49de2d Include <windows.h> before enabling all the warnings
This avoids tons of -Wredundant-decls and -Wnon-virtual-dtor (given for
all OLE interfaces).
2020-08-31 12:40:50 +02:00
Vadim Zeitlin
6f9390306d Disable -Wsuggest-final-xxx in the headers for now
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.
2020-08-31 12:40:50 +02:00
Vadim Zeitlin
3bbefcdd74 Don't trigger warnings in standard headers when building wxQt
Pre-include QFont header in wxQt to avoid warnings for the other headers
included from it.
2020-08-31 01:25:45 +02:00
Vadim Zeitlin
266c3a962f Disable -Winline as we can't ensure all functions are inlined
It doesn't really make sense to enable this for C++ code, with a lot of
implicitly inline functions.
2020-08-31 01:25:07 +02:00
Vadim Zeitlin
1861065ef2 Disable -Wformat in system headers
This is given for the use of %zu by gcc 5.4.
2020-08-31 01:25:07 +02:00
Vadim Zeitlin
23334af81b Test headers compilation with maximum warnings options with gcc
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.
2020-08-31 01:24:57 +02:00
Andreas Falkenhahn
a59901f8f1 Fix bug in CanUndo() returning true after wxTextCtrl creation
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/2010

Closes #17524.
2020-08-25 18:10:20 +02:00
Vadim Zeitlin
30fc873626 Remove useless hdrstop pragma from allheaders test
It shouldn't be necessary for a test not using PCH at all and Borland
compiler is almost certainly not supported anyhow any longer.
2020-08-25 16:54:23 +02:00
Vadim Zeitlin
825fd01beb Test XRC headers compilation without implicit wxString conversion
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.
2020-08-24 16:47:37 +02:00
Vadim Zeitlin
ff3cb34d18 Add a unit test for using bitmaps with image and empty label
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.
2020-08-21 20:21:17 -07:00
Vadim Zeitlin
ae1bcc5cb2 Show only the first difference when images differ in the tests
The code was supposed to do this, but didn't, as "break" only broke from
the inner loop, but not the outer one, so replace it with "return".
2020-08-15 16:16:45 +02:00
Vadim Zeitlin
5a27ea9a86 Merge branch 'fix_grid_deselect' of https://github.com/swt2c/wxWidgets
Fix regression in wxGrid::DeselectRow() and wxGrid::DeselectCol() and
add unit tests for them.

See https://github.com/wxWidgets/wxWidgets/pull/2017
2020-08-14 19:27:48 +02:00
PB
a4647825cb Do not use wxRegEx in wxCmpNaturalGeneric()
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
2020-08-14 19:26:33 +02:00
Vadim Zeitlin
bb93682a87 Improve wxGrid selection test slightly
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.
2020-08-14 12:41:10 +02:00
Vadim Zeitlin
4475df8264 Add unit tests for wxGrid::Deselect{Row,Col}()
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.
2020-08-14 12:36:46 +02:00
ali kettab
2256dac384 Enable wxSlider "Thumb" unit test under GTK too
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
2020-08-05 22:46:04 +02:00