Commit graph

3207 commits

Author SHA1 Message Date
Vadim Zeitlin
4df2c878f4 Add wxSTC project to the GUI tests MSVS solution
The tests depend on wxSTC library, so add the project to ensure that it
is (re)built when building them.
2023-05-06 19:43:00 +01:00
Vadim Zeitlin
a2e3dd563e Check that we retrieve the same numbers of files in wxFTP test
GetFilesList() and GetDirList() should return the same number of lines,
normally, so check for this.
2023-05-04 17:06:02 +01:00
Vadim Zeitlin
5e3c2fb1c6 Don't use raw pointers in wxFTP unit test
Use std::unique_ptr<> and vector<> instead.
2023-05-04 16:38:29 +01:00
Vadim Zeitlin
649c64bab1 Replace CPPUNIT_ASSERT with CATCH macros in wxFTP unit test
No real changes, just stop using legacy macros.
2023-05-04 16:36:28 +01:00
Vadim Zeitlin
8d8f94da64 Merge branch 'webkit2_fixes' of https://github.com/swt2c/wxWidgets
Miscellaneous fixes for WebKit2 wxWebView backend.

See #23497.
2023-04-28 16:39:49 +02:00
Vadim Zeitlin
5d2639d1cf Merge branch 'std-iostream-fixes'
Restore wxDocument::{Save,Load}Object() compatibility with the old
non-STL build.

See #23481.
2023-04-28 15:26:54 +02:00
Vadim Zeitlin
fd0a52250d Remove redundant wxUSE_STD_IOSTREAM test
It's not necessary to check for it as wxHAS_TEXT_WINDOW_STREAM is only
set to 1 if standard streams are used.
2023-04-28 15:26:46 +02:00
Vadim Zeitlin
85e88d6af3 Merge branch 'format-unicode-fix' of https://github.com/lanurmi/wxWidgets
Fix for wxLocale breaking Unicode string formatting under macOS.

See #23454.
2023-04-28 15:06:54 +02:00
Scott Talbert
9688ccc087 WebView tests: Fix Selection test with WebKit 2.40+
For some reason, calling HasSelection() immediately after SelectAll()
causes the web extension to get stuck under WebKit 2.40.  Instead of
sleeping, call wxYield() a few times to let the event loop run a bit.
2023-04-26 10:26:16 -04:00
Vadim Zeitlin
7465d8297e Add wxString::wc_string() for consistency
We have utf8_str() and utf8_string(), but no similar equivalent for
wc_str(), so add one too, it seems nicer to use than ToStdWstring().

Closes #23463.
2023-04-20 15:20:13 +02:00
Vadim Zeitlin
8e35b647c3 Use std::unordered_map<> in private wxWebRequest headers
Replace wx synonym with the direct use of the standard class.
2023-04-18 00:42:56 +01:00
Vadim Zeitlin
080b59ca8b Use std::unordered_map<> in the GUI unit test code
This allows to use the correct types for the map keys and values too.
2023-04-18 00:42:55 +01:00
Vadim Zeitlin
7824391f64 Merge branch 'use-std-containers'
Remove avoidable uses of legacy container classes by replacing them with
the standard containers.

See #23440.
2023-04-17 17:02:27 +02:00
Lauri Nurmi
aefd1e41c7 Attempt to test whether wxLocale breaks formatting Unicode strings 2023-04-17 02:04:59 +03:00
Vadim Zeitlin
889845fbc4 Add support for wxNO_IMPLICIT_WXSTRING_CONV_TO_PTR to wxString
This symbol is similar to the existing wxNO_IMPLICIT_WXSTRING_ENCODING
and can be defined when building the application (as opposed to when
building the library) to disable implicit wxString conversions to
pointer types, i.e. char*, wchat_t* and void*.

This makes the just added wxUSE_CHAR_CONV_IN_WXSTRING library build
option unnecessary, so remove it.
2023-04-16 01:16:56 +02:00
Vadim Zeitlin
4913857ef7 Define wxNO_UNSAFE_WXSTRING_CONV if wxUSE_UNSAFE_WXSTRING_CONV==0
This doesn't really change anything, but allows to simplify the tests,
as we can now check only for wxNO_UNSAFE_WXSTRING_CONV and this covers
both the case of the library compiled without support for the unsafe
conversions at all and the case when the conversions are disabled by
explicitly defining wxNO_UNSAFE_WXSTRING_CONV when building the
application.
2023-04-16 01:16:56 +02:00
Vadim Zeitlin
35c35c235e Remove wxUSE_STL which is not really used any longer
wxString is always based on std::[w]string since 2c0c727f49 (Remove wx
own wxStringImpl implementation, 2022-11-16) and all containers use
standard containers by default too now -- and there is a separate
wxUSE_STD_CONTAINERS for this anyhow.

