Commit graph

3108 commits

Author SHA1 Message Date
Vadim Zeitlin
00366cbaae Merge branch 'animation-hidpi'
Add support for specifying multiple animations to allow automatically
showing a higher resolution version when using high DPI, just as it was
already possible with the bitmaps.

See #23817.
2023-08-29 01:53:36 +02:00
Vadim Zeitlin
b284ede300 Merge branch 'memstream-peek'
Return 1 from LastRead() after successful wxMemoryInputStream::Peek()
call.

See #23758.
2023-08-26 12:27:28 +02:00
Vadim Zeitlin
15f19d5d0f Add wxSize::IsAtLeast() helper
This function is trivial but still useful and it doesn't cost much to
have it.
2023-08-25 20:37:58 +02:00
Vadim Zeitlin
d69ddb8656 Revert all recent wxUSE_DPI_AWARE_MANIFEST-related changes
This reverts 5d630caabd (Make it enough to predefine only
wxUSE_DPI_AWARE_MANIFEST, 2023-08-23) and all the commits which tried to
fix the breakage caused by it.

While the original change had merit, it seems to be too difficult to fix
all our build systems to avoid embedding manifest when defining this in
the code, like samples/sample.rc does, so revert this change for now.

Maybe it can be reintroduced in the future after switching to some other
build system.
2023-08-25 00:03:47 +02:00
Vadim Zeitlin
a56219532e Don't embed manifest in GUI test MSVS project neither
This is similar to f6255e456b (Don't embed default manifest in minimal
samples MSVC project, 2023-08-24) but for the GUI test, which was also
broken by 5d630caabd (Make it enough to predefine only
wxUSE_DPI_AWARE_MANIFEST, 2023-08-23).
2023-08-24 17:24:07 +02:00
Samuel Thibault
62f75c235d Fix DynamicLibrary::Load() test for less common platforms
alpha and ia64 use libc.so.6.1, GNU/kFreeBSD uses libc.so.0.1, and
GNU/Hurd uses libc.so.0.3, so check for these versions too in addition
to 6 and 7 used under x86 Linux.

Closes #23801.
2023-08-24 02:49:31 +02:00
Carlo Bramini
15d7aaaa50 Fix wxLocale::GetInfo() unit test under Cygwin
Use the French date format expected by Cygwin CRT which differs from the
one used by MSVC.

Closes #23782.
2023-08-24 02:25:25 +02:00
Carlo Bramini
1bc8631b52 Fix DynamicLibrary::Load unit test under Cygwin
While running the test_base on CYGWIN, this message will be printed on the console:

-------------------------------------------------------------------------------
DynamicLibrary::Load
-------------------------------------------------------------------------------
/cygdrive/c/Users/carlo/Documents/GitHub/wxWidgets/tests/misc/dynamiclib.cpp:26
...............................................................................

/cygdrive/c/Users/carlo/Documents/GitHub/wxWidgets/tests/misc/dynamiclib.cpp:80: warning:
  Couldn't find libc.so, skipping DynamicLibrary::Load() test.

/cygdrive/c/Users/carlo/Documents/GitHub/wxWidgets/tests/misc/dynamiclib.cpp:84: warning:
  Possible candidates:
  /lib/libc.a
  /usr/lib/libc.a

CYGWIN uses NEWLIB as C library and it is compiled into cygwin1.dll.
This patch adds the right test case for CYGWIN, for letting the execution of the test.

