Commit graph

3182 commits

Author SHA1 Message Date
Vadim Zeitlin
268b2b98e0 Use WaitForEventAt() in Grid::ReorderedColumnsCellClick test too
This test also sporadically fails on AppVeyor.
2024-01-01 22:04:41 +01:00
Paul Cornett
f1731fd672 Return index of first added image in wxImageList::Add()
This is what MSW does. Broken in c374eefd34 (Fold wxOSX-specific wxImageList into
generic version, 2018-10-30)
See #10013
2023-12-28 12:49:47 -08:00
Vadim Zeitlin
378da09c84 Fix typo in "receive" occurring a few times
This is just too annoying to see.
2023-12-27 02:56:20 +01:00
Vadim Zeitlin
5f62f30231 Use WaitForEventAt() in Grid::CellSelect test too
Try making this test more robust as well as it also sporadically fails
on AppVeyor.

Also simplify it a bit, checking for each of the expected events in turn
instead of checking for their total number at the end.
2023-12-27 02:49:53 +01:00
Vadim Zeitlin
bac0aa0e83 Merge branch 'ui-tests-fixes'
Attempt to work around failures in UI tests under AppVeyor.

See #24162.
2023-12-25 18:02:51 +01:00
Vadim Zeitlin
a2a8fc1d65 Avoid harmless MSVC shadowing warning in the test
Using "argc" and "argv" for parameter names triggers C4458 with MSVS
2022, warning about hiding class members with the same names.

As we can't rename the latter, rename the parameters to avoid this.
2023-12-25 17:56:10 +01:00
Vadim Zeitlin
2573e61c19 Fix harmless MSVC warning about uninitialized variables in a test
MSVS 2022 gave C4701 when std::isinf(d) was used below in release build.
2023-12-25 17:24:55 +01:00
Vadim Zeitlin
61edcbc5a6 Use WaitForEventAt() in Grid::CellClick test too
This test doesn't use the native header but somehow still fails on
AppVeyor and locally a very failure can be reproduced if the mouse is
moved while the test runs, so check for this here too.
2023-12-25 17:07:53 +01:00
Vadim Zeitlin
216b5a4b23 Also use WaitForEventAt() in Grid::SortClick test case
Abandon this test too if the mouse moves for whatever reason.
2023-12-25 17:07:53 +01:00
Vadim Zeitlin
8218e31418 Abandon tests waiting for mouse events if mouse moved
If the mouse pointer moves, for whatever unexplained reason, the click
is not going to happen, so don't wait for it.
2023-12-25 17:07:53 +01:00
Vadim Zeitlin
ab0a44a63a Give information about which section of grid tests fails
This is useful to see when the failure occurs exactly as the same checks
are performed in 3 different cases.
2023-12-25 15:18:05 +01:00
Artur Wieczorek
c8552aec0c Make wxPGPropertyFlags a bitmask
To improve type safety of flags.
2023-12-25 15:09:50 +01:00
Viachaslau Lisouski
ca405352e0 Add wxFileSystemHandler for "data" scheme
This notably allows embedding images directly in HTML.

Closes #24138.
2023-12-18 22:19:11 +01:00
Blake-Madden
5ba009e861 Add Catholic Feasts holiday authority class (US observances)
This includes a static function to calculate Easter that can be used for
other authorities.

Document the wxDateTimeWorkDays and wxDateTimeHolidayAuthority classes.

Closes #24094.
2023-12-05 00:53:26 +01:00
ali kettab
47bc3a8b96 Try to fix unit tests systematically failing under AppVeyor
Raise the window to ensure that it gets the expected mouse events.

See #24082.

Closes #24109.
2023-11-30 16:32:48 +01:00
Vadim Zeitlin
5318637839 Merge branch 'fix_SVG_premultiply' of https://github.com/teliseo/wxWidgets
Fix wxBitmapBundle::FromSVG(), which renders incorrectly on GTK and add
wxHAS_PREMULTIPLIED_ALPHA to make the code dealing with alpha more clear
and correct.

See #24097.
2023-11-30 02:35:20 +01:00
Ian McInerney
97cba7c0ca Restore ToCDouble compatibility with leading spaces/+ and hex
The previous ToCDouble() function accepted leading spaces, a starting +
sign, and hex strings. std::from_chars() does not accept spaces or +,
and requires a special flag to convert hex strings, so handle this
manually to preserve the old behaviour of this function.

This is similar to the changes done for ToCULong() in #24022.

