Commit Graph

1627 Commits

Author SHA1 Message Date
Vadim Zeitlin
68d235fed3 Output test name before GTK error messages in the test suite
Try to make it possible to understand where exactly do the GTK+ errors
appearing in the buildbot slaves output originate from by installing a custom
Glib log handler and prefixing the normal log messages with the name of the
test running when they're generated.

This required a small refactoring of DetailListener which is now always
installed, in order to always have access to the current test name, but still
needs to be explicitly enabled to produce output.
2016-06-29 18:49:47 +02:00
Vadim Zeitlin
8686ca62e7 Avoid asserts when destroying windows with mouse capture in tests
Destroying a window with mouse capture results in an assert, which is
translated into an exception when running the test suite. As this exception is
thrown from wxWindowBase dtor, it results in an immediate program termination
when using C++11 and can also have the same effect even when using C++98 if
this exception is thrown while already handling another exception due to a
test failure.

Try to avoid this by using a "safe" DeleteTestWindow() function instead of
deleting the window directly. Currently this function ensures that the window
doesn't have mouse capture before deleting it, but it could also be used to
check for other things later. Also, this commit only uses this function for
the two controls which do happen to be destroyed with mouse capture currently
(at least when using wxGTK), but it should probably be generalized to all
controls in the future.
2016-06-29 18:26:11 +02:00
Vadim Zeitlin
a7d82aa776 Turn off optimizations for all gcc versions in hash unit tests
Optimizations were turned off for g++ 4.8 to work around compiler bug
resulting in generating infinite loops for the code in this function in
052e598d09, but apparently other versions of g++
suffer from it as well, so just always turn them off until we can be sure
about the version of the compiler in which this bug was really fixed.
2016-06-29 15:43:01 +02:00
Vadim Zeitlin
68b2e06f70 Improve translated mnemonics unit test
Don't switch locale to Japanese, which might not be supported, but just use
wxTranslations directly because we only need translations, not full locale
support.

Also rename the test method to a more descriptive name.
2016-06-26 18:36:14 +02:00
David Hart
13068d3603 Strip mnemonics from CJK translations of menu items too
Chinese, Japanese etc translations use a special style for the menu mnemonics
and append them to the translated menu label in brackets, e.g. the menu label
could have the form of "<translation-of-file> (&F)".

Check for this style of mnemonics in wxStripMenuCodes() too and strip them as
well.
2016-06-26 18:36:11 +02:00
Lauri Nurmi
e45a9543d6 Fix unit test when char is unsigned by default
Skip test relying on char being signed if it isn't by default, as is the case
with gcc on some ARM platforms, for example.

Closes https://github.com/wxWidgets/wxWidgets/pull/299
2016-06-17 14:49:21 +02:00
Vadim Zeitlin
023ee99ea7 Don't crash in wxTextFile::GetLastLine() if the file is empty
Just return a reference to an empty wxString, as GetFirstLine() already does
(although this is actually questionable -- what if this string is modified?).

See #17283.
2016-06-09 16:48:01 +02:00
Artur Wieczorek
82a0e285d8 Added drawing rounded rectangles to the graphics benchmark.
This test is executed together with standard rectangles benchmark and both benchmarks are enabled with '--rectangles' option.
2016-06-05 23:14:48 +02:00
Vadim Zeitlin
d68eb10e3d Handle strings with embedded NULs in wxDataStream
Read/write the entire string and not just the part until the first NUL in it.

Closes #17556.
2016-06-04 21:47:12 +02:00
Artur Wieczorek
b58d58adc0 Implemented new drawing benchmarks.
Since for some renderers circles and/or ellipses are basic figures so it would be worth to test the performance of drawing them.
Respective tests are enabled with new command line options: "--circles" or "--ellipses".
2016-05-31 21:31:15 +02:00
Artur Wieczorek
573cb961cb Added option to select graphics renderer in the graphics benchmark application
Since there are several graphics renderers available under wxMSW it would be good to have ability to test graphics performance of any of them and not only the performance of default one.
Therefore new feature to run the tests with selected graphics renderer has been implemented in the benchmark application. Renderer can be selected with optional command line option: "/r renderer_name", when `renderer_name` can be either gdiplus, direct2d, cairo.
When no renderer is explicitly selected then default renderer is used.
2016-05-31 21:30:54 +02:00
Dimitri Schoolwerth
fe716b3c8e Fix 'not enough actual parameters for macro' warning
The macro wxGCC_WARNING_RESTORE is being used without a parameter which
MSVC warns about. Fix by passing the same parameter as when using
wxGCC_WARNING_SUPPRESS, namely deprecated-declarations.

