From c20d8682bd345c6967ad1bf31445d55c7c971cff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Fri, 29 Oct 2004 09:29:52 +0000 Subject: [PATCH] check if conversion to UTF7 works git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30160 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- tests/strings/strings.cpp | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/tests/strings/strings.cpp b/tests/strings/strings.cpp index 1aa6be1ba8..ac619a4511 100644 --- a/tests/strings/strings.cpp +++ b/tests/strings/strings.cpp @@ -42,8 +42,11 @@ private: CPPUNIT_TEST( Constructors ); #if wxUSE_WCHAR_T CPPUNIT_TEST( ConstructorsWithConversion ); -#endif CPPUNIT_TEST( Conversion ); +#endif +#if wxUSE_UNICODE + CPPUNIT_TEST( ConversionUTF7 ); +#endif CPPUNIT_TEST( Extraction ); CPPUNIT_TEST( Find ); CPPUNIT_TEST( Tokenizer ); @@ -61,8 +64,11 @@ private: void Constructors(); #if wxUSE_WCHAR_T void ConstructorsWithConversion(); -#endif void Conversion(); +#endif +#if wxUSE_UNICODE + void ConversionUTF7(); +#endif void Extraction(); void Find(); void SingleTokenizerTest( wxChar *str, wxChar *delims, size_t count , wxStringTokenizerMode mode ); @@ -180,7 +186,6 @@ void StringTestCase::ConstructorsWithConversion() CPPUNIT_ASSERT( s3 == sub ); CPPUNIT_ASSERT( s4 == sub ); } -#endif void StringTestCase::Conversion() { @@ -193,7 +198,6 @@ void StringTestCase::Conversion() wxString szTheString2("The\0String", wxConvLocal, 10); CPPUNIT_ASSERT( wxMemcmp(szTheString2.c_str(), L"The\0String", 11) == 0 ); #else -# if wxUSE_WCHAR_T wxString szTheString(wxT("TheString")); szTheString.insert(3, 1, '\0'); wxWCharBuffer theBuffer = szTheString.wc_str(wxConvLibc); @@ -205,9 +209,21 @@ void StringTestCase::Conversion() wxWCharBuffer theLocalBuffer = szLocalTheString.wc_str(wxConvLocal); CPPUNIT_ASSERT( memcmp(theLocalBuffer.data(), L"The\0String", 11 * sizeof(wchar_t)) == 0 ); -# endif #endif } +#endif // wxUSE_WCHAR_T + +#if wxUSE_UNICODE +void StringTestCase::ConversionUTF7() +{ + const wxChar wdata[] = { 0x00A3, 0x00A3, 0x00A3, 0x00A3, 0 }; // pound signs + const char *utf7 = "+AKM-+AKM-+AKM-+AKM-"; + wxString str(wdata); + + wxCSConv conv(_T("utf-7")); + CPPUNIT_ASSERT( strcmp(str.mb_str(conv), utf7) == 0 ); +} +#endif // wxUSE_UNICODE void StringTestCase::Extraction() {