Commit Graph

63183 Commits

Author SHA1 Message Date
Vadim Zeitlin
5fb740fed8 Add a layout hack to PositionToCoords() unit test for wxGTK
The text control needs a few event loop iterations in order to layout
itself correctly, so give it up to 1 second to do it in order to avoid
spurious test failures that occurred if just a single call to wxYield()
were done (or, worse, none at all as it was the case before).

Also log the value returned by PositionToCoords() in case of test
failures.
2017-11-07 15:03:59 +01:00
Vadim Zeitlin
407d38d9ed Always use wxTE_MULTILINE explicitly in PositionToCoords() test
While it is added implicitly when running all tests in the order, this
style wasn't used if just this test was ran using "-c PositionToCoords"
option.

Specify wxTE_MULTILINE in it explicitly to allow this to work too.
2017-11-07 14:23:07 +01:00
Vadim Zeitlin
faad429b0f Fix wxTextCtrl::XYToPosition() for last position in wxGTK
Change this method to consider the coordinates corresponding to the last
position (i.e. the one beyond the last text character) as valid, for
consistency with wxMSW and to conform to the documented behaviour.

Also give more information about the failures in the corresponding unit
test to make debugging problems with this function simpler.
2017-11-07 14:12:48 +01:00
Vadim Zeitlin
6d55a533a3 Add overview of wxTextCtrl positions and coordinates
Explain the various coordinates that can be used and which positions are
considered valid and which are not.
2017-11-07 03:46:50 +01:00
Vadim Zeitlin
1c4e8377b7 Fix XYToPosition() for the last position in first line in wxGTK
This is similar to e74fb5effe for wxMSW
and ensures that we don't consider the last position on the first line
invalid in wxGTK neither.

This fixes TextCtrlTestCase::XYToPositionSingleLine() unit test failure.
2017-11-07 03:46:26 +01:00
Vadim Zeitlin
72fe57ec18 Use wxTextEntry::Clear() in wxOwnerDrawnComboBox::Clear()
This seems more natural than calling SetValue(wxEmptyString).

No real changes.
2017-11-07 03:14:49 +01:00
Vadim Zeitlin
13163fb315 Send event when clearing wxTextCtrl in wxGTK again
This was broken by 1c946a469a and resulted
in test failures in OwnerDrawnComboBoxTestCase::TextChangeEvents() unit
test because wxOwnerDrawnComboBox::Clear() used SetValue("") and didn't
generate any events any more.

Fix this regression by explicitly sending an event if we're returning
early and add a unit test explicitly checking that SetValue("") does
generate an event.
2017-11-07 03:12:10 +01:00
Vadim Zeitlin
3069167dd4 Do set the current test name when running the tests
The variables and helper TempStringAssign class were added in order to
implement this, but somehow it was never done, so wxGetCurrentTestName()
always returned an empty string.

Fix this and so store the class/method name of the currently running
test in the global variables to give more context, notably for GTK+
errors.
2017-11-07 02:54:25 +01:00
Vadim Zeitlin
79d35109f0 Avoid assert if there is no selection in wxListCtrl::DeleteItem()
Don't try making the current item visible if there is no current item.