The only remaining use of wxUSE_STL was as the default value for
wxUSE_STD_STRING_CONV_IN_WXSTRING option, but it's not really needed
for this neither, and this option can just be set to 0 by default.

Also add wxUSE_CHAR_CONV_IN_WXSTRING which can now be set to 0 too to
disable all unwanted implicit conversions (even "safe" ones, to wide
strings, in addition to the unsafe ones to narrow strings that could be
already disabled with wxUSE_UNSAFE_WXSTRING_CONV) to allow people who
don't want to have any implicit conversions at all to do it.

Keep --enable-stl configure option for compatibility, but warn if it is
used to tell people that it is not needed any longer.
2023-04-15 17:22:09 +02:00
Vadim Zeitlin
d65eed50fa Replace some occurrences of wxUSE_STL with wxUSE_STD_CONTAINERS
The latter option will remain, while the former one won't be used at all
any longer soon, so prefer using the latter whenever possible.
2023-04-15 15:14:41 +01:00
Vadim Zeitlin
338751756f Use std::vector<wxImage> instead of wxImageArray
Preserve the old dynamic array name but just define it as a thin class
deriving from std::vector and accept just vector in SaveAnimation().
2023-04-12 18:09:47 +01:00
Vadim Zeitlin
8fd4f5e79d Merge branch 'to-from-chars' into drop-x-fonts
Use C++17 std::{to,from}_chars() for conversions between wxString and
numbers in C locale.

See #23422.
2023-04-12 16:42:03 +02:00
Vadim Zeitlin
15936efed9 Merge branch 'use-stl-tweaks'
Minor changes related to wxUSE_STL.

See #23435.
2023-04-10 16:21:36 +02:00
Vadim Zeitlin
6ea0589ed3 Remove unnecessary wxUSE_STL test from HTML parser benchmark
The same code can be used in STL and non-STL builds.
2023-04-09 02:33:22 +02:00
Vadim Zeitlin
e9527ee5a2 Define wxArchiveIterator in all builds, not just STL one
Doing this doesn't introduce any backwards compatibility problems, so do
it always, and not only when wxUSE_STL==1.
2023-04-09 02:33:22 +02:00
Vadim Zeitlin
e832ebbacc Add wxArrayString::AsVector() too
This provides the conversion in the other direction, which is needed
less often but it's still arguably better to have it than not to.
2023-04-08 22:45:11 +01:00
Vadim Zeitlin
cee7611c6a Add wxArrayString ctor from std::vector
Allow constructing wxArrayString from vectors of any compatible type,
including wxString itself as well as std::string or std::wstring.
2023-04-08 20:22:48 +02:00
Vadim Zeitlin
9b1d031a1b Show more information if wxString::ToLong() tests fail
Make it possible to see which test failed if one did.
2023-04-05 15:59:36 +02:00
Vadim Zeitlin
6d92131fc7 Add a benchmark for wxString::FromDouble() and FromCDouble() too
Also compare them with snprintf("%d") and std::to_chars, which is again
significantly faster.
2023-04-05 13:59:05 +02:00
Vadim Zeitlin
ca2803922d Use current locale for the benchmarks
The just added wxString::ToDouble() benchmark is locale-dependent, so
allow using the current locale for the tests.
2023-04-05 13:37:02 +02:00
Vadim Zeitlin
b5bf41e8ba Add wxString::ToDouble() and ToCDouble() benchmarks
Compare performance of these functions with each other and strtod() as
well as C++17 std::from_chars(), which is significantly faster than any
of the other ones (twice faster than strtod() which is itself 6 times
faster than wxString functions on this machine).
2023-04-05 13:37:02 +02:00
Vadim Zeitlin
a1d9eecc7a Avoid failures in wxKill() unit tests under Windows 11
Apparently notepad can't be killed by sending WM_QUIT to its process
under Windows 11 because the process we launch is not actually the GUI
process showing the notepad window but some helper parent process.

Work around this by launching mspaint, which can still be killed by
wxKill(), instead.

Closes #23365.
2023-04-01 19:14:18 +02:00
Vadim Zeitlin
378f3860d2 Allow setting locale for the tests
This is especially useful to set an UTF-8 locale on the startup to force
using UTF-8-specific code in UTF-8 build.
2023-03-28 13:48:13 +01:00
Vadim Zeitlin
2b5dbd1ec5 Get rid of CppUnit boilerplate in wxString unit test
No real changes, just remove the completely useless StringTestCase and
use Catch macros directly instead of CPPUNIT_ASSERT wrappers.
2023-03-28 13:48:13 +01:00
Vadim Zeitlin
1869f9ec6f Use range for instead of iterators in unit test
No real changes, just simplify the code and ensure that iterating over a
string using range for loop works as expected.
2023-03-26 17:56:55 +01:00
Ryan Norton
e1c3962aa9 Improve wxURI parsing
- Update parsing IPvX addresses to follow RFC and add many more tests.
- Rework authority parsing for RFC edge cases.
- Fix a couple of other extreme edge cases.

