Commit Graph
3337 Commits
Author SHA1 Message Date
Vadim Zeitlin e80bcffe69 Add a way to test arbitrary wxFileName access
Allow running the test with WX_TEST_FILENAME set to the path to test to
see how it is decomposed by wxFileName and if it can be actually
accessed.
2025-01-16 00:53:38 +01:00
Vadim Zeitlin 3a0ac1e14a Fix wxString::BeforeFirst() when "rest" is the string itself
This didn't work correctly before, but there doesn't seem to be any good
reason to not allow this, as it allows to naturally extract some leading
prefix from a string and it also already worked for BeforeLast(), so
make it work for BeforeFirst() too.
2025-01-15 02:19:13 +01:00
Lauri Nurmi 5d8ea50d96 Also accept wide string literals as translation macro arguments
Not accepting them was an accidental regression introduced in #24957,
fix it by accepting any kind of characters in the wrapper functions and
not just "char[]".

This went unnoticed because there weren't any such calls in wx's own
tests or samples, so add some to the test suite to prevent similar
regressions in the future.

Closes #25063.
2025-01-13 22:12:42 +01:00
Vadim Zeitlin 3c7577ee11 Merge branch 'fix-stc-implicit-encoding'
Fix use of implicit encoding in wxSTC header.

See #25052.
2025-01-09 18:25:48 +01:00
ali kettab 5319941619 Implement wxTextCtrl::SearchText() in wxQt
CMake builds / ${{ matrix.name }} (-DCMAKE_C_COMPILER=cl.exe -DCMAKE_CXX_COMPILER=cl.exe, Ninja, SOME, CONSOLE_ONLY, Windows MSVC, 1, windows-latest) (push) Waiting to run
CMake builds / ${{ matrix.name }} (-DCMAKE_SYSTEM_NAME=iOS -DCMAKE_FIND_ROOT_PATH=/usr/local -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED=NO, Xcode, OFF, OFF, macOS 14 wxIOS, macos-14) (push) Waiting to run
CMake builds / ${{ matrix.name }} (Unix Makefiles, ALL, Ubuntu 22.04 wxGTK 3, ubuntu-22.04) (push) Waiting to run
CMake builds / ${{ matrix.name }} (Xcode, macOS 14 wxOSX, macos-14) (push) Waiting to run
Mac builds / ${{ matrix.name }} (arm64, --with-cxx=14 --enable-universal_binary=arm64,x86_64 --disable-shared --disable-debug --enable-optimise, wxMac Universal C++14, self-hosted) (push) Waiting to run
Mac builds / ${{ matrix.name }} (arm64, wxMac ARM with ASAN, self-hosted, true) (push) Waiting to run
Mac builds / ${{ matrix.name }} (true, x86_64, PKG_CONFIG_LIBDIR=/dev/null, --with-osx_iphone --enable-monolithic --disable-sys-libs --host=i686-apple-darwin_sim --build=x86_64-apple-darwin17.7.0, wxiOS, macos-14, true, true, iphonesimulator) (push) Waiting to run
Mac builds / ${{ matrix.name }} (x86_64, --disable-sys-libs, wxMac macOS 14, macos-14) (push) Waiting to run
Mac builds / ${{ matrix.name }} (x86_64, --with-cxx=17 --with-macosx-version-min=10.12 --enable-debug, wxMac Intel C++17, self-hosted) (push) Waiting to run
Mac Xcode builds / ${{ matrix.name }} (x86_64, Debug, generic/platform=iOS, iOS static Debug, build/osx/wxiphone.xcodeproj, macos-latest, static) (push) Waiting to run
Mac Xcode builds / ${{ matrix.name }} (x86_64, Release, generic/platform=iOS Simulator, iOS Simulator static, samples/minimal/minimal_iphone.xcodeproj, macos-latest, app-static) (push) Waiting to run
Mac Xcode builds / ${{ matrix.name }} (x86_64, Release, generic/platform=macOS, macOS dynamic Release, samples/minimal/minimal_cocoa.xcodeproj, self-hosted, app-dynamic) (push) Waiting to run
MSW builds / wxMSW vs${{ matrix.vsversion }} ${{ matrix.configuration }} ${{ matrix.platform }} (DLL Debug, x64, true, 2022) (push) Waiting to run
MSW builds / wxMSW vs${{ matrix.vsversion }} ${{ matrix.configuration }} ${{ matrix.platform }} (DLL Release, x64, 2019) (push) Waiting to run
MSW builds / wxMSW vs${{ matrix.vsversion }} ${{ matrix.configuration }} ${{ matrix.platform }} (Debug, Win32, 2019) (push) Waiting to run
MSW builds / wxMSW vs${{ matrix.vsversion }} ${{ matrix.configuration }} ${{ matrix.platform }} (Release, arm64, 2022) (push) Waiting to run
MSW builds / msw-msys2-clang (push) Waiting to run
MSW cross-builds / ${{ matrix.name }} (--disable-compat32, testing, wxMSW 64 bits) (push) Waiting to run
MSW cross-builds / ${{ matrix.name }} (--enable-universal --disable-compat32 --disable-debug --disable-optimise, testing, true, wxMSW/Univ) (push) Waiting to run
MSW cross-builds / ${{ matrix.name }} (stable, wxMSW 32 bits, i686-w64-mingw32) (push) Waiting to run
Code Checks / Check Spelling (push) Waiting to run
Code Checks / Check Whitespace (push) Waiting to run
Code Checks / Check Mixed EOL (push) Waiting to run
Code Checks / Check C++ Style (push) Waiting to run
Update Documentation / Update Online Documentation (push) Waiting to run
Closes #24899.
2025-01-08 18:26:36 +01:00
Blake-Madden d8ba9ce111 Implement wxTextCtrl::SearchText() for wxGTK3
Closes #24897.
2025-01-08 18:24:18 +01:00
Vadim Zeitlin afa366eafb Merge branch 'qt-enter-leave-events' of https://github.com/AliKet/wxWidgets
Fix wxEVT_{ENTER,LEAVE}_WINDOW events generation in wxQt and add a test
for them.

