Commit Graph

2722 Commits

Author SHA1 Message Date
Vadim Zeitlin
559ea66e55 Use DPI aware manifests for MSVS 2022 too 2021-12-18 13:22:59 +01:00
Vadim Zeitlin
e4ff06ebdd Also remove mentions of amd64_dpi_aware_pmv2.manifest from the manually maintained MSVS projects 2021-12-17 22:00:42 +01:00
Vadim Zeitlin
5d6b2f6704 Rebake after parent commit changes 2021-12-17 21:29:49 +01:00
Vadim Zeitlin
9aaadab7d6 Check for most clang warnings in our headers in the test suite
Make allheaders unit test also enable -Wall, -Wextra and -Wpedantic for
clang to detect any warnings it might give in wx headers.

Don't use -Weverything because there are just too many warnings we'd
need to disable then.
2021-12-15 17:50:55 +01:00
Vadim Zeitlin
d1b5fd27aa Enable long path normalization test by default
It seems that the default value of NtfsDisable8dot3NameCreation registry
value is 2, and not 0, since a very long time (at least Windows 7), so
the wxPATH_NORM_LONG test was never actually executed.

Change the check guarding it to check if the value of the key is
different from 1 instead of checking that it is 0, as the test can still
succeed on the systems where this is the case.

Of course, it can also fail, if short names are disabled for the current
volume, but let's see if this is a problem in practice before doing
something more complicated to deal with this case.
2021-12-10 17:27:06 +01:00
Vadim Zeitlin
b247a1ee70 Use testdata.conf for the wxPATH_NORM_LONG test
This file already exists in the test directory, as it's used by another
test, so just use it instead of relying on the existing of mkinstalldirs
in the parent directory, which is not guaranteed as CMake build runs the
tests from a different directory, which is not the immediate child of
the top source directory.
2021-12-10 17:27:02 +01:00
Vadim Zeitlin
1e683c1401 Rename testdata.fc to testdata.conf
No real changes, just use a more clear and longer (which will be
important for the next commit) name for a test file.

Remove the non-existing samples/console/testdata.gc from make_dist.mk
(there are other non-existing files still referenced there).
2021-12-10 17:26:49 +01:00
Simon Stone
0fc936ca41 Add wxIntegerValidatorctor ctor taking minimum and maximum value
Using this ctor is more convenient than using the default ctor and then
calling SetMin() and SetMax().

Document the new ctor and add tests showing that minimum and maximum
values are actually respected.

Closes https://github.com/wxWidgets/wxWidgets/pull/2610
2021-12-09 19:55:44 +01:00
Tobias Taschner
bbca67df67 Implement wxFSVolume for macOS
Implement with NSFileManager and NSURL to provide basic functionality
like on MSW. Icons are not implemented for macOS.
2021-12-01 23:35:19 +01:00
Vadim Zeitlin
8adfaa37f7 Add wxBitmapBundle::FromSVGFile() helper
This is just a trivial wrapper for wxBitmapBundle::FromSVG(), but it can
still be convenient to have.
2021-11-29 12:55:22 +00:00
Vadim Zeitlin
5efcaf4e59 Fix copying testdata.fc file to the tests build directory
This file was listed in test.bkl but wasn't actually copied because the
value of <files> was overwritten by another <files> just below ever
since the changes of 21fe35aff7 (add wxImage test units to test loading
from both seekable and non-seekable streams, 2009-06-01).

Fix this by splitting this wx-data into 2 different ones, to avoid this
conflict.
2021-11-28 22:16:12 +01:00
Artur Wieczorek
fc6bfbc0bf Add tests of clipping regions with wxDC with RTL layout enabled 2021-11-28 17:05:34 +01:00
Paul Cornett
b04c1ace47 Avoid integer overflow when computing image data size in wxImage::Create()
See #19326

Co-Authored-By: David Costanzo <david_costanzo@yahoo.com>
2021-11-27 17:14:28 -08:00
Vadim Zeitlin
7ba71ecaa2 Merge branch 'size-div-double'
Add operator/(wxSize, double) and cleanup some wxSize and related tests.

See https://github.com/wxWidgets/wxWidgets/pull/2593
2021-11-25 15:16:53 +01:00
Simon Rozman
e3535d6481 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 12:13:12 +01:00
Vadim Zeitlin
2bbe126dca Add operator/(wxSize, double)
For some reason, while both operator*(wxSize, double) and
wxSize::operator/=(double) existed, this one did not, which was
unexpected, so add it too.
2021-11-20 22:06:28 +01:00
Vadim Zeitlin
9941531efc Simplify wxSize unit test further by comparing wxSizes directly
This is shorter and more clear than comparing width and height
independently and results in just as informative messages in case of
test failure if asserthelper.h is included.
2021-11-20 22:01:31 +01:00
Vadim Zeitlin
a18e00379e Get rid of CppUnit boilerplate in wxPoint and wxRealPoint tests
Similar to the previous commit, this doesn't really change anything, but
simplifies things.
2021-11-20 21:57:35 +01:00
Vadim Zeitlin
227b5dba0a Get rid of CppUnit boilerplate in wxSize unit test
No real changes.
2021-11-20 21:52:59 +01:00
David Costanzo
0985996d01 Fix loading of RLE bitmaps in wxBMPHandler
- Fix handling of delta encoding that change vertical position
- Fix handling of end-of-line encodings that are given mid-line
- Removed unnecessary computation for linepos

Add regression tests for the bitmaps using RLE and loading which
previously didn't work correctly.

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

Closes #19318.
2021-11-18 15:37:03 +01:00
Vadim Zeitlin
94f10eba4e Merge branch 'extra_accels' of https://github.com/vadz/wxWidgets
Allow defining additional accelerators for the menu items.

See https://github.com/wxWidgets/wxWidgets/pull/2588
2021-11-18 15:29:56 +01:00
Vadim Zeitlin
c36cc54d74 Simplify checking for menu events in the unit test
This should make the explicit casts such as added in 8db55e9653
(Explicitly cast enum to int inside CHECK(), 2019-09-30) and the
previous commit unnecessary, result in better messages if a test fails
and allow the other tests to still run after the failing tests, as we
use CHECK() instead of CPPUNIT_ASSERT(), which maps to REQUIRE(), now.
2021-11-16 20:34:19 +01:00
Vadim Zeitlin
5f5d61f759 Apply workaround for ancient MinGW to the menu unit test
Do the same thing for the just added tests as was already done in
8db55e9653 (Explicitly cast enum to int inside CHECK(), 2019-09-30) for
the other ones.
2021-11-16 20:21:51 +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
Alexander Koshelev
0cd898975c Allow to add extra accelerators to wxMenuItem
These accelerators are not shown in wxMenuItem label, but still will
work.

Implement support for them in all major ports and XRC.

Co-Authored-By: Vadim Zeitlin <vadim@wxwidgets.org>
2021-11-16 17:26:39 +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