This is another fix after 99d7b13e3f (in
addition to the previous 925a1c0734).
2017-11-07 02:54:24 +01:00
Vadim Zeitlin
cacb49c4ad Remove "test" from the sections names in Catch unit tests
It doesn't really add anything and it's more convenient to specify the
section on the command line (using the "-c" option) if it's just a
single word, without spaces, as it doesn't need to be quoted then.
2017-11-07 02:54:18 +01:00
Vadim Zeitlin
e8ceaabb87 Avoid gcc -Wunused-function warnings in wxEvtHandler unit test
The warnings are justified as the functions defined by the event table
macros are indeed not used here because we only write them to test that
they compile, but not useful, so suppress them.
2017-11-07 02:54:05 +01:00
hwiesmann
f9429b7db4 Make wxAuiManager::SavePaneInfo() parameter const
The pane is not modified by saving its details.
2017-11-05 23:45:21 +01:00
Vadim Zeitlin
b4e55a7192 Merge branch 'test-fixes'
Miscellaneous test fixes and disable the UI tests by default under
non-MSW platforms.
2017-11-05 23:44:01 +01:00
Paul Cornett
74282d9aed Fix DrawPoint() test
The result now matches non-GC wxDC, after 5ba7a1d1
2017-11-05 09:35:43 -08:00
Vadim Zeitlin
99378ed0d7 Disable tests using wxUIActionSimulator under non-MSW platforms
wxUIActionSimulator is just too unreliable to be used there, so while
fixing it should really be a priority, for now at least prevent these
spurious failures from masking any other ones, which indicate real
problems that need to be fixed.

Notice that these tests can still be enabled by setting the environment
variable WX_UI_TESTS to 1 (or disabled by setting it to 0 under MSW).
2017-11-05 17:51:55 +01:00
Vadim Zeitlin
0858cd52a7 Don't unnecessarily use heap-allocated objects in a test
Just use local stack variables instead.
2017-11-05 17:30:46 +01:00
Vadim Zeitlin
10b80a16f0 Factor out TempFile class and reuse it in other tests
Ensure we don't leave "mytext.dat" and "test.txt" lying around in any
directory the tests are run from by ensuring that these files are
destroyed by the test code using them.
2017-11-05 17:28:24 +01:00
Vadim Zeitlin
0425b8b7f0 Properly terminate UTF-16 strings in cMB2WC() unit test
Such strings must have 2 NUL bytes at the end, just the one added
implicitly to all C strings isn't enough.
2017-11-05 17:18:58 +01:00
Vadim Zeitlin
aaea62a322 Avoid launching interactive programs in unattended tests
This is typically going to fail anyhow, so don't even try to avoid
useless error messages.
2017-11-05 17:16:39 +01:00
Hartwig
d36d251e8d Improve documentation for loading and saving AUI layout
Give more details about LoadPerspective() and Save/LoadPaneInfo().

See https://github.com/wxWidgets/wxWidgets/pull/584
2017-11-05 16:51:53 +01:00
Tim S
1c2e58cd85 Remove cp commands copying removed files from help sample
Just remove the commands copying files that were removed in
961a1c2b39 themselves too.

See #17962.
2017-11-05 16:47:25 +01:00
Tim S
7f4035dc5b Update instructions for building under MSys2
Added "--needed --noconfirm" to pacman for faster package updating.
2017-11-05 16:47:17 +01:00
Lauri Nurmi
f529dfaaef Fix wxPenInfo ctor compilation with gcc 4.4.7 on CentOS 6
Use template argument when calling the base template class ctor.
2017-11-05 16:42:20 +01:00
Vadim Zeitlin
56323b5aba Merge branch 'log-encoding'
See https://github.com/wxWidgets/wxWidgets/pull/552

Closes #17385.
2017-11-04 18:20:24 +01:00
Vadim Zeitlin
a7dddd9f3b Refactor wxLog and wxMessageOutput classes to avoid duplication
Add wxMessageOutputWithConv mix-in class to avoid duplicating the same
code in wxLogStream and wxMessageOutputStderr.

Also derive wxLogStderr from wxMessageOutputStderr to reuse its code
without having to create a temporary object of this type (which will be
more expensive now that doing it involves creating a heap-allocated
conversion object copy).
2017-11-04 16:19:06 +01:00
Vadim Zeitlin
7872e8f7ef Allow using web extension from tests and sample
Check for web extension in ".." and "../.." to find it when running the
webview test and sample, respectively, even if "make install" hadn't
been done yet.

