Skip to content

Commit

Permalink
QTest: rename local timeout variable in QTRY_IMPL macro
Browse files Browse the repository at this point in the history
`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 d4bb448.

Task-number: QTBUG-121746
Change-Id: If05dccdc24a66e95a08156b820d185f184783ad6
Reviewed-by: Marc Mutz <[email protected]>
  • Loading branch information
vohi committed Feb 9, 2024
1 parent 28ecb52 commit a8da982
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/testlib/qtestcase.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit a8da982

Please sign in to comment.