From cd201b2c2c2849fea0c5a38ffd979cd9d5b24997 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 13 Nov 2018 11:15:44 +0100 Subject: Adjust QTRY_IMPL()'s default timestep MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It was previously using 50ms steps, which was a bad choice for client code whose total time-out was comparable to 50ms or less. Reduce the time-step so that we loop several times within the timeout (but make sure it's never zero, by adding 1ms). Change-Id: I0428a7741c0741dfb312e40ae1eda900050195ab Reviewed-by: Jędrzej Nowacki --- src/testlib/qtestcase.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/testlib') diff --git a/src/testlib/qtestcase.h b/src/testlib/qtestcase.h index 54669c11de..fbc251a2a2 100644 --- a/src/testlib/qtestcase.h +++ b/src/testlib/qtestcase.h @@ -150,7 +150,7 @@ do {\ // Ideally we'd use qWaitFor instead of QTRY_LOOP_IMPL, but due // to a compiler bug on MSVC < 2017 we can't (see QTBUG-59096) #define QTRY_IMPL(expr, timeout)\ - const int qt_test_step = 50; \ + const int qt_test_step = timeout < 350 ? timeout / 7 + 1 : 50; \ const int qt_test_timeoutValue = timeout; \ QTRY_LOOP_IMPL((expr), qt_test_timeoutValue, qt_test_step); \ QTRY_TIMEOUT_DEBUG_IMPL((expr), qt_test_timeoutValue, qt_test_step)\ -- cgit v1.2.3