Commit Graph

63458 Commits

Author SHA1 Message Date
Vadim Zeitlin
322144299d Use wxDateTime::TimeZone::IsLocal() in the unit test
No real changes, as this doesn't affect this test, but use the new
IsLocal() method instead of comparing the time zone offset with the time
zone, which doesn't work correctly for BST.
2017-11-30 17:53:52 +01:00
Vadim Zeitlin
d49784b0a2 Disable wxDateTime tests failing due to TZ offset changes
wxDateTime timezone-related methods always use the current timezone
offset, while other methods, using CRT, use correct value for the given
date, which may be different.

This discrepancy accounted for test failures in Europe/Minsk time zone
as Belarus has switched from UTC+2 to UTC+3 since 1999 date used in the
test.

It is impossible to really fix the problem easily, so just skip the test
in this case and also mention this bug in the documentation.

See #15370.
2017-11-30 17:44:41 +01:00
Vadim Zeitlin
d3a01e3fe6 Show more information in other DateTimeTestCase tests too
Show the loop variable when doing checks inside a loop to make it more
obvious for which test case the failures occur.

Also use CHECK(), instead of REQUIRE(), to which CPPUNIT_ASSERT_EQUAL
expands, to continue with the other loop iterations after failure.
2017-11-29 23:55:13 +01:00
Vadim Zeitlin
4868ec0893 Show more information if DateTimeTestCase::TestTimeFormat() fails
No real changes, just show the variable values if any checks fail and
also continue running the test for the other data points even if one of
them fails.
2017-11-29 23:19:01 +01:00
Vadim Zeitlin
c7c30504c8 Do nothing when converting wxDateTime to/from local time zone
In particular, do not (unexpectedly) adjust time by the DST.

Closes #16585.

See #10445.
2017-11-29 23:18:57 +01:00
Vadim Zeitlin
543c522cb8 Explicitly disambiguate local time zone from UTC
Don't rely on time zone offset to check whether it is local as this
doesn't, and can't, work for the local time zone in Great Britain which
uses the same offset as UTC, but does use DST, unlike the latter.

Add a unit test (albeit disabled by default) checking that the code that
previously didn't work correctly in BST does work now (run the tests
using "TZ=Europe/London ./test wxDateTime-BST-bugs" under Unix to test).

Closes #14317, #17220.

See #10445.
2017-11-29 23:02:22 +01:00
Vadim Zeitlin
f13b7c6a55 Extract common code in a new wxTryGetTm() helper function
Replace exactly the same code occurring in both wxDateTime::GetTm() and
Format() with a single version in a new wxTryGetTm() function.

No real changes yet, except for removing of some useless asserts.
2017-11-29 22:02:16 +01:00
Vadim Zeitlin
39dc254bf4 Don't call time() from wxLogRecordInfo ctor
This is a tiny optimization (or maybe not so tiny on platforms other
than Linux where time() might not as fast as just reading a memory
location), but mostly is done to work around faketime bug[*] which
prevented it from being used for testing programs using wxWidgets, such
as our own unit tests because time() was called from wxLogTrace() in
wxCSConv::DoCreate() called when creating global conversion objects
during the library initialization.

Arguably, it might be better to avoid calling wxLogTrace() during the
initialization, but this can't be done as simply and this change might
have a small performance benefit too.

[*] https://github.com/wolfcw/libfaketime/issues/132
2017-11-29 02:22:16 +01:00
Vadim Zeitlin
5b2f7aa96d Remove IsDST() check in wxDateTime DST unit test
IsDST() returns 0 for the DST end date itself, which is wrong, but
doesn't seem to be directly relevant for this test.
2017-11-28 23:59:21 +01:00
Vadim Zeitlin
13c3b5cbd1 Use different sections for wxDateTime DST test
Try to make it more clear where exactly does it fail on buildbot.
2017-11-28 23:40:51 +01:00
Vadim Zeitlin
efb8d82c8a Provide more information if wxDateTime DST test fails
Show the original date and the date after modification.
2017-11-28 23:19:26 +01:00
Vadim Zeitlin
369e6f6554 Use "datetime" tag for all wxDateTime unit tests
Make it possible to run all these tests at once (and no other ones)
easily.
2017-11-28 23:09:51 +01:00
Vadim Zeitlin
e23ff6fded Add tests for wxDateTime setters around DST end time
Check that setting the other date components doesn't change its hour.

See https://github.com/wxWidgets/wxWidgets/pull/367
2017-11-28 23:05:45 +01:00
Vadim Zeitlin
8415d12c61 Fix signed integer overflow in ZIP reading code
Subtracting a huge negative offset from the current position could
overflow it, which was correctly detected as undefined behaviour by
UBSAN.

