From: Francesco Montorsi Date: Mon, 16 Mar 2009 15:47:39 +0000 (+0000) Subject: don't fail on machines without french support installed X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/7ab4bb30bc2c5e1e96a2745e0f4127a596671e91?ds=inline don't fail on machines without french support installed git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59577 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/tests/intl/intltest.cpp b/tests/intl/intltest.cpp index 18e5be0be1..097e3a9025 100644 --- a/tests/intl/intltest.cpp +++ b/tests/intl/intltest.cpp @@ -32,7 +32,7 @@ class IntlTestCase : public CppUnit::TestCase { public: - IntlTestCase() {} + IntlTestCase() { m_locale=NULL; } virtual void setUp(); virtual void tearDown(); @@ -59,9 +59,14 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( IntlTestCase, "IntlTestCase" ); void IntlTestCase::setUp() { + if (!wxLocale::IsAvailable(wxLANGUAGE_FRENCH)) + return; // you should have french support installed to run this test! + wxLocale::AddCatalogLookupPathPrefix("./intl"); m_locale = new wxLocale; + CPPUNIT_ASSERT( m_locale); + // don't load default catalog, it may be unavailable: bool loaded = m_locale->Init(wxLANGUAGE_FRENCH, wxLOCALE_CONV_ENCODING); CPPUNIT_ASSERT( loaded ); @@ -71,12 +76,18 @@ void IntlTestCase::setUp() void IntlTestCase::tearDown() { - delete m_locale; - m_locale = NULL; + if (m_locale) + { + delete m_locale; + m_locale = NULL; + } } void IntlTestCase::Domain() { + if (!m_locale) + return; // no french support installed on this system! + // _() searches all domains by default: CPPUNIT_ASSERT_EQUAL( "&Ouvrir un fichier", _("&Open bogus file") ); @@ -89,6 +100,9 @@ void IntlTestCase::Domain() void IntlTestCase::Headers() { + if (!m_locale) + return; // no french support installed on this system! + CPPUNIT_ASSERT_EQUAL( "wxWindows 2.0 i18n sample", m_locale->GetHeaderValue("Project-Id-Version") ); CPPUNIT_ASSERT_EQUAL( "1999-01-13 18:19+0100", m_locale->GetHeaderValue("POT-Creation-Date") ); CPPUNIT_ASSERT_EQUAL( "YEAR-MO-DA HO:MI+ZONE", m_locale->GetHeaderValue("PO-Revision-Date") );