qt5base-lts/tests/auto/corelib/text/qstring
Edward Welbourne 458d53f572 Move locale-switching code in tests to a shared header
QLocale and QString tests had copies of a TransientLocale; we've
recently improved the QLocale one. Rather than duplicating those
rather complicated improvements, finally share a common version.

In the process, I noticed that setlocale() only returns the prior
value when passed nullptr as the new value; so rework the
implementation to get that right, so that it now correctly restores
the prior locale. That, in turn, means there's now a later call to
setlocale(), when we actually set the changed setting, which may
invalidate the earlier return; so copy it to a QByteArray before the
second call.

Included Ivan Solovev's improved version of how to reset the locale,
since TransientLocale needs it.

Pick-to: 6.2
Change-Id: I4cb1efbda42f0e2cdd934e04b3b3732ce0f45a06
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-09-14 13:07:13 +02:00
..
.gitignore Move text-related code out of corelib/tools/ to corelib/text/ 2019-07-10 17:05:30 +02:00
CMakeLists.txt CMake: Regenerate projects to use new qt_internal_ API 2020-09-23 16:59:06 +02:00
double_data.h Move text-related code out of corelib/tools/ to corelib/text/ 2019-07-10 17:05:30 +02:00
tst_qstring_mac.mm Replace QtTest headers with QTest 2020-12-22 15:20:30 +01:00
tst_qstring.cpp Move locale-switching code in tests to a shared header 2021-09-14 13:07:13 +02:00