Refactor code waiting for events in the test suite

We already had WX_ASSERT_EVENT_OCCURS_IN macro and a recent commit also
added code doing almost the same thing manually in wxTopLevelWindow unit
test, which was one version too many.

Replace both of them with the new EventCounter::WaitEvent().

No real changes, this is just a refactoring.
This commit is contained in:
Vadim Zeitlin
2019-01-24 14:04:10 +01:00
parent f4ea128007
commit 5811d541da
6 changed files with 33 additions and 39 deletions

View File

@@ -35,6 +35,13 @@ public:
int GetCount() { return m_frame->GetEventCount(m_type); }
void Clear() { m_frame->ClearEventCount(m_type); }
// Sometimes we need to yield a few times before getting the event we
// expect, so provide a function waiting for the expected event for up to
// the given number of milliseconds (supposed to be divisible by 50).
//
// Return true if we did receive the event or false otherwise.
bool WaitEvent(int timeInMs = 1000);
private:
wxEventType m_type;
wxTestableFrame* m_frame;