From acdd4850a485a0cb8f8f0502cafd65a9f214b2a9 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 20 Oct 2015 16:09:41 +0200 Subject: tests/auto/other: Remove some placeholder formatting. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use QByteArray/QString addition instead in loops and for test row names. Change-Id: Iae76d852a1657bfb6d88e84515f30bd2f1dece6b Reviewed-by: Jędrzej Nowacki --- tests/auto/other/lancelot/paintcommands.cpp | 19 ++++++++-------- .../other/networkselftest/tst_networkselftest.cpp | 4 ++-- .../other/qaccessibility/tst_qaccessibility.cpp | 26 +++++++++++++--------- 3 files changed, 27 insertions(+), 22 deletions(-) diff --git a/tests/auto/other/lancelot/paintcommands.cpp b/tests/auto/other/lancelot/paintcommands.cpp index 4fc41fd649..15454b59d2 100644 --- a/tests/auto/other/lancelot/paintcommands.cpp +++ b/tests/auto/other/lancelot/paintcommands.cpp @@ -650,7 +650,7 @@ template T PaintCommands::image_load(const QString &filepath) QDir dir = fi.absoluteDir(); dir.cdUp(); dir.cd("images"); - QString fileName = QString("%1/%2").arg(dir.absolutePath()).arg(fi.fileName()); + QString fileName = dir.absolutePath() + QLatin1Char('/') + fi.fileName(); t = T(fileName); if (t.isNull() && !fileName.endsWith(".png")) { fileName.append(".png"); @@ -841,10 +841,11 @@ void PaintCommands::command_import(QRegExp re) qPrintable(fi.fileName())); QFileInfo fileinfo(*file); - m_commands[m_currentCommandIndex] = QString("# import file (%1) start").arg(fileinfo.fileName()); + m_commands[m_currentCommandIndex] = QLatin1String("# import file (") + fileinfo.fileName() + + QLatin1String(") start"); QString rawContent = QString::fromUtf8(file->readAll()); QStringList importedData = rawContent.split('\n', QString::SkipEmptyParts); - importedData.append(QString("# import file (%1) end ---").arg(fileinfo.fileName())); + importedData.append(QLatin1String("# import file (") + fileinfo.fileName() + QLatin1String(") end ---")); insertAt(m_currentCommandIndex, importedData); if (m_verboseMode) { @@ -862,13 +863,13 @@ void PaintCommands::command_begin_block(QRegExp re) if (m_verboseMode) printf(" -(lance) begin_block (%s)\n", qPrintable(blockName)); - m_commands[m_currentCommandIndex] = QString("# begin block (%1)").arg(blockName); + m_commands[m_currentCommandIndex] = QLatin1String("# begin block (") + blockName + QLatin1Char(')'); QStringList newBlock; int i = m_currentCommandIndex + 1; for (; i < m_commands.count(); ++i) { const QString &nextCmd = m_commands.at(i); if (nextCmd.startsWith("end_block")) { - m_commands[i] = QString("# end block (%1)").arg(blockName); + m_commands[i] = QLatin1String("# end block (") + blockName + QLatin1Char(')'); break; } newBlock += nextCmd; @@ -905,7 +906,7 @@ void PaintCommands::command_repeat_block(QRegExp re) return; } - m_commands[m_currentCommandIndex] = QString("# repeated block (%1)").arg(blockName); + m_commands[m_currentCommandIndex] = QLatin1String("# repeated block (") + blockName + QLatin1Char(')'); insertAt(m_currentCommandIndex, block); } @@ -946,7 +947,7 @@ void PaintCommands::command_drawPixmap(QRegExp re) QDir dir = fi.absoluteDir(); dir.cdUp(); dir.cd("images"); - QString fileName = QString("%1/%2").arg(dir.absolutePath()).arg(re.cap(1)); + QString fileName = dir.absolutePath() + QLatin1Char('/') + re.cap(1); pm = QPixmap(fileName); if (pm.isNull() && !fileName.endsWith(".png")) { fileName.append(".png"); @@ -995,7 +996,7 @@ void PaintCommands::command_drawImage(QRegExp re) QDir dir = fi.absoluteDir(); dir.cdUp(); dir.cd("images"); - QString fileName = QString("%1/%2").arg(dir.absolutePath()).arg(re.cap(1)); + QString fileName = dir.absolutePath() + QLatin1Char('/') + re.cap(1); im = QImage(fileName); if (im.isNull() && !fileName.endsWith(".png")) { fileName.append(".png"); @@ -1041,7 +1042,7 @@ void PaintCommands::command_drawTiledPixmap(QRegExp re) QDir dir = fi.absoluteDir(); dir.cdUp(); dir.cd("images"); - QString fileName = QString("%1/%2").arg(dir.absolutePath()).arg(re.cap(1)); + QString fileName = dir.absolutePath() + QLatin1Char('/') + re.cap(1); pm = QPixmap(fileName); if (pm.isNull() && !fileName.endsWith(".png")) { fileName.append(".png"); diff --git a/tests/auto/other/networkselftest/tst_networkselftest.cpp b/tests/auto/other/networkselftest/tst_networkselftest.cpp index 7ce385121c..257a7fc03d 100644 --- a/tests/auto/other/networkselftest/tst_networkselftest.cpp +++ b/tests/auto/other/networkselftest/tst_networkselftest.cpp @@ -986,8 +986,8 @@ void tst_NetworkSelfTest::smbServer() static const char contents[] = "This is 34 bytes. Do not change..."; #ifdef Q_OS_WIN // use Windows's native UNC support to try and open a file on the server - QString filepath = QString("\\\\%1\\testshare\\test.pri").arg(QtNetworkSettings::winServerName()); - FILE *f = fopen(filepath.toLatin1(), "rb"); + QByteArray filepath = "\\\\" + QtNetworkSettings::winServerName().toLatin1() + "\\testshare\\test.pri"; + FILE *f = fopen(filepath.constData(), "rb"); QVERIFY2(f, qt_error_string().toLocal8Bit()); char buf[128]; diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp index 142b62ac68..8fe4d976b3 100644 --- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp @@ -573,7 +573,7 @@ static QWidget *createWidgets() int i = 0; box->addWidget(new QComboBox(w)); - box->addWidget(new QPushButton(QString::fromLatin1("widget text %1").arg(i++), w)); + box->addWidget(new QPushButton(QLatin1String("widget text ") + QString::number(i++), w)); box->addWidget(new QHeaderView(Qt::Vertical, w)); box->addWidget(new QTreeView(w)); box->addWidget(new QTreeWidget(w)); @@ -583,25 +583,25 @@ static QWidget *createWidgets() box->addWidget(new QTableWidget(w)); box->addWidget(new QCalendarWidget(w)); box->addWidget(new QDialogButtonBox(w)); - box->addWidget(new QGroupBox(QString::fromLatin1("widget text %1").arg(i++), w)); + box->addWidget(new QGroupBox(QLatin1String("widget text ") + QString::number(i++), w)); box->addWidget(new QFrame(w)); - box->addWidget(new QLineEdit(QString::fromLatin1("widget text %1").arg(i++), w)); + box->addWidget(new QLineEdit(QLatin1String("widget text ") + QString::number(i++), w)); box->addWidget(new QProgressBar(w)); box->addWidget(new QTabWidget(w)); - box->addWidget(new QCheckBox(QString::fromLatin1("widget text %1").arg(i++), w)); - box->addWidget(new QRadioButton(QString::fromLatin1("widget text %1").arg(i++), w)); + box->addWidget(new QCheckBox(QLatin1String("widget text ") + QString::number(i++), w)); + box->addWidget(new QRadioButton(QLatin1String("widget text ") + QString::number(i++), w)); box->addWidget(new QDial(w)); box->addWidget(new QScrollBar(w)); box->addWidget(new QSlider(w)); box->addWidget(new QDateTimeEdit(w)); box->addWidget(new QDoubleSpinBox(w)); box->addWidget(new QSpinBox(w)); - box->addWidget(new QLabel(QString::fromLatin1("widget text %1").arg(i++), w)); + box->addWidget(new QLabel(QLatin1String("widget text ") + QString::number(i++), w)); box->addWidget(new QLCDNumber(w)); box->addWidget(new QStackedWidget(w)); box->addWidget(new QToolBox(w)); - box->addWidget(new QLabel(QString::fromLatin1("widget text %1").arg(i++), w)); - box->addWidget(new QTextEdit(QString::fromLatin1("widget text %1").arg(i++), w)); + box->addWidget(new QLabel(QLatin1String("widget text ") + QString::number(i++), w)); + box->addWidget(new QTextEdit(QLatin1String("widget text ") + QString::number(i++), w)); /* Not in the list * QAbstractItemView, QGraphicsView, QScrollArea, @@ -2322,9 +2322,13 @@ void tst_QAccessibility::lineEditTextFunctions_data() QTest::newRow("char after 6") << "hello" << 2 << (int) QAccessible::CharBoundary << 3 << 6 << -1 << -1 << ""; for (int i = -2; i < 6; ++i) { - QTest::newRow(QString::fromLatin1("line before %1").arg(i).toLocal8Bit().constData()) << "hello" << 0 << (int) QAccessible::LineBoundary << 3 << i << -1 << -1 << ""; - QTest::newRow(QString::fromLatin1("line at %1").arg(i).toLocal8Bit().constData()) << "hello" << 1 << (int) QAccessible::LineBoundary << 3 << i << 0 << 5 << "hello"; - QTest::newRow(QString::fromLatin1("line after %1").arg(i).toLocal8Bit().constData()) << "hello" << 2 << (int) QAccessible::LineBoundary << 3 << i << -1 << -1 << ""; + const QByteArray iB = QByteArray::number(i); + QTest::newRow(("line before " + iB).constData()) + << "hello" << 0 << (int) QAccessible::LineBoundary << 3 << i << -1 << -1 << ""; + QTest::newRow(("line at " + iB).constData()) + << "hello" << 1 << (int) QAccessible::LineBoundary << 3 << i << 0 << 5 << "hello"; + QTest::newRow(("line after " + iB).constData()) + << "hello" << 2 << (int) QAccessible::LineBoundary << 3 << i << -1 << -1 << ""; } } -- cgit v1.2.3