Also give a warning about the missing extension if we can't find it
anywhere.
2017-11-04 16:07:53 +01:00
Vadim Zeitlin
7e0b6d4d81 Merge branch 'webview-js-retval'
Integrate GSoC 2017 work by Jose Lorenzo on allowing returning values
from JavaScript code via wxWebView::RunScript().
2017-11-04 16:07:51 +01:00
Lauri Nurmi
6b73bd9136 Allow specifying character set for wxLogStderr and wxLogStream.
Until now, a mixture of non-UTF-8 and UTF-8 could be written in some circumstances.
2017-11-04 15:47:18 +02:00
Vadim Zeitlin
1417776d33 Make deleting toolbar from its own event handler work again
While it is not guaranteed in general that destroying a window from an
event handler for an event originating from this window itself works, it
did use to work in the case of wxToolBar and its event handlers. However
this stopped working since faffaaae29 as
it added a test using the now deleted object member fields after the
call to the event handler.

To fix this regression without reintroducing the bug fixed by that
commit (see #16762), add an ugly way to check if the toolbar is still
alive after a call to its event handler and do it explicitly after
OnLeftClick() returns.

Closes #17732.
2017-11-04 14:28:38 +01:00
Vadim Zeitlin
266152b459 Merge branch 'mbconv-len-fix'
Return buffers of correct length from wxMBConv::cWC2MB() and cMB2WC().
2017-11-04 14:20:15 +01:00
Vadim Zeitlin
c47acbeb52 Fix wxMBConv::cWC2MB() and cMB2WC() returned buffer length
This commit refactors the overloads of cMB2WC() and cWC2MB() methods
taking raw pointers and buffers to reuse the same code and fixes the
wrong length of the buffer returned by cWC2MB(wchar_t*) overload for
conversions using multiple bytes to represent the NUL terminator
character (it previously was wrong for UTF-16 and UTF-32 conversions due
to wrongly subtracting 1 from the length when creating it instead of
correctly subtracting GetMBNulLen()) and the wrong length of the buffer
returned from cMB2WC(char*) overload where no adjustment for the
trailing NUL was done at all.

Also return simple default-constructed buffers from these methods in
case of failure instead of using wxScopedCharBuffer::CreateNonOwned()
which is less obvious and less efficient (even if the latter probably
doesn't matter here because it's only done in case of an error).

Finally, add tests checking that using WC2MB() or either of cWC2MB()
overloads returns the buffers of the same length and with the same
contents.
2017-11-03 23:26:39 +01:00
Vadim Zeitlin
b8881c1b8e Test UTF-8 build on Travis CI
Instead of adding a separate build, just reuse the existing monolithic
build to also use UTF-8: this is unlikely to miss any problems with the
monolithic build that would be found without using these options, but
also gives us a chance to find the problems in UTF-8 build, both at
compile-time and in the test suite.
2017-11-03 23:11:33 +01:00
Vadim Zeitlin
9c1964ee1d Fix a unit test in UTF-8 build using UTF-8 strings only
Avoid the optimized mb_str() available in this build returning directly
a "char*" as it doesn't preserve the length of the string if it contains
NULs. Use mb_str(wxMBConv) overload instead which always returns the
buffer of the correct length.

Arguably, this is a problem of wxString API and maybe this optimized
mb_str() overload shouldn't be provided at all. OTOH the main reason for
wxUSE_UTF8_LOCALE_ONLY existence is optimization, so it seems a pity to
deliberately make the code less efficient when using it.
2017-11-03 23:11:32 +01:00
Vadim Zeitlin
6d3530a653 Merge branch 'cygwin-python'
Fix Python problem in Cygwin build on AppVeyor correctly.
2017-11-03 19:46:36 +01:00
Paul Cornett
d57d9ffaf7 Avoid some GTK+ run-time errors when using wx{File,Dir}PickerCtrl
The wxGTK implementation uses wx{File,Dir}Button, which derives from
wxButton, but is not a GtkButton, so many operations which try to modify
it, such as changing it's style, are likely to result in errors.
See #17984
2017-11-03 11:45:50 -07:00
Vadim Zeitlin
84b2ba40ee Fix wrong wxStringOutputStream optimization for UTF-8 build
We can only use utf8_length() if the conversion used with this object
uses UTF-8 too, otherwise we still need to do the conversion to find out
how many bytes does the string content take in the given encoding.

See #17985.
2017-11-03 18:48:38 +01:00
Vadim Zeitlin
8bf239f8e4 Make wxMBConv dtor inline
The Darwin linking problem mentioned in the comment doesn't exist in any
of the still supported macOS versions, so it doesn't make sense to
continue working around it.
2017-11-03 18:00:04 +01:00
Vadim Zeitlin
2e9e38aba1 Revert "Work around using Python in Cygwin AppVeyor build"
This reverts commit 257974e321 as it
shouldn't be needed any more after the last commit.
2017-11-03 17:34:51 +01:00
Vadim Zeitlin
69d3c2bf50 Use -g (--upgrade-also) switch with Cygwin setup on AppVeyor
This is necessary to properly upgrade the package dependencies when
installing the new versions of the packages themselves and fixes the
problem with the new Python 2.7.14 failing to run since its package was
updated from 2.7.13.
2017-11-03 17:33:13 +01:00
Vadim Zeitlin
724de3e1d1 Merge branch 'strstream-pos-fix'
See https://github.com/wxWidgets/wxWidgets/pull/580

Closes #17985.
2017-11-03 17:24:35 +01:00
Vadim Zeitlin
70c057ed8a Revert "Test using previous build platform for AppVeyor"
This reverts commit b05d864f5e as it
didn't help with Python-related build failures, finally.
2017-11-03 16:58:33 +01:00
Vadim Zeitlin
257974e321 Work around using Python in Cygwin AppVeyor build
This doesn't work any longer since Cygwin Python 2.7.14 update, see
https://cygwin.com/ml/cygwin/2017-11/msg00053.html

Avoid using it by preventing include/wx/stc/stc.h file from being
updated, this shouldn't be necessary anyhow as the version in git should
be already up-to-date.
2017-11-03 15:46:33 +01:00
Vadim Zeitlin
e3589af56a Fix wxStringOutputStream position when using external string
Initialize m_pos correctly when using an existing, and hence possibly
not empty, string (and not the internal one which is always empty
initially). The old code was totally wrong as it divided the string
length by the size of wxChar instead of multiplying by it, but doing
this could have been wrong too with UTF-16 and surrogates, so use the
conversion object to compute the real length of the string
representation in the corresponding encoding.

Add a simple unit test checking that this works as intended.

Closes #17985.
2017-11-03 15:25:36 +01:00
Vadim Zeitlin
8e7fef5f08 Make wxStringOutputStream ctor explicit
Avoid accidentally creating wxStringOutputStream from a wxString
pointer, this seems unlikely, but why take the risk of it happening at
all.
2017-11-03 00:36:48 +01:00
Vadim Zeitlin
e09d87f54b Move wxStringOutputStream ctor to the source file
There is no real need for this not quite trivial function to be inline.

No real changes.
2017-11-02 23:36:05 +01:00
mgimenez
16888e9883 Fix copy-paste typo in wxGrid::DeleteRows() documentation
Just use the correct verb.

Closes #17987.
2017-11-02 20:51:34 +01:00
Paul Cornett
d76e627341 More use of wxFALLTHROUGH 2017-11-02 08:56:29 -07:00
Paul Cornett
c2513d8a4e Add missing break statement 2017-11-02 08:55:00 -07:00
Vadim Zeitlin
f200015b3c Fix wxFileDialog::SetExtraControlCreator() supported platforms
Just remove them, actually, as this functionality is supported by all 3
major platforms.
2017-11-02 14:55:54 +01:00
Vadim Zeitlin
b3fe07942f Remove top level "const" from wxMBConv methods return values
This "const" is useless and doesn't actually do anything, remove it to
avoid confusion.
2017-11-02 01:57:22 +01:00