fix the test for !wxUSE_UNICODE_UTF8 builds: don't suppose that strings are UTF-8 encoded in VsnprintfTestCase::S() but use FromUTF8() explicitly (how did it manage to work with VC9 before?)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60018 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -348,21 +348,27 @@ void VsnprintfTestCase::S()
|
|||||||
#define ABCDEFGHI "\xCE\xB1\xCE\xB2\xCE\xB3\xCE\xB4\xCE\xB5\xCE\xB6\xCE\xB7\xCE\xB8\xCE\xB9"
|
#define ABCDEFGHI "\xCE\xB1\xCE\xB2\xCE\xB3\xCE\xB4\xCE\xB5\xCE\xB6\xCE\xB7\xCE\xB8\xCE\xB9"
|
||||||
// alpha+beta+gamma+delta+epsilon+zeta+eta+theta+iota
|
// alpha+beta+gamma+delta+epsilon+zeta+eta+theta+iota
|
||||||
|
|
||||||
#define ALPHA_w wxT(ALPHA)
|
// the 'expected' and 'arg' parameters of this macro are supposed to be
|
||||||
#define ABC_w wxT(ABC)
|
// UTF-8 strings
|
||||||
#define ABCDE_w wxT(ABCDE)
|
#define CMP3_UTF8(expected, fmt, arg) \
|
||||||
#define ABCDEFGHI_w wxT(ABCDEFGHI)
|
CPPUNIT_ASSERT_EQUAL \
|
||||||
|
( \
|
||||||
|
wxString::FromUTF8(expected).length(), \
|
||||||
|
wxSnprintf(buf, MAX_TEST_LEN, fmt, wxString::FromUTF8(arg)) \
|
||||||
|
); \
|
||||||
|
CPPUNIT_ASSERT_EQUAL \
|
||||||
|
( \
|
||||||
|
wxString::FromUTF8(expected), \
|
||||||
|
buf \
|
||||||
|
)
|
||||||
|
|
||||||
// CMP3 uses wxT() on the first argument so we need to be careful
|
CMP3_UTF8(" " ABC, "%5s", ABC);
|
||||||
// when using string concatenation that all parts of the string after
|
CMP3_UTF8(" " ALPHA, "%5s", ALPHA);
|
||||||
// the first explicitely use wxT():
|
CMP3_UTF8(ABCDEFGHI, "%5s", ABCDEFGHI);
|
||||||
CMP3(" " ABC_w, "%5s", ABC);
|
CMP3_UTF8(ABC " ", "%-5s", ABC);
|
||||||
CMP3(" " ALPHA_w, "%5s", ALPHA);
|
CMP3_UTF8(ABCDEFGHI, "%-5s", ABCDEFGHI);
|
||||||
CMP3(ABCDEFGHI, "%5s", ABCDEFGHI);
|
CMP3_UTF8(ABCDE, "%.5s", ABCDEFGHI);
|
||||||
CMP3(ABC L" ", "%-5s", ABC);
|
#endif // wxUSE_UNICODE
|
||||||
CMP3(ABCDEFGHI, "%-5s", ABCDEFGHI);
|
|
||||||
CMP3(ABCDE, "%.5s", ABCDEFGHI);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// test a string which has a NULL character after "ab";
|
// test a string which has a NULL character after "ab";
|
||||||
// obviously it should be handled exactly like just as "ab"
|
// obviously it should be handled exactly like just as "ab"
|
||||||
|
Reference in New Issue
Block a user