Closes #23781.
2023-08-24 02:24:16 +02:00
the-nerbs
ffe520cb6d Update wxMemoryInputStream::Peek to set last read count.
This aligns the memory stream's Peek with other streams' Peek impls by
making it set the last read count to 1 when it successfully peeks a
character, or 0 when it does not. While the formal docs do not link
Peek to LastCount directly, the in-source comments on the declaration
of both wxInputStream::Peek and wxInputStream::LastRead both indicate
that Peek will set the last read count.
2023-08-06 20:46:27 -04:00
Vadim Zeitlin
ec4777bbbf Rebake after the previous commit
This just separates the automatically-generated changes from the manual
ones in the parent commit.
2023-07-29 18:13:29 +02:00
Vadim Zeitlin
7d362c3fca Enable wxStyledTextCtrl unit test in static builds too
It should link there too now after the previous commits.
2023-07-29 16:01:33 +02:00
Vadim Zeitlin
994bbe51a7 Link with stc directly in the test bakefile
There doesn't seem any reason not to do it, so do the same thing as is
done in the stc sample and which seems to work there.
2023-07-29 16:01:33 +02:00
Vadim Zeitlin
a44fe10e32 Link with Scintilla libs in the MSVS test project
They are required by wxStyledTextCtrl tests.
2023-07-29 16:01:33 +02:00
Vadim Zeitlin
f03ea82be8 Merge branch 'im/stringview' of https://github.com/imciner2/wxWidgets
Add std::string_view constructors to wxString.

Also improve C++17 standard headers detection for MSVS.

See #23711.
2023-07-24 18:16:39 +02:00
Ian McInerney
b8d3b37c9e Add new macro for standard library header inclusion
Newer standard library headers should only be included when the compiler
is targetting that standard, otherwise some compilers (like MSVC) will
warn that you are using a newer C++ include on an older version.
2023-07-24 16:54:14 +01:00
Ian McInerney
3dfb2a5ac1 Add std::string_view constructors to wxString 2023-07-20 19:59:01 +01:00
Martin Corino
4d76a87015 Make wxSearchCtrl inherit from wxTextEntry in all ports
Previously it only inherited from wxTextEntryBase in the generic
implementation (used e.g. in wxMSW).

Update the code, documentation and add new unit tests checking that
wxSearchCtrl member functions inherited from wxTextEntry behave
correctly.

Closes #23686.

Closes #23697.
2023-07-20 14:46:41 +02:00
Vadim Zeitlin
6bd2b6b4db Revert "Move Cygwin __USE_W32_SOCKETS definition to wxMSW-specific file"
This reverts commit 0f2b8a2065 as it broke
Cygwin build due to problems with fd_set definition.

Closes #23674.
2023-07-09 17:05:09 +02:00
Vadim Zeitlin
d1ee86df3c Merge branch 'gcc-wextra'
Enable -Wextra for the Unix CI builds after fixing all the existing
warnings.

See #23662.
2023-07-08 00:36:47 +02:00
Vadim Zeitlin
008e72c3ac Avoid using implicit assignment operator in wxAny test
This implicitly declared operator is deprecated because MyClass has an
explicitly defined copy ctor, so we either need to define the assignment
explicitly too or just not use it at all, as done by this commit.
2023-07-04 02:08:32 +02:00
Vadim Zeitlin
b6d082a7a6 Suppress warning in tests checking legacy Connect()
This code can't be modified as it tests for compatibility with the
existing code of this form, so just disable the warnings it now triggers
with -Wextra.
2023-07-04 02:08:32 +02:00
Vadim Zeitlin
9952af8e93 Define explicit copy ctor for classes with assignment operator
This avoids clang -Wdeprecated-copy enabled by -Wextra when building the
test.
2023-07-04 01:29:51 +02:00
Vadim Zeitlin
aa77eb91b0 Add new test GIF image to CMake builds too
This should have been done in c2e5749443 (Fix crash when reading
truncated GIF image, 2023-07-02), but was forgotten there -- so do it
now, and add a comment reminding not to forget it the next time.

See #23409.
2023-07-03 20:20:52 +02:00
Vadim Zeitlin
1c16055713 Still enforce validity on focus loss in numeric validators
The changes of c269932c4e (Relax checks on character entry in numeric
validators, 2023-07-02) went a bit too far and not just relaxed the
checks but removed them entirely.

Correct this by ensuring we have a valid value after focus loss.

See #12968.
2023-07-02 19:13:41 +01:00
Vadim Zeitlin
c2e5749443 Fix crash when reading truncated GIF image
Add a unit test case checking that we don't crash any longer and still
read the image meta data correctly, even if not the image itself.

Also add another check for EOF and possibly invalid "bits" value in
another place where we were not checking for it when reading from the
stream.

Closes #23409.

