tst_QPlainTextEdit/tst_QTextEdit: Do not output unprintable characters.
The test selectWordsFromStringsContainingSeparators() duplicated in boths tests caused tab and Nbsp characters to be output to the log, which upsets editors. Use an array of ushort instead of a wasteful QStringList and output the hex codes for the unprintable characters. Change-Id: I08724268f376b4c0da492b4109570e44f7d4a3fb Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This commit is contained in:
parent
a9bef62ec2
commit
ed08e3be34
@ -1184,12 +1184,19 @@ void tst_QPlainTextEdit::selectWordsFromStringsContainingSeparators_data()
|
||||
QTest::addColumn<QString>("testString");
|
||||
QTest::addColumn<QString>("selectedWord");
|
||||
|
||||
QStringList wordSeparators;
|
||||
wordSeparators << "." << "," << "?" << "!" << ":" << ";" << "-" << "<" << ">" << "["
|
||||
<< "]" << "(" << ")" << "{" << "}" << "=" << "\t"<< QString(QChar::Nbsp);
|
||||
const ushort wordSeparators[] =
|
||||
{'.', ',', '?', '!', ':', ';', '-', '<', '>', '[', ']', '(', ')', '{', '}',
|
||||
'=', '\t', ushort(QChar::Nbsp)};
|
||||
|
||||
foreach (QString s, wordSeparators)
|
||||
QTest::newRow(QString("separator: " + s).toLocal8Bit()) << QString("foo") + s + QString("bar") << QString("foo");
|
||||
for (size_t i = 0, count = sizeof(wordSeparators) / sizeof(wordSeparators[0]); i < count; ++i) {
|
||||
const ushort u = wordSeparators[i];
|
||||
QByteArray rowName = QByteArrayLiteral("separator: ");
|
||||
if (u >= 32 && u < 128)
|
||||
rowName += char(u);
|
||||
else
|
||||
rowName += QByteArrayLiteral("0x") + QByteArray::number(u, 16);
|
||||
QTest::newRow(rowName.constData()) << QString("foo") + QChar(u) + QString("bar") << QString("foo");
|
||||
}
|
||||
}
|
||||
|
||||
void tst_QPlainTextEdit::selectWordsFromStringsContainingSeparators()
|
||||
|
@ -1530,12 +1530,19 @@ void tst_QTextEdit::selectWordsFromStringsContainingSeparators_data()
|
||||
QTest::addColumn<QString>("testString");
|
||||
QTest::addColumn<QString>("selectedWord");
|
||||
|
||||
QStringList wordSeparators;
|
||||
wordSeparators << "." << "," << "?" << "!" << ":" << ";" << "-" << "<" << ">" << "["
|
||||
<< "]" << "(" << ")" << "{" << "}" << "=" << "\t"<< QString(QChar::Nbsp);
|
||||
const ushort wordSeparators[] =
|
||||
{'.', ',', '?', '!', ':', ';', '-', '<', '>', '[', ']', '(', ')', '{', '}',
|
||||
'=', '\t', ushort(QChar::Nbsp)};
|
||||
|
||||
foreach (QString s, wordSeparators)
|
||||
QTest::newRow(QString("separator: " + s).toLocal8Bit()) << QString("foo") + s + QString("bar") << QString("foo");
|
||||
for (size_t i = 0, count = sizeof(wordSeparators) / sizeof(wordSeparators[0]); i < count; ++i) {
|
||||
const ushort u = wordSeparators[i];
|
||||
QByteArray rowName = QByteArrayLiteral("separator: ");
|
||||
if (u >= 32 && u < 128)
|
||||
rowName += char(u);
|
||||
else
|
||||
rowName += QByteArrayLiteral("0x") + QByteArray::number(u, 16);
|
||||
QTest::newRow(rowName.constData()) << QString("foo") + QChar(u) + QString("bar") << QString("foo");
|
||||
}
|
||||
}
|
||||
|
||||
void tst_QTextEdit::selectWordsFromStringsContainingSeparators()
|
||||
|
Loading…
Reference in New Issue
Block a user