Commit Graph

50 Commits

Author SHA1 Message Date
Vadim Zeitlin
0b9041dd29 Remove macOS workaround unnecessary any longer
The workaround introduced by f0e098fa06
doesn't seem to be needed any more, the test passes just fine without
it, so remove it.

See #16969.
2019-04-26 13:36:00 +02:00
Vadim Zeitlin
1b7b79e1c2 Remove wxLog::AddTraceMask() call
This shouldn't be done unconditionally, trace mask can always be enabled
using WXTRACE environment variable from outside the test.

Also remove a useless tracing message.
2019-04-26 13:19:05 +02:00
Vadim Zeitlin
77645a1aad Replace legacy CppUnit macros with CATCH ones
No real changes.
2019-04-26 13:19:05 +02:00
Vadim Zeitlin
ba8a594bb3 Remove unnecessary wxLogDebug() from the test cases
Tests can be traced using CATCH command line options already, so these
log statements were useless.
2019-04-26 13:19:05 +02:00
Vadim Zeitlin
12e2f9c0cc Get rid of CppUnit::TestCase subclass
Use a test fixture instead.

This gets rid of some boilerplate and allows to avoid repeating
preprocessor checks.
2019-04-26 13:19:05 +02:00
Vadim Zeitlin
9adcae898f Make wxFileSystemWatcherEvent handler non-virtual and private
There is no reason for it to be neither virtual nor public.
2019-04-26 02:52:57 +02:00
Vadim Zeitlin
194fa8b4ca Remove unneeded KeepWaiting() and AfterWait() functions
These functions were never used anywhere and their meaning was not
clear, so just drop them.

Also remove the now unused "tested" member and "WAIT_DURATION" constant.
2019-04-26 02:52:57 +02:00
Vadim Zeitlin
4783262238 Simplify the code by using CallAfter()
Use CallAfter() to perform idle-time initialization, this is shorter and
simpler than dealing with the idle events explicitly.

Unfortunately the remaining use of idle events can't be avoided, explain
the reasons for this in a comment.
2019-04-26 02:51:47 +02:00
Vadim Zeitlin
9c956ea962 Remove strange counter-based idle handling code
Just bind the idle events we want to execute dynamically instead.

This is already more clear and robust than the old version, but will be
simplified event further in the next commit.
2019-04-26 02:35:14 +02:00
Vadim Zeitlin
db0d288f60 Use Bind() instead of Connect()
Just another modernization, no real changes.
2019-04-25 02:49:23 +02:00
Vadim Zeitlin
cfb194e55f Use wxVector<> instead of macro-based wxArray
Also remove the never used m_lastEvent member variable.

No real changes.
2019-04-25 02:50:08 +02:00
Vadim Zeitlin
cd8bbcb8df Remove unused variable
FileSystemWatcherTestCase::m_loop was never used, so just remove it.
2019-04-25 02:50:03 +02:00
Vadim Zeitlin
a83ffbe320 Reduce use of raw pointers
Use objects instead of pointers whenever possible and wxScopedPtr
instead of raw pointers when we really need to allocate objects on the
heap.
2019-04-25 02:49:54 +02:00
Vadim Zeitlin
789ba56c77 Rename class used as the test skeleton
Use a better name than the absolutely meaningless EventHandler.

Also add a brief comment describing this class.

No real changes.
2019-04-25 02:49:24 +02:00
Maarten Bent
7c1ab06ea5 Add more wxOVERRIDE 2018-09-22 14:44:07 +02:00
Maarten Bent
57180d68c8 Add wxOVERRIDE to test files
And cleanup some tailing spaces and tabs.
2018-07-29 12:08:53 +02: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
Paul Cornett
fc7f20c419 Fix some memory leaks in the tests 2017-10-01 09:41:49 -07: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
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
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
f4b80e5337 Remove MSVC6 support.
Don't support this compiler any more, this allows to get rid of tons of
MSVC6-specific workarounds, in particular we can now use Bind() and natural
template functions calls in the library code.

