2700 Commits

Author SHA1 Message Date
5136db1fcc Merge commit '63f83c096ccf7b16ed96d60e56d08caacaaa6771' 2021-11-29 14:55:52 +01:00
9cd8cc04dd Mark MSVS *.vcxproj.filters files as using CR LF as well
For consistency with *.vcxproj and *.sln and for making
check_mixed_eol.sh happy.

Signed-off-by: Simon Rozman <simon@rozman.si>
2021-11-24 14:49:46 +01:00
Vadim Zeitlin
63f83c096c Merge branch 'webview_runscript_improvements' of https://github.com/TcT2k/wxWidgets
Add WebView::RunScriptAsync() for running scripts asynchronously.

See https://github.com/wxWidgets/wxWidgets/pull/2316
2021-11-16 17:30:55 +01:00
Vadim Zeitlin
46973762ba Explain how to build the tests
It may not be obvious how to build the tests, so add a section
explaining this to the existing file containing the instructions about
writing the tests and add a README to the tests directory itself to
increase chances that this file will be found -- hopefully anybody
interested in the tests will look at the README in the directory
containing them.
2021-11-12 14:21:41 +01:00
David Costanzo
20208cc81f Fix loading bitmaps with malformed biClrUsed field
Stop throwing std::bad_alloc when BMP has large/negative biClrUsed by
checking that biClrUsed has a reasonable value before attempting to
allocate however much memory it indicates.

Add unit tests showing the loading such invalid bitmaps now correctly
returns an error rather than throwing an exception.

Closes https://github.com/wxWidgets/wxWidgets/pull/2583

Closes #19295.
2021-11-06 16:12:04 +01:00
Tobias Taschner
0921d0508a Add tests for wxWebView::RunScriptAsync() 2021-11-03 14:04:24 +01:00
Tobias Taschner
fd2920ff22 Fix wxWebViewEdge tests
Edge does not support the about: URL using it in the test resulted
in various problems. Just use about:blank for now as the edge backend
does not merge them for the history checks.
2021-11-03 11:18:53 +01:00
Vadim Zeitlin
c28c7edbb4 Let wxGrid::GetSelectionBlockTopLeft/BottomRight work in any mode
These functions used to work in any mode until the changes of 02509cbc39
(Refactor wxGridSelection to store selection as blocks only, 2020-03-03)
and should continue to do so, if only for compatibility.
2021-10-26 19:51:26 +01:00
Vadim Zeitlin
da73be0d77 Upscale the biggest bitmap in the bundle if it's too small
The changes of b20552116c (Allow wxBitmapBundle to specify its preferred
bitmap size, 2021-10-19) resulted in never rescaling the bitmaps in
standard size in high DPI at all, which isn't the right thing to do: by
default, i.e. if just a single bitmap is specified, we should scale it
up as necessary in order to show the UI elements in the correct sizes.
2021-10-26 00:04:22 +02:00
Vadim Zeitlin
7b4257b9cd Respect the scale of the bitmap converted to wxBitmapBundle
Use the scaled size, different from the default size, when constructing
wxBitmapBundle from an existing wxBitmap to keep the existing code using
scaled bitmaps working.

Add a unit test checking that this now works as expected under the
platforms where scale factor is used.
2021-10-24 23:15:04 +02:00
Vadim Zeitlin
9e5c8eef24 Make wxDumpWindow() public and available in wxMSW too
This function was defined in wxGTK and wxOSX, but not in wxMSW or the
other ports, but it can be useful there too, so make it public and
define it in common code.
2021-10-20 23:35:37 +01:00
Vadim Zeitlin
85503d1dcd Get rid of CppUnit boilerplate in MiscGUIFuncsTestCase
Simplify code by not defining an unnecessary test case class and using
CATCH macros directly.

No real changes.
2021-10-20 23:35:37 +01:00
Vadim Zeitlin
87b394a555 Use wxScopedPtr in MiscGUIFuncsTestCase for automatic cleanup
Replace manual calls to Destroy() to ensure that the objects created in
this test will be destroyed even if a check fails.
2021-10-20 23:35:37 +01:00
Vadim Zeitlin
b20552116c Allow wxBitmapBundle to specify its preferred bitmap size
Using bitmaps of preferred size avoids scaling and results in much
better appearance, so add methods allowing querying the bundle about the
bitmaps it supports and implement them in the various implementations.