Credit to OSS-Fuzz: this solves its issue 4388.
2017-11-28 22:43:57 +01:00
Vadim Zeitlin
9d97e4e7cc Don't use invalid static_cast<> in wxAppConsoleBase ctor
Although the object being created _will_ be of type wxAppConsole, it
doesn't have this type yet, as wxAppConsole ctor hadn't yet run, and so
the static cast is invalid and detected as such by UBSAN in g++ 6.3.
2017-11-28 22:39:24 +01:00
Jouk
3100af8eef use wxUSE_PRIVATE_FONTS on OpenVMS only for gtk2+ 2017-11-28 12:56:06 +01:00
Pavel O
e7e649df40 Check for lzma and jbig when using system libtiff
Currently lzma and jbig libraries are checked only for builtin
libtiff. When the system libtiff is built with lzma and jbig
support and when the `--with-libtiff=sys` flag is specified
the configure script will fail, due to missing linking with
lzma and jbig.

Fixed this by moving lzma and jbig checks from libtiff-builin check
above all libtiff checks. Also added lzma and jbig libs to
EXTRALIBS_GUI.

See https://github.com/wxWidgets/wxWidgets/pull/619
2017-11-27 21:57:07 +01:00
Jouk
ba58172987 change max to max_ to avoid %CXX-E-AMBIGUOUSNAME, "max" is ambiguous on OpenVMS 2017-11-27 09:00:29 +01:00
Jouk
23b8496e63 Add wxUSE_PRIVATE_FONTS to setup for OpenVMS 2017-11-27 08:57:54 +01:00
Vadim Zeitlin
310c45a5e2 Merge branch 'deprecated' of https://github.com/MaartenBent/wxWidgets
Fixes for deprecation and other warnings in samples and demos.

See https://github.com/wxWidgets/wxWidgets/pull/617
2017-11-26 17:30:49 +01:00
Paul Cornett
bca2d063bb Avoid using NULL style provider
Fixes assertions with wxNotebook
2017-11-26 00:00:44 -08:00
Vadim Zeitlin
797fad2858 Merge branch 'xtifix' of https://github.com/pavelxdd/wxWidgets
See https://github.com/wxWidgets/wxWidgets/pull/618
2017-11-25 22:22:59 +01:00
Vadim Zeitlin
302fc5190a Merge branch 'gtk2-version-checks'
Simplify GTK+ 2 version checks with a helper function.

See https://github.com/wxWidgets/wxWidgets/pull/614
2017-11-25 22:18:31 +01:00
Paul Cornett
6830767839 Fix STL build broken in 003faa9 2017-11-25 11:26:07 -08:00
Paul Cornett
17de4e31fb Avoid using NULL GtkSettings pointer
Seems to happen when running tests
2017-11-25 11:00:31 -08:00
Paul Cornett
23e3323655 Add non-const overload for GetToolByPos()
See #16763
2017-11-25 10:57:23 -08:00
Paul Cornett
ecfcab41e5 Simplify setting background color in wxPseudoTransparentFrame 2017-11-25 10:56:15 -08:00
Paul Cornett
ee0b07fc31 Avoid deprecated GtkAlignment with GTK3 2017-11-25 10:54:32 -08:00
Vadim Zeitlin
cf02d15646 Merge branch 'appveyor-tests'
Fix several problems in tests under MSW (mostly with MinGW) and enable
building and running them on AppVeyor CI.
2017-11-25 19:18:14 +01:00
Paul Cornett
003faa993e Use CSS for window font and colors on GTK3
Avoids deprecated gtk_widget_override_* functions
2017-11-25 10:13:34 -08:00
Maarten Bent
a96171def4 Fix unused variable and parameter warnings in samples
These variables are only used in debug builds, causing warnings in release builds.
2017-11-25 17:52:08 +01:00
Maarten Bent
afc02a34ee More use of wxFALLTHROUGH in MSW code and samples 2017-11-25 17:52:08 +01:00
Maarten Bent
6315ae04fb Fix reading poems from file in wxPoem demo
When using ftell to get the position in the file, it should be opened in binary mode.
Regenerate the poem index file with the correct start positions.
Use the wxICON macro for creating the icon, so .ico is used on Windows.
2017-11-25 17:52:07 +01:00
Maarten Bent
4d8fad3d80 Fix warnings and modernize demo code
Fix wxFont, wxPen and wxBrush style deprecation warnings.
Add wxFALLTHROUGH to resolve implicit fallthrough warnings in switch statements.
Fix build error when using long for GetTextExtent (with wxUSE_GRID 0).
Remove unused icon from fractal demo.
2017-11-25 17:52:07 +01:00
Maarten Bent
dc6858d905 Fix wxPen and wxBrush style deprecation warnings in utils
Fix a warning about hidden local variable in the helpview util.
2017-11-25 17:52:07 +01:00
Maarten Bent
2156d29801 Add FindOrCreateFont overload accepting wxFontInfo 2017-11-25 17:52:03 +01:00
Vadim Zeitlin
b29aa3f785 Run unit tests on AppVeyor too
Launch the tests after building them.
2017-11-25 17:30:51 +01:00
Vadim Zeitlin
f10bd1279d Remove the correct directory from PATH for MinGW AppVeyor builds
We need to remove the directory containing sh.exe from the PATH as
otherwise mingw32-make seems to use it and not cmd.exe for executing the
commands in the makefile, but the wrong directory was being removed in
appveyor.yml, having no effect.

