From 8fefe0c5914755d4d2fd60adaab3e800010eb28d Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Fri, 13 Jul 2018 14:02:09 +0200 Subject: [PATCH] QmlProfiler: Fix place markers Using the numerus form requires "%n". Change-Id: I18e32795d6f4f58e9b531e89572351d6520e7e33 Reviewed-by: Oswald Buddenhagen Reviewed-by: Ulf Hermann --- src/plugins/qmlprofiler/memoryusagemodel.cpp | 8 +++----- .../qmlprofiler/tests/memoryusagemodel_test.cpp | 14 ++++++-------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/plugins/qmlprofiler/memoryusagemodel.cpp b/src/plugins/qmlprofiler/memoryusagemodel.cpp index fa7c258b002..1fcfc4631f1 100644 --- a/src/plugins/qmlprofiler/memoryusagemodel.cpp +++ b/src/plugins/qmlprofiler/memoryusagemodel.cpp @@ -116,16 +116,14 @@ QVariantMap MemoryUsageModel::details(int index) const else result.insert(QLatin1String("displayName"), tr("Memory Freed")); - result.insert(tr("Total"), tr("%1 byte(s)", nullptr, toSameSignedInt(ev->size)).arg(ev->size)); + result.insert(tr("Total"), tr("%n byte(s)", nullptr, toSameSignedInt(ev->size))); if (ev->allocations > 0) { - result.insert(tr("Allocated"), tr("%1 byte(s)", nullptr, toSameSignedInt(ev->allocated)) - .arg(ev->allocated)); + result.insert(tr("Allocated"), tr("%n byte(s)", nullptr, toSameSignedInt(ev->allocated))); result.insert(tr("Allocations"), ev->allocations); } if (ev->deallocations > 0) { result.insert(tr("Deallocated"), - tr("%1 byte(s)", nullptr, toSameSignedInt(-ev->deallocated)) - .arg(-ev->deallocated)); + tr("%n byte(s)", nullptr, toSameSignedInt(-ev->deallocated))); result.insert(tr("Deallocations"), ev->deallocations); } QString memoryTypeName; diff --git a/src/plugins/qmlprofiler/tests/memoryusagemodel_test.cpp b/src/plugins/qmlprofiler/tests/memoryusagemodel_test.cpp index faa0dd1e897..804c6d8fb1f 100644 --- a/src/plugins/qmlprofiler/tests/memoryusagemodel_test.cpp +++ b/src/plugins/qmlprofiler/tests/memoryusagemodel_test.cpp @@ -150,9 +150,9 @@ void MemoryUsageModelTest::testDetails() const QVariantMap allocated = model.details(0); QCOMPARE(allocated[QString("displayName")].toString(), model.tr("Memory Allocated")); QCOMPARE(allocated[model.tr("Total")].toString(), - model.tr("%1 byte(s)", nullptr, 4096).arg(4096)); + model.tr("%n byte(s)", nullptr, 4096)); QCOMPARE(allocated[model.tr("Allocated")].toString(), - model.tr("%1 byte(s)", nullptr, 4096).arg(4096)); + model.tr("%n byte(s)", nullptr, 4096)); QCOMPARE(allocated[model.tr("Allocations")].toString(), QString::number(2)); QCOMPARE(allocated[model.tr("Type")].toString(), model.tr("Heap Allocation")); QCOMPARE(allocated[model.tr("Location")].toString(), QmlProfilerModelManager::tr("")); @@ -163,9 +163,9 @@ void MemoryUsageModelTest::testDetails() const QVariantMap large = model.details(2); QCOMPARE(large[QString("displayName")].toString(), model.tr("Memory Allocated")); QCOMPARE(large[model.tr("Total")].toString(), - model.tr("%1 byte(s)", nullptr, 5120).arg(5120)); + model.tr("%n byte(s)", nullptr, 5120)); QCOMPARE(large[model.tr("Allocated")].toString(), - model.tr("%1 byte(s)", nullptr, 1024).arg(1024)); + model.tr("%n byte(s)", nullptr, 1024)); QCOMPARE(large[model.tr("Allocations")].toString(), QString::number(1)); QCOMPARE(large[model.tr("Type")].toString(), model.tr("Large Item Allocation")); QCOMPARE(large[model.tr("Location")].toString(), QmlProfilerModelManager::tr("")); @@ -175,10 +175,8 @@ void MemoryUsageModelTest::testDetails() const QVariantMap freed = model.details(9); QCOMPARE(freed[QString("displayName")].toString(), model.tr("Memory Freed")); - QCOMPARE(freed[model.tr("Total")].toString(), - model.tr("%1 byte(s)", nullptr, 2048).arg(2048)); - QCOMPARE(freed[model.tr("Deallocated")].toString(), - model.tr("%1 byte(s)", nullptr, 1024).arg(1024)); + QCOMPARE(freed[model.tr("Total")].toString(), model.tr("%n byte(s)", nullptr, 2048)); + QCOMPARE(freed[model.tr("Deallocated")].toString(), model.tr("%n byte(s)", nullptr, 1024)); QCOMPARE(freed[model.tr("Deallocations")].toString(), QString::number(1)); QCOMPARE(freed[model.tr("Type")].toString(), model.tr("Heap Usage")); QCOMPARE(freed[model.tr("Location")].toString(), QmlProfilerModelManager::tr(""));