Commit Graph
2874 Commits
Author SHA1 Message Date
Vadim Zeitlin eb1242cc1c Merge branch 'compat-32'
Remove WXWIN_COMPATIBILITY_2_8 and associated code, add
WXWIN_COMPATIBILITY_3_2.

See #22692.

Closes #22686.
2022-08-03 18:13:44 +02:00
Artur Wieczorek 5e2da5a106 Get rid of v2.8 code 2022-08-02 08:26:29 +02:00
Vadim Zeitlin 4b0fa10a29 Don't mix flags from different enums in wxRegEx unit test
Pass compilation and matching flags using separate parameters instead of
passing them as a single int and then separating them inside the
function.

This is a bit cleaner and also avoids warning about using deprecated
enum operations when using C++20.
2022-07-31 22:22:58 +02:00
Vadim Zeitlin 8a5d9295b7 Fix even more warnings about combining different enums in C++20
This completes the changes of 5477d4faa8 (Avoid warnings when combining
wxStaticText styles with C++20, 2022-07-20) which, in turn, was based on
3d278ee75f (Avoid warnings about operations on different enums in C++20
mode, 2021-04-25).

Also add a test checking that no warnings are given for all possible
enum values combinations (but this test is only useful when using
C++20).

See #22681.
2022-07-31 20:00:18 +02:00
Tim Stahlhut c69ee439d9 Stop using wxWidgets 1.xx wxString compatibility functions
Replace them with std::string-like equivalents when possible (i.e.
replace Length() with length(), IsNull() with empty()) or, at least,
with wx 2 functions if not (e.g. Remove() with Truncate(), First() with
Find(), LowerCase() with MakeLower() etc).

Closes #22638.
2022-07-24 16:25:29 +02:00
Vadim Zeitlin af4ad43824 Rebake and rerun autoconf after the version update 2022-07-17 17:03:39 +02:00
PBandVadim Zeitlin 8d3812adce Fix wxDynamicLibrary unit test compilation in C++20 mode
Don't use operator<<() with a wide char string, as this overload has
been removed in C++20. This can be done simply by not using wide char
string at all in this test, as it's not really needed.

Co-Authored-By: Vadim Zeitlin <vadim@wxwidgets.org>

Closes #22599.
2022-07-05 01:36:42 +02:00
Vadim Zeitlin 8a17c52c3b Fix wrong conversion of negative 64-bit wxAny to wxVariant
Extracting the lower part of a 64-bit value only works when long is
32-bit, but not if it's 64-bit as well as is the case under LP64 Unix
systems.

Just use a normal cast to long instead, as this is simpler and works in
all cases.

Also add a simple unit test for this case, which would have previously
failed, but passes now.

Closes #22592.

Closes #22595.
2022-07-04 01:19:50 +02:00
Vadim Zeitlin ab204afcab Use correct libc.so location under FreeBSD
This allows wxDynamicLibrary to pass there instead of just warning and
skipping the test.
2022-06-30 16:28:29 +02:00
Vadim Zeitlin 6da0cfa2c9 Stop using xclock in wxExecute() unit test
It isn't available under all systems and can't be run without an active
X11 session even when it is, so replace it with a simple call to sleep.
2022-06-30 14:07:08 +02:00
Vadim Zeitlin 20c8844925 Don't try using /usr/lib/libc.so on unknown Unix systems
This doesn't work under FreeBSD, even if the file exists there.

Show the existing libc candidates on such systems to see if any of them
look plausible.
2022-06-30 14:03:44 +02:00
Vadim Zeitlin 587c1fafe0 Remove unused wx/log.h include from wxDynamicLibrary unit test
No real changes.
2022-06-30 14:03:28 +02:00
Vadim Zeitlin 3fcf4a5f74 Fix Windows wxDynamicLibrary tests build after recent change
Fix a mistake in e32f49bca0 (Do run DynamicLibrary::Load unit test under
Linux, 2022-06-29).
2022-06-29 22:42:10 +02:00
Vadim Zeitlin e32f49bca0 Do run DynamicLibrary::Load unit test under Linux
Use existing path for libc.so on Linux/x86_64 platforms to prevent the
test from just exiting without doing anything.