Fix this and undo 5f2ccde269 which
compensated for it by (almost) clearing the PATH entirely which, in
turn, broke one of our unit tests (and could break other things in the
future, as having an empty PATH is rather unexpected).

Also use the full path for head program now that its directory is not in
the PATH any more. Alternative could be to use PowerShell, but while

powershell -Command "'gcc','mingw32-make','ar'|%%{ iex \"$_ --version\"|select -first 1 }"

does work, it looks really ugly, so avoid it for now.

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

See #17274.
2017-11-25 17:28:42 +01:00
Vadim Zeitlin
4e4617a9e6 Show value if comparison fails in VarArgTestCase
Use string comparison instead of wxStrcmp() to view the actual value of
the string if it doesn't have the expected value.
2017-11-25 17:28:42 +01:00
Vadim Zeitlin
01cd702ee3 Test for wxXLocale availability directly in the unit test
Apparently a locale can be available at MSW level, so that
wxLocale::IsAvailable() returns true, but not supported by the MSVC CRT,
so that constructing the corresponding wxXLocale fails, which resulted
in wxXLocale unit test failures.

Fix them by checking that wxXLocale can be constructed directly instead
of using wxLocale::IsAvailable() as a proxy.

This is not ideal and perhaps wxLocale::IsAvailable() should check that
the locale is supported in wxXLocale too, but should at least allow unit
tests to pass on AppVeyor for now.
2017-11-25 17:28:42 +01:00
Maarten Bent
cbf13e68a2 Replace deprecated std::auto_ptr with wxScopedPtr 2017-11-25 17:00:18 +01:00
Vadim Zeitlin
62f9438ad3 Rewrite wxPathList unit test without CppUnit-compatible API
Simplify the test by using a single function instead of all the
machinery inherited from CppUnit.

Also provide more information in case of test failure.
2017-11-25 16:08:01 +01:00
Vadim Zeitlin
b630abffd2 Fix FormatConverterTestCase for MinGW and Cygwin
Standard/Unix format strings are intentionally used when using these
compilers/environments (see d62c535d4c for
the former), so don't check for Windows/MSVC format strings in the test.
2017-11-25 11:13:02 +01:00
Vadim Zeitlin
471a771382 Fix built-in wxPrintf() for repeated positional parameters
Allow wxPrintf("%1$s %1$s", "foo") to work.

Take into account the possibility that the number of format specifiers
and the number of actual arguments can be different.

Closes #9367.
2017-11-25 11:13:02 +01:00
Vadim Zeitlin
dd8155980b Enable building the unit tests for x64 in MSVS solutions
For some reason (but probably accidentally), building tests was disabled
for x64 platform.
2017-11-25 11:13:02 +01:00
Vadim Zeitlin
3508e3a623 Disable test for clicking URLs under AppVeyor
It fails, for whatever reason, even though it passes locally and other
tests using wxUIActionSimulator work under AppVeyor too.
2017-11-25 11:13:02 +01:00
Vadim Zeitlin
753aa757a4 Recognize AppVeyor CI environment in unit tests
Check for APPVEYOR environment variable in addition to TRAVIS one.
2017-11-25 11:13:02 +01:00
Vadim Zeitlin
0c29775d4d Skip wxTopLevelWindow showing/activation tests in CI builds
It doesn't seem to work when run unattended, for whatever reason.
2017-11-25 11:13:02 +01:00
Vadim Zeitlin
838a687d94 Document wxComboBox::SetValue() better in wxCB_READONLY case
Make it clear that the control doesn't send wxEVT_TEXT event in this
case.
2017-11-25 10:47:50 +01:00
Vadim Zeitlin
075ebbe12a Skip AppVeyor CI builds on documentation-only changes
There is no need to rebuild everything if only the documentation files
have changed.

Unfortunately there doesn't seem to be any way to do the same thing for
Travis CI yet, see https://github.com/travis-ci/travis-ci/issues/6301
2017-11-25 10:47:50 +01:00