test: Add InvocationSpy and ValueSpy helper classes
authorManuel Nickschas <sputnick@quassel-irc.org>
Thu, 4 Oct 2018 16:40:23 +0000 (18:40 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Sun, 18 Nov 2018 10:06:43 +0000 (11:06 +0100)
commit34e58425ffb5475b210abb484970e674ddb98744
tree295befe3b6d46a06b08aba5e129e8329cf8d6fc2
parentcf64023910d5b42477f6158f4cee853cc7f7f3f8
test: Add InvocationSpy and ValueSpy helper classes

For test cases testing asynchronous operations that require a running
event loop, it is convenient to have a way to wait until something
happens. Qt provides QSignalSpy to wait for a specific signal while
spinning the event loop. This is not always convenient to use, though.

Provide InvocationSpy and ValueSpy (based on QSignalSpy) that provide
an explicit way of notifying them, without having to connect a signal
first. Unlike QSignalSpy, those classes also time out when not notified
within a given time span.

Put those classes in a new library Quassel::Test::Util, which will
gain more testing-related utils over time.
src/test/CMakeLists.txt
src/test/util/CMakeLists.txt [new file with mode: 0644]
src/test/util/invocationspy.cpp [new file with mode: 0644]
src/test/util/invocationspy.h [new file with mode: 0644]