Skip to content

Commit 754de11

Browse files
committed
Fix bug in SPYWAIT helpers
SPYWAIT was a macro that could evaluate an expression twice, which is not what we want to do.
1 parent 421d4d0 commit 754de11

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

test/common.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@
33

44
// This is just a fix for QSignalSpy::wait
55
// http://stackoverflow.com/questions/22390208/google-test-mock-with-qt-signals
6-
#define SPYWAIT(spy) (spy.count()>0||spy.wait())
7-
#define SPYWAIT2(spy, time) (spy.count()>0||spy.wait(time))
6+
bool SPYWAIT(QSignalSpy &spy, int timeout=10000)
7+
{
8+
return spy.count()>0||spy.wait(timeout);
9+
}
10+
11+
bool SPYWAIT2(QSignalSpy &spy, int timeout=5000)
12+
{
13+
return spy.count()>0||spy.wait(timeout);
14+
}
815

916
#endif

0 commit comments

Comments
 (0)