- // NB: this line will output two warnings like these, on GCC:
- // warning: use of 'h' length modifier with 's' type character (i.e.
- // GCC warns you that 'h' is not legal on 's' conv spec) but they must
- // be ignored as here we explicitely want to test the wxSnprintf()
- // behaviour in such case
-
- CMPTOSIZE(buffer, size,
- "unicode string: unicode!! W - ansi string: ansi!! w\n\n",
- "unicode string: %ls %lc - ansi string: %hs %hc\n\n",
- L"unicode!!", L'W', "ansi!!", 'w');
+ //
+ // NB: we use wxUnsafeSnprintf() as %hs and %hc are invalid in printf
+ // format and gcc would warn about this otherwise
+
+ r = wxUnsafeSnprintf(buffer, size,
+ _T("unicode string: %ls %lc - ansi string: %hs %hc\n\n"),
+ L"unicode!!", L'W', "ansi!!", 'w');
+ CPPUNIT_ASSERT( r != -1 );
+ CPPUNIT_ASSERT_EQUAL(
+ wxString(wxT("unicode string: unicode!! W - ansi string: ansi!! w\n\n")).Left(size - 1),
+ wxString(buffer)
+ );