Also don't give a compilation error for unknown platforms, just a
run-time warning is sufficient.
2022-06-29 22:25:08 +02:00
Vadim Zeitlin c1a573d216 Initialize unused variable in FileKindTestCase to avoid a warning
Avoid -Wmaybe-uninitialized from gcc 11.
2022-06-29 22:10:55 +02:00
Vadim Zeitlin 0167d56427 Merge branch 'glibc-checks'
Fix build with glibc < 2.12

See #22564.
2022-06-26 22:12:51 +02:00
Vadim Zeitlin 8c5df4b485 Use UTF-8 locale in Unicode formatting test
At least under FreeBSD, vsnprintf() doesn't work with Unicode strings in
non-UTF-8 locales (but just returns EILSEQ), so set such locale before
using it.
2022-06-23 21:15:58 +01:00
Vadim Zeitlin a9d3ef2539 Fix date/time format unit test under FreeBSD
Expect French date/time formats actually used there (at least under
French 13), as they're different from the ones used by glibc under
Linux.
2022-06-23 21:15:58 +01:00
Vadim Zeitlin cffbea5a0f Don't replace multiple HOME occurrences
Fix another bug in wxFileName::ReplaceHomeDir(): only replace the first
occurrence of the home directory, not all of them (or even the first one
if it appears in the middle of the string).
2022-06-23 21:15:58 +01:00
Vadim Zeitlin 96a917eaa8 Fix wxFileName::ReplaceHomeDir() when HOME=="/"
This is rare but can happen and the function behaved completely wrongly
in this case, so handle it explicitly.

Also disable the unit test when HOME has this value, as it assumes this
is not the case.
2022-06-23 21:15:58 +01:00
Vadim Zeitlin d74a4ea30d Add wxCHECK_GLIBC_VERSION() and cleanup glibc version checks
Use this macro where possible and simplify the checks in a couple of
places where it isn't (because we're checking for an exact glibc
version).

No real changes.
2022-06-23 19:01:18 +02:00
Vadim Zeitlin 2a2308d5ed Update version to 3.2.0 and rebake and rerun autoconf
Update all make/project files to use 3.2.0.
2022-06-21 00:54:26 +02:00
Vadim Zeitlin c639226543 Merge branch 'dvc-model-simplify'
Simplify defining classes inheriting from wxDataViewModel.

See #22553.

Closes #17755.
2022-06-20 00:42:54 +02:00
Vadim Zeitlin b3b5c8a670 Fix wxWebResponse::GetHeader() and GetURL() in wxMSW
These functions returned strings of wrong size, with some junk after the
end of the actual string, due to a confusion between the size of the
buffer in bytes used by the WinHTTP functions and the length of the
buffer in (wide) characters used by wxWCharBuffer.

Fix this and add a unit test checking that the expected header is
returned.

See #22549.

Closes #22181.
2022-06-20 00:41:13 +02:00
Vadim Zeitlin aedd4ca847 Add a test for wxLocale::IsAvailable(wxLANGUAGE_DEFAULT)
This must always returns true.
2022-06-19 02:13:48 +02:00
Vadim Zeitlin dbd211dbc2 Don't require overriding wxDataViewModel::GetColumn{Count,Type}()
Neither of these methods was actually ever used after the changes of the
last two commits (and they hadn't been used when not using wxGTK even
before), so don't force the user-defined model classes to override them.

Also stop using them, as the stub versions don't return correct values
any longer.

Still keep the virtual functions in the base class for compatibility
however as it doesn't cost us much and avoids breaking the existing code
using "override".
2022-06-18 19:19:16 +02:00
Vadim Zeitlin e7785ac224 Merge branch 'bmp-read-fixes'
Fix and improve/simplify BMP reading code, in particular restoring
support for loading BI_BITFIELDS bitmaps broken some time ago.

