Details
-
Suggestion
-
Resolution: Done
-
P2: Important
-
None
-
None
Description
Sometimes one wants to test for things whose success is delayed, or has a transient success evaluation. For instance, reports from the file system about files created or focus handling.
One way would be to have a macro like QTRY_VERIFY(expr, timeout) that loops over expr constantly attempting to evaluate it to true, until the timeout happens.
An alternative is QDELAYED_VERIFY(expr, timeout) that waits until timeout, and then runs expr. The advantage is that expr doesn't have to be sideeffect free, but it on the other hand means it will allways take timeout amount of time to run, and that transient tests are more likely to fail.
See the top of tst_qtableview.cpp for an example macro.