QTest: rename local timeout variable in QTRY_IMPL macro

`timeout` is a likely name for a variable in the scope in which a
QTRY_ macro is used, so don't use that name in the macro itself. The
other variables are all prefixed with `qt_test_`, so do that here as
well, and be explicit about what the variable stores.

Amends d4bb448cddce63e0c6a84a86020fa59dd32b2293.

Task-number: QTBUG-121746
Change-Id: If05dccdc24a66e95a08156b820d185f184783ad6
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
Volker Hilsheimer 2024-02-09 11:05:49 +01:00
parent 28ecb523ce
commit a8da9829dc

View File

@ -199,13 +199,13 @@ inline void useVerifyThrowsException() {}
}
#define QTRY_IMPL(expr, timeoutAsGiven)\
const auto timeout = [&] { \
const auto qt_test_timeoutAsMs = [&] { \
/* make 5s work w/o user action: */ \
using namespace std::chrono_literals; \
return std::chrono::milliseconds{timeoutAsGiven}; \
}(); \
const int qt_test_step = timeout.count() < 350 ? timeout.count() / 7 + 1 : 50; \
const int qt_test_timeoutValue = timeout.count(); \
const int qt_test_step = qt_test_timeoutAsMs.count() < 350 ? qt_test_timeoutAsMs.count() / 7 + 1 : 50; \
const int qt_test_timeoutValue = qt_test_timeoutAsMs.count(); \
{ QTRY_LOOP_IMPL(expr, qt_test_timeoutValue, qt_test_step) } \
QTRY_TIMEOUT_DEBUG_IMPL(expr, qt_test_timeoutValue, qt_test_step)
// Ends with an if-block, so doesn't want a following semicolon.