Allow setting locale for the tests

This is especially useful to set an UTF-8 locale on the startup to force
using UTF-8-specific code in UTF-8 build.
This commit is contained in:
Vadim Zeitlin 2023-03-28 00:36:49 +01:00
parent 92649ca2e6
commit 378f3860d2

View file

@ -633,6 +633,13 @@ bool TestApp::OnInit()
cout << " as " << wxGetUserId()
<< std::endl;
// Optionally allow executing the tests in the locale specified by the
// standard environment variable, this is especially useful to use UTF-8
// for all tests by just setting WX_TEST_LOCALE=C.
wxString testLoc;
if ( wxGetEnv(wxASCII_STR("WX_TEST_LOCALE"), &testLoc) )
wxSetlocale(LC_ALL, testLoc);
#if wxUSE_GUI
// create a parent window to be used as parent for the GUI controls
new wxTestableFrame();