Regression since b58c87db28.
2016-04-15 02:35:40 +00:00
Vadim Zeitlin
ba5a0a3878 Fix more typos in comments and wxFAIL messages
Closes https://github.com/wxWidgets/wxWidgets/pull/270
2016-04-14 16:08:28 +02:00
ARATA Mizuki
1809ade5ad Test the conversion of wxString from/to UTF-8 std::string in StdStringTestCase::StdConversion 2016-03-25 16:39:21 +09:00
Vadim Zeitlin
7eee3576cf Update version to 3.1.1
Update misc/scripts/inc_release script: remove non-existent any more files and
update the version in the MSVS 200x project files not generated by bakefile
any more and MSVS 201x project files which were not previously taken into
account.

Run it and rebake.
2016-03-03 23:23:06 +01:00
Vadim Zeitlin
a29928c4a5 Merge several fixes to wxGTK GUI test suite
The test suite now mostly passes for GTK+ 2 and at least doesn't crash (but
still has many failures) with GTK+ 3.

Closes https://github.com/wxWidgets/wxWidgets/pull/235
2016-02-27 18:04:17 +01:00
ARATA Mizuki
a2f0374052 Fix check for string termination in IsValidUtf8String()
The current code incorrectly returned true if the string contained
an invalid UTF-8 sequence after an embedded NUL.

Check the entire string if the length was explicitly given instead of stopping
at the first NUL.

Closes https://github.com/wxWidgets/wxWidgets/pull/236
2016-02-27 16:42:30 +01:00
Vadim Zeitlin
9fee931d6d Work around a crash in wxGTK3 GUI test suite
The tests crashed after running ModalDialogsTestCase::FileDialog() because the
next call to wxYield() resulted in the completion of an async operation
launched by the native file dialog which tried to dereference the already
destroyed dialog.
2016-02-27 02:41:18 +01:00
Vadim Zeitlin
de491dd67f Show wxTestableFrame from its ctor
No real changes, just always show the frame as we need it to be shown for the
tests to run anyhow.

Also update the nonsensical comment about creating a hidden window just before
showing it.
2016-02-27 02:41:18 +01:00
Vadim Zeitlin
e29bfda8d8 Fix wxComboBox unit test under wxGTK after recent changes
wxEVT_COMBOBOX_CLOSEUP is sent during idle time after the changes of
a216806c99, so add wxYield() to make sure that
the unit test gets it.

See #17223.
2016-02-27 02:41:11 +01:00
Vadim Zeitlin
6c2e702357 Add another sleep to make menu unit test pass under wxGTK
At least when using GNOME, the frame containing the menu doesn't appear on
screen in time for wxUIActionSimulator to use it without this.
2016-02-27 01:14:24 +01:00
Vadim Zeitlin
cceddaf3da dd a hack to make wxBitmapComboBox Editable() unit test pass
Sleep for a little while before sending text to this control as the test often
(although not always) fails without it under wxGTK.
2016-02-27 01:14:24 +01:00
Vadim Zeitlin
ea489e1a7d Fix assertion in the HtmlParser unit test case
Use wxHtmlWinParser instead of wxHtmlParser which can't be actually used
without being initialized with the tag handlers (it's not clear whether this
is really intentional...).
2016-02-27 01:14:14 +01:00
Vadim Zeitlin
fde8f93a49 Fix ellipsization unit test when using pixel scaling
When pixel doubling is in use, e.g. when using GTK+ 2 on high DPI displays,
the width of a single TAB can be greater than the hardcoded 50 width in the
test, which resulted in test failures.

