Commit Graph

1599 Commits

Author SHA1 Message Date
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
Tobias Taschner
8282c1be0f Remove Windows CE support
Windows CE doesn't seem to be supported by Microsoft any longer. Last CE
release was in early 2013 and the PocketPC and Smartphone targets supported by
wxWidgets are long gone.

The build files where already removed in an earlier cleanup this commit
removes all files, every #ifdef and all documentation regarding the Windows CE
support.

Closes https://github.com/wxWidgets/wxWidgets/pull/81
2015-09-23 00:52:30 +02:00
Vadim Zeitlin
78d09e2e90 Document and test wxDatePickerCtrl::SetRange() date-clamping behaviour.
Document that the current value of the control is adjusted if it doesn't lie
in the newly set range and add a unit test to check for this, now that it
actually passes under all platforms, after the previous commits.
2015-07-17 17:59:40 +02:00
Vadim Zeitlin
c15ae5e4a3 Add a check for wxSocketServer creation to the unit tests.
This should prevent an assert failure which happens if we call Accept() on an
invalid server below and also confirm if the server creation really failed or
not.
2015-06-23 19:11:31 +02:00
Vadim Zeitlin
853a8ef76f Avoid warnings about narrowing casts in the long long tests.
Recent g++ versions give -Wnarrowing warning when a value outside of the type
range is used to initialize a variable of this type in { }. Avoid it in the
long long tests using explicit casts as we already cast between long long and
unsigned long long values here anyhow.
2015-06-21 15:56:06 +02:00
Vadim Zeitlin
d5fda9d69b Fix g++ version test in the previous commit.
sUse the correct __GNUC_MINOR__ instead of the wrongly autocompleted
__GLIBC_MINOR__.
2015-06-21 02:42:34 +02:00
Vadim Zeitlin
052e598d09 Avoid g++ 4.8.2 bug that resulted in infinite loops in the test suite.
g++ 4.8.2, shipped with Ubuntu 14.04, generates incorrect code for checking
the loop termination condition, resulting in never ending loops in
HashMapTest().

Disable the optimizations for this function for 4.8.[012] as the bug seems to
be fixed in 4.8.4 and several similar (but not really identical) bug reports
in gcc bugzilla have been fixed in 4.8.3.

This should allow the unit tests on Linux buildbots, using 4.8.2, to run to
completion again.
2015-06-21 02:24:50 +02:00
Vadim Zeitlin
04c4e5f177 Avoid reading one char beyond the buffer end in UnicodeTestCase.
Valgrind complains about reading beyond the end of buffer when using glibc
std::string for wxString implementation under amd64 Linux. Don't suppose that
the buffer has one extra null word at its end to avoid this.
2015-06-19 20:22:11 +02:00
Vadim Zeitlin
893102b926 Fix mismatched new[]/delete in a test case.
Use wxDELETEA() as the comment said we did -- except that we didn't.
2015-06-19 16:32:14 +02:00
Vadim Zeitlin
6037ce0e6f Disable unit test sporadically failing in wxGTK buildbot builds.
This failure seems to only happen on buildbot, at least it couldn't be
reproduced after 100 runs of the test locally, so it just doesn't seem
possible to debug it.

Disable it to allow detecting when other tests fail (which would be
unexpected, unlike this one).
2015-06-12 15:57:33 +02:00
Roberto Perpuly
aa5dbad410 Use FSEvents in wxFileSystemWatcher on OS X
The FSEvents API allows for creating watches in entire trees of
directories in an efficient manner.

Closes #16969.
2015-06-06 02:37:35 +04:00
Roberto Perpuly
f0e098fa06 Re-enable running FS watcher test on OS X
Use a workaround to compensate for the differences between a non-GUI and
GUI event loop with wxOSX. This allows the FS watcher tests to pass
(previously it would hang) under OS X without having to move the tests
to the test GUI application (where the tests do pass on OS X already,
without needing this workaround).

See #16969.
2015-06-06 01:29:52 +04:00
Roberto Perpuly
bb14d8e131 Fix re-running aborted FS watcher test
If the test is interrupted and run again an assert is raised because the
temporary fswatcher_test dir has had no chance to be deleted and still
exists. Fix this by removing the dir before each test.
2015-06-06 01:29:52 +04:00
Vadim Zeitlin
ef30f6fe63 Fix recently added wxFileName::MakeRelativeTo() unit test for non-Unix.
Don't hard code the use of slashes as path separators.
2015-05-30 03:38:03 +02:00
Vadim Zeitlin
fda09f917a Fix wxFileName::MakeRelativeTo() for directory relatively to itself.
The expected result in this case is ".", but the filename became empty instead
when wxPATH_NATIVE was used.