See #24883.
2025-01-08 17:32:30 +01:00
Vadim Zeitlin e211f6f794 Test wx/stc/stc.h in the "all headers" test too
Ensure that the problem like the one fixed by the previous commit
doesn't happen again.

See #25047.
2025-01-08 03:12:33 +01:00
Vadim Zeitlin c55ba785d3 Use PCRE2 function for counting the number of captures
Don't try parsing the regex ourselves, which is not just slower but also
more buggy: in particular, we didn't handle regexes with trailing
backslash correctly and could keep reading after the end of the buffer
in this case.

See #25040.
2025-01-06 22:16:06 +01:00
Vadim Zeitlin 981341c913 Update copyright years to 2025
Just run misc/scripts/inc_year and commit the results.

See #18690, #25041.
2025-01-06 22:16:06 +01:00
Vadim Zeitlin f5eb38410d Allow using move-only types with wxMessageQueue
Add Post() overload taking r-value reference and a unit test showing
that we can use it with a non-copyable type.
2024-12-26 15:19:08 +01:00
Vadim Zeitlin 65c8b058ef Use unique_ptr<> instead of manual calls to delete
No real changes.
2024-12-26 14:43:15 +01:00
Vadim Zeitlin aa94d0b21e Get rid of CppUnit boilerplate in wxMessageQueue unit test
No real changes, just remove the completely unnecessary test case class.

This commit is best viewed ignoring whitespace-only changes.
2024-12-26 14:40:45 +01:00
Vadim Zeitlin c213730d17 Stop using wxArray in wxMessageQueue unit test
Use std::vector<> instead.
2024-12-26 14:33:48 +01:00
Vadim Zeitlin de3b760fc6 Revert "Add support for multiple headers with same name to wxWebRequest"
This reverts commit 8395e5733d because
HTTP standard says that senders MUST NOT generate multiple lines with
the same header, with the only exception of Set-Cookie, so we shouldn't
provide a way to do it.

That commit also introduced a nasty regression with the programs calling
AddCommonHeader("User-Agent") not working at all any more after it
because WinHTTP refuses to send a request with multiple copies of this
header.

Also partially reverts 1000d67c13 which
was done later but is logically part of the same commit that is being
reverted.

See #24881.
2024-12-20 02:23:24 +01:00
Vadim Zeitlin 0319e8ceb9 Revert "Add headers test"
This reverts commit 0fce060a02 which won't
work any more after upcoming reverting of the commit adding AddHeader().
2024-12-20 00:04:20 +01:00
Vadim Zeitlin 7a7610713d Add simple wxColourDatabase unit test
Notably check that the recently added UseScheme() works.
2024-12-14 01:22:54 +01:00
Lauri Nurmi 87c1aae252 Fix double negatives used with 'neither'
Replace most 'neither' words introduced after 2b0ee48ef7
(Fix double negatives used with 'neither', 2023-11-25)
with 'either'.

All changes are to comments only.

Closes #24999.
2024-12-11 17:57:46 +01:00
Vadim Zeitlin 6476b4ed57 Ensure that wxWebSessionImpl remains alive for long enough
This object shouldn't be destroyed as long as there are any
wxWebRequests using it still alive, as destroying them after the session
would result in a crash, so replace a (possibly dangling) reference to
wxWebSessionImpl in wxWebRequestImpl with a shared pointer, which keeps
it alive for as long as necessary.

