tests/auto/corelib/codecs: clean up
- port Q_FOREACH to C++11 range-for - port uses of inefficient QLists to QVector Fixes errors pointed out by my tree's static checks. Change-Id: Ica50f44d862f635df06cb8f09ce506b9d30fdfc5 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
parent
e38064f698
commit
964290126e
@ -332,7 +332,8 @@ void tst_QTextCodec::codecForLocale()
|
||||
|
||||
// find a codec that is not the codecForLocale()
|
||||
QTextCodec *codec2 = 0;
|
||||
foreach (int mib, QTextCodec::availableMibs()) {
|
||||
const auto availableMibs = QTextCodec::availableMibs();
|
||||
for (int mib : availableMibs ) {
|
||||
if (mib != codec->mibEnum()) {
|
||||
codec2 = QTextCodec::codecForMib(mib);
|
||||
if (codec2)
|
||||
@ -2148,7 +2149,7 @@ public:
|
||||
void tst_QTextCodec::threadSafety()
|
||||
{
|
||||
QList<QByteArray> codecList = QTextCodec::availableCodecs();
|
||||
QList<int> mibList = QTextCodec::availableMibs();
|
||||
const QVector<int> mibList = QTextCodec::availableMibs().toVector();
|
||||
QThreadPool::globalInstance()->setMaxThreadCount(12);
|
||||
|
||||
QVector<QByteArray> res;
|
||||
@ -2167,7 +2168,7 @@ void tst_QTextCodec::threadSafety()
|
||||
QThreadPool::globalInstance()->waitForDone();
|
||||
|
||||
QCOMPARE(res.toList(), codecList);
|
||||
QCOMPARE(res2.toList(), mibList);
|
||||
QCOMPARE(res2, mibList);
|
||||
}
|
||||
|
||||
void tst_QTextCodec::invalidNames()
|
||||
@ -2189,10 +2190,9 @@ void tst_QTextCodec::invalidNames()
|
||||
void tst_QTextCodec::checkAliases_data()
|
||||
{
|
||||
QTest::addColumn<QByteArray>("codecName");
|
||||
QList<QByteArray> codecList = QTextCodec::availableCodecs();
|
||||
foreach (const QByteArray &a, codecList) {
|
||||
const QList<QByteArray> codecList = QTextCodec::availableCodecs();
|
||||
for (const QByteArray &a : codecList)
|
||||
QTest::newRow( a.constData() ) << a;
|
||||
}
|
||||
}
|
||||
|
||||
void tst_QTextCodec::checkAliases()
|
||||
@ -2203,7 +2203,8 @@ void tst_QTextCodec::checkAliases()
|
||||
QCOMPARE(QTextCodec::codecForName(codecName), c);
|
||||
QCOMPARE(QTextCodec::codecForName(c->name()), c);
|
||||
|
||||
foreach(const QByteArray &a, c->aliases()) {
|
||||
const auto aliases = c->aliases();
|
||||
for (const QByteArray &a : aliases) {
|
||||
QCOMPARE(QTextCodec::codecForName(a), c);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user