See #22504.
2022-06-10 17:17:56 +01:00
Vadim Zeitlin 7faa70a4a9 Merge branch 'listctrl-col-count'
Ensure wxListCtrl::GetColumnCount() behaves consistently on all
platforms with wxLC_LIST style.

See #22497.

Closes #22482.
2022-06-10 17:16:47 +01:00
Vadim Zeitlin 3c25afaec4 Remove wx.ico from test bakefile and makefiles
This should have been done in 2373b4ca24 (Construct the test bitmaps
directly in wxImageList test code, 2022-05-18) but was forgotten there.
2022-06-09 01:01:06 +02:00
Vadim Zeitlin 3ffc739e0e Only read BMP pixel data from stream in LoadBMPData()
This makes the code much more clear: LoadDib() now reads all the header
data while LoadBMPData() reads bitmap data only and doesn't read any
header values any more, unlike before.

It also allows not to have to pass neither bmpOffset nor IsBmp
parameters to LoadBMPData(), making its argument list much more
reasonable.

Finally, and, most importantly, it fixes loading bitmaps using
BI_BITFIELDS that was broken back in cccda9ef6b (Fix loading colour
palette from BMP file, 2019-12-28).

This commit also adds a unit test checking that this doesn't get broken
again without anyone noticing.

See #18634.

Closes #22499.
2022-06-08 23:49:18 +01:00
Vadim Zeitlin b918353306 Provide more details in case of image test failures
Add INFO() to show the file for which the error occurred.
2022-06-08 20:28:19 +01:00
Vadim Zeitlin 1a6c5746db Add a simple test allowing to load an arbitrary image
This test is disabled by default but useful for checking if the given
image can be loaded.
2022-06-08 19:27:11 +01:00
Vadim Zeitlin 856758269f Add a test checking "+" and "Num +" accelerator parsing
Confirm that this works correctly and also that "+" is intentionally '+'
and not WXK_ADD.
2022-06-08 15:40:23 +01:00
Vadim Zeitlin 9547cbc6a4 Extend wxListCtrl::GetColumnCount() tests to all modes
Check that it consistently returns 0 in the wxLC_ICON and
wxLC_SMALL_ICON modes under all platforms.

Document the behaviour of this function in all modes.
2022-06-08 13:52:53 +01:00
Vadim Zeitlin 8b1bab9c71 Simplify the code in just added ListCtrlTestCase::ColumnCount()
Don't call tearDown() explicitly, we'll get rid of this function sooner
or later, hopefully, so don't add extra calls to it and just delete the
window directly, nothing else should be needed here.

No real changes.
2022-06-08 13:40:43 +01:00
Kvaz1r 1a545fe428 Add tests for wxListCtrl ColumnCount 2022-06-07 22:15:11 +03:00
Vadim Zeitlin 72f851f6f4 Remove the size parameter of wxBitmapBundle::GetConsensusSizeFor()
It doesn't seem to be useful and wasn't really specified in 2 out of 3
existing calls to this function and was probably wrongly specified in
the remaining one, so just remove it for now, it can always be added
later if we decide what exactly should it do.
2022-06-05 03:23:41 +02:00
Vadim Zeitlin 907e4ea862 Add wxBitmapBundle::GetConsensusSizeFor(double) and test it
Add an overload of the existing function which can be easily tested in
the unit tests and add a trivial new test for it.
2022-06-05 03:06:10 +02:00
Vadim Zeitlin 538eafc78b Fix bug with wrong GetIndexToUpscale() return value
Only assign known good values of the index to "indexLast" as otherwise
we could end up returning an invalid index value from it if "indexBest"
was never set and the last index wasn't a valid one, as it happened in
wxBitmapBundleImplSet containing an original bitmap and a x2 scaled copy
of it, which shouldn't be used for further scaling.

