enable tests using \u escapes for VC7; replaced compiler version checks for this with wxHAVE_U_ESCAPE defined once and for all in testprec.h
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38475 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -20,6 +20,25 @@
|
|||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#endif // WX_PRECOMP
|
#endif // WX_PRECOMP
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// local functions
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#if wxUSE_WCHAR_T && !wxUSE_UNICODE
|
||||||
|
|
||||||
|
// in case wcscmp is missing
|
||||||
|
static int wx_wcscmp(const wchar_t *s1, const wchar_t *s2)
|
||||||
|
{
|
||||||
|
while (*s1 == *s2 && *s1 != 0)
|
||||||
|
{
|
||||||
|
s1++;
|
||||||
|
s2++;
|
||||||
|
}
|
||||||
|
return *s1 - *s2;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // wxUSE_WCHAR_T && !wxUSE_UNICODE
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// test class
|
// test class
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -142,24 +161,10 @@ void UnicodeTestCase::Conversion()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !wxUSE_UNICODE
|
|
||||||
// in case wcscmp is missing
|
|
||||||
//
|
|
||||||
static int wx_wcscmp(const wchar_t *s1, const wchar_t *s2)
|
|
||||||
{
|
|
||||||
while (*s1 == *s2 && *s1 != 0)
|
|
||||||
{
|
|
||||||
s1++;
|
|
||||||
s2++;
|
|
||||||
}
|
|
||||||
return *s1 - *s2;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void
|
void
|
||||||
UnicodeTestCase::DoTestConversion(const char *s,
|
UnicodeTestCase::DoTestConversion(const char *s,
|
||||||
const wchar_t *ws,
|
const wchar_t *ws,
|
||||||
wxCSConv& conv)
|
wxCSConv& conv)
|
||||||
{
|
{
|
||||||
#if wxUSE_UNICODE
|
#if wxUSE_UNICODE
|
||||||
if ( ws )
|
if ( ws )
|
||||||
@@ -193,21 +198,14 @@ void UnicodeTestCase::ConversionUTF7()
|
|||||||
{
|
{
|
||||||
{ "+-", L"+" },
|
{ "+-", L"+" },
|
||||||
{ "+--", L"+-" },
|
{ "+--", L"+-" },
|
||||||
//\u isn't recognized on MSVC 6
|
|
||||||
#if !defined(_MSC_VER)
|
#ifdef wxHAVE_U_ESCAPE
|
||||||
#if !defined(__GNUC__) || (__GNUC__ >= 3)
|
|
||||||
{ "+AKM-", L"\u00a3" },
|
{ "+AKM-", L"\u00a3" },
|
||||||
#endif
|
#endif // wxHAVE_U_ESCAPE
|
||||||
#endif
|
|
||||||
// Windows accepts invalid UTF-7 strings and so does our UTF-7
|
// the following are invalid UTF-7 sequences
|
||||||
// conversion code -- this is wrong IMO but the way it is for now
|
|
||||||
//
|
|
||||||
// notice that converting "+" still behaves as expected because the
|
|
||||||
// result is just an empty string, i.e. the same as if there were an
|
|
||||||
// error, but converting "a+" results in "a" while it really should
|
|
||||||
// fail
|
|
||||||
{ "+", NULL },
|
{ "+", NULL },
|
||||||
{ "a+", L"a" },
|
{ "a+", NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
wxCSConv conv(_T("utf-7"));
|
wxCSConv conv(_T("utf-7"));
|
||||||
@@ -223,10 +221,8 @@ void UnicodeTestCase::ConversionUTF8()
|
|||||||
static const StringConversionData utf8data[] =
|
static const StringConversionData utf8data[] =
|
||||||
{
|
{
|
||||||
//\u isn't recognized on MSVC 6
|
//\u isn't recognized on MSVC 6
|
||||||
#if !defined(_MSC_VER)
|
#ifdef wxHAVE_U_ESCAPE
|
||||||
#if !defined(__GNUC__) || (__GNUC__ >= 3)
|
|
||||||
{ "\xc2\xa3", L"\u00a3" },
|
{ "\xc2\xa3", L"\u00a3" },
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
{ "\xc2", NULL },
|
{ "\xc2", NULL },
|
||||||
};
|
};
|
||||||
|
@@ -1,3 +1,9 @@
|
|||||||
|
|
||||||
#include "wx/wxprec.h"
|
#include "wx/wxprec.h"
|
||||||
#include "wx/cppunit.h"
|
#include "wx/cppunit.h"
|
||||||
|
|
||||||
|
// define wxHAVE_U_ESCAPE if the compiler supports \uxxxx character constants
|
||||||
|
#if (defined(__VISUALC__) && (__VISUALC__ >= 1300)) || \
|
||||||
|
(defined(__GNUC__) && (__GNUC__ >= 3))
|
||||||
|
#define wxHAVE_U_ESCAPE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user