Again to fix compilation after b0afad8f0b

Commit 125bb81bef wasn't enough. Let's
just make it simpler and use a regular function.

Change-Id: I9627dedaa87873b4b138224afd182e4fd9a55265
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
bb10
Thiago Macieira 2014-04-23 11:03:28 -07:00 committed by The Qt Project
parent 08edb8742c
commit 9a07ea69d6
1 changed files with 13 additions and 10 deletions

View File

@ -53,11 +53,7 @@ public:
// test data:
QTextCodec *codec;
QString (*from8BitPtr)(const char *, int);
#ifdef Q_COMPILER_REF_QUALIFIERS
QByteArray (QString:: *to8Bit)() const &;
#else
QByteArray (QString:: *to8Bit)() const;
#endif
static QByteArray to8Bit(const QString &);
inline QString from8Bit(const QByteArray &ba)
{ return from8BitPtr(ba.constData(), ba.length()); }
@ -97,14 +93,21 @@ void tst_Utf8::init()
if (useLocale) {
codec = QTextCodec::codecForLocale();
from8BitPtr = &QString::fromLocal8Bit;
to8Bit = &QString::toLocal8Bit;
} else {
codec = QTextCodec::codecForMib(106);
from8BitPtr = &QString::fromUtf8;
to8Bit = &QString::toUtf8;
}
}
QByteArray tst_Utf8::to8Bit(const QString &s)
{
QFETCH_GLOBAL(bool, useLocale);
if (useLocale)
return s.toLocal8Bit();
else
return s.toUtf8();
}
void tst_Utf8::roundTrip_data()
{
QTest::addColumn<QByteArray>("utf8");
@ -161,11 +164,11 @@ void tst_Utf8::roundTrip()
QFETCH(QByteArray, utf8);
QFETCH(QString, utf16);
QCOMPARE((utf16.*to8Bit)(), utf8);
QCOMPARE(to8Bit(utf16), utf8);
QCOMPARE(from8Bit(utf8), utf16);
QCOMPARE((from8Bit(utf8).*to8Bit)(), utf8);
QCOMPARE(from8Bit((utf16.*to8Bit)()), utf16);
QCOMPARE(to8Bit(from8Bit(utf8)), utf8);
QCOMPARE(from8Bit(to8Bit(utf16)), utf16);
}
void tst_Utf8::charByChar_data()