Also remove MSVC6 project and solution files and don't generate them when
bakefile_gen is ran any more (removing the remaining occurrences of msvc6prj
from the bakefiles results in weird bake-time errors, so it's simpler to just
leave them there).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76532 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-05-15 22:32:17 +00:00
Vadim Zeitlin
e15d5575a7 Don't build wxFileSystemWatcher test if wxUSE_FSWATCHER==0.
Closes #16031.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76028 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-02-27 15:46:25 +00:00
Vadim Zeitlin
3f66f6a5b3 Remove all lines containing cvs/svn "$Id$" keyword.
This keyword is not expanded by Git which means it's not replaced with the
correct revision value in the releases made using git-based scripts and it's
confusing to have lines with unexpanded "$Id$" in the released files. As
expanding them with Git is not that simple (it could be done with git archive
and export-subst attribute) and there are not many benefits in having them in
the first place, just remove all these lines.

If nothing else, this will make an eventual transition to Git simpler.

Closes #14487.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74602 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-07-26 16:02:46 +00:00
Vadim Zeitlin
f31f9900e4 Add wxFSW_EVENT_ATTRIB wxFileSystemWatcher flag.
This flag allows to monitor changes to the file attributes, such as file
modification time.

This patch adds the flag, support for it under Linux and the corresponding
modifications to the sample and the test suite.

Closes #14833.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72977 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-11-17 23:56:00 +00:00
Vadim Zeitlin
b77bb705dd Support monitoring only some events in wxGTK wxFileSystemWatcher.
Call inotify() with the appropriate flags instead of always using IN_ALL_EVENTS.

Closes #14832.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72961 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-11-15 22:24:22 +00:00
Vadim Zeitlin
4677003143 No changes, just fix a harmless warning in FileSystemWatcherTestCase.
Fix an unused parameter warning under non-Unix platforms.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72942 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-11-10 12:22:09 +00:00
Vadim Zeitlin
0fccda2ced Respect wxFileName::DontFollowLink() in wxFileSystemWatcher.
Watch the link itself and not its target if DontFollowLink() had been called.

Closes #14543.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72751 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-10-24 18:21:31 +00:00
Vadim Zeitlin
6eef5763a8 Check for filespec when generating events in wxFileSystemWatcher.
Instead of setting watches on individual files when a non-empty filespec is
given, always watch all the files but just ignore the events from the ones not
matching the filespec. This makes the code simpler and fixes several bugs.

See #14544.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72681 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-10-15 01:09:25 +00:00
Vadim Zeitlin
76cfd1bf95 Make wxFileSystemWatcher watch entries reference-counted.
This helps to avoid problems that arise from watching the same physical file
system path multiple times, which could happen when adding a watch for a path
already watched because of a recursive watch on a parent directory, for
example.

Closes #14490.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72679 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-10-15 01:08:37 +00:00
Vadim Zeitlin
227dee95e0 Improve handling of file spec in wxFileSystemWatcher::AddTree().
Fix watching too many files (i.e. even those not matching the provided spec)
and asserts when removing a recursive watch with a file spec in wxMSW.

Closes #14488.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72678 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-10-15 01:08:13 +00:00
Vadim Zeitlin
e9e077a843 Disable the recently added wxFileSystemWatcher unit case under Windows.
It currently fails there, so don't run it until this is fixed to let the tests
pass globally.

See #14480.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72080 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-07-14 20:10:54 +00:00
Vadim Zeitlin
2b6d227c12 Test calling wxFileSystemWatcher::{Add,Remove}Tree().
Add a test for tree monitoring functions to the unit test.

See #14480.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72068 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-07-13 11:22:13 +00:00
Vadim Zeitlin
bb5a951418 Use __WINDOWS__ for OS checks and __WXMSW__ for GUI checks (round 2).
This is continuation of r70796 and serves the same purpose.