This is not actually used anywhere yet, but will be soon.
2021-10-19 02:20:26 +01:00
Vadim Zeitlin
fb4e188cea Add wxHAS_SVG feature test macro
This is more clear and future-proof than using wxHAS_RAW_BITMAP for
checking for SVG availability.
2021-10-05 16:12:01 +01:00
Vadim Zeitlin
ab619010bd Add FromSVG() overload taking const data
Passing non-const data is inconvenient and error-prone, as data can't be
used again after it was modified by Nano SVG, which resulted in the
button using SVG bitmap not working any longer in the toolbar sample
after recreating the toolbar.

So make it easier to do the right thing, while still keeping the
overload taking non-const data for the situations when avoiding an extra
copy is worth it.
2021-10-05 16:06:43 +01:00
Vadim Zeitlin
ac02ae877f Add simple wxBitmapBundle::FromSVG() implementation using NanoSVG
Add nanosvg submodule and use it in the generic implementation of this
function.

This is incomplete yet and, notably, doesn't cache the rasterized
images, but already shows that using SVG images works (at least in the
toolbar sample).
2021-10-05 16:06:43 +01:00
Vadim Zeitlin
7337bf1da1 Add a simple wxBitmapBundle unit test
Check for the minimal functionality when using vector-based
implementation.
2021-10-05 15:49:43 +01:00
Vadim Zeitlin
79582adeb4 Merge branch 'list-std'
Fix build in STL mode under OpenVMS.

See https://github.com/wxWidgets/wxWidgets/pull/2528
2021-09-23 16:25:51 +02:00
Artur Wieczorek
37ad7bb30e Adjust point to be tested in wxListBox::HitTest for macOS 11
On macOS >= 11 wxListBox has a new layout because underlying
NSTableView has a new style with padding so we need to move
the point to be tested to another position.
2021-09-22 22:19:45 +02:00
Vadim Zeitlin
364835706c Add unit test for wxWindowList::Find()
Check that Find() of a list declared using WX_DECLARE_LIST_3 (as
wxWindowList is) can be passed a pointer to the base class object and
still compiles and works correctly.
2021-09-22 18:07:08 +02:00
Vadim Zeitlin
ed19e5625b Fix wxFileName unit test under Unix after recent changes
Don't use GetVolumeSeparator() to combine UNC or GUID volumes with
paths, this doesn't work because this kind of paths doesn't contain
colons at all.

Update the documentation to mention this.
2021-09-15 13:10:25 +02:00
Vadim Zeitlin
e8629db48a Add another test case for wxPATH_NORM_DOTS
This was reported to not work but does work now.

See #15012.
2021-09-15 02:06:30 +01:00
Vadim Zeitlin
549e0a59b1 Fix handling of single letter shares in UNC paths in wxFileName
This comes at the price of breaking compatibility and returning
"\\share" rather than just "share" from wxFileName::GetVolume() for the
UNC paths. This breakage seems justified because it is required in order
to allow application code to distinguish between paths "x:\foo" and
"\\x\foo", which was previously impossible as GetVolume() returned just
"x" in both cases.

Document this change, adjust the existing checks for the new GetVolume()
semantics and add a new test which passes now, but didn't pass before.

Closes #19255.

This commit is best viewed ignoring whitespace-only changes.
2021-09-15 01:51:35 +01:00
Vadim Zeitlin
abf26b03a7 Fix wxFileName::Mkdir("/foo") under MSW
Creating a directory with the leading path separator unexpectedly
created it under the current directory rather than in the root of the
current drive under MSW, due to the path being considered relative, in
spite of starting with the path separator, because it didn't have the
volume.

Fix this by avoiding the use of IsAbsolute() in Mkdir() and checking for
m_relative instead, as it seems the safest possible fix for this bug
because changing IsAbsolute() to return true in this case might change
the behaviour of the existing code.

Closes #4470.
2021-09-13 21:25:30 +01:00
Vadim Zeitlin
8db2f45171 Fix handling multiple leading backslashes in wxFileName under MSW
Extend the existing workaround to work not only with explicitly
wxPATH_DOS paths, but with paths implicitly using the DOS format due to
it being the default format for the current platform.