Add a unit test checking that this bug is fixed now.
2022-06-03 00:44:59 +01:00
Vadim Zeitlin 6d5bd15d12 Use non-integer scale that is exact multiple of an available one
Always rounding non-integer scale when upscaling is wrong, as we could
be able to upscale an existing x1.5 image to e.g. 300% DPI scaling with
relatively good results, so only do it if there is no available scale
that exactly divides the requested one.

Add a previously failing unit test which passes now.
2022-06-02 23:09:05 +01:00
Vadim Zeitlin 2d782443a4 Choose the best bitmap to rescale to the target size
It's not necessarily the largest bitmap, but one which may be scaled
using an integer factor.

Fix the tests to expect the correct results, now that they actually
pass.
2022-06-02 01:37:24 +01:00
Vadim Zeitlin 3414e6a1d4 Extend wxBitmapBundle unit tests for bitmap scaling
Check not only that the resulting bitmap has the right size, but also
that it was obtained by scaling the correct bitmap.

Define the required machinery to allow using CATCH CHECK_THAT() macro to
succinctly verify both.

Note that this doesn't change the existing tests, but just rewrites them
in a new form and also adds more tests for a bundle with 3 bitmaps.
2022-06-02 01:37:24 +01:00
Vadim Zeitlin 30fb836136 Break the tie in favour of smaller bitmaps at 1.5x factor
Prefer to use 1x bitmap to 2x one at 150% scaling, as it seems better to
use smaller (but still readable) bitmaps than overlarge ones in this
case.
2022-06-02 01:37:24 +01:00
Vadim Zeitlin 0b0e95296a Upscale images by integer factors only
Doing anything else results in really poor results, so don't even try
scaling images by 2.25, for example -- scaling by 2 looks much better
and the size difference is relatively insignificant and definitely not
worth the difference in quality.
2022-06-02 01:37:24 +01:00
Artur Wieczorek b9cb57eceb Test wxPropertyGrid headers compilation without implicit wxString conversion
Add wxPropertyGrid headers to the list of headers compiled with
wxNO_IMPLICIT_WXSTRING_ENCODING.

See #22102.
2022-05-30 19:06:37 +02:00
Vadim Zeitlin 8169464516 Suppress harmless MSVC warnings in atomic unit test
The changes of 50bc3ceb04 (Get rid of CppUnit boilerplate in atomic unit
test, 2022-05-11) resulted in warnings about possibly uninitialized
variables in this test, so do initialize them for MSVC even if it isn't
really necessary.
2022-05-23 15:05:47 +01:00
Vadim Zeitlin 15705b3350 Simplify bitmap size checks in wxImageList tests
Also don't hardcode 32*32 size but make it a constant that could be
changed later.
2022-05-23 15:05:47 +01:00
Vadim Zeitlin 2373b4ca24 Construct the test bitmaps directly in wxImageList test code
Don't use external image files, this makes it simpler to run the test
(it can be now done from any directory) and also experiment with it
(e.g. by making the test image fully transparent or fully opaque).

Remove the now unneeded .ico file but keep the .png one still used by
another test.
2022-05-23 15:05:47 +01:00
Vadim Zeitlin 1ed13da86e Factor out common initialization code in wxImageList tests
No changes, just stop duplicating exactly the same initialization code
for the tests with and without masks.
2022-05-18 15:43:31 +01:00
Vadim Zeitlin 2ba9007d0e Add wxCHECK_CXX_STD() and use it to test for C++17 and C++20
Unlike direct tests of __cplusplus, using this macro also works with
(recent enough, i.e. MSVS 2015.3 or later) MSVC versions, even if
/Zc:__cplusplus is not used.

This simplifies some checks and makes some other ones (notably the check
for C++20 used before wxALLOW_COMBINING_ENUMS macro definition) work
with MSVC versions with C++20 support as intended.
2022-05-11 16:57:18 +01:00