Closes #14065, #14066.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70808 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-03-04 20:31:42 +00:00
Vadim Zeitlin
921e411cc1 Ignore extra modify events after rename in wxFileSystemWatcher.
Document that such extra events may occur and generally improve the event
types documentation.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70074 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-12-21 00:26:06 +00:00
Vadim Zeitlin
69b554dccc Try to get more information about wxFileSystemWatcher unit test failures.
Log the original and new paths of the rename event to help debugging the extra
modification events detected during the buildbot builds.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70020 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-12-16 21:11:19 +00:00
Vadim Zeitlin
d3eec3b672 Attempt to work around Mac g++ 4.0 bug in fswatcher unit test.
Don't define the class overriding a virtual base class method inside the test
function as g++ 4.0 under OS X 10.5 fails to compile this for some mysterious
reason.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67722 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-05-10 08:54:20 +00:00
Vadim Zeitlin
6a9455d3f0 Fix compilation of wxFileSystemWatcher unit test in non-PCH build.
Add #include of wx/timer.h needed when not using PCH.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67695 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-05-04 00:01:58 +00:00
Vadim Zeitlin
51fb867819 Fix wxFileSystemWatcher::Remove() in wxMSW.
Removing the path watched by wxFileSystemWatcher didn't do anything in wxMSW
implementation so we still continued getting events for the changes to this
path even after calling Remove().

Fix this by really implementing Remove() properly. Also add a unit test
checking that we don't get any events after calling Remove().

See #12847.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67691 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-05-03 23:31:29 +00:00
Vadim Zeitlin
17e23c0cb9 No changes, just slightly simplify wxFileSystemWatcher unit test.
CheckResult() method of the test event handler doesn't need to return
anything, it uses CPPUNIT_ASSERTs and related macros inside it to check that
everything is expected.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67690 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-05-03 23:31:24 +00:00
Dimitri Schoolwerth
e3778b4d9c No code changes, fixed some typos.
Changed several occurrences of "it's" where "its" is meant, as well as a few other minor typos.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67656 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-04-30 10:57:04 +00:00
Dimitri Schoolwerth
4c51a665c6 Fixed various typos.
Applied patch by snowleopard2 fixing a bunch of typos such as misspellings and double words in the documentation. Combined the patch with some local queued typos waiting to be committed as well as adding new typo fixes inspired by the patch.

Function names with American spelling were not changed nor was third-party code touched. The only code changes involve some changes in strings that are translated ("Can not" -> "Cannot").

Closes #13063 (again).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67280 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-03-22 14:17:38 +00:00
Vadim Zeitlin
b66a68884d Temporarily disable wxFileSystemWatcher unit test under OS X.
This tests hangs and never finishes, disable it for now to allow buildbot to
at least run the other tests.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63739 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-03-22 16:08:44 +00:00
Vadim Zeitlin
77241feb3f Use an even more informative error message in wxFSW unit test.
Dump information about both events when we received two of them instead of the
(single) expected one.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62486 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-23 11:44:57 +00:00
Vadim Zeitlin
1c9c8e88c2 Give more informative error in wxFSW test.
Output more details when more than one event is unexpectedly received.
Hopefully this will allow to debug the test failure at build bot slaves which
doesn't seem to be happening locally.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62482 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-22 23:54:55 +00:00
Vadim Zeitlin
d5236dfffd Fix g++ compilation of wxFileSystemWatcher test after VC6 fix.
Enums can't be used to deduce template parameters so cast WAIT_DURATION to int
explicitly before passing it to wxString::Format().

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62481 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-22 23:54:47 +00:00
Vadim Zeitlin
771ce939f3 Fix wxFSW test compilation with VC6.
Work around an internal compiler error and don't initialize static variable
when declaring it as VC6 doesn't support this.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62480 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-22 16:57:41 +00:00
Vadim Zeitlin
6b8ef0b35d Merge SOC2009_FSWATCHER branch into trunk.
Merges everything from the branch with only some minor changes, mostly renamed
wxUSE_FSWATCHER_{INOTIFY,KQUEUE} to wxHAS_{INOTIFY,KQUEUE}.

Add wxFileSystemWatcher and related classes.

Also introduces wxEventLoopSource.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62474 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-22 11:35:43 +00:00