Closes #19261.
2021-09-13 20:53:27 +01:00
Artur Wieczorek
a86419c0be Fix Window::SizerErrors test in release build
In release build no exceptions are thrown by wxASSERT/wxCHECK
so there is no need to check them.
2021-09-11 23:24:22 +02:00
Artur Wieczorek
4a7ac90ce3 Fix wxImage::InitAlpha tests in release build
In release build exceptions are not thrown
so there is no need to check them.
2021-09-08 17:43:25 +02:00
Vadim Zeitlin
8368914725 Merge branch 'compare-localized'
Allow creating wxUILocale for any locale and add
wxUILocale::CompareStrings().

See https://github.com/wxWidgets/wxWidgets/pull/2506
2021-09-05 23:16:10 +02:00
Vadim Zeitlin
3ca3944cff Add a pseudo-test for interactive wxUILocale::FromTag() testing
This allows to easily check whether the given locale is supported.
2021-09-05 00:10:05 +01:00
Vadim Zeitlin
2c580c9190 Add wxUILocale::FromTag() helper
This is exactly the same as wxUILocale(wxLocaleIdent::FromTag()) but
shorter.
2021-09-05 01:00:04 +02:00
Vadim Zeitlin
6b26deaddc Replace wxLocaleIdent ctor from language with FromTag()
This static function parses a subset of the language tags described in
BCP 47 (see https://www.rfc-editor.org/rfc/bcp/bcp47.txt).

Use the tag, as specified by this function, rather than the locale
identifiers components under MSW, where this should allow us to use even
locales that can't be described using just language-script-region.
2021-09-05 01:00:04 +02:00
Vadim Zeitlin
5233014a71 Add missing CHECK() to wxUILocale test case for MSW/Mac
Don't forget to check that the locale is actually supported, as
expected, under these platforms.
2021-09-05 00:15:39 +02:00
Vadim Zeitlin
44a5cf78d1 Allow rescaling larger images in Win64 builds
Use wxUIntPtr rather than (unsigned) long in wxImage::ResampleNearest()
as long is still 32 bits under Win64 and so doesn't allow the code there
to work with images larger than 2^16 in either direction, when it could
be allowed in this case.

Document the current limits on the size of the image and add a unit test
checking that resizing images of size greater than 2^16 works in 64 bits.

See #18550.
2021-09-04 18:59:33 +01:00
Vadim Zeitlin
0f79f69d88 Return empty bitmaps from wxButton if not explicitly set in wxMSW
Do this for consistency with the other ports and because this seems more
useful anyhow.

Update the documentation to make this behaviour more clear and document
this change as a (minor) incompatibility in wxMSW.

Also add more unit tests to check for this behaviour. Note this also
fixes the problem with the unit test added in the grandparent commit
under MSW.
2021-09-03 21:22:05 +02:00
Vadim Zeitlin
ff4cd70412 Avoid crash in wxBitmap::GetImage() for invalid bitmaps
Just return NULL from this (wxOSX private, in spite of not using a
port-specific prefix) method.

This fixes crash in wxButton::SetBitmapXXX(wxNullBitmap), as shown by
the new test case which used to crash but doesn't do it any longer.

Closes #19257.
2021-09-03 00:28:58 +02:00
Artur Wieczorek
0455e25302 Set window postion explicitly in clipping box test for wxClientDC
Set window position explictly to (0, 0) to avoid unwanted clipping
if defualt position selected by the system would place it (partially)
outside of the parent window.
2021-09-02 19:26:30 +02:00
Vadim Zeitlin
b306cfba26 Disable non-trivial CompareStrings() tests in ANSI build
UTF-8 strings can't be used in this case and we don't care enough about
this deprecated build to bother with using Latin-1 just for it.
2021-09-01 18:11:40 +02:00
Vadim Zeitlin
b14137a355 Skip tests using unsupported locales under Unix systems
At least under Linux it's common not to have all the supported locales
installed, so check that a locale is available to avoid test failures if
it isn't.

We still rely on all the locales we use being available under MSW and
macOS, as this should be always the case.
2021-09-01 18:11:40 +02:00
Vadim Zeitlin
32316af106 Add wxUILocale::IsSupported()
This function can now be implemented relatively straightforwardly
(although it does require an extra check under Mac), so add it, as it
can be generally useful and we're also going to need it for our own
tests in the upcoming commit.
2021-09-01 18:11:40 +02:00
Vadim Zeitlin
babcd16bc4 Disable CompareStrings() tests failing under Wine
There isn't much we can do about it, although perhaps these tests could
be re-enabled once https://bugs.winehq.org/show_bug.cgi?id=9583 is
fixed.
2021-09-01 18:11:40 +02:00
Vadim Zeitlin
ae81d9d207 Implement wxUILocale::CompareStrings() for Unix systems
This required changing CompareStrings() to be a method of wxUILocale
object, rather than just as a static function, as we must only allocate
the locale_t object once, and not during each to this function, as this
could make it unusably slow when using it as a comparison function when
sorting a large list of strings.

This is also more efficient under Mac, where we can similarly allocate
NSLocale only once and even marginally more efficient under MSW, where
we don't have to construct the locale string during each call. And,
under all platforms, it also simplifies code by separating this function
implementation from the initialization of wxUILocaleImpl.

Also document that case-insensitive comparison is not available under
Unix and adjust the tests accordingly.
2021-09-01 18:11:40 +02:00
Vadim Zeitlin
45f9908e05 Allow creating wxUILocale objects for any locale
Creating such objects (without using them for the UI) is supported under
all platforms, so allow doing it.

Note that this is only supported under Unix systems when locale_t and
related functionality is available, but this should be the case just
about everywhere by now.

Add a test (or, rather, replace an existing test which was disabled by
default) checking that we can now get locale information about any
locale, not necessarily the currently used one.
2021-09-01 18:11:40 +02:00
Vadim Zeitlin
e27497774a Optionally use case-insensitive comparison in CompareStrings()
Harmonize Mac and MSW versions by using case-sensitive comparison in
both of them by default, but allowing to use a flag to use
case-insensitive comparison instead.
2021-09-01 18:11:40 +02:00
Vadim Zeitlin
59e4e098b7 Add minimal tests for wxUILocale::CompareStrings()
Test the new function in a couple of different locales.
2021-09-01 18:11:40 +02:00
Vadim Zeitlin
abdf251b42 Convert intltest.cpp to UTF-8 encoding
Don't use Latin-1 for this file, this encoding is obsolete.

No real changes, the only non-ASCII character in this file was in a
comment anyhow.
2021-09-01 18:11:39 +02:00
Vadim Zeitlin
5216d97f08 Use arch suffix consistently in all directories names
For some reason, we used "vc_x64_lib" as the output directory for the
libraries, but "vc_mswu_x64" as the output directory for the samples.

Place the arch suffix, i.e. "_x64" part, always after the compiler
prefix (possibly including version), for consistency with both the
library output directories and with MSBuild project files, as
build/msw/wx_setup.props uses $(wxCompilerPrefix)$(wxArchSuffix)_...
as wxIntRootDir value.
2021-08-26 23:12:40 +02:00
Vadim Zeitlin
e307945170 Merge branch 'ui-locale'
Add wxUILocale class providing functionality which can be implemented
portably for all major platforms, including macOS, and doesn't force
the change of the global C locale, unlike wxLocale.

See https://github.com/wxWidgets/wxWidgets/pull/2464
2021-08-26 15:49:57 +02:00
Vadim Zeitlin
bf9a56d65c Merge branch 'ci-msw-vs2022'
Add minimal support for MSVS 2022 and CI builds using it.

See https://github.com/wxWidgets/wxWidgets/pull/2490
2021-08-26 00:04:37 +02:00
Vadim Zeitlin
2c4b627cff Remove warning messages from clipping box unit tests
There is nothing that can be done about the warnings saying that using
transform matrix is not supported for the given DC kind and it's not
going to change any time soon (i.e. implementing support for transform
matrix for wxSVGFileDC is not planned), but in the meanwhile it results
in a lot of useless output in the CI logs when running the tests, making
it difficult to find real problems in the test.

This commit is best viewed ignoring whitespace-only changes.
2021-08-25 23:57:12 +02:00