Closes #24089.
2023-11-30 02:29:58 +01:00
Tim Eliseo
06e3e26ead Add checks to BitmapBundle::FromSVG-alpha test to catch lack of SVG premultiply. 2023-11-28 13:36:06 -08:00
Tim Eliseo
a160e788ae Add test BitmapBundle::FromSVG-alpha to verify SVG alpha premultiply fix.
See #24064.
2023-11-26 13:29:41 -08:00
Tim Eliseo
fce4941404 Add wxHAS_PREMULTIPLIED_ALPHA to abstract if wxBitmap pixels are premultiplied.
All previous relevant platform-specific tests have been changed to use this
symbol. Also, samples/image now premultiplies conditionally, correcting a
visual anomaly on wxGTK.
2023-11-26 13:23:52 -08:00
Paul Cornett
edd1d758de Fix wxCheckBox::SetValue() when in undetermined state with GTK
State becomes determined when SetValue() is called.
See #24074
2023-11-20 08:50:05 -08:00
Vadim Zeitlin
dede4b9326 Use "= default" for all trivial default ctors and dtors
Replace user-specified empty constructors and destructors with the
compiler-generated versions, which has a number of advantages for code
generation, in addition to being more clear.

Closes #22965.

Closes #24058.
2023-11-17 01:33:32 +01:00
Vadim Zeitlin
5a184d423b Merge branch 'qt-uiaction-tests' of https://github.com/AliKet/wxWidgets
Enable automatic tests using wxUIActionSimulator under wxQt.

See #24015.
2023-11-17 01:05:56 +01:00
Vadim Zeitlin
ef4fecc186 Merge branches 'tree-state-bmpbundle' and 'imglist-scalefactor'
Refactor wxImageList and convert it to use physical pixels and
add support for high DPI state images wxTreeCtrl using the new
wxImageList.

See #24000, #24033.
2023-11-17 01:03:27 +01:00
Vadim Zeitlin
39079cbf23 Return true from AddCatalog() if message ID matches language
When the original messages language matches the language of the locale
being used, these strings can be used directly and so AddCatalog()
should still return true for them but it didn't do it any more after the
changes of 94b1a17aeb (Add AddAvailableCatalog() and use it in
AddStdCatalog(), 2023-09-30).

See #18227.

Closes #24019.

Closes #24037.
2023-11-07 15:11:26 +01:00
Vadim Zeitlin
53b4f4ddf2 Use physical size in wxImageList
This seems to be the only way to fix using this class, which is
fundamentally incompatible with high DPI support, with bitmaps of
different logical but identical physical sizes.

By using physical size we ensure that the code chopping up the provided
bitmap in multiple images doesn't do it with the bitmap having the same
physical size but a different logical size from all the other bitmaps.
And, conceptually, logical size of the bitmaps in it really shouldn't
matter to the image list as it doesn't have a scaling factor and so
can't do anything useful with the logical size.

Moreover, we can't add wxImageList::SetScaleFactor() neither because
this class is, by design, supposed to be shareable between different
controls which may use different scale factors, so it doesn't make sense
to speak of the scale factor of the image list itself.

This undoes the changes made in the generic implementation back in
c374eefd34 (Fold wxOSX-specific wxImageList into generic version,
2018-10-30) and also eb52e86553 (Take into account scale factor of
images added to wxImageList, 2021-04-03).

Also update a couple of places where wxImageList is still used to use
physical sizes. Unfortunately some others can't be easily fixed, e.g.
global wxFileIconsTable would have to be completely rewritten.

Finally, add a unit test checking that things work as expected now:
previously the size of 24x24 bitmap in the image list containing
(scaled) 32x32 bitmaps would be 21x21 due to sub-bitmap extraction
kicking in.

Closes #23994.
2023-11-06 21:18:34 +01:00
Vadim Zeitlin
31fefa7ba2 Merge branch 'cxx17-string-toculong'
Fixes for C++17 version of wxString::ToCULong().

See #24022.
2023-11-03 00:51:04 +01:00
ali kettab
28cf04036d Enable tests using wxUIActionSimulator under wxQt 2023-11-01 01:06:39 +01:00
ali kettab
aa4a19cb1d Fix or skip other failures in the tests under wxQt 2023-11-01 00:39:19 +01:00
ali kettab
7469f0f5c4 Fix failures in TreeCtrlTestCase tests under wxQt 2023-10-31 22:58:21 +01:00
ali kettab
0e325e6262 Fix failures in ListBoxTestCase tests under wxQt 2023-10-31 22:56:30 +01:00
ali kettab
53c2b7d65b Fix failures in wxGrid tests under wxQt 2023-10-31 22:53:59 +01:00
ali kettab
b5dad92007 Make sure the window is active after SetFocus() under wxQt
Calling wxYield() after SetFocus() ensures that the window is active
and the tests will pass. Otherwise, they would fail.
2023-10-31 22:42:27 +01:00
ali kettab
3a71aeed5e Enable some more tests under wxQt 2023-10-31 22:28:34 +01:00
Vadim Zeitlin
ae2b05be5c Fix more compatibility problems in C++17 wxString::ToLong()
Unlike the traditional C functions, std::from_chars() doesn't skip
leading whitespace and doesn't accept the leading "+" sign, so we need
to skip them explicitly to preserve the behaviour of ToLong() in the
previous wxWidgets versions.
2023-10-31 00:44:10 +01:00
Vadim Zeitlin
8d6a722ed8 Fix C++17 implementation of wxString::ToCULong()
Do use std::from_chars<unsigned long>() in it as otherwise values
greater than LONG_MAX failed to parse.

