X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d3eec3b672ed275fb3b0ab520b8e2464e699cb16..615f68c6b9fb887d2cfcbc6a3c6c3716a34a914e:/tests/fswatcher/fswatchertest.cpp diff --git a/tests/fswatcher/fswatchertest.cpp b/tests/fswatcher/fswatchertest.cpp index fc158e7162..8840342dc7 100644 --- a/tests/fswatcher/fswatchertest.cpp +++ b/tests/fswatcher/fswatchertest.cpp @@ -335,19 +335,6 @@ public: const wxFileSystemWatcherEvent * const e = m_events.front(); - WX_ASSERT_EQUAL_MESSAGE - ( - ( - "Extra events received, first is of type %x, for path=\"%s\"," - "last is of type %x, path=\"%s\"", - e->GetChangeType(), - e->GetPath().GetFullPath(), - m_events.back()->GetChangeType(), - m_events.back()->GetPath().GetFullPath() - ), - 1, m_events.size() - ); - // this is our "reference event" const wxFileSystemWatcherEvent expected = ExpectedEvent(); @@ -360,6 +347,35 @@ public: CPPUNIT_ASSERT_EQUAL(expected.GetPath(), e->GetPath()); CPPUNIT_ASSERT_EQUAL(expected.GetNewPath(), e->GetNewPath()); + + // Under MSW extra modification events are sometimes reported after a + // rename and we just can't get rid of them, so ignore them in this + // test if they do happen. + if ( e->GetChangeType() == wxFSW_EVENT_RENAME && + m_events.size() == 2 ) + { + const wxFileSystemWatcherEvent* const e2 = m_events.back(); + if ( e2->GetChangeType() == wxFSW_EVENT_MODIFY && + e2->GetPath() == e->GetNewPath() ) + { + // This is a modify event for the new file, ignore it. + return; + } + } + + WX_ASSERT_EQUAL_MESSAGE + ( + ( + "Extra events received, last one is of type %x, path=\"%s\" " + "(the original event was for \"%s\" (\"%s\")", + m_events.back()->GetChangeType(), + m_events.back()->GetPath().GetFullPath(), + e->GetPath().GetFullPath(), + e->GetNewPath().GetFullPath() + ), + 1, m_events.size() + ); + } virtual void GenerateEvent() = 0;