the expected test result was wrong, corrected; also define a manifest constant only once instead of using its value everywhere
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38483 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -138,14 +138,18 @@ void UnicodeTestCase::ConstructorsWithConversion()
|
|||||||
void UnicodeTestCase::Conversion()
|
void UnicodeTestCase::Conversion()
|
||||||
{
|
{
|
||||||
#if wxUSE_UNICODE
|
#if wxUSE_UNICODE
|
||||||
wxString szTheString(L"The\0String", wxConvLibc, 10);
|
static const size_t lenNulString = 10;
|
||||||
|
|
||||||
|
wxString szTheString(L"The\0String", wxConvLibc, lenNulString);
|
||||||
wxCharBuffer theBuffer = szTheString.mb_str();
|
wxCharBuffer theBuffer = szTheString.mb_str();
|
||||||
|
|
||||||
CPPUNIT_ASSERT( memcmp(theBuffer.data(), "The\0String", 11) == 0 );
|
CPPUNIT_ASSERT( memcmp(theBuffer.data(), "The\0String",
|
||||||
|
lenNulString + 1) == 0 );
|
||||||
|
|
||||||
wxString szTheString2("The\0String", wxConvLocal, 10);
|
wxString szTheString2("The\0String", wxConvLocal, lenNulString);
|
||||||
CPPUNIT_ASSERT( szTheString2.length() == 11 );
|
CPPUNIT_ASSERT_EQUAL( lenNulString, szTheString2.length() );
|
||||||
CPPUNIT_ASSERT( wxTmemcmp(szTheString2.c_str(), L"The\0String", 11) == 0 );
|
CPPUNIT_ASSERT( wxTmemcmp(szTheString2.c_str(), L"The\0String",
|
||||||
|
lenNulString + 1) == 0 );
|
||||||
#else
|
#else
|
||||||
wxString szTheString(wxT("TheString"));
|
wxString szTheString(wxT("TheString"));
|
||||||
szTheString.insert(3, 1, '\0');
|
szTheString.insert(3, 1, '\0');
|
||||||
|
Reference in New Issue
Block a user