Fix this by examining GetFormat(format), which takes care of mapping
wxPATH_NATIVE to its real value, instead of wxPATH_NATIVE itself.

Also add a unit test verifying that this works as expected.

Closes #17010.
2015-05-29 16:23:17 +02:00
Vadim Zeitlin
ee973e1fe7 Add more wxString::Format() positional parameters tests.
Verify that repeating positional parameters does work with wxString::Format()
instead of keeping these tests commented out in wxVsnprintf() tests, which are
not run at all if we're using the compiler-provided vsprintf().

Closes #9367.
2015-05-28 14:12:48 +02:00
Dimitri Schoolwerth
9a517e572e Revert "Disable wxFont::SetStrikethrough() test under wxOSX."
Enable the test again because strike-through support has been available
under wxOSX for some time.

This reverts commit 9b1aeb4c93.
2015-05-22 03:28:07 +04:00
Nick Matthews
d13278ecc3 Add support for DOCTYPE to wxXmlDocument.
Allow retrieving the DOCTYPE specified in an existing document as well as
specifying the DOCTYPE to use when writing a new one.

Closes #13779.
2015-04-26 15:36:48 +02:00
Dimitri Schoolwerth
8f8d58d193 Use wx-prefixed macros throughout the repository.
Change {DECLARE,IMPLEMENT}_*CLASS and {DECLARE,BEGIN,END}_EVENT_TABLE
occurrences to use the wx-prefixed version of the macros.
2015-04-23 22:00:35 +04:00
Vadim Zeitlin
2d3f617b34 Fix crash in BoxSizerTestCase::IncompatibleFlags().
Reset the old window sizer pointer, otherwise it was deleted again in the
window dtor (thanks buildbot for finding this one).
2015-04-23 19:31:15 +02:00
Dimitri Schoolwerth
2d5ce25373 Work around failing file watcher test under XP.
Under only Windows XP the test FileSystemWatcherTestCase::TestTrees fails
during the RmDir(treedir) call (SHFileOperation strangely returns
ERROR_DIR_NOT_EMPTY). To make the test pass remove the treedir first and
only then the singledir. This is merely a workaround while the actual
problem is still to be investigated.
2015-04-19 13:34:39 +04:00
Vadim Zeitlin
7af8598903 Yet another wxStopWatch unit test fix for buildbot.
Relax the check in RestartBug() test too, the time can be slightly smaller
than expected (by ~2ms on disc-xp machine).
2015-04-17 01:43:57 +02:00
Dimitri Schoolwerth
25fcb85590 Fix TreeCtrlTestCase assert failure under Windows.
A '-' keypress doesn't collapse a tree item with the native MSW tree
control. Instead, when not using the generic tree control, simulate a
keypress of WXK_LEFT to collapse the root item . This fixes the assert
checking if the root item is collapsed after the keypress.

Regression since 9d7a7ec556 (which
mistakenly may have had treectrltest.cpp as part of its commit).
2015-04-16 03:13:54 +04:00
Vadim Zeitlin
594dc3396a Relax another check in wxStopWatch unit test.
Increase the upper bound even further to avoid spurious failures in the
buildbot builds.
2015-04-13 15:55:33 +02:00
Vadim Zeitlin
4556179fd1 Disable ItemContainerTestCase::SimSelect() for wxBitmapComboBox on buildbot.
This test inexplicably fails when running on buildbot (but not locally), so
just disable it to get a build without test failures.
2015-04-12 23:18:59 +02:00
Vadim Zeitlin
10a727bf1d Compare scaled images approximately in the unit tests.
Comparing them exactly results in tests failures when using compiler version
different from the one that was used to generate the test fails, see
http://thread.gmane.org/gmane.comp.lib.wxwidgets.devel/151149/focus=151154
and other messages in the same thread.
2015-04-12 22:56:24 +02:00
Vadim Zeitlin
ca0c422964 Relax wxStopWatch test to make it less likely to fail on buildbot.
Be prepared for sleeping taking more time than we budget for it on a highly
loaded machine such as a buildbot slave.
2015-04-12 22:47:46 +02:00
Vadim Zeitlin
b7778beeef Give more details in GarbageTestCase unit test.
Try to find out why this test fails in the OS X buildbot builds.

Use macros to ensure that all checks provide information about the bitmap (or
animation) type they fail for, without having to repeat the same code for
doing it many times.
2015-04-12 22:30:52 +02:00
Vadim Zeitlin
2d7875c926 Restore OnRun() in the non-GUI unit test suite.
Commit 3e67b1ef68 broke the test suite in
non-GUI case, we still need to override OnRun() then to run the tests.

Also make it more clear that m_exitcode is only used in the GUI case.
2015-04-12 18:21:47 +02:00