We wrote an extra NUL byte to the stream and, unsurprisingly, contents of its
buffer didn't match the original string resulting in the test failure.
Also get rid of a #if wxUSE_UNICODE.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63249
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
{
wxStringOutputStream sos;
- size_t len = text.length();
-#if wxUSE_UNICODE
- const wxCharBuffer textMB(wxConvLibc.cWC2MB(text.wc_str(), len + 1, &len));
-#else
- const char *textMB = text.c_str();
-#endif
-
- sos.Write(textMB, len);
+ const wxScopedCharBuffer buf(text.mb_str());
+ sos.Write(buf, buf.length());
CPPUNIT_ASSERT_EQUAL( text, sos.GetString() );
}