Closes #23360.
2023-03-22 18:35:45 +01:00
Vadim Zeitlin
8b2e010841 Stop using macro-based array in wxThread unit test
Use vector of unique_ptr instead.
2023-03-13 01:17:23 +01:00
Vadim Zeitlin
dd8935b07d Fix waiting for threads to exit in wxCondition unit test
Using sleep was not only fragile but also resulted in tons of TSAN
errors, so replace it by the similar approach to the one which was
already used to wait for the threads to start up.

This is horribly inefficient but we don't care about this in the test
and, at least, this does ensure that the threads exit before it ends.
2023-03-13 01:17:23 +01:00
Vadim Zeitlin
345b8ff505 Fix some brokenness in wxThread::Delete() unit test
Don't use sleep in this test as the thread may terminate before it
returns, possibly resulting in crashes that the existing comment warned
about, and definitely resulting in TSAN errors.

Also ensure that the thread doesn't terminate instead of just hoping
that it doesn't do it because it doesn't have time to run 30 iterations
of its entry function by passing the special value of 0 to ctor, which
explicitly prevents the thread from terminating on its own.
2023-03-13 01:17:23 +01:00
Vadim Zeitlin
8f22eb5157 Merge branch 'calendar-locale'
Improve date validation in wxDatePickerCtrlGeneric and a couple of minor
fixes in the related code.

See #23312.
2023-03-09 00:10:43 +01:00
Vadim Zeitlin
d5a90896ae Merge branch 'app-init'
Improvements to wxApp initialization and modernize the code to use
std::unique_ptr<> instead of wxScopedPtr or, worse, macro-based scoped
pointers.

See #23319.
2023-03-07 19:27:10 +01:00
Lotendan
4d62df488b Add support for initializer_list to wx dynamic arrays
While these array classes are deprecated in the user code, they're still
used, for compatibility, in many places in wxWidgets API and allowing to
create them from initializer_list makes using it more ergonomic as it's
now possible to just pass an initializer list of items to fill the
control with, for example, instead of appending them one by one.

Closes #23309.
2023-03-07 17:41:05 +01:00
Vadim Zeitlin
363f0988cf Replace wxScopedPtr with std::unique_ptr in the tests
Just use the standard class instead of the wx one, as they can be used
in exactly the same way.
2023-03-06 23:34:44 +01:00
Vadim Zeitlin
29a97bb52d Don't needlessly use wxScopedPtr in wxConfig unit test
Just use objects directly instead of pointers.
2023-03-06 23:22:05 +01:00
Vadim Zeitlin
38a0a72b71 Show date format in locale pseudo-test too
In addition to the decimal separator, show the date format for the
current locale too in wxUILocale::ShowSystem pseudo-test to check that
this works as expected.
2023-03-04 23:37:05 +01:00
Vadim Zeitlin
7bad8b1060 Fix more -Wshorten-64-to-32 occurrences and test for them
Add more static casts to avoid harmless warnings about long and/or
size_t to unsigned int conversions and enable -Wshorten-64-to-32 in the
allheaders test to ensure they don't get introduced again in the future.
2023-02-27 13:47:57 +01:00
Vadim Zeitlin
7ae9e9b974 Add test really checking wxGridSizer::Layout()
The existing test with this name only checked wxFlexGridSizer::Layout()
and the base class uses a different implementation, which merits its own
unit test.
2023-02-23 15:37:32 +00:00
Vadim Zeitlin
3ed5e42441 Merge branch 'scintilla-5.0' of https://github.com/MaartenBent/wxWidgets
Update Scintilla to 5.0.

See #23117.
2023-02-20 18:25:35 +01:00
Vadim Zeitlin
c6a18264e1 Fix signed/unsigned comparison warnings in wxPropertyGrid tests
Use size_t for a variable being compared with a size_t expression.
2023-02-19 23:47:08 +01:00
Artur Wieczorek
5b1911523c Add more unit tests of wxPGVIterator 2023-02-19 22:36:40 +01:00
Artur Wieczorek
f1273ce152 Use class enums to implement bitmask types
To improve type safety of flags.
2023-02-19 22:36:21 +01:00
Maarten Bent
b0385e498c
Rebake after bakefile changes 2023-02-14 22:52:26 +01:00