Co-authored-by: PB <PBfordev@gmail.com>
2023-07-02 18:06:03 +01:00
Vadim Zeitlin
72c5691d2f Fix buffer overrun in wxHTMLDataObject under non-MSW platforms
Using strcpy() in GetDataHere() added an extra NUL at the end which
didn't fit into the buffer of the size returned by GetDataSize(). This
could have been also fixed by returning an extra byte from the latter
function, but as the string doesn't need to be NUL-terminated,
apparently, just use memcpy() with the correct number of bytes instead.

Also, because the string is not necessarily NUL-terminated, use the
provided length in wxHTMLDataObject::SetData() instead of relying on the
buffer being NUL-terminated and reading uninitialized memory beyond its
size.

Add a unit test confirming that there are no more ASAN errors when using
this class.

Closes #23660.

Co-Authored-By: mcorino <martin@corino.nl>
2023-06-21 20:38:25 +01:00
Vadim Zeitlin
c7d414bbed Make HTML pasting code more robust and efficient
Use StartFragment and EndFragment headers values in order to extract the
HTML fragment from the entire CF_HTML string, instead of searching for
"<!--StartFragment-->" and "<!--EndFragment-->" comments which could be
wrong (e.g. if a StartFragment comment actually appeared inside the HTML
fragment) and less efficient too.

Also add a simple pseudo-test, disabled by default, allowing to view the
clipboard contents if HTML is available on it.
2023-06-21 20:38:25 +01:00
Brian Nixon
e1e2e982e3 Restore old delta-RLE bitmap background setting
Revert the change introduced in b473163da2
and restore the setting of the background of delta-RLE bitmaps to the
first entry in the colour table. This retains earlier wxWidgets
behaviour and matches Windows `LoadImage()` with `LR_CREATEDIBSECTION`.

Closes #23638.

Closes #23657.
2023-06-20 22:19:47 +02:00
Brian Nixon
381c39a051 Clear grid attribute cache when loading new table
Clear the cached attributes when replacing the table they were used
with.

Add unit test checking that the attributes are not used any longer.

Closes #23607.
2023-06-05 15:22:49 +02:00
Brian Nixon
b9d0541f9a Make wxSocket::Peek() work with UDP too
Fix wxSocketImpl::RecvDgram() when caller requests fewer bytes than
are present in datagram, as we must always read all the available bytes
when using UDP -- they are not buffered by the OS and so won't be
provided by the next Read() call.

Closes #23594.

Closes #23604.
2023-06-05 01:49:41 +02:00
Brian Nixon
b473163da2 Correct delta-RLE bitmap background colour
Use black instead of the first palette colour for the implicit
background for RLE bitmaps for consistency with Windows itself.

Closes #23599.
2023-06-04 00:38:39 +02:00
Brian Nixon
d78e9fb1cb Correct loading of BI_BITFIELDS bitmaps
This fixes several minor bugs in the loading of `BI_BITFIELDS` bitmaps,
related to handling different header sizes and the colour and alpha
masks.

Closes #23601.
2023-06-03 21:07:40 +02:00
Vadim Zeitlin
a3e925df0a Merge branch 'mac-uilocale-script-fix'
Locale-related fixes for macOS and new calendar names localization
functions.

Closes #23209.

See #23556.
2023-06-03 21:07:40 +02:00
Brian Nixon
28d6234bfe Add image test to compare BMP creation methods
Check that loading BMP files directly using wxDIB and via wxImage
built-in support for them produces the same result (which wasn't the
case for the RLE-compressed bitmaps until the last commit).
2023-05-31 21:19:14 +01:00
Vadim Zeitlin
d2101ca3be Show result of parsing wxLocaleIdent in wxUILocale pseudo test
In addition to showing whether the locale is supported or not, show all
of its components to allow interactively verifying if an identifier is
being parsed correctly.
2023-05-19 01:33:13 +02:00
Vadim Zeitlin
92664881fe Fix lack of unsharing in wxImage::Clear()
Calling Clear() wrongly modified any other wxImage objects reusing the
same data.

