qt5base-lts/tests/shared
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
..
fakedirmodel.h Updated license headers 2016-01-21 18:55:18 +00:00
filesystem.h Include what you use ! filesystem.h uses QOperatingSystemVersion 2021-08-27 20:31:18 +02:00
localechange.h Move locale-switching code in tests to a shared header 2021-09-14 13:07:13 +02:00