From 3ca3944cff0716605a5f408924580ea2e3b4500d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 5 Sep 2021 00:10:05 +0100 Subject: [PATCH] Add a pseudo-test for interactive wxUILocale::FromTag() testing This allows to easily check whether the given locale is supported. --- tests/intl/intltest.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/intl/intltest.cpp b/tests/intl/intltest.cpp index 1fe64c5623..03b4bd9986 100644 --- a/tests/intl/intltest.cpp +++ b/tests/intl/intltest.cpp @@ -356,4 +356,20 @@ TEST_CASE("wxUILocale::CompareStrings", "[uilocale]") #endif // wxUSE_UNICODE } +// Test which can be used to check if the given locale tag is supported. +TEST_CASE("wxUILocale::FromTag", "[uilocale][.]") +{ + wxString tag; + if ( !wxGetEnv("WX_TEST_LOCALE_TAG", &tag) ) + { + FAIL("Specify WX_TEST_LOCALE_TAG"); + } + + const wxLocaleIdent locId = wxLocaleIdent::FromTag(tag); + REQUIRE( !locId.IsEmpty() ); + + const wxUILocale loc(locId); + WARN("Locale \"" << tag << "\" supported: " << loc.IsSupported() ); +} + #endif // wxUSE_INTL