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.
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.
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.
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.
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.
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.
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.
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.
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).
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.
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.
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.
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".
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.