Commit Graph

1902 Commits

Author SHA1 Message Date
Vadim Zeitlin
b88d5e08ce Fix adding pages without associated window to wxTreebook
wxTreebook is supposed to allow not specifying any valid window for the
top-level pages, but this didn't work any longer, probably since the
changes of 02a92e23f3 (see #4379), as a
possibly null page was dereferenced without checking, resulting in a
crash.

Fix this by adding a missing check.

Also rename DoGetNonNullPage() to TryGetNonNullPage() to make it more
clear that this function can return null and add a unit test checking
that calling AddPage(NULL) really works (or at least doesn't crash).

See https://github.com/wxWidgets/wxWidgets/pull/921
2018-09-18 00:33:59 +02:00
Vadim Zeitlin
6401c2e956 Merge branch 'font-fixes'
Complete support for fractional point sizes and font weights other than
light/bold.

Also harmonize wxFont API and implementation among all ports (fixing
compilation of those of them that were broken by recent changes).

See https://github.com/wxWidgets/wxWidgets/pull/919
2018-09-17 22:58:56 +02:00
Vadim Zeitlin
f69dbaa1ae Introduce MSW ARM64 support
This is a preliminary ARM64 platform support for wxWidgets at "it
compiles" stage. This will allow building and testing wxWidgets based
apps for oncoming Windows 10 ARM64.

Requirements:
- Visual Studio 2017 Update 4 or later with Visual C++ compilers and
  libraries for ARM64 component installed

Building:
1. Open command prompt.
2. Change directory to build\msw subfolder.
3. Run "C:\Program Files (x86)\Microsoft Visual
   Studio\2017\Community\VC\Auxiliary\Build\vcvarsamd64_arm64.bat" once.
4. Use `nmake TARGET_CPU=ARM64 ...` to build required flavor of wxWidget
   libraries.

Notes:
1. Building of *.sln/*.vcxproj files does not support ARM64 yet. This
   requires to hardcode Windows SDK to 10.0.15063.0 or later in
   *.vcxproj files, which would render them non-compilable in older
   Visual Studio versions. Microsoft is aware of this issue and is
   planning a fix in the next version of Visual Studio.
2. wxmsw31ud_gl.dll does not build yet. Awaiting Microsoft to deliver
   missing opengl32.lib for ARM64. Please, specify USE_OPENGL=0.

Closes https://github.com/wxWidgets/wxWidgets/pull/923
2018-09-17 22:34:32 +02:00
Vadim Zeitlin
b1dcdb864c Add simple unit tests for the new wxFont features
Check that calling SetFractionalPointSize() and SetNumericWeight() at
the very least results in the expected return values from
GetFractionalPointSize() and GetNumericWeight().
2018-09-17 15:24:42 +02:00
Artur Wieczorek
75225cc1a6 Remove references to "adv" library from MSVS 201x test projects 2018-09-13 20:56:54 +02:00
Vadim Zeitlin
08e5acedcc Centralize backwards compatibility code in wxFont
Add wxFontBase::AccountForCompatValues() and use it in all ports instead
of redoing the same comparison with wxDEFAULT in all of them.

This is done not so much to avoid the code duplication, which was
minimal anyhow, but to make the code more clear and make it easier to
remove it from all ports at once in the bright (but remote) future when
we don't need these compatibility hacks any more.

Also document that wxDEFAULT and wxNORMAL are only handled specially in
the old-style ctor taking the individual font components and not the new
one using wxFontInfo and extend the unit test to check this.
2018-09-07 03:08:42 +02:00
Vadim Zeitlin
b84db46feb Add unit test for wxFont::GetStyle() and special style values
Similarly to the previous commit, verify that wxNORMAL, wxITALIC and
wxSLANT still work for compatibility (note the latter is synonymous with
wxITALIC under MSW).
2018-09-06 03:13:23 +02:00
Vadim Zeitlin
5bf920775a Add unit test for wxFont::GetWeight() and special weight values
Verify that using wxNORMAL, wxBOLD and wxLIGHT still works, as they must
do for compatibility reasons.
2018-09-06 03:13:23 +02:00
Vadim Zeitlin
de3cc614b2 Add unit test for wxFont::GetPointSize() and special sizes
Verify that using wxDEFAULT works to create a font of default size, for
compatibility reasons, and that using -1 works in the same way too.
2018-09-06 03:13:23 +02:00
Vadim Zeitlin
7cc016b5fa Remove CppUnit boilerplate from wxFont unit test
No real changes, just remove the test case class which is not at all
necessary in this unit test.
2018-09-06 03:13:23 +02:00
Vadim Zeitlin
76aad86cfb Remove unnecessary wxUSE_FONTMAP guard from wxFont unit test
This test doesn't require wxFontMapper.
2018-09-06 03:13:23 +02:00
Vadim Zeitlin
3ffa651a34 Move wxAdv library contents into wxCore
This basically removes the "adv" library, even though it's still
preserved for compatibility with user make/project files referring to
it.

It is done because the distinction between "adv" and "core" was never
really clear (e.g. why wxTreeCtrl was in core but wxTreeListCtrl in
adv?) and it prevented some core classes from using adv ones.
2018-08-27 21:13:04 +02:00
Vadim Zeitlin
a59f5932df Add wxHtmlContainerCell::Detach()
This allows manipulating the HTML DOM from the outside, e.g. to detach
a header element in order to be able to repeat it on all pages.
2018-08-25 21:16:55 +02:00
Vadim Zeitlin
869fb4f2bc Remove CppUnit compatibility macros from wxHtmlParser test
There was just a single test there, so remove all CppUnit boilerplate
which accounted for more than 50% of the file before adding more tests.
2018-08-25 21:00:11 +02:00
Vadim Zeitlin
de5ba70203 Fix handling events from their items in submenu itself
This previously worked in wxGTK, but not in wxMSW and even under wxGTK
it could be surprising that the submenu got the event, but its parent
menu did not.

Make things consistent between the platforms and send the event to the
menu directly containing it first, but then also to its parent menu(s).

Document the new behaviour and verify that it works as intended with a
new unit test.

Closes #18202.
2018-08-25 02:36:45 +02:00
Vadim Zeitlin
48da21619e Merge branch 'treectrl-delete-events'
See https://github.com/wxWidgets/wxWidgets/pull/881
2018-08-18 15:07:37 +02:00
Vadim Zeitlin
3c8b9589d8 Test that wxTreeCtrl::DeleteAllItems() does send events
This seems to be the case under all still supported MSW versions, so
remove the note saying that the events might not be sent from the
documentation and add a unit test verifying that they are indeed sent.
2018-08-14 17:50:28 +02:00
Vadim Zeitlin
d9d05bc221 Document that wxTreeCtrl::DeleteChildren() does send events
Contrary to what the documentation stated previously, this function does
generate the wxEVT_TREE_DELETE_ITEM events for all the items being
deleted, in both MSW and generic implementations.

Update the documentation and add a new unit test checking that the
behaviour really conforms to it.
2018-08-14 17:48:46 +02:00
Maarten Bent
bcfc9a8a26 Fix printf tests for recent MinGW versions
The default mantissa length was changed from 3 to 2 in MinGW 5.0.4.
Fix the test for printing pointer addresses in 64bit MinGW.
2018-08-02 21:10:20 +02:00
Maarten Bent
f3ae302b4d Prevent segfault in vararg test with MinGW
The segmentation fault is caused by swscanf with __USE_MINGW_ANSI_STDIO=1.
See https://sourceforge.net/p/mingw-w64/mailman/message/36118530/
2018-08-02 20:50:55 +02:00
Maarten Bent
da9b4bc0a0 Remove unused variable in graphpath test 2018-07-29 16:29:36 +02:00
Maarten Bent
5ea4e639b6 Fix type cast warning in thread test 2018-07-29 16:29:36 +02:00
Maarten Bent
5da4e81e10 Fix type casts and invalid format specifiers in interactive tests 2018-07-29 16:29:35 +02:00
Maarten Bent
a5b1a418bb Use wxPrintf in interactive tests
Remove unneeded calls to c_str() and mb_str().
2018-07-29 16:26:41 +02:00
Maarten Bent
57180d68c8 Add wxOVERRIDE to test files
And cleanup some tailing spaces and tabs.
2018-07-29 12:08:53 +02:00
Artur Wieczorek
e732da462f Add tests for the bounds of wxGraphicsPath
Check if bounding box of wxGraphicsPath is properly determined.
2018-07-28 11:36:44 +02:00
Vadim Zeitlin
1345b38c51 Merge branch 'gtk-datapick-focus'
Fix focus event generation for generic wxDatePickerCtrl and other
wxCompositeWindows.

See https://github.com/wxWidgets/wxWidgets/pull/860

Closes #18120.
2018-07-25 20:15:32 +02:00
Vadim Zeitlin
fb71adab04 Add a unit test for wxDatePickerCtrl focus events
Unfortunately it doesn't work with wxGTK, as usual, due to
wxUIActionSimulator not working correctly there.
2018-07-25 18:18:18 +02:00
Vadim Zeitlin
9e05eb42b5 Fix outdated comment in wxHtmlPrintout unit test
This should have been part of 321854b519
which changed the code, but not the accompanying comment.
2018-07-25 13:52:49 +02:00
Vadim Zeitlin
0338796847 Remove unnecessary headers from wxHtmlPrintout unit test
These headers were added by 905789485a
which was replaced with 321854b519 later
and are not needed any more.
2018-07-25 13:49:00 +02:00
Vadim Zeitlin
6acd663190 Revert "Add even more debug output to the test"
This reverts commit 1ce009e73a as AppVeyor
test failures problem is fixed now.
2018-07-25 13:47:13 +02:00
Vadim Zeitlin
542124aa95 Fix page-break-inside:avoid to work for nested tags too
The initial version was too naïve and didn't work correctly if the <div>
with this style had nested elements.
2018-07-25 02:23:02 +02:00
Vadim Zeitlin
321854b519 Try using fixed font size in pixels in the test 2018-07-22 00:54:05 +02:00
Vadim Zeitlin
1ce009e73a Add even more debug output to the test 2018-07-22 00:43:26 +02:00
Vadim Zeitlin
96cca10328 Use fixed font name in the HTML pagination test 2018-07-22 00:43:26 +02:00
Vadim Zeitlin
905789485a Fix the just added pagination test for high DPI systems
Adjust the font size used by a DPI-dependent factor to ensure that the
text takes the same amount of pixels independently of DPI.
2018-07-22 00:43:25 +02:00
Vadim Zeitlin
566e401a3f Add support for style="page-break-inside:avoid" to wxHTML
Allow using this style to prevent page breaks inside the given <div>.
2018-07-22 00:43:25 +02:00
Vadim Zeitlin
02ffdd16f6 Fix using WX_DECLARE_OBJARRAY() with pointer types
While this doesn't make, and never made, any sense (pointers should be
stored in a plain, non-object array), we still should continue to
support it for compatibility.

Fix the problem introduced by 97684a9267
by writing "T const&" instead of "const T&" as the latter didn't have
the same meaning when the macro parameter "T" expanded into "U*" as
"const" applied to "U", making this type incompatible with the actual
one.

Also extend the unit test to check for this.
2018-07-15 14:48:08 +02:00
Artur Wieczorek
fc53007ab4 Add unit test for current point of wxGraphicsPath
Verify that last point is properly positioned after the operations
on wxGraphicsPath.

See #18111.
2018-07-02 20:08:30 +02:00
Vadim Zeitlin
f03d655b1a Enable running TLW activation unit tests in CI environments
Hopefully the previous commit fixed it under AppVeyor.
2018-06-22 02:44:40 +02:00
Vadim Zeitlin
a8c1ae7058 Fix TLW activation unit test
Ensure that another TLW is active before calling ShowWithoutActivating()
as otherwise the newly shown window would be considered active, even if
it actually isn't, because it contains the current focus.
2018-06-22 02:43:23 +02:00
Vadim Zeitlin
c0be6a38c4 Merge branch 'gtk-entry-hittest'
Implement wxTextCtrl::HitTest() for single line controls in wxGTK.

See https://github.com/wxWidgets/wxWidgets/pull/826
2018-06-21 16:08:16 +02:00
Vadim Zeitlin
9cc2dbc9f1 Merge branches 'svgdc-clip' and 'fix-dc-clipper-restore'
Various clipping-related fixes.

See https://github.com/wxWidgets/wxWidgets/pull/835

See https://github.com/wxWidgets/wxWidgets/pull/836
2018-06-21 16:07:59 +02:00
Vadim Zeitlin
01cd3cc019 Fix image unit test compilation when wxUSE_GIF==0
Don't compile GIF-related test cases and don't add GIF image handler in
this build configuration.
2018-06-20 18:15:38 +02:00
Vadim Zeitlin
070336470f Make wxSVGFileDC::GetClippingBox() actually work
wxSVGFileDCImpl class uses the default, i.e. inherited from wxDCImpl,
implementation of this method, but for it to work, the clipping box
coordinates stored in wxDCImpl need to be updated when the clipping
region changes or is destroyed and this wasn't done before.

Fix this now and add a unit test verifying that this indeed works.
2018-06-18 17:11:16 +02:00
Vadim Zeitlin
e13904308f Add convenient tags for clipping box unit tests
No real changes, just replace the old CppUnit test registration macros
with wxREGISTER_UNIT_TEST_WITH_TAGS() which allows to specify the tags
explicitly and use "clip" as the tag for all the tests here to allow
running all of them (and just them) by specifying "[clip]" on the test
program command line.
2018-06-18 10:54:26 +02:00
Vadim Zeitlin
96d9616201 Merge branch 'html-print-cleanup'
Simplify wxHTML pagination code and make it easier to reuse from
applications.

See https://github.com/wxWidgets/wxWidgets/pull/817
2018-06-10 14:56:33 +02:00
Vadim Zeitlin
06f554775c Add unit test for wxTextCtrl::HitTest() for single line controls
Note that the control needs to be created with a reasonable size for
HitTest() to work correctly (at least under MSW, but probably not only),
so change the test set up function to use some fixed size for all kinds
of controls instead of doing it only for the multi-line ones.
2018-06-03 17:05:11 +02:00
Vadim Zeitlin
950b1a9d51 Merge branch 'replace-connect-bind'
Replace almost all occurrences of wxEvtHandler::Connect() with Bind().

See https://github.com/wxWidgets/wxWidgets/pull/820
2018-06-01 18:31:59 +02:00
Vadim Zeitlin
5f7a6bd15b Replace Connect() with Bind() in all samples and utils too
Still use Connect() in unit tests which were written explicitly for it
and in EventConnector, which can't use Bind() as it uses a variable for
the event type.

No real changes, just use the newer and more convenient function.
2018-05-31 16:19:23 +02:00