summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/kernel
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-10-16 09:38:51 +0200
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-10-19 12:39:16 +0000
commit52d5b272394f5d1fd84d5c44af78e3b87d264766 (patch)
tree2f03119fab864c4ce41e83185f3c317e647484c4 /tests/auto/widgets/kernel
parent240d768ca6ef41bf661a1fb8e1bde408e25ba553 (diff)
tests/auto/widgets: Remove some placeholder formatting.
Use QByteArray/QString addition instead in loops and for test row names. Change-Id: Ia067cd966bf13506e6ca19925eae3158da027b83 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
Diffstat (limited to 'tests/auto/widgets/kernel')
-rw-r--r--tests/auto/widgets/kernel/qaction/tst_qaction.cpp4
-rw-r--r--tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp5
-rw-r--r--tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp2
-rw-r--r--tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp10
-rw-r--r--tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp7
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp2
6 files changed, 17 insertions, 13 deletions
diff --git a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp
index 71b55d71ea..02276e7651 100644
--- a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp
+++ b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp
@@ -334,9 +334,9 @@ void tst_QAction::task200823_tooltip()
action->setShortcut(shortcut);
// we want a non-standard tooltip that shows the shortcut
- action->setToolTip(QString("%1 (%2)").arg(action->text()).arg(action->shortcut().toString()));
+ action->setToolTip(action->text() + QLatin1String(" (") + action->shortcut().toString() + QLatin1Char(')'));
- QString ref = QString("foo (%1)").arg(QKeySequence(shortcut).toString());
+ QString ref = QLatin1String("foo (") + QKeySequence(shortcut).toString() + QLatin1Char(')');
QCOMPARE(action->toolTip(), ref);
}
diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
index 8f8b4313e2..1257a3f420 100644
--- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
+++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
@@ -400,11 +400,12 @@ void tst_QApplication::setFont_data()
if (!sizes.size())
sizes = fdb.standardSizes();
if (sizes.size() > 0) {
- QTest::newRow(QString("data%1a").arg(cnt).toLatin1().constData())
+ const QByteArray cntB = QByteArray::number(cnt);
+ QTest::newRow(("data" + cntB + "a").constData())
<< family
<< sizes.first()
<< false;
- QTest::newRow(QString("data%1b").arg(cnt).toLatin1().constData())
+ QTest::newRow(("data" + cntB + "b").constData())
<< family
<< sizes.first()
<< true;
diff --git a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
index 6b27b4ffb6..dc3be524f8 100644
--- a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
+++ b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
@@ -184,7 +184,7 @@ void tst_QFormLayout::getItemPosition()
QList<QLabel*> labels;
QList<QLineEdit*> fields;
for (int i = 0; i < 5; ++i) {
- labels.append(new QLabel(QString("Label %1").arg(i+1)));
+ labels.append(new QLabel(QLatin1String("Label " ) + QString::number(i + 1)));
fields.append(new QLineEdit);
fl->addRow(labels[i], fields[i]);
}
diff --git a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp
index 1e67c675ef..0ad8e30351 100644
--- a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp
+++ b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp
@@ -538,7 +538,8 @@ public:
}
private:
void init(int numPixels = -1){
- setText(QString::fromLatin1("(%1,%2)").arg(sh.width()).arg(sh.height()));
+ setText(QLatin1Char('(') + QString::number(sh.width())
+ + QLatin1Char(',') + QString::number(sh.height()) + QLatin1Char(')'));
setFrameStyle(QFrame::Box | QFrame::Plain);
setNumberOfPixels(numPixels);
}
@@ -1432,8 +1433,9 @@ void tst_QGridLayout::layoutSpacing_data()
w->setLayout(layout);
int pw = up->sizeHint().width();
int ph = up->sizeHint().height();
- QByteArray testName = QString::fromLatin1("arrowpad with %1 empty rows, %2 empty columns").arg(yoff).arg(xoff).toLatin1();
- QTest::newRow(testName.data())
+ QByteArray testName = "arrowpad with " + QByteArray::number(yoff)
+ + " empty rows, " + QByteArray::number(xoff) + " empty columns";
+ QTest::newRow(testName.constData())
<< w << (PointList()
<< QPoint(0 + pw + 5, 3)
<< QPoint(0, 3 + ph + 10)
@@ -1686,7 +1688,7 @@ void tst_QGridLayout::replaceWidget()
for (int n = 0; n < itemCount; ++n) {
int x = n % 3;
int y = n / 3;
- labels[n] = new QLabel(QString("label %1").arg(n));
+ labels[n] = new QLabel(QLatin1String("label ") + QString::number(n));
Qt::Alignment align = (n % 3 ? Qt::AlignLeft : Qt::AlignRight);
l->addWidget(labels[n], x * 3, y * 3, (n % 2) + 1, (n + 1) % 2 + 1, align);
}
diff --git a/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp b/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp
index f206a5fe9a..5641e60078 100644
--- a/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp
+++ b/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp
@@ -180,12 +180,13 @@ protected:
QKeyEvent *ke = static_cast<QKeyEvent*>(e);
if (ke->modifiers() && ke->key() > Qt::Key_Any
&& ke->key() < Qt::Key_ydiaeresis) {
+ const QChar c = QLatin1Char(char(ke->key()));
if (ke->modifiers() == Qt::ControlModifier)
- insertPlainText(QString("<Ctrl+%1>").arg(char(ke->key())));
+ insertPlainText(QLatin1String("<Ctrl+") + c + QLatin1Char('>'));
else if (ke->modifiers() == Qt::AltModifier)
- insertPlainText(QString("<Alt+%1>").arg(char(ke->key())));
+ insertPlainText(QLatin1String("<Alt+") + c + QLatin1Char('>'));
else if (ke->modifiers() == Qt::ShiftModifier)
- insertPlainText(QString("<Shift+%1>").arg(char(ke->key())));
+ insertPlainText(QLatin1String("<Shift+") + c + QLatin1Char('>'));
return true;
}
}
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index f3f4467b80..eb39f8fff8 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -5644,7 +5644,7 @@ void tst_QWidget::setToolTip()
for (int pass = 0; pass < 2; ++pass) {
QCursor::setPos(0, 0);
QScopedPointer<QWidget> popup(new QWidget(0, Qt::Popup));
- popup->setObjectName(QString::fromLatin1("tst_qwidget setToolTip #%1").arg(pass));
+ popup->setObjectName(QLatin1String("tst_qwidget setToolTip #") + QString::number(pass));
popup->setWindowTitle(popup->objectName());
popup->setGeometry(50, 50, 150, 50);
QFrame *frame = new QFrame(popup.data());