QChar: make construction from integral explicit
QChar should not be convertible from any integral type except from char16_t, short and possibly char (since it's a direct superset). David provided the perfect example: if (str == 123) { ~~~ } compiles, with 123 implicitly converted to QChar (str == "123" was meant instead). But similarly one can construct other scenarios where QString(123) gets accidentally used (instead of QString::number(123)), like QString s; s += 123;. Add a macro to revert to the implicit constructors, for backwards compatibility. The breaks are mostly in tests that "abuse" of integers (arithmetic, etc.). Maybe it's time for user-defined literals for QChar/QString, but that is left for another commit. [ChangeLog][Potentially Source-Incompatible Changes][QChar] QChar constructors from integral types are now by default explicit. It is recommended to use explicit conversions, QLatin1Char, QChar::fromUcs4 instead of implicit conversions. The old behavior can be restored by defining the QT_IMPLICIT_QCHAR_CONSTRUCTION macro. Change-Id: I6175f6ab9bcf1956f6f97ab0c9d9d5aaf777296d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
1aec96bffd
commit
1869615fc9
@ -192,7 +192,7 @@ QList<QStorageInfo> QStorageInfoPrivate::mountedVolumes()
|
|||||||
if (!drive.rootPath().isEmpty()) // drive exists, but not mounted
|
if (!drive.rootPath().isEmpty()) // drive exists, but not mounted
|
||||||
volumes.append(drive);
|
volumes.append(drive);
|
||||||
}
|
}
|
||||||
driveName[0] = driveName[0].unicode() + 1;
|
driveName[0] = QChar(driveName[0].unicode() + 1);
|
||||||
driveBits = driveBits >> 1;
|
driveBits = driveBits >> 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,6 +158,12 @@ QT_BEGIN_NAMESPACE
|
|||||||
to construct a QChar from an 8-bit \c char, and you will need to
|
to construct a QChar from an 8-bit \c char, and you will need to
|
||||||
call toLatin1() to get the 8-bit value back.
|
call toLatin1() to get the 8-bit value back.
|
||||||
|
|
||||||
|
Starting with Qt 6.0, most QChar constructors are \c explicit. This
|
||||||
|
is done to avoid dangerous mistakes when accidentally mixing
|
||||||
|
integral types and strings. You can opt-out (and make these
|
||||||
|
constructors implicit) by defining the macro \c
|
||||||
|
QT_IMPLICIT_QCHAR_CONSTRUCTION.
|
||||||
|
|
||||||
For more information see
|
For more information see
|
||||||
\l{http://www.unicode.org/ucd/}{"About the Unicode Character Database"}.
|
\l{http://www.unicode.org/ucd/}{"About the Unicode Character Database"}.
|
||||||
|
|
||||||
@ -2118,4 +2124,51 @@ static bool normalizationQuickCheckHelper(QString *str, QString::NormalizationFo
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\macro QT_IMPLICIT_QCHAR_CONSTRUCTION
|
||||||
|
\since 6.0
|
||||||
|
\relates QChar
|
||||||
|
|
||||||
|
Defining this macro makes certain QChar constructors implicit
|
||||||
|
rather than explicit. This is done to enforce safe conversions:
|
||||||
|
|
||||||
|
\badcode
|
||||||
|
|
||||||
|
QString str = getString();
|
||||||
|
if (str == 123) {
|
||||||
|
// Oops, meant str == "123". By default does not compile,
|
||||||
|
// *unless* this macro is defined, in which case, it's interpreted
|
||||||
|
// as `if (str == QChar(123))`, that is, `if (str == '{')`.
|
||||||
|
// Likely, not what we meant.
|
||||||
|
}
|
||||||
|
|
||||||
|
\endcode
|
||||||
|
|
||||||
|
This macro is provided to keep existing code working; it is
|
||||||
|
recommended to instead use explicit conversions and/or QLatin1Char.
|
||||||
|
For instance:
|
||||||
|
|
||||||
|
\code
|
||||||
|
|
||||||
|
QChar c1 = 'x'; // OK, unless QT_NO_CAST_FROM_ASCII is defined
|
||||||
|
QChar c2 = u'x'; // always OK, recommended
|
||||||
|
QChar c3 = QLatin1Char('x'); // always OK, recommended
|
||||||
|
|
||||||
|
// from int to 1 UTF-16 code unit: must guarantee that the input is <= 0xFFFF
|
||||||
|
QChar c4 = 120; // compile error, unless QT_IMPLICIT_QCHAR_CONSTRUCTION is defined
|
||||||
|
QChar c5(120); // OK (direct initialization)
|
||||||
|
auto c6 = QChar(120); // ditto
|
||||||
|
|
||||||
|
// from int/char32_t to 1/2 UTF-16 code units:
|
||||||
|
// 𝄞 'MUSICAL SYMBOL G CLEF' (U+1D11E)
|
||||||
|
auto c7 = QChar(0x1D11E); // compiles, but undefined behavior at runtime
|
||||||
|
auto c8 = QChar::fromUcs4(0x1D11E); // always OK
|
||||||
|
auto c9 = QChar::fromUcs4(U'\U0001D11E'); // always OK
|
||||||
|
// => use c8/c9 as QStringView objects
|
||||||
|
|
||||||
|
\endcode
|
||||||
|
|
||||||
|
\sa QLatin1Char, QChar::fromUcs4, QT_NO_CAST_FROM_ASCII
|
||||||
|
*/
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -101,12 +101,18 @@ public:
|
|||||||
LastValidCodePoint = 0x10ffff
|
LastValidCodePoint = 0x10ffff
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef QT_IMPLICIT_QCHAR_CONSTRUCTION
|
||||||
|
#define QCHAR_MAYBE_IMPLICIT Q_IMPLICIT
|
||||||
|
#else
|
||||||
|
#define QCHAR_MAYBE_IMPLICIT explicit
|
||||||
|
#endif
|
||||||
|
|
||||||
constexpr Q_IMPLICIT QChar() noexcept : ucs(0) {}
|
constexpr Q_IMPLICIT QChar() noexcept : ucs(0) {}
|
||||||
constexpr Q_IMPLICIT QChar(ushort rc) noexcept : ucs(rc) {}
|
constexpr Q_IMPLICIT QChar(ushort rc) noexcept : ucs(rc) {}
|
||||||
constexpr Q_IMPLICIT QChar(uchar c, uchar r) noexcept : ucs(char16_t((r << 8) | c)) {}
|
constexpr QCHAR_MAYBE_IMPLICIT QChar(uchar c, uchar r) noexcept : ucs(char16_t((r << 8) | c)) {}
|
||||||
constexpr Q_IMPLICIT QChar(short rc) noexcept : ucs(char16_t(rc)) {}
|
constexpr Q_IMPLICIT QChar(short rc) noexcept : ucs(char16_t(rc)) {}
|
||||||
constexpr Q_IMPLICIT QChar(uint rc) noexcept : ucs(char16_t(rc & 0xffff)) {}
|
constexpr QCHAR_MAYBE_IMPLICIT QChar(uint rc) noexcept : ucs(char16_t(rc & 0xffff)) {}
|
||||||
constexpr Q_IMPLICIT QChar(int rc) noexcept : ucs(char16_t(rc & 0xffff)) {}
|
constexpr QCHAR_MAYBE_IMPLICIT QChar(int rc) noexcept : ucs(char16_t(rc & 0xffff)) {}
|
||||||
constexpr Q_IMPLICIT QChar(SpecialCharacter s) noexcept : ucs(char16_t(s)) {} // implicit
|
constexpr Q_IMPLICIT QChar(SpecialCharacter s) noexcept : ucs(char16_t(s)) {} // implicit
|
||||||
constexpr Q_IMPLICIT QChar(QLatin1Char ch) noexcept : ucs(ch.unicode()) {} // implicit
|
constexpr Q_IMPLICIT QChar(QLatin1Char ch) noexcept : ucs(ch.unicode()) {} // implicit
|
||||||
constexpr Q_IMPLICIT QChar(char16_t ch) noexcept : ucs(ch) {} // implicit
|
constexpr Q_IMPLICIT QChar(char16_t ch) noexcept : ucs(ch) {} // implicit
|
||||||
@ -114,18 +120,19 @@ public:
|
|||||||
static_assert(sizeof(wchar_t) == sizeof(char16_t));
|
static_assert(sizeof(wchar_t) == sizeof(char16_t));
|
||||||
#endif
|
#endif
|
||||||
#if defined(Q_OS_WIN) || defined(Q_CLANG_QDOC)
|
#if defined(Q_OS_WIN) || defined(Q_CLANG_QDOC)
|
||||||
# if !defined(_WCHAR_T_DEFINED) || defined(_NATIVE_WCHAR_T_DEFINED)
|
|
||||||
constexpr Q_IMPLICIT QChar(wchar_t ch) noexcept : ucs(char16_t(ch)) {} // implicit
|
constexpr Q_IMPLICIT QChar(wchar_t ch) noexcept : ucs(char16_t(ch)) {} // implicit
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef QT_NO_CAST_FROM_ASCII
|
#ifndef QT_NO_CAST_FROM_ASCII
|
||||||
|
// Always implicit -- allow for 'x' => QChar conversions
|
||||||
QT_ASCII_CAST_WARN constexpr Q_IMPLICIT QChar(char c) noexcept : ucs(uchar(c)) { }
|
QT_ASCII_CAST_WARN constexpr Q_IMPLICIT QChar(char c) noexcept : ucs(uchar(c)) { }
|
||||||
#ifndef QT_RESTRICTED_CAST_FROM_ASCII
|
#ifndef QT_RESTRICTED_CAST_FROM_ASCII
|
||||||
QT_ASCII_CAST_WARN constexpr Q_IMPLICIT QChar(uchar c) noexcept : ucs(c) { }
|
QT_ASCII_CAST_WARN constexpr QCHAR_MAYBE_IMPLICIT QChar(uchar c) noexcept : ucs(c) { }
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#undef QCHAR_MAYBE_IMPLICIT
|
||||||
|
|
||||||
static constexpr QChar fromUcs2(char16_t c) noexcept { return QChar{c}; }
|
static constexpr QChar fromUcs2(char16_t c) noexcept { return QChar{c}; }
|
||||||
static constexpr inline auto fromUcs4(char32_t c) noexcept;
|
static constexpr inline auto fromUcs4(char32_t c) noexcept;
|
||||||
|
|
||||||
|
@ -1509,8 +1509,10 @@ inline char qToLower(char ch)
|
|||||||
/*!
|
/*!
|
||||||
\macro QT_NO_CAST_FROM_ASCII
|
\macro QT_NO_CAST_FROM_ASCII
|
||||||
\relates QString
|
\relates QString
|
||||||
|
\relates QChar
|
||||||
|
|
||||||
Disables automatic conversions from 8-bit strings (char *) to unicode QStrings
|
Disables automatic conversions from 8-bit strings (char *) to unicode QStrings,
|
||||||
|
as well as from 8-bit char types (char and unsigned char) to QChar.
|
||||||
|
|
||||||
\sa QT_NO_CAST_TO_ASCII, QT_RESTRICTED_CAST_FROM_ASCII, QT_NO_CAST_FROM_BYTEARRAY
|
\sa QT_NO_CAST_TO_ASCII, QT_RESTRICTED_CAST_FROM_ASCII, QT_NO_CAST_FROM_BYTEARRAY
|
||||||
*/
|
*/
|
||||||
|
@ -485,7 +485,7 @@ static QChar *createFontFile(const QString &faceName)
|
|||||||
const int nameLength = qMin(faceName.length(), LF_FACESIZE - 1);
|
const int nameLength = qMin(faceName.length(), LF_FACESIZE - 1);
|
||||||
faceNamePtr = new QChar[nameLength + 1];
|
faceNamePtr = new QChar[nameLength + 1];
|
||||||
memcpy(static_cast<void *>(faceNamePtr), faceName.utf16(), sizeof(wchar_t) * nameLength);
|
memcpy(static_cast<void *>(faceNamePtr), faceName.utf16(), sizeof(wchar_t) * nameLength);
|
||||||
faceNamePtr[nameLength] = 0;
|
faceNamePtr[nameLength] = u'\0';
|
||||||
}
|
}
|
||||||
return faceNamePtr;
|
return faceNamePtr;
|
||||||
}
|
}
|
||||||
|
@ -376,7 +376,7 @@ void QWindowsFontEngine::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::Shape
|
|||||||
oldFont = SelectObject(hdc, hfont);
|
oldFont = SelectObject(hdc, hfont);
|
||||||
|
|
||||||
if (!ttf) {
|
if (!ttf) {
|
||||||
QChar ch[2] = { ushort(glyph), 0 };
|
QChar ch[2] = { ushort(glyph), u'\0' };
|
||||||
int chrLen = 1;
|
int chrLen = 1;
|
||||||
if (QChar::requiresSurrogates(glyph)) {
|
if (QChar::requiresSurrogates(glyph)) {
|
||||||
ch[0] = QChar::highSurrogate(glyph);
|
ch[0] = QChar::highSurrogate(glyph);
|
||||||
|
@ -121,7 +121,7 @@ static CarbonModifiers toCarbonModifiers(Qt::KeyboardModifiers qtModifiers)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Keyboard keys (non-modifiers)
|
// Keyboard keys (non-modifiers)
|
||||||
static QHash<QChar, Qt::Key> standardKeys = {
|
static QHash<char16_t, Qt::Key> standardKeys = {
|
||||||
{ kHomeCharCode, Qt::Key_Home },
|
{ kHomeCharCode, Qt::Key_Home },
|
||||||
{ kEnterCharCode, Qt::Key_Enter },
|
{ kEnterCharCode, Qt::Key_Enter },
|
||||||
{ kEndCharCode, Qt::Key_End },
|
{ kEndCharCode, Qt::Key_End },
|
||||||
@ -173,7 +173,7 @@ static QHash<QChar, Qt::Key> standardKeys = {
|
|||||||
{ '^', Qt::Key_AsciiCircum }
|
{ '^', Qt::Key_AsciiCircum }
|
||||||
};
|
};
|
||||||
|
|
||||||
static QHash<QChar, Qt::Key> virtualKeys = {
|
static QHash<char16_t, Qt::Key> virtualKeys = {
|
||||||
{ kVK_F1, Qt::Key_F1 },
|
{ kVK_F1, Qt::Key_F1 },
|
||||||
{ kVK_F2, Qt::Key_F2 },
|
{ kVK_F2, Qt::Key_F2 },
|
||||||
{ kVK_F3, Qt::Key_F3 },
|
{ kVK_F3, Qt::Key_F3 },
|
||||||
@ -202,7 +202,7 @@ static QHash<QChar, Qt::Key> virtualKeys = {
|
|||||||
{ kVK_PageDown, Qt::Key_PageDown }
|
{ kVK_PageDown, Qt::Key_PageDown }
|
||||||
};
|
};
|
||||||
|
|
||||||
static QHash<QChar, Qt::Key> functionKeys = {
|
static QHash<char16_t, Qt::Key> functionKeys = {
|
||||||
{ NSUpArrowFunctionKey, Qt::Key_Up },
|
{ NSUpArrowFunctionKey, Qt::Key_Up },
|
||||||
{ NSDownArrowFunctionKey, Qt::Key_Down },
|
{ NSDownArrowFunctionKey, Qt::Key_Down },
|
||||||
{ NSLeftArrowFunctionKey, Qt::Key_Left },
|
{ NSLeftArrowFunctionKey, Qt::Key_Left },
|
||||||
@ -237,7 +237,7 @@ static int toKeyCode(const QChar &key, int virtualKey, int modifiers)
|
|||||||
qCDebug(lcQpaKeyMapperKeys, "Mapping key: %d (0x%04x) / vk %d (0x%04x)",
|
qCDebug(lcQpaKeyMapperKeys, "Mapping key: %d (0x%04x) / vk %d (0x%04x)",
|
||||||
key.unicode(), key.unicode(), virtualKey, virtualKey);
|
key.unicode(), key.unicode(), virtualKey, virtualKey);
|
||||||
|
|
||||||
if (key == kClearCharCode && virtualKey == 0x47)
|
if (key == QChar(kClearCharCode) && virtualKey == 0x47)
|
||||||
return Qt::Key_Clear;
|
return Qt::Key_Clear;
|
||||||
|
|
||||||
if (key.isDigit()) {
|
if (key.isDigit()) {
|
||||||
@ -254,7 +254,7 @@ static int toKeyCode(const QChar &key, int virtualKey, int modifiers)
|
|||||||
return key.unicode();
|
return key.unicode();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auto qtKey = standardKeys.value(key)) {
|
if (auto qtKey = standardKeys.value(key.unicode())) {
|
||||||
// To work like Qt for X11 we issue Backtab when Shift + Tab are pressed
|
// To work like Qt for X11 we issue Backtab when Shift + Tab are pressed
|
||||||
if (qtKey == Qt::Key_Tab && (modifiers & Qt::ShiftModifier)) {
|
if (qtKey == Qt::Key_Tab && (modifiers & Qt::ShiftModifier)) {
|
||||||
qCDebug(lcQpaKeyMapperKeys, "Got key: Qt::Key_Backtab");
|
qCDebug(lcQpaKeyMapperKeys, "Got key: Qt::Key_Backtab");
|
||||||
@ -272,11 +272,11 @@ static int toKeyCode(const QChar &key, int virtualKey, int modifiers)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if they belong to key codes in private unicode range
|
// Check if they belong to key codes in private unicode range
|
||||||
if (key >= NSUpArrowFunctionKey && key <= NSModeSwitchFunctionKey) {
|
if (key >= QChar(NSUpArrowFunctionKey) && key <= QChar(NSModeSwitchFunctionKey)) {
|
||||||
if (auto qtKey = functionKeys.value(key)) {
|
if (auto qtKey = functionKeys.value(key.unicode())) {
|
||||||
qCDebug(lcQpaKeyMapperKeys) << "Got" << qtKey;
|
qCDebug(lcQpaKeyMapperKeys) << "Got" << qtKey;
|
||||||
return qtKey;
|
return qtKey;
|
||||||
} else if (key >= NSF1FunctionKey && key <= NSF35FunctionKey) {
|
} else if (key >= QChar(NSF1FunctionKey) && key <= QChar(NSF35FunctionKey)) {
|
||||||
auto functionKey = Qt::Key_F1 + (key.unicode() - NSF1FunctionKey) ;
|
auto functionKey = Qt::Key_F1 + (key.unicode() - NSF1FunctionKey) ;
|
||||||
qCDebug(lcQpaKeyMapperKeys) << "Got" << functionKey;
|
qCDebug(lcQpaKeyMapperKeys) << "Got" << functionKey;
|
||||||
return functionKey;
|
return functionKey;
|
||||||
@ -291,7 +291,7 @@ static int toKeyCode(const QChar &key, int virtualKey, int modifiers)
|
|||||||
|
|
||||||
static const int NSEscapeCharacter = 27; // not defined by Cocoa headers
|
static const int NSEscapeCharacter = 27; // not defined by Cocoa headers
|
||||||
|
|
||||||
static const QHash<QChar, Qt::Key> cocoaKeys = {
|
static const QHash<char16_t, Qt::Key> cocoaKeys = {
|
||||||
{ NSEnterCharacter, Qt::Key_Enter },
|
{ NSEnterCharacter, Qt::Key_Enter },
|
||||||
{ NSBackspaceCharacter, Qt::Key_Backspace },
|
{ NSBackspaceCharacter, Qt::Key_Backspace },
|
||||||
{ NSTabCharacter, Qt::Key_Tab },
|
{ NSTabCharacter, Qt::Key_Tab },
|
||||||
@ -357,11 +357,11 @@ QChar QCocoaKeyMapper::toCocoaKey(Qt::Key key)
|
|||||||
{
|
{
|
||||||
// Prioritize overloaded keys
|
// Prioritize overloaded keys
|
||||||
if (key == Qt::Key_Return)
|
if (key == Qt::Key_Return)
|
||||||
return NSNewlineCharacter;
|
return QChar(NSNewlineCharacter);
|
||||||
if (key == Qt::Key_Backspace)
|
if (key == Qt::Key_Backspace)
|
||||||
return NSBackspaceCharacter;
|
return QChar(NSBackspaceCharacter);
|
||||||
|
|
||||||
static QHash<Qt::Key, QChar> reverseCocoaKeys;
|
static QHash<Qt::Key, char16_t> reverseCocoaKeys;
|
||||||
if (reverseCocoaKeys.isEmpty()) {
|
if (reverseCocoaKeys.isEmpty()) {
|
||||||
reverseCocoaKeys.reserve(cocoaKeys.size());
|
reverseCocoaKeys.reserve(cocoaKeys.size());
|
||||||
for (auto it = cocoaKeys.begin(); it != cocoaKeys.end(); ++it)
|
for (auto it = cocoaKeys.begin(); it != cocoaKeys.end(); ++it)
|
||||||
@ -373,7 +373,7 @@ QChar QCocoaKeyMapper::toCocoaKey(Qt::Key key)
|
|||||||
|
|
||||||
Qt::Key QCocoaKeyMapper::fromCocoaKey(QChar keyCode)
|
Qt::Key QCocoaKeyMapper::fromCocoaKey(QChar keyCode)
|
||||||
{
|
{
|
||||||
if (auto key = cocoaKeys.value(keyCode))
|
if (auto key = cocoaKeys.value(keyCode.unicode()))
|
||||||
return key;
|
return key;
|
||||||
|
|
||||||
return Qt::Key(keyCode.toUpper().unicode());
|
return Qt::Key(keyCode.toUpper().unicode());
|
||||||
|
@ -362,7 +362,7 @@ NSMenuItem *QCocoaMenuItem::sync()
|
|||||||
// Similar to qt_mac_removePrivateUnicode change the delete key,
|
// Similar to qt_mac_removePrivateUnicode change the delete key,
|
||||||
// so the symbol is correctly seen in native menu bar.
|
// so the symbol is correctly seen in native menu bar.
|
||||||
if (cocoaKey.unicode() == NSDeleteFunctionKey)
|
if (cocoaKey.unicode() == NSDeleteFunctionKey)
|
||||||
cocoaKey = NSDeleteCharacter;
|
cocoaKey = QChar(NSDeleteCharacter);
|
||||||
|
|
||||||
m_native.keyEquivalent = QStringView(&cocoaKey, 1).toNSString();
|
m_native.keyEquivalent = QStringView(&cocoaKey, 1).toNSString();
|
||||||
m_native.keyEquivalentModifierMask = QCocoaKeyMapper::toCocoaModifiers(modifiers);
|
m_native.keyEquivalentModifierMask = QCocoaKeyMapper::toCocoaModifiers(modifiers);
|
||||||
|
@ -676,7 +676,7 @@ static inline bool isTreeView(const QWidget *widget)
|
|||||||
|
|
||||||
static QString qt_mac_removeMnemonics(const QString &original)
|
static QString qt_mac_removeMnemonics(const QString &original)
|
||||||
{
|
{
|
||||||
QString returnText(original.size(), 0);
|
QString returnText(original.size(), QChar(0));
|
||||||
int finalDest = 0;
|
int finalDest = 0;
|
||||||
int currPos = 0;
|
int currPos = 0;
|
||||||
int l = original.length();
|
int l = original.length();
|
||||||
|
@ -3182,7 +3182,7 @@ void tst_QFile::mapResource()
|
|||||||
QCOMPARE(file.error(), error);
|
QCOMPARE(file.error(), error);
|
||||||
QVERIFY((error == QFile::NoError) ? (memory != 0) : (memory == 0));
|
QVERIFY((error == QFile::NoError) ? (memory != 0) : (memory == 0));
|
||||||
if (error == QFile::NoError)
|
if (error == QFile::NoError)
|
||||||
QCOMPARE(QString(memory[0]), QString::number(offset + 1));
|
QCOMPARE(QString(QChar(memory[0])), QString::number(offset + 1));
|
||||||
QVERIFY(file.unmap(memory));
|
QVERIFY(file.unmap(memory));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -517,23 +517,23 @@ void tst_QUrlInternal::nameprep_highcodes_data()
|
|||||||
QTest::addColumn<int>("rc");
|
QTest::addColumn<int>("rc");
|
||||||
|
|
||||||
{
|
{
|
||||||
QChar st[] = { '-', 0xd801, 0xdc1d, 'a' };
|
QChar st[] = { '-', QChar(0xd801), QChar(0xdc1d), 'a' };
|
||||||
QChar se[] = { '-', 0xd801, 0xdc45, 'a' };
|
QChar se[] = { '-', QChar(0xd801), QChar(0xdc45), 'a' };
|
||||||
QTest::newRow("highcodes (U+1041D)")
|
QTest::newRow("highcodes (U+1041D)")
|
||||||
<< QString(st, sizeof(st)/sizeof(st[0]))
|
<< QString(st, sizeof(st)/sizeof(st[0]))
|
||||||
<< QString(se, sizeof(se)/sizeof(se[0]))
|
<< QString(se, sizeof(se)/sizeof(se[0]))
|
||||||
<< QString() << 0 << 0;
|
<< QString() << 0 << 0;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
QChar st[] = { 0x011C, 0xd835, 0xdf6e, 0x0110 };
|
QChar st[] = { QChar(0x011C), QChar(0xd835), QChar(0xdf6e), QChar(0x0110) };
|
||||||
QChar se[] = { 0x011D, 0x03C9, 0x0111 };
|
QChar se[] = { QChar(0x011D), QChar(0x03C9), QChar(0x0111) };
|
||||||
QTest::newRow("highcodes (U+1D76E)")
|
QTest::newRow("highcodes (U+1D76E)")
|
||||||
<< QString(st, sizeof(st)/sizeof(st[0]))
|
<< QString(st, sizeof(st)/sizeof(st[0]))
|
||||||
<< QString(se, sizeof(se)/sizeof(se[0]))
|
<< QString(se, sizeof(se)/sizeof(se[0]))
|
||||||
<< QString() << 0 << 0;
|
<< QString() << 0 << 0;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
QChar st[] = { 'D', 'o', '\'', 0x2060, 'h' };
|
QChar st[] = { 'D', 'o', '\'', QChar(0x2060), 'h' };
|
||||||
QChar se[] = { 'd', 'o', '\'', 'h' };
|
QChar se[] = { 'd', 'o', '\'', 'h' };
|
||||||
QTest::newRow("highcodes (D, o, ', U+2060, h)")
|
QTest::newRow("highcodes (D, o, ', U+2060, h)")
|
||||||
<< QString(st, sizeof(st)/sizeof(st[0]))
|
<< QString(st, sizeof(st)/sizeof(st[0]))
|
||||||
|
@ -4794,7 +4794,7 @@ void tst_QSortFilterProxyModel::filterAndInsertColumn()
|
|||||||
model.insertRows(0, 1);
|
model.insertRows(0, 1);
|
||||||
for (int i = 0; i < model.rowCount(); ++i) {
|
for (int i = 0; i < model.rowCount(); ++i) {
|
||||||
for (int j = 0; j < model.columnCount(); ++j)
|
for (int j = 0; j < model.columnCount(); ++j)
|
||||||
model.setData(model.index(i, j), QString('A' + j) + QString::number(i + 1));
|
model.setData(model.index(i, j), QString(QChar('A' + j)) + QString::number(i + 1));
|
||||||
}
|
}
|
||||||
ColumnFilterProxy proxy(filterMode);
|
ColumnFilterProxy proxy(filterMode);
|
||||||
proxy.setSourceModel(&model);
|
proxy.setSourceModel(&model);
|
||||||
@ -5048,7 +5048,7 @@ void tst_QSortFilterProxyModel::invalidateColumnsOrRowsFilter()
|
|||||||
QStandardItemModel model(10, 4);
|
QStandardItemModel model(10, 4);
|
||||||
for (int i = 0; i < model.rowCount(); ++i) {
|
for (int i = 0; i < model.rowCount(); ++i) {
|
||||||
for (int j = 0; j < model.columnCount(); ++j) {
|
for (int j = 0; j < model.columnCount(); ++j) {
|
||||||
model.setItem(i, j, new QStandardItem(QString('A' + j) + QString::number(i + 1)));
|
model.setItem(i, j, new QStandardItem(QString(QChar('A' + j)) + QString::number(i + 1)));
|
||||||
model.item(i, 0)->appendColumn({ new QStandardItem(QString("child col %0").arg(j)) });
|
model.item(i, 0)->appendColumn({ new QStandardItem(QString("child col %0").arg(j)) });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3229,8 +3229,8 @@ void tst_QtJson::streamSerializationQJsonValue_data()
|
|||||||
QTest::newRow("array") << QJsonValue{QJsonArray{12,1,5,6,7}};
|
QTest::newRow("array") << QJsonValue{QJsonArray{12,1,5,6,7}};
|
||||||
QTest::newRow("object") << QJsonValue{QJsonObject{{"foo", 665}, {"bar", 666}}};
|
QTest::newRow("object") << QJsonValue{QJsonObject{{"foo", 665}, {"bar", 666}}};
|
||||||
// test json escape sequence
|
// test json escape sequence
|
||||||
QTest::newRow("array with 0xD800") << QJsonValue(QJsonArray{QString(0xD800)});
|
QTest::newRow("array with 0xD800") << QJsonValue(QJsonArray{QString(QChar(0xD800))});
|
||||||
QTest::newRow("array with 0xDF06,0xD834") << QJsonValue(QJsonArray{QString(0xDF06).append(0xD834)});
|
QTest::newRow("array with 0xDF06,0xD834") << QJsonValue(QJsonArray{QString(QChar(0xDF06)).append(QChar(0xD834))});
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QtJson::streamSerializationQJsonValue()
|
void tst_QtJson::streamSerializationQJsonValue()
|
||||||
@ -3323,8 +3323,8 @@ void tst_QtJson::escapeSurrogateCodePoints_data()
|
|||||||
{
|
{
|
||||||
QTest::addColumn<QString>("str");
|
QTest::addColumn<QString>("str");
|
||||||
QTest::addColumn<QByteArray>("escStr");
|
QTest::addColumn<QByteArray>("escStr");
|
||||||
QTest::newRow("0xD800") << QString(0xD800) << QByteArray("\\ud800");
|
QTest::newRow("0xD800") << QString(QChar(0xD800)) << QByteArray("\\ud800");
|
||||||
QTest::newRow("0xDF06,0xD834") << QString(0xDF06).append(0xD834) << QByteArray("\\udf06\\ud834");
|
QTest::newRow("0xDF06,0xD834") << QString(QChar(0xDF06)).append(QChar(0xD834)) << QByteArray("\\udf06\\ud834");
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QtJson::escapeSurrogateCodePoints()
|
void tst_QtJson::escapeSurrogateCodePoints()
|
||||||
|
@ -2874,7 +2874,7 @@ void tst_QDataStream::status_QString_data()
|
|||||||
QString oneMbMinus1;
|
QString oneMbMinus1;
|
||||||
oneMbMinus1.resize(1024 * 1024 - 1);
|
oneMbMinus1.resize(1024 * 1024 - 1);
|
||||||
for (int i = 0; i < oneMbMinus1.size(); ++i)
|
for (int i = 0; i < oneMbMinus1.size(); ++i)
|
||||||
oneMbMinus1[i] = 0x1 | (8 * ((uchar)i / 9));
|
oneMbMinus1[i] = QChar(0x1 | (8 * ((uchar)i / 9)));
|
||||||
QString threeMbMinus1 = oneMbMinus1 + QChar('j') + oneMbMinus1 + QChar('k') + oneMbMinus1;
|
QString threeMbMinus1 = oneMbMinus1 + QChar('j') + oneMbMinus1 + QChar('k') + oneMbMinus1;
|
||||||
|
|
||||||
QByteArray threeMbMinus1Data = qstring2qbytearray(threeMbMinus1);
|
QByteArray threeMbMinus1Data = qstring2qbytearray(threeMbMinus1);
|
||||||
|
@ -115,9 +115,9 @@ void tst_QChar::fromUcs4()
|
|||||||
void tst_QChar::fromWchar_t()
|
void tst_QChar::fromWchar_t()
|
||||||
{
|
{
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
QChar aUmlaut = L'\u00E4'; // German small letter a-umlaut
|
QChar aUmlaut(L'\u00E4'); // German small letter a-umlaut
|
||||||
QCOMPARE(aUmlaut, QChar(0xE4));
|
QCOMPARE(aUmlaut, QChar(0xE4));
|
||||||
QChar replacementCharacter = L'\uFFFD';
|
QChar replacementCharacter(L'\uFFFD');
|
||||||
QCOMPARE(replacementCharacter, QChar(QChar::ReplacementCharacter));
|
QCOMPARE(replacementCharacter, QChar(QChar::ReplacementCharacter));
|
||||||
#else
|
#else
|
||||||
QSKIP("This is a Windows-only test.");
|
QSKIP("This is a Windows-only test.");
|
||||||
|
@ -3991,7 +3991,7 @@ void tst_QString::check_QTextIOStream()
|
|||||||
|
|
||||||
void tst_QString::fromRawData()
|
void tst_QString::fromRawData()
|
||||||
{
|
{
|
||||||
const QChar ptr[] = { 0x1234, 0x0000 };
|
const QChar ptr[] = { QChar(0x1234), QChar(0x0000) };
|
||||||
QString cstr = QString::fromRawData(ptr, 1);
|
QString cstr = QString::fromRawData(ptr, 1);
|
||||||
QVERIFY(!cstr.isDetached());
|
QVERIFY(!cstr.isDetached());
|
||||||
QVERIFY(cstr.constData() == ptr);
|
QVERIFY(cstr.constData() == ptr);
|
||||||
@ -4008,8 +4008,8 @@ void tst_QString::fromRawData()
|
|||||||
|
|
||||||
void tst_QString::setRawData()
|
void tst_QString::setRawData()
|
||||||
{
|
{
|
||||||
const QChar ptr[] = { 0x1234, 0x0000 };
|
const QChar ptr[] = { QChar(0x1234), QChar(0x0000) };
|
||||||
const QChar ptr2[] = { 0x4321, 0x0000 };
|
const QChar ptr2[] = { QChar(0x4321), QChar(0x0000) };
|
||||||
QString cstr;
|
QString cstr;
|
||||||
|
|
||||||
// This just tests the fromRawData() fallback
|
// This just tests the fromRawData() fallback
|
||||||
@ -4278,7 +4278,7 @@ void tst_QString::invalidToLocal8Bit_data()
|
|||||||
QTest::addColumn<QByteArray>("expect"); // Initial validly-converted prefix
|
QTest::addColumn<QByteArray>("expect"); // Initial validly-converted prefix
|
||||||
|
|
||||||
{
|
{
|
||||||
const QChar malformed[] = { 'A', 0xd800, 'B', 0 };
|
const QChar malformed[] = { 'A', QChar(0xd800), 'B', '\0' };
|
||||||
const char expected[] = "A";
|
const char expected[] = "A";
|
||||||
QTest::newRow("LoneHighSurrogate")
|
QTest::newRow("LoneHighSurrogate")
|
||||||
<< QString(malformed, sizeof(malformed) / sizeof(QChar))
|
<< QString(malformed, sizeof(malformed) / sizeof(QChar))
|
||||||
@ -4286,28 +4286,28 @@ void tst_QString::invalidToLocal8Bit_data()
|
|||||||
<< QByteArray(expected, sizeof(expected) / sizeof(char) - 1);
|
<< QByteArray(expected, sizeof(expected) / sizeof(char) - 1);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
const QChar malformed[] = { 'A', 0xdc00, 'B', 0 };
|
const QChar malformed[] = { 'A', QChar(0xdc00), 'B', '\0' };
|
||||||
const char expected[] = "A";
|
const char expected[] = "A";
|
||||||
QTest::newRow("LoneLowSurrogate")
|
QTest::newRow("LoneLowSurrogate")
|
||||||
<< QString(malformed, sizeof(malformed) / sizeof(QChar))
|
<< QString(malformed, sizeof(malformed) / sizeof(QChar))
|
||||||
<< QByteArray(expected, sizeof(expected) / sizeof(char) - 1);
|
<< QByteArray(expected, sizeof(expected) / sizeof(char) - 1);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
const QChar malformed[] = { 'A', 0xd800, 0xd801, 'B', 0 };
|
const QChar malformed[] = { 'A', QChar(0xd800), QChar(0xd801), 'B', '\0' };
|
||||||
const char expected[] = "A";
|
const char expected[] = "A";
|
||||||
QTest::newRow("DoubleHighSurrogate")
|
QTest::newRow("DoubleHighSurrogate")
|
||||||
<< QString(malformed, sizeof(malformed) / sizeof(QChar))
|
<< QString(malformed, sizeof(malformed) / sizeof(QChar))
|
||||||
<< QByteArray(expected, sizeof(expected) / sizeof(char) - 1);
|
<< QByteArray(expected, sizeof(expected) / sizeof(char) - 1);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
const QChar malformed[] = { 'A', 0xdc00, 0xdc01, 'B', 0 };
|
const QChar malformed[] = { 'A', QChar(0xdc00), QChar(0xdc01), 'B', '\0' };
|
||||||
const char expected[] = "A";
|
const char expected[] = "A";
|
||||||
QTest::newRow("DoubleLowSurrogate")
|
QTest::newRow("DoubleLowSurrogate")
|
||||||
<< QString(malformed, sizeof(malformed) / sizeof(QChar))
|
<< QString(malformed, sizeof(malformed) / sizeof(QChar))
|
||||||
<< QByteArray(expected, sizeof(expected) / sizeof(char) - 1);
|
<< QByteArray(expected, sizeof(expected) / sizeof(char) - 1);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
const QChar malformed[] = { 'A', 0xdc00, 0xd800, 'B', 0 };
|
const QChar malformed[] = { 'A', QChar(0xdc00), QChar(0xd800), 'B', '\0' };
|
||||||
const char expected[] = "A";
|
const char expected[] = "A";
|
||||||
QTest::newRow("ReversedSurrogates") // low before high
|
QTest::newRow("ReversedSurrogates") // low before high
|
||||||
<< QString(malformed, sizeof(malformed) / sizeof(QChar))
|
<< QString(malformed, sizeof(malformed) / sizeof(QChar))
|
||||||
|
@ -610,7 +610,7 @@ void tst_QStringConverter::utf8Codec_data()
|
|||||||
str = fromInvalidUtf8Sequence(utf8);
|
str = fromInvalidUtf8Sequence(utf8);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.1") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.1") << utf8 << str << -1;
|
||||||
utf8 += char(0x30);
|
utf8 += char(0x30);
|
||||||
str += 0x30;
|
str += QChar(0x30);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.1-1") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.1-1") << utf8 << str << -1;
|
||||||
|
|
||||||
// 3.3.2
|
// 3.3.2
|
||||||
@ -620,7 +620,7 @@ void tst_QStringConverter::utf8Codec_data()
|
|||||||
str = fromInvalidUtf8Sequence(utf8);
|
str = fromInvalidUtf8Sequence(utf8);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.2") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.2") << utf8 << str << -1;
|
||||||
utf8 += char(0x30);
|
utf8 += char(0x30);
|
||||||
str += 0x30;
|
str += QChar(0x30);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.2-1") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.2-1") << utf8 << str << -1;
|
||||||
|
|
||||||
utf8.clear();
|
utf8.clear();
|
||||||
@ -628,7 +628,7 @@ void tst_QStringConverter::utf8Codec_data()
|
|||||||
str = fromInvalidUtf8Sequence(utf8);
|
str = fromInvalidUtf8Sequence(utf8);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.2-2") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.2-2") << utf8 << str << -1;
|
||||||
utf8 += 0x30;
|
utf8 += 0x30;
|
||||||
str += 0x30;
|
str += QChar(0x30);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.2-3") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.2-3") << utf8 << str << -1;
|
||||||
|
|
||||||
// 3.3.3
|
// 3.3.3
|
||||||
@ -639,7 +639,7 @@ void tst_QStringConverter::utf8Codec_data()
|
|||||||
str = fromInvalidUtf8Sequence(utf8);
|
str = fromInvalidUtf8Sequence(utf8);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.3") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.3") << utf8 << str << -1;
|
||||||
utf8 += char(0x30);
|
utf8 += char(0x30);
|
||||||
str += 0x30;
|
str += QChar(0x30);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.3-1") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.3-1") << utf8 << str << -1;
|
||||||
|
|
||||||
utf8.clear();
|
utf8.clear();
|
||||||
@ -647,7 +647,7 @@ void tst_QStringConverter::utf8Codec_data()
|
|||||||
str = fromInvalidUtf8Sequence(utf8);
|
str = fromInvalidUtf8Sequence(utf8);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.3-2") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.3-2") << utf8 << str << -1;
|
||||||
utf8 += char(0x30);
|
utf8 += char(0x30);
|
||||||
str += 0x30;
|
str += QChar(0x30);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.3-3") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.3-3") << utf8 << str << -1;
|
||||||
|
|
||||||
utf8.clear();
|
utf8.clear();
|
||||||
@ -656,7 +656,7 @@ void tst_QStringConverter::utf8Codec_data()
|
|||||||
str = fromInvalidUtf8Sequence(utf8);
|
str = fromInvalidUtf8Sequence(utf8);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.3-4") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.3-4") << utf8 << str << -1;
|
||||||
utf8 += char(0x30);
|
utf8 += char(0x30);
|
||||||
str += 0x30;
|
str += QChar(0x30);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.3-5") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.3-5") << utf8 << str << -1;
|
||||||
|
|
||||||
// 3.3.4
|
// 3.3.4
|
||||||
@ -668,7 +668,7 @@ void tst_QStringConverter::utf8Codec_data()
|
|||||||
str = fromInvalidUtf8Sequence(utf8);
|
str = fromInvalidUtf8Sequence(utf8);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.4") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.4") << utf8 << str << -1;
|
||||||
utf8 += char(0x30);
|
utf8 += char(0x30);
|
||||||
str += 0x30;
|
str += QChar(0x30);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.4-1") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.4-1") << utf8 << str << -1;
|
||||||
|
|
||||||
utf8.clear();
|
utf8.clear();
|
||||||
@ -678,7 +678,7 @@ void tst_QStringConverter::utf8Codec_data()
|
|||||||
str = fromInvalidUtf8Sequence(utf8);
|
str = fromInvalidUtf8Sequence(utf8);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.4-2") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.4-2") << utf8 << str << -1;
|
||||||
utf8 += char(0x30);
|
utf8 += char(0x30);
|
||||||
str += 0x30;
|
str += QChar(0x30);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.4-3") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.4-3") << utf8 << str << -1;
|
||||||
|
|
||||||
utf8.clear();
|
utf8.clear();
|
||||||
@ -687,7 +687,7 @@ void tst_QStringConverter::utf8Codec_data()
|
|||||||
str = fromInvalidUtf8Sequence(utf8);
|
str = fromInvalidUtf8Sequence(utf8);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.4-4") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.4-4") << utf8 << str << -1;
|
||||||
utf8 += char(0x30);
|
utf8 += char(0x30);
|
||||||
str += 0x30;
|
str += QChar(0x30);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.4-5") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.4-5") << utf8 << str << -1;
|
||||||
|
|
||||||
utf8.clear();
|
utf8.clear();
|
||||||
@ -695,7 +695,7 @@ void tst_QStringConverter::utf8Codec_data()
|
|||||||
str = fromInvalidUtf8Sequence(utf8);
|
str = fromInvalidUtf8Sequence(utf8);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.4-6") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.4-6") << utf8 << str << -1;
|
||||||
utf8 += char(0x30);
|
utf8 += char(0x30);
|
||||||
str += 0x30;
|
str += QChar(0x30);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.4-7") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.4-7") << utf8 << str << -1;
|
||||||
|
|
||||||
// 3.3.5
|
// 3.3.5
|
||||||
@ -708,7 +708,7 @@ void tst_QStringConverter::utf8Codec_data()
|
|||||||
str = fromInvalidUtf8Sequence(utf8);
|
str = fromInvalidUtf8Sequence(utf8);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.5") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.5") << utf8 << str << -1;
|
||||||
utf8 += char(0x30);
|
utf8 += char(0x30);
|
||||||
str += 0x30;
|
str += QChar(0x30);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.5-1") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.5-1") << utf8 << str << -1;
|
||||||
|
|
||||||
utf8.clear();
|
utf8.clear();
|
||||||
@ -719,7 +719,7 @@ void tst_QStringConverter::utf8Codec_data()
|
|||||||
str = fromInvalidUtf8Sequence(utf8);
|
str = fromInvalidUtf8Sequence(utf8);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.5-2") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.5-2") << utf8 << str << -1;
|
||||||
utf8 += char(0x30);
|
utf8 += char(0x30);
|
||||||
str += 0x30;
|
str += QChar(0x30);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.5-3") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.5-3") << utf8 << str << -1;
|
||||||
|
|
||||||
utf8.clear();
|
utf8.clear();
|
||||||
@ -729,7 +729,7 @@ void tst_QStringConverter::utf8Codec_data()
|
|||||||
str = fromInvalidUtf8Sequence(utf8);
|
str = fromInvalidUtf8Sequence(utf8);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.5-4") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.5-4") << utf8 << str << -1;
|
||||||
utf8 += char(0x30);
|
utf8 += char(0x30);
|
||||||
str += 0x30;
|
str += QChar(0x30);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.5-5") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.5-5") << utf8 << str << -1;
|
||||||
|
|
||||||
utf8.clear();
|
utf8.clear();
|
||||||
@ -738,7 +738,7 @@ void tst_QStringConverter::utf8Codec_data()
|
|||||||
str = fromInvalidUtf8Sequence(utf8);
|
str = fromInvalidUtf8Sequence(utf8);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.5-6") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.5-6") << utf8 << str << -1;
|
||||||
utf8 += char(0x30);
|
utf8 += char(0x30);
|
||||||
str += 0x30;
|
str += QChar(0x30);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.5-7") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.5-7") << utf8 << str << -1;
|
||||||
|
|
||||||
utf8.clear();
|
utf8.clear();
|
||||||
@ -746,7 +746,7 @@ void tst_QStringConverter::utf8Codec_data()
|
|||||||
str = fromInvalidUtf8Sequence(utf8);
|
str = fromInvalidUtf8Sequence(utf8);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.5-8") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.5-8") << utf8 << str << -1;
|
||||||
utf8 += char(0x30);
|
utf8 += char(0x30);
|
||||||
str += 0x30;
|
str += QChar(0x30);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.5-9") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.5-9") << utf8 << str << -1;
|
||||||
|
|
||||||
// 3.3.6
|
// 3.3.6
|
||||||
@ -755,7 +755,7 @@ void tst_QStringConverter::utf8Codec_data()
|
|||||||
str = fromInvalidUtf8Sequence(utf8);
|
str = fromInvalidUtf8Sequence(utf8);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.6") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.6") << utf8 << str << -1;
|
||||||
utf8 += char(0x30);
|
utf8 += char(0x30);
|
||||||
str += 0x30;
|
str += QChar(0x30);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.6-1") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.6-1") << utf8 << str << -1;
|
||||||
|
|
||||||
// 3.3.7
|
// 3.3.7
|
||||||
@ -765,7 +765,7 @@ void tst_QStringConverter::utf8Codec_data()
|
|||||||
str = fromInvalidUtf8Sequence(utf8);
|
str = fromInvalidUtf8Sequence(utf8);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.7") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.7") << utf8 << str << -1;
|
||||||
utf8 += char(0x30);
|
utf8 += char(0x30);
|
||||||
str += 0x30;
|
str += QChar(0x30);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.7-1") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.7-1") << utf8 << str << -1;
|
||||||
|
|
||||||
utf8.clear();
|
utf8.clear();
|
||||||
@ -773,7 +773,7 @@ void tst_QStringConverter::utf8Codec_data()
|
|||||||
str = fromInvalidUtf8Sequence(utf8);
|
str = fromInvalidUtf8Sequence(utf8);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.7-2") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.7-2") << utf8 << str << -1;
|
||||||
utf8 += char(0x30);
|
utf8 += char(0x30);
|
||||||
str += 0x30;
|
str += QChar(0x30);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.7-3") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.7-3") << utf8 << str << -1;
|
||||||
|
|
||||||
// 3.3.8
|
// 3.3.8
|
||||||
@ -784,7 +784,7 @@ void tst_QStringConverter::utf8Codec_data()
|
|||||||
str = fromInvalidUtf8Sequence(utf8);
|
str = fromInvalidUtf8Sequence(utf8);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.8") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.8") << utf8 << str << -1;
|
||||||
utf8 += char(0x30);
|
utf8 += char(0x30);
|
||||||
str += 0x30;
|
str += QChar(0x30);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.8-1") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.8-1") << utf8 << str << -1;
|
||||||
|
|
||||||
utf8.clear();
|
utf8.clear();
|
||||||
@ -793,7 +793,7 @@ void tst_QStringConverter::utf8Codec_data()
|
|||||||
str = fromInvalidUtf8Sequence(utf8);
|
str = fromInvalidUtf8Sequence(utf8);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.8-2") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.8-2") << utf8 << str << -1;
|
||||||
utf8 += char(0x30);
|
utf8 += char(0x30);
|
||||||
str += 0x30;
|
str += QChar(0x30);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.8-3") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.8-3") << utf8 << str << -1;
|
||||||
|
|
||||||
utf8.clear();
|
utf8.clear();
|
||||||
@ -801,7 +801,7 @@ void tst_QStringConverter::utf8Codec_data()
|
|||||||
str = fromInvalidUtf8Sequence(utf8);
|
str = fromInvalidUtf8Sequence(utf8);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.8-4") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.8-4") << utf8 << str << -1;
|
||||||
utf8 += char(0x30);
|
utf8 += char(0x30);
|
||||||
str += 0x30;
|
str += QChar(0x30);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.8-5") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.8-5") << utf8 << str << -1;
|
||||||
|
|
||||||
// 3.3.9
|
// 3.3.9
|
||||||
@ -813,7 +813,7 @@ void tst_QStringConverter::utf8Codec_data()
|
|||||||
str = fromInvalidUtf8Sequence(utf8);
|
str = fromInvalidUtf8Sequence(utf8);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.9") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.9") << utf8 << str << -1;
|
||||||
utf8 += char(0x30);
|
utf8 += char(0x30);
|
||||||
str += 0x30;
|
str += QChar(0x30);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.9-1") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.9-1") << utf8 << str << -1;
|
||||||
|
|
||||||
utf8.clear();
|
utf8.clear();
|
||||||
@ -823,7 +823,7 @@ void tst_QStringConverter::utf8Codec_data()
|
|||||||
str = fromInvalidUtf8Sequence(utf8);
|
str = fromInvalidUtf8Sequence(utf8);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.9-2") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.9-2") << utf8 << str << -1;
|
||||||
utf8 += char(0x30);
|
utf8 += char(0x30);
|
||||||
str += 0x30;
|
str += QChar(0x30);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.9-3") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.9-3") << utf8 << str << -1;
|
||||||
|
|
||||||
utf8.clear();
|
utf8.clear();
|
||||||
@ -832,7 +832,7 @@ void tst_QStringConverter::utf8Codec_data()
|
|||||||
str = fromInvalidUtf8Sequence(utf8);
|
str = fromInvalidUtf8Sequence(utf8);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.9-4") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.9-4") << utf8 << str << -1;
|
||||||
utf8 += char(0x30);
|
utf8 += char(0x30);
|
||||||
str += 0x30;
|
str += QChar(0x30);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.9-5") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.9-5") << utf8 << str << -1;
|
||||||
|
|
||||||
utf8.clear();
|
utf8.clear();
|
||||||
@ -840,7 +840,7 @@ void tst_QStringConverter::utf8Codec_data()
|
|||||||
str = fromInvalidUtf8Sequence(utf8);
|
str = fromInvalidUtf8Sequence(utf8);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.9-6") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.9-6") << utf8 << str << -1;
|
||||||
utf8 += char(0x30);
|
utf8 += char(0x30);
|
||||||
str += 0x30;
|
str += QChar(0x30);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.9-7") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.9-7") << utf8 << str << -1;
|
||||||
|
|
||||||
// 3.3.10
|
// 3.3.10
|
||||||
@ -853,7 +853,7 @@ void tst_QStringConverter::utf8Codec_data()
|
|||||||
str = fromInvalidUtf8Sequence(utf8);
|
str = fromInvalidUtf8Sequence(utf8);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.10") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.10") << utf8 << str << -1;
|
||||||
utf8 += char(0x30);
|
utf8 += char(0x30);
|
||||||
str += 0x30;
|
str += QChar(0x30);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.10-1") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.10-1") << utf8 << str << -1;
|
||||||
|
|
||||||
utf8.clear();
|
utf8.clear();
|
||||||
@ -864,7 +864,7 @@ void tst_QStringConverter::utf8Codec_data()
|
|||||||
str = fromInvalidUtf8Sequence(utf8);
|
str = fromInvalidUtf8Sequence(utf8);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.10-2") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.10-2") << utf8 << str << -1;
|
||||||
utf8 += char(0x30);
|
utf8 += char(0x30);
|
||||||
str += 0x30;
|
str += QChar(0x30);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.10-3") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.10-3") << utf8 << str << -1;
|
||||||
|
|
||||||
utf8.clear();
|
utf8.clear();
|
||||||
@ -874,7 +874,7 @@ void tst_QStringConverter::utf8Codec_data()
|
|||||||
str = fromInvalidUtf8Sequence(utf8);
|
str = fromInvalidUtf8Sequence(utf8);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.10-4") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.10-4") << utf8 << str << -1;
|
||||||
utf8 += char(0x30);
|
utf8 += char(0x30);
|
||||||
str += 0x30;
|
str += QChar(0x30);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.10-5") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.10-5") << utf8 << str << -1;
|
||||||
|
|
||||||
utf8.clear();
|
utf8.clear();
|
||||||
@ -883,7 +883,7 @@ void tst_QStringConverter::utf8Codec_data()
|
|||||||
str = fromInvalidUtf8Sequence(utf8);
|
str = fromInvalidUtf8Sequence(utf8);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.10-6") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.10-6") << utf8 << str << -1;
|
||||||
utf8 += char(0x30);
|
utf8 += char(0x30);
|
||||||
str += 0x30;
|
str += QChar(0x30);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.10-7") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.10-7") << utf8 << str << -1;
|
||||||
|
|
||||||
utf8.clear();
|
utf8.clear();
|
||||||
@ -891,7 +891,7 @@ void tst_QStringConverter::utf8Codec_data()
|
|||||||
str = fromInvalidUtf8Sequence(utf8);
|
str = fromInvalidUtf8Sequence(utf8);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.10-8") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.10-8") << utf8 << str << -1;
|
||||||
utf8 += char(0x30);
|
utf8 += char(0x30);
|
||||||
str += 0x30;
|
str += QChar(0x30);
|
||||||
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.10-9") << utf8 << str << -1;
|
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.10-9") << utf8 << str << -1;
|
||||||
|
|
||||||
// 3.4
|
// 3.4
|
||||||
|
@ -666,7 +666,7 @@ template <typename Char>
|
|||||||
void tst_QStringView::fromLiteral(const Char *arg) const
|
void tst_QStringView::fromLiteral(const Char *arg) const
|
||||||
{
|
{
|
||||||
const Char *null = nullptr;
|
const Char *null = nullptr;
|
||||||
const Char empty[] = { 0 };
|
const Char empty[] = { Char{} };
|
||||||
|
|
||||||
QCOMPARE(QStringView(null).size(), qsizetype(0));
|
QCOMPARE(QStringView(null).size(), qsizetype(0));
|
||||||
QCOMPARE(QStringView(null).data(), nullptr);
|
QCOMPARE(QStringView(null).data(), nullptr);
|
||||||
|
@ -293,7 +293,7 @@ void tst_QTextBoundaryFinder::wordBoundaries_manual_data()
|
|||||||
QTest::addColumn<QList<int> >("expectedEndPositions");
|
QTest::addColumn<QList<int> >("expectedEndPositions");
|
||||||
|
|
||||||
{
|
{
|
||||||
QChar s[] = { 0x000D, 0x000A, 0x000A };
|
QChar s[] = { QChar(0x000D), QChar(0x000A), QChar(0x000A) };
|
||||||
QString testString(s, sizeof(s)/sizeof(s[0]));
|
QString testString(s, sizeof(s)/sizeof(s[0]));
|
||||||
QList<int> expectedBreakPositions, expectedStartPositions, expectedEndPositions;
|
QList<int> expectedBreakPositions, expectedStartPositions, expectedEndPositions;
|
||||||
expectedBreakPositions << 0 << 2 << 3;
|
expectedBreakPositions << 0 << 2 << 3;
|
||||||
@ -302,7 +302,7 @@ void tst_QTextBoundaryFinder::wordBoundaries_manual_data()
|
|||||||
<< expectedStartPositions << expectedEndPositions;
|
<< expectedStartPositions << expectedEndPositions;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
QChar s[] = { 0x000D, 0x0308, 0x000A, 0x000A };
|
QChar s[] = { QChar(0x000D), QChar(0x0308), QChar(0x000A), QChar(0x000A) };
|
||||||
QString testString(s, sizeof(s)/sizeof(s[0]));
|
QString testString(s, sizeof(s)/sizeof(s[0]));
|
||||||
QList<int> expectedBreakPositions, expectedStartPositions, expectedEndPositions;
|
QList<int> expectedBreakPositions, expectedStartPositions, expectedEndPositions;
|
||||||
expectedBreakPositions << 0 << 1 << 2 << 3 << 4;
|
expectedBreakPositions << 0 << 1 << 2 << 3 << 4;
|
||||||
@ -366,7 +366,7 @@ void tst_QTextBoundaryFinder::wordBoundaries_manual_data()
|
|||||||
|
|
||||||
// Sample Strings from WordBreakTest.html
|
// Sample Strings from WordBreakTest.html
|
||||||
{
|
{
|
||||||
QChar s[] = { 0x0063, 0x0061, 0x006E, 0x0027, 0x0074 };
|
QChar s[] = { QChar(0x0063), QChar(0x0061), QChar(0x006E), QChar(0x0027), QChar(0x0074) };
|
||||||
QString testString(s, sizeof(s)/sizeof(s[0]));
|
QString testString(s, sizeof(s)/sizeof(s[0]));
|
||||||
QList<int> expectedBreakPositions, expectedStartPositions, expectedEndPositions;
|
QList<int> expectedBreakPositions, expectedStartPositions, expectedEndPositions;
|
||||||
expectedBreakPositions << 0 << 5;
|
expectedBreakPositions << 0 << 5;
|
||||||
@ -377,7 +377,7 @@ void tst_QTextBoundaryFinder::wordBoundaries_manual_data()
|
|||||||
<< expectedStartPositions << expectedEndPositions;
|
<< expectedStartPositions << expectedEndPositions;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
QChar s[] = { 0x0063, 0x0061, 0x006E, 0x2019, 0x0074 };
|
QChar s[] = { QChar(0x0063), QChar(0x0061), QChar(0x006E), QChar(0x2019), QChar(0x0074) };
|
||||||
QString testString(s, sizeof(s)/sizeof(s[0]));
|
QString testString(s, sizeof(s)/sizeof(s[0]));
|
||||||
QList<int> expectedBreakPositions, expectedStartPositions, expectedEndPositions;
|
QList<int> expectedBreakPositions, expectedStartPositions, expectedEndPositions;
|
||||||
expectedBreakPositions << 0 << 5;
|
expectedBreakPositions << 0 << 5;
|
||||||
@ -388,7 +388,7 @@ void tst_QTextBoundaryFinder::wordBoundaries_manual_data()
|
|||||||
<< expectedStartPositions << expectedEndPositions;
|
<< expectedStartPositions << expectedEndPositions;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
QChar s[] = { 0x0061, 0x0062, 0x00AD, 0x0062, 0x0061 };
|
QChar s[] = { QChar(0x0061), QChar(0x0062), QChar(0x00AD), QChar(0x0062), QChar(0x0061) };
|
||||||
QString testString(s, sizeof(s)/sizeof(s[0]));
|
QString testString(s, sizeof(s)/sizeof(s[0]));
|
||||||
QList<int> expectedBreakPositions, expectedStartPositions, expectedEndPositions;
|
QList<int> expectedBreakPositions, expectedStartPositions, expectedEndPositions;
|
||||||
expectedBreakPositions << 0 << 5;
|
expectedBreakPositions << 0 << 5;
|
||||||
@ -399,8 +399,10 @@ void tst_QTextBoundaryFinder::wordBoundaries_manual_data()
|
|||||||
<< expectedStartPositions << expectedEndPositions;
|
<< expectedStartPositions << expectedEndPositions;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
QChar s[] = { 0x0061, 0x0024, 0x002D, 0x0033, 0x0034, 0x002C, 0x0035, 0x0036,
|
QChar s[] = { QChar(0x0061), QChar(0x0024), QChar(0x002D), QChar(0x0033),
|
||||||
0x0037, 0x002E, 0x0031, 0x0034, 0x0025, 0x0062 };
|
QChar(0x0034), QChar(0x002C), QChar(0x0035), QChar(0x0036),
|
||||||
|
QChar(0x0037), QChar(0x002E), QChar(0x0031), QChar(0x0034),
|
||||||
|
QChar(0x0025), QChar(0x0062) };
|
||||||
QString testString(s, sizeof(s)/sizeof(s[0]));
|
QString testString(s, sizeof(s)/sizeof(s[0]));
|
||||||
QList<int> expectedBreakPositions, expectedStartPositions, expectedEndPositions;
|
QList<int> expectedBreakPositions, expectedStartPositions, expectedEndPositions;
|
||||||
expectedBreakPositions << 0 << 1 << 2 << 3 << 12 << 13 << 14;
|
expectedBreakPositions << 0 << 1 << 2 << 3 << 12 << 13 << 14;
|
||||||
@ -411,7 +413,7 @@ void tst_QTextBoundaryFinder::wordBoundaries_manual_data()
|
|||||||
<< expectedStartPositions << expectedEndPositions;
|
<< expectedStartPositions << expectedEndPositions;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
QChar s[] = { 0x0033, 0x0061 };
|
QChar s[] = { QChar(0x0033), QChar(0x0061) };
|
||||||
QString testString(s, sizeof(s)/sizeof(s[0]));
|
QString testString(s, sizeof(s)/sizeof(s[0]));
|
||||||
QList<int> expectedBreakPositions, expectedStartPositions, expectedEndPositions;
|
QList<int> expectedBreakPositions, expectedStartPositions, expectedEndPositions;
|
||||||
expectedBreakPositions << 0 << 2;
|
expectedBreakPositions << 0 << 2;
|
||||||
@ -422,8 +424,9 @@ void tst_QTextBoundaryFinder::wordBoundaries_manual_data()
|
|||||||
<< expectedStartPositions << expectedEndPositions;
|
<< expectedStartPositions << expectedEndPositions;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
QChar s[] = { 0x2060, 0x0063, 0x2060, 0x0061, 0x2060, 0x006E, 0x2060, 0x0027,
|
QChar s[] = { QChar(0x2060), QChar(0x0063), QChar(0x2060), QChar(0x0061),
|
||||||
0x2060, 0x0074, 0x2060, 0x2060 };
|
QChar(0x2060), QChar(0x006E), QChar(0x2060), QChar(0x0027),
|
||||||
|
QChar(0x2060), QChar(0x0074), QChar(0x2060), QChar(0x2060) };
|
||||||
QString testString(s, sizeof(s)/sizeof(s[0]));
|
QString testString(s, sizeof(s)/sizeof(s[0]));
|
||||||
QList<int> expectedBreakPositions, expectedStartPositions, expectedEndPositions;
|
QList<int> expectedBreakPositions, expectedStartPositions, expectedEndPositions;
|
||||||
expectedBreakPositions << 0 << 1 << 12;
|
expectedBreakPositions << 0 << 1 << 12;
|
||||||
@ -434,8 +437,9 @@ void tst_QTextBoundaryFinder::wordBoundaries_manual_data()
|
|||||||
<< expectedStartPositions << expectedEndPositions;
|
<< expectedStartPositions << expectedEndPositions;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
QChar s[] = { 0x2060, 0x0063, 0x2060, 0x0061, 0x2060, 0x006E, 0x2060, 0x2019,
|
QChar s[] = { QChar(0x2060), QChar(0x0063), QChar(0x2060), QChar(0x0061),
|
||||||
0x2060, 0x0074, 0x2060, 0x2060 };
|
QChar(0x2060), QChar(0x006E), QChar(0x2060), QChar(0x2019),
|
||||||
|
QChar(0x2060), QChar(0x0074), QChar(0x2060), QChar(0x2060) };
|
||||||
QString testString(s, sizeof(s)/sizeof(s[0]));
|
QString testString(s, sizeof(s)/sizeof(s[0]));
|
||||||
QList<int> expectedBreakPositions, expectedStartPositions, expectedEndPositions;
|
QList<int> expectedBreakPositions, expectedStartPositions, expectedEndPositions;
|
||||||
expectedBreakPositions << 0 << 1 << 12;
|
expectedBreakPositions << 0 << 1 << 12;
|
||||||
@ -446,8 +450,9 @@ void tst_QTextBoundaryFinder::wordBoundaries_manual_data()
|
|||||||
<< expectedStartPositions << expectedEndPositions;
|
<< expectedStartPositions << expectedEndPositions;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
QChar s[] = { 0x2060, 0x0061, 0x2060, 0x0062, 0x2060, 0x00AD, 0x2060, 0x0062,
|
QChar s[] = { QChar(0x2060), QChar(0x0061), QChar(0x2060), QChar(0x0062),
|
||||||
0x2060, 0x0061, 0x2060, 0x2060 };
|
QChar(0x2060), QChar(0x00AD), QChar(0x2060), QChar(0x0062),
|
||||||
|
QChar(0x2060), QChar(0x0061), QChar(0x2060), QChar(0x2060) };
|
||||||
QString testString(s, sizeof(s)/sizeof(s[0]));
|
QString testString(s, sizeof(s)/sizeof(s[0]));
|
||||||
QList<int> expectedBreakPositions, expectedStartPositions, expectedEndPositions;
|
QList<int> expectedBreakPositions, expectedStartPositions, expectedEndPositions;
|
||||||
expectedBreakPositions << 0 << 1 << 12;
|
expectedBreakPositions << 0 << 1 << 12;
|
||||||
@ -458,10 +463,14 @@ void tst_QTextBoundaryFinder::wordBoundaries_manual_data()
|
|||||||
<< expectedStartPositions << expectedEndPositions;
|
<< expectedStartPositions << expectedEndPositions;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
QChar s[] = { 0x2060, 0x0061, 0x2060, 0x0024, 0x2060, 0x002D, 0x2060, 0x0033,
|
QChar s[] = { QChar(0x2060), QChar(0x0061), QChar(0x2060), QChar(0x0024),
|
||||||
0x2060, 0x0034, 0x2060, 0x002C, 0x2060, 0x0035, 0x2060, 0x0036,
|
QChar(0x2060), QChar(0x002D), QChar(0x2060), QChar(0x0033),
|
||||||
0x2060, 0x0037, 0x2060, 0x002E, 0x2060, 0x0031, 0x2060, 0x0034,
|
QChar(0x2060), QChar(0x0034), QChar(0x2060), QChar(0x002C),
|
||||||
0x2060, 0x0025, 0x2060, 0x0062, 0x2060, 0x2060 };
|
QChar(0x2060), QChar(0x0035), QChar(0x2060), QChar(0x0036),
|
||||||
|
QChar(0x2060), QChar(0x0037), QChar(0x2060), QChar(0x002E),
|
||||||
|
QChar(0x2060), QChar(0x0031), QChar(0x2060), QChar(0x0034),
|
||||||
|
QChar(0x2060), QChar(0x0025), QChar(0x2060), QChar(0x0062),
|
||||||
|
QChar(0x2060), QChar(0x2060) };
|
||||||
QString testString(s, sizeof(s)/sizeof(s[0]));
|
QString testString(s, sizeof(s)/sizeof(s[0]));
|
||||||
QList<int> expectedBreakPositions, expectedStartPositions, expectedEndPositions;
|
QList<int> expectedBreakPositions, expectedStartPositions, expectedEndPositions;
|
||||||
expectedBreakPositions << 0 << 1 << 3 << 5 << 7 << 25 << 27 << 30;
|
expectedBreakPositions << 0 << 1 << 3 << 5 << 7 << 25 << 27 << 30;
|
||||||
@ -472,7 +481,8 @@ void tst_QTextBoundaryFinder::wordBoundaries_manual_data()
|
|||||||
<< expectedStartPositions << expectedEndPositions;
|
<< expectedStartPositions << expectedEndPositions;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
QChar s[] = { 0x2060, 0x0033, 0x2060, 0x0061, 0x2060, 0x2060 };
|
QChar s[] = { QChar(0x2060), QChar(0x0033), QChar(0x2060), QChar(0x0061),
|
||||||
|
QChar(0x2060), QChar(0x2060) };
|
||||||
QString testString(s, sizeof(s)/sizeof(s[0]));
|
QString testString(s, sizeof(s)/sizeof(s[0]));
|
||||||
QList<int> expectedBreakPositions, expectedStartPositions, expectedEndPositions;
|
QList<int> expectedBreakPositions, expectedStartPositions, expectedEndPositions;
|
||||||
expectedBreakPositions << 0 << 1 << 6;
|
expectedBreakPositions << 0 << 1 << 6;
|
||||||
@ -502,7 +512,7 @@ void tst_QTextBoundaryFinder::sentenceBoundaries_manual_data()
|
|||||||
QTest::addColumn<QList<int> >("expectedBreakPositions");
|
QTest::addColumn<QList<int> >("expectedBreakPositions");
|
||||||
|
|
||||||
{
|
{
|
||||||
QChar s[] = { 0x000D, 0x000A, 0x000A };
|
QChar s[] = { QChar(0x000D), QChar(0x000A), QChar(0x000A) };
|
||||||
QString testString(s, sizeof(s)/sizeof(s[0]));
|
QString testString(s, sizeof(s)/sizeof(s[0]));
|
||||||
QList<int> expectedBreakPositions;
|
QList<int> expectedBreakPositions;
|
||||||
expectedBreakPositions << 0 << 2 << 3;
|
expectedBreakPositions << 0 << 2 << 3;
|
||||||
@ -510,7 +520,7 @@ void tst_QTextBoundaryFinder::sentenceBoundaries_manual_data()
|
|||||||
QTest::newRow("+CRxLF+LF+") << testString << expectedBreakPositions;
|
QTest::newRow("+CRxLF+LF+") << testString << expectedBreakPositions;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
QChar s[] = { 0x000D, 0x0308, 0x000A, 0x000A };
|
QChar s[] = { QChar(0x000D), QChar(0x0308), QChar(0x000A), QChar(0x000A) };
|
||||||
QString testString(s, sizeof(s)/sizeof(s[0]));
|
QString testString(s, sizeof(s)/sizeof(s[0]));
|
||||||
QList<int> expectedBreakPositions;
|
QList<int> expectedBreakPositions;
|
||||||
expectedBreakPositions << 0 << 1 << 3 << 4;
|
expectedBreakPositions << 0 << 1 << 3 << 4;
|
||||||
@ -587,7 +597,7 @@ void tst_QTextBoundaryFinder::lineBoundaries_manual_data()
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
QChar s[] = { 0x000D, 0x0308, 0x000A, 0x000A, 0x0020 };
|
QChar s[] = { QChar(0x000D), QChar(0x0308), QChar(0x000A), QChar(0x000A), QChar(0x0020) };
|
||||||
QString testString(s, sizeof(s)/sizeof(s[0]));
|
QString testString(s, sizeof(s)/sizeof(s[0]));
|
||||||
QList<int> expectedBreakPositions, expectedMandatoryBreakPositions;
|
QList<int> expectedBreakPositions, expectedMandatoryBreakPositions;
|
||||||
expectedBreakPositions << 0 << 1 << 3 << 4 << 5;
|
expectedBreakPositions << 0 << 1 << 3 << 4 << 5;
|
||||||
@ -597,7 +607,7 @@ void tst_QTextBoundaryFinder::lineBoundaries_manual_data()
|
|||||||
<< expectedMandatoryBreakPositions;
|
<< expectedMandatoryBreakPositions;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
QChar s[] = { 0x000A, 0x2E80, 0x0308, 0x0023, 0x0023 };
|
QChar s[] = { QChar(0x000A), QChar(0x2E80), QChar(0x0308), QChar(0x0023), QChar(0x0023) };
|
||||||
QString testString(s, sizeof(s)/sizeof(QChar));
|
QString testString(s, sizeof(s)/sizeof(QChar));
|
||||||
QList<int> expectedBreakPositions, expectedMandatoryBreakPositions;
|
QList<int> expectedBreakPositions, expectedMandatoryBreakPositions;
|
||||||
expectedBreakPositions << 0 << 1 << 3 << 5;
|
expectedBreakPositions << 0 << 1 << 3 << 5;
|
||||||
@ -607,7 +617,7 @@ void tst_QTextBoundaryFinder::lineBoundaries_manual_data()
|
|||||||
<< expectedMandatoryBreakPositions;
|
<< expectedMandatoryBreakPositions;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
QChar s[] = { 0x000A, 0x0308, 0x0023, 0x0023 };
|
QChar s[] = { QChar(0x000A), QChar(0x0308), QChar(0x0023), QChar(0x0023) };
|
||||||
QString testString(s, sizeof(s)/sizeof(QChar));
|
QString testString(s, sizeof(s)/sizeof(QChar));
|
||||||
QList<int> expectedBreakPositions, expectedMandatoryBreakPositions;
|
QList<int> expectedBreakPositions, expectedMandatoryBreakPositions;
|
||||||
expectedBreakPositions << 0 << 1 << 4;
|
expectedBreakPositions << 0 << 1 << 4;
|
||||||
@ -618,7 +628,7 @@ void tst_QTextBoundaryFinder::lineBoundaries_manual_data()
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
QChar s[] = { 0x0061, 0x00AD, 0x0062, 0x0009, 0x0063, 0x0064 };
|
QChar s[] = { QChar(0x0061), QChar(0x00AD), QChar(0x0062), QChar(0x0009), QChar(0x0063), QChar(0x0064) };
|
||||||
QString testString(s, sizeof(s)/sizeof(s[0]));
|
QString testString(s, sizeof(s)/sizeof(s[0]));
|
||||||
QList<int> expectedBreakPositions, expectedMandatoryBreakPositions;
|
QList<int> expectedBreakPositions, expectedMandatoryBreakPositions;
|
||||||
expectedBreakPositions << 0 << 2 << 4 << 6;
|
expectedBreakPositions << 0 << 2 << 4 << 6;
|
||||||
|
@ -1121,17 +1121,17 @@ void tst_Collections::hash()
|
|||||||
Hash hash;
|
Hash hash;
|
||||||
QString key = QLatin1String(" ");
|
QString key = QLatin1String(" ");
|
||||||
for (int i = 0; i < 10; ++i) {
|
for (int i = 0; i < 10; ++i) {
|
||||||
key[0] = i + '0';
|
key[0] = QChar(i + '0');
|
||||||
for (int j = 0; j < 10; ++j) {
|
for (int j = 0; j < 10; ++j) {
|
||||||
key[1] = j + '0';
|
key[1] = QChar(j + '0');
|
||||||
hash.insert(key, "V" + key);
|
hash.insert(key, "V" + key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 10; ++i) {
|
for (int i = 0; i < 10; ++i) {
|
||||||
key[0] = i + '0';
|
key[0] = QChar(i + '0');
|
||||||
for (int j = 0; j < 10; ++j) {
|
for (int j = 0; j < 10; ++j) {
|
||||||
key[1] = j + '0';
|
key[1] = QChar(j + '0');
|
||||||
hash.remove(key);
|
hash.remove(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -309,17 +309,17 @@ void tst_QHash::insert1()
|
|||||||
Hash hash;
|
Hash hash;
|
||||||
QString key = QLatin1String(" ");
|
QString key = QLatin1String(" ");
|
||||||
for (int i = 0; i < 10; ++i) {
|
for (int i = 0; i < 10; ++i) {
|
||||||
key[0] = i + '0';
|
key[0] = QChar(i + '0');
|
||||||
for (int j = 0; j < 10; ++j) {
|
for (int j = 0; j < 10; ++j) {
|
||||||
key[1] = j + '0';
|
key[1] = QChar(j + '0');
|
||||||
hash.insert(key, "V" + key);
|
hash.insert(key, "V" + key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 10; ++i) {
|
for (int i = 0; i < 10; ++i) {
|
||||||
key[0] = i + '0';
|
key[0] = QChar(i + '0');
|
||||||
for (int j = 0; j < 10; ++j) {
|
for (int j = 0; j < 10; ++j) {
|
||||||
key[1] = j + '0';
|
key[1] = QChar(j + '0');
|
||||||
hash.remove(key);
|
hash.remove(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ static void addFixedTypes()
|
|||||||
|
|
||||||
static void addInvalidSingleLetterTypes()
|
static void addInvalidSingleLetterTypes()
|
||||||
{
|
{
|
||||||
QChar nulString[] = { 0 };
|
QChar nulString[] = { '\0' };
|
||||||
QTest::newRow("nul") << QString(nulString, 1) << false << false;
|
QTest::newRow("nul") << QString(nulString, 1) << false << false;
|
||||||
QTest::newRow("tilde") << "~" << false << false;
|
QTest::newRow("tilde") << "~" << false << false;
|
||||||
QTest::newRow("struct-begin") << "(" << false << false;
|
QTest::newRow("struct-begin") << "(" << false << false;
|
||||||
|
@ -1149,8 +1149,8 @@ void tst_QTextLayout::graphemeBoundaryForSurrogatePairs()
|
|||||||
{
|
{
|
||||||
QString txt;
|
QString txt;
|
||||||
txt.append(QLatin1Char('a'));
|
txt.append(QLatin1Char('a'));
|
||||||
txt.append(0xd87e);
|
txt.append(QChar(0xd87e));
|
||||||
txt.append(0xdc25);
|
txt.append(QChar(0xdc25));
|
||||||
txt.append(QLatin1Char('b'));
|
txt.append(QLatin1Char('b'));
|
||||||
QTextLayout layout(txt);
|
QTextLayout layout(txt);
|
||||||
QTextEngine *engine = layout.engine();
|
QTextEngine *engine = layout.engine();
|
||||||
|
@ -2861,7 +2861,7 @@ void tst_QHeaderView::additionalInit()
|
|||||||
model->setData(model->index(i, 0), QVariant(i));
|
model->setData(model->index(i, 0), QVariant(i));
|
||||||
s.setNum(i);
|
s.setNum(i);
|
||||||
s += QLatin1Char('.');
|
s += QLatin1Char('.');
|
||||||
s += 'a' + (i % 25);
|
s += QChar('a' + (i % 25));
|
||||||
model->setData(model->index(i, 1), QVariant(s));
|
model->setData(model->index(i, 1), QVariant(s));
|
||||||
}
|
}
|
||||||
m_tableview->setUpdatesEnabled(updates_enabled);
|
m_tableview->setUpdatesEnabled(updates_enabled);
|
||||||
|
@ -1833,7 +1833,7 @@ void tst_QDom::appendDocumentNode() const
|
|||||||
|
|
||||||
static const QChar umlautName[] =
|
static const QChar umlautName[] =
|
||||||
{
|
{
|
||||||
'a', 0xfc, 'b'
|
'a', '\xfc', 'b'
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -164,12 +164,12 @@ void tst_QPixmapCache::styleUseCaseComplexKey()
|
|||||||
{
|
{
|
||||||
styleStruct myStruct;
|
styleStruct myStruct;
|
||||||
myStruct.key = QString("my-progressbar-%1").arg(i);
|
myStruct.key = QString("my-progressbar-%1").arg(i);
|
||||||
myStruct.key = 5;
|
myStruct.key = QChar(5);
|
||||||
myStruct.key = 4;
|
myStruct.key = QChar(4);
|
||||||
myStruct.key = 3;
|
myStruct.key = QChar(3);
|
||||||
myStruct.palette = 358;
|
myStruct.palette = 358;
|
||||||
myStruct.width = 100;
|
myStruct.width = 100;
|
||||||
myStruct.key = 200;
|
myStruct.key = QChar(200);
|
||||||
QPixmapCache::Key key = QPixmapCache::insert(p);
|
QPixmapCache::Key key = QPixmapCache::insert(p);
|
||||||
hash.insert(myStruct, key);
|
hash.insert(myStruct, key);
|
||||||
}
|
}
|
||||||
@ -177,12 +177,12 @@ void tst_QPixmapCache::styleUseCaseComplexKey()
|
|||||||
{
|
{
|
||||||
styleStruct myStruct;
|
styleStruct myStruct;
|
||||||
myStruct.key = QString("my-progressbar-%1").arg(i);
|
myStruct.key = QString("my-progressbar-%1").arg(i);
|
||||||
myStruct.key = 5;
|
myStruct.key = QChar(5);
|
||||||
myStruct.key = 4;
|
myStruct.key = QChar(4);
|
||||||
myStruct.key = 3;
|
myStruct.key = QChar(3);
|
||||||
myStruct.palette = 358;
|
myStruct.palette = 358;
|
||||||
myStruct.width = 100;
|
myStruct.width = 100;
|
||||||
myStruct.key = 200;
|
myStruct.key = QChar(200);
|
||||||
QPixmapCache::Key key = hash.value(myStruct);
|
QPixmapCache::Key key = hash.value(myStruct);
|
||||||
QPixmapCache::find(key, &p);
|
QPixmapCache::find(key, &p);
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,7 @@ void BenchQHeaderView::init()
|
|||||||
m_model->setData(m_model->index(i, 0), QVariant(i));
|
m_model->setData(m_model->index(i, 0), QVariant(i));
|
||||||
s.setNum(i);
|
s.setNum(i);
|
||||||
s += QLatin1Char('.');
|
s += QLatin1Char('.');
|
||||||
s += 'a' + (i % 25);
|
s += QLatin1Char('a' + (i % 25));
|
||||||
m_model->setData(m_model->index(i, 1), QVariant(s));
|
m_model->setData(m_model->index(i, 1), QVariant(s));
|
||||||
}
|
}
|
||||||
m_tv->setUpdatesEnabled(m_updatesEnabled);
|
m_tv->setUpdatesEnabled(m_updatesEnabled);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user