Base the widths on the average character width to make sure we can always
ellipsize.
2016-02-26 15:09:39 +01:00
Vadim Zeitlin
b58c87db28 Avoid gcc deprecation warnings for wxNORMAL in the tests
We use wxNORMAL intentionally to test for its support, so we're not interested
in deprecation warnings about it.
2016-02-26 14:36:01 +01:00
Vadim Zeitlin
cb49eb5162 Fix harmless deprecation warning for g_type_init() in drawing test
Same as 3dde6ec2fe.
2016-02-26 14:34:23 +01:00
ARATA Mizuki
5a92181ac1 Fix the length returned by UTF-32 conversion for non-BMP input
Don't optimize the required length as this is a tiny gain resulting in big
problems with the strings containing surrogates for which the actual result is
shorter than the length returned, resulting in extra NUL bytes at the end of
the converted buffer.

This is similar to 3410aa372f (see #16298) but
for UTF-32 and not UTF-16.

Closes #17070.
2016-02-21 14:38:17 +01:00
Vadim Zeitlin
8eac125e86 Revert "Temporarily ensure that the file functions test uses UTF-8"
This reverts commit a44bcb4746 which is not
necessary any more since the fixes to file name conversions in the previous
commit.
2016-02-19 02:52:43 +01:00
Vadim Zeitlin
ed09b7b6c0 Remove symlinks time comparison tests from wxFileName test
These tests don't seem to be sound, it's possible for one second or more to
pass between the two calls to GetTimes() and it's apparently possible for the
access time on the symlink to not change (due to /tmp being mounted with
"noatime" option perhaps?), resulting in Travis CI build failures.
2016-02-13 18:55:53 +01:00
Vadim Zeitlin
54c874d488 Don't duplicate information in detailed test output
No need to output wxGetOsDescription() twice.
2016-02-13 18:34:47 +01:00
Vadim Zeitlin
a44bcb4746 Temporarily ensure that the file functions test uses UTF-8
Work around the bug in the library which prevents Unicode file names from
working under Unix unless we use an UTF-8 locale.

Closes #11404.
2016-02-13 17:21:52 +01:00
Vadim Zeitlin
b08985ac24 Don't use std::auto_ptr<> in the test to avoid warnings
When compiling with g++ or clang in C++11 mode, the use of std::auto_ptr<>
triggers warnings about its deprecation, so replace it with wxScopedPtr<> as
this is simpler than choosing between auto_ptr<> and unique_ptr<>.
2016-02-13 13:36:58 +01:00
Artur Wieczorek
5245afa263 Add test cases to test file operations with Unicode file names
File names containing ASCII or non-ASCII (Unicode) characters are used in the
file function tests.
2016-02-13 04:01:28 +01:00
Vadim Zeitlin
314630945a Fix wxURI::Unescape() to work with Unicode strings
Such strings are not really URIs as they should have been encoded if they were
but we can obtain them from e.g. wxFileSystem::FindFirst(), so handle them
correctly here as it's simpler than checking all the places where Unescape()
is called.

Add a unit test checking that decoding an URI containing both Unicode and
percent-encoded Unicode characters works correctly.
2016-02-13 04:01:27 +01:00
Zane U. Ji
95abaa1f23 Return valie file URLs from wxFileSystem::FileNameToURL()
According to https://tools.ietf.org/html/rfc1738#section-5 the file URLs must
always start with "file://", so ensure that this is indeed the case.

Closes #16209.
2016-02-05 22:43:23 +01:00
Vadim Zeitlin
d480c12477 Add MSVS 2010, 2012, 2013 and 2015 projects for the tests
Provide a way to build the tests from MSVS, maintaining these files manually
is not ideal but it's still better than nothing.
2016-02-05 22:43:23 +01:00
Vadim Zeitlin
5dd5d68e67 Revert "Fix fields initialization in wxCommandEvent copy ctor."
This reverts commit 62763ad541 which seems to
have been completely unnecessary as the fields had been already initialized
and this commit actually broke initialization of the propagation level of the
copied wxCommandEvent objects.

Add a unit test proving that things do work.

Closes #16739.
2016-01-30 05:02:54 +01:00
Vadim Zeitlin
bef874a674 Skip network tests when running under Travis CI
These tests fail sporadically for some reason outside of our control, just
skip them rather than have frequent false positives.
2016-01-26 23:19:51 +01:00
Vadim Zeitlin
cdef013a8a Suppress harmless warnings about string literals in test code
We rely on string literals being of non-const char or wchar_t pointer type for
this code to compile, even if this results in warnings, so we're not
interested in these warnings in the test code itself.
2016-01-24 21:21:25 +01:00
Vadim Zeitlin
10daded3e9 Fix UnbindFromHandler() test compilation with C++98
Can't declare classes inside the function as they must have external linkage
to be usable with Bind().

Fixes the build after 99d9a81e28, see #17229.
2015-12-08 15:22:01 +01:00
Vadim Zeitlin
99d9a81e28 Fix crash when unbinding event handlers from other handlers
Calling Unbind() on another handler from the currently executing handler which
had been bound after (and hence executed before) the handler being unbound
resulted in a crash previously as the iterators used in the loop over all
dynamic event handlers became invalid.

Fix this by storing the dynamic event table entries in a vector instead of a
list (which is also more memory and speed efficient anyhow) and null the
deleted entries instead of removing them to avoid invalidating the iterators
and only really remove them once we finish iterating.

Closes #17229.
2015-12-08 03:02:37 +01:00
Vadim Zeitlin
530276ec6a Fix crash in graphics benchmark
Set the GL context pointer deleted in the frame dtor to NULL to ensure we
don't crash on exit when not using OpenGL.
2015-12-06 17:31:24 +01:00
Artur Wieczorek
7ddb522ec2 Extend benchmarks of drawing bitmaps on wxMemoryDC
Extended tests to determine speed of drawing RGB/ARGB bitmaps on target
bitmaps with different colour depths (RGB/0RGB/ARGB/system default).

See #16766.
2015-12-06 17:24:37 +01:00
Vadim Zeitlin
3fa5d92bc2 Build graphics benchmark too
Added the graphics benchmark to the bakefile, which didn't build it before,
for some reason.
2015-12-06 17:24:35 +01:00
ARATA Mizuki
0c02d70fa5 Add a test checking that conversions involving surrogates work
After the fixes in the previous commits conversions between wchar_t containing
surrogates and UTF-{8,16,32} work correctly, so add a test ensuring that this
is the case.

Notice that other conversions are still broken in presence of surrogates.

See #17070.
2015-11-13 20:32:24 +01:00
Vadim Zeitlin
37dd89a0da Don't rely on wxMBConv::cWC2MB(NULL) returning the exact byte count
UTF-32 conversions use a useful optimization by avoiding the extra scan of the
input wchar_t string in their FromWChar() and cWC2MB() implementation when
they are only asked to compute the required buffer size without actually doing
the conversion. However this means that for an input string containing UTF-16
surrogates (which is possible under MSW where wchar_t is 16 bits) the actual
size of the output string can be smaller than that returned by FromWChar(NULL).

Document that this may happen and avoid relying on the exact equality in the
tests.

See #17070.
2015-11-13 19:36:33 +01:00
Vadim Zeitlin
048ba4b509 Fail to convert wide string with incomplete surrogates to UTF-8
Correctly fail if the wide string being converted is UTF-16 encoded (which can
only happen on platforms using 16 bit wchar_t, i.e. MSW) and ends in the
middle of a surrogate pair.

Notice that other conversions still wrongly encode invalid wchar_t sequences
such as 0xd800 not followed by anything, this will need to be fixed in the
future, but for now at least make it work for the most commonly used
conversion.

See #17070.
2015-11-13 19:36:32 +01:00
Vadim Zeitlin
154ebfd1d9 Rename wxBoxSizer::m_minSize to avoid clash with the base class
wxSizer already has m_minSize field, use m_calculatedMinSize for the field of
the derived wxBoxSizer class to avoid confusion, just as wxFlexGridSizer
already did.

Also add a new unit test checking that GetMinSize() still works after this
change.
2015-10-11 01:00:38 +02:00
Vadim Zeitlin
5cce48186c Link with shlwapi.lib and version.lib under MSW
These libraries are required now that we don't load the functions from them
dynamically (see e78be14ac1)

Closes #17180
2015-10-07 18:56:33 +02:00
Tobias Taschner
a0fb808087 Add wxStandardPaths::GetUserDir() to get Desktop, Download etc
All major supported platforms have well defined per-user directories to store
Downloads, Music, Pictures, Videos and the Desktop files. The new method
wxStandardPaths::GetUserDir() allows for a unified way to access these on MSW,
OS X and Unix (if XDG user dirs specification is implemented for the latter).

See https://github.com/wxWidgets/wxWidgets/pull/89
2015-10-04 01:05:23 +02:00