Handle negative numbers explicitly to still parse them in this function
as well, as needs to be done for compatibility.

Add a test case for the previously failing numbers.

Closes #23957.
2023-10-31 00:44:10 +01:00
Vadim Zeitlin
8f3331e8c1 Fix assert checking input size in wxOSX GetSubBitmap()
Extend the just added GetSubBitmap() unit test to check for this too.
2023-10-29 01:48:29 +02:00
Vadim Zeitlin
2cf77c2596 Fix GetSubBitmap() returned value size when rounding is required
When using non-integer scale factor, we need to round the result of the
multiplication by it instead of truncating it for consistency with the
behaviour of wxBitmap::CreateWithDIPSize() and the other places where we
do this, including wxOSX version of this function.

Add a simple unit test checking that this works correctly (it would fail
with wxGTK before).
2023-10-29 01:48:27 +02:00
Vadim Zeitlin
4048542d54 Move test not depending on it outside wxHAS_RAW_BITMAP check
No real changes, just don't put the test not using raw bitmap access
inside the section guarded by "#if wxHAS_RAW_BITMAP".

This commit is best viewed with Git --color-moved option.
2023-10-29 01:48:11 +02:00
Vadim Zeitlin
72b4658d5a Merge branch 'gtk-gui-app-console-mode'
Add a test for running wxGTK GUI apps in console mode.

See #23981, #23990.
2023-10-25 23:48:00 +02:00
Vadim Zeitlin
ea393d76ad Allow running GUI test in console-like app mode
This allows to test that GUI applications not initializing the GUI can
at least start correctly and work as console ones (at least under Unix).
2023-10-24 01:21:22 +02:00
ali kettab
b7cf27f2ce Enable HitTestSingleLine test case under wxQt 2023-10-23 21:16:31 +01:00
Vadim Zeitlin
e43f913313 Remove all blank "Modified by:" lines from top comment blocks
Having this line is not useful at all as it doesn't contain any
information and shouldn't be filled in the future as git-shortlog can
provide the information about people who changed the given file more
more reliably than consulting the comments in any case.

Keep the non-blank lines for historical purposes.
2023-10-22 01:22:48 +02:00
Vadim Zeitlin
c601bf4279 Merge branch 'qt-fixes'
Fix bugs preventing GUI tests from working with wxQt and provide native
implementations of wx{Date,Time}Ctrl in this port.

See #23925.
2023-10-22 01:18:50 +02:00
Vadim Zeitlin
99febcf9c1 Wait for events in Grid::LabelClick and RangeSelect tests too
Not sure if it really helps, but try to wait for the events in these
tests as well if only for consistency with what was done in 3d07de66b1
(Add a wait to wxGrid UI unit tests too, 2023-10-03).
2023-10-22 01:06:38 +02:00
ali kettab
1f606cd925 Skip test which work locally, but not when run on GitHub CI under wxQt 2023-10-15 00:10:02 +01:00
ali kettab
09c22b080e Fix listboxtest test failing under wxQt
Qt uses QString::localeAwareCompare() for comparison and this is what their
documentation says: "On other Unix-like systems without ICU, the comparison
falls back to the system library's strcoll()". Under MSW, Qt uses CompareStringEx()
IOW, Qt always compares strings by locale-specific sorting criteria and BTW
this is what wxGTK was like before this commit 625ed74 (Make sorting of wxListBox,
wxChoice and wxComboBox identical to the MSW sorting)
2023-10-15 00:10:02 +01:00
ali kettab
155b24daea Fix gridtest test failing under wxQt 2023-10-15 00:10:02 +01:00
ali kettab
942b3bccf4 Fix windowtest test failing under wxQt 2023-10-15 00:10:02 +01:00
ali kettab
ae0d707166 Fix wxListCtrl test failing under wxQt
The wxListCtrl would assert with this message: '../src/qt/listctrl.cpp(452):
assert "col < columnCount()" failed in SetItem(): Invalid col'

Because under wxQt: no columns means no items, and no items means
no selection can be made at all.
2023-10-15 00:10:02 +01:00