Commit Graph

63370 Commits

Author SHA1 Message Date
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
Vadim Zeitlin
6e7254a7a1 Move both wxMBConv::cXX2YY() overloads together
No real changes, just group the overloads in a more logical way.
2017-11-02 01:57:20 +01:00
Vadim Zeitlin
18063f38ff Update comment describing wxMBConv::cMB2WC() and cWC2MB()
Don't say that these functions return NULL pointers when they don't
return pointers at all any more (and since quite some time).
2017-11-02 01:57:18 +01:00
Vadim Zeitlin
72781e78d8 Merge branch 'catchify'
Switch from CppUnit to Catch for the unit tests.

Closes https://github.com/wxWidgets/wxWidgets/pull/577
2017-11-02 01:55:00 +01:00
Vadim Zeitlin
62979a5f6f Remove unused member variables from unit testing class
Thanks clang for the reminder about them with its -Wunused-private-field
warnings.
2017-11-02 01:53:33 +01:00
Vadim Zeitlin
fdad46b10d Suppress some harmless clang warnings in a Catch header
Just avoid harmless but annoying warnings in catch_impl.hpp when using
clang.
2017-11-02 01:53:31 +01:00
Vadim Zeitlin
c363ce8500 Don't use "-t" option when running tests any longer
This option now lists the available tags instead of showing the timing
information.

We could use Catch "--durations yes" option, but it results in too much
output, so for now just run the tests with default verbosity.
2017-11-02 01:53:29 +01:00
Vadim Zeitlin
d78b7d2f27 Fix a typo in Catch tutorial link
No real changes.
2017-11-02 01:53:27 +01:00
Vadim Zeitlin
729dd5e693 Work around Catch multi-thread unsafety
Don't use Catch asserts in threads other than main, this doesn't work
reliably.

Switch to using simple wxASSERT() which doesn't give as much information
as Catch asserts when the test fails, but at least allows the tests to
pass when the asserts don't fail.
2017-11-02 01:53:25 +01:00
Vadim Zeitlin
ebf30adeb6 Avoid calling strftime() with an invalid format string
This results in an assertion from MSVC CRT implementation which was
somehow consumed by CppUnit but with the switch to Catch resulted in a
test failure.
2017-11-02 01:53:23 +01:00
Vadim Zeitlin
f3f345eec9 Fix harmless signed/unsigned comparison warnings in a test
These warnings appeared after switching to Catch, just use the same type
for all variables to avoid them.
2017-11-02 01:53:21 +01:00
Vadim Zeitlin
e70fc11ef1 Replace CppUnit with Catch for unit tests
Drop the legacy CppUnit testing framework used for the unit tests.
Replacing it with Catch has the advantage of not requiring CppUnit
libraries to be installed on the system in order to be able to run
tests (Catch is header-only and a copy of it is now included in the
main repository itself) and, in the future, of being able to write
the tests in a much more natural way.

For now, however, avoid changing the existing tests code as much as
[reasonably] possible to avoid introducing bugs in them and provide
the CppUnit compatibility macros in the new wx/catch_cppunit.h header
which allow to preserve the 99% of the existing code unchanged. Some
of the required changes are:

 - Decompose asserts using "a && b" conditions into multiple asserts
   checking "a" and "b" independently. This would have been better
   even with CppUnit (to know which part of condition exactly failed)
   and is required with Catch.

 - Use extra parentheses around such conditions when they can't be
   easily decomposed in the arrays test, due to the use of macros.
   This is not ideal from the point of view of messages given when
   the tests fail but will do for now.

 - Rewrite asserts using "a || b" as a combination of condition
   checks and assert macros. Again, this is better anyhow, and is
   required with Catch. Incidentally, this allowed to fix a bug in
   the "exec" unit test which didn't leave enough time for the new
   process to be launched before trying to kill it.

 - Remove multiple CPPUNIT_TEST_SUITE_NAMED_REGISTRATION() macros,
   our emulation of this macro can be used only once.

 - Provide string conversions using Catch-specific StringMaker for
   a couple of types.

 - Replace custom wxImage comparison with a Catch-specific matcher
   class.

 - Remove most of test running logic from test.cpp, in particular don't
   parse command line ourselves any longer but use Catch built-in
   command line parser. This is a source of a minor regression:
   previously, both "Foo" and "FooTestCase" could be used as the name of
   the test to run, but now only the latter is accepted.
2017-11-02 01:53:16 +01:00
Vadim Zeitlin
b05d864f5e Test using previous build platform for AppVeyor
Try fixing Python-related build failures in Cygwin build by using the
previous version of the image, before the latest update.
2017-11-01 23:47:18 +01:00
Adrien Tétar
80e2264373 Fix wxBORDER_NONE handling for wxTextCtrl under GTK+ 3
Remove the border by applying custom CSS, which seems to be the only way
to do it with recent GTK+ versions.

Closes https://github.com/wxWidgets/wxWidgets/pull/576
2017-11-01 22:49:26 +01:00