See #24969.
2024-12-02 01:22:33 +01:00
Vadim Zeitlin 79f06970a8 Make wxTextCtrl::SetLabel() consistently do nothing everywhere
Previously it did the same thing as SetValue() in wxMSW but didn't do
anything in wxGTK (and probably other ports), which made it easy to
write code that only worked under Windows but mysteriously didn't show
any text under Linux.

Change it to not do anything anywhere and add an assert to help
detecting wrong uses of this function.

Also add a unit test checking this behaviour.

See #24982.
2024-12-02 01:16:37 +01:00
Paul Cornett 5ff83b400c Avoid assertion failure on BMP file with invalid or too-large size 2024-11-27 18:54:12 -08:00
Paul Cornett 05404fd379 Avoid negative shift count with valid BMP file
Detected by undefined behavior sanitizer, on a file with 16 bpp and a color
component of more than 8 bits. Fix by using a different, and more accurate,
method to scale color components to 8 bits.
2024-11-27 18:54:12 -08:00
Paul Cornett 443b64c11c Avoid memory overwrite on malformed BMP with invalid RLE data 2024-11-27 18:54:12 -08:00
Vadim Zeitlin 4897743c58 Add a simple function wrapping lines at given width
This could be enhanced, e.g. break lines at characters other than
spaces, support Unicode better etc, but for now add just a very simple
function that should be suitable for wrapping help message in
wxCmdLineParser, where it will be used next.
2024-11-22 23:02:58 +01:00
Paul Cornett dc83c4ca0e Fix loading ICO files with fully transparent alpha
Windows behavior is to ignore alpha in that case. Broken by b21642b72b
2024-11-19 13:50:33 -08:00
Paul Cornett 738c16a724 Add new test image to build files
Should have been part of b321af212d (Fix loading ICO files with alpha, 2024-11-18)
2024-11-18 17:25:44 -08:00
Paul Cornett b321af212d Fix loading ICO files with alpha
The rules are different than for BMP files. Broken by b21642b72b (Fix loading
BMP files which use 32bpp but do not have valid alpha (#24939), 2024-11-04)
See #24955
2024-11-18 16:55:19 -08:00
Ulrich Telle 57e1c9e1ee Update wxWidgets language database and improve locale matching
This commit improves the best locale match algorithm by prioritizing
closer matches and add many new tests verifying that this works as
expected.

In order to do this, new information had to be added to the language
database, which was extended with it and updated to use the latest
Unicode CLDR data and latest Windows 11 locale list.

Further, add a set of scripts for maintaining the language database up
to date and a GitHub workflow `genlangdb.yml` which can be run manually
to regenerate the wxWidgets language-related source and header files
from the underlying Windows and Unicode data. It produces 2 artifacts:

- wxLanguageDatabaseDist.zip allows to easily update the
  language-related files in the wxWidgets repository by simply copying
  all files.
- the normal workflow log and wxLanguageDatabaseLog.zip allow to check
  all temporary files of the regeneration process and to detect
  potential issues, before the language-related files are actually
  replaced by the new ones.

Finally, fix wxUILocaleImplName::GetPreferredUILanguages: Under Windows
10 and above the Windows API function ::GetUserPreferredUILanguages()
returns only the primary UI language plus US English. Additional
preferred UI languages installed by the user are ignored, so instead of
using this function read the list of user preferred languages from the
Windows registry.

Closes #24855.
2024-11-18 16:46:25 +01:00
paulcor b21642b72b Fix loading BMP files which use 32bpp but do not have valid alpha (#24939)
Based on the behavior of WIN32 LoadFile(), and the gdk-pixbuf BMP loader source
code, the alpha values are ignored unless the compression method is BI_BITFIELDS.
See #10915, #24219
2024-11-04 19:38:54 -08:00
Lauri Nurmi a47b560fd4 Fix wxGETTEXT_IN_CONTEXT* with wxNO_IMPLICIT_WXSTRING_ENCODING
The call to wxGetTranslation() was ambiguous. Fix this by adding missing
wxASCII_STR() for all string literal arguments in wxGETTEXT_IN_CONTEXT
and wxGETTEXT_IN_CONTEXT_PLURAL, just as it is used in _().

Also test that all translation macros expand to compilable code
when wxNO_IMPLICIT_WXSTRING_ENCODING is enabled.

See #1312 and also #24916.

Closes #24925.
2024-11-01 16:35:06 +01:00
Vadim Zeitlin 74a1997842 Merge branch 'endsession-fixes'
Miscellaneous end session-related fixes for wxMSW.

See #24906.
2024-10-28 17:38:39 +01:00
Lauri Nurmi 86dae550cf Add a trivial test for wxArchiveIterator::operator=()
It is necessary to call operator=() in tests to ensure it even
compiles.
2024-10-28 12:27:14 +02:00
Vadim Zeitlin b12ba61e23 Get rid of CppUnit boilerplate in modal dialog test cases
No real changes, just use CATCH macros directly.
2024-10-25 01:33:11 +02:00
Vadim Zeitlin d30e4d66bc Avoid harmless MSVS 2022 shadowing warning in array test
Rename the loop variable to avoid clashing with the name of an existing
local variable.
2024-10-21 22:03:05 +02:00
Vadim Zeitlin 1355cad8dc Fix deleting stack pointer in event propagation test case
wxDocTemplate must be heap-allocated as wxDocManager deletes it.
2024-10-21 22:02:39 +02:00
Vadim Zeitlin 1ee2480841 Avoid undefined behaviour in wxLongLong unit tests
There were several instances of signed integer overflow, avoid them by
either restricting the range or switching to unsigned.
2024-10-20 17:29:24 +02:00
Vadim Zeitlin 6dfa8d0a51 Avoid integer overflow in base64 test case
Don't multiply rand() by values that can result in overflowing the range
of int type, cast it to float and then convert back to int instead.
2024-10-20 17:29:24 +02:00
ali kettab 66090a1487 Added test case to test wxEVT_{ENTER,LEAVE}_WINDOW events 2024-10-19 19:38:16 +01:00
Vadim Zeitlin 210e8a7a1c Merge branch 'drop-longlongwx'
Always use wxLongLong and always use its "native" version.

See #24891.
2024-10-19 16:27:39 +02:00
Blake-Madden 5f7d255be3 Add wxTextCtrl::SearchText() for MSW
Add new API allowing for more efficient searches in wxTextCtrl and
implement it in wxMSW only for now.

See #24756.
2024-10-18 19:32:58 +02:00
Vadim Zeitlin 7aa6da06d0 Remove wxUSE_LONGLONG and always use wxLongLong_t
All supported platforms provide 64-bit integer types since many years,
so remove the legacy wxLongLongWx implementation and rename
wxLongLongNative to just wxLongLong and always compile it in.

Note that wxLongLong itself must still be kept for compatibility as it
has member functions, such as GetValue() or ToString(), that can be used
in the existing code.
2024-10-18 19:26:15 +02:00
Stefan Dinkelacker 38c56c0b36 Fix newly introduced headers test
The format of the generated JSON by the httpbin service for
multiple headers with the same name differs between platforms.
These headers are sometimes put into a JSON array and sometimes
concatenated into a single comma-separated string.
2024-10-15 23:04:37 +02:00
Stefan Dinkelacker 3b2971e825 Improve test output on failure
The two strings that are compared should now be printed on
test failure.
2024-10-15 21:30:42 +02:00
Stefan Dinkelacker 1000d67c13 Add fallback to URLSession webrequest backend
Multiple HTTP headers with the same name are not supported by the
URLsession API. As a fallback, the last header is used instead.
2024-10-15 18:37:54 +02:00
Stefan Dinkelacker 0fce060a02 Add headers test
The contents of a webrequest header can be checked with the
headers endpoint of the httpbin service.
2024-10-15 16:31:40 +02:00
Stefan Dinkelacker e249e3620d Generalize CheckExpectedJSON() 2024-10-15 16:28:12 +02:00
Stefan Dinkelacker 8395e5733d Add support for multiple headers with same name to wxWebRequest
wxWebRequest::AddHeader() was added to accompany the existing
SetHeader() method. In wxWebSession, AddCommonHeader() did exist
already but behaved like setting a header. Its behavior was adapted
to its name and SetCommonHeader() was added with the old behavior
to accompany AddCommonHeader().

The WinHTTP and CURL implementations of wxWebRequest do now append
multiple headers of the same name. The URLSession implementation
follows in the next commits.
2024-10-15 09:15:07 +02:00
Stefan Dinkelacker ae6dc7b469 Add GetAllHeaderValues() to wxWebResponse
HTTP headers like Set-Cookie can be present multiple times in a
web response by definition. The existing GetHeader() method is
not sufficient to cope with this situation.

This commit already adds an implementation for Windows.
Linux and macOS follow in the next commits.
2024-10-14 21:36:48 +02:00
Lauri Nurmi 463d903b23 Add the wxWARN_UNUSED attribute for wxColour; remove unused 2024-10-10 20:21:06 +03:00
Lauri Nurmi ee978a1f6f Use unused variables like they were likely meant to be used
No actual changes to the test, a slight change of tone with one colour
scheme in the propgrid sample.
2024-10-10 20:20:02 +03:00