Fix this by adding the missing call to AllocExclusive() to this function
and also add a check for the image validity which was missing there as
well ever since this function was added back in fc3762b5fc (add
wxImage::Clear (patch by troelsk); closes #10141, 2009-01-09).

Also add a unit test.

Closes #23553.
2023-05-18 00:31:15 +02:00
Vadim Zeitlin
d56d773a55 Remove CppUnit boilerplate in wxImage unit test
No real changes, just remove all the ugly compatibility macros.
2023-05-18 00:25:35 +02:00
Vadim Zeitlin
4a2d256e94 Remove CppUnit boilerplate from wxURL unit tests
No real changes, just don't use compatibility macros any longer.

Also remove URLTestCase as it's useless now when we can just use
wxSocketInitializer directly.
2023-05-18 00:10:28 +02:00
Vadim Zeitlin
1afcac9ca5 Use wxSocketInitializer in the unit tests
Prefer using this RAII wrapper to explicit function calls, this is
shorter and more robust.
2023-05-18 00:06:21 +02:00
Vadim Zeitlin
c41969eff2 Disable wxHyperlinkCtrl colours test under Wine
This doesn't work due to LM_GETITEM not returning the expected result
after changing the state using LM_SETITEM under Wine.

It could be worked around by remembering whether we changed the colours
in our own variable, or maybe just reverted later if Wine fixes this,
but for now disable the test.
2023-05-15 21:50:31 +01:00
Vadim Zeitlin
cd28031b4d Document that wxMSW wxHyperlinkCtrl hover colour can't be changed
This isn't supported by the native control, and it doesn't seem worth to
make an extra effort to support it, so just document it and stop
checking that it works in the unit test.
2023-05-15 21:39:13 +01:00
Vadim Zeitlin
5b9b817aaa Simplify showing colour values in failing unit tests
Use wxColour::GetAsString() instead of reimplementing it in the test.
2023-05-15 21:39:13 +01:00
Vadim Zeitlin
02eb3a26b6 Fix using colours, fonts etc in CATCH assert messages
Include the header declaring the stream insertion operators for these
types before including catch.hpp itself as otherwise they may not be
seen when these classes are used and Catch::StringMaker is instantiated
using the "unstreamable" alternative for them.

It would probably be better to specialize Catch::StringMaker for these
types directly instead of relying on stream insertion operators, but
this would require more changes and in the meanwhile this improves the
display of failing checks.
2023-05-15 21:39:13 +01:00
Vadim Zeitlin
d1fedc1415 Get rid of CppUnit boilerplate in wxHyperlinkCtrl unit test
No real changes, just avoid using compatibility macros in this test.
2023-05-15 21:39:13 +01:00
Vadim Zeitlin
5f5e5c27dd Merge branch 'keep-on-same-display'
Keep window on the same display when its client size is changed.

See #23533.
2023-05-10 22:45:02 +01:00
Vadim Zeitlin
54a8a6ac16 Fix wxTreeCtrl::ScrollTo() with hidden root item in wxMSW
Scroll to the topmost item, as the generic version does, instead of
crashing.

Closes #23534.
2023-05-10 19:08:00 +01:00
Vadim Zeitlin
5fd6be2f64 Add wxRect::MakeCenteredIn() modifying the rectangle in place
This can be more convenient than calling CenterIn().
2023-05-10 00:09:41 +01:00
Vadim Zeitlin
1a22adb80d Get rid of CppUnit boilerplate in wxRect unit test
No real changes, just clean up the test.
2023-05-10 00:02:58 +01:00
Vadim Zeitlin
d39aac0fa8 Merge branch 'aui-tbar-items'
Fix regression in code using pointers to wxAuiToolBar elements.

See #23529.
2023-05-08 15:15:02 +01:00
Vadim Zeitlin
4d48e47811 Fix regression in destroying wxArtProvider objects
Don't delete the art provider object in Remove() as this contradicted
its contract and do restore the call to Remove() from wxArtProvider dtor
as it's actually documented to work.

This fixes a regression due to the changes of 4a294caacd (Stop using
macro-based wxList in wxArtProvider code, 2023-04-11).

Closes #23513.

Closes #23529.
